query_name
stringlengths 13
55
| code_file_path
stringlengths 14
194
| context_blocks
list | answer_spans
list | supporting_fact_spans
list | example_type
int8 0
1
| single_hop
bool 2
classes | subtokenized_input_sequence
sequence | label_sequence
sequence |
---|---|---|---|---|---|---|---|---|
Unused local variable | tucker777/QSTK/qstksim/tests/test_tradesim_SPY.py | [
{
"content": " def test_buy_close(self):\n ''' Tests tradesim buy-on-open functionality '''\n (df_funds, ts_leverage, f_commision, f_slippage, f_borrow) = \\\n qstksim.tradesim( self.df_alloc, self.df_close, 10000, 1, True, 0.02,\n 5, 0.02)\n\n print 'Commision Costs : ' + str(f_commision)\n print 'Slippage : ' + str(f_slippage)\n print 'Short Borrowing Cost : ' + str(f_borrow)\n print 'Leverage : '\t\n print ts_leverage\n np.testing.assert_approx_equal(df_funds[-1], \\\n 10000 * self.i_open_result, significant = 3)\n self.assertTrue(True)\n #self.assertTrue(abs(df_funds[-1] - 10000 * self.i_open_result)<=0.01)",
"metadata": "root.Test.test_buy_close",
"header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 67
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"buy",
"\\u",
"close_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
" ",
"Test",
"s",
" ",
"trades",
"im",
" ",
"buy",
"-",
"on",
"-",
"open",
" ",
"functional",
"it",
"y",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"df",
"\\u",
"funds",
"_",
",_",
"ts",
"\\u",
"leve",
"rage_",
",_",
"f",
"\\u",
"comm",
"isi",
"on_",
",_",
"f",
"\\u",
"slip",
"page_",
",_",
"f",
"\\u",
"borrow",
"_",
")_",
"=_",
"qst",
"ksi",
"m_",
"._",
"trades",
"im_",
"(_",
"self_",
"._",
"df",
"\\u",
"alloc_",
",_",
"self_",
"._",
"df",
"\\u",
"close_",
",_",
"10000_",
",_",
"1_",
",_",
"True_",
",_",
"0.02_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"5_",
",_",
"0.02_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'",
"Commi",
"sion",
" ",
"Cost",
"s",
" ",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"f",
"\\u",
"comm",
"isi",
"on_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Sli",
"ppa",
"ge",
" ",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"f",
"\\u",
"slip",
"page_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Short",
" ",
"Bor",
"row",
"ing",
" ",
"Cost",
" ",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"f",
"\\u",
"borrow",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Leve",
"rage",
" ",
":",
" ",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"ts",
"\\u",
"leve",
"rage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"np_",
"._",
"testing_",
"._",
"assert",
"\\u",
"approx",
"\\u",
"equal_",
"(_",
"df",
"\\u",
"funds",
"_",
"[_",
"-_",
"1_",
"]_",
",_",
"10000_",
"*_",
"self_",
"._",
"i",
"\\u",
"open",
"\\u",
"result_",
",_",
"significant",
"_",
"=_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"self",
".",
"assert",
"Tru",
"e",
"(",
"abs",
"(",
"df",
"\\u",
"funds",
"[-",
"1",
"]",
" ",
"-",
" ",
"10000",
" ",
"*",
" ",
"self",
".",
"i",
"\\u",
"open",
"\\u",
"result",
")<",
"=",
"0.01",
")_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | bayespy/bayespy/bayespy/inference/vmp/nodes/tests/test_gaussian_markov_chain.py | [
{
"content": "################################################################################\n# Copyright (C) 2013-2014 Jaakko Luttinen\n#\n# This file is licensed under the MIT License.\n################################################################################\n\n\n\"\"\"\nUnit tests for gaussian_markov_chain module.\n\"\"\"\n\nimport numpy as np\n\nfrom ..gaussian_markov_chain import GaussianMarkovChain\nfrom ..gaussian_markov_chain import VaryingGaussianMarkovChain\nfrom ..gaussian import Gaussian, GaussianMoments\nfrom ..gaussian import GaussianARD\nfrom ..wishart import Wishart, WishartMoments\nfrom ..gamma import Gamma, GammaMoments\n\nfrom bayespy.utils import random\nfrom bayespy.utils import linalg\nfrom bayespy.utils import misc\n\nfrom bayespy.utils.misc import TestCase\n\n\n\n\n\n\n \n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def kalman_filter(y, U, A, V, mu0, Cov0, out=None):\n \"\"\"\n Perform Kalman filtering to obtain filtered mean and covariance.\n\n The parameters of the process may vary in time, thus they are\n given as iterators instead of fixed values.\n\n Parameters\n ----------\n y : (N,D) array\n \"Normalized\" noisy observations of the states, that is, the\n observations multiplied by the precision matrix U (and possibly\n other transformation matrices).\n U : (N,D,D) array or N-list of (D,D) arrays\n Precision matrix (i.e., inverse covariance matrix) of the observation \n noise for each time instance.\n A : (N-1,D,D) array or (N-1)-list of (D,D) arrays\n Dynamic matrix for each time instance.\n V : (N-1,D,D) array or (N-1)-list of (D,D) arrays\n Covariance matrix of the innovation noise for each time instance.\n\n Returns\n -------\n mu : array\n Filtered mean of the states.\n Cov : array\n Filtered covariance of the states.\n\n See also\n --------\n rts_smoother\n \"\"\"\n mu = mu0\n Cov = Cov0\n\n # Allocate memory for the results\n (N,D) = np.shape(y)\n X = np.empty((N,D))\n CovX = np.empty((N,D,D))\n\n # Update step for t=0\n M = np.dot(np.dot(Cov, U[0]), Cov) + Cov\n L = linalg.chol(M)\n mu = np.dot(Cov, linalg.chol_solve(L, np.dot(Cov,y[0]) + mu))\n Cov = np.dot(Cov, linalg.chol_solve(L, Cov))\n X[0,:] = mu\n CovX[0,:,:] = Cov\n\n #for (yn, Un, An, Vn) in zip(y, U, A, V):\n for n in range(len(y)-1): #(yn, Un, An, Vn) in zip(y, U, A, V):\n # Prediction step\n mu = np.dot(A[n], mu)\n Cov = np.dot(np.dot(A[n], Cov), A[n].T) + V[n]\n # Update step\n M = np.dot(np.dot(Cov, U[n+1]), Cov) + Cov\n L = linalg.chol(M)\n mu = np.dot(Cov, linalg.chol_solve(L, np.dot(Cov,y[n+1]) + mu))\n Cov = np.dot(Cov, linalg.chol_solve(L, Cov))\n\n # Force symmetric covariance (for numeric inaccuracy)\n Cov = 0.5*Cov + 0.5*Cov.T\n\n # Store results\n X[n+1,:] = mu\n CovX[n+1,:,:] = Cov\n\n return (X, CovX)",
"metadata": "root.kalman_filter",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": "def rts_smoother(mu, Cov, A, V, removethis=None):\n \"\"\"\n Perform Rauch-Tung-Striebel smoothing to obtain the posterior.\n\n The function returns the posterior mean and covariance of each\n state. The parameters of the process may vary in time, thus they\n are given as iterators instead of fixed values.\n\n Parameters\n ----------\n mu : (N,D) array\n Mean of the states from Kalman filter.\n Cov : (N,D,D) array\n Covariance of the states from Kalman filter. \n A : (N-1,D,D) array or (N-1)-list of (D,D) arrays\n Dynamic matrix for each time instance.\n V : (N-1,D,D) array or (N-1)-list of (D,D) arrays\n Covariance matrix of the innovation noise for each time instance.\n\n Returns\n -------\n mu : array\n Posterior mean of the states.\n Cov : array\n Posterior covariance of the states.\n\n See also\n --------\n kalman_filter\n \"\"\"\n\n N = len(mu)\n #n = N-1\n\n # Start from the last time instance and smoothen backwards\n x = mu[-1,:]\n Covx = Cov[-1,:,:]\n\n for n in reversed(range(N-1)):#(An, Vn) in zip(reversed(A), reversed(V)):\n\n #n = n - 1\n #if n <= 0:\n # break\n\n # The predicted value of n\n x_p = np.dot(A[n], mu[n,:])\n Cov_p = np.dot(np.dot(A[n], Cov[n,:,:]), A[n].T) + V[n]\n\n # Temporary variable\n S = np.linalg.solve(Cov_p, np.dot(A[n], Cov[n,:,:]))\n\n # Smoothed value of n\n x = mu[n,:] + np.dot(S.T, x-x_p)\n Covx = Cov[n,:,:] + np.dot(np.dot(S.T, Covx-Cov_p), S)\n\n # Force symmetric covariance (for numeric inaccuracy)\n Covx = 0.5*Covx + 0.5*Covx.T\n\n # Store results\n mu[n,:] = x\n Cov[n,:] = Covx\n\n\n return (mu, Cov)",
"metadata": "root.rts_smoother",
"header": "['module', '___EOS___']",
"index": 96
},
{
"content": "class TestGaussianMarkovChain(TestCase):\n\n \n\n\n\n\n\n\n \n \n",
"metadata": "root.TestGaussianMarkovChain",
"header": "['module', '___EOS___']",
"index": 162
},
{
"content": " def create_model(self, N, D):\n\n # Construct the model\n Mu = Gaussian(np.random.randn(D),\n np.identity(D))\n Lambda = Wishart(D,\n random.covariance(D))\n A = Gaussian(np.random.randn(D,D),\n np.identity(D))\n V = Gamma(D,\n np.random.rand(D))\n X = GaussianMarkovChain(Mu, Lambda, A, V, n=N)\n Y = Gaussian(X, np.identity(D))\n\n return (Y, X, Mu, Lambda, A, V)",
"metadata": "root.TestGaussianMarkovChain.create_model",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 164
},
{
"content": " def test_plates(self):\n \"\"\"\n Test that plates are handled correctly.\n \"\"\"",
"metadata": "root.TestGaussianMarkovChain.test_plates",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 181
},
{
"content": " def test_message_to_mu0(self):\n pass",
"metadata": "root.TestGaussianMarkovChain.test_message_to_mu0",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 186
},
{
"content": " def test_message_to_Lambda0(self):\n pass",
"metadata": "root.TestGaussianMarkovChain.test_message_to_Lambda0",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 189
},
{
"content": " def test_message_to_A(self):\n pass",
"metadata": "root.TestGaussianMarkovChain.test_message_to_A",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 192
},
{
"content": " def test_message_to_v(self):\n pass",
"metadata": "root.TestGaussianMarkovChain.test_message_to_v",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 195
},
{
"content": " def test_message_to_child(self):\n \"\"\"\n Test the updating of GaussianMarkovChain.\n\n Check that the moments and the lower bound contribution are computed\n correctly.\n \"\"\"\n\n # TODO: Add plates and missing values!\n\n # Dimensionalities\n D = 3\n N = 5\n (Y, X, Mu, Lambda, A, V) = self.create_model(N, D)\n\n # Inference with arbitrary observations\n y = np.random.randn(N,D)\n Y.observe(y)\n X.update()\n (x_vb, xnxn_vb, xpxn_vb) = X.get_moments()\n\n # Get parameter moments\n (mu0, mumu0) = Mu.get_moments()\n (icov0, logdet0) = Lambda.get_moments()\n (a, aa) = A.get_moments()\n (icov_x, logdetx) = V.get_moments()\n icov_x = np.diag(icov_x)\n # Prior precision\n Z = np.einsum('...kij,...kk->...ij', aa, icov_x)\n U_diag = [icov0+Z] + (N-2)*[icov_x+Z] + [icov_x]\n U_super = (N-1) * [-np.dot(a.T, icov_x)]\n U = misc.block_banded(U_diag, U_super)\n # Prior mean\n mu_prior = np.zeros(D*N)\n mu_prior[:D] = np.dot(icov0,mu0)\n # Data \n Cov = np.linalg.inv(U + np.identity(D*N))\n mu = np.dot(Cov, mu_prior + y.flatten())\n # Moments\n xx = mu[:,np.newaxis]*mu[np.newaxis,:] + Cov\n mu = np.reshape(mu, (N,D))\n xx = np.reshape(xx, (N,D,N,D))\n\n # Check results\n self.assertAllClose(x_vb, mu,\n msg=\"Incorrect mean\")\n for n in range(N):\n self.assertAllClose(xnxn_vb[n,:,:], xx[n,:,n,:],\n msg=\"Incorrect second moment\")\n for n in range(N-1):\n self.assertAllClose(xpxn_vb[n,:,:], xx[n,:,n+1,:],\n msg=\"Incorrect lagged second moment\")\n\n\n # Compute the entropy H(X)\n ldet = linalg.logdet_cov(Cov)\n H = random.gaussian_entropy(-ldet, N*D)\n # Compute <log p(X|...)>\n xx = np.reshape(xx, (N*D, N*D))\n mu = np.reshape(mu, (N*D,))\n ldet = -logdet0 - np.sum(np.ones((N-1,D))*logdetx)\n P = random.gaussian_logpdf(np.einsum('...ij,...ij', \n xx, \n U),\n np.einsum('...i,...i', \n mu, \n mu_prior),\n np.einsum('...ij,...ij', \n mumu0,\n icov0),\n -ldet,\n N*D)\n \n # The VB bound from the net\n l = X.lower_bound_contribution()\n\n self.assertAllClose(l, H+P)\n \n\n # Compute the true bound <log p(X|...)> + H(X)\n\n\n #\n # Simple tests\n #\n\n def check(N, D, plates=None, mu=None, Lambda=None, A=None, V=None):\n if mu is None:\n mu = np.random.randn(D)\n if Lambda is None:\n Lambda = random.covariance(D)\n if A is None:\n A = np.random.randn(D,D)\n if V is None:\n V = np.random.rand(D)\n X = GaussianMarkovChain(mu,\n Lambda,\n A,\n V,\n plates=plates,\n n=N)\n (u0, u1, u2) = X._message_to_child()\n (mu, mumu) = Gaussian._ensure_moments(mu, GaussianMoments, ndim=1).get_moments()\n (Lambda, _) = Wishart._ensure_moments(Lambda, WishartMoments, ndim=1).get_moments()\n (a, aa) = Gaussian._ensure_moments(A, GaussianMoments, ndim=1).get_moments()\n a = a * np.ones((N-1,D,D)) # explicit broadcasting for simplicity\n aa = aa * np.ones((N-1,D,D,D)) # explicit broadcasting for simplicity\n (v, _) = Gamma._ensure_moments(V, GammaMoments).get_moments()\n v = v * np.ones((N-1,D))\n plates_C = X.plates\n plates_mu = X.plates\n C = np.zeros(plates_C + (N,D,N,D))\n plates_mu = np.shape(mu)[:-1]\n m = np.zeros(plates_mu + (N,D))\n m[...,0,:] = np.einsum('...ij,...j->...i', Lambda, mu)\n C[...,0,:,0,:] = Lambda + np.einsum('...dij,...d->...ij',\n aa[...,0,:,:,:],\n v[...,0,:])\n for n in range(1,N-1):\n C[...,n,:,n,:] = (np.einsum('...dij,...d->...ij',\n aa[...,n,:,:,:],\n v[...,n,:])\n + v[...,n,:,None] * np.identity(D))\n for n in range(N-1):\n C[...,n,:,n+1,:] = -np.einsum('...di,...d->...id',\n a[...,n,:,:],\n v[...,n,:])\n C[...,n+1,:,n,:] = -np.einsum('...di,...d->...di',\n a[...,n,:,:],\n v[...,n,:])\n C[...,-1,:,-1,:] = v[...,-1,:,None]*np.identity(D)\n C = np.reshape(C, plates_C+(N*D,N*D))\n Cov = np.linalg.inv(C)\n Cov = np.reshape(Cov, plates_C+(N,D,N,D))\n m0 = np.einsum('...minj,...nj->...mi', Cov, m)\n m1 = np.zeros(plates_C+(N,D,D))\n m2 = np.zeros(plates_C+(N-1,D,D))\n for n in range(N):\n m1[...,n,:,:] = Cov[...,n,:,n,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n,:])\n for n in range(N-1):\n m2[...,n,:,:] = Cov[...,n,:,n+1,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n+1,:])\n self.assertAllClose(m0, u0*np.ones(np.shape(m0)))\n self.assertAllClose(m1, u1*np.ones(np.shape(m1)))\n self.assertAllClose(m2, u2*np.ones(np.shape(m2)))\n\n pass\n\n check(4,1)\n check(4,3)\n\n #\n # Test mu\n #\n\n # Simple\n check(4,3,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3)))\n # Plates\n check(4,3,\n mu=Gaussian(np.random.randn(5,6,3),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=(5,)))\n check(4,3,\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=()))\n check(4,3,\n plates=(5,),\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test Lambda\n #\n \n # Simple\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3)))\n # Plates\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,)))\n check(4,3,\n Lambda=Wishart(10+np.random.rand(1),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=()))\n check(4,3,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test A\n #\n\n # Simple\n check(4,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(3,)))\n # Plates on time axis\n check(5,3,\n A=GaussianARD(np.random.randn(4,3,3),\n np.random.rand(4,3,3),\n shape=(3,),\n plates=(4,3)))\n # Plates on time axis with broadcasted moments\n check(5,3,\n A=GaussianARD(np.random.randn(1,3,3),\n np.random.rand(1,3,3),\n shape=(3,),\n plates=(4,3)))\n check(5,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(4,3)))\n # Plates\n check(4,3,\n A=GaussianARD(np.random.randn(5,6,1,3,3),\n np.random.rand(5,6,1,3,3),\n shape=(3,),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(5,1,3)))\n check(4,3,\n A=GaussianARD(np.random.randn(1,1,3,3),\n np.random.rand(1,1,3,3),\n shape=(3,),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(3,)))\n check(4,3,\n plates=(5,),\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(1,1,3)))\n\n #\n # Test v\n #\n \n # Simple\n check(4,3,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,\n V=Gamma(np.random.rand(3),\n np.random.rand(3),\n plates=(3,)))\n # Plates\n check(4,3,\n V=Gamma(np.random.rand(5,6,1,3),\n np.random.rand(5,6,1,3),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(5,1,3)))\n check(4,3,\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,\n plates=(5,),\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(1,1,3)))\n\n #\n # Check with input signals\n #\n\n mu = 2\n Lambda = 3\n A = 4\n B = 5\n v = 6\n inputs = [[-2], [3]]\n X = GaussianMarkovChain([mu], [[Lambda]], [[A,B]], [v], inputs=inputs)\n V = (np.array([[v*A**2, -v*A, 0],\n [-v*A, v*A**2, -v*A],\n [0, -v*A, 0]]) +\n np.array([[Lambda, 0, 0],\n [0, v, 0],\n [0, 0, v]]))\n m = (np.array([Lambda*mu, 0, 0]) +\n np.array([0, v*B*inputs[0][0], v*B*inputs[1][0]]) -\n np.array([v*A*B*inputs[0][0], v*A*B*inputs[1][0], 0]))\n Cov = np.linalg.inv(V)\n mean = np.dot(Cov, m)\n\n X.update()\n u = X.get_moments()\n\n self.assertAllClose(u[0], mean[:,None])\n self.assertAllClose(u[1] - u[0][...,None,:]*u[0][...,:,None],\n Cov[(0,1,2),(0,1,2),None,None])\n self.assertAllClose(u[2] - u[0][...,:-1,:,None]*u[0][...,1:,None,:],\n Cov[(0,1),(1,2),None,None])\n\n pass",
"metadata": "root.TestGaussianMarkovChain.test_message_to_child",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 198
},
{
"content": " def test_smoothing(self):\n \"\"\"\n Test the posterior estimation of GaussianMarkovChain.\n\n Create time-variant dynamics and compare the results of BayesPy VB\n inference and standard Kalman filtering & smoothing.\n\n This is not that useful anymore, because the moments are checked much\n better in another test method.\n \"\"\"\n\n #\n # Set up an artificial system\n #\n\n # Dimensions\n N = 500\n D = 2\n # Dynamics (time varying)\n A0 = np.array([[.9, -.4], [.4, .9]])\n A1 = np.array([[.98, -.1], [.1, .98]])\n l = np.linspace(0, 1, N-1).reshape((-1,1,1))\n A = (1-l)*A0 + l*A1\n # Innovation covariance matrix (time varying)\n v = np.random.rand(D)\n V = np.diag(v)\n # Observation noise covariance matrix\n C = np.identity(D)\n\n #\n # Simulate data\n #\n \n X = np.empty((N,D))\n Y = np.empty((N,D))\n\n x = np.array([0.5, -0.5])\n X[0,:] = x\n Y[0,:] = x + np.random.multivariate_normal(np.zeros(D), C)\n for n in range(N-1):\n x = np.dot(A[n,:,:],x) + np.random.multivariate_normal(np.zeros(D), V)\n X[n+1,:] = x\n Y[n+1,:] = x + np.random.multivariate_normal(np.zeros(D), C)\n\n #\n # BayesPy inference\n #\n\n # Construct VB model\n Xh = GaussianMarkovChain(np.zeros(D), np.identity(D), A, 1/v, n=N)\n Yh = Gaussian(Xh, np.identity(D), plates=(N,))\n # Put data \n Yh.observe(Y)\n # Run inference\n Xh.update()\n # Store results\n Xh_vb = Xh.u[0]\n CovXh_vb = Xh.u[1] - Xh_vb[...,np.newaxis,:] * Xh_vb[...,:,np.newaxis]\n\n #\n # \"The ground truth\" using standard Kalman filter and RTS smoother\n #\n V = N*(V,)\n UY = Y\n U = N*(C,)\n (Xh, CovXh) = kalman_filter(UY, U, A, V, np.zeros(D), np.identity(D))\n (Xh, CovXh) = rts_smoother(Xh, CovXh, A, V)\n\n #\n # Check results\n #\n self.assertTrue(np.allclose(Xh_vb, Xh))\n self.assertTrue(np.allclose(CovXh_vb, CovXh))",
"metadata": "root.TestGaussianMarkovChain.test_smoothing",
"header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 553
},
{
"content": "class TestVaryingGaussianMarkovChain(TestCase):\n\n\n\n\n\n\n",
"metadata": "root.TestVaryingGaussianMarkovChain",
"header": "['module', '___EOS___']",
"index": 628
},
{
"content": " def test_plates_from_parents(self):\n \"\"\"\n Test that VaryingGaussianMarkovChain deduces plates correctly\n \"\"\"\n def check(plates_X,\n plates_mu=(),\n plates_Lambda=(),\n plates_B=(),\n plates_S=(),\n plates_v=()):\n \n D = 3\n K = 2\n N = 4\n\n np.random.seed(42)\n mu = Gaussian(np.random.randn(*(plates_mu+(D,))),\n random.covariance(D))\n Lambda = Wishart(D+np.ones(plates_Lambda),\n random.covariance(D))\n B = GaussianARD(np.random.randn(*(plates_B+(D,D,K))),\n 1+np.random.rand(*(plates_B+(D,D,K))),\n shape=(D,K),\n plates=plates_B+(D,))\n S = GaussianARD(np.random.randn(*(plates_S+(N,K))),\n 1+np.random.rand(*(plates_S+(N,K))),\n shape=(K,),\n plates=plates_S+(N,))\n v = Gamma(1+np.random.rand(*(plates_v+(1,D))),\n 1+np.random.rand(*(plates_v+(1,D))))\n X = VaryingGaussianMarkovChain(mu, Lambda, B, S, v, name=\"X\")\n self.assertEqual(plates_X, X.plates,\n msg=\"Incorrect plates deduced\")\n pass\n\n check(())\n check((2,3),\n plates_mu=(2,3))\n check((6,7),\n plates_Lambda=(6,7))\n check((2,3),\n plates_B=(2,3))\n check((2,3),\n plates_S=(2,3))\n check((2,3),\n plates_v=(2,3))\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_plates_from_parents",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 630
},
{
"content": " def test_message_to_child(self):\n\n # A very simple check before the more complex ones:\n # 1-D process, k=1, fixed constant parameters\n m = 1.0\n l = 4.0\n b = 2.0\n s = [3.0, 8.0]\n v = 5.0\n X = VaryingGaussianMarkovChain([m],\n [[l]],\n [[[b]]],\n [[s[0]],[s[1]]],\n [v])\n (u0, u1, u2) = X._message_to_child()\n C = np.array([[l+b**2*s[0]**2*v, -b*s[0]*v, 0],\n [ -b*s[0]*v, v+b**2*s[1]**2*v, -b*s[1]*v],\n [ 0, -b*s[1]*v, v]])\n Cov = np.linalg.inv(C)\n m0 = np.dot(Cov, [[l*m], [0], [0]])\n m1 = np.diag(Cov)[:,None,None] + m0[:,:,None]**2\n m2 = np.diag(Cov, k=1)[:,None,None] + m0[1:,:,None]*m0[:-1,:,None]\n self.assertAllClose(m0, u0)\n self.assertAllClose(m1, u1)\n self.assertAllClose(m2, u2)\n\n def check(N, D, K, plates=None, mu=None, Lambda=None, B=None, S=None, V=None):\n if mu is None:\n mu = np.random.randn(D)\n if Lambda is None:\n Lambda = random.covariance(D)\n if B is None:\n B = np.random.randn(D,D,K)\n if S is None:\n S = np.random.randn(N-1,K)\n if V is None:\n V = np.random.rand(D)\n X = VaryingGaussianMarkovChain(mu,\n Lambda,\n B,\n S,\n V,\n plates=plates,\n n=N)\n (u0, u1, u2) = X._message_to_child()\n (mu, mumu) = X.parents[0].get_moments()\n (Lambda, _) = X.parents[1].get_moments()\n (b, bb) = X.parents[2].get_moments()\n (s, ss) = X.parents[3].get_moments()\n (v, _) = X.parents[4].get_moments()\n v = v * np.ones((N-1,D))\n #V = np.atleast_3d(v)[...,-1,:,None]*np.identity(D)\n plates_C = X.plates\n plates_mu = X.plates\n C = np.zeros(plates_C + (N,D,N,D))\n plates_mu = np.shape(mu)[:-1]\n m = np.zeros(plates_mu + (N,D))\n m[...,0,:] = np.einsum('...ij,...j->...i', Lambda, mu)\n #m = np.reshape(m, plates_mu + (N*D,))\n A = np.einsum('...dik,...nk->...ndi', b, s)\n AA = np.einsum('...dikjl,...nkl->...ndij', bb, ss)\n C[...,0,:,0,:] = Lambda + np.einsum('...dij,...d->...ij',\n AA[...,0,:,:,:],\n v[...,0,:])\n for n in range(1,N-1):\n C[...,n,:,n,:] = (np.einsum('...dij,...d->...ij',\n AA[...,n,:,:,:],\n v[...,n,:])\n + v[...,n,:,None] * np.identity(D))\n for n in range(N-1):\n C[...,n,:,n+1,:] = -np.einsum('...di,...d->...id',\n A[...,n,:,:],\n v[...,n,:])\n C[...,n+1,:,n,:] = -np.einsum('...di,...d->...di',\n A[...,n,:,:],\n v[...,n,:])\n C[...,-1,:,-1,:] = v[...,-1,:,None]*np.identity(D)\n C = np.reshape(C, plates_C+(N*D,N*D))\n Cov = np.linalg.inv(C)\n Cov = np.reshape(Cov, plates_C+(N,D,N,D))\n m0 = np.einsum('...minj,...nj->...mi', Cov, m)\n m1 = np.zeros(plates_C+(N,D,D))\n m2 = np.zeros(plates_C+(N-1,D,D))\n for n in range(N):\n m1[...,n,:,:] = Cov[...,n,:,n,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n,:])\n for n in range(N-1):\n m2[...,n,:,:] = Cov[...,n,:,n+1,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n+1,:])\n self.assertAllClose(m0, u0*np.ones(np.shape(m0)))\n self.assertAllClose(m1, u1*np.ones(np.shape(m1)))\n self.assertAllClose(m2, u2*np.ones(np.shape(m2)))\n\n pass\n\n check(2,1,1)\n check(2,3,1)\n check(2,1,3)\n check(4,3,2)\n\n #\n # Test mu\n #\n\n # Simple\n check(4,3,2,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3)))\n # Plates\n check(4,3,2,\n mu=Gaussian(np.random.randn(5,6,3),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=(5,)))\n check(4,3,2,\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=()))\n check(4,3,2,\n plates=(5,),\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test Lambda\n #\n \n # Simple\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3)))\n # Plates\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,)))\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(1),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=()))\n check(4,3,2,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test B\n #\n\n # Simple\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)))\n # Plates\n check(4,3,2,\n B=GaussianARD(np.random.randn(5,6,3,3,2),\n np.random.rand(5,6,3,3,2),\n shape=(3,2),\n plates=(5,6,3)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(5,3)))\n check(4,3,2,\n B=GaussianARD(np.random.randn(1,3,3,2),\n np.random.rand(1,3,3,2),\n shape=(3,2),\n plates=(5,3)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)))\n check(4,3,2,\n plates=(5,),\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(1,3)))\n\n #\n # Test S\n #\n \n # Simple\n check(4,3,2,\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n # Plates\n check(4,3,2,\n S=GaussianARD(np.random.randn(5,6,4-1,2),\n np.random.rand(5,6,4-1,2),\n shape=(2,),\n plates=(5,6,4-1,)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(5,4-1,)))\n check(4,3,2,\n S=GaussianARD(np.random.randn(1,4-1,2),\n np.random.rand(1,4-1,2),\n shape=(2,),\n plates=(5,4-1,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n check(4,3,2,\n plates=(5,),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(1,4-1,)))\n\n #\n # Test v\n #\n \n # Simple\n check(4,3,2,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,2,\n V=Gamma(np.random.rand(3),\n np.random.rand(3),\n plates=(3,)))\n # Plates\n check(4,3,2,\n V=Gamma(np.random.rand(5,6,1,3),\n np.random.rand(5,6,1,3),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(5,1,3)))\n check(4,3,2,\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,2,\n plates=(5,),\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(1,1,3)))\n\n #\n # Uncertainty in both B and S\n #\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n \n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_child",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 678
},
{
"content": " def test_message_to_mu(self):\n # TODO\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_mu",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 984
},
{
"content": " def test_message_to_Lambda(self):\n # TODO\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_Lambda",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 988
},
{
"content": " def test_message_to_B(self):\n # TODO\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_B",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 992
},
{
"content": " def test_message_to_S(self):\n # TODO\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_S",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 996
},
{
"content": " def test_message_to_v(self):\n # TODO\n pass",
"metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_v",
"header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 1000
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2013",
"-",
"2014",
" ",
"Ja",
"ak",
"ko",
" ",
"Lu",
"tti",
"nen",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"license",
"d",
" ",
"under",
" ",
"the",
" ",
"MIT",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Unit",
" ",
"tests",
" ",
"for",
" ",
"gauss",
"ian",
"\\u",
"markov",
"\\u",
"chain",
" ",
"module",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"._",
"gauss",
"ian",
"\\u",
"markov",
"\\u",
"chain_",
"import_",
"Gaussian",
"Markov",
"Chain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"gauss",
"ian",
"\\u",
"markov",
"\\u",
"chain_",
"import_",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"gaussian_",
"import_",
"Gaussian",
"_",
",_",
"Gaussian",
"Moment",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"gaussian_",
"import_",
"Gaussian",
"ARD",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"wish",
"art_",
"import_",
"Wis",
"hart",
"_",
",_",
"Wis",
"hart",
"Moment",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"gamma_",
"import_",
"Gamma",
"_",
",_",
"Gamma",
"Moment",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"bayes",
"py_",
"._",
"utils_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bayes",
"py_",
"._",
"utils_",
"import_",
"linalg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bayes",
"py_",
"._",
"utils_",
"import_",
"misc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"bayes",
"py_",
"._",
"utils_",
"._",
"misc_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"kal",
"man",
"\\u",
"filter_",
"(_",
"y_",
",_",
"U_",
",_",
"A_",
",_",
"V_",
",_",
"mu",
"0_",
",_",
"Cov",
"0_",
",_",
"out_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Perform",
" ",
"Kal",
"man",
" ",
"filtering",
" ",
"to",
" ",
"obtain",
" ",
"filter",
"ed",
" ",
"mean",
" ",
"and",
" ",
"covariance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"parameter",
"s",
" ",
"of",
" ",
"the",
" ",
"process",
" ",
"may",
" ",
"vary",
" ",
"in",
" ",
"time",
",",
" ",
"thu",
"s",
" ",
"the",
"y",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"give",
"n",
" ",
"as",
" ",
"iterators",
" ",
"inst",
"ead",
" ",
"of",
" ",
"fixed",
" ",
"values",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"y",
" ",
":",
" ",
"(",
"N",
",",
"D",
")",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"Normalize",
"d",
"\"",
" ",
"noisy",
" ",
"observa",
"tion",
"s",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
",",
" ",
"tha",
"t",
" ",
"is",
",",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"observa",
"tion",
"s",
" ",
"multiplie",
"d",
" ",
"by",
" ",
"the",
" ",
"preci",
"sion",
" ",
"matrix",
" ",
"U",
" ",
"(",
"and",
" ",
"possib",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"other",
" ",
"transformation",
" ",
"matric",
"es",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"U",
" ",
":",
" ",
"(",
"N",
",",
"D",
",",
"D",
")",
" ",
"array",
" ",
"or",
" ",
"N",
"-",
"list",
" ",
"of",
" ",
"(",
"D",
",",
"D",
")",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Precis",
"ion",
" ",
"matrix",
" ",
"(",
"i",
".",
"e",
".,",
" ",
"inv",
"erse",
" ",
"covariance",
" ",
"matrix",
")",
" ",
"of",
" ",
"the",
" ",
"observa",
"tion",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"noise",
" ",
"for",
" ",
"each",
" ",
"time",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
":",
" ",
"(",
"N",
"-1",
",",
"D",
",",
"D",
")",
" ",
"array",
" ",
"or",
" ",
"(",
"N",
"-1",
")-",
"list",
" ",
"of",
" ",
"(",
"D",
",",
"D",
")",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Dynamic",
" ",
"matrix",
" ",
"for",
" ",
"each",
" ",
"time",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"V",
" ",
":",
" ",
"(",
"N",
"-1",
",",
"D",
",",
"D",
")",
" ",
"array",
" ",
"or",
" ",
"(",
"N",
"-1",
")-",
"list",
" ",
"of",
" ",
"(",
"D",
",",
"D",
")",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Covar",
"iance",
" ",
"matrix",
" ",
"of",
" ",
"the",
" ",
"inno",
"vati",
"on",
" ",
"noise",
" ",
"for",
" ",
"each",
" ",
"time",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mu",
" ",
":",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Filter",
"ed",
" ",
"mean",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Cov",
" ",
":",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Filter",
"ed",
" ",
"covariance",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"See",
" ",
"als",
"o",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"rts",
"\\u",
"smooth",
"er",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"mu",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"Cov",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Allocate",
" ",
"memory",
" ",
"for",
" ",
"the",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"N_",
",_",
"D_",
")_",
"=_",
"np_",
"._",
"shape_",
"(_",
"y_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"np_",
"._",
"empty_",
"(_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"X_",
"=_",
"np_",
"._",
"empty_",
"(_",
"(_",
"N_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"step",
" ",
"for",
" ",
"t",
"=",
"0_",
"\\u\\u\\uNL\\u\\u\\u_",
"M_",
"=_",
"np_",
"._",
"dot_",
"(_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"U_",
"[_",
"0_",
"]_",
")_",
",_",
"Cov",
"_",
")_",
"+_",
"Cov",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"L_",
"=_",
"linalg_",
"._",
"chol",
"_",
"(_",
"M_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"linalg_",
"._",
"chol",
"\\u",
"solve_",
"(_",
"L_",
",_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"y_",
"[_",
"0_",
"]_",
")_",
"+_",
"mu_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"linalg_",
"._",
"chol",
"\\u",
"solve_",
"(_",
"L_",
",_",
"Cov",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"[_",
"0_",
",_",
":_",
"]_",
"=_",
"mu_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"X_",
"[_",
"0_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"for",
" ",
"(",
"yn",
",",
" ",
"Un",
",",
" ",
"An",
",",
" ",
"Vn",
")",
" ",
"in",
" ",
"zip",
"(",
"y",
",",
" ",
"U",
",",
" ",
"A",
",",
" ",
"V",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"len_",
"(_",
"y_",
")_",
"-_",
"1_",
")_",
":_",
"#(",
"yn",
",",
" ",
"Un",
",",
" ",
"An",
",",
" ",
"Vn",
")",
" ",
"in",
" ",
"zip",
"(",
"y",
",",
" ",
"U",
",",
" ",
"A",
",",
" ",
"V",
"):",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Prediction",
" ",
"step_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mu_",
"=_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
"]_",
",_",
"mu_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"dot_",
"(_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
"]_",
",_",
"Cov",
"_",
")_",
",_",
"A_",
"[_",
"n_",
"]_",
"._",
"T_",
")_",
"+_",
"V_",
"[_",
"n_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"step_",
"\\u\\u\\uNL\\u\\u\\u_",
"M_",
"=_",
"np_",
"._",
"dot_",
"(_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"U_",
"[_",
"n_",
"+_",
"1_",
"]_",
")_",
",_",
"Cov",
"_",
")_",
"+_",
"Cov",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"L_",
"=_",
"linalg_",
"._",
"chol",
"_",
"(_",
"M_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"linalg_",
"._",
"chol",
"\\u",
"solve_",
"(_",
"L_",
",_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"y_",
"[_",
"n_",
"+_",
"1_",
"]_",
")_",
"+_",
"mu_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"linalg_",
"._",
"chol",
"\\u",
"solve_",
"(_",
"L_",
",_",
"Cov",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Force",
" ",
"symmetric",
" ",
"covariance",
" ",
"(",
"for",
" ",
"numeri",
"c",
" ",
"ina",
"ccu",
"rac",
"y",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cov",
"_",
"=_",
"0.5_",
"*_",
"Cov",
"_",
"+_",
"0.5_",
"*_",
"Cov",
"_",
"._",
"T_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"X_",
"[_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"=_",
"mu_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"X_",
"[_",
"n_",
"+_",
"1_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"X_",
",_",
"Cov",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rts",
"\\u",
"smooth",
"er_",
"(_",
"mu_",
",_",
"Cov",
"_",
",_",
"A_",
",_",
"V_",
",_",
"remove",
"this_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Perform",
" ",
"Ra",
"uch",
"-",
"Tun",
"g",
"-",
"Stri",
"ebe",
"l",
" ",
"smoothing",
" ",
"to",
" ",
"obtain",
" ",
"the",
" ",
"posterior",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"function",
" ",
"return",
"s",
" ",
"the",
" ",
"posterior",
" ",
"mean",
" ",
"and",
" ",
"covariance",
" ",
"of",
" ",
"each",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"state",
".",
" ",
"The",
" ",
"parameter",
"s",
" ",
"of",
" ",
"the",
" ",
"process",
" ",
"may",
" ",
"vary",
" ",
"in",
" ",
"time",
",",
" ",
"thu",
"s",
" ",
"the",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"are",
" ",
"give",
"n",
" ",
"as",
" ",
"iterators",
" ",
"inst",
"ead",
" ",
"of",
" ",
"fixed",
" ",
"values",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mu",
" ",
":",
" ",
"(",
"N",
",",
"D",
")",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Mea",
"n",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
" ",
"from",
" ",
"Kal",
"man",
" ",
"filter",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Cov",
" ",
":",
" ",
"(",
"N",
",",
"D",
",",
"D",
")",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Covar",
"iance",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
" ",
"from",
" ",
"Kal",
"man",
" ",
"filter",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
":",
" ",
"(",
"N",
"-1",
",",
"D",
",",
"D",
")",
" ",
"array",
" ",
"or",
" ",
"(",
"N",
"-1",
")-",
"list",
" ",
"of",
" ",
"(",
"D",
",",
"D",
")",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Dynamic",
" ",
"matrix",
" ",
"for",
" ",
"each",
" ",
"time",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"V",
" ",
":",
" ",
"(",
"N",
"-1",
",",
"D",
",",
"D",
")",
" ",
"array",
" ",
"or",
" ",
"(",
"N",
"-1",
")-",
"list",
" ",
"of",
" ",
"(",
"D",
",",
"D",
")",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Covar",
"iance",
" ",
"matrix",
" ",
"of",
" ",
"the",
" ",
"inno",
"vati",
"on",
" ",
"noise",
" ",
"for",
" ",
"each",
" ",
"time",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mu",
" ",
":",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Poster",
"ior",
" ",
"mean",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Cov",
" ",
":",
" ",
"array",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Poster",
"ior",
" ",
"covariance",
" ",
"of",
" ",
"the",
" ",
"state",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"See",
" ",
"als",
"o",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"kal",
"man",
"\\u",
"filter",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"N_",
"=_",
"len_",
"(_",
"mu_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"n",
" ",
"=",
" ",
"N",
"-1",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Start",
" ",
"from",
" ",
"the",
" ",
"last",
" ",
"time",
" ",
"instance",
" ",
"and",
" ",
"smooth",
"en",
" ",
"backwards_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"mu_",
"[_",
"-_",
"1_",
",_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"x_",
"=_",
"Cov",
"_",
"[_",
"-_",
"1_",
",_",
":_",
",_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"n_",
"in_",
"reversed_",
"(_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
")_",
":_",
"#(",
"An",
",",
" ",
"Vn",
")",
" ",
"in",
" ",
"zip",
"(",
"reverse",
"d",
"(",
"A",
"),",
" ",
"reverse",
"d",
"(",
"V",
"))",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"n",
" ",
"=",
" ",
"n",
" ",
"-",
" ",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"if",
" ",
"n",
" ",
"<=",
" ",
"0",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"break_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"predi",
"cte",
"d",
" ",
"value",
" ",
"of",
" ",
"n_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"p_",
"=_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
"]_",
",_",
"mu_",
"[_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"\\u",
"p_",
"=_",
"np_",
"._",
"dot_",
"(_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
"]_",
",_",
"Cov",
"_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
")_",
",_",
"A_",
"[_",
"n_",
"]_",
"._",
"T_",
")_",
"+_",
"V_",
"[_",
"n_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Tempora",
"ry",
" ",
"variable_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"np_",
"._",
"linalg_",
"._",
"solve_",
"(_",
"Cov",
"\\u",
"p_",
",_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
"]_",
",_",
"Cov",
"_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Smooth",
"ed",
" ",
"value",
" ",
"of",
" ",
"n_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"mu_",
"[_",
"n_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"dot_",
"(_",
"S_",
"._",
"T_",
",_",
"x_",
"-_",
"x",
"\\u",
"p_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"x_",
"=_",
"Cov",
"_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"dot_",
"(_",
"np_",
"._",
"dot_",
"(_",
"S_",
"._",
"T_",
",_",
"Cov",
"x_",
"-_",
"Cov",
"\\u",
"p_",
")_",
",_",
"S_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Force",
" ",
"symmetric",
" ",
"covariance",
" ",
"(",
"for",
" ",
"numeri",
"c",
" ",
"ina",
"ccu",
"rac",
"y",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cov",
"x_",
"=_",
"0.5_",
"*_",
"Cov",
"x_",
"+_",
"0.5_",
"*_",
"Cov",
"x_",
"._",
"T_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"[_",
"n_",
",_",
":_",
"]_",
"=_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"[_",
"n_",
",_",
":_",
"]_",
"=_",
"Cov",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"mu_",
",_",
"Cov",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"create",
"\\u",
"model_",
"(_",
"self_",
",_",
"N_",
",_",
"D_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"the",
" ",
"model_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Mu",
"_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"D_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
",_",
"D_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"D_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Mu",
"_",
",_",
"Lambda_",
",_",
"A_",
",_",
"V_",
",_",
"n_",
"=_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"=_",
"Gaussian",
"_",
"(_",
"X_",
",_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"(_",
"Y_",
",_",
"X_",
",_",
"Mu",
"_",
",_",
"Lambda_",
",_",
"A_",
",_",
"V_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"plates",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"plates",
" ",
"are",
" ",
"handle",
"d",
" ",
"correct",
"ly",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"mu",
"0_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"Lam",
"bda",
"0_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"A_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"v_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"child_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"the",
" ",
"updat",
"ing",
" ",
"of",
" ",
"Gaussian",
"Markov",
"Chain",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Check",
" ",
"tha",
"t",
" ",
"the",
" ",
"moments",
" ",
"and",
" ",
"the",
" ",
"lower",
" ",
"bound",
" ",
"contribution",
" ",
"are",
" ",
"compute",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"correct",
"ly",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"Add",
" ",
"plates",
" ",
"and",
" ",
"missi",
"ng",
" ",
"values",
"!",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Dimen",
"sion",
"ali",
"ties_",
"\\u\\u\\uNL\\u\\u\\u_",
"D_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"N_",
"=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"Y_",
",_",
"X_",
",_",
"Mu",
"_",
",_",
"Lambda_",
",_",
"A_",
",_",
"V_",
")_",
"=_",
"self_",
"._",
"create",
"\\u",
"model_",
"(_",
"N_",
",_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Infer",
"ence",
" ",
"with",
" ",
"arbitra",
"ry",
" ",
"observations_",
"\\u\\u\\uNL\\u\\u\\u_",
"y_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"N_",
",_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"._",
"observe",
"_",
"(_",
"y_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"._",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"x",
"\\u",
"vb_",
",_",
"xn",
"xn",
"\\u",
"vb_",
",_",
"xp",
"xn",
"\\u",
"vb_",
")_",
"=_",
"X_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"parameter",
" ",
"moments_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"mu",
"0_",
",_",
"mum",
"u0",
"_",
")_",
"=_",
"Mu",
"_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"ico",
"v0_",
",_",
"logd",
"et",
"0_",
")_",
"=_",
"Lambda_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"a_",
",_",
"aa_",
")_",
"=_",
"A_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"ico",
"v",
"\\u",
"x_",
",_",
"logd",
"et",
"x_",
")_",
"=_",
"V_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ico",
"v",
"\\u",
"x_",
"=_",
"np_",
"._",
"diag_",
"(_",
"ico",
"v",
"\\u",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Prior",
" ",
"precision_",
"\\u\\u\\uNL\\u\\u\\u_",
"Z_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"ki",
"j",
",...",
"kk",
"->",
"...",
"ij",
"'_",
",_",
"aa_",
",_",
"ico",
"v",
"\\u",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"U",
"\\u",
"diag_",
"=_",
"[_",
"ico",
"v0_",
"+_",
"Z_",
"]_",
"+_",
"(_",
"N_",
"-_",
"2_",
")_",
"*_",
"[_",
"ico",
"v",
"\\u",
"x_",
"+_",
"Z_",
"]_",
"+_",
"[_",
"ico",
"v",
"\\u",
"x_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"U",
"\\u",
"super_",
"=_",
"(_",
"N_",
"-_",
"1_",
")_",
"*_",
"[_",
"-_",
"np_",
"._",
"dot_",
"(_",
"a_",
"._",
"T_",
",_",
"ico",
"v",
"\\u",
"x_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"U_",
"=_",
"misc_",
"._",
"block",
"\\u",
"band",
"ed_",
"(_",
"U",
"\\u",
"diag_",
",_",
"U",
"\\u",
"super_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Prior",
" ",
"mean_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu",
"\\u",
"prior_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"D_",
"*_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu",
"\\u",
"prior_",
"[_",
":_",
"D_",
"]_",
"=_",
"np_",
"._",
"dot_",
"(_",
"ico",
"v0_",
",_",
"mu",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Data",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"linalg_",
"._",
"inv_",
"(_",
"U_",
"+_",
"np_",
"._",
"identity_",
"(_",
"D_",
"*_",
"N_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"mu",
"\\u",
"prior_",
"+_",
"y_",
"._",
"flatten_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Moment",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"xx_",
"=_",
"mu_",
"[_",
":_",
",_",
"np_",
"._",
"newaxis_",
"]_",
"*_",
"mu_",
"[_",
"np_",
"._",
"newaxis_",
",_",
":_",
"]_",
"+_",
"Cov",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"mu_",
",_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xx_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"xx_",
",_",
"(_",
"N_",
",_",
"D_",
",_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"x",
"\\u",
"vb_",
",_",
"mu_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"=_",
"\"",
"Inco",
"rrect",
" ",
"mean",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"xn",
"xn",
"\\u",
"vb_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"xx_",
"[_",
"n_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"=_",
"\"",
"Inco",
"rrect",
" ",
"second",
" ",
"moment",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"xp",
"xn",
"\\u",
"vb_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"xx_",
"[_",
"n_",
",_",
":_",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"=_",
"\"",
"Inco",
"rrect",
" ",
"lag",
"ged",
" ",
"second",
" ",
"moment",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Compute",
" ",
"the",
" ",
"entr",
"opy",
" ",
"H",
"(",
"X",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"lde",
"t_",
"=_",
"linalg_",
"._",
"logd",
"et",
"\\u",
"cov_",
"(_",
"Cov",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"H_",
"=_",
"random_",
"._",
"gauss",
"ian",
"\\u",
"entropy_",
"(_",
"-_",
"lde",
"t_",
",_",
"N_",
"*_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Compute",
" ",
"<",
"log",
" ",
"p",
"(",
"X",
"|.",
"..",
")>",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"xx_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"xx_",
",_",
"(_",
"N_",
"*_",
"D_",
",_",
"N_",
"*_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"mu_",
",_",
"(_",
"N_",
"*_",
"D_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lde",
"t_",
"=_",
"-_",
"logd",
"et",
"0_",
"-_",
"np_",
"._",
"sum_",
"(_",
"np_",
"._",
"ones_",
"(_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
")_",
")_",
"*_",
"logd",
"et",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"P_",
"=_",
"random_",
"._",
"gauss",
"ian",
"\\u",
"logp",
"df_",
"(_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"ij",
",...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"xx_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"U_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"i",
",...",
"i",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu",
"\\u",
"prior_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"ij",
",...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mum",
"u0",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ico",
"v0_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"-_",
"lde",
"t_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"N_",
"*_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"VB",
" ",
"bound",
" ",
"from",
" ",
"the",
" ",
"net_",
"\\u\\u\\uNL\\u\\u\\u_",
"l_",
"=_",
"X_",
"._",
"lower",
"\\u",
"bound",
"\\u",
"contribution",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"l_",
",_",
"H_",
"+_",
"P_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Compute",
" ",
"the",
" ",
"true",
" ",
"bound",
" ",
"<",
"log",
" ",
"p",
"(",
"X",
"|.",
"..",
")>",
" ",
"+",
" ",
"H",
"(",
"X",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple",
" ",
"tests_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"check_",
"(_",
"N_",
",_",
"D_",
",_",
"plates",
"_",
"=_",
"None_",
",_",
"mu_",
"=_",
"None_",
",_",
"Lambda_",
"=_",
"None_",
",_",
"A_",
"=_",
"None_",
",_",
"V_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"mu_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mu_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"Lambda_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Lambda_",
"=_",
"random_",
"._",
"covariance_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"A_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"A_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
",_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"V_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"V_",
"=_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"X_",
"=_",
"Gaussian",
"Markov",
"Chain_",
"(_",
"mu_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"plates",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"n_",
"=_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"u0",
"_",
",_",
"u1_",
",_",
"u2_",
")_",
"=_",
"X_",
"._",
"\\u",
"message",
"\\u",
"to",
"\\u",
"child_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"mu_",
",_",
"mum",
"u_",
")_",
"=_",
"Gaussian",
"_",
"._",
"\\u",
"ensure",
"\\u",
"moments_",
"(_",
"mu_",
",_",
"Gaussian",
"Moment",
"s_",
",_",
"ndim_",
"=_",
"1_",
")_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"Lambda_",
",_",
"\\u_",
")_",
"=_",
"Wis",
"hart",
"_",
"._",
"\\u",
"ensure",
"\\u",
"moments_",
"(_",
"Lambda_",
",_",
"Wis",
"hart",
"Moment",
"s_",
",_",
"ndim_",
"=_",
"1_",
")_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"a_",
",_",
"aa_",
")_",
"=_",
"Gaussian",
"_",
"._",
"\\u",
"ensure",
"\\u",
"moments_",
"(_",
"A_",
",_",
"Gaussian",
"Moment",
"s_",
",_",
"ndim_",
"=_",
"1_",
")_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a_",
"=_",
"a_",
"*_",
"np_",
"._",
"ones_",
"(_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"#",
" ",
"explicit",
" ",
"broadcast",
"ing",
" ",
"for",
" ",
"simpli",
"city_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aa_",
"=_",
"aa_",
"*_",
"np_",
"._",
"ones_",
"(_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"#",
" ",
"explicit",
" ",
"broadcast",
"ing",
" ",
"for",
" ",
"simpli",
"city_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"v_",
",_",
"\\u_",
")_",
"=_",
"Gamma",
"_",
"._",
"\\u",
"ensure",
"\\u",
"moments_",
"(_",
"V_",
",_",
"Gamma",
"Moment",
"s_",
")_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"=_",
"v_",
"*_",
"np_",
"._",
"ones_",
"(_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plates",
"\\u",
"C_",
"=_",
"X_",
"._",
"plates",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"X_",
"._",
"plates",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"np_",
"._",
"shape_",
"(_",
"mu_",
")_",
"[_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"mu_",
"+_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
"]_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"ij",
",...",
"j",
"->",
"...",
"i",
"'_",
",_",
"Lambda_",
",_",
"mu_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
",_",
"0_",
",_",
":_",
"]_",
"=_",
"Lambda_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"dij",
",...",
"d",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"aa_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"1_",
",_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"C_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"=_",
"(_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"dij",
",...",
"d",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"aa_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"+_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"C_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"=_",
"-_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
",...",
"d",
"->",
"...",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"n_",
"+_",
"1_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"=_",
"-_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
",...",
"d",
"->",
"...",
"di",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"-_",
"1_",
",_",
":_",
",_",
"-_",
"1_",
",_",
":_",
"]_",
"=_",
"v_",
"[_",
"..._",
",_",
"-_",
"1_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"C_",
",_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
"*_",
"D_",
",_",
"N_",
"*_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"linalg_",
"._",
"inv_",
"(_",
"C_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"Cov",
"_",
",_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m0_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"min",
"j",
",...",
"nj",
"->",
"...",
"mi",
"'_",
",_",
"Cov",
"_",
",_",
"m_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m1_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m2_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"m1_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"i",
",...",
"j",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"m2_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"i",
",...",
"j",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m0_",
",_",
"u0",
"_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m0_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m1_",
",_",
"u1_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m1_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m2_",
",_",
"u2_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m2_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"mu_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"5_",
",_",
"6_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"Lambda_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"A_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"on",
" ",
"time",
" ",
"axis_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"5_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"on",
" ",
"time",
" ",
"axis",
" ",
"with",
" ",
"broadcast",
"ed",
" ",
"moments_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"5_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"5_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"v_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"with",
" ",
"input",
" ",
"signals_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Lambda_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"A_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"B_",
"=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"=_",
"6_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"inputs_",
"=_",
"[_",
"[_",
"-_",
"2_",
"]_",
",_",
"[_",
"3_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"Gaussian",
"Markov",
"Chain_",
"(_",
"[_",
"mu_",
"]_",
",_",
"[_",
"[_",
"Lambda_",
"]_",
"]_",
",_",
"[_",
"[_",
"A_",
",_",
"B_",
"]_",
"]_",
",_",
"[_",
"v_",
"]_",
",_",
"inputs_",
"=_",
"inputs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"V_",
"=_",
"(_",
"np_",
"._",
"array_",
"(_",
"[_",
"[_",
"v_",
"*_",
"A_",
"**_",
"2_",
",_",
"-_",
"v_",
"*_",
"A_",
",_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"-_",
"v_",
"*_",
"A_",
",_",
"v_",
"*_",
"A_",
"**_",
"2_",
",_",
"-_",
"v_",
"*_",
"A_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"0_",
",_",
"-_",
"v_",
"*_",
"A_",
",_",
"0_",
"]_",
"]_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"array_",
"(_",
"[_",
"[_",
"Lambda_",
",_",
"0_",
",_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"0_",
",_",
"v_",
",_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"0_",
",_",
"0_",
",_",
"v_",
"]_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"(_",
"np_",
"._",
"array_",
"(_",
"[_",
"Lambda_",
"*_",
"mu_",
",_",
"0_",
",_",
"0_",
"]_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"array_",
"(_",
"[_",
"0_",
",_",
"v_",
"*_",
"B_",
"*_",
"inputs_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
",_",
"v_",
"*_",
"B_",
"*_",
"inputs_",
"[_",
"1_",
"]_",
"[_",
"0_",
"]_",
"]_",
")_",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"array_",
"(_",
"[_",
"v_",
"*_",
"A_",
"*_",
"B_",
"*_",
"inputs_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
",_",
"v_",
"*_",
"A_",
"*_",
"B_",
"*_",
"inputs_",
"[_",
"1_",
"]_",
"[_",
"0_",
"]_",
",_",
"0_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"linalg_",
"._",
"inv_",
"(_",
"V_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mean_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"m_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"X_",
"._",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"=_",
"X_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"u_",
"[_",
"0_",
"]_",
",_",
"mean_",
"[_",
":_",
",_",
"None_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"u_",
"[_",
"1_",
"]_",
"-_",
"u_",
"[_",
"0_",
"]_",
"[_",
"..._",
",_",
"None_",
",_",
":_",
"]_",
"*_",
"u_",
"[_",
"0_",
"]_",
"[_",
"..._",
",_",
":_",
",_",
"None_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cov",
"_",
"[_",
"(_",
"0_",
",_",
"1_",
",_",
"2_",
")_",
",_",
"(_",
"0_",
",_",
"1_",
",_",
"2_",
")_",
",_",
"None_",
",_",
"None_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"u_",
"[_",
"2_",
"]_",
"-_",
"u_",
"[_",
"0_",
"]_",
"[_",
"..._",
",_",
":_",
"-_",
"1_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"u_",
"[_",
"0_",
"]_",
"[_",
"..._",
",_",
"1_",
":_",
",_",
"None_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cov",
"_",
"[_",
"(_",
"0_",
",_",
"1_",
")_",
",_",
"(_",
"1_",
",_",
"2_",
")_",
",_",
"None_",
",_",
"None_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"smoothing",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"the",
" ",
"posterior",
" ",
"estimati",
"on",
" ",
"of",
" ",
"Gaussian",
"Markov",
"Chain",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"time",
"-",
"variant",
" ",
"dynamics",
" ",
"and",
" ",
"compare",
" ",
"the",
" ",
"results",
" ",
"of",
" ",
"Bayes",
"Py",
" ",
"VB",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"infer",
"ence",
" ",
"and",
" ",
"standard",
" ",
"Kal",
"man",
" ",
"filtering",
" ",
"&",
" ",
"smoothing",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"not",
" ",
"tha",
"t",
" ",
"usef",
"ul",
" ",
"any",
"more",
",",
" ",
"bec",
"aus",
"e",
" ",
"the",
" ",
"moments",
" ",
"are",
" ",
"checke",
"d",
" ",
"muc",
"h",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bett",
"er",
" ",
"in",
" ",
"anot",
"her",
" ",
"test",
" ",
"method",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"up",
" ",
"an",
" ",
"arti",
"ficia",
"l",
" ",
"system_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Dimensions_",
"\\u\\u\\uNL\\u\\u\\u_",
"N_",
"=_",
"500_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"D_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Dynamic",
"s",
" ",
"(",
"time",
" ",
"varying",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"A0_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"[_",
".9_",
",_",
"-_",
".4_",
"]_",
",_",
"[_",
".4_",
",_",
".9_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"A1_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"[_",
".9",
"8_",
",_",
"-_",
".1_",
"]_",
",_",
"[_",
".1_",
",_",
".9",
"8_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"l_",
"=_",
"np_",
"._",
"linspace_",
"(_",
"0_",
",_",
"1_",
",_",
"N_",
"-_",
"1_",
")_",
"._",
"reshape_",
"(_",
"(_",
"-_",
"1_",
",_",
"1_",
",_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"A_",
"=_",
"(_",
"1_",
"-_",
"l_",
")_",
"*_",
"A0_",
"+_",
"l_",
"*_",
"A1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Inno",
"vati",
"on",
" ",
"covariance",
" ",
"matrix",
" ",
"(",
"time",
" ",
"varying",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"=_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"V_",
"=_",
"np_",
"._",
"diag_",
"(_",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Observation",
" ",
"noise",
" ",
"covariance",
" ",
"matrix_",
"\\u\\u\\uNL\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simulate",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"X_",
"=_",
"np_",
"._",
"empty_",
"(_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"=_",
"np_",
"._",
"empty_",
"(_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"0.5_",
",_",
"-_",
"0.5_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"[_",
"0_",
",_",
":_",
"]_",
"=_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"[_",
"0_",
",_",
":_",
"]_",
"=_",
"x_",
"+_",
"np_",
"._",
"random_",
"._",
"multivariate",
"\\u",
"normal_",
"(_",
"np_",
"._",
"zeros_",
"(_",
"D_",
")_",
",_",
"C_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x_",
"=_",
"np_",
"._",
"dot_",
"(_",
"A_",
"[_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"x_",
")_",
"+_",
"np_",
"._",
"random_",
"._",
"multivariate",
"\\u",
"normal_",
"(_",
"np_",
"._",
"zeros_",
"(_",
"D_",
")_",
",_",
"V_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"[_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"=_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"[_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"=_",
"x_",
"+_",
"np_",
"._",
"random_",
"._",
"multivariate",
"\\u",
"normal_",
"(_",
"np_",
"._",
"zeros_",
"(_",
"D_",
")_",
",_",
"C_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Bayes",
"Py",
" ",
"inference_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"VB",
" ",
"model_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Xh",
"_",
"=_",
"Gaussian",
"Markov",
"Chain_",
"(_",
"np_",
"._",
"zeros_",
"(_",
"D_",
")_",
",_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
",_",
"A_",
",_",
"1_",
"/_",
"v_",
",_",
"n_",
"=_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Yh",
"_",
"=_",
"Gaussian",
"_",
"(_",
"Xh",
"_",
",_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
",_",
"plates",
"_",
"=_",
"(_",
"N_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Put",
" ",
"data",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"Yh",
"_",
"._",
"observe",
"_",
"(_",
"Y_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Run",
" ",
"inference_",
"\\u\\u\\uNL\\u\\u\\u_",
"Xh",
"_",
"._",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"Xh",
"\\u",
"vb_",
"=_",
"Xh",
"_",
"._",
"u_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"Xh",
"\\u",
"vb_",
"=_",
"Xh",
"_",
"._",
"u_",
"[_",
"1_",
"]_",
"-_",
"Xh",
"\\u",
"vb_",
"[_",
"..._",
",_",
"np_",
"._",
"newaxis_",
",_",
":_",
"]_",
"*_",
"Xh",
"\\u",
"vb_",
"[_",
"..._",
",_",
":_",
",_",
"np_",
"._",
"newaxis_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"",
"The",
" ",
"ground",
" ",
"truth",
"\"",
" ",
"usi",
"ng",
" ",
"standard",
" ",
"Kal",
"man",
" ",
"filter",
" ",
"and",
" ",
"RTS",
" ",
"smooth",
"er_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"N_",
"*_",
"(_",
"V_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"UY",
"_",
"=_",
"Y_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"U_",
"=_",
"N_",
"*_",
"(_",
"C_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"Xh",
"_",
",_",
"Cov",
"Xh",
"_",
")_",
"=_",
"kal",
"man",
"\\u",
"filter_",
"(_",
"UY",
"_",
",_",
"U_",
",_",
"A_",
",_",
"V_",
",_",
"np_",
"._",
"zeros_",
"(_",
"D_",
")_",
",_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"Xh",
"_",
",_",
"Cov",
"Xh",
"_",
")_",
"=_",
"rts",
"\\u",
"smooth",
"er_",
"(_",
"Xh",
"_",
",_",
"Cov",
"Xh",
"_",
",_",
"A_",
",_",
"V_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"np_",
"._",
"allclose_",
"(_",
"Xh",
"\\u",
"vb_",
",_",
"Xh",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"np_",
"._",
"allclose_",
"(_",
"Cov",
"Xh",
"\\u",
"vb_",
",_",
"Cov",
"Xh",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"plates",
"\\u",
"from",
"\\u",
"parents_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain",
" ",
"deduc",
"es",
" ",
"plates",
" ",
"correct",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"check_",
"(_",
"plates",
"\\u",
"X_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"Lambda_",
"=_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"B_",
"=_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"S_",
"=_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"v_",
"=_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"D_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"K_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"N_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"seed_",
"(_",
"42_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"mu_",
"+_",
"(_",
"D_",
",_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"D_",
"+_",
"np_",
"._",
"ones_",
"(_",
"plates",
"\\u",
"Lambda_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"B_",
"+_",
"(_",
"D_",
",_",
"D_",
",_",
"K_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"1_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"B_",
"+_",
"(_",
"D_",
",_",
"D_",
",_",
"K_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"D_",
",_",
"K_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"plates",
"\\u",
"B_",
"+_",
"(_",
"D_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"S_",
"+_",
"(_",
"N_",
",_",
"K_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"1_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"S_",
"+_",
"(_",
"N_",
",_",
"K_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"K_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"plates",
"\\u",
"S_",
"+_",
"(_",
"N_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"=_",
"Gamma",
"_",
"(_",
"1_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"v_",
"+_",
"(_",
"1_",
",_",
"D_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"1_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"*_",
"(_",
"plates",
"\\u",
"v_",
"+_",
"(_",
"1_",
",_",
"D_",
")_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"mu_",
",_",
"Lambda_",
",_",
"B_",
",_",
"S_",
",_",
"v_",
",_",
"name_",
"=_",
"\"",
"X",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"plates",
"\\u",
"X_",
",_",
"X_",
"._",
"plates",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"=_",
"\"",
"Inco",
"rrect",
" ",
"plates",
" ",
"deduc",
"ed",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"check_",
"(_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"(_",
"2_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"(_",
"2_",
",_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"(_",
"6_",
",_",
"7_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"Lambda_",
"=_",
"(_",
"6_",
",_",
"7_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"(_",
"2_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"B_",
"=_",
"(_",
"2_",
",_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"(_",
"2_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"S_",
"=_",
"(_",
"2_",
",_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"(_",
"2_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"v_",
"=_",
"(_",
"2_",
",_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"child_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"very",
" ",
"simple",
" ",
"check",
" ",
"bef",
"ore",
" ",
"the",
" ",
"more",
" ",
"complex",
" ",
"ones",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"1",
"-",
"D",
" ",
"process",
",",
" ",
"k",
"=",
"1",
",",
" ",
"fixed",
" ",
"constant",
" ",
"parameters_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"m_",
"=_",
"1.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"l_",
"=_",
"4.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"2.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"=_",
"[_",
"3.0_",
",_",
"8.0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"=_",
"5.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"[_",
"m_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"[_",
"l_",
"]_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"[_",
"[_",
"b_",
"]_",
"]_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"[_",
"s_",
"[_",
"0_",
"]_",
"]_",
",_",
"[_",
"s_",
"[_",
"1_",
"]_",
"]_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"v_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"u0",
"_",
",_",
"u1_",
",_",
"u2_",
")_",
"=_",
"X_",
"._",
"\\u",
"message",
"\\u",
"to",
"\\u",
"child_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"[_",
"l_",
"+_",
"b_",
"**_",
"2_",
"*_",
"s_",
"[_",
"0_",
"]_",
"**_",
"2_",
"*_",
"v_",
",_",
"-_",
"b_",
"*_",
"s_",
"[_",
"0_",
"]_",
"*_",
"v_",
",_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"-_",
"b_",
"*_",
"s_",
"[_",
"0_",
"]_",
"*_",
"v_",
",_",
"v_",
"+_",
"b_",
"**_",
"2_",
"*_",
"s_",
"[_",
"1_",
"]_",
"**_",
"2_",
"*_",
"v_",
",_",
"-_",
"b_",
"*_",
"s_",
"[_",
"1_",
"]_",
"*_",
"v_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"0_",
",_",
"-_",
"b_",
"*_",
"s_",
"[_",
"1_",
"]_",
"*_",
"v_",
",_",
"v_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"linalg_",
"._",
"inv_",
"(_",
"C_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m0_",
"=_",
"np_",
"._",
"dot_",
"(_",
"Cov",
"_",
",_",
"[_",
"[_",
"l_",
"*_",
"m_",
"]_",
",_",
"[_",
"0_",
"]_",
",_",
"[_",
"0_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m1_",
"=_",
"np_",
"._",
"diag_",
"(_",
"Cov",
"_",
")_",
"[_",
":_",
",_",
"None_",
",_",
"None_",
"]_",
"+_",
"m0_",
"[_",
":_",
",_",
":_",
",_",
"None_",
"]_",
"**_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m2_",
"=_",
"np_",
"._",
"diag_",
"(_",
"Cov",
"_",
",_",
"k_",
"=_",
"1_",
")_",
"[_",
":_",
",_",
"None_",
",_",
"None_",
"]_",
"+_",
"m0_",
"[_",
"1_",
":_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"m0_",
"[_",
":_",
"-_",
"1_",
",_",
":_",
",_",
"None_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m0_",
",_",
"u0",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m1_",
",_",
"u1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m2_",
",_",
"u2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"check_",
"(_",
"N_",
",_",
"D_",
",_",
"K_",
",_",
"plates",
"_",
"=_",
"None_",
",_",
"mu_",
"=_",
"None_",
",_",
"Lambda_",
"=_",
"None_",
",_",
"B_",
"=_",
"None_",
",_",
"S_",
"=_",
"None_",
",_",
"V_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"mu_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mu_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"Lambda_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Lambda_",
"=_",
"random_",
"._",
"covariance_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"B_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"B_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"D_",
",_",
"D_",
",_",
"K_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"S_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"S_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"N_",
"-_",
"1_",
",_",
"K_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"V_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"V_",
"=_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"X_",
"=_",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"mu_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"plates",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"n_",
"=_",
"N_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"u0",
"_",
",_",
"u1_",
",_",
"u2_",
")_",
"=_",
"X_",
"._",
"\\u",
"message",
"\\u",
"to",
"\\u",
"child_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"mu_",
",_",
"mum",
"u_",
")_",
"=_",
"X_",
"._",
"parents_",
"[_",
"0_",
"]_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"Lambda_",
",_",
"\\u_",
")_",
"=_",
"X_",
"._",
"parents_",
"[_",
"1_",
"]_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"b_",
",_",
"bb_",
")_",
"=_",
"X_",
"._",
"parents_",
"[_",
"2_",
"]_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"s_",
",_",
"ss_",
")_",
"=_",
"X_",
"._",
"parents_",
"[_",
"3_",
"]_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"v_",
",_",
"\\u_",
")_",
"=_",
"X_",
"._",
"parents_",
"[_",
"4_",
"]_",
"._",
"get",
"\\u",
"moments_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"=_",
"v_",
"*_",
"np_",
"._",
"ones_",
"(_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"V",
" ",
"=",
" ",
"np",
".",
"atl",
"east",
"\\u",
"3d",
"(",
"v",
")[",
"...",
",-",
"1",
",:",
",",
"Non",
"e",
"]*",
"np",
".",
"identi",
"ty",
"(",
"D",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"\\u",
"C_",
"=_",
"X_",
"._",
"plates",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"X_",
"._",
"plates",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plates",
"\\u",
"mu_",
"=_",
"np_",
"._",
"shape_",
"(_",
"mu_",
")_",
"[_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"mu_",
"+_",
"(_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
"]_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"ij",
",...",
"j",
"->",
"...",
"i",
"'_",
",_",
"Lambda_",
",_",
"mu_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"m",
" ",
"=",
" ",
"np",
".",
"reshape",
"(",
"m",
",",
" ",
"plates",
"\\u",
"mu",
" ",
"+",
" ",
"(",
"N",
"*",
"D",
",)",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
"k",
",...",
"nk",
"->",
"...",
"ndi",
"'_",
",_",
"b_",
",_",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"AA_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
"kj",
"l",
",...",
"nk",
"l",
"->",
"...",
"ndi",
"j",
"'_",
",_",
"bb_",
",_",
"ss_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
",_",
"0_",
",_",
":_",
"]_",
"=_",
"Lambda_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"dij",
",...",
"d",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"AA_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"0_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"1_",
",_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"C_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"=_",
"(_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"dij",
",...",
"d",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"AA_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"+_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"C_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"=_",
"-_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
",...",
"d",
"->",
"...",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"n_",
"+_",
"1_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"=_",
"-_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"di",
",...",
"d",
"->",
"...",
"di",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"A_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"C_",
"[_",
"..._",
",_",
"-_",
"1_",
",_",
":_",
",_",
"-_",
"1_",
",_",
":_",
"]_",
"=_",
"v_",
"[_",
"..._",
",_",
"-_",
"1_",
",_",
":_",
",_",
"None_",
"]_",
"*_",
"np_",
"._",
"identity_",
"(_",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"C_",
",_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
"*_",
"D_",
",_",
"N_",
"*_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"linalg_",
"._",
"inv_",
"(_",
"C_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Cov",
"_",
"=_",
"np_",
"._",
"reshape_",
"(_",
"Cov",
"_",
",_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"N_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m0_",
"=_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"min",
"j",
",...",
"nj",
"->",
"...",
"mi",
"'_",
",_",
"Cov",
"_",
",_",
"m_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m1_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m2_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"plates",
"\\u",
"C_",
"+_",
"(_",
"N_",
"-_",
"1_",
",_",
"D_",
",_",
"D_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"m1_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"i",
",...",
"j",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"n_",
"in_",
"range_",
"(_",
"N_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"m2_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
":_",
"]_",
"=_",
"Cov",
"_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
"+_",
"np_",
"._",
"einsum_",
"(_",
"'...",
"i",
",...",
"j",
"->",
"...",
"ij",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
",_",
":_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m0_",
"[_",
"..._",
",_",
"n_",
"+_",
"1_",
",_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m0_",
",_",
"u0",
"_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m0_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m1_",
",_",
"u1_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m1_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"All",
"Close_",
"(_",
"m2_",
",_",
"u2_",
"*_",
"np_",
"._",
"ones_",
"(_",
"np_",
"._",
"shape_",
"(_",
"m2_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"check_",
"(_",
"2_",
",_",
"1_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"2_",
",_",
"3_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"2_",
",_",
"1_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"mu_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"5_",
",_",
"6_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mu_",
"=_",
"Gaussian",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"Lambda_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lambda_",
"=_",
"Wis",
"hart",
"_",
"(_",
"10_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"random_",
"._",
"covariance_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"B_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"5_",
",_",
"6_",
",_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"S_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"5_",
",_",
"6_",
",_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
",_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"1_",
",_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"v_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Simple_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"6_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"with",
" ",
"moments",
" ",
"broadcast",
"ed",
" ",
"over",
" ",
"plates",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Plat",
"es",
" ",
"broadcast",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"5_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"V_",
"=_",
"Gamma",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"1_",
",_",
"1_",
",_",
"3_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Unc",
"erta",
"int",
"y",
" ",
"in",
" ",
"bot",
"h",
" ",
"B",
" ",
"and",
" ",
"S_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"check_",
"(_",
"4_",
",_",
"3_",
",_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
",_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"3_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"3_",
",_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"S_",
"=_",
"Gaussian",
"ARD",
"_",
"(_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"4_",
"-_",
"1_",
",_",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shape_",
"=_",
"(_",
"2_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plates",
"_",
"=_",
"(_",
"4_",
"-_",
"1_",
",_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"mu_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"Lambda_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"B_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"S_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Var",
"ying",
"Gaussian",
"Markov",
"Chain_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"message",
"\\u",
"to",
"\\u",
"v_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TO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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Testing equality to None | ContinuumIO/ashiba/enaml/enaml/core/operators.py | [
{
"content": "def assert_d_member(klass, binding, readable, writable):\n \"\"\" Assert binding points to a valid declarative member.\n\n Parameters\n ----------\n klass : Declarative\n The declarative class which owns the binding.\n\n binding : BindingConstruct\n The binding construct created by the resolver.\n\n readable : bool\n Whether the member should have the 'd_readable' metadata flag.\n\n writable : bool\n Whether the member should have the 'd_writable' metadata flag.\n\n Returns\n -------\n result : tuple\n A 2-tuple of (name, member) on which the binding should operate.\n\n Raises\n ------\n DeclarativeError\n This will be raised if the member is not valid for the spec.\n\n \"\"\"\n members = klass.members()\n m = members.get(binding.name)\n\n # TODO remove this backwards compatibility mod in Enaml 0.8.0\n if m is None:\n if binding.name == 'fgcolor' and 'foreground' in members:\n _warn_color_binding(binding)\n binding.name = 'foreground'\n m = members['foreground']\n elif binding.name == 'bgcolor' and 'background' in members:\n _warn_color_binding(binding)\n binding.name = 'background'\n m = members['background']\n\n if m is None or m.metadata is None or not m.metadata.get('d_member'):\n msg = \"'%s' is not a declarative member\" % binding.name\n root = binding.root()\n filename = root.filename\n context = root.typename\n lineno = binding.lineno\n raise DeclarativeError(msg, filename, context, lineno)\n if readable and not m.metadata.get('d_readable'):\n msg = \"'%s' is not readable from enaml\" % binding.name\n root = binding.root()\n filename = root.filename\n context = root.typename\n lineno = binding.lineno\n raise DeclarativeError(msg, filename, context, lineno)\n if writable and not m.metadata.get('d_writable'):\n msg = \"'%s' is not writable from enaml\" % binding.name\n root = binding.root()\n filename = root.filename\n context = root.typename\n lineno = binding.lineno\n raise DeclarativeError(msg, filename, context, lineno)\n return m",
"metadata": "root.assert_d_member",
"header": "['module', '___EOS___']",
"index": 353
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"assert",
"\\u",
"d\\u",
"member_",
"(_",
"klass_",
",_",
"binding_",
",_",
"readable_",
",_",
"writable_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Assert",
" ",
"bindi",
"ng",
" ",
"points",
" ",
"to",
" ",
"a",
" ",
"valid",
" ",
"declarative",
" ",
"member",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"klass",
" ",
":",
" ",
"Declarati",
"ve",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"declarative",
" ",
"class",
" ",
"whi",
"ch",
" ",
"owns",
" ",
"the",
" ",
"bindi",
"ng",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bindi",
"ng",
" ",
":",
" ",
"Bind",
"ing",
"Construct",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"bindi",
"ng",
" ",
"construct",
" ",
"created",
" ",
"by",
" ",
"the",
" ",
"resolver",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reada",
"ble",
" ",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whe",
"ther",
" ",
"the",
" ",
"member",
" ",
"shou",
"ld",
" ",
"have",
" ",
"the",
" ",
"'",
"d\\u",
"reada",
"ble",
"'",
" ",
"metadata",
" ",
"flag",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"writ",
"able",
" ",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whe",
"ther",
" ",
"the",
" ",
"member",
" ",
"shou",
"ld",
" ",
"have",
" ",
"the",
" ",
"'",
"d\\u",
"writ",
"able",
"'",
" ",
"metadata",
" ",
"flag",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"result",
" ",
":",
" ",
"tuple",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"2",
"-",
"tuple",
" ",
"of",
" ",
"(",
"name",
",",
" ",
"member",
")",
" ",
"on",
" ",
"whi",
"ch",
" ",
"the",
" ",
"bindi",
"ng",
" ",
"shou",
"ld",
" ",
"operate",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Rai",
"ses",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Declarati",
"ve",
"Error",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"will",
" ",
"be",
" ",
"raise",
"d",
" ",
"if",
" ",
"the",
" ",
"member",
" ",
"is",
" ",
"not",
" ",
"valid",
" ",
"for",
" ",
"the",
" ",
"spec",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"members_",
"=_",
"klass_",
"._",
"members_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"members_",
"._",
"get_",
"(_",
"binding_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
" ",
"remove",
" ",
"this",
" ",
"back",
"ward",
"s",
" ",
"compatibility",
" ",
"mod",
" ",
"in",
" ",
"En",
"aml",
" ",
"0.",
"8.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"m_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"binding_",
"._",
"name_",
"==_",
"'",
"fg",
"color",
"'_",
"and_",
"'",
"fore",
"ground",
"'_",
"in_",
"members_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"warn",
"\\u",
"color",
"\\u",
"binding_",
"(_",
"binding_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"binding_",
"._",
"name_",
"=_",
"'",
"fore",
"ground",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"members_",
"[_",
"'",
"fore",
"ground",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"binding_",
"._",
"name_",
"==_",
"'",
"bg",
"color",
"'_",
"and_",
"'",
"background",
"'_",
"in_",
"members_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"warn",
"\\u",
"color",
"\\u",
"binding_",
"(_",
"binding_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"binding_",
"._",
"name_",
"=_",
"'",
"background",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"m_",
"=_",
"members_",
"[_",
"'",
"background",
"'_",
"]_",
"\\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_",
"m_",
"is_",
"None_",
"or_",
"m_",
"._",
"metadata_",
"is_",
"None_",
"or_",
"not_",
"m_",
"._",
"metadata_",
"._",
"get_",
"(_",
"'",
"d\\u",
"member",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"\"'",
"%",
"s",
"'",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"declarative",
" ",
"member",
"\"_",
"%_",
"binding_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"root_",
"=_",
"binding_",
"._",
"root_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"root_",
"._",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"root_",
"._",
"typename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lineno_",
"=_",
"binding_",
"._",
"lineno_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Declarati",
"ve",
"Error_",
"(_",
"msg_",
",_",
"filename_",
",_",
"context_",
",_",
"lineno_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"readable_",
"and_",
"not_",
"m_",
"._",
"metadata_",
"._",
"get_",
"(_",
"'",
"d\\u",
"reada",
"ble",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"\"'",
"%",
"s",
"'",
" ",
"is",
" ",
"not",
" ",
"reada",
"ble",
" ",
"from",
" ",
"ena",
"ml",
"\"_",
"%_",
"binding_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"root_",
"=_",
"binding_",
"._",
"root_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"root_",
"._",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"root_",
"._",
"typename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lineno_",
"=_",
"binding_",
"._",
"lineno_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Declarati",
"ve",
"Error_",
"(_",
"msg_",
",_",
"filename_",
",_",
"context_",
",_",
"lineno_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"writable_",
"and_",
"not_",
"m_",
"._",
"metadata_",
"._",
"get_",
"(_",
"'",
"d\\u",
"writ",
"able",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"\"'",
"%",
"s",
"'",
" ",
"is",
" ",
"not",
" ",
"writ",
"able",
" ",
"from",
" ",
"ena",
"ml",
"\"_",
"%_",
"binding_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"root_",
"=_",
"binding_",
"._",
"root_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"root_",
"._",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"root_",
"._",
"typename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lineno_",
"=_",
"binding_",
"._",
"lineno_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Declarati",
"ve",
"Error_",
"(_",
"msg_",
",_",
"filename_",
",_",
"context_",
",_",
"lineno_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"m_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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def get_nodes_links(slice, chosen_group=None):\n nodes = []\n links = []\n sr_aggs = get_sr_aggregates(slice)\n\n # Getting image for the nodes\n # FIXME: avoid to ask the user for the complete name of the method here! he should NOT know it\n try:\n image_url = reverse('img_media_sample_resource', args=(\"sensor-tiny.png\",))\n except:\n image_url = 'sensor-tiny.png'\n\n # For every SampleResource AM\n for i, sr_agg in enumerate(sr_aggs):\n sr_agg = sr_agg.sampleresourceaggregate\n # Iterates over every SampleResource contained within the slice\n for sr in sr_agg.get_resources():\n sr = sr.sampleresource\n nodes.append(Node(\n # Users shall not be left the choice to choose group/island; otherwise collision may arise\n name = sr.name, value = sr.id, aggregate = sr.aggregate, type = \"Sample resource\",\n description = get_node_description(sr), image = image_url)\n )\n for connection in sr.get_connections():\n # Two-ways link\n links.append(\n Link(\n target = str(sr.id), source = str(connection.id),\n value = \"rsc_id_%s-rsc_id_%s\" % (connection.id, sr.id)\n ),\n )\n links.append(\n Link(\n target = str(sr.id), source = str(connection.id),\n value = \"rsc_id_%s-rsc_id_%s\" % (sr.id, connection.id)\n ),\n )\n return [nodes, links]",
"metadata": "root.get_nodes_links",
"header": "['module', '___EOS___']",
"index": 118
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Sus",
"picio",
"us_",
"unused_",
"loop_",
"iteration_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"nodes",
"\\u",
"links_",
"(_",
"slice_",
",_",
"chosen",
"\\u",
"group_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nodes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"links_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sr",
"\\u",
"aggs",
"_",
"=_",
"get",
"\\u",
"sr",
"\\u",
"aggregates",
"_",
"(_",
"slice_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
"ting",
" ",
"image",
" ",
"for",
" ",
"the",
" ",
"nodes_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FIX",
"ME",
":",
" ",
"avoid",
" ",
"to",
" ",
"ask",
" ",
"the",
" ",
"user",
" ",
"for",
" ",
"the",
" ",
"complete",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"method",
" ",
"here",
"!",
" ",
"he",
" ",
"shou",
"ld",
" ",
"NOT",
" ",
"know",
" ",
"it_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"image",
"\\u",
"url_",
"=_",
"reverse_",
"(_",
"'",
"img",
"\\u",
"media",
"\\u",
"sample",
"\\u",
"resource",
"'_",
",_",
"args_",
"=_",
"(_",
"\"",
"sensor",
"-",
"tiny",
".",
"png",
"\"_",
",_",
")_",
")_",
"\\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 ",
" _",
"image",
"\\u",
"url_",
"=_",
"'",
"sensor",
"-",
"tiny",
".",
"png",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"every",
" ",
"Sampl",
"e",
"Reso",
"urc",
"e",
" ",
"AM",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
",_",
"sr",
"\\u",
"agg_",
"in_",
"enumerate_",
"(_",
"sr",
"\\u",
"aggs",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sr",
"\\u",
"agg_",
"=_",
"sr",
"\\u",
"agg_",
"._",
"sampler",
"esource",
"aggregate_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Iterat",
"es",
" ",
"over",
" ",
"every",
" ",
"Sampl",
"e",
"Reso",
"urc",
"e",
" ",
"contain",
"ed",
" ",
"within",
" ",
"the",
" ",
"slice_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"sr_",
"in_",
"sr",
"\\u",
"agg_",
"._",
"get",
"\\u",
"resources_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sr_",
"=_",
"sr_",
"._",
"sampler",
"esource",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"nodes_",
"._",
"append_",
"(_",
"Node_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"User",
"s",
" ",
"sha",
"ll",
" ",
"not",
" ",
"be",
" ",
"left",
" ",
"the",
" ",
"choice",
" ",
"to",
" ",
"choose",
" ",
"group",
"/",
"island",
";",
" ",
"other",
"wis",
"e",
" ",
"colli",
"sion",
" ",
"may",
" ",
"aris",
"e_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"sr_",
"._",
"name_",
",_",
"value_",
"=_",
"sr_",
"._",
"id_",
",_",
"aggregate_",
"=_",
"sr_",
"._",
"aggregate_",
",_",
"type_",
"=_",
"\"",
"Sampl",
"e",
" ",
"resource",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"get",
"\\u",
"node",
"\\u",
"description_",
"(_",
"sr_",
")_",
",_",
"image_",
"=_",
"image",
"\\u",
"url_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"connection_",
"in_",
"sr_",
"._",
"get",
"\\u",
"connections_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tw",
"o",
"-",
"way",
"s",
" ",
"link_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"links_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Link_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"target_",
"=_",
"str_",
"(_",
"sr_",
"._",
"id_",
")_",
",_",
"source_",
"=_",
"str_",
"(_",
"connection_",
"._",
"id_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"\"",
"rsc",
"\\u",
"id",
"\\u",
"%",
"s",
"-",
"rsc",
"\\u",
"id",
"\\u",
"%",
"s",
"\"_",
"%_",
"(_",
"connection_",
"._",
"id_",
",_",
"sr_",
"._",
"id_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"links_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Link_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"target_",
"=_",
"str_",
"(_",
"sr_",
"._",
"id_",
")_",
",_",
"source_",
"=_",
"str_",
"(_",
"connection_",
"._",
"id_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"\"",
"rsc",
"\\u",
"id",
"\\u",
"%",
"s",
"-",
"rsc",
"\\u",
"id",
"\\u",
"%",
"s",
"\"_",
"%_",
"(_",
"sr_",
"._",
"id_",
",_",
"connection_",
"._",
"id_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\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
] |
Except block handles 'BaseException' | bipsandbytes/django-api/django_api/decorators.py | [
{
"content": "def validate_json_request(required_fields):\n \"\"\"\n Return a decorator that ensures that the request passed to the view\n function/method has a valid JSON request body with the given required\n fields. The dict parsed from the JSON is then passed as the second\n argument to the decorated function/method. For example:\n\n @json_request({'name', 'date'})\n def view_func(request, request_dict):\n ...\n \"\"\"\n def decorator(func):\n @wraps(func)\n def wrapped_func(request, *args, **kwargs):\n try:\n request_dict = json.loads(request.raw_post_data)\n except ValueError as e:\n return JsonResponseBadRequest('invalid POST JSON: %s' % e)\n\n for k in required_fields:\n if k not in request_dict:\n return JsonResponseBadRequest(\n 'POST JSON must contain property \\'%s\\'' % k)\n\n return func(request, request_dict, *args, **kwargs)\n return wrapped_func\n return decorator",
"metadata": "root.validate_json_request",
"header": "['module', '___EOS___']",
"index": 220
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"validat",
"e\\u",
"json",
"\\u",
"request_",
"(_",
"require",
"d\\u",
"fields_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"decorat",
"or",
" ",
"tha",
"t",
" ",
"ensure",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"request",
" ",
"pass",
"ed",
" ",
"to",
" ",
"the",
" ",
"view",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"function",
"/",
"method",
" ",
"has",
" ",
"a",
" ",
"valid",
" ",
"JSO",
"N",
" ",
"request",
" ",
"body",
" ",
"with",
" ",
"the",
" ",
"give",
"n",
" ",
"require",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fields",
".",
" ",
" ",
"The",
" ",
"dict",
" ",
"parsed",
" ",
"from",
" ",
"the",
" ",
"JSO",
"N",
" ",
"is",
" ",
"then",
" ",
"pass",
"ed",
" ",
"as",
" ",
"the",
" ",
"second",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"argu",
"ment",
" ",
"to",
" ",
"the",
" ",
"decorated",
" ",
"function",
"/",
"method",
".",
" ",
" ",
"For",
" ",
"example",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"json",
"\\u",
"request",
"({",
"'",
"name",
"',",
" ",
"'",
"date",
"'})",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"def",
" ",
"view",
"\\u",
"func",
"(",
"request",
",",
" ",
"request",
"\\u",
"dict",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"decorator_",
"(_",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"wraps_",
"(_",
"func_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"wrapp",
"ed",
"\\u",
"func_",
"(_",
"request_",
",_",
"*_",
"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 ",
" _",
"request",
"\\u",
"dict_",
"=_",
"json_",
"._",
"loads_",
"(_",
"request_",
"._",
"raw",
"\\u",
"post",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Js",
"on",
"Respons",
"e",
"Ba",
"d",
"Request_",
"(_",
"'",
"invalid",
" ",
"POST",
" ",
"JSO",
"N",
":",
" ",
"%",
"s",
"'_",
"%_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"k_",
"in_",
"require",
"d\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"k_",
"not_",
"in_",
"request",
"\\u",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"Js",
"on",
"Respons",
"e",
"Ba",
"d",
"Request_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"POST",
" ",
"JSO",
"N",
" ",
"must",
" ",
"contain",
" ",
"property",
" ",
"\\\\'",
"%",
"s",
"\\\\''_",
"%_",
"k_",
")_",
"\\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_",
"func_",
"(_",
"request_",
",_",
"request",
"\\u",
"dict_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"wrapp",
"ed",
"\\u",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"decorator_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Implicit string concatenation in a list | openstack/python-mistralclient/mistralclient/tests/functional/cli/v2/cli_tests_v2.py | [
{
"content": " def test_cron_trigger_create_delete(self):\n trigger = self.mistral_admin(\n 'cron-trigger-create',\n params=('trigger %s {} --pattern \"5 * * * *\" --count 5'\n ' --first-time \"4242-12-25 13:37\"' % self.wf_name))\n self.assertTableStruct(trigger, ['Field', 'Value'])\n\n tr_name = self.get_value_of_field(trigger, 'Name')\n wf_name = self.get_value_of_field(trigger, 'Workflow')\n created_at = self.get_value_of_field(trigger, 'Created at')\n remain = self.get_value_of_field(trigger, 'Remaining executions')\n next_time = self.get_value_of_field(trigger, 'Next execution time')\n\n self.assertEqual('trigger', tr_name)\n self.assertEqual(self.wf_name, wf_name)\n self.assertIsNotNone(created_at)\n self.assertEqual(\"4242-12-25 13:37:00\", next_time)\n self.assertEqual(\"5\", remain)\n\n trgs = self.mistral_admin('cron-trigger-list')\n self.assertIn(tr_name, [tr['Name'] for tr in trgs])\n self.assertIn(wf_name, [tr['Workflow'] for tr in trgs])\n\n self.mistral('cron-trigger-delete', params=tr_name)\n\n trgs = self.mistral_admin('cron-trigger-list')\n self.assertNotIn(tr_name, [tr['Name'] for tr in trgs])",
"metadata": "root.CronTriggerCLITests.test_cron_trigger_create_delete",
"header": "['class', 'CronTriggerCLITests', '(', 'base_v2', '.', 'MistralClientTestBase', ')', ':', '___EOS___']",
"index": 581
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"class_",
"Cro",
"n",
"Trigger",
"CLI",
"Tests_",
"(_",
"base",
"\\u",
"v2_",
"._",
"Mis",
"tra",
"l",
"Client",
"Test",
"Base_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"cron",
"\\u",
"trigger",
"\\u",
"create",
"\\u",
"delete_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"trigger_",
"=_",
"self_",
"._",
"mist",
"ral",
"\\u",
"admin_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"cron",
"-",
"trigger",
"-",
"create",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"params_",
"=_",
"(_",
"'",
"trigger",
" ",
"%",
"s",
" ",
"{}",
" ",
"--",
"pattern",
" ",
"\"",
"5",
" ",
"*",
" ",
"*",
" ",
"*",
" ",
"*\"",
" ",
"--",
"count",
" ",
"5",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"--",
"first",
"-",
"time",
" ",
"\"",
"424",
"2",
"-1",
"2",
"-",
"25",
" ",
"13",
":",
"3",
"7",
"\"'_",
"%_",
"self_",
"._",
"wf",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Table",
"Struct_",
"(_",
"trigger_",
",_",
"[_",
"'",
"Field",
"'_",
",_",
"'",
"Value",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"tr",
"\\u",
"name_",
"=_",
"self_",
"._",
"get",
"\\u",
"value",
"\\u",
"of",
"\\u",
"field_",
"(_",
"trigger_",
",_",
"'",
"Name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"wf",
"\\u",
"name_",
"=_",
"self_",
"._",
"get",
"\\u",
"value",
"\\u",
"of",
"\\u",
"field_",
"(_",
"trigger_",
",_",
"'",
"Work",
"flow",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"created",
"\\u",
"at_",
"=_",
"self_",
"._",
"get",
"\\u",
"value",
"\\u",
"of",
"\\u",
"field_",
"(_",
"trigger_",
",_",
"'",
"Creat",
"ed",
" ",
"at",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remain_",
"=_",
"self_",
"._",
"get",
"\\u",
"value",
"\\u",
"of",
"\\u",
"field_",
"(_",
"trigger_",
",_",
"'",
"Rema",
"inin",
"g",
" ",
"executions",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"next",
"\\u",
"time_",
"=_",
"self_",
"._",
"get",
"\\u",
"value",
"\\u",
"of",
"\\u",
"field_",
"(_",
"trigger_",
",_",
"'",
"Ne",
"xt",
" ",
"executi",
"on",
" ",
"time",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"trigger",
"'_",
",_",
"tr",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"wf",
"\\u",
"name_",
",_",
"wf",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"created",
"\\u",
"at_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"424",
"2",
"-1",
"2",
"-",
"25",
" ",
"13",
":",
"3",
"7",
":",
"00",
"\"_",
",_",
"next",
"\\u",
"time_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"5",
"\"_",
",_",
"remain_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"trg",
"s_",
"=_",
"self_",
"._",
"mist",
"ral",
"\\u",
"admin_",
"(_",
"'",
"cron",
"-",
"trigger",
"-",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"tr",
"\\u",
"name_",
",_",
"[_",
"tr_",
"[_",
"'",
"Name",
"'_",
"]_",
"for_",
"tr_",
"in_",
"trg",
"s_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"wf",
"\\u",
"name_",
",_",
"[_",
"tr_",
"[_",
"'",
"Work",
"flow",
"'_",
"]_",
"for_",
"tr_",
"in_",
"trg",
"s_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"mist",
"ral_",
"(_",
"'",
"cron",
"-",
"trigger",
"-",
"delete",
"'_",
",_",
"params_",
"=_",
"tr",
"\\u",
"name_",
")_",
"\\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
] |
Imprecise assert | zbyte64/django-dockit/dockit/tests/schema/fields_tests.py | [
{
"content": " def compare_py_val_to_primitive(self, py_val, primitive):\n self.assertTrue(isinstance(py_val, DotPathSet))\n self.assertEqual(py_val, set(primitive))",
"metadata": "root.SetFieldTestCase.compare_py_val_to_primitive",
"header": "['class', 'SetFieldTestCase', '(', 'BaseFieldTestCase', ')', ':', '___EOS___']",
"index": 191
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Set",
"Field",
"Test",
"Case_",
"(_",
"Base",
"Field",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"compare",
"\\u",
"py",
"\\u",
"val",
"\\u",
"to",
"\\u",
"primitive_",
"(_",
"self_",
",_",
"py",
"\\u",
"val_",
",_",
"primitive_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"isinstance_",
"(_",
"py",
"\\u",
"val_",
",_",
"Dot",
"Path",
"Set_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"py",
"\\u",
"val_",
",_",
"set_",
"(_",
"primitive_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | frappe/frappe/frappe/website/context.py | [
{
"content": "def add_sidebar_data(context):\n\tfrom frappe.utils.user import get_fullname_and_avatar\n\timport frappe.templates.pages.list\n\n\tcontext.my_account_list = frappe.get_all('Portal Menu Item',\n\t\t\tfields=['title', 'route', 'reference_doctype'], filters={'enabled': 1}, order_by='idx asc')\n\n\tfor item in context.my_account_list:\n\t\tif item.reference_doctype:\n\t\t\titem.count = len(frappe.templates.pages.list.get(item.reference_doctype).get('result'))\n\n\tinfo = get_fullname_and_avatar(frappe.session.user)\n\tcontext[\"fullname\"] = info.fullname\n\tcontext[\"user_image\"] = info.avatar",
"metadata": "root.add_sidebar_data",
"header": "['module', '___EOS___']",
"index": 82
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"sidebar",
"\\u",
"data_",
"(_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"from_",
"frappe_",
"._",
"utils_",
"._",
"user_",
"import_",
"get",
"\\u",
"full",
"name",
"\\u",
"and",
"\\u",
"avatar_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"frappe_",
"._",
"templates_",
"._",
"pages_",
"._",
"list_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"._",
"my",
"\\u",
"account",
"\\u",
"list_",
"=_",
"frappe_",
"._",
"get",
"\\u",
"all_",
"(_",
"'",
"Porta",
"l",
" ",
"Menu",
" ",
"Item",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"'",
"title",
"'_",
",_",
"'",
"route",
"'_",
",_",
"'",
"reference",
"\\u",
"doct",
"ype",
"'_",
"]_",
",_",
"filters_",
"=_",
"{_",
"'",
"enable",
"d",
"'_",
":_",
"1_",
"}_",
",_",
"order",
"\\u",
"by_",
"=_",
"'",
"idx",
" ",
"asc",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"item_",
"in_",
"context_",
"._",
"my",
"\\u",
"account",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"item_",
"._",
"reference",
"\\u",
"doctype_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"item_",
"._",
"count_",
"=_",
"len_",
"(_",
"frappe_",
"._",
"templates_",
"._",
"pages_",
"._",
"list_",
"._",
"get_",
"(_",
"item_",
"._",
"reference",
"\\u",
"doctype_",
")_",
"._",
"get_",
"(_",
"'",
"result",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"info_",
"=_",
"get",
"\\u",
"full",
"name",
"\\u",
"and",
"\\u",
"avatar_",
"(_",
"frappe_",
"._",
"session_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"\"",
"full",
"name",
"\"_",
"]_",
"=_",
"info_",
"._",
"fullname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"\"",
"user",
"\\u",
"image",
"\"_",
"]_",
"=_",
"info_",
"._",
"avatar_",
"\\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
] |
Except block handles 'BaseException' | pandaproject/panda/panda/api/utils.py | [
{
"content": " def try_api_keys(self, request, **kwargs):\n \"\"\"\n Attempt to authenticate with API keys in headers or parameters.\n \"\"\"\n email = request.META.get('HTTP_PANDA_EMAIL') or request.GET.get('email')\n api_key = request.META.get('HTTP_PANDA_API_KEY') or request.GET.get('api_key')\n\n if email:\n email = unquote(email)\n\n if not email or not api_key:\n return False\n\n try:\n user = UserProxy.objects.get(username=email.lower())\n except (UserProxy.DoesNotExist, UserProxy.MultipleObjectsReturned):\n return False \n\n if not user.is_active:\n return False\n \n request.user = user\n\n return self.get_key(user, api_key)",
"metadata": "root.PandaAuthentication.try_api_keys",
"header": "['class', 'PandaAuthentication', '(', 'ApiKeyAuthentication', ')', ':', '___EOS___']",
"index": 143
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Pan",
"da",
"Authentication_",
"(_",
"Ap",
"i",
"Key",
"Authentication_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"try",
"\\u",
"api",
"\\u",
"keys_",
"(_",
"self_",
",_",
"request_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Atte",
"mpt",
" ",
"to",
" ",
"authenticat",
"e",
" ",
"with",
" ",
"API",
" ",
"keys",
" ",
"in",
" ",
"header",
"s",
" ",
"or",
" ",
"parameter",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email_",
"=_",
"request_",
"._",
"META_",
"._",
"get_",
"(_",
"'",
"HTTP",
"\\u",
"PAN",
"DA",
"\\u",
"EMA",
"IL",
"'_",
")_",
"or_",
"request_",
"._",
"GET_",
"._",
"get_",
"(_",
"'",
"email",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api",
"\\u",
"key_",
"=_",
"request_",
"._",
"META_",
"._",
"get_",
"(_",
"'",
"HTTP",
"\\u",
"PAN",
"DA",
"\\u",
"API",
"\\u",
"KEY",
"'_",
")_",
"or_",
"request_",
"._",
"GET_",
"._",
"get_",
"(_",
"'",
"api",
"\\u",
"key",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"email_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"email_",
"=_",
"unquote_",
"(_",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"email_",
"or_",
"not_",
"api",
"\\u",
"key_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"User",
"Proxy_",
"._",
"objects_",
"._",
"get_",
"(_",
"username_",
"=_",
"email_",
"._",
"lower_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"User",
"Proxy_",
"._",
"Do",
"es",
"Not",
"Exist_",
",_",
"User",
"Proxy_",
"._",
"Multipl",
"e",
"Object",
"s",
"Return",
"ed_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"user_",
"._",
"is",
"\\u",
"active_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"request_",
"._",
"user_",
"=_",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"self_",
"._",
"get",
"\\u",
"key_",
"(_",
"user_",
",_",
"api",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | diefenbach/django-lfs/lfs/manage/property/views.py | [
{
"content": "@permission_required(\"core.manage_shop\")\ndef manage_properties(request):\n \"\"\"The main view to manage properties.\n \"\"\"\n try:\n prop = Property.objects.filter(local=False)[0]\n url = reverse(\"lfs_manage_shop_property\", kwargs={\"id\": prop.pk})\n except IndexError:\n url = reverse(\"lfs_manage_no_shop_properties\")\n\n return HttpResponseRedirect(url)",
"metadata": "root.manage_properties",
"header": "['module', '___EOS___']",
"index": 37
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"permissi",
"on",
"\\u",
"required_",
"(_",
"\"",
"core",
".",
"manage",
"\\u",
"shop",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"manage",
"\\u",
"properties_",
"(_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"The",
" ",
"main",
" ",
"view",
" ",
"to",
" ",
"manage",
" ",
"proper",
"ties",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"prop_",
"=_",
"Property_",
"._",
"objects_",
"._",
"filter_",
"(_",
"local_",
"=_",
"False_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"reverse_",
"(_",
"\"",
"lf",
"s",
"\\u",
"manage",
"\\u",
"shop",
"\\u",
"property",
"\"_",
",_",
"kwargs_",
"=_",
"{_",
"\"",
"id",
"\"_",
":_",
"prop_",
"._",
"pk_",
"}_",
")_",
"\\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 ",
" _",
"url_",
"=_",
"reverse_",
"(_",
"\"",
"lf",
"s",
"\\u",
"manage",
"\\u",
"no",
"\\u",
"shop",
"\\u",
"proper",
"ties",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Http",
"Respons",
"e",
"Redirect_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Use of the return value of a procedure | mne-tools/mne-python/mne/tests/test_label.py | [
{
"content": "@testing.requires_testing_data\ndef test_label_io():\n \"\"\"Test IO of label files\n \"\"\"\n tempdir = _TempDir()\n label = read_label(label_fname)\n\n # label attributes\n assert_equal(label.name, 'test-lh')\n assert_is(label.subject, None)\n assert_is(label.color, None)\n\n # save and reload\n label.save(op.join(tempdir, 'foo'))\n label2 = read_label(op.join(tempdir, 'foo-lh.label'))\n assert_labels_equal(label, label2)\n\n # pickling\n dest = op.join(tempdir, 'foo.pickled')\n with open(dest, 'wb') as fid:\n pickle.dump(label, fid, pickle.HIGHEST_PROTOCOL)\n with open(dest, 'rb') as fid:\n label2 = pickle.load(fid)\n assert_labels_equal(label, label2)",
"metadata": "root.test_label_io",
"header": "['module', '___EOS___']",
"index": 292
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Use_",
"of_",
"the_",
"return_",
"value_",
"of_",
"a_",
"procedure_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"testing_",
"._",
"require",
"s",
"\\u",
"testi",
"ng",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"label",
"\\u",
"io_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
" ",
"IO",
" ",
"of",
" ",
"label",
" ",
"files",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tempdir_",
"=_",
"\\u",
"Temp",
"Dir_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"label_",
"=_",
"read",
"\\u",
"label_",
"(_",
"label",
"\\u",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"label",
" ",
"attributes_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"label_",
"._",
"name_",
",_",
"'",
"test",
"-",
"lh",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"is_",
"(_",
"label_",
"._",
"subject_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"is_",
"(_",
"label_",
"._",
"color_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"save",
" ",
"and",
" ",
"reload_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"._",
"save_",
"(_",
"op_",
"._",
"join_",
"(_",
"tempdir_",
",_",
"'",
"foo",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"label2",
"_",
"=_",
"read",
"\\u",
"label_",
"(_",
"op_",
"._",
"join_",
"(_",
"tempdir_",
",_",
"'",
"foo",
"-",
"lh",
".",
"label",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"labels",
"\\u",
"equal_",
"(_",
"label_",
",_",
"label2",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pick",
"ling_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"op_",
"._",
"join_",
"(_",
"tempdir_",
",_",
"'",
"foo",
".",
"pickled",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"dest_",
",_",
"'",
"wb",
"'_",
")_",
"as_",
"fid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pickle_",
"._",
"dump_",
"(_",
"label_",
",_",
"fid_",
",_",
"pickle_",
"._",
"HIGHE",
"ST",
"\\u",
"PROTOCOL_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"open_",
"(_",
"dest_",
",_",
"'",
"rb",
"'_",
")_",
"as_",
"fid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"label2",
"_",
"=_",
"pickle_",
"._",
"load_",
"(_",
"fid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"labels",
"\\u",
"equal_",
"(_",
"label_",
",_",
"label2",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | ImageEngine/gaffer/python/GafferUI/BoolPlugValueWidget.py | [
{
"content": "##########################################################################\n#\n# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.\n# Copyright (c) 2012-2013, John Haddon. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nfrom __future__ import with_statement\n\nimport IECore\n\nimport Gaffer\nimport GafferUI\n\n## Supported plug metadata :\n#\n# - \"boolPlugValueWidget:displayMode\", with a value of \"checkBox\" or \"switch\"\n\nGafferUI.PlugValueWidget.registerType( Gaffer.BoolPlug, BoolPlugValueWidget )\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class BoolPlugValueWidget( GafferUI.PlugValueWidget ) :\n\n\n\n\n",
"metadata": "root.BoolPlugValueWidget",
"header": "['module', '___EOS___']",
"index": 47
},
{
"content": "\tdef __init__( self, plug, displayMode=GafferUI.BoolWidget.DisplayMode.CheckBox, parenting=None ) :\n\n\t\tself.__boolWidget = GafferUI.BoolWidget( displayMode=displayMode )\n\n\t\tGafferUI.PlugValueWidget.__init__( self, self.__boolWidget, plug, parenting = parenting )\n\n\t\tself._addPopupMenu( self.__boolWidget )\n\n\t\tself.__stateChangedConnection = self.__boolWidget.stateChangedSignal().connect( Gaffer.WeakMethod( self.__stateChanged ) )\n\n\t\tself._updateFromPlug()",
"metadata": "root.BoolPlugValueWidget.__init__",
"header": "['class', 'BoolPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']",
"index": 49
},
{
"content": "\tdef setHighlighted( self, highlighted ) :\n\n\t\tGafferUI.PlugValueWidget.setHighlighted( self, highlighted )\n\t\tself.__boolWidget.setHighlighted( highlighted )",
"metadata": "root.BoolPlugValueWidget.setHighlighted",
"header": "['class', 'BoolPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']",
"index": 61
},
{
"content": "\tdef _updateFromPlug( self ) :\n\n\t\tif self.getPlug() is not None :\n\n\t\t\tvalue = None\n\t\t\twith self.getContext() :\n\t\t\t\t# Since BoolWidget doesn't yet have a way of\n\t\t\t\t# displaying errors, we just ignore exceptions\n\t\t\t\t# and leave UI components like GraphGadget to\n\t\t\t\t# display them via Node.errorSignal().\n\t\t\t\twith IECore.IgnoredExceptions( Exception ) :\n\t\t\t\t\tvalue = self.getPlug().getValue()\n\n\t\t\tif value is not None :\n\t\t\t\twith Gaffer.BlockedConnection( self.__stateChangedConnection ) :\n\t\t\t\t\tself.__boolWidget.setState( value )\n\n\t\t\tdisplayMode = Gaffer.Metadata.plugValue( self.getPlug(), \"boolPlugValueWidget:displayMode\" )\n\t\t\tif displayMode is not None :\n\t\t\t\tself.__boolWidget.setDisplayMode( self.__boolWidget.DisplayMode.Switch if displayMode == \"switch\" else self.__boolWidget.DisplayMode.CheckBox )\n\n\t\tself.__boolWidget.setEnabled( self._editable( canEditAnimation = True ) )",
"metadata": "root.BoolPlugValueWidget._updateFromPlug",
"header": "['class', 'BoolPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']",
"index": 66
},
{
"content": "\tdef __stateChanged( self, widget ) :\n\n\t\tself.__setPlugValue()\n\n\t\treturn False",
"metadata": "root.BoolPlugValueWidget.__stateChanged",
"header": "['class', 'BoolPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']",
"index": 89
},
{
"content": "\tdef __setPlugValue( self ) :\n\n\t\twith Gaffer.UndoContext( self.getPlug().ancestor( Gaffer.ScriptNode ) ) :\n\n\t\t\tif Gaffer.Animation.isAnimated( self.getPlug() ) :\n\t\t\t\tcurve = Gaffer.Animation.acquire( self.getPlug() )\n\t\t\t\tcurve.addKey(\n\t\t\t\t\tGaffer.Animation.Key(\n\t\t\t\t\t\ttime = self.getContext().getTime(),\n\t\t\t\t\t\tvalue = self.__boolWidget.getState(),\n\t\t\t\t\t\ttype = Gaffer.Animation.Type.Step\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\telse :\n\t\t\t\tself.getPlug().setValue( self.__boolWidget.getState() )",
"metadata": "root.BoolPlugValueWidget.__setPlugValue",
"header": "['class', 'BoolPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']",
"index": 95
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2011",
"-",
"2013",
",",
" ",
"Image",
" ",
"Engine",
" ",
"Desig",
"n",
" ",
"Inc",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2012",
"-",
"2013",
",",
" ",
"Joh",
"n",
" ",
"Had",
"don",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Redistributi",
"on",
" ",
"and",
" ",
"use",
" ",
"in",
" ",
"source",
" ",
"and",
" ",
"binar",
"y",
" ",
"forms",
",",
" ",
"with",
" ",
"or",
" ",
"with",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
" ",
"are",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Nei",
"ther",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"Joh",
"n",
" ",
"Had",
"don",
" ",
"nor",
" ",
"the",
" ",
"names",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"any",
" ",
"other",
" ",
"contributor",
"s",
" ",
"to",
" ",
"this",
" ",
"software",
" ",
"may",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"endo",
"rse",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"promote",
" ",
"products",
" ",
"derive",
"d",
" ",
"from",
" ",
"this",
" ",
"software",
" ",
"with",
"out",
" ",
"specific",
" ",
"prior_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"writt",
"en",
" ",
"permissi",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THIS",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"BY",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"AND",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"\"",
"AS_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"IS",
"\"",
" ",
"AND",
" ",
"ANY",
" ",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
",",
" ",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THE",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"AND",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PUR",
"POS",
"E",
" ",
"ARE",
" ",
"DISC",
"LAI",
"MED",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"OWNER",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"DIRECT",
",",
" ",
"INDI",
"RECT",
",",
" ",
"INC",
"IDENT",
"AL",
",",
" ",
"SPECIAL",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"EXE",
"MPL",
"ARY",
",",
" ",
"OR",
" ",
"CONS",
"EQU",
"ENTI",
"AL",
" ",
"DA",
"MAGE",
"S",
" ",
"(",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROC",
"URE",
"MENT",
" ",
"OF",
" ",
"SUBST",
"ITU",
"TE",
" ",
"GOOD",
"S",
" ",
"OR",
" ",
"SERVICES",
";",
" ",
"LOSS",
" ",
"OF",
" ",
"USE",
",",
" ",
"DATA",
",",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROF",
"IT",
"S",
";",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")",
" ",
"HO",
"WE",
"VER",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",",
" ",
"STRI",
"CT",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
")",
" ",
"ARI",
"SIN",
"G",
" ",
"IN",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF",
" ",
"ADV",
"ISE",
"D",
" ",
"OF",
" ",
"THE",
" ",
"POS",
"SIB",
"ILI",
"TY",
" ",
"OF",
" ",
"SUC",
"H",
" ",
"DA",
"MAGE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"with",
"\\u",
"statement_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"IE",
"Core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"UI_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Supp",
"orte",
"d",
" ",
"plug",
" ",
"metadata",
" ",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-",
" ",
"\"",
"bool",
"Plug",
"Value",
"Wid",
"get",
":",
"display",
"Mode",
"\",",
" ",
"with",
" ",
"a",
" ",
"value",
" ",
"of",
" ",
"\"",
"check",
"Box",
"\"",
" ",
"or",
" ",
"\"",
"switch",
"\"_",
"\\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_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
"._",
"register",
"Type_",
"(_",
"Ga",
"ffer",
"_",
"._",
"Boo",
"l",
"Plug",
"_",
",_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"plug_",
",_",
"display",
"Mode_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Boo",
"l",
"Widget_",
"._",
"Display",
"Mode_",
"._",
"Check",
"Box_",
",_",
"parent",
"ing_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Boo",
"l",
"Widget_",
"(_",
"display",
"Mode_",
"=_",
"display",
"Mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
",_",
"plug_",
",_",
"parent",
"ing_",
"=_",
"parent",
"ing_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"add",
"Pop",
"up",
"Menu_",
"(_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"state",
"Change",
"d",
"Connection_",
"=_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"state",
"Change",
"d",
"Signal_",
"(_",
")_",
"._",
"connect_",
"(_",
"Ga",
"ffer",
"_",
"._",
"Wea",
"k",
"Method_",
"(_",
"self_",
"._",
"\\u\\u",
"state",
"Changed_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"update",
"Fro",
"m",
"Plug",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Highlight",
"ed_",
"(_",
"self_",
",_",
"highlighted",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
"._",
"set",
"Highlight",
"ed_",
"(_",
"self_",
",_",
"highlighted",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"set",
"Highlight",
"ed_",
"(_",
"highlighted",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"update",
"Fro",
"m",
"Plug",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"value_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"get",
"Context_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Sin",
"ce",
" ",
"Boo",
"l",
"Wid",
"get",
" ",
"doe",
"sn",
"'",
"t",
" ",
"ye",
"t",
" ",
"have",
" ",
"a",
" ",
"way",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"display",
"ing",
" ",
"error",
"s",
",",
" ",
"we",
" ",
"just",
" ",
"ignore",
" ",
"exceptions_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"and",
" ",
"lea",
"ve",
" ",
"UI",
" ",
"component",
"s",
" ",
"like",
" ",
"Graph",
"Ga",
"dget",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"display",
" ",
"them",
" ",
"via",
" ",
"Node",
".",
"error",
"Signal",
"()",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"with_",
"IE",
"Core_",
"._",
"Ignor",
"ed",
"Exceptions_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"value_",
"=_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
"._",
"get",
"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_",
"if_",
"value_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"with_",
"Ga",
"ffer",
"_",
"._",
"Blocked",
"Connection_",
"(_",
"self_",
"._",
"\\u\\u",
"state",
"Change",
"d",
"Connection_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"set",
"State_",
"(_",
"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_",
"display",
"Mode_",
"=_",
"Ga",
"ffer",
"_",
"._",
"Metadata_",
"._",
"plug",
"Value_",
"(_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
",_",
"\"",
"bool",
"Plug",
"Value",
"Wid",
"get",
":",
"display",
"Mode",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"display",
"Mode_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"set",
"Display",
"Mode_",
"(_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"Display",
"Mode_",
"._",
"Switch_",
"if_",
"display",
"Mode_",
"==_",
"\"",
"switch",
"\"_",
"else_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"Display",
"Mode_",
"._",
"Check",
"Box_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"set",
"Enabled_",
"(_",
"self_",
"._",
"\\u",
"editable_",
"(_",
"can",
"Edit",
"Animation_",
"=_",
"True_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"state",
"Changed_",
"(_",
"self_",
",_",
"widget_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"\\u\\u",
"set",
"Plug",
"Value_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Boo",
"l",
"Plug",
"Value",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Plug",
"Value",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"set",
"Plug",
"Value_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"with_",
"Ga",
"ffer",
"_",
"._",
"Und",
"o",
"Context_",
"(_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
"._",
"ancestor_",
"(_",
"Ga",
"ffer",
"_",
"._",
"Script",
"Node_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"if_",
"Ga",
"ffer",
"_",
"._",
"Animation_",
"._",
"is",
"Animat",
"ed_",
"(_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"curve_",
"=_",
"Ga",
"ffer",
"_",
"._",
"Animation_",
"._",
"acquire_",
"(_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"curve_",
"._",
"add",
"Key_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ga",
"ffer",
"_",
"._",
"Animation_",
"._",
"Key_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"time_",
"=_",
"self_",
"._",
"get",
"Context_",
"(_",
")_",
"._",
"get",
"Time_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"get",
"State_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"type_",
"=_",
"Ga",
"ffer",
"_",
"._",
"Animation_",
"._",
"Type_",
"._",
"Step_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"self_",
"._",
"get",
"Plug",
"_",
"(_",
")_",
"._",
"set",
"Value_",
"(_",
"self_",
"._",
"\\u\\u",
"bool",
"Widget_",
"._",
"get",
"State_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | tariqdaouda/Mariana/Mariana/training/recorders.py | [
{
"content": "import sys, os\nfrom pyGeno.tools.parsers.CSVTools import CSVFile\n\n__all__ = [\"Recorder_ABC\", \"GGPlot2\"]\n\n\n\n\n\n\n\t\t\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Recorder_ABC(object) :\n\t\"\"\"A recorder is meant to be plugged into a trainer to record the\n\tadvancement of the training. This is the interface a Recorder must expose.\"\"\"\n\t\n",
"metadata": "root.Recorder_ABC",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": "\tdef commit(self, store, model) :\n\t\t\"\"\"Does something with the currenty state of the trainer's store and the model\"\"\"\n\t\traise NotImplemented(\"Should be implemented in child\")",
"metadata": "root.Recorder_ABC.commit",
"header": "['class', 'Recorder_ABC', '(', 'object', ')', ':', '___EOS___']",
"index": 9
},
{
"content": "\tdef __len__(self) :\n\t\t\"\"\"returns the number of commits performed\"\"\"\n\t\traise NotImplemented(\"Should be implemented in child\")",
"metadata": "root.Recorder_ABC.__len__",
"header": "['class', 'Recorder_ABC', '(', 'object', ')', ':', '___EOS___']",
"index": 13
},
{
"content": "class GGPlot2(Recorder_ABC):\n \t\"\"\"This training recorder will create a nice CSV file fit for using with ggplot2 and will update\n \tit as the training goes. It will also save the best model for each set of the trainer, and print\n \tregular reports on the console.\n\n \t:param int printRate: The rate at which the status is printed on the console. If set to <= to 0, will never print.\n \t:param int write: The rate at which the status is written on disk\n \t:param list saveBestsFor: Name of the sets for wich the best models parameters should be saved\n \t\"\"\"\n",
"metadata": "root.GGPlot2",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": " \tdef __init__(self, filename, saveBestsFor = [\"test\", \"validation\"], printRate=1, writeRate=1):\n\t\t\n\t\tself.filename = filename.replace(\".csv\", \"\") + \".ggplot2.csv\"\n\t\n \t\tself.bestScores = {}\n\t\tself.currentScores = {}\n\n\t\tself.csvLegend = None\n\t\tself.csvFile = None\n\n\t\tself.length = 0\n\n\t\tself.printRate = printRate\n\t\tself.writeRate = writeRate\n\t\tself.saveBestsFor = saveBestsFor",
"metadata": "root.GGPlot2.__init__",
"header": "['class', 'GGPlot2', '(', 'Recorder_ABC', ')', ':', '___EOS___']",
"index": 27
},
{
"content": "\tdef getBestModelFilename(self, outputName, theSet) :\n\t\treturn \"best-%s-%s-%s\" % (outputName, theSet, self.filename)",
"metadata": "root.getBestModelFilename",
"header": "['module', '___EOS___']",
"index": 43
},
{
"content": "\tdef commit(self, store, model) :\n\t\t\"\"\"Appends the current state of the store to the CSV. This one is meant to be called by the trainer\"\"\"\n\t\tdef _fillLine(csvFile, score, bestScore, setName, setLen, outputName, **csvValues) :\n\t\t\tline = csvFile.newLine()\n\t\t\tfor k, v in csvValues.iteritems() :\n\t\t\t\tline[k] = v\n\t\t\tline[\"score\"] = score\n\t\t\tline[\"best_score\"] = bestScore[0]\n\t\t\tline[\"best_score_commit\"] = bestScore[1]\n\t\t\tline[\"set\"] = \"%s(%s)\" %(setName, setLen)\n\t\t\tline[\"output\"] = outputName\n\t\t\tline.commit()\n\t\t\n\t\tself.length += 1\n\t\tif self.csvLegend is None :\n\t\t\tself.csvLegend = store[\"hyperParameters\"].keys()\n\t\t\tself.csvLegend.extend(store[\"runInfos\"].keys())\n\t\t\tself.csvLegend.extend( [\"score\", \"best_score\", \"best_score_commit\", \"set\", \"output\"] )\n\n\t\t\tself.csvFile = CSVFile(legend = self.csvLegend)\n\t\t\tself.csvFile.streamToFile( self.filename, writeRate = self.writeRate )\n\n\t\tfor theSet, scores in store[\"scores\"].iteritems() :\n\t\t\tself.currentScores[theSet] = {}\n\t\t\tif theSet not in self.bestScores :\n\t\t\t\tself.bestScores[theSet] = {}\n\t\t\tfor outputName, score in scores.iteritems() :\n\t\t\t\tself.currentScores[theSet][outputName] = score\n\t\t\t\tif outputName not in self.bestScores[theSet] or score < self.bestScores[theSet][outputName][0] :\n\t\t\t\t\tself.bestScores[theSet][outputName] = (score, self.length)\n\t\t\t\t\tif theSet in self.saveBestsFor :\n\t\t\t\t\t\tmodel.save(self.getBestModelFilename(outputName, theSet))\n\n\t\t\t\tmuchData = store[\"hyperParameters\"]\n\t\t\t\tmuchData.update(store[\"runInfos\"]) \n\t\t\t\t_fillLine(\n\t\t\t\t\tself.csvFile,\n\t\t\t\t\tself.currentScores[theSet][outputName],\n\t\t\t\t\tself.bestScores[theSet][outputName],\n\t\t\t\t\ttheSet,\n\t\t\t\t\tstore[\"setSizes\"][theSet],\n\t\t\t\t\toutputName,\n\t\t\t\t\t**muchData\n\t\t\t\t)\n\t\n\t\tif self.printRate > 0 and (self.length%self.printRate) == 0:\n\t\t\tself.printCurrentState()",
"metadata": "root.commit",
"header": "['module', '___EOS___']",
"index": 46
},
{
"content": "\tdef printCurrentState(self) :\n\t\t\"\"\"prints the current state stored in the recorder\"\"\"\n\t\tif self.length > 0 :\n\t\t\tprint \"\\n==>rec: ggplot2, commit %s, pid: %s:\" % (self.length, os.getpid())\n\t\t\tfor setName, scores in self.bestScores.iteritems() :\n\t\t\t\tprint \" |-%s set\" % setName\n\t\t\t\tfor outputName in scores :\n\t\t\t\t\tif self.currentScores[setName][outputName] == self.bestScores[setName][outputName][0] :\n\t\t\t\t\t\thighlight = \"+best+\"\n\t\t\t\t\telse :\n\t\t\t\t\t\tscore, epoch = self.bestScores[setName][outputName]\n\t\t\t\t\t\thighlight = \"(best: %s @ commit: %s)\" % (score, epoch)\n\t\t\t\t\t\n\t\t\t\t\tprint \" |->%s: %s %s\" % (outputName, self.currentScores[setName][outputName], highlight)\n\t\telse :\n\t\t\tprint \"==>rec: ggplot2, nothing to show yet\"\n\t\t\n\t\tsys.stdout.flush()",
"metadata": "root.printCurrentState",
"header": "['module', '___EOS___']",
"index": 94
},
{
"content": "\tdef getBestModel(self, outputName, theSet) :\n\t\t\"\"\"returns the best model for a given output and set\"\"\"\n\t\timport Mariana.network as MNET\n\t\tfn = self.getBestModelFilename(outputName, theSet)\n\t\treturn MNET.loadModel(fn)",
"metadata": "root.getBestModel",
"header": "['module', '___EOS___']",
"index": 113
},
{
"content": "\tdef __len__(self) :\n\t\t\"\"\"returns the number of commits performed\"\"\"\n\t\treturn self.length",
"metadata": "root.__len__",
"header": "['module', '___EOS___']",
"index": 119
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"sys_",
",_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"py",
"Geno",
"_",
"._",
"tools_",
"._",
"parsers_",
"._",
"CSV",
"Tools_",
"import_",
"CSV",
"File_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"\"",
"Recorder",
"\\u",
"ABC",
"\"_",
",_",
"\"",
"GG",
"Plot",
"2",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Recorder",
"\\u",
"ABC_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"\"\"\"",
"A",
" ",
"recorde",
"r",
" ",
"is",
" ",
"mean",
"t",
" ",
"to",
" ",
"be",
" ",
"plug",
"ged",
" ",
"int",
"o",
" ",
"a",
" ",
"trainer",
" ",
"to",
" ",
"record",
" ",
"the",
"\\",
"10",
";",
"\t",
"advance",
"ment",
" ",
"of",
" ",
"the",
" ",
"train",
"ing",
".",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"interface",
" ",
"a",
" ",
"Recorder",
" ",
"must",
" ",
"expos",
"e",
".\"\"\"_",
"\\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_",
"Recorder",
"\\u",
"ABC_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"commit_",
"(_",
"self_",
",_",
"store_",
",_",
"model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"Do",
"es",
" ",
"somet",
"hing",
" ",
"with",
" ",
"the",
" ",
"current",
"y",
" ",
"state",
" ",
"of",
" ",
"the",
" ",
"trainer",
"'",
"s",
" ",
"store",
" ",
"and",
" ",
"the",
" ",
"model",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Implemented_",
"(_",
"\"",
"Sho",
"ul",
"d",
" ",
"be",
" ",
"implemented",
" ",
"in",
" ",
"child",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Recorder",
"\\u",
"ABC_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"len\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"return",
"s",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"commit",
"s",
" ",
"perform",
"ed",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Implemented_",
"(_",
"\"",
"Sho",
"ul",
"d",
" ",
"be",
" ",
"implemented",
" ",
"in",
" ",
"child",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"GG",
"Plot",
"2_",
"(_",
"Recorder",
"\\u",
"ABC_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
"\t_",
"\"\"\"",
"Thi",
"s",
" ",
"train",
"ing",
" ",
"recorde",
"r",
" ",
"will",
" ",
"create",
" ",
"a",
" ",
"nice",
" ",
"CSV",
" ",
"file",
" ",
"fit",
" ",
"for",
" ",
"usi",
"ng",
" ",
"with",
" ",
"gg",
"plot",
"2",
" ",
"and",
" ",
"will",
" ",
"update",
"\\",
"10",
";",
" ",
"\t",
"it",
" ",
"as",
" ",
"the",
" ",
"train",
"ing",
" ",
"go",
"es",
".",
" ",
"It",
" ",
"will",
" ",
"als",
"o",
" ",
"save",
" ",
"the",
" ",
"best",
" ",
"model",
" ",
"for",
" ",
"each",
" ",
"set",
" ",
"of",
" ",
"the",
" ",
"trainer",
",",
" ",
"and",
" ",
"print",
"\\",
"10",
";",
" ",
"\t",
"regular",
" ",
"report",
"s",
" ",
"on",
" ",
"the",
" ",
"console",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
"\t",
":",
"param",
" ",
"int",
" ",
"print",
"Rat",
"e",
":",
" ",
"The",
" ",
"rate",
" ",
"at",
" ",
"whi",
"ch",
" ",
"the",
" ",
"status",
" ",
"is",
" ",
"printed",
" ",
"on",
" ",
"the",
" ",
"console",
".",
" ",
"If",
" ",
"set",
" ",
"to",
" ",
"<=",
" ",
"to",
" ",
"0",
",",
" ",
"will",
" ",
"neve",
"r",
" ",
"print",
".",
"\\",
"10",
";",
" ",
"\t",
":",
"param",
" ",
"int",
" ",
"write",
":",
" ",
"The",
" ",
"rate",
" ",
"at",
" ",
"whi",
"ch",
" ",
"the",
" ",
"status",
" ",
"is",
" ",
"writt",
"en",
" ",
"on",
" ",
"disk",
"\\",
"10",
";",
" ",
"\t",
":",
"param",
" ",
"list",
" ",
"save",
"Bes",
"ts",
"For",
":",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"sets",
" ",
"for",
" ",
"wic",
"h",
" ",
"the",
" ",
"best",
" ",
"model",
"s",
" ",
"parameter",
"s",
" ",
"shou",
"ld",
" ",
"be",
" ",
"saved",
"\\",
"10",
";",
" ",
"\t",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"GG",
"Plot",
"2_",
"(_",
"Recorder",
"\\u",
"ABC_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"filename_",
",_",
"save",
"Bes",
"ts",
"For_",
"=_",
"[_",
"\"",
"test",
"\"_",
",_",
"\"",
"validation",
"\"_",
"]_",
",_",
"print",
"Rate_",
"=_",
"1_",
",_",
"write",
"Rate_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"filename_",
"=_",
"filename_",
"._",
"replace_",
"(_",
"\".",
"csv",
"\"_",
",_",
"\"\"_",
")_",
"+_",
"\".",
"gg",
"plot",
"2",
".",
"csv",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"best",
"Scores_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"current",
"Scores_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"csv",
"Legend",
"_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"csv",
"File_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"length_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"print",
"Rate_",
"=_",
"print",
"Rate_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"write",
"Rate_",
"=_",
"write",
"Rate_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"save",
"Bes",
"ts",
"For_",
"=_",
"save",
"Bes",
"ts",
"For_",
"\\u\\u\\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",
"Bes",
"t",
"Model",
"Filename_",
"(_",
"self_",
",_",
"output",
"Name_",
",_",
"the",
"Set_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"\"",
"best",
"-%",
"s",
"-%",
"s",
"-%",
"s",
"\"_",
"%_",
"(_",
"output",
"Name_",
",_",
"the",
"Set_",
",_",
"self_",
"._",
"filename_",
")_",
"\\u\\u\\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_",
"commit_",
"(_",
"self_",
",_",
"store_",
",_",
"model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"Append",
"s",
" ",
"the",
" ",
"current",
" ",
"state",
" ",
"of",
" ",
"the",
" ",
"store",
" ",
"to",
" ",
"the",
" ",
"CSV",
".",
" ",
"Thi",
"s",
" ",
"one",
" ",
"is",
" ",
"mean",
"t",
" ",
"to",
" ",
"be",
" ",
"call",
"ed",
" ",
"by",
" ",
"the",
" ",
"trainer",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"fill",
"Line_",
"(_",
"csv",
"File_",
",_",
"score_",
",_",
"best",
"Score_",
",_",
"set",
"Name_",
",_",
"set",
"Len_",
",_",
"output",
"Name_",
",_",
"**_",
"csv",
"Values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"line_",
"=_",
"csv",
"File_",
"._",
"new",
"Line_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"csv",
"Values_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"line_",
"[_",
"k_",
"]_",
"=_",
"v_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"line_",
"[_",
"\"",
"score",
"\"_",
"]_",
"=_",
"score_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"[_",
"\"",
"best",
"\\u",
"score",
"\"_",
"]_",
"=_",
"best",
"Score_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"[_",
"\"",
"best",
"\\u",
"score",
"\\u",
"commit",
"\"_",
"]_",
"=_",
"best",
"Score_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"[_",
"\"",
"set",
"\"_",
"]_",
"=_",
"\"%",
"s",
"(%",
"s",
")\"_",
"%_",
"(_",
"set",
"Name_",
",_",
"set",
"Len_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"[_",
"\"",
"output",
"\"_",
"]_",
"=_",
"output",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"._",
"commit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"length_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"csv",
"Legend",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"csv",
"Legend",
"_",
"=_",
"store_",
"[_",
"\"",
"hyper",
"Parameter",
"s",
"\"_",
"]_",
"._",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"csv",
"Legend",
"_",
"._",
"extend_",
"(_",
"store_",
"[_",
"\"",
"run",
"Info",
"s",
"\"_",
"]_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"csv",
"Legend",
"_",
"._",
"extend_",
"(_",
"[_",
"\"",
"score",
"\"_",
",_",
"\"",
"best",
"\\u",
"score",
"\"_",
",_",
"\"",
"best",
"\\u",
"score",
"\\u",
"commit",
"\"_",
",_",
"\"",
"set",
"\"_",
",_",
"\"",
"output",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"csv",
"File_",
"=_",
"CSV",
"File_",
"(_",
"legend_",
"=_",
"self_",
"._",
"csv",
"Legend",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"csv",
"File_",
"._",
"stream",
"To",
"File_",
"(_",
"self_",
"._",
"filename_",
",_",
"write",
"Rate_",
"=_",
"self_",
"._",
"write",
"Rate_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"the",
"Set_",
",_",
"scores_",
"in_",
"store_",
"[_",
"\"",
"score",
"s",
"\"_",
"]_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"current",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"the",
"Set_",
"not_",
"in_",
"self_",
"._",
"best",
"Scores_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"self_",
"._",
"best",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"output",
"Name_",
",_",
"score_",
"in_",
"scores_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"self_",
"._",
"current",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"[_",
"output",
"Name_",
"]_",
"=_",
"score_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"output",
"Name_",
"not_",
"in_",
"self_",
"._",
"best",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"or_",
"score_",
"<_",
"self_",
"._",
"best",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"[_",
"output",
"Name_",
"]_",
"[_",
"0_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"self_",
"._",
"best",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"[_",
"output",
"Name_",
"]_",
"=_",
"(_",
"score_",
",_",
"self_",
"._",
"length_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"the",
"Set_",
"in_",
"self_",
"._",
"save",
"Bes",
"ts",
"For_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"model_",
"._",
"save_",
"(_",
"self_",
"._",
"get",
"Bes",
"t",
"Model",
"Filename_",
"(_",
"output",
"Name_",
",_",
"the",
"Set_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"muc",
"h",
"Data_",
"=_",
"store_",
"[_",
"\"",
"hyper",
"Parameter",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"muc",
"h",
"Data_",
"._",
"update_",
"(_",
"store_",
"[_",
"\"",
"run",
"Info",
"s",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"fill",
"Line_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"csv",
"File_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"current",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"[_",
"output",
"Name_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"best",
"Scores_",
"[_",
"the",
"Set_",
"]_",
"[_",
"output",
"Name_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"the",
"Set_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"store_",
"[_",
"\"",
"set",
"Size",
"s",
"\"_",
"]_",
"[_",
"the",
"Set_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"Name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"muc",
"h",
"Data_",
"\\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_",
"self_",
"._",
"print",
"Rate_",
">_",
"0_",
"and_",
"(_",
"self_",
"._",
"length_",
"%_",
"self_",
"._",
"print",
"Rate_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"print",
"Curr",
"ent",
"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_",
"print",
"Curr",
"ent",
"State_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"print",
"s",
" ",
"the",
" ",
"current",
" ",
"state",
" ",
"store",
"d",
" ",
"in",
" ",
"the",
" ",
"recorde",
"r",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"length_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"print_",
"\"\\\\",
"n",
"==",
">",
"rec",
":",
" ",
"gg",
"plot",
"2",
",",
" ",
"commit",
" ",
"%",
"s",
",",
" ",
"pid",
":",
" ",
"%",
"s",
":\"_",
"%_",
"(_",
"self_",
"._",
"length_",
",_",
"os_",
"._",
"getpid_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"set",
"Name_",
",_",
"scores_",
"in_",
"self_",
"._",
"best",
"Scores_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"print_",
"\"",
" ",
" ",
"|",
"-%",
"s",
" ",
"set",
"\"_",
"%_",
"set",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"output",
"Name_",
"in_",
"scores_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"if_",
"self_",
"._",
"current",
"Scores_",
"[_",
"set",
"Name_",
"]_",
"[_",
"output",
"Name_",
"]_",
"==_",
"self_",
"._",
"best",
"Scores_",
"[_",
"set",
"Name_",
"]_",
"[_",
"output",
"Name_",
"]_",
"[_",
"0_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"highlight_",
"=_",
"\"+",
"best",
"+\"_",
"\\u\\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\t\t_",
"score_",
",_",
"epoch_",
"=_",
"self_",
"._",
"best",
"Scores_",
"[_",
"set",
"Name_",
"]_",
"[_",
"output",
"Name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"highlight_",
"=_",
"\"(",
"best",
":",
" ",
"%",
"s",
" ",
"@",
" ",
"commit",
":",
" ",
"%",
"s",
")\"_",
"%_",
"(_",
"score_",
",_",
"epoch_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"\"",
" ",
" ",
" ",
" ",
"|",
"->",
"%",
"s",
":",
" ",
"%",
"s",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"output",
"Name_",
",_",
"self_",
"._",
"current",
"Scores_",
"[_",
"set",
"Name_",
"]_",
"[_",
"output",
"Name_",
"]_",
",_",
"highlight_",
")_",
"\\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\t",
"\t\t_",
"print_",
"\"==",
">",
"rec",
":",
" ",
"gg",
"plot",
"2",
",",
" ",
"not",
"hing",
" ",
"to",
" ",
"show",
" ",
"ye",
"t",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\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",
"Bes",
"t",
"Model_",
"(_",
"self_",
",_",
"output",
"Name_",
",_",
"the",
"Set_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"return",
"s",
" ",
"the",
" ",
"best",
" ",
"model",
" ",
"for",
" ",
"a",
" ",
"give",
"n",
" ",
"output",
" ",
"and",
" ",
"set",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Mari",
"ana",
"_",
"._",
"network_",
"as_",
"MN",
"ET_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fn_",
"=_",
"self_",
"._",
"get",
"Bes",
"t",
"Model",
"Filename_",
"(_",
"output",
"Name_",
",_",
"the",
"Set_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"MN",
"ET_",
"._",
"load",
"Model_",
"(_",
"fn_",
")_",
"\\u\\u\\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\\u",
"len\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"\"\"\"",
"return",
"s",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"commit",
"s",
" ",
"perform",
"ed",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"length_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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,
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
] |
Except block handles 'BaseException' | gbowerman/azurerm/tests/createstorage.py | [
{
"content": "import azurerm\nimport json\n\n# Load Azure app defaults\ntry:\n with open('azurermconfig.json') as configFile:\n configData = json.load(configFile)\nexcept FileNotFoundError:\n print(\"Error: Expecting vmssConfig.json in current folder\")\n sys.exit()\n\ntenant_id = configData['tenantId']\napp_id = configData['appId']\napp_secret = configData['appSecret']\nsubscription_id = configData['subscriptionId']\nresource_group = configData['resourceGroup']\nvmssname = configData['vmssName']\n\naccess_token = azurerm.get_access_token(\n tenant_id,\n application_id,\n application_secret\n)\n\n# create a storage account \nprint('Enter storage account name to create.')\nsaname = input()\nlocation = 'southeastasia'\nsareturn = azurerm.create_storage_account(access_token, subscription_id, resource_group, saname, location)\nprint(sareturn)\n\nprint('Storage account details...')\n\n# get storage account details\nsa_info = azurerm.get_storage_account(access_token, subscription_id, resource_group, saname)\nprint(json.dumps(sa_info, sort_keys=False, indent=2, separators=(',', ': ')))\n\nprint('Storage account quota...')\n\n# get storage account quota\nquota_info = azurerm.get_storage_usage(access_token, subscription_id)\nprint(json.dumps(quota_info, sort_keys=False, indent=2, separators=(',', ': ')))\n\nprint('Storage account keys...')\n\n# get storage account keys\nkeys = azurerm.get_storage_account_keys(access_token, subscription_id, resource_group, saname)\nprint(json.dumps(keys.text, sort_keys=False, indent=2, separators=(',', ': ')))\n# print(keys.text)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"azu",
"rer",
"m_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Load",
" ",
"Az",
"ure",
" ",
"app",
" ",
"defaults_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"'",
"azu",
"rer",
"mco",
"nfig",
".",
"json",
"'_",
")_",
"as_",
"config",
"File_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"config",
"Data_",
"=_",
"json_",
"._",
"load_",
"(_",
"config",
"File_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"File",
"Not",
"Foun",
"d",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"Error",
":",
" ",
"Expecti",
"ng",
" ",
"vms",
"s",
"Config",
".",
"json",
" ",
"in",
" ",
"current",
" ",
"folder",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tenan",
"t",
"\\u",
"id_",
"=_",
"config",
"Data_",
"[_",
"'",
"tenan",
"t",
"Id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app",
"\\u",
"id_",
"=_",
"config",
"Data_",
"[_",
"'",
"app",
"Id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app",
"\\u",
"secret_",
"=_",
"config",
"Data_",
"[_",
"'",
"app",
"Sec",
"ret",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subscript",
"ion",
"\\u",
"id_",
"=_",
"config",
"Data_",
"[_",
"'",
"subscript",
"ion",
"Id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resource",
"\\u",
"group_",
"=_",
"config",
"Data_",
"[_",
"'",
"resource",
"Group",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vms",
"sname_",
"=_",
"config",
"Data_",
"[_",
"'",
"vms",
"s",
"Name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"access",
"\\u",
"token_",
"=_",
"azu",
"rer",
"m_",
"._",
"get",
"\\u",
"access",
"\\u",
"token_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"tenan",
"t",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"applica",
"tion",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"applica",
"tion",
"\\u",
"secret_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"create",
" ",
"a",
" ",
"storage",
" ",
"account",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"'",
"Enter",
" ",
"storage",
" ",
"account",
" ",
"name",
" ",
"to",
" ",
"create",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"san",
"ame_",
"=_",
"input_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"location_",
"=_",
"'",
"south",
"east",
"asia",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sar",
"etu",
"rn_",
"=_",
"azu",
"rer",
"m_",
"._",
"create",
"\\u",
"storage",
"\\u",
"account_",
"(_",
"access",
"\\u",
"token_",
",_",
"subscript",
"ion",
"\\u",
"id_",
",_",
"resource",
"\\u",
"group_",
",_",
"san",
"ame_",
",_",
"location_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"sar",
"etu",
"rn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"'",
"Stor",
"age",
" ",
"account",
" ",
"deta",
"il",
"s",
"...'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"storage",
" ",
"account",
" ",
"details_",
"\\u\\u\\uNL\\u\\u\\u_",
"sa",
"\\u",
"info_",
"=_",
"azu",
"rer",
"m_",
"._",
"get",
"\\u",
"storage",
"\\u",
"account_",
"(_",
"access",
"\\u",
"token_",
",_",
"subscript",
"ion",
"\\u",
"id_",
",_",
"resource",
"\\u",
"group_",
",_",
"san",
"ame_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"json_",
"._",
"dumps_",
"(_",
"sa",
"\\u",
"info_",
",_",
"sort",
"\\u",
"keys_",
"=_",
"False_",
",_",
"indent_",
"=_",
"2_",
",_",
"separators_",
"=_",
"(_",
"','_",
",_",
"':",
" ",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"'",
"Stor",
"age",
" ",
"account",
" ",
"quot",
"a",
"...'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"storage",
" ",
"account",
" ",
"quota_",
"\\u\\u\\uNL\\u\\u\\u_",
"quot",
"a",
"\\u",
"info_",
"=_",
"azu",
"rer",
"m_",
"._",
"get",
"\\u",
"storage",
"\\u",
"usage_",
"(_",
"access",
"\\u",
"token_",
",_",
"subscript",
"ion",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"json_",
"._",
"dumps_",
"(_",
"quot",
"a",
"\\u",
"info_",
",_",
"sort",
"\\u",
"keys_",
"=_",
"False_",
",_",
"indent_",
"=_",
"2_",
",_",
"separators_",
"=_",
"(_",
"','_",
",_",
"':",
" ",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"'",
"Stor",
"age",
" ",
"account",
" ",
"keys",
"...'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"storage",
" ",
"account",
" ",
"keys_",
"\\u\\u\\uNL\\u\\u\\u_",
"keys_",
"=_",
"azu",
"rer",
"m_",
"._",
"get",
"\\u",
"storage",
"\\u",
"account",
"\\u",
"keys_",
"(_",
"access",
"\\u",
"token_",
",_",
"subscript",
"ion",
"\\u",
"id_",
",_",
"resource",
"\\u",
"group_",
",_",
"san",
"ame_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"json_",
"._",
"dumps_",
"(_",
"keys_",
"._",
"text_",
",_",
"sort",
"\\u",
"keys_",
"=_",
"False_",
",_",
"indent_",
"=_",
"2_",
",_",
"separators_",
"=_",
"(_",
"','_",
",_",
"':",
" ",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
"(",
"keys",
".",
"text",
")_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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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
] |
Unnecessary pass | sunscrapers/djet/testproject/tests/tests/test_assertions.py | [
{
"content": " def test_assert_instance_created_raises_assertion_error_when_not_created(self):\n with self.assertRaisesRegexp(AssertionError, 'No MockModel found'):\n with self.assert_instance_created(models.MockModel, field='value'):\n pass",
"metadata": "root.InstanceAssertionsMixinTest.test_assert_instance_created_raises_assertion_error_when_not_created",
"header": "['class', 'InstanceAssertionsMixinTest', '(', 'assertions', '.', 'InstanceAssertionsMixin', ',', 'TestCase', ')', ':', '___EOS___']",
"index": 174
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"pass_",
"[SEP]_",
"class_",
"Insta",
"nce",
"Assert",
"ion",
"s",
"Mix",
"in",
"Test_",
"(_",
"assertions_",
"._",
"Insta",
"nce",
"Assert",
"ion",
"s",
"Mixin_",
",_",
"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",
"assert",
"\\u",
"instance",
"\\u",
"created",
"\\u",
"raise",
"s",
"\\u",
"assertion",
"\\u",
"error",
"\\u",
"whe",
"n",
"\\u",
"not",
"\\u",
"created_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"self_",
"._",
"assert",
"Rai",
"ses",
"Regexp_",
"(_",
"Assert",
"ion",
"Error_",
",_",
"'",
"No",
" ",
"Moc",
"k",
"Model",
" ",
"found",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"self_",
"._",
"assert",
"\\u",
"instance",
"\\u",
"created_",
"(_",
"models_",
"._",
"Moc",
"k",
"Model_",
",_",
"field_",
"=_",
"'",
"value",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | deanhiller/databus/webapp/play1.3.x/python/Lib/multiprocessing/connection.py | [
{
"content": "def answer_challenge(connection, authkey):\n import hmac\n assert isinstance(authkey, bytes)\n message = connection.recv_bytes(256) # reject large message\n assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message\n message = message[len(CHALLENGE):]\n digest = hmac.new(authkey, message).digest()\n connection.send_bytes(digest)\n response = connection.recv_bytes(256) # reject large message\n if response != WELCOME:\n raise AuthenticationError('digest sent was rejected')",
"metadata": "root.answer_challenge",
"header": "['module', '___EOS___']",
"index": 367
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"answer",
"\\u",
"challenge_",
"(_",
"connection_",
",_",
"auth",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"hmac_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"isinstance_",
"(_",
"auth",
"key_",
",_",
"bytes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"=_",
"connection_",
"._",
"recv",
"\\u",
"bytes_",
"(_",
"256_",
")_",
"#",
" ",
"reject",
" ",
"large",
" ",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"message_",
"[_",
":_",
"len_",
"(_",
"CHA",
"LLE",
"NGE",
"_",
")_",
"]_",
"==_",
"CHA",
"LLE",
"NGE",
"_",
",_",
"'",
"message",
" ",
"=",
" ",
"%",
"r",
"'_",
"%_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"=_",
"message_",
"[_",
"len_",
"(_",
"CHA",
"LLE",
"NGE",
"_",
")_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"digest_",
"=_",
"hmac_",
"._",
"new_",
"(_",
"auth",
"key_",
",_",
"message_",
")_",
"._",
"digest_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"connection_",
"._",
"send",
"\\u",
"bytes_",
"(_",
"digest_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"connection_",
"._",
"recv",
"\\u",
"bytes_",
"(_",
"256_",
")_",
"#",
" ",
"reject",
" ",
"large",
" ",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"response_",
"!=_",
"WEL",
"COM",
"E_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Auth",
"entica",
"tion",
"Error_",
"(_",
"'",
"digest",
" ",
"sent",
" ",
"was",
" ",
"reject",
"ed",
"'_",
")_",
"\\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
] |
Unnecessary delete statement in function | Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/tools/multidimensional_zonal_statistics_as_table.py | [
{
"content": " def zonal_statistics_as_table_for_discrete(self, parameters, messages, dataset):\n \"\"\"Performs zonal statistics as table assuming dataset is a CF 1.6\n compliant discrete sampling geometry dataset of 'point', 'timeseries',\n or 'profile' feature type using an orthogonal or incomplete\n multidimensional array data representation.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n\n # Grab the parameter values\n dataset_name = input_parameter.valueAsText # input netCDF filename\n output_filename = output_parameter.valueAsText # output filename\n var_name = variable_parameter.valueAsText # netCDF variable name\n\n # Get associated station, x, and y variables\n (stat_variable, x_variable, y_variable) = self.get_dependent_variables(\n dataset, var_name)\n if (stat_variable is None) or (x_variable is None) or (y_variable is None):\n messages.addErrorMessage('%s is not a station variable.' % var_name)\n raise arcpy.ExecuteError\n\n # Extract variable from netCDF dataset\n arr_var = dataset.variable(var_name)\n\n # Extract coordinates attribute\n dim_names = []\n if 'coordinates' in arr_var.ncattrs():\n dim_names = str(arr_var.getncattr('coordinates')).split()\n\n # Get coordinate arrays\n X = dataset.variable(x_variable)\n Y = dataset.variable(y_variable)\n\n # Make array of station indices\n if stat_variable in dataset.variable_names():\n arr_stat = dataset.variable(stat_variable)[:]\n else:\n arr_stat = numpy.arange(len(dataset.dimension(stat_variable)))\n\n # Empty dictionary to hold stations falling within each zone\n zone_stations = {}\n # where the keys are values of the zone field and the key values\n # are each a list of station indices contained within that zone\n\n # Process input zone data\n desc = arcpy.Describe(zone_parameter.value)\n\n # Was a temporary feature class created?\n bltemppoly = False\n\n # Convert raster to polygon if necessary\n valid_raster_types = [\"RasterLayer\", \"RasterDataset\"]\n valid_feature_types = [\"ShapeFile\",\"FeatureLayer\", \"FeatureDataset\"]\n if desc.dataType in valid_raster_types:\n temp_poly = \"in_memory\\\\temp\"\n arcpy.RasterToPolygon_conversion(in_raster, temp_poly, \\\n \"NO_SIMPLIFY\", zonefield_parameter.value)\n temp_field = \"GRIDCODE\"\n bltemppoly = True\n elif desc.dataType in valid_feature_types:\n temp_poly = zone_parameter.value\n temp_field = zonefield_parameter.value\n else:\n messages.addErrorMessage(\"Not a valid zone dataset.\")\n raise arcpy.ExecuteError\n\n num_recs = int(arcpy.GetCount_management(temp_poly).getOutput(0))\n num_recs *= numpy.prod(arr_stat.shape)\n\n arcpy.SetProgressor(\"step\", \"Building zone feature look-up...\", 0, num_recs, 1)\n\n # Find zones associated with each feature\n desc = arcpy.Describe(temp_poly)\n rows = arcpy.SearchCursor(temp_poly)\n for row in rows:\n feat = row.getValue(desc.ShapeFieldName)\n zone = row.getValue(temp_field)\n for station in arr_stat:\n if feat.contains(arcpy.Point(float(X[station]),float(Y[station]))):\n if not zone in zone_stations.keys():\n zone_stations[zone] = []\n zone_stations[zone].append(station)\n arcpy.SetProgressorPosition()\n del rows, row\n arcpy.ResetProgressor()\n\n # Delete temporary feature class if it exists\n if bltemppoly:\n arcpy.Delete_management(temp_poly)\n\n # Check if variable is packed\n ispacked = hasattr(arr_var,'scale_factor') or hasattr(arr_var, 'add_offset')\n # Determine whether given statistic is categorical or not\n new_var_dtype = False\n for stat in self.statistics:\n if type_parameter.valueAsText in stat[1].keys():\n new_var_dtype = stat[2]\n break\n type_changed = False\n if ('int' in str(arr_var.dtype)) and (not new_var_dtype) and (\n not ispacked):\n type_changed = True\n\n # Slice generator\n # Adapted from: http://code.activestate.com/recipes/\n # 502194-a-generator-for-an-arbitrary-number-of-for-loops/\n # Originally written by Steven Bethard\n def multi_for(iterables):\n if not iterables:\n yield ()\n else:\n if isinstance(iterables[0], collections.Iterable):\n for item in iterables[0]:\n for rest_tuple in multi_for(iterables[1:]):\n yield (item,) + rest_tuple\n else:\n for rest_tuple in multi_for(iterables[1:]):\n yield (iterables[0],) + rest_tuple\n\n # Generate slice list\n dim_shape = arr_var.shape\n dim_name = arr_var.dimensions\n dim_slices = []\n dim_dims = []\n dim_prod = 1\n for dim_index, dim_item in enumerate(dim_name):\n if dim_item != stat_variable:\n dim_prod *= dim_shape[dim_index]\n dim_slices.append(xrange(dim_shape[dim_index]))\n dim_dims.append((str(dim_item), numpy.int))\n\n # Get position of statistic\n stat_position = dim_name.index(stat_variable)\n\n blstructcreated = False\n\n def hstack_struct(arr1, arr2):\n # Will only work correctly if arr1 and arr2 only have one record\n dt = numpy.lib.recfunctions.zip_descr((arr1, arr2), flatten=True)\n return numpy.array(arr1.tolist() + arr2.tolist(), dtype = dt)\n\n # Progress bar\n dim_prod *= len(zone_stations)\n arcpy.ResetProgressor()\n arcpy.SetProgressor('step', 'Calculating...', 0, dim_prod, 1)\n\n # Loop through zones\n index = 0\n valid_indices = []\n for zone in zone_stations:\n\n # Grab station indices associated with zone\n zone_indices = zone_stations[zone]\n\n # Loop through slices\n for varslice in multi_for(dim_slices):\n\n # Insert station indices into slice\n varslice = list(varslice)\n varslice.insert(stat_position, zone_indices)\n\n # Take slice from data\n if type_changed:\n arr_slice = arr_var[varslice].astype('f8')\n else:\n arr_slice = arr_var[varslice]\n\n # Create masked array\n if hasattr(arr_slice, 'mask'):\n arr_mask = arr_slice.mask.copy()\n else:\n arr_mask = numpy.ma.make_mask_none(arr_slice.shape)\n arr_slice = numpy.ma.asarray(arr_slice)\n\n # Perform for zone when NoData is ignored\n # or when there is no NoData within zone\n if ignore_parameter.value or (not numpy.any(arr_mask)):\n\n # Apply mask\n arr_slice.mask = arr_mask\n\n # Apply operator to zone masked slice\n result = self.calculate_statistic(arr_slice[:], \\\n type_parameter.valueAsText)\n\n # Structure results into row\n struct_data = []\n for it_ind, it in enumerate(list(varslice)):\n if it_ind != stat_position:\n if dim_name[it_ind] in dataset.variable_names():\n # Dimension with variable\n struct_data.append(dataset.variable(dim_name[it_ind])[it])\n else:\n # Dimension without variable\n struct_data.append(it)\n struct_data.append(zone)\n struct_data.append(numpy.ma.count(arr_slice))\n if numpy.isscalar(result):\n # Single-valued result\n struct_data.append(result)\n else:\n # Multivalued result\n struct_data += [it2 for it in result.tolist() for it2 in it]\n\n # Create table when necessary\n if not blstructcreated:\n struct_dtype = dim_dims[:]\n struct_dtype.append((str(zonefield_parameter.value),numpy.int))\n struct_dtype.append(('COUNT', numpy.int))\n if numpy.isscalar(result):\n # Single-valued result\n struct_dtype.append((str(type_parameter.valueAsText), \\\n numpy.float))\n else:\n # Multivalued result\n struct_dtype += [(it, numpy.float) for it in list(\n result.dtype.names)]\n struct = numpy.zeros((dim_prod,), numpy.dtype(struct_dtype))\n blstructcreated = True\n\n # Insert row\n struct[index] = numpy.array(tuple(struct_data), \\\n numpy.dtype(struct_dtype))\n valid_indices.append(index)\n #else:\n # # Passing drops zones with NoData in them from table\n # pass\n index += 1\n arcpy.SetProgressorPosition()\n\n arcpy.ResetProgressor()\n\n if 'time' in dim_name:\n # Output zonal statistics to temporary table\n temp_table = os.path.join(tempfile.gettempdir(), 'temp_table.dbf')\n if arcpy.Exists(temp_table):\n arcpy.Delete_management(temp_table)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], temp_table)\n # Create table view of the time dimension from netCDF file\n temp_mdtable = r\"md_table\"\n arcpy.MakeNetCDFTableView_md(dataset_name, 'time', temp_mdtable, 'time')\n # Get time field from table view\n desc_fields = arcpy.ListFields(temp_mdtable)\n time_field = desc_fields[[field.name for field in \\\n desc_fields].index('time')]\n # Create a table in the output location\n arcpy.CreateTable_management(*os.path.split(output_filename))\n # Add fields from temporary table except for time field, which\n # we add from the MakeNetCDFTableView\n desc_fields = arcpy.ListFields(temp_table)\n for index, field in enumerate(desc_fields):\n if field.type != 'OID':\n if field.name == 'time':\n arcpy.AddField_management(output_filename, time_field.name, \\\n time_field.type, time_field.precision, time_field.scale, \\\n time_field.length, time_field.aliasName, \\\n time_field.isNullable, time_field.required, \\\n time_field.domain)\n else:\n arcpy.AddField_management(output_filename, field.name, \\\n field.type, field.precision, field.scale, field.length, \\\n field.aliasName, field.isNullable, field.required,\n field.domain)\n arcpy.DeleteField_management(output_filename,\"Field1\")\n # Create list of datetime objects from table view\n time_arc = []\n with arcpy.da.SearchCursor(temp_mdtable, 'time') as cursor:\n for row in cursor:\n time_arc.append(row[0])\n del cursor\n # Get time variable from netCDF dataset\n time_var = dataset.variable('time')[:].tolist()\n # Loop through entries from temporary table\n with arcpy.da.InsertCursor(output_filename, '*') as ins_cursor:\n new_time_ind = ins_cursor.fields.index('time')\n with arcpy.da.SearchCursor(temp_table, '*') as cursor:\n time_ind = cursor.fields.index('time')\n for row in cursor:\n new_row = list(row)\n new_row[new_time_ind] = \\\n time_arc[time_var.index(row[time_ind])]\n ins_cursor.insertRow(tuple(new_row))\n del ins_cursor\n del cursor\n else:\n # Write table\n if arcpy.env.overwriteOutput:\n arcpy.Delete_management(output_filename)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], output_filename)\n\n return",
"metadata": "root.MultidimensionalZonalStatisticsAsTable.zonal_statistics_as_table_for_discrete",
"header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']",
"index": 862
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"delete_",
"statement_",
"in_",
"function_",
"[SEP]_",
"class_",
"Multi",
"dimension",
"al",
"Zon",
"al",
"Statistic",
"s",
"As",
"Table_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"zona",
"l\\u",
"statistic",
"s",
"\\u",
"as",
"\\u",
"table",
"\\u",
"for",
"\\u",
"discrete",
"_",
"(_",
"self_",
",_",
"parameters_",
",_",
"messages_",
",_",
"dataset_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Perform",
"s",
" ",
"zona",
"l",
" ",
"statistic",
"s",
" ",
"as",
" ",
"table",
" ",
"ass",
"umi",
"ng",
" ",
"dataset",
" ",
"is",
" ",
"a",
" ",
"CF",
" ",
"1.6",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"compliant",
" ",
"discrete",
" ",
"samp",
"ling",
" ",
"geom",
"etry",
" ",
"dataset",
" ",
"of",
" ",
"'",
"point",
"',",
" ",
"'",
"times",
"eries",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"or",
" ",
"'",
"profile",
"'",
" ",
"feature",
" ",
"type",
" ",
"usi",
"ng",
" ",
"an",
" ",
"orthogonal",
" ",
"or",
" ",
"incomplete",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"multid",
"ime",
"nsion",
"al",
" ",
"array",
" ",
"data",
" ",
"represent",
"ation",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"zone",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"input",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"variab",
"le",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"3_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"type",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"4_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ignore",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"5_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zone",
"field",
"\\u",
"parameter_",
"=_",
"parameters_",
"[_",
"6_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Grab",
" ",
"the",
" ",
"parameter",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"dataset",
"\\u",
"name_",
"=_",
"input",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
"#",
" ",
"input",
" ",
"net",
"CD",
"F",
" ",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output",
"\\u",
"filename_",
"=_",
"output",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
"#",
" ",
"output",
" ",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"var",
"\\u",
"name_",
"=_",
"variab",
"le",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
"#",
" ",
"net",
"CD",
"F",
" ",
"variab",
"le",
" ",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"associate",
"d",
" ",
"station",
",",
" ",
"x",
",",
" ",
"and",
" ",
"y",
" ",
"variables_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"stat",
"\\u",
"variable_",
",_",
"x",
"\\u",
"variable_",
",_",
"y",
"\\u",
"variable_",
")_",
"=_",
"self_",
"._",
"get",
"\\u",
"dependent",
"\\u",
"variables_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"dataset_",
",_",
"var",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"stat",
"\\u",
"variable_",
"is_",
"None_",
")_",
"or_",
"(_",
"x",
"\\u",
"variable_",
"is_",
"None_",
")_",
"or_",
"(_",
"y",
"\\u",
"variable_",
"is_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"messages_",
"._",
"add",
"Error",
"Message_",
"(_",
"'%",
"s",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"station",
" ",
"variab",
"le",
".'_",
"%_",
"var",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"arcpy_",
"._",
"Execut",
"e",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Extract",
" ",
"variab",
"le",
" ",
"from",
" ",
"net",
"CD",
"F",
" ",
"dataset_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arr",
"\\u",
"var_",
"=_",
"dataset_",
"._",
"variable_",
"(_",
"var",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Extract",
" ",
"coordinate",
"s",
" ",
"attribute_",
"\\u\\u\\uNL\\u\\u\\u_",
"dim",
"\\u",
"names_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"coordinate",
"s",
"'_",
"in_",
"arr",
"\\u",
"var_",
"._",
"nca",
"ttr",
"s_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dim",
"\\u",
"names_",
"=_",
"str_",
"(_",
"arr",
"\\u",
"var_",
"._",
"getn",
"catt",
"r_",
"(_",
"'",
"coordinate",
"s",
"'_",
")_",
")_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"coordinate",
" ",
"arrays_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"X_",
"=_",
"dataset_",
"._",
"variable_",
"(_",
"x",
"\\u",
"variable_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"=_",
"dataset_",
"._",
"variable_",
"(_",
"y",
"\\u",
"variable_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"array",
" ",
"of",
" ",
"station",
" ",
"indices_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"stat",
"\\u",
"variable_",
"in_",
"dataset_",
"._",
"variab",
"le",
"\\u",
"names_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arr",
"\\u",
"stat_",
"=_",
"dataset_",
"._",
"variable_",
"(_",
"stat",
"\\u",
"variable_",
")_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arr",
"\\u",
"stat_",
"=_",
"numpy_",
"._",
"arange_",
"(_",
"len_",
"(_",
"dataset_",
"._",
"dimension_",
"(_",
"stat",
"\\u",
"variable_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Emp",
"ty",
" ",
"dictionar",
"y",
" ",
"to",
" ",
"hold",
" ",
"station",
"s",
" ",
"falling",
" ",
"within",
" ",
"each",
" ",
"zone_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"zone",
"\\u",
"stations_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
" ",
" ",
"where",
" ",
"the",
" ",
"keys",
" ",
"are",
" ",
"values",
" ",
"of",
" ",
"the",
" ",
"zone",
" ",
"field",
" ",
"and",
" ",
"the",
" ",
"key",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"are",
" ",
"each",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"station",
" ",
"indice",
"s",
" ",
"contain",
"ed",
" ",
"within",
" ",
"tha",
"t",
" ",
"zone_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Process",
" ",
"input",
" ",
"zone",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc_",
"=_",
"arcpy_",
"._",
"Describe",
"_",
"(_",
"zone",
"\\u",
"parameter_",
"._",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Wa",
"s",
" ",
"a",
" ",
"temporar",
"y",
" ",
"feature",
" ",
"class",
" ",
"created",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"bl",
"temp",
"poly_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"rast",
"er",
" ",
"to",
" ",
"poly",
"gon",
" ",
"if",
" ",
"necessar",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"valid",
"\\u",
"rast",
"er",
"\\u",
"types_",
"=_",
"[_",
"\"",
"Ras",
"ter",
"Layer",
"\"_",
",_",
"\"",
"Ras",
"ter",
"Datas",
"et",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"valid",
"\\u",
"feature",
"\\u",
"types_",
"=_",
"[_",
"\"",
"Shape",
"File",
"\"_",
",_",
"\"",
"Feature",
"Layer",
"\"_",
",_",
"\"",
"Feature",
"Datas",
"et",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"desc_",
"._",
"data",
"Type_",
"in_",
"valid",
"\\u",
"rast",
"er",
"\\u",
"types_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"temp",
"\\u",
"poly_",
"=_",
"\"",
"in",
"\\u",
"memory",
"\\\\\\\\",
"temp",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Ras",
"ter",
"To",
"Polygon",
"\\u",
"conversion_",
"(_",
"in",
"\\u",
"raster_",
",_",
"temp",
"\\u",
"poly_",
",_",
"\"",
"NO",
"\\u",
"SIM",
"PLI",
"FY",
"\"_",
",_",
"zone",
"field",
"\\u",
"parameter_",
"._",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"temp",
"\\u",
"field_",
"=_",
"\"",
"GRID",
"CODE",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bl",
"temp",
"poly_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"desc_",
"._",
"data",
"Type_",
"in_",
"valid",
"\\u",
"feature",
"\\u",
"types_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"temp",
"\\u",
"poly_",
"=_",
"zone",
"\\u",
"parameter_",
"._",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"temp",
"\\u",
"field_",
"=_",
"zone",
"field",
"\\u",
"parameter_",
"._",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"messages_",
"._",
"add",
"Error",
"Message_",
"(_",
"\"",
"Not",
" ",
"a",
" ",
"valid",
" ",
"zone",
" ",
"dataset",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"arcpy_",
"._",
"Execut",
"e",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"num",
"\\u",
"recs_",
"=_",
"int_",
"(_",
"arcpy_",
"._",
"Get",
"Count",
"\\u",
"management_",
"(_",
"temp",
"\\u",
"poly_",
")_",
"._",
"get",
"Output_",
"(_",
"0_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"recs_",
"*=_",
"numpy_",
"._",
"prod_",
"(_",
"arr",
"\\u",
"stat_",
"._",
"shape_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"arcpy_",
"._",
"Set",
"Progres",
"sor",
"_",
"(_",
"\"",
"step",
"\"_",
",_",
"\"",
"Building",
" ",
"zone",
" ",
"feature",
" ",
"look",
"-",
"up",
"...\"_",
",_",
"0_",
",_",
"num",
"\\u",
"recs_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"zone",
"s",
" ",
"associate",
"d",
" ",
"with",
" ",
"each",
" ",
"feature_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc_",
"=_",
"arcpy_",
"._",
"Describe",
"_",
"(_",
"temp",
"\\u",
"poly_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rows_",
"=_",
"arcpy_",
"._",
"Sear",
"ch",
"Cursor_",
"(_",
"temp",
"\\u",
"poly_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"row_",
"in_",
"rows_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"feat_",
"=_",
"row_",
"._",
"get",
"Value_",
"(_",
"desc_",
"._",
"Shape",
"Field",
"Name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zone_",
"=_",
"row_",
"._",
"get",
"Value_",
"(_",
"temp",
"\\u",
"field_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"station_",
"in_",
"arr",
"\\u",
"stat_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"feat_",
"._",
"contains_",
"(_",
"arcpy_",
"._",
"Point_",
"(_",
"float_",
"(_",
"X_",
"[_",
"station_",
"]_",
")_",
",_",
"float_",
"(_",
"Y_",
"[_",
"station_",
"]_",
")_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"not_",
"zone_",
"in_",
"zone",
"\\u",
"stations_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"zone",
"\\u",
"stations_",
"[_",
"zone_",
"]_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"zone",
"\\u",
"stations_",
"[_",
"zone_",
"]_",
"._",
"append_",
"(_",
"station_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arcpy_",
"._",
"Set",
"Progres",
"sor",
"Position_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"rows_",
",_",
"row_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Reset",
"Progres",
"sor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Delete",
" ",
"temporar",
"y",
" ",
"feature",
" ",
"class",
" ",
"if",
" ",
"it",
" ",
"exists_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"bl",
"temp",
"poly_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arcpy_",
"._",
"Delete",
"\\u",
"management_",
"(_",
"temp",
"\\u",
"poly_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"if",
" ",
"variab",
"le",
" ",
"is",
" ",
"packed_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"isp",
"acke",
"d_",
"=_",
"hasattr_",
"(_",
"arr",
"\\u",
"var_",
",_",
"'",
"scale",
"\\u",
"factor",
"'_",
")_",
"or_",
"hasattr_",
"(_",
"arr",
"\\u",
"var_",
",_",
"'",
"add",
"\\u",
"offset",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Det",
"erm",
"ine",
" ",
"whe",
"ther",
" ",
"give",
"n",
" ",
"statistic",
" ",
"is",
" ",
"categor",
"ical",
" ",
"or",
" ",
"not_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"var",
"\\u",
"dtype_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"stat_",
"in_",
"self_",
"._",
"statistics_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"type",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
"in_",
"stat_",
"[_",
"1_",
"]_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"var",
"\\u",
"dtype_",
"=_",
"stat_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"type",
"\\u",
"changed_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"'",
"int",
"'_",
"in_",
"str_",
"(_",
"arr",
"\\u",
"var_",
"._",
"dtype_",
")_",
")_",
"and_",
"(_",
"not_",
"new",
"\\u",
"var",
"\\u",
"dtype_",
")_",
"and_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"not_",
"isp",
"acke",
"d_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type",
"\\u",
"changed_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Slice",
" ",
"generator_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Adapt",
"ed",
" ",
"from",
":",
" ",
"http",
"://",
"code",
".",
"active",
"state",
".",
"com",
"/",
"recip",
"es",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"502",
"194",
"-",
"a",
"-",
"generat",
"or",
"-",
"for",
"-",
"an",
"-",
"arbitra",
"ry",
"-",
"number",
"-",
"of",
"-",
"for",
"-",
"loop",
"s",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Origina",
"ll",
"y",
" ",
"writt",
"en",
" ",
"by",
" ",
"Ste",
"ven",
" ",
"Bet",
"hard",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"multi",
"\\u",
"for_",
"(_",
"iterable",
"s_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"iterable",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"iterable",
"s_",
"[_",
"0_",
"]_",
",_",
"collections_",
"._",
"Iterable_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"item_",
"in_",
"iterable",
"s_",
"[_",
"0_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"for_",
"rest",
"\\u",
"tuple_",
"in_",
"multi",
"\\u",
"for_",
"(_",
"iterable",
"s_",
"[_",
"1_",
":_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"yield_",
"(_",
"item_",
",_",
")_",
"+_",
"rest",
"\\u",
"tuple_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"rest",
"\\u",
"tuple_",
"in_",
"multi",
"\\u",
"for_",
"(_",
"iterable",
"s_",
"[_",
"1_",
":_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"yield_",
"(_",
"iterable",
"s_",
"[_",
"0_",
"]_",
",_",
")_",
"+_",
"rest",
"\\u",
"tuple_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Generate",
" ",
"slice",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"dim",
"\\u",
"shape_",
"=_",
"arr",
"\\u",
"var_",
"._",
"shape_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"name_",
"=_",
"arr",
"\\u",
"var_",
"._",
"dimensions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"slices_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"dims_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"prod_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"dim",
"\\u",
"index_",
",_",
"dim",
"\\u",
"item_",
"in_",
"enumerate_",
"(_",
"dim",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"dim",
"\\u",
"item_",
"!=_",
"stat",
"\\u",
"variable_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dim",
"\\u",
"prod_",
"*=_",
"dim",
"\\u",
"shape_",
"[_",
"dim",
"\\u",
"index_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"slices_",
"._",
"append_",
"(_",
"xrange_",
"(_",
"dim",
"\\u",
"shape_",
"[_",
"dim",
"\\u",
"index_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dim",
"\\u",
"dims_",
"._",
"append_",
"(_",
"(_",
"str_",
"(_",
"dim",
"\\u",
"item_",
")_",
",_",
"numpy_",
"._",
"int_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"position",
" ",
"of",
" ",
"statistic_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"stat",
"\\u",
"position_",
"=_",
"dim",
"\\u",
"name_",
"._",
"index_",
"(_",
"stat",
"\\u",
"variable_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bl",
"struct",
"created_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"hst",
"ack",
"\\u",
"struct_",
"(_",
"arr",
"1_",
",_",
"arr",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Wil",
"l",
" ",
"only",
" ",
"work",
" ",
"correct",
"ly",
" ",
"if",
" ",
"arr",
"1",
" ",
"and",
" ",
"arr",
"2",
" ",
"only",
" ",
"have",
" ",
"one",
" ",
"record_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dt_",
"=_",
"numpy_",
"._",
"lib_",
"._",
"rec",
"functions_",
"._",
"zip",
"\\u",
"descr_",
"(_",
"(_",
"arr",
"1_",
",_",
"arr",
"2_",
")_",
",_",
"flatten_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"numpy_",
"._",
"array_",
"(_",
"arr",
"1_",
"._",
"tolist_",
"(_",
")_",
"+_",
"arr",
"2_",
"._",
"tolist_",
"(_",
")_",
",_",
"dtype_",
"=_",
"dt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Progres",
"s",
" ",
"bar_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"dim",
"\\u",
"prod_",
"*=_",
"len_",
"(_",
"zone",
"\\u",
"stations_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Reset",
"Progres",
"sor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Set",
"Progres",
"sor",
"_",
"(_",
"'",
"step",
"'_",
",_",
"'",
"Calculating",
"...'_",
",_",
"0_",
",_",
"dim",
"\\u",
"prod_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Loop",
" ",
"through",
" ",
"zones_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"valid",
"\\u",
"indices_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"zone_",
"in_",
"zone",
"\\u",
"stations_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Grab",
" ",
"station",
" ",
"indice",
"s",
" ",
"associate",
"d",
" ",
"with",
" ",
"zone_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"zone",
"\\u",
"indices_",
"=_",
"zone",
"\\u",
"stations_",
"[_",
"zone_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Loop",
" ",
"through",
" ",
"slices_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"vars",
"lice",
"_",
"in_",
"multi",
"\\u",
"for_",
"(_",
"dim",
"\\u",
"slices_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Insert",
" ",
"station",
" ",
"indice",
"s",
" ",
"int",
"o",
" ",
"slice_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vars",
"lice",
"_",
"=_",
"list_",
"(_",
"vars",
"lice",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vars",
"lice",
"_",
"._",
"insert_",
"(_",
"stat",
"\\u",
"position_",
",_",
"zone",
"\\u",
"indices_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Tak",
"e",
" ",
"slice",
" ",
"from",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type",
"\\u",
"changed_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"arr",
"\\u",
"slice_",
"=_",
"arr",
"\\u",
"var_",
"[_",
"vars",
"lice",
"_",
"]_",
"._",
"astype_",
"(_",
"'",
"f8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"arr",
"\\u",
"slice_",
"=_",
"arr",
"\\u",
"var_",
"[_",
"vars",
"lice",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"mask",
"ed",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"arr",
"\\u",
"slice_",
",_",
"'",
"mask",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"arr",
"\\u",
"mask_",
"=_",
"arr",
"\\u",
"slice_",
"._",
"mask_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"arr",
"\\u",
"mask_",
"=_",
"numpy_",
"._",
"ma_",
"._",
"make",
"\\u",
"mask",
"\\u",
"none_",
"(_",
"arr",
"\\u",
"slice_",
"._",
"shape_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arr",
"\\u",
"slice_",
"=_",
"numpy_",
"._",
"ma_",
"._",
"asarray_",
"(_",
"arr",
"\\u",
"slice_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Perform",
" ",
"for",
" ",
"zone",
" ",
"whe",
"n",
" ",
"No",
"Data",
" ",
"is",
" ",
"ignored_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"or",
" ",
"whe",
"n",
" ",
"there",
" ",
"is",
" ",
"no",
" ",
"No",
"Data",
" ",
"within",
" ",
"zone_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"ignore",
"\\u",
"parameter_",
"._",
"value_",
"or_",
"(_",
"not_",
"numpy_",
"._",
"any_",
"(_",
"arr",
"\\u",
"mask_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Apply",
" ",
"mask_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"arr",
"\\u",
"slice_",
"._",
"mask_",
"=_",
"arr",
"\\u",
"mask_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Apply",
" ",
"opera",
"tor",
" ",
"to",
" ",
"zone",
" ",
"mask",
"ed",
" ",
"slice_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"calcul",
"ate",
"\\u",
"statistic_",
"(_",
"arr",
"\\u",
"slice_",
"[_",
":_",
"]_",
",_",
"type",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Structur",
"e",
" ",
"results",
" ",
"int",
"o",
" ",
"row_",
"\\u\\u\\uNL\\u\\u\\u_",
"struct",
"\\u",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"it",
"\\u",
"ind_",
",_",
"it_",
"in_",
"enumerate_",
"(_",
"list_",
"(_",
"vars",
"lice",
"_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"it",
"\\u",
"ind_",
"!=_",
"stat",
"\\u",
"position_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"dim",
"\\u",
"name_",
"[_",
"it",
"\\u",
"ind_",
"]_",
"in_",
"dataset_",
"._",
"variab",
"le",
"\\u",
"names_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Dimen",
"sion",
" ",
"with",
" ",
"variable_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"data_",
"._",
"append_",
"(_",
"dataset_",
"._",
"variable_",
"(_",
"dim",
"\\u",
"name_",
"[_",
"it",
"\\u",
"ind_",
"]_",
")_",
"[_",
"it_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Dimen",
"sion",
" ",
"with",
"out",
" ",
"variable_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"data_",
"._",
"append_",
"(_",
"it_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"struct",
"\\u",
"data_",
"._",
"append_",
"(_",
"zone_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"struct",
"\\u",
"data_",
"._",
"append_",
"(_",
"numpy_",
"._",
"ma_",
"._",
"count_",
"(_",
"arr",
"\\u",
"slice_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"numpy_",
"._",
"iss",
"cala",
"r_",
"(_",
"result_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Sing",
"le",
"-",
"valued",
" ",
"result_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"data_",
"._",
"append_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Multi",
"valued",
" ",
"result_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"data_",
"+=_",
"[_",
"it",
"2_",
"for_",
"it_",
"in_",
"result_",
"._",
"tolist_",
"(_",
")_",
"for_",
"it",
"2_",
"in_",
"it_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"table",
" ",
"whe",
"n",
" ",
"necessar",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"bl",
"struct",
"created_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"dtype_",
"=_",
"dim",
"\\u",
"dims_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"struct",
"\\u",
"dtype_",
"._",
"append_",
"(_",
"(_",
"str_",
"(_",
"zone",
"field",
"\\u",
"parameter_",
"._",
"value_",
")_",
",_",
"numpy_",
"._",
"int_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"struct",
"\\u",
"dtype_",
"._",
"append_",
"(_",
"(_",
"'",
"COUNT",
"'_",
",_",
"numpy_",
"._",
"int_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"numpy_",
"._",
"iss",
"cala",
"r_",
"(_",
"result_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Sing",
"le",
"-",
"valued",
" ",
"result_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"dtype_",
"._",
"append_",
"(_",
"(_",
"str_",
"(_",
"type",
"\\u",
"parameter_",
"._",
"value",
"As",
"Text_",
")_",
",_",
"numpy_",
"._",
"float_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Multi",
"valued",
" ",
"result_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"struct",
"\\u",
"dtype_",
"+=_",
"[_",
"(_",
"it_",
",_",
"numpy_",
"._",
"float_",
")_",
"for_",
"it_",
"in_",
"list_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"._",
"dtype_",
"._",
"names_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"struct_",
"=_",
"numpy_",
"._",
"zeros_",
"(_",
"(_",
"dim",
"\\u",
"prod_",
",_",
")_",
",_",
"numpy_",
"._",
"dtype_",
"(_",
"struct",
"\\u",
"dtype_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bl",
"struct",
"created_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Insert",
" ",
"row_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"struct_",
"[_",
"index_",
"]_",
"=_",
"numpy_",
"._",
"array_",
"(_",
"tuple_",
"(_",
"struct",
"\\u",
"data_",
")_",
",_",
"numpy_",
"._",
"dtype_",
"(_",
"struct",
"\\u",
"dtype_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"valid",
"\\u",
"indices_",
"._",
"append_",
"(_",
"index_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"else",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"#",
" ",
"Passi",
"ng",
" ",
"drops",
" ",
"zone",
"s",
" ",
"with",
" ",
"No",
"Data",
" ",
"in",
" ",
"them",
" ",
"from",
" ",
"table_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"pass_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"index_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Set",
"Progres",
"sor",
"Position_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arcpy_",
"._",
"Reset",
"Progres",
"sor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"time",
"'_",
"in_",
"dim",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Output",
" ",
"zona",
"l",
" ",
"statistic",
"s",
" ",
"to",
" ",
"temporar",
"y",
" ",
"table_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"temp",
"\\u",
"table_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"tempfile_",
"._",
"gettempdir_",
"(_",
")_",
",_",
"'",
"temp",
"\\u",
"table",
".",
"dbf",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"arcpy_",
"._",
"Exists_",
"(_",
"temp",
"\\u",
"table_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arcpy_",
"._",
"Delete",
"\\u",
"management_",
"(_",
"temp",
"\\u",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arcpy_",
"._",
"da_",
"._",
"Num",
"Py",
"Array",
"To",
"Table_",
"(_",
"struct_",
"[_",
"valid",
"\\u",
"indices_",
"]_",
",_",
"temp",
"\\u",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"table",
" ",
"view",
" ",
"of",
" ",
"the",
" ",
"time",
" ",
"dimension",
" ",
"from",
" ",
"net",
"CD",
"F",
" ",
"file_",
"\\u\\u\\uNL\\u\\u\\u_",
"temp",
"\\u",
"mdt",
"able_",
"=_",
"r",
"\"",
"md",
"\\u",
"table",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arcpy_",
"._",
"Make",
"Net",
"CD",
"FT",
"able",
"View",
"\\u",
"md_",
"(_",
"dataset",
"\\u",
"name_",
",_",
"'",
"time",
"'_",
",_",
"temp",
"\\u",
"mdt",
"able_",
",_",
"'",
"time",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"time",
" ",
"field",
" ",
"from",
" ",
"table",
" ",
"view_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc",
"\\u",
"fields_",
"=_",
"arcpy_",
"._",
"List",
"Fields_",
"(_",
"temp",
"\\u",
"mdt",
"able_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time",
"\\u",
"field_",
"=_",
"desc",
"\\u",
"fields_",
"[_",
"[_",
"field_",
"._",
"name_",
"for_",
"field_",
"in_",
"desc",
"\\u",
"fields_",
"]_",
"._",
"index_",
"(_",
"'",
"time",
"'_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"table",
" ",
"in",
" ",
"the",
" ",
"output",
" ",
"location_",
"\\u\\u\\uNL\\u\\u\\u_",
"arcpy_",
"._",
"Creat",
"e",
"Table",
"\\u",
"management_",
"(_",
"*_",
"os_",
"._",
"path_",
"._",
"split_",
"(_",
"output",
"\\u",
"filename_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"fields",
" ",
"from",
" ",
"temporar",
"y",
" ",
"table",
" ",
"except",
" ",
"for",
" ",
"time",
" ",
"field",
",",
" ",
"which_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"we",
" ",
"add",
" ",
"from",
" ",
"the",
" ",
"Make",
"Net",
"CD",
"FT",
"able",
"View_",
"\\u\\u\\uNL\\u\\u\\u_",
"desc",
"\\u",
"fields_",
"=_",
"arcpy_",
"._",
"List",
"Fields_",
"(_",
"temp",
"\\u",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"index_",
",_",
"field_",
"in_",
"enumerate_",
"(_",
"desc",
"\\u",
"fields_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"field_",
"._",
"type_",
"!=_",
"'",
"OID",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"field_",
"._",
"name_",
"==_",
"'",
"time",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"arcpy_",
"._",
"Add",
"Field",
"\\u",
"management_",
"(_",
"output",
"\\u",
"filename_",
",_",
"time",
"\\u",
"field_",
"._",
"name_",
",_",
"time",
"\\u",
"field_",
"._",
"type_",
",_",
"time",
"\\u",
"field_",
"._",
"precision_",
",_",
"time",
"\\u",
"field_",
"._",
"scale_",
",_",
"time",
"\\u",
"field_",
"._",
"length_",
",_",
"time",
"\\u",
"field_",
"._",
"alias",
"Name_",
",_",
"time",
"\\u",
"field_",
"._",
"is",
"Null",
"able_",
",_",
"time",
"\\u",
"field_",
"._",
"required_",
",_",
"time",
"\\u",
"field_",
"._",
"domain_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"arcpy_",
"._",
"Add",
"Field",
"\\u",
"management_",
"(_",
"output",
"\\u",
"filename_",
",_",
"field_",
"._",
"name_",
",_",
"field_",
"._",
"type_",
",_",
"field_",
"._",
"precision_",
",_",
"field_",
"._",
"scale_",
",_",
"field_",
"._",
"length_",
",_",
"field_",
"._",
"alias",
"Name_",
",_",
"field_",
"._",
"is",
"Null",
"able_",
",_",
"field_",
"._",
"required_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"._",
"domain_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arcpy_",
"._",
"Delete",
"Field",
"\\u",
"management_",
"(_",
"output",
"\\u",
"filename_",
",_",
"\"",
"Field",
"1",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"list",
" ",
"of",
" ",
"datetime",
" ",
"object",
"s",
" ",
"from",
" ",
"table",
" ",
"view_",
"\\u\\u\\uNL\\u\\u\\u_",
"time",
"\\u",
"arc_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"arcpy_",
"._",
"da_",
"._",
"Sear",
"ch",
"Cursor_",
"(_",
"temp",
"\\u",
"mdt",
"able_",
",_",
"'",
"time",
"'_",
")_",
"as_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"row_",
"in_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"time",
"\\u",
"arc_",
"._",
"append_",
"(_",
"row_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"cursor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"time",
" ",
"variab",
"le",
" ",
"from",
" ",
"net",
"CD",
"F",
" ",
"dataset_",
"\\u\\u\\uNL\\u\\u\\u_",
"time",
"\\u",
"var_",
"=_",
"dataset_",
"._",
"variable_",
"(_",
"'",
"time",
"'_",
")_",
"[_",
":_",
"]_",
"._",
"tolist_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Loop",
" ",
"through",
" ",
"entri",
"es",
" ",
"from",
" ",
"temporar",
"y",
" ",
"table_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"arcpy_",
"._",
"da_",
"._",
"Insert",
"Cursor_",
"(_",
"output",
"\\u",
"filename_",
",_",
"'*'_",
")_",
"as_",
"ins",
"\\u",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"time",
"\\u",
"ind_",
"=_",
"ins",
"\\u",
"cursor_",
"._",
"fields_",
"._",
"index_",
"(_",
"'",
"time",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"arcpy_",
"._",
"da_",
"._",
"Sear",
"ch",
"Cursor_",
"(_",
"temp",
"\\u",
"table_",
",_",
"'*'_",
")_",
"as_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"time",
"\\u",
"ind_",
"=_",
"cursor_",
"._",
"fields_",
"._",
"index_",
"(_",
"'",
"time",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"row_",
"in_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"new",
"\\u",
"row_",
"=_",
"list_",
"(_",
"row_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"row_",
"[_",
"new",
"\\u",
"time",
"\\u",
"ind_",
"]_",
"=_",
"time",
"\\u",
"arc_",
"[_",
"time",
"\\u",
"var_",
"._",
"index_",
"(_",
"row_",
"[_",
"time",
"\\u",
"ind_",
"]_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ins",
"\\u",
"cursor_",
"._",
"insert",
"Row_",
"(_",
"tuple_",
"(_",
"new",
"\\u",
"row_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"ins",
"\\u",
"cursor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"cursor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Write",
" ",
"table_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"arcpy_",
"._",
"env_",
"._",
"overwrit",
"e",
"Output_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arcpy_",
"._",
"Delete",
"\\u",
"management_",
"(_",
"output",
"\\u",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arcpy_",
"._",
"da_",
"._",
"Num",
"Py",
"Array",
"To",
"Table_",
"(_",
"struct_",
"[_",
"valid",
"\\u",
"indices_",
"]_",
",_",
"output",
"\\u",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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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
] |
Variable defined multiple times | thasso/pyjip/test/test_examples.py | [
{
"content": "def test_dynamic_options_multiplex():\n script = '''#!/usr/bin/env jip\n# Touch a number of files with a common prefix\n#\n# usage:\n# touch --prefix <prefix> --count <count>\n\n#%begin init\nadd_output('output')\n#%end\n\n#%begin setup\noptions['output'].set([\"%s_%s\" % (prefix, i) for i in range(1, count.get(int) + 1)])\n#%end\n\n#%begin command\nfor x in ${output}; do\n touch $x\ndone\n '''\n tool = jip.tools.ScriptTool.from_string(script)\n tool.init()\n assert tool is not None\n p = jip.Pipeline()\n node = p.job('test').run(tool, prefix='test', count=[1, 2])\n assert node is not None\n p.expand()\n cwd = os.getcwd()\n\n assert len(p) == 2\n node_1 = p.get('test.0')\n node_2 = p.get('test.1')\n assert node_1.output == os.path.join(cwd, 'test_1')\n assert node_2.output == [os.path.join(cwd, x) for x in\n ['test_1', 'test_2']]",
"metadata": "root.test_dynamic_options_multiplex",
"header": "['module', '___EOS___']",
"index": 542
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"dynami",
"c\\u",
"options",
"\\u",
"multiple",
"x_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"script_",
"=_",
"'''",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"ji",
"p",
"\\",
"10",
";",
"#",
" ",
"Tou",
"ch",
" ",
"a",
" ",
"number",
" ",
"of",
" ",
"files",
" ",
"with",
" ",
"a",
" ",
"common",
" ",
"prefix",
"\\",
"10",
";",
"#",
"\\",
"10",
";",
"#",
" ",
"usage",
":",
"\\",
"10",
";",
"#",
" ",
" ",
" ",
"touch",
" ",
"--",
"prefix",
" ",
"<",
"prefix",
">",
" ",
"--",
"count",
" ",
"<",
"count",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
"%",
"begin",
" ",
"init",
"\\",
"10",
";",
"add",
"\\u",
"output",
"('",
"output",
"')",
"\\",
"10",
";",
"#",
"%",
"end",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
"%",
"begin",
" ",
"setup",
"\\",
"10",
";",
"options",
"['",
"output",
"']",
".",
"set",
"([",
"\"%",
"s",
"\\u",
"%",
"s",
"\"",
" ",
"%",
" ",
"(",
"prefix",
",",
" ",
"i",
")",
" ",
"for",
" ",
"i",
" ",
"in",
" ",
"range",
"(",
"1",
",",
" ",
"count",
".",
"get",
"(",
"int",
")",
" ",
"+",
" ",
"1",
")])",
"\\",
"10",
";",
"#",
"%",
"end",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
"%",
"begin",
" ",
"command",
"\\",
"10",
";",
"for",
" ",
"x",
" ",
"in",
" ",
"${",
"output",
"};",
" ",
"do",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"touch",
" ",
"$",
"x",
"\\",
"10",
";",
"don",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tool_",
"=_",
"ji",
"p_",
"._",
"tools_",
"._",
"Script",
"Tool_",
"._",
"from",
"\\u",
"string_",
"(_",
"script_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tool_",
"._",
"init_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"tool_",
"is_",
"not_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"=_",
"ji",
"p_",
"._",
"Pipeline_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node_",
"=_",
"p_",
"._",
"job_",
"(_",
"'",
"test",
"'_",
")_",
"._",
"run_",
"(_",
"tool_",
",_",
"prefix_",
"=_",
"'",
"test",
"'_",
",_",
"count_",
"=_",
"[_",
"1_",
",_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"node_",
"is_",
"not_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"._",
"expand_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cwd_",
"=_",
"os_",
"._",
"getcwd_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"len_",
"(_",
"p_",
")_",
"==_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node",
"\\u",
"1_",
"=_",
"p_",
"._",
"get_",
"(_",
"'",
"test",
".0",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node",
"\\u",
"2_",
"=_",
"p_",
"._",
"get_",
"(_",
"'",
"test",
".1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"node",
"\\u",
"1_",
"._",
"output_",
"==_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"cwd_",
",_",
"'",
"test\\u",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"node",
"\\u",
"2_",
"._",
"output_",
"==_",
"[_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"cwd_",
",_",
"x_",
")_",
"for_",
"x_",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"test\\u",
"1",
"'_",
",_",
"'",
"test\\u",
"2",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/queries/tests.py | [
{
"content": " def test_ticket10742(self):\n # Queries used in an __in clause don't execute subqueries\n\n subq = Author.objects.filter(num__lt=3000)\n qs = Author.objects.filter(pk__in=subq)\n self.assertQuerysetEqual(qs, ['<Author: a1>', '<Author: a2>'])\n\n # The subquery result cache should not be populated\n self.assertTrue(subq._result_cache is None)\n\n subq = Author.objects.filter(num__lt=3000)\n qs = Author.objects.exclude(pk__in=subq)\n self.assertQuerysetEqual(qs, ['<Author: a3>', '<Author: a4>'])\n\n # The subquery result cache should not be populated\n self.assertTrue(subq._result_cache is None)\n\n subq = Author.objects.filter(num__lt=3000)\n self.assertQuerysetEqual(\n Author.objects.filter(Q(pk__in=subq) & Q(name='a1')),\n ['<Author: a1>']\n )\n\n # The subquery result cache should not be populated\n self.assertTrue(subq._result_cache is None)",
"metadata": "root.Queries1Tests.test_ticket10742",
"header": "['class', 'Queries1Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']",
"index": 747
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Querie",
"s1",
"Tests_",
"(_",
"Base",
"Query",
"set",
"Test_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"tick",
"et",
"107",
"42_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Querie",
"s",
" ",
"used",
" ",
"in",
" ",
"an",
" ",
"\\u\\u",
"in",
" ",
"clause",
" ",
"don",
"'",
"t",
" ",
"execute",
" ",
"sub",
"queries_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sub",
"q_",
"=_",
"Author_",
"._",
"objects_",
"._",
"filter_",
"(_",
"num",
"\\u\\u",
"lt_",
"=_",
"3000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qs_",
"=_",
"Author_",
"._",
"objects_",
"._",
"filter_",
"(_",
"pk",
"\\u\\u",
"in_",
"=_",
"sub",
"q_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Query",
"set",
"Equal_",
"(_",
"qs_",
",_",
"[_",
"'<",
"Author",
":",
" ",
"a1",
">'_",
",_",
"'<",
"Author",
":",
" ",
"a2",
">'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"subquery",
" ",
"result",
" ",
"cache",
" ",
"shou",
"ld",
" ",
"not",
" ",
"be",
" ",
"populate",
"d_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"sub",
"q_",
"._",
"\\u",
"result",
"\\u",
"cache_",
"is_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sub",
"q_",
"=_",
"Author_",
"._",
"objects_",
"._",
"filter_",
"(_",
"num",
"\\u\\u",
"lt_",
"=_",
"3000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qs_",
"=_",
"Author_",
"._",
"objects_",
"._",
"exclude_",
"(_",
"pk",
"\\u\\u",
"in_",
"=_",
"sub",
"q_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Query",
"set",
"Equal_",
"(_",
"qs_",
",_",
"[_",
"'<",
"Author",
":",
" ",
"a3",
">'_",
",_",
"'<",
"Author",
":",
" ",
"a4",
">'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"subquery",
" ",
"result",
" ",
"cache",
" ",
"shou",
"ld",
" ",
"not",
" ",
"be",
" ",
"populate",
"d_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"sub",
"q_",
"._",
"\\u",
"result",
"\\u",
"cache_",
"is_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sub",
"q_",
"=_",
"Author_",
"._",
"objects_",
"._",
"filter_",
"(_",
"num",
"\\u\\u",
"lt_",
"=_",
"3000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Query",
"set",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Author_",
"._",
"objects_",
"._",
"filter_",
"(_",
"Q_",
"(_",
"pk",
"\\u\\u",
"in_",
"=_",
"sub",
"q_",
")_",
"&_",
"Q_",
"(_",
"name_",
"=_",
"'",
"a1",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'<",
"Author",
":",
" ",
"a1",
">'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"subquery",
" ",
"result",
" ",
"cache",
" ",
"shou",
"ld",
" ",
"not",
" ",
"be",
" ",
"populate",
"d_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"sub",
"q_",
"._",
"\\u",
"result",
"\\u",
"cache_",
"is_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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/lib/django/tests/modeltests/basic/models.py | [
{
"content": "\"\"\"\n1. Bare-bones model\n\nThis is a basic model with only two non-primary-key fields.\n\"\"\"\n\nfrom django.db import models\n\n\n__test__ = {'API_TESTS': \"\"\"\n# No articles are in the system yet.\n>>> Article.objects.all()\n[]\n\n# Create an Article.\n>>> from datetime import datetime\n>>> a = Article(id=None, headline='Area man programs in Python', pub_date=datetime(2005, 7, 28))\n\n# Save it into the database. You have to call save() explicitly.\n>>> a.save()\n\n# Now it has an ID. Note it's a long integer, as designated by the trailing \"L\".\n>>> a.id\n1L\n\n# Access database columns via Python attributes.\n>>> a.headline\n'Area man programs in Python'\n>>> a.pub_date\ndatetime.datetime(2005, 7, 28, 0, 0)\n\n# Change values by changing the attributes, then calling save().\n>>> a.headline = 'Area woman programs in Python'\n>>> a.save()\n\n# Article.objects.all() returns all the articles in the database.\n>>> Article.objects.all()\n[<Article: Area woman programs in Python>]\n\n# Django provides a rich database lookup API.\n>>> Article.objects.get(id__exact=1)\n<Article: Area woman programs in Python>\n>>> Article.objects.get(headline__startswith='Area woman')\n<Article: Area woman programs in Python>\n>>> Article.objects.get(pub_date__year=2005)\n<Article: Area woman programs in Python>\n>>> Article.objects.get(pub_date__year=2005, pub_date__month=7)\n<Article: Area woman programs in Python>\n>>> Article.objects.get(pub_date__year=2005, pub_date__month=7, pub_date__day=28)\n<Article: Area woman programs in Python>\n\n# The \"__exact\" lookup type can be omitted, as a shortcut.\n>>> Article.objects.get(id=1)\n<Article: Area woman programs in Python>\n>>> Article.objects.get(headline='Area woman programs in Python')\n<Article: Area woman programs in Python>\n\n>>> Article.objects.filter(pub_date__year=2005)\n[<Article: Area woman programs in Python>]\n>>> Article.objects.filter(pub_date__year=2004)\n[]\n>>> Article.objects.filter(pub_date__year=2005, pub_date__month=7)\n[<Article: Area woman programs in Python>]\n\n# Django raises an Article.DoesNotExist exception for get() if the parameters\n# don't match any object.\n>>> Article.objects.get(id__exact=2)\nTraceback (most recent call last):\n ...\nDoesNotExist: Article matching query does not exist.\n\n>>> Article.objects.get(pub_date__year=2005, pub_date__month=8)\nTraceback (most recent call last):\n ...\nDoesNotExist: Article matching query does not exist.\n\n# Lookup by a primary key is the most common case, so Django provides a\n# shortcut for primary-key exact lookups.\n# The following is identical to articles.get(id=1).\n>>> Article.objects.get(pk=1)\n<Article: Area woman programs in Python>\n\n# pk can be used as a shortcut for the primary key name in any query\n>>> Article.objects.filter(pk__in=[1])\n[<Article: Area woman programs in Python>]\n\n# Model instances of the same type and same ID are considered equal.\n>>> a = Article.objects.get(pk=1)\n>>> b = Article.objects.get(pk=1)\n>>> a == b\nTrue\n\n# You can initialize a model instance using positional arguments, which should\n# match the field order as defined in the model.\n>>> a2 = Article(None, 'Second article', datetime(2005, 7, 29))\n>>> a2.save()\n>>> a2.id\n2L\n>>> a2.headline\n'Second article'\n>>> a2.pub_date\ndatetime.datetime(2005, 7, 29, 0, 0)\n\n# ...or, you can use keyword arguments.\n>>> a3 = Article(id=None, headline='Third article', pub_date=datetime(2005, 7, 30))\n>>> a3.save()\n>>> a3.id\n3L\n>>> a3.headline\n'Third article'\n>>> a3.pub_date\ndatetime.datetime(2005, 7, 30, 0, 0)\n\n# You can also mix and match position and keyword arguments, but be sure not to\n# duplicate field information.\n>>> a4 = Article(None, 'Fourth article', pub_date=datetime(2005, 7, 31))\n>>> a4.save()\n>>> a4.headline\n'Fourth article'\n\n# Don't use invalid keyword arguments.\n>>> a5 = Article(id=None, headline='Invalid', pub_date=datetime(2005, 7, 31), foo='bar')\nTraceback (most recent call last):\n ...\nTypeError: 'foo' is an invalid keyword argument for this function\n\n# You can leave off the value for an AutoField when creating an object, because\n# it'll get filled in automatically when you save().\n>>> a5 = Article(headline='Article 6', pub_date=datetime(2005, 7, 31))\n>>> a5.save()\n>>> a5.id\n5L\n>>> a5.headline\n'Article 6'\n\n# If you leave off a field with \"default\" set, Django will use the default.\n>>> a6 = Article(pub_date=datetime(2005, 7, 31))\n>>> a6.save()\n>>> a6.headline\n'Default headline'\n\n# For DateTimeFields, Django saves as much precision (in seconds) as you\n# give it.\n>>> a7 = Article(headline='Article 7', pub_date=datetime(2005, 7, 31, 12, 30))\n>>> a7.save()\n>>> Article.objects.get(id__exact=7).pub_date\ndatetime.datetime(2005, 7, 31, 12, 30)\n\n>>> a8 = Article(headline='Article 8', pub_date=datetime(2005, 7, 31, 12, 30, 45))\n>>> a8.save()\n>>> Article.objects.get(id__exact=8).pub_date\ndatetime.datetime(2005, 7, 31, 12, 30, 45)\n>>> a8.id\n8L\n\n# Saving an object again doesn't create a new object -- it just saves the old one.\n>>> a8.save()\n>>> a8.id\n8L\n>>> a8.headline = 'Updated article 8'\n>>> a8.save()\n>>> a8.id\n8L\n\n>>> a7 == a8\nFalse\n>>> a8 == Article.objects.get(id__exact=8)\nTrue\n>>> a7 != a8\nTrue\n>>> Article.objects.get(id__exact=8) != Article.objects.get(id__exact=7)\nTrue\n>>> Article.objects.get(id__exact=8) == Article.objects.get(id__exact=7)\nFalse\n\n# dates() returns a list of available dates of the given scope for the given field.\n>>> Article.objects.dates('pub_date', 'year')\n[datetime.datetime(2005, 1, 1, 0, 0)]\n>>> Article.objects.dates('pub_date', 'month')\n[datetime.datetime(2005, 7, 1, 0, 0)]\n>>> Article.objects.dates('pub_date', 'day')\n[datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 31, 0, 0)]\n>>> Article.objects.dates('pub_date', 'day', order='ASC')\n[datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 31, 0, 0)]\n>>> Article.objects.dates('pub_date', 'day', order='DESC')\n[datetime.datetime(2005, 7, 31, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 28, 0, 0)]\n\n# dates() requires valid arguments.\n\n>>> Article.objects.dates()\nTraceback (most recent call last):\n ...\nTypeError: dates() takes at least 3 arguments (1 given)\n\n>>> Article.objects.dates('invalid_field', 'year')\nTraceback (most recent call last):\n ...\nFieldDoesNotExist: Article has no field named 'invalid_field'\n\n>>> Article.objects.dates('pub_date', 'bad_kind')\nTraceback (most recent call last):\n ...\nAssertionError: 'kind' must be one of 'year', 'month' or 'day'.\n\n>>> Article.objects.dates('pub_date', 'year', order='bad order')\nTraceback (most recent call last):\n ...\nAssertionError: 'order' must be either 'ASC' or 'DESC'.\n\n# Use iterator() with dates() to return a generator that lazily requests each\n# result one at a time, to save memory.\n>>> for a in Article.objects.dates('pub_date', 'day', order='DESC').iterator():\n... print repr(a)\ndatetime.datetime(2005, 7, 31, 0, 0)\ndatetime.datetime(2005, 7, 30, 0, 0)\ndatetime.datetime(2005, 7, 29, 0, 0)\ndatetime.datetime(2005, 7, 28, 0, 0)\n\n# You can combine queries with & and |.\n>>> s1 = Article.objects.filter(id__exact=1)\n>>> s2 = Article.objects.filter(id__exact=2)\n>>> s1 | s2\n[<Article: Area woman programs in Python>, <Article: Second article>]\n>>> s1 & s2\n[]\n\n# You can get the number of objects like this:\n>>> len(Article.objects.filter(id__exact=1))\n1\n\n# You can get items using index and slice notation.\n>>> Article.objects.all()[0]\n<Article: Area woman programs in Python>\n>>> Article.objects.all()[1:3]\n[<Article: Second article>, <Article: Third article>]\n>>> s3 = Article.objects.filter(id__exact=3)\n>>> (s1 | s2 | s3)[::2]\n[<Article: Area woman programs in Python>, <Article: Third article>]\n\n# Slices (without step) are lazy:\n>>> Article.objects.all()[0:5].filter()\n[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>]\n\n# Slicing again works:\n>>> Article.objects.all()[0:5][0:2]\n[<Article: Area woman programs in Python>, <Article: Second article>]\n>>> Article.objects.all()[0:5][:2]\n[<Article: Area woman programs in Python>, <Article: Second article>]\n>>> Article.objects.all()[0:5][4:]\n[<Article: Default headline>]\n>>> Article.objects.all()[0:5][5:]\n[]\n\n# Some more tests!\n>>> Article.objects.all()[2:][0:2]\n[<Article: Third article>, <Article: Article 6>]\n>>> Article.objects.all()[2:][:2]\n[<Article: Third article>, <Article: Article 6>]\n>>> Article.objects.all()[2:][2:3]\n[<Article: Default headline>]\n\n# Note that you can't use 'offset' without 'limit' (on some dbs), so this doesn't work:\n>>> Article.objects.all()[2:]\nTraceback (most recent call last):\n ...\nAssertionError: 'offset' is not allowed without 'limit'\n\n# Also, once you have sliced you can't filter, re-order or combine\n>>> Article.objects.all()[0:5].filter(id=1)\nTraceback (most recent call last):\n ...\nAssertionError: Cannot filter a query once a slice has been taken.\n\n>>> Article.objects.all()[0:5].order_by('id')\nTraceback (most recent call last):\n ...\nAssertionError: Cannot reorder a query once a slice has been taken.\n\n>>> Article.objects.all()[0:1] & Article.objects.all()[4:5]\nTraceback (most recent call last):\n ...\nAssertionError: Cannot combine queries once a slice has been taken.\n\n# Negative slices are not supported, due to database constraints.\n# (hint: inverting your ordering might do what you need).\n>>> Article.objects.all()[-1]\nTraceback (most recent call last):\n ...\nAssertionError: Negative indexing is not supported.\n>>> Article.objects.all()[0:-5]\nTraceback (most recent call last):\n ...\nAssertionError: Negative indexing is not supported.\n\n# An Article instance doesn't have access to the \"objects\" attribute.\n# That's only available on the class.\n>>> a7.objects.all()\nTraceback (most recent call last):\n ...\nAttributeError: Manager isn't accessible via Article instances\n\n>>> a7.objects\nTraceback (most recent call last):\n ...\nAttributeError: Manager isn't accessible via Article instances\n\n# Bulk delete test: How many objects before and after the delete?\n>>> Article.objects.all()\n[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>, <Article: Fourth article>, <Article: Article 7>, <Article: Updated article 8>]\n>>> Article.objects.filter(id__lte=4).delete()\n>>> Article.objects.all()\n[<Article: Article 6>, <Article: Default headline>, <Article: Article 7>, <Article: Updated article 8>]\n\"\"\"}\n\nfrom django.conf import settings\n\nbuilding_docs = getattr(settings, 'BUILDING_DOCS', False)\n\nif building_docs or settings.DATABASE_ENGINE == 'postgresql':\n __test__['API_TESTS'] += \"\"\"\n# In PostgreSQL, microsecond-level precision is available.\n>>> a9 = Article(headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180))\n>>> a9.save()\n>>> Article.objects.get(id__exact=9).pub_date\ndatetime.datetime(2005, 7, 31, 12, 30, 45, 180)\n\"\"\"\n\nif building_docs or settings.DATABASE_ENGINE == 'mysql':\n __test__['API_TESTS'] += \"\"\"\n# In MySQL, microsecond-level precision isn't available. You'll lose\n# microsecond-level precision once the data is saved.\n>>> a9 = Article(headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180))\n>>> a9.save()\n>>> Article.objects.get(id__exact=9).pub_date\ndatetime.datetime(2005, 7, 31, 12, 30, 45)\n\"\"\"\n\n__test__['API_TESTS'] += \"\"\"\n\n# You can manually specify the primary key when creating a new object.\n>>> a101 = Article(id=101, headline='Article 101', pub_date=datetime(2005, 7, 31, 12, 30, 45))\n>>> a101.save()\n>>> a101 = Article.objects.get(pk=101)\n>>> a101.headline\n'Article 101'\n\n# You can create saved objects in a single step\n>>> a10 = Article.objects.create(headline=\"Article 10\", pub_date=datetime(2005, 7, 31, 12, 30, 45))\n>>> Article.objects.get(headline=\"Article 10\")\n<Article: Article 10>\n\n# Edge-case test: A year lookup should retrieve all objects in the given\nyear, including Jan. 1 and Dec. 31.\n>>> a11 = Article.objects.create(headline='Article 11', pub_date=datetime(2008, 1, 1))\n>>> a12 = Article.objects.create(headline='Article 12', pub_date=datetime(2008, 12, 31, 23, 59, 59, 999999))\n>>> Article.objects.filter(pub_date__year=2008)\n[<Article: Article 11>, <Article: Article 12>]\n\"\"\"\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Article(models.Model):\n headline = models.CharField(maxlength=100, default='Default headline')\n pub_date = models.DateTimeField()\n\n class Meta:\n ordering = ('pub_date','headline')\n",
"metadata": "root.Article",
"header": "['module', '___EOS___']",
"index": 8
},
{
"content": " def __str__(self):\n return self.headline",
"metadata": "root.Article.__str__",
"header": "['class', 'Article', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 15
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"1",
".",
" ",
"Bar",
"e-",
"bone",
"s",
" ",
"model",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"basic",
" ",
"model",
" ",
"with",
" ",
"only",
" ",
"two",
" ",
"non",
"-",
"primary",
"-",
"key",
" ",
"fields",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\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",
"test\\u",
"\\u_",
"=_",
"{_",
"'",
"API",
"\\u",
"TESTS",
"'_",
":_",
"\"\"\"",
"\\",
"10",
";",
"#",
" ",
"No",
" ",
"article",
"s",
" ",
"are",
" ",
"in",
" ",
"the",
" ",
"system",
" ",
"ye",
"t",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()",
"\\",
"10",
";",
"[]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Creat",
"e",
" ",
"an",
" ",
"Artic",
"le",
".",
"\\",
"10",
";",
">>>",
" ",
"from",
" ",
"datetime",
" ",
"import",
" ",
"datetime",
"\\",
"10",
";",
">>>",
" ",
"a",
" ",
"=",
" ",
"Artic",
"le",
"(",
"id",
"=",
"Non",
"e",
",",
" ",
"headline",
"='",
"Area",
" ",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
"))\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Save",
" ",
"it",
" ",
"int",
"o",
" ",
"the",
" ",
"databa",
"se",
".",
" ",
"You",
" ",
"have",
" ",
"to",
" ",
"call",
" ",
"save",
"()",
" ",
"explicit",
"ly",
".",
"\\",
"10",
";",
">>>",
" ",
"a",
".",
"save",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"No",
"w",
" ",
"it",
" ",
"has",
" ",
"an",
" ",
"ID",
".",
" ",
"Not",
"e",
" ",
"it",
"'",
"s",
" ",
"a",
" ",
"long",
" ",
"integ",
"er",
",",
" ",
"as",
" ",
"designate",
"d",
" ",
"by",
" ",
"the",
" ",
"trail",
"ing",
" ",
"\"",
"L",
"\".\\",
"10",
";",
">>>",
" ",
"a",
".",
"id",
"\\",
"10",
";",
"1",
"L",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Access",
" ",
"databa",
"se",
" ",
"column",
"s",
" ",
"via",
" ",
"Pyth",
"on",
" ",
"attribute",
"s",
".",
"\\",
"10",
";",
">>>",
" ",
"a",
".",
"headline",
"\\",
"10",
";'",
"Area",
" ",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
"'",
"\\",
"10",
";",
">>>",
" ",
"a",
".",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Change",
" ",
"values",
" ",
"by",
" ",
"chang",
"ing",
" ",
"the",
" ",
"attribute",
"s",
",",
" ",
"then",
" ",
"calling",
" ",
"save",
"()",
".",
"\\",
"10",
";",
">>>",
" ",
"a",
".",
"headline",
" ",
"=",
" ",
"'",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
"'",
"\\",
"10",
";",
">>>",
" ",
"a",
".",
"save",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()",
" ",
"return",
"s",
" ",
"all",
" ",
"the",
" ",
"article",
"s",
" ",
"in",
" ",
"the",
" ",
"databa",
"se",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Dj",
"ang",
"o",
" ",
"provide",
"s",
" ",
"a",
" ",
"rich",
" ",
"databa",
"se",
" ",
"look",
"up",
" ",
"API",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"1",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"headline",
"\\u\\u",
"startswith",
"='",
"Area",
" ",
"wo",
"man",
"')",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
",",
" ",
"pub",
"\\u",
"date",
"\\u\\u",
"month",
"=",
"7",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
",",
" ",
"pub",
"\\u",
"date",
"\\u\\u",
"month",
"=",
"7",
",",
" ",
"pub",
"\\u",
"date",
"\\u\\u",
"day",
"=",
"2",
"8",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"The",
" ",
"\"\\u\\u",
"exact",
"\"",
" ",
"look",
"up",
" ",
"type",
" ",
"can",
" ",
"be",
" ",
"omit",
"ted",
",",
" ",
"as",
" ",
"a",
" ",
"shortcut",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"=",
"1",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"headline",
"='",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
"')",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
")",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2004",
")",
"\\",
"10",
";",
"[]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
",",
" ",
"pub",
"\\u",
"date",
"\\u\\u",
"month",
"=",
"7",
")",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Dj",
"ang",
"o",
" ",
"raise",
"s",
" ",
"an",
" ",
"Artic",
"le",
".",
"Do",
"es",
"Not",
"Exist",
" ",
"exception",
" ",
"for",
" ",
"get",
"()",
" ",
"if",
" ",
"the",
" ",
"parameter",
"s",
"\\",
"10",
";",
"#",
" ",
"don",
"'",
"t",
" ",
"match",
" ",
"any",
" ",
"object",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"2",
")",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Do",
"es",
"Not",
"Exist",
":",
" ",
"Artic",
"le",
" ",
"matchi",
"ng",
" ",
"query",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
".",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2005",
",",
" ",
"pub",
"\\u",
"date",
"\\u\\u",
"month",
"=",
"8",
")",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Do",
"es",
"Not",
"Exist",
":",
" ",
"Artic",
"le",
" ",
"matchi",
"ng",
" ",
"query",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Look",
"up",
" ",
"by",
" ",
"a",
" ",
"primary",
" ",
"key",
" ",
"is",
" ",
"the",
" ",
"most",
" ",
"common",
" ",
"case",
",",
" ",
"so",
" ",
"Dj",
"ang",
"o",
" ",
"provide",
"s",
" ",
"a",
"\\",
"10",
";",
"#",
" ",
"shortcut",
" ",
"for",
" ",
"primary",
"-",
"key",
" ",
"exact",
" ",
"lookups",
".",
"\\",
"10",
";",
"#",
" ",
"The",
" ",
"follow",
"ing",
" ",
"is",
" ",
"identi",
"cal",
" ",
"to",
" ",
"article",
"s",
".",
"get",
"(",
"id",
"=",
"1",
").",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pk",
"=",
"1",
")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"pk",
" ",
"can",
" ",
"be",
" ",
"used",
" ",
"as",
" ",
"a",
" ",
"shortcut",
" ",
"for",
" ",
"the",
" ",
"primary",
" ",
"key",
" ",
"name",
" ",
"in",
" ",
"any",
" ",
"query",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"pk",
"\\u\\u",
"in",
"=[",
"1",
"])",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Model",
" ",
"instance",
"s",
" ",
"of",
" ",
"the",
" ",
"same",
" ",
"type",
" ",
"and",
" ",
"same",
" ",
"ID",
" ",
"are",
" ",
"consider",
"ed",
" ",
"equal",
".",
"\\",
"10",
";",
">>>",
" ",
"a",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pk",
"=",
"1",
")",
"\\",
"10",
";",
">>>",
" ",
"b",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pk",
"=",
"1",
")",
"\\",
"10",
";",
">>>",
" ",
"a",
" ",
"==",
" ",
"b",
"\\",
"10",
";",
"Tru",
"e",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"initialize",
" ",
"a",
" ",
"model",
" ",
"instance",
" ",
"usi",
"ng",
" ",
"positional",
" ",
"argu",
"ment",
"s",
",",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
"\\",
"10",
";",
"#",
" ",
"match",
" ",
"the",
" ",
"field",
" ",
"order",
" ",
"as",
" ",
"defin",
"ed",
" ",
"in",
" ",
"the",
" ",
"model",
".",
"\\",
"10",
";",
">>>",
" ",
"a2",
" ",
"=",
" ",
"Artic",
"le",
"(",
"Non",
"e",
",",
" ",
"'",
"Second",
" ",
"article",
"',",
" ",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
"))\\",
"10",
";",
">>>",
" ",
"a2",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a2",
".",
"id",
"\\",
"10",
";",
"2",
"L",
"\\",
"10",
";",
">>>",
" ",
"a2",
".",
"headline",
"\\",
"10",
";'",
"Second",
" ",
"article",
"'",
"\\",
"10",
";",
">>>",
" ",
"a2",
".",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"...",
"or",
",",
" ",
"you",
" ",
"can",
" ",
"use",
" ",
"keyw",
"ord",
" ",
"argu",
"ment",
"s",
".",
"\\",
"10",
";",
">>>",
" ",
"a3",
" ",
"=",
" ",
"Artic",
"le",
"(",
"id",
"=",
"Non",
"e",
",",
" ",
"headline",
"='",
"Thi",
"rd",
" ",
"article",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
"))\\",
"10",
";",
">>>",
" ",
"a3",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a3",
".",
"id",
"\\",
"10",
";",
"3",
"L",
"\\",
"10",
";",
">>>",
" ",
"a3",
".",
"headline",
"\\",
"10",
";'",
"Thi",
"rd",
" ",
"article",
"'",
"\\",
"10",
";",
">>>",
" ",
"a3",
".",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"als",
"o",
" ",
"mix",
" ",
"and",
" ",
"match",
" ",
"position",
" ",
"and",
" ",
"keyw",
"ord",
" ",
"argu",
"ment",
"s",
",",
" ",
"but",
" ",
"be",
" ",
"sure",
" ",
"not",
" ",
"to",
"\\",
"10",
";",
"#",
" ",
"duplicat",
"e",
" ",
"field",
" ",
"informati",
"on",
".",
"\\",
"10",
";",
">>>",
" ",
"a4",
" ",
"=",
" ",
"Artic",
"le",
"(",
"Non",
"e",
",",
" ",
"'",
"Four",
"th",
" ",
"article",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
"))\\",
"10",
";",
">>>",
" ",
"a4",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a4",
".",
"headline",
"\\",
"10",
";'",
"Four",
"th",
" ",
"article",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Don",
"'",
"t",
" ",
"use",
" ",
"invalid",
" ",
"keyw",
"ord",
" ",
"argu",
"ment",
"s",
".",
"\\",
"10",
";",
">>>",
" ",
"a5",
" ",
"=",
" ",
"Artic",
"le",
"(",
"id",
"=",
"Non",
"e",
",",
" ",
"headline",
"='",
"Inva",
"lid",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
"),",
" ",
"foo",
"='",
"bar",
"')",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Type",
"Error",
":",
" ",
"'",
"foo",
"'",
" ",
"is",
" ",
"an",
" ",
"invalid",
" ",
"keyw",
"ord",
" ",
"argu",
"ment",
" ",
"for",
" ",
"this",
" ",
"function",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"lea",
"ve",
" ",
"off",
" ",
"the",
" ",
"value",
" ",
"for",
" ",
"an",
" ",
"Auto",
"Field",
" ",
"whe",
"n",
" ",
"creati",
"ng",
" ",
"an",
" ",
"object",
",",
" ",
"bec",
"aus",
"e",
"\\",
"10",
";",
"#",
" ",
"it",
"'",
"ll",
" ",
"get",
" ",
"filled",
" ",
"in",
" ",
"automati",
"call",
"y",
" ",
"whe",
"n",
" ",
"you",
" ",
"save",
"()",
".",
"\\",
"10",
";",
">>>",
" ",
"a5",
" ",
"=",
" ",
"Artic",
"le",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"6",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
"))\\",
"10",
";",
">>>",
" ",
"a5",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a5",
".",
"id",
"\\",
"10",
";",
"5",
"L",
"\\",
"10",
";",
">>>",
" ",
"a5",
".",
"headline",
"\\",
"10",
";'",
"Artic",
"le",
" ",
"6",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"If",
" ",
"you",
" ",
"lea",
"ve",
" ",
"off",
" ",
"a",
" ",
"field",
" ",
"with",
" ",
"\"",
"default",
"\"",
" ",
"set",
",",
" ",
"Dj",
"ang",
"o",
" ",
"will",
" ",
"use",
" ",
"the",
" ",
"default",
".",
"\\",
"10",
";",
">>>",
" ",
"a6",
" ",
"=",
" ",
"Artic",
"le",
"(",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
"))\\",
"10",
";",
">>>",
" ",
"a6",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a6",
".",
"headline",
"\\",
"10",
";'",
"Default",
" ",
"headline",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"For",
" ",
"Date",
"Time",
"Field",
"s",
",",
" ",
"Dj",
"ang",
"o",
" ",
"save",
"s",
" ",
"as",
" ",
"muc",
"h",
" ",
"preci",
"sion",
" ",
"(",
"in",
" ",
"second",
"s",
")",
" ",
"as",
" ",
"you",
"\\",
"10",
";",
"#",
" ",
"give",
" ",
"it",
".",
"\\",
"10",
";",
">>>",
" ",
"a7",
" ",
"=",
" ",
"Artic",
"le",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"7",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
"))\\",
"10",
";",
">>>",
" ",
"a7",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"7",
").",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
")",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"a8",
" ",
"=",
" ",
"Artic",
"le",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"8",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
"))\\",
"10",
";",
">>>",
" ",
"a8",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"8",
").",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
")",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"id",
"\\",
"10",
";",
"8",
"L",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Sav",
"ing",
" ",
"an",
" ",
"object",
" ",
"again",
" ",
"doe",
"sn",
"'",
"t",
" ",
"create",
" ",
"a",
" ",
"new",
" ",
"object",
" ",
"--",
" ",
"it",
" ",
"just",
" ",
"save",
"s",
" ",
"the",
" ",
"old",
" ",
"one",
".",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"id",
"\\",
"10",
";",
"8",
"L",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"headline",
" ",
"=",
" ",
"'",
"Update",
"d",
" ",
"article",
" ",
"8",
"'",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a8",
".",
"id",
"\\",
"10",
";",
"8",
"L",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"a7",
" ",
"==",
" ",
"a8",
"\\",
"10",
";",
"Fal",
"se",
"\\",
"10",
";",
">>>",
" ",
"a8",
" ",
"==",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"8",
")",
"\\",
"10",
";",
"Tru",
"e",
"\\",
"10",
";",
">>>",
" ",
"a7",
" ",
"!=",
" ",
"a8",
"\\",
"10",
";",
"Tru",
"e",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"8",
")",
" ",
"!=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"7",
")",
"\\",
"10",
";",
"Tru",
"e",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"8",
")",
" ",
"==",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"7",
")",
"\\",
"10",
";",
"Fal",
"se",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"dates",
"()",
" ",
"return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"avail",
"able",
" ",
"dates",
" ",
"of",
" ",
"the",
" ",
"give",
"n",
" ",
"scope",
" ",
"for",
" ",
"the",
" ",
"give",
"n",
" ",
"field",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"year",
"')",
"\\",
"10",
";",
"[",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"1",
",",
" ",
"1",
",",
" ",
"0",
",",
" ",
"0",
")]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"month",
"')",
"\\",
"10",
";",
"[",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"1",
",",
" ",
"0",
",",
" ",
"0",
")]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"day",
"')",
"\\",
"10",
";",
"[",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"0",
",",
" ",
"0",
")]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"day",
"',",
" ",
"order",
"='",
"ASC",
"')",
"\\",
"10",
";",
"[",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"0",
",",
" ",
"0",
")]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"day",
"',",
" ",
"order",
"='",
"DESC",
"')",
"\\",
"10",
";",
"[",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
",",
" ",
"0",
",",
" ",
"0",
"),",
" ",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
",",
" ",
"0",
",",
" ",
"0",
")]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"dates",
"()",
" ",
"require",
"s",
" ",
"valid",
" ",
"argu",
"ment",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"()",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Type",
"Error",
":",
" ",
"dates",
"()",
" ",
"take",
"s",
" ",
"at",
" ",
"leas",
"t",
" ",
"3",
" ",
"argu",
"ment",
"s",
" ",
"(",
"1",
" ",
"give",
"n",
")",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"invalid",
"\\u",
"field",
"',",
" ",
"'",
"year",
"')",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Field",
"Do",
"es",
"Not",
"Exist",
":",
" ",
"Artic",
"le",
" ",
"has",
" ",
"no",
" ",
"field",
" ",
"named",
" ",
"'",
"invalid",
"\\u",
"field",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"bad",
"\\u",
"kind",
"')",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"'",
"kind",
"'",
" ",
"must",
" ",
"be",
" ",
"one",
" ",
"of",
" ",
"'",
"year",
"',",
" ",
"'",
"month",
"'",
" ",
"or",
" ",
"'",
"day",
"'.",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"year",
"',",
" ",
"order",
"='",
"bad",
" ",
"order",
"')",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"'",
"order",
"'",
" ",
"must",
" ",
"be",
" ",
"eit",
"her",
" ",
"'",
"ASC",
"'",
" ",
"or",
" ",
"'",
"DESC",
"'.",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Us",
"e",
" ",
"iter",
"ator",
"()",
" ",
"with",
" ",
"dates",
"()",
" ",
"to",
" ",
"return",
" ",
"a",
" ",
"generat",
"or",
" ",
"tha",
"t",
" ",
"laz",
"il",
"y",
" ",
"request",
"s",
" ",
"each",
"\\",
"10",
";",
"#",
" ",
"result",
" ",
"one",
" ",
"at",
" ",
"a",
" ",
"time",
",",
" ",
"to",
" ",
"save",
" ",
"memory",
".",
"\\",
"10",
";",
">>>",
" ",
"for",
" ",
"a",
" ",
"in",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"dates",
"('",
"pub",
"\\u",
"date",
"',",
" ",
"'",
"day",
"',",
" ",
"order",
"='",
"DESC",
"')",
".",
"iter",
"ator",
"():",
"\\",
"10",
";",
"...",
" ",
"print",
" ",
"repr",
"(",
"a",
")",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"30",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"9",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"2",
"8",
",",
" ",
"0",
",",
" ",
"0",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"combin",
"e",
" ",
"querie",
"s",
" ",
"with",
" ",
"&",
" ",
"and",
" ",
"|.",
"\\",
"10",
";",
">>>",
" ",
"s1",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"id",
"\\u\\u",
"exact",
"=",
"1",
")",
"\\",
"10",
";",
">>>",
" ",
"s2",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"id",
"\\u\\u",
"exact",
"=",
"2",
")",
"\\",
"10",
";",
">>>",
" ",
"s1",
" ",
"|",
" ",
"s2",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">]",
"\\",
"10",
";",
">>>",
" ",
"s1",
" ",
"&",
" ",
"s2",
"\\",
"10",
";",
"[]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"get",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"object",
"s",
" ",
"like",
" ",
"this",
":",
"\\",
"10",
";",
">>>",
" ",
"len",
"(",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"id",
"\\u\\u",
"exact",
"=",
"1",
"))\\",
"10",
";",
"1",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"get",
" ",
"items",
" ",
"usi",
"ng",
" ",
"index",
" ",
"and",
" ",
"slice",
" ",
"notation",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
"]",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"1",
":",
"3",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">]",
"\\",
"10",
";",
">>>",
" ",
"s3",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"id",
"\\u\\u",
"exact",
"=",
"3",
")",
"\\",
"10",
";",
">>>",
" ",
"(",
"s1",
" ",
"|",
" ",
"s2",
" ",
"|",
" ",
"s3",
")[",
"::",
"2",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Slice",
"s",
" ",
"(",
"with",
"out",
" ",
"step",
")",
" ",
"are",
" ",
"lazy",
":",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"].",
"filter",
"()",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"6",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Default",
" ",
"headline",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Sli",
"cing",
" ",
"again",
" ",
"works",
":",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"][",
"0",
":",
"2",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"][",
":",
"2",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"][",
"4",
":]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Default",
" ",
"headline",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"][",
"5",
":]",
"\\",
"10",
";",
"[]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Some",
" ",
"more",
" ",
"tests",
"!",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"2",
":]",
"[",
"0",
":",
"2",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"6",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"2",
":]",
"[:",
"2",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"6",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"2",
":]",
"[",
"2",
":",
"3",
"]",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Default",
" ",
"headline",
">]",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"you",
" ",
"can",
"'",
"t",
" ",
"use",
" ",
"'",
"offset",
"'",
" ",
"with",
"out",
" ",
"'",
"limit",
"'",
" ",
"(",
"on",
" ",
"some",
" ",
"dbs",
"),",
" ",
"so",
" ",
"this",
" ",
"doe",
"sn",
"'",
"t",
" ",
"work",
":",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"2",
":]",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"'",
"offset",
"'",
" ",
"is",
" ",
"not",
" ",
"allow",
"ed",
" ",
"with",
"out",
" ",
"'",
"limit",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Al",
"so",
",",
" ",
"onc",
"e",
" ",
"you",
" ",
"have",
" ",
"sliced",
" ",
"you",
" ",
"can",
"'",
"t",
" ",
"filter",
",",
" ",
"re",
"-",
"order",
" ",
"or",
" ",
"combin",
"e",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"].",
"filter",
"(",
"id",
"=",
"1",
")",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"Cann",
"ot",
" ",
"filter",
" ",
"a",
" ",
"query",
" ",
"onc",
"e",
" ",
"a",
" ",
"slice",
" ",
"has",
" ",
"bee",
"n",
" ",
"take",
"n",
".",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"5",
"].",
"order",
"\\u",
"by",
"('",
"id",
"')",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"Cann",
"ot",
" ",
"reorder",
" ",
"a",
" ",
"query",
" ",
"onc",
"e",
" ",
"a",
" ",
"slice",
" ",
"has",
" ",
"bee",
"n",
" ",
"take",
"n",
".",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":",
"1",
"]",
" ",
"&",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"4",
":",
"5",
"]",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"Cann",
"ot",
" ",
"combin",
"e",
" ",
"querie",
"s",
" ",
"onc",
"e",
" ",
"a",
" ",
"slice",
" ",
"has",
" ",
"bee",
"n",
" ",
"take",
"n",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Nega",
"tiv",
"e",
" ",
"slice",
"s",
" ",
"are",
" ",
"not",
" ",
"support",
"ed",
",",
" ",
"due",
" ",
"to",
" ",
"databa",
"se",
" ",
"constraint",
"s",
".",
"\\",
"10",
";",
"#",
" ",
"(",
"hin",
"t",
":",
" ",
"invert",
"ing",
" ",
"your",
" ",
"orderi",
"ng",
" ",
"mig",
"ht",
" ",
"do",
" ",
"what",
" ",
"you",
" ",
"need",
").",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"-1",
"]",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"Nega",
"tiv",
"e",
" ",
"indexing",
" ",
"is",
" ",
"not",
" ",
"support",
"ed",
".",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()[",
"0",
":-",
"5",
"]",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Assert",
"ion",
"Error",
":",
" ",
"Nega",
"tiv",
"e",
" ",
"indexing",
" ",
"is",
" ",
"not",
" ",
"support",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"An",
" ",
"Artic",
"le",
" ",
"instance",
" ",
"doe",
"sn",
"'",
"t",
" ",
"have",
" ",
"access",
" ",
"to",
" ",
"the",
" ",
"\"",
"object",
"s",
"\"",
" ",
"attribute",
".",
"\\",
"10",
";",
"#",
" ",
"Tha",
"t",
"'",
"s",
" ",
"only",
" ",
"avail",
"able",
" ",
"on",
" ",
"the",
" ",
"class",
".",
"\\",
"10",
";",
">>>",
" ",
"a7",
".",
"object",
"s",
".",
"all",
"()",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Attribute",
"Error",
":",
" ",
"Manager",
" ",
"isn",
"'",
"t",
" ",
"accessible",
" ",
"via",
" ",
"Artic",
"le",
" ",
"instance",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
">>>",
" ",
"a7",
".",
"object",
"s",
"\\",
"10",
";",
"Trace",
"back",
" ",
"(",
"most",
" ",
"recent",
" ",
"call",
" ",
"last",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
"\\",
"10",
";",
"Attribute",
"Error",
":",
" ",
"Manager",
" ",
"isn",
"'",
"t",
" ",
"accessible",
" ",
"via",
" ",
"Artic",
"le",
" ",
"instance",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Bul",
"k",
" ",
"delete",
" ",
"test",
":",
" ",
"Ho",
"w",
" ",
"many",
" ",
"object",
"s",
" ",
"bef",
"ore",
" ",
"and",
" ",
"after",
" ",
"the",
" ",
"delete",
"?",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Area",
" ",
"wo",
"man",
" ",
"program",
"s",
" ",
"in",
" ",
"Pyth",
"on",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Second",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Thi",
"rd",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"6",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Default",
" ",
"headline",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Four",
"th",
" ",
"article",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"7",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Update",
"d",
" ",
"article",
" ",
"8",
">]",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"id",
"\\u\\u",
"lte",
"=",
"4",
").",
"delete",
"()",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"all",
"()",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"6",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Default",
" ",
"headline",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"7",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Update",
"d",
" ",
"article",
" ",
"8",
">]",
"\\",
"10",
";\"\"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"buildi",
"ng",
"\\u",
"docs_",
"=_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"BUILD",
"ING",
"\\u",
"DOCS",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"buildi",
"ng",
"\\u",
"docs_",
"or_",
"settings_",
"._",
"DATA",
"BASE",
"\\u",
"ENGINE_",
"==_",
"'",
"postgres",
"ql",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u\\u",
"test\\u",
"\\u_",
"[_",
"'",
"API",
"\\u",
"TESTS",
"'_",
"]_",
"+=_",
"\"\"\"",
"\\",
"10",
";",
"#",
" ",
"In",
" ",
"Post",
"gre",
"SQL",
",",
" ",
"microsecond",
"-",
"level",
" ",
"preci",
"sion",
" ",
"is",
" ",
"avail",
"able",
".",
"\\",
"10",
";",
">>>",
" ",
"a9",
" ",
"=",
" ",
"Artic",
"le",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"9",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
",",
" ",
"180",
"))\\",
"10",
";",
">>>",
" ",
"a9",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"9",
").",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
",",
" ",
"180",
")",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"buildi",
"ng",
"\\u",
"docs_",
"or_",
"settings_",
"._",
"DATA",
"BASE",
"\\u",
"ENGINE_",
"==_",
"'",
"mysql",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u\\u",
"test\\u",
"\\u_",
"[_",
"'",
"API",
"\\u",
"TESTS",
"'_",
"]_",
"+=_",
"\"\"\"",
"\\",
"10",
";",
"#",
" ",
"In",
" ",
"My",
"SQL",
",",
" ",
"microsecond",
"-",
"level",
" ",
"preci",
"sion",
" ",
"isn",
"'",
"t",
" ",
"avail",
"able",
".",
" ",
"You",
"'",
"ll",
" ",
"lose",
"\\",
"10",
";",
"#",
" ",
"microsecond",
"-",
"level",
" ",
"preci",
"sion",
" ",
"onc",
"e",
" ",
"the",
" ",
"data",
" ",
"is",
" ",
"saved",
".",
"\\",
"10",
";",
">>>",
" ",
"a9",
" ",
"=",
" ",
"Artic",
"le",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"9",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
",",
" ",
"180",
"))\\",
"10",
";",
">>>",
" ",
"a9",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"id",
"\\u\\u",
"exact",
"=",
"9",
").",
"pub",
"\\u",
"date",
"\\",
"10",
";",
"datetime",
".",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
")",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u",
"test\\u",
"\\u_",
"[_",
"'",
"API",
"\\u",
"TESTS",
"'_",
"]_",
"+=_",
"\"\"\"",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"manu",
"ally",
" ",
"speci",
"fy",
" ",
"the",
" ",
"primary",
" ",
"key",
" ",
"whe",
"n",
" ",
"creati",
"ng",
" ",
"a",
" ",
"new",
" ",
"object",
".",
"\\",
"10",
";",
">>>",
" ",
"a1",
"01",
" ",
"=",
" ",
"Artic",
"le",
"(",
"id",
"=",
"101",
",",
" ",
"headline",
"='",
"Artic",
"le",
" ",
"101",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
"))\\",
"10",
";",
">>>",
" ",
"a1",
"01",
".",
"save",
"()",
"\\",
"10",
";",
">>>",
" ",
"a1",
"01",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"pk",
"=",
"101",
")",
"\\",
"10",
";",
">>>",
" ",
"a1",
"01",
".",
"headline",
"\\",
"10",
";'",
"Artic",
"le",
" ",
"101",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"You",
" ",
"can",
" ",
"create",
" ",
"saved",
" ",
"object",
"s",
" ",
"in",
" ",
"a",
" ",
"single",
" ",
"step",
"\\",
"10",
";",
">>>",
" ",
"a1",
"0",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"create",
"(",
"headline",
"=\"",
"Artic",
"le",
" ",
"10",
"\",",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2005",
",",
" ",
"7",
",",
" ",
"3",
"1",
",",
" ",
"1",
"2",
",",
" ",
"30",
",",
" ",
"4",
"5",
"))\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"get",
"(",
"headline",
"=\"",
"Artic",
"le",
" ",
"10",
"\")",
"\\",
"10",
";<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"10",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"#",
" ",
"Ed",
"ge",
"-",
"case",
" ",
"test",
":",
" ",
"A",
" ",
"year",
" ",
"look",
"up",
" ",
"shou",
"ld",
" ",
"retrieve",
" ",
"all",
" ",
"object",
"s",
" ",
"in",
" ",
"the",
" ",
"give",
"n",
"\\",
"10",
";",
"year",
",",
" ",
"inclu",
"ding",
" ",
"Jan",
".",
" ",
"1",
" ",
"and",
" ",
"De",
"c",
".",
" ",
"31.",
"\\",
"10",
";",
">>>",
" ",
"a1",
"1",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"create",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"11",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2008",
",",
" ",
"1",
",",
" ",
"1",
"))\\",
"10",
";",
">>>",
" ",
"a1",
"2",
" ",
"=",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"create",
"(",
"headline",
"='",
"Artic",
"le",
" ",
"1",
"2",
"',",
" ",
"pub",
"\\u",
"date",
"=",
"datetime",
"(",
"2008",
",",
" ",
"1",
"2",
",",
" ",
"3",
"1",
",",
" ",
"23",
",",
" ",
"5",
"9",
",",
" ",
"5",
"9",
",",
" ",
"999999",
"))\\",
"10",
";",
">>>",
" ",
"Artic",
"le",
".",
"object",
"s",
".",
"filter",
"(",
"pub",
"\\u",
"date",
"\\u\\u",
"year",
"=",
"2008",
")",
"\\",
"10",
";",
"[",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"11",
">",
",",
" ",
"<",
"Artic",
"le",
":",
" ",
"Artic",
"le",
" ",
"1",
"2",
">]",
"\\",
"10",
";\"\"\"_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Article_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"headline",
"_",
"=_",
"models_",
"._",
"Char",
"Field_",
"(_",
"maxlength",
"_",
"=_",
"100_",
",_",
"default_",
"=_",
"'",
"Default",
" ",
"headline",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pub",
"\\u",
"date_",
"=_",
"models_",
"._",
"Date",
"Time",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ordering_",
"=_",
"(_",
"'",
"pub",
"\\u",
"date",
"'_",
",_",
"'",
"headline",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Article_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"headline",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Module is imported more than once | openstack/horizon/openstack_dashboard/dashboards/project/images/images/views.py | [
{
"content": "# Copyright 2012 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n#\n# Copyright 2012 Nebula, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nViews for managing images.\n\"\"\"\nfrom django.core.urlresolvers import reverse\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom horizon import exceptions\nfrom horizon import forms\nfrom horizon import tabs\nfrom horizon.utils import memoized\n\nfrom openstack_dashboard import api\nfrom openstack_dashboard.utils import filters\n\nfrom openstack_dashboard.dashboards.project.images.images \\\n import forms as project_forms\nfrom openstack_dashboard.dashboards.project.images.images \\\n import tables as project_tables\nfrom openstack_dashboard.dashboards.project.images.images \\\n import tabs as project_tabs\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"more_",
"than_",
"once_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"Unit",
"ed",
" ",
"State",
"s",
" ",
"Gov",
"ern",
"ment",
" ",
"as",
" ",
"represent",
"ed",
" ",
"by",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Administra",
"tor",
" ",
"of",
" ",
"the",
" ",
"Nat",
"ional",
" ",
"Aer",
"ona",
"uti",
"cs",
" ",
"and",
" ",
"Spac",
"e",
" ",
"Administrati",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"Ne",
"bul",
"a",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"View",
"s",
" ",
"for",
" ",
"mana",
"ging",
" ",
"images",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"urlresolvers_",
"import_",
"reverse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"urlresolvers_",
"import_",
"reverse",
"\\u",
"lazy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"exceptions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"tabs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"._",
"utils_",
"import_",
"memoized",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"openst",
"ack",
"\\u",
"dashboard_",
"import_",
"api_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openst",
"ack",
"\\u",
"dashboard_",
"._",
"utils_",
"import_",
"filters_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"openst",
"ack",
"\\u",
"dashboard_",
"._",
"dashboards",
"_",
"._",
"project_",
"._",
"images_",
"._",
"images_",
"import_",
"forms_",
"as_",
"project",
"\\u",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"openst",
"ack",
"\\u",
"dashboard_",
"._",
"dashboards",
"_",
"._",
"project_",
"._",
"images_",
"._",
"images_",
"import_",
"tables_",
"as_",
"project",
"\\u",
"tables_",
"\\u\\u\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#\n# Copyright (C) 2007-2015 Dirk Beyer\n# All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# prepare for Python 3\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\n# THIS MODULE HAS TO WORK WITH PYTHON 2.7!\n\nimport argparse\nimport logging\nimport os\nimport sys\nimport tempfile\nimport threading\nsys.dont_write_bytecode = True # prevent creation of .pyc files\n\nfrom benchexec.cgroups import * # @UnusedWildImport\nfrom benchexec.runexecutor import RunExecutor\nfrom benchexec import util\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def check_cgroup_availability(wait=1):\n \"\"\"\n Basic utility to check the availability and permissions of cgroups.\n This will log some warnings for the user if necessary.\n On some systems, daemons such as cgrulesengd might interfere with the cgroups\n of a process soon after it was started. Thus this function starts a process,\n waits a configurable amount of time, and check whether the cgroups have been changed.\n @param wait: a non-negative int that is interpreted as seconds to wait during the check\n @raise SystemExit: if cgroups are not usable\n \"\"\"\n logging.basicConfig(format=\"%(levelname)s: %(message)s\")\n runexecutor = RunExecutor()\n my_cgroups = runexecutor.cgroups\n\n if not (CPUACCT in my_cgroups and\n CPUSET in my_cgroups and\n # FREEZER in my_cgroups and # For now, we do not require freezer\n MEMORY in my_cgroups):\n sys.exit(1)\n\n with tempfile.NamedTemporaryFile(mode='rt') as tmp:\n runexecutor.execute_run(['sh', '-c', 'sleep {0}; cat /proc/self/cgroup'.format(wait)], tmp.name,\n memlimit=1024*1024, # set memlimit to force check for swapaccount\n # set cores and memory_nodes to force usage of CPUSET\n cores=util.parse_int_list(my_cgroups.get_value(CPUSET, 'cpus')),\n memory_nodes=my_cgroups.read_allowed_memory_banks())\n lines = []\n for line in tmp:\n line = line.strip()\n if line and not line == \"sh -c 'sleep {0}; cat /proc/self/cgroup'\".format(wait) \\\n and not all(c == '-' for c in line):\n lines.append(line)\n task_cgroups = find_my_cgroups(lines)\n\n fail = False\n for subsystem in CPUACCT, CPUSET, MEMORY, FREEZER:\n if subsystem in my_cgroups:\n if not task_cgroups[subsystem].startswith(os.path.join(my_cgroups[subsystem], 'benchmark_')):\n logging.warning('Task was in cgroup %s for subsystem %s, '\n 'which is not the expected sub-cgroup of %s. '\n 'Maybe some other program is interfering with cgroup management?',\n task_cgroups[subsystem], subsystem, my_cgroups[subsystem])\n fail = True\n if fail:\n sys.exit(1)",
"metadata": "root.check_cgroup_availability",
"header": "['module', '___EOS___']",
"index": 35
},
{
"content": "def check_cgroup_availability_in_thread(options):\n \"\"\"\n Run check_cgroup_availability() in a separate thread to detect the following problem:\n If \"cgexec --sticky\" is used to tell cgrulesengd to not interfere\n with our child processes, the sticky flag unfortunately works only\n for processes spawned by the main thread, not those spawned by other threads\n (and this will happen if \"benchexec -N\" is used).\n \"\"\"\n thread = _CheckCgroupsThread(options)\n thread.start()\n thread.join()\n if thread.error:\n raise thread.error",
"metadata": "root.check_cgroup_availability_in_thread",
"header": "['module', '___EOS___']",
"index": 82
},
{
"content": "class _CheckCgroupsThread(threading.Thread):\n\n error = None\n\n",
"metadata": "root._CheckCgroupsThread",
"header": "['module', '___EOS___']",
"index": 96
},
{
"content": " def __init__(self, options):\n super(_CheckCgroupsThread, self).__init__()\n self.options = options",
"metadata": "root._CheckCgroupsThread.__init__",
"header": "['class', '_CheckCgroupsThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']",
"index": 100
},
{
"content": " def run(self):\n try:\n check_cgroup_availability(self.options.wait)\n except BaseException as e:\n self.error = e",
"metadata": "root._CheckCgroupsThread.run",
"header": "['class', '_CheckCgroupsThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']",
"index": 104
},
{
"content": "def main(argv=None):\n \"\"\"\n A simple command-line interface for the cgroups check of BenchExec.\n \"\"\"\n if argv is None:\n argv = sys.argv\n\n parser = argparse.ArgumentParser(\n fromfile_prefix_chars='@',\n description=\n \"\"\"Check whether cgroups are available and can be used for BenchExec.\n Part of BenchExec: https://github.com/sosy-lab/benchexec/\"\"\")\n parser.add_argument(\"--wait\", type=int, default=1, metavar=\"SECONDS\",\n help='wait some time to ensure no process interferes with cgroups in the meantime (default: 1s)')\n parser.add_argument(\"--no-thread\", action=\"store_true\",\n help='run check on the main thread instead of a separate thread'\n + '(behavior of cgrulesengd differs depending on this)')\n\n options = parser.parse_args(argv[1:])\n\n if options.no_thread:\n check_cgroup_availability(options.wait)\n else:\n check_cgroup_availability_in_thread(options)",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 111
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Ben",
"ch",
"Exe",
"c",
" ",
"is",
" ",
"a",
" ",
"frame",
"work",
" ",
"for",
" ",
"reliab",
"le",
" ",
"bench",
"marking",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"part",
" ",
"of",
" ",
"Ben",
"ch",
"Exe",
"c",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2007",
"-",
"201",
"5",
" ",
" ",
"Dir",
"k",
" ",
"Be",
"yer_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\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_",
"#",
" ",
"prepar",
"e",
" ",
"for",
" ",
"Pyth",
"on",
" ",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"print",
"\\u",
"function_",
",_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THIS",
" ",
"MODUL",
"E",
" ",
"HAS",
" ",
"TO",
" ",
"WORK",
" ",
"WITH",
" ",
"PYTHON",
" ",
"2.7",
"!",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"argparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tempfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"threading_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"don",
"t",
"\\u",
"write",
"\\u",
"bytecode_",
"=_",
"True_",
"#",
" ",
"prevent",
" ",
"creati",
"on",
" ",
"of",
" ",
".",
"pyc",
" ",
"files_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"bench",
"exec_",
"._",
"cgroup",
"s_",
"import_",
"*_",
"#",
" ",
"@",
"Un",
"used",
"Wild",
"Import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bench",
"exec_",
"._",
"rune",
"xec",
"uto",
"r_",
"import_",
"Run",
"Executor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bench",
"exec_",
"import_",
"util_",
"\\u\\u\\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\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"check",
"\\u",
"cgroup",
"\\u",
"availability_",
"(_",
"wait_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Basic",
" ",
"utility",
" ",
"to",
" ",
"check",
" ",
"the",
" ",
"avail",
"abilit",
"y",
" ",
"and",
" ",
"permissi",
"ons",
" ",
"of",
" ",
"cgroup",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"will",
" ",
"log",
" ",
"some",
" ",
"warn",
"ings",
" ",
"for",
" ",
"the",
" ",
"user",
" ",
"if",
" ",
"necessar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"On",
" ",
"some",
" ",
"system",
"s",
",",
" ",
"daemon",
"s",
" ",
"suc",
"h",
" ",
"as",
" ",
"cg",
"rule",
"sen",
"gd",
" ",
"mig",
"ht",
" ",
"interf",
"ere",
" ",
"with",
" ",
"the",
" ",
"cgroup",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"a",
" ",
"process",
" ",
"soo",
"n",
" ",
"after",
" ",
"it",
" ",
"was",
" ",
"start",
"ed",
".",
" ",
"Thu",
"s",
" ",
"this",
" ",
"function",
" ",
"starts",
" ",
"a",
" ",
"process",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"waits",
" ",
"a",
" ",
"configurable",
" ",
"amo",
"unt",
" ",
"of",
" ",
"time",
",",
" ",
"and",
" ",
"check",
" ",
"whe",
"ther",
" ",
"the",
" ",
"cgroup",
"s",
" ",
"have",
" ",
"bee",
"n",
" ",
"change",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"wait",
":",
" ",
"a",
" ",
"non",
"-",
"negati",
"ve",
" ",
"int",
" ",
"tha",
"t",
" ",
"is",
" ",
"interprete",
"d",
" ",
"as",
" ",
"second",
"s",
" ",
"to",
" ",
"wait",
" ",
"dur",
"ing",
" ",
"the",
" ",
"check",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"raise",
" ",
"System",
"Exi",
"t",
":",
" ",
"if",
" ",
"cgroup",
"s",
" ",
"are",
" ",
"not",
" ",
"usable",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logging_",
"._",
"basic",
"Config_",
"(_",
"format_",
"=_",
"\"%",
"(",
"level",
"name",
")",
"s",
":",
" ",
"%",
"(",
"message",
")",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rune",
"xec",
"uto",
"r_",
"=_",
"Run",
"Executor_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"my",
"\\u",
"cgroup",
"s_",
"=_",
"rune",
"xec",
"uto",
"r_",
"._",
"cgroup",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"(_",
"CPU",
"ACC",
"T_",
"in_",
"my",
"\\u",
"cgroup",
"s_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"CPU",
"SET_",
"in_",
"my",
"\\u",
"cgroup",
"s_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FREE",
"ZE",
"R",
" ",
"in",
" ",
"my",
"\\u",
"cgroup",
"s",
" ",
"and",
" ",
"#",
" ",
"For",
" ",
"now",
",",
" ",
"we",
" ",
"do",
" ",
"not",
" ",
"require",
" ",
"freez",
"er_",
"\\u\\u\\uNL\\u\\u\\u_",
"MEM",
"ORY",
"_",
"in_",
"my",
"\\u",
"cgroup",
"s_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
"mode_",
"=_",
"'",
"rt",
"'_",
")_",
"as_",
"tmp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rune",
"xec",
"uto",
"r_",
"._",
"execute",
"\\u",
"run_",
"(_",
"[_",
"'",
"sh",
"'_",
",_",
"'-",
"c",
"'_",
",_",
"'",
"sleep",
" ",
"{",
"0",
"};",
" ",
"cat",
" ",
"/",
"proc",
"/",
"self",
"/",
"cgroup",
"'_",
"._",
"format_",
"(_",
"wait_",
")_",
"]_",
",_",
"tmp_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mem",
"limit_",
"=_",
"1024_",
"*_",
"1024_",
",_",
"#",
" ",
"set",
" ",
"mem",
"limit",
" ",
"to",
" ",
"force",
" ",
"check",
" ",
"for",
" ",
"swap",
"account_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"set",
" ",
"cores",
" ",
"and",
" ",
"memory",
"\\u",
"nodes",
" ",
"to",
" ",
"force",
" ",
"usage",
" ",
"of",
" ",
"CPU",
"SET_",
"\\u\\u\\uNL\\u\\u\\u_",
"cores_",
"=_",
"util_",
"._",
"parse",
"\\u",
"int\\u",
"list_",
"(_",
"my",
"\\u",
"cgroup",
"s_",
"._",
"get",
"\\u",
"value_",
"(_",
"CPU",
"SET_",
",_",
"'",
"cpus",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"memory",
"\\u",
"nodes_",
"=_",
"my",
"\\u",
"cgroup",
"s_",
"._",
"read",
"\\u",
"allow",
"ed",
"\\u",
"memory",
"\\u",
"banks",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lines_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"line_",
"in_",
"tmp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"line_",
"and_",
"not_",
"line_",
"==_",
"\"",
"sh",
" ",
"-",
"c",
" ",
"'",
"sleep",
" ",
"{",
"0",
"};",
" ",
"cat",
" ",
"/",
"proc",
"/",
"self",
"/",
"cgroup",
"'\"_",
"._",
"format_",
"(_",
"wait_",
")_",
"and_",
"not_",
"all_",
"(_",
"c_",
"==_",
"'-'_",
"for_",
"c_",
"in_",
"line_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lines_",
"._",
"append_",
"(_",
"line_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"task",
"\\u",
"cgroup",
"s_",
"=_",
"find",
"\\u",
"my",
"\\u",
"cgroup",
"s_",
"(_",
"lines_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fail_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"subsystem",
"_",
"in_",
"CPU",
"ACC",
"T_",
",_",
"CPU",
"SET_",
",_",
"MEM",
"ORY",
"_",
",_",
"FREE",
"ZE",
"R_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"subsystem",
"_",
"in_",
"my",
"\\u",
"cgroup",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"task",
"\\u",
"cgroup",
"s_",
"[_",
"subsystem",
"_",
"]_",
"._",
"startswith_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"my",
"\\u",
"cgroup",
"s_",
"[_",
"subsystem",
"_",
"]_",
",_",
"'",
"bench",
"mark",
"\\u'_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"warning_",
"(_",
"'",
"Task",
" ",
"was",
" ",
"in",
" ",
"cgroup",
" ",
"%",
"s",
" ",
"for",
" ",
"subsystem",
" ",
"%",
"s",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"whi",
"ch",
" ",
"is",
" ",
"not",
" ",
"the",
" ",
"expected",
" ",
"sub",
"-",
"cgroup",
" ",
"of",
" ",
"%",
"s",
".",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ma",
"yb",
"e",
" ",
"some",
" ",
"other",
" ",
"program",
" ",
"is",
" ",
"interf",
"erin",
"g",
" ",
"with",
" ",
"cgroup",
" ",
"manage",
"ment",
"?'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"task",
"\\u",
"cgroup",
"s_",
"[_",
"subsystem",
"_",
"]_",
",_",
"subsystem",
"_",
",_",
"my",
"\\u",
"cgroup",
"s_",
"[_",
"subsystem",
"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fail_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"fail_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"check",
"\\u",
"cgroup",
"\\u",
"avail",
"abilit",
"y",
"\\u",
"in",
"\\u",
"thread_",
"(_",
"options_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Run",
" ",
"check",
"\\u",
"cgroup",
"\\u",
"avail",
"abilit",
"y",
"()",
" ",
"in",
" ",
"a",
" ",
"separate",
" ",
"thread",
" ",
"to",
" ",
"detect",
" ",
"the",
" ",
"follow",
"ing",
" ",
"problem",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"\"",
"cg",
"exec",
" ",
"--",
"sticky",
"\"",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"tell",
" ",
"cg",
"rule",
"sen",
"gd",
" ",
"to",
" ",
"not",
" ",
"interf",
"ere",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"with",
" ",
"our",
" ",
"child",
" ",
"process",
"es",
",",
" ",
"the",
" ",
"sticky",
" ",
"flag",
" ",
"unfo",
"rtu",
"nat",
"el",
"y",
" ",
"works",
" ",
"only",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"for",
" ",
"process",
"es",
" ",
"spawne",
"d",
" ",
"by",
" ",
"the",
" ",
"main",
" ",
"thread",
",",
" ",
"not",
" ",
"tho",
"se",
" ",
"spawne",
"d",
" ",
"by",
" ",
"other",
" ",
"thread",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"and",
" ",
"this",
" ",
"will",
" ",
"happ",
"en",
" ",
"if",
" ",
"\"",
"bench",
"exec",
" ",
"-",
"N",
"\"",
" ",
"is",
" ",
"used",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"thread_",
"=_",
"\\u",
"Check",
"Cg",
"roup",
"s",
"Thread_",
"(_",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"thread_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"thread_",
"._",
"join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"thread_",
"._",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"thread_",
"._",
"error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"\\u",
"Check",
"Cg",
"roup",
"s",
"Thread_",
"(_",
"threading_",
"._",
"Thread_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"error_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Check",
"Cg",
"roup",
"s",
"Thread_",
"(_",
"threading_",
"._",
"Thread_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"options_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"\\u",
"Check",
"Cg",
"roup",
"s",
"Thread_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"options_",
"=_",
"options_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Check",
"Cg",
"roup",
"s",
"Thread_",
"(_",
"threading_",
"._",
"Thread_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"check",
"\\u",
"cgroup",
"\\u",
"availability_",
"(_",
"self_",
"._",
"options_",
"._",
"wait_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Base",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"error_",
"=_",
"e_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"main_",
"(_",
"argv_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"simple",
" ",
"command",
"-",
"line",
" ",
"interface",
" ",
"for",
" ",
"the",
" ",
"cgroup",
"s",
" ",
"check",
" ",
"of",
" ",
"Ben",
"ch",
"Exe",
"c",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\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\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"parser_",
"=_",
"argparse_",
"._",
"Arg",
"ument",
"Parser_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"from",
"file",
"\\u",
"prefix",
"\\u",
"chars_",
"=_",
"'@'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Check",
" ",
"whe",
"ther",
" ",
"cgroup",
"s",
" ",
"are",
" ",
"avail",
"able",
" ",
"and",
" ",
"can",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"Ben",
"ch",
"Exe",
"c",
".",
"\\",
"10",
";",
" ",
" ",
" ",
"Part",
" ",
"of",
" ",
"Ben",
"ch",
"Exe",
"c",
":",
" ",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"sos",
"y",
"-",
"lab",
"/",
"bench",
"exec",
"/\"",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\"--",
"wait",
"\"_",
",_",
"type_",
"=_",
"int_",
",_",
"default_",
"=_",
"1_",
",_",
"metavar_",
"=_",
"\"",
"SECOND",
"S",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"wait",
" ",
"some",
" ",
"time",
" ",
"to",
" ",
"ensure",
" ",
"no",
" ",
"process",
" ",
"interf",
"eres",
" ",
"with",
" ",
"cgroup",
"s",
" ",
"in",
" ",
"the",
" ",
"mean",
"time",
" ",
"(",
"default",
":",
" ",
"1s",
")'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\"--",
"no",
"-",
"thread",
"\"_",
",_",
"action_",
"=_",
"\"",
"store",
"\\u",
"true",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"run",
" ",
"check",
" ",
"on",
" ",
"the",
" ",
"main",
" ",
"thread",
" ",
"inst",
"ead",
" ",
"of",
" ",
"a",
" ",
"separate",
" ",
"thread",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"+_",
"'(",
"behavior",
" ",
"of",
" ",
"cg",
"rule",
"sen",
"gd",
" ",
"differs",
" ",
"depend",
"ing",
" ",
"on",
" ",
"this",
")'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"=_",
"parser_",
"._",
"parse",
"\\u",
"args_",
"(_",
"argv_",
"[_",
"1_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"options_",
"._",
"no",
"\\u",
"thread_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"check",
"\\u",
"cgroup",
"\\u",
"availability_",
"(_",
"options_",
"._",
"wait_",
")_",
"\\u\\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",
"cgroup",
"\\u",
"avail",
"abilit",
"y",
"\\u",
"in",
"\\u",
"thread_",
"(_",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | dimagi/commcare-hq/corehq/apps/userreports/sql/util.py | [
{
"content": "def get_column_name(path):\n \"\"\"\n :param path: xpath from form or case\n :return: column name for postgres\n\n Postgres only allows columns up to 63 characters\n Anyone viewing the table directly will want to know the last parts of the path, not the first parts e.g.\n this: 'my_long_choice_list_option_1_ABCDEFGH', 'my_long_choice_list_option_2_ABCD1234'\n not: 'question_group_1_my_long_choice_ABCDEFGH', 'question_group_1_my_long_choice_ABCD1234'\n \"\"\"\n parts = path.split(\"/\")\n\n def _hash(parts):\n front = \"/\".join(parts[:-1])\n end = parts[-1]\n return hashlib.sha1('{}_{}'.format(hashlib.sha1(front).hexdigest(), end)).hexdigest()[:8]\n\n new_parts = path[-54:].split(\"/\")\n return \"_\".join(new_parts + [_hash(parts)])",
"metadata": "root.get_column_name",
"header": "['module', '___EOS___']",
"index": 31
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"column",
"\\u",
"name_",
"(_",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"path",
":",
" ",
"xpa",
"th",
" ",
"from",
" ",
"form",
" ",
"or",
" ",
"case",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"column",
" ",
"name",
" ",
"for",
" ",
"postgres",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Post",
"gres",
" ",
"only",
" ",
"allow",
"s",
" ",
"column",
"s",
" ",
"up",
" ",
"to",
" ",
"6",
"3",
" ",
"character",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Any",
"one",
" ",
"viewin",
"g",
" ",
"the",
" ",
"table",
" ",
"direct",
"ly",
" ",
"will",
" ",
"want",
" ",
"to",
" ",
"know",
" ",
"the",
" ",
"last",
" ",
"part",
"s",
" ",
"of",
" ",
"the",
" ",
"path",
",",
" ",
"not",
" ",
"the",
" ",
"first",
" ",
"part",
"s",
" ",
"e",
".",
"g",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"this",
":",
" ",
"'",
"my",
"\\u",
"long",
"\\u",
"choice",
"\\u",
"list",
"\\u",
"option",
"\\u",
"1",
"\\u",
"ABCDE",
"FG",
"H",
"',",
" ",
"'",
"my",
"\\u",
"long",
"\\u",
"choice",
"\\u",
"list",
"\\u",
"option",
"\\u",
"2",
"\\u",
"ABC",
"D1",
"234",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"not",
":",
" ",
"'",
"question",
"\\u",
"group",
"\\u",
"1",
"\\u",
"my",
"\\u",
"long",
"\\u",
"choice",
"\\u",
"ABCDE",
"FG",
"H",
"',",
" ",
"'",
"question",
"\\u",
"group",
"\\u",
"1",
"\\u",
"my",
"\\u",
"long",
"\\u",
"choice",
"\\u",
"ABC",
"D1",
"234",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parts_",
"=_",
"path_",
"._",
"split_",
"(_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"hash_",
"(_",
"parts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"front_",
"=_",
"\"/\"_",
"._",
"join_",
"(_",
"parts_",
"[_",
":_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"end_",
"=_",
"parts_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"hashlib_",
"._",
"sha1_",
"(_",
"'{}\\u",
"{}'_",
"._",
"format_",
"(_",
"hashlib_",
"._",
"sha1_",
"(_",
"front_",
")_",
"._",
"hexdigest_",
"(_",
")_",
",_",
"end_",
")_",
")_",
"._",
"hexdigest_",
"(_",
")_",
"[_",
":_",
"8_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | serverdensity/sd-agent/checks.d/process.py | [
{
"content": " def psutil_wrapper(self, process, method, accessors, *args, **kwargs):\n \"\"\"\n A psutil wrapper that is calling\n * psutil.method(*args, **kwargs) and returns the result\n OR\n * psutil.method(*args, **kwargs).accessor[i] for each accessors given in\n a list, the result being indexed in a dictionary by the accessor name\n \"\"\"\n\n if accessors is None:\n result = None\n else:\n result = {}\n\n # Ban certain method that we know fail\n if method == 'memory_info_ex'\\\n and (Platform.is_win32() or Platform.is_solaris()):\n return result\n elif method == 'num_fds' and not Platform.is_unix():\n return result\n\n try:\n res = getattr(process, method)(*args, **kwargs)\n if accessors is None:\n result = res\n else:\n for acc in accessors:\n try:\n result[acc] = getattr(res, acc)\n except AttributeError:\n self.log.debug(\"psutil.%s().%s attribute does not exist\", method, acc)\n except (NotImplementedError, AttributeError):\n self.log.debug(\"psutil method %s not implemented\", method)\n except psutil.AccessDenied:\n self.log.debug(\"psutil was denied acccess for method %s\", method)\n except psutil.NoSuchProcess:\n self.warning(\"Process {0} disappeared while scanning\".format(process.pid))\n\n return result",
"metadata": "root.ProcessCheck.psutil_wrapper",
"header": "['class', 'ProcessCheck', '(', 'AgentCheck', ')', ':', '___EOS___']",
"index": 125
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Process",
"Check_",
"(_",
"Agent",
"Check_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"psu",
"til",
"\\u",
"wrapper_",
"(_",
"self_",
",_",
"process_",
",_",
"method_",
",_",
"accessor",
"s_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"psu",
"til",
" ",
"wrapp",
"er",
" ",
"tha",
"t",
" ",
"is",
" ",
"calling",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"psu",
"til",
".",
"method",
"(*",
"args",
",",
" ",
"**",
"kwarg",
"s",
")",
" ",
"and",
" ",
"return",
"s",
" ",
"the",
" ",
"result",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"OR",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"psu",
"til",
".",
"method",
"(*",
"args",
",",
" ",
"**",
"kwarg",
"s",
").",
"accessor",
"[",
"i",
"]",
" ",
"for",
" ",
"each",
" ",
"accessor",
"s",
" ",
"give",
"n",
" ",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"list",
",",
" ",
"the",
" ",
"result",
" ",
"bei",
"ng",
" ",
"indexe",
"d",
" ",
"in",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"by",
" ",
"the",
" ",
"accessor",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"accessor",
"s_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ban",
" ",
"cert",
"ain",
" ",
"method",
" ",
"tha",
"t",
" ",
"we",
" ",
"know",
" ",
"fail_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"method_",
"==_",
"'",
"memory",
"\\u",
"info",
"\\u",
"ex",
"'_",
"and_",
"(_",
"Platform_",
"._",
"is",
"\\u",
"win32",
"_",
"(_",
")_",
"or_",
"Platform_",
"._",
"is",
"\\u",
"solar",
"is_",
"(_",
")_",
")_",
":_",
"\\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_",
"elif_",
"method_",
"==_",
"'",
"num",
"\\u",
"fds",
"'_",
"and_",
"not_",
"Platform_",
"._",
"is",
"\\u",
"unix",
"_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"result_",
"\\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 ",
" _",
"res_",
"=_",
"getattr_",
"(_",
"process_",
",_",
"method_",
")_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"accessor",
"s_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"res_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"acc_",
"in_",
"accessor",
"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 ",
" ",
" _",
"result_",
"[_",
"acc_",
"]_",
"=_",
"getattr_",
"(_",
"res_",
",_",
"acc_",
")_",
"\\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_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"psu",
"til",
".",
"%",
"s",
"()",
".",
"%",
"s",
" ",
"attribute",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
"\"_",
",_",
"method_",
",_",
"acc_",
")_",
"\\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_",
"except_",
"(_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
",_",
"Attribute",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"psu",
"til",
" ",
"method",
" ",
"%",
"s",
" ",
"not",
" ",
"implemented",
"\"_",
",_",
"method_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"psutil_",
"._",
"Access",
"Denied_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"psu",
"til",
" ",
"was",
" ",
"deni",
"ed",
" ",
"acc",
"cess",
" ",
"for",
" ",
"method",
" ",
"%",
"s",
"\"_",
",_",
"method_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"psutil_",
"._",
"No",
"Suc",
"h",
"Process_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"warning_",
"(_",
"\"",
"Process",
" ",
"{",
"0",
"}",
" ",
"disapp",
"ear",
"ed",
" ",
"whi",
"le",
" ",
"scanning",
"\"_",
"._",
"format_",
"(_",
"process_",
"._",
"pid_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
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,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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
] |
Unnecessary 'else' clause in loop | GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py | [
{
"content": " def _Apply(self, meta_data):\n \"\"\"Applies the current txn on the given entity group.\n\n This function blindly performs the operations contained in the current txn.\n The calling function must acquire the entity group write lock and ensure\n transactions are applied in order.\n \"\"\"\n\n self._apply_lock.acquire()\n try:\n\n assert self._state == self.COMMITTED\n for tracker in self._entity_groups.values():\n if tracker._meta_data is meta_data:\n break\n else:\n assert False\n assert tracker._read_pos != tracker.APPLIED\n\n\n for entity, insert in tracker._put.itervalues():\n key = datastore_types.ReferenceToKeyValue(entity.key())\n if key in tracker._snapshot:\n metadata = tracker._snapshot[key].metadata\n else:\n metadata = entity_pb.EntityMetadata()\n metadata.set_updated_version(self.GetMutationVersion(entity.key()))\n record = EntityRecord(entity, metadata)\n self._txn_manager._Put(record, insert)\n\n\n for key in tracker._delete.itervalues():\n self._txn_manager._Delete(key)\n\n\n tracker._read_pos = EntityGroupTracker.APPLIED\n\n\n tracker._meta_data.Unlog(self)\n finally:\n self._apply_lock.release()",
"metadata": "root.LiveTxn._Apply",
"header": "['class', 'LiveTxn', '(', 'object', ')', ':', '___EOS___']",
"index": 1770
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"'",
"else",
"'_",
"clause_",
"in_",
"loop_",
"[SEP]_",
"class_",
"Live",
"Tx",
"n_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Apply",
"_",
"(_",
"self_",
",_",
"meta",
"\\u",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Appl",
"ies",
" ",
"the",
" ",
"current",
" ",
"tx",
"n",
" ",
"on",
" ",
"the",
" ",
"give",
"n",
" ",
"entity",
" ",
"group",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"function",
" ",
"blind",
"ly",
" ",
"perform",
"s",
" ",
"the",
" ",
"operati",
"ons",
" ",
"contain",
"ed",
" ",
"in",
" ",
"the",
" ",
"current",
" ",
"tx",
"n",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"calling",
" ",
"function",
" ",
"must",
" ",
"acquir",
"e",
" ",
"the",
" ",
"entity",
" ",
"group",
" ",
"write",
" ",
"lock",
" ",
"and",
" ",
"ensure",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"transaction",
"s",
" ",
"are",
" ",
"applied",
" ",
"in",
" ",
"order",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"appl",
"y",
"\\u",
"lock_",
"._",
"acquire_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"self_",
"._",
"\\u",
"state_",
"==_",
"self_",
"._",
"COMMIT",
"TED_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"tracker_",
"in_",
"self_",
"._",
"\\u",
"entity",
"\\u",
"groups_",
"._",
"values_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tracker_",
"._",
"\\u",
"meta",
"\\u",
"data_",
"is_",
"meta",
"\\u",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"tracker_",
"._",
"\\u",
"read",
"\\u",
"pos_",
"!=_",
"tracker_",
"._",
"APPL",
"IED",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"entity_",
",_",
"insert_",
"in_",
"tracker_",
"._",
"\\u",
"put_",
"._",
"itervalues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"datast",
"ore",
"\\u",
"types_",
"._",
"Reference",
"To",
"Key",
"Value_",
"(_",
"entity_",
"._",
"key_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"key_",
"in_",
"tracker_",
"._",
"\\u",
"snapshot_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"metadata_",
"=_",
"tracker_",
"._",
"\\u",
"snapshot_",
"[_",
"key_",
"]_",
"._",
"metadata_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"metadata_",
"=_",
"entity",
"\\u",
"pb_",
"._",
"Entit",
"y",
"Metadata_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"metadata_",
"._",
"set\\u",
"update",
"d\\u",
"version_",
"(_",
"self_",
"._",
"Get",
"Mutation",
"Version_",
"(_",
"entity_",
"._",
"key_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"Entit",
"y",
"Record_",
"(_",
"entity_",
",_",
"metadata_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"tx",
"n",
"\\u",
"manager_",
"._",
"\\u",
"Put",
"_",
"(_",
"record_",
",_",
"insert_",
")_",
"\\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_",
"key_",
"in_",
"tracker_",
"._",
"\\u",
"delete_",
"._",
"itervalues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"tx",
"n",
"\\u",
"manager_",
"._",
"\\u",
"Delete_",
"(_",
"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_",
"tracker_",
"._",
"\\u",
"read",
"\\u",
"pos_",
"=_",
"Entit",
"y",
"Group",
"Tracker_",
"._",
"APPL",
"IED",
"_",
"\\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
] |
Variable defined multiple times | ossxp-com/repo/git_command.py | [
{
"content": " def __getattr__(self, name):\n name = name.replace('_','-')\n def fun(*cmdv):\n command = [name]\n command.extend(cmdv)\n return GitCommand(None, command).Wait() == 0\n return fun",
"metadata": "root._GitCall.__getattr__",
"header": "['class', '_GitCall', '(', 'object', ')', ':', '___EOS___']",
"index": 98
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"\\u",
"Git",
"Call_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getattr\\u\\u_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"name_",
"._",
"replace_",
"(_",
"'\\u'_",
",_",
"'-'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"fun_",
"(_",
"*_",
"cmd",
"v_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"command_",
"=_",
"[_",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"command_",
"._",
"extend_",
"(_",
"cmd",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Git",
"Command_",
"(_",
"None_",
",_",
"command_",
")_",
"._",
"Wait_",
"(_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"fun_",
"\\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
] |
Unused local variable | simonw/django-redis-monitor/django_redis_monitor/redis_monitor.py | [
{
"content": " def get_recent_hits_per_second(self, hours = 0, minutes = 0, seconds = 0):\n gathered = self.get_recent_hits(hours, minutes, seconds)\n for date, hits in gathered:\n yield date, hits / 10.0",
"metadata": "root.RedisMonitor.get_recent_hits_per_second",
"header": "['class', 'RedisMonitor', '(', 'object', ')', ':', '___EOS___']",
"index": 72
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Red",
"is",
"Monitor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"recent",
"\\u",
"hits",
"\\u",
"per",
"\\u",
"second_",
"(_",
"self_",
",_",
"hours_",
"=_",
"0_",
",_",
"minutes_",
"=_",
"0_",
",_",
"seconds_",
"=_",
"0_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gather",
"ed_",
"=_",
"self_",
"._",
"get",
"\\u",
"recent",
"\\u",
"hits_",
"(_",
"hours_",
",_",
"minutes_",
",_",
"seconds_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"date_",
",_",
"hits_",
"in_",
"gather",
"ed_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"date_",
",_",
"hits_",
"/_",
"10.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
] |
Unused import | sensepost/Snoopy/snoopy/server/bin/sslstripSnoopy/build/lib.linux-i686-2.7/sslstrip/ServerConnectionFactory.py | [
{
"content": "# Copyright (c) 2004-2009 Moxie Marlinspike\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 3 of the\n# License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\n# USA\n#\n\nimport logging\nfrom twisted.internet.protocol import ClientFactory\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ServerConnectionFactory(ClientFactory):\n\n\n ",
"metadata": "root.ServerConnectionFactory",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": " def __init__(self, command, uri, postData, headers, client):\n self.command = command\n self.uri = uri\n self.postData = postData\n self.headers = headers\n self.client = client",
"metadata": "root.ServerConnectionFactory.__init__",
"header": "['class', 'ServerConnectionFactory', '(', 'ClientFactory', ')', ':', '___EOS___']",
"index": 23
},
{
"content": " def buildProtocol(self, addr):\n return self.protocol(self.command, self.uri, self.postData, self.headers, self.client)",
"metadata": "root.ServerConnectionFactory.buildProtocol",
"header": "['class', 'ServerConnectionFactory', '(', 'ClientFactory', ')', ':', '___EOS___']",
"index": 30
},
{
"content": " def clientConnectionFailed(self, connector, reason):\n logging.debug(\"Client:%s Server connection failed.\" % (self.client.getClientIP()))\n\n destination = connector.getDestination()\n\n if (destination.port != 443):\n logging.debug(\"Client:%s Retrying via SSL\" % (self.client.getClientIP()))\n self.client.proxyViaSSL(self.headers['host'], self.command, self.uri, self.postData, self.headers, 443)\n else:\n self.client.finish()",
"metadata": "root.ServerConnectionFactory.clientConnectionFailed",
"header": "['class', 'ServerConnectionFactory', '(', 'ClientFactory', ')', ':', '___EOS___']",
"index": 33
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2004",
"-",
"200",
"9",
" ",
"Mo",
"xi",
"e",
" ",
"Mar",
"lins",
"pike",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"program",
" ",
"is",
" ",
"free",
" ",
"software",
";",
" ",
"you",
" ",
"can",
" ",
"redis",
"tribut",
"e",
" ",
"it",
" ",
"and",
"/",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"modif",
"y",
" ",
"it",
" ",
"under",
" ",
"the",
" ",
"term",
"s",
" ",
"of",
" ",
"the",
" ",
"GN",
"U",
" ",
"General",
" ",
"Public",
" ",
"License",
" ",
"as_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"publi",
"shed",
" ",
"by",
" ",
"the",
" ",
"Free",
" ",
"Sof",
"twa",
"re",
" ",
"Foun",
"dati",
"on",
";",
" ",
"eit",
"her",
" ",
"version",
" ",
"3",
" ",
"of",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
",",
" ",
"or",
" ",
"(",
"at",
" ",
"your",
" ",
"option",
")",
" ",
"any",
" ",
"late",
"r",
" ",
"version",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"program",
" ",
"is",
" ",
"distributed",
" ",
"in",
" ",
"the",
" ",
"hop",
"e",
" ",
"tha",
"t",
" ",
"it",
" ",
"will",
" ",
"be",
" ",
"usef",
"ul",
",",
" ",
"but",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"ANY",
" ",
"WAR",
"RAN",
"TY",
";",
" ",
"with",
"out",
" ",
"even",
" ",
"the",
" ",
"impli",
"ed",
" ",
"warr",
"ant",
"y",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"or",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"GN",
"U_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"General",
" ",
"Public",
" ",
"License",
" ",
"for",
" ",
"more",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"shou",
"ld",
" ",
"have",
" ",
"receive",
"d",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"GN",
"U",
" ",
"General",
" ",
"Public",
" ",
"License",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"along",
" ",
"with",
" ",
"this",
" ",
"program",
";",
" ",
"if",
" ",
"not",
",",
" ",
"write",
" ",
"to",
" ",
"the",
" ",
"Free",
" ",
"Sof",
"twa",
"re_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Foun",
"dati",
"on",
",",
" ",
"Inc",
".,",
" ",
"5",
"9",
" ",
"Temp",
"le",
" ",
"Place",
",",
" ",
"Suit",
"e",
" ",
"330",
",",
" ",
"Bo",
"ston",
",",
" ",
"MA",
" ",
"0211",
"1",
"-1",
"307",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"USA",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"twisted_",
"._",
"internet_",
"._",
"protocol_",
"import_",
"Client",
"Factory_",
"\\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]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Server",
"Connect",
"ion",
"Factory_",
"(_",
"Client",
"Factory_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Server",
"Connect",
"ion",
"Factory_",
"(_",
"Client",
"Factory_",
")_",
":_",
"\\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_",
",_",
"command_",
",_",
"uri_",
",_",
"post",
"Data_",
",_",
"headers_",
",_",
"client_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"command_",
"=_",
"command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"uri_",
"=_",
"uri_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"post",
"Data_",
"=_",
"post",
"Data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"headers_",
"=_",
"headers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"client_",
"=_",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Server",
"Connect",
"ion",
"Factory_",
"(_",
"Client",
"Factory_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"Protocol_",
"(_",
"self_",
",_",
"addr_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"protocol_",
"(_",
"self_",
"._",
"command_",
",_",
"self_",
"._",
"uri_",
",_",
"self_",
"._",
"post",
"Data_",
",_",
"self_",
"._",
"headers_",
",_",
"self_",
"._",
"client_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Server",
"Connect",
"ion",
"Factory_",
"(_",
"Client",
"Factory_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"client",
"Connect",
"ion",
"Failed_",
"(_",
"self_",
",_",
"connector_",
",_",
"reason_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"debug_",
"(_",
"\"",
"Client",
":",
"%",
"s",
" ",
"Server",
" ",
"connecti",
"on",
" ",
"fail",
"ed",
".\"_",
"%_",
"(_",
"self_",
"._",
"client_",
"._",
"get",
"Client",
"IP_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"destination_",
"=_",
"connector_",
"._",
"get",
"Destination_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"destination_",
"._",
"port_",
"!=_",
"443_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"debug_",
"(_",
"\"",
"Client",
":",
"%",
"s",
" ",
"Retr",
"ying",
" ",
"via",
" ",
"SS",
"L",
"\"_",
"%_",
"(_",
"self_",
"._",
"client_",
"._",
"get",
"Client",
"IP_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"proxy",
"Via",
"SSL_",
"(_",
"self_",
"._",
"headers_",
"[_",
"'",
"host",
"'_",
"]_",
",_",
"self_",
"._",
"command_",
",_",
"self_",
"._",
"uri_",
",_",
"self_",
"._",
"post",
"Data_",
",_",
"self_",
"._",
"headers_",
",_",
"443_",
")_",
"\\u\\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_",
"._",
"client_",
"._",
"finish_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | gunthercox/ChatterBot/tests/base_case.py | [
{
"content": "from unittest import TestCase\nfrom chatterbot import ChatBot\nimport os\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ChatBotTestCase(TestCase):\n\n\n\n",
"metadata": "root.ChatBotTestCase",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": " def setUp(self):\n self.test_data_directory = 'test_data'\n self.test_database_name = self.random_string() + \".db\"\n\n if not os.path.exists(self.test_data_directory):\n os.makedirs(self.test_data_directory)\n\n database_path = os.path.join(\n self.test_data_directory,\n self.test_database_name\n )\n\n self.chatbot = ChatBot(\n \"Test Bot\",\n io_adapter=\"chatterbot.adapters.io.NoOutputAdapter\",\n database=database_path\n )",
"metadata": "root.ChatBotTestCase.setUp",
"header": "['class', 'ChatBotTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 7
},
{
"content": " def random_string(self, start=0, end=9000):\n \"\"\"\n Generate a string based on a random number.\n \"\"\"\n from random import randint\n return str(randint(start, end))",
"metadata": "root.ChatBotTestCase.random_string",
"header": "['class', 'ChatBotTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def remove_test_data(self):\n import shutil\n\n if os.path.exists(self.test_data_directory):\n shutil.rmtree(self.test_data_directory)",
"metadata": "root.ChatBotTestCase.remove_test_data",
"header": "['class', 'ChatBotTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 32
},
{
"content": " def tearDown(self):\n \"\"\"\n Remove the test database.\n \"\"\"\n self.chatbot.storage.drop()\n self.remove_test_data()",
"metadata": "root.ChatBotTestCase.tearDown",
"header": "['class', 'ChatBotTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 38
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"unittest_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"chat",
"ter",
"bot_",
"import_",
"Cha",
"t",
"Bot_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\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_",
"Cha",
"t",
"Bot",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Bot",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
"=_",
"'",
"test\\u",
"data",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"test\\u",
"databa",
"se",
"\\u",
"name_",
"=_",
"self_",
"._",
"random",
"\\u",
"string_",
"(_",
")_",
"+_",
"\".",
"db",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"makedirs_",
"(_",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"databa",
"se",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"test\\u",
"databa",
"se",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"chat",
"bot_",
"=_",
"Cha",
"t",
"Bot_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Test",
" ",
"Bot",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"io",
"\\u",
"adapter_",
"=_",
"\"",
"chat",
"ter",
"bot",
".",
"adapter",
"s",
".",
"io",
".",
"No",
"Output",
"Adapt",
"er",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"database_",
"=_",
"databa",
"se",
"\\u",
"path_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Bot",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"random",
"\\u",
"string_",
"(_",
"self_",
",_",
"start_",
"=_",
"0_",
",_",
"end_",
"=_",
"9000",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Generate",
" ",
"a",
" ",
"string",
" ",
"based",
" ",
"on",
" ",
"a",
" ",
"random",
" ",
"number",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"random_",
"import_",
"randint_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"str_",
"(_",
"randint_",
"(_",
"start_",
",_",
"end_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Bot",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"remove",
"\\u",
"test\\u",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"shutil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"rmtree_",
"(_",
"self_",
"._",
"test\\u",
"data\\u",
"directory_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Bot",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tear",
"Down_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Remove",
" ",
"the",
" ",
"test",
" ",
"databa",
"se",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"chat",
"bot_",
"._",
"storage_",
"._",
"drop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"remove",
"\\u",
"test\\u",
"data_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
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
] |
Except block handles 'BaseException' | openstack/python-blazarclient/climateclient/openstack/common/test.py | [
{
"content": " def _set_timeout(self):\n test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)\n try:\n test_timeout = int(test_timeout)\n except ValueError:\n # If timeout value is invalid do not set a timeout.\n test_timeout = 0\n if test_timeout > 0:\n self.useFixture(fixtures.Timeout(test_timeout, gentle=True))",
"metadata": "root.BaseTestCase._set_timeout",
"header": "['class', 'BaseTestCase', '(', 'testtools', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 39
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Base",
"Test",
"Case_",
"(_",
"testtools_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"set\\u",
"timeout_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"timeout_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"OS",
"\\u",
"TEST",
"\\u",
"TIME",
"OUT",
"'_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"timeout_",
"=_",
"int_",
"(_",
"test\\u",
"timeout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"timeo",
"ut",
" ",
"value",
" ",
"is",
" ",
"invalid",
" ",
"do",
" ",
"not",
" ",
"set",
" ",
"a",
" ",
"timeo",
"ut",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"timeout_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"test\\u",
"timeout_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"use",
"Fixture_",
"(_",
"fixtures_",
"._",
"Timeout_",
"(_",
"test\\u",
"timeout_",
",_",
"gent",
"le_",
"=_",
"True_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | facebook/augmented-traffic-control/atc/atcd/atcd/scripts/runner.py | [
{
"content": "#\n# Copyright (c) 2014, Facebook, Inc.\n# All rights reserved.\n#\n# This source code is licensed under the BSD-style license found in the\n# LICENSE file in the root directory of this source tree. An additional grant\n# of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n'''\nATC Daemon main file\n'''\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport sys\n\n# AtcdHandler main class\nfrom atcd.AtcdDeviceTimeoutTask import AtcdDeviceTimeoutTask\nfrom atcd.AtcdThriftHandlerTask import AtcdNBServerTask\nfrom atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask\nfrom atcd.AtcdVService import AtcdVService\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def initialize_thrift():\n AtcdNBServerTask.register()\n AtcdThriftHandlerTask.factory().register()\n AtcdDeviceTimeoutTask.register()\n\n AtcdVService.initFromCLI()",
"metadata": "root.initialize_thrift",
"header": "['module', '___EOS___']",
"index": 24
},
{
"content": "def run():\n initialize_thrift()\n sys.exit(0)",
"metadata": "root.run",
"header": "['module', '___EOS___']",
"index": 32
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2014",
",",
" ",
"Face",
"book",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Thi",
"s",
" ",
"source",
" ",
"code",
" ",
"is",
" ",
"license",
"d",
" ",
"under",
" ",
"the",
" ",
"BS",
"D",
"-",
"style",
" ",
"license",
" ",
"found",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"LICENSE",
" ",
"file",
" ",
"in",
" ",
"the",
" ",
"root",
" ",
"director",
"y",
" ",
"of",
" ",
"this",
" ",
"source",
" ",
"tree",
".",
" ",
"An",
" ",
"addition",
"al",
" ",
"grant_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"of",
" ",
"pate",
"nt",
" ",
"rights",
" ",
"can",
" ",
"be",
" ",
"found",
" ",
"in",
" ",
"the",
" ",
"PAT",
"ENT",
"S",
" ",
"file",
" ",
"in",
" ",
"the",
" ",
"same",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"ATC",
" ",
"Da",
"emo",
"n",
" ",
"main",
" ",
"file",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"At",
"cd",
"Handle",
"r",
" ",
"main",
" ",
"class_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"atc",
"d_",
"._",
"At",
"cd",
"Dev",
"ice",
"Time",
"out",
"Task_",
"import_",
"At",
"cd",
"Dev",
"ice",
"Time",
"out",
"Task_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atc",
"d_",
"._",
"At",
"cd",
"Thri",
"ft",
"Handle",
"r",
"Task_",
"import_",
"At",
"cd",
"NB",
"Server",
"Task_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atc",
"d_",
"._",
"At",
"cd",
"Thri",
"ft",
"Handle",
"r",
"Task_",
"import_",
"At",
"cd",
"Thri",
"ft",
"Handle",
"r",
"Task_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"atc",
"d_",
"._",
"At",
"cd",
"VS",
"ervice",
"_",
"import_",
"At",
"cd",
"VS",
"ervice",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"initialize",
"\\u",
"thrift",
"_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"At",
"cd",
"NB",
"Server",
"Task_",
"._",
"register_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"At",
"cd",
"Thri",
"ft",
"Handle",
"r",
"Task_",
"._",
"factory_",
"(_",
")_",
"._",
"register_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"At",
"cd",
"Dev",
"ice",
"Time",
"out",
"Task_",
"._",
"register_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"At",
"cd",
"VS",
"ervice",
"_",
"._",
"init",
"Fro",
"m",
"CLI_",
"(_",
")_",
"\\u\\u\\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_",
"run_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"initialize",
"\\u",
"thrift",
"_",
"(_",
")_",
"\\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,
4,
2,
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' | danirus/django-comments-xtd/django_comments_xtd/demos/multiple/settings.py | [
{
"content": "#-*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport os\n\nPRJ_PATH = os.path.abspath(os.path.curdir)\n\nDEBUG = True\n\nADMINS = (\n ('Alice Bloggs', 'alice@example.com'),\n)\n\nMANAGERS = ADMINS\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3', \n 'NAME': 'django_comments_xtd_demo.db',\n 'USER': '', \n 'PASSWORD': '', \n 'HOST': '', \n 'PORT': '',\n }\n}\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# If running in a Windows environment this must be set to the same as your\n# system time zone.\nTIME_ZONE = 'Europe/Brussels'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\nSITE_ID = 1\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# Absolute path to the directory that holds media.\n# Example: \"/home/media/media.lawrence.com/\"\nMEDIA_ROOT = os.path.join(PRJ_PATH, \"media\")\n\n# URL that handles the media served from MEDIA_ROOT. Make sure to use a\n# trailing slash if there is a path component (optional in other cases).\n# Examples: \"http://media.lawrence.com\", \"http://example.com/media/\"\nMEDIA_URL = '/media/'\n\n# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a\n# trailing slash.\n# Examples: \"http://foo.com/media/\", \"/media/\".\n# ADMIN_MEDIA_PREFIX = '/media/'\n\nSTATIC_URL = '/static/'\n\n# Additional locations of static files\nSTATICFILES_DIRS = (\n # Put strings here, like \"/home/html/static\" or \"C:/www/django/static\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)\n\n# List of finder classes that know how to find static files in\n# various locations.\nSTATICFILES_FINDERS = (\n 'django.contrib.staticfiles.finders.FileSystemFinder',\n 'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n# 'django.contrib.staticfiles.finders.DefaultStorageFinder',\n)\n\nSECRET_KEY = 'v2824l&2-n+4zznbsk9c-ap5i)b3e8b+%*a=dxqlahm^%)68jn'\n\nTEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n\t'DIRS': [\n\t os.path.join(os.path.dirname(__file__), \"templates\"),\n\t],\n 'APP_DIRS': True,\n\t'OPTIONS': {\n\t 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',\n\t\t'django.contrib.auth.context_processors.auth',\n 'django.contrib.messages.context_processors.messages',\n\t ],\n\t},\n },\n]\n\nMIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n)\n\nROOT_URLCONF = 'urls'\n\ntry:\n import imp\n imp.find_module('django_comments')\n django_comments = 'django_comments'\nexcept ImportError:\n django_comments = 'django.contrib.comments'\n\nINSTALLED_APPS = (\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n django_comments,\n\n 'multiple.blog',\n 'multiple.projects',\n 'django_comments_xtd',\n 'django_markup',\n)\n\nfrom django import VERSION\nif VERSION[1] < 7:\n INSTALLED_APPS = INSTALLED_APPS + ('south',)\n\n# EMAIL_HOST = \"smtp.gmail.com\" \n# EMAIL_PORT = \"587\"\n# EMAIL_HOST_USER = \"username@gmail.com\"\n# EMAIL_HOST_PASSWORD = \"\"\n# EMAIL_USE_TLS = True # Yes for Gmail\n# DEFAULT_FROM_EMAIL = \"Alice Bloggs <alice@example.com>\"\n# SERVER_EMAIL = DEFAULT_FROM_EMAIL\n\n# Fill in actual EMAIL settings above, and comment out the \n# following line to let this django demo sending emails\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n\nCOMMENTS_APP = \"django_comments_xtd\"\nCOMMENTS_XTD_CONFIRM_EMAIL = False\nCOMMENTS_XTD_SALT = b\"es-war-einmal-una-bella-princesa-in-a-beautiful-castle\"\nCOMMENTS_XTD_MAX_THREAD_LEVEL = 3\nCOMMENTS_XTD_MAX_THREAD_LEVEL_BY_APP_MODEL = {'projects.release': 1}\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#-",
"*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"PR",
"J",
"\\u",
"PATH_",
"=_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"path_",
"._",
"curdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"DEBUG_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ADMINS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Ali",
"ce",
" ",
"Blog",
"gs",
"'_",
",_",
"'",
"alic",
"e",
"@",
"example",
".",
"com",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MANAGER",
"S_",
"=_",
"ADMINS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"DATABASES_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"default",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ENGINE",
"'_",
":_",
"'",
"django",
".",
"db",
".",
"back",
"ends",
".",
"sql",
"ite",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"NAME",
"'_",
":_",
"'",
"django",
"\\u",
"comment",
"s",
"\\u",
"xt",
"d\\u",
"demo",
".",
"db",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"USER",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"PASS",
"WORD",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"HOST",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"PORT",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Local",
" ",
"time",
" ",
"zone",
" ",
"for",
" ",
"this",
" ",
"installation",
".",
" ",
"Choi",
"ces",
" ",
"can",
" ",
"be",
" ",
"found",
" ",
"here",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"en",
".",
"wikip",
"edia",
".",
"org",
"/",
"wiki",
"/",
"List",
"\\u",
"of",
"\\u",
"tz",
"\\u",
"zone",
"s",
"\\u",
"by",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"alth",
"ou",
"gh",
" ",
"not",
" ",
"all",
" ",
"choice",
"s",
" ",
"may",
" ",
"be",
" ",
"avail",
"able",
" ",
"on",
" ",
"all",
" ",
"operati",
"ng",
" ",
"system",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"runn",
"ing",
" ",
"in",
" ",
"a",
" ",
"Window",
"s",
" ",
"environ",
"ment",
" ",
"this",
" ",
"must",
" ",
"be",
" ",
"set",
" ",
"to",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"your",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"system",
" ",
"time",
" ",
"zone",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"TIME",
"\\u",
"ZONE_",
"=_",
"'",
"Euro",
"pe",
"/",
"Brus",
"sel",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Lang",
"ua",
"ge",
" ",
"code",
" ",
"for",
" ",
"this",
" ",
"installation",
".",
" ",
"All",
" ",
"choice",
"s",
" ",
"can",
" ",
"be",
" ",
"found",
" ",
"here",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"i18n",
"guy",
".",
"com",
"/",
"unicode",
"/",
"language",
"-",
"identifi",
"ers",
".",
"html_",
"\\u\\u\\uNL\\u\\u\\u_",
"LANGUAGE",
"\\u",
"CODE_",
"=_",
"'",
"en",
"-",
"us",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SITE",
"\\u",
"ID_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"you",
" ",
"set",
" ",
"this",
" ",
"to",
" ",
"Fal",
"se",
",",
" ",
"Dj",
"ang",
"o",
" ",
"will",
" ",
"make",
" ",
"some",
" ",
"optimization",
"s",
" ",
"so",
" ",
"as",
" ",
"not_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"load",
" ",
"the",
" ",
"international",
"izatio",
"n",
" ",
"machine",
"ry",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"USE",
"\\u",
"I1",
"8",
"N_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Abs",
"olute",
" ",
"path",
" ",
"to",
" ",
"the",
" ",
"director",
"y",
" ",
"tha",
"t",
" ",
"hold",
"s",
" ",
"media",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Exam",
"ple",
":",
" ",
"\"/",
"home",
"/",
"media",
"/",
"media",
".",
"law",
"ren",
"ce",
".",
"com",
"/\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"MEDIA",
"\\u",
"ROOT_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"PR",
"J",
"\\u",
"PATH_",
",_",
"\"",
"media",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"URL",
" ",
"tha",
"t",
" ",
"handle",
"s",
" ",
"the",
" ",
"media",
" ",
"serve",
"d",
" ",
"from",
" ",
"MEDIA",
"\\u",
"ROO",
"T",
".",
" ",
"Make",
" ",
"sure",
" ",
"to",
" ",
"use",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"trail",
"ing",
" ",
"slash",
" ",
"if",
" ",
"there",
" ",
"is",
" ",
"a",
" ",
"path",
" ",
"component",
" ",
"(",
"option",
"al",
" ",
"in",
" ",
"other",
" ",
"case",
"s",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Exam",
"ples",
":",
" ",
"\"",
"http",
"://",
"media",
".",
"law",
"ren",
"ce",
".",
"com",
"\",",
" ",
"\"",
"http",
"://",
"example",
".",
"com",
"/",
"media",
"/\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"MEDIA",
"\\u",
"URL_",
"=_",
"'/",
"media",
"/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"URL",
" ",
"prefix",
" ",
"for",
" ",
"admin",
" ",
"media",
" ",
"--",
" ",
"CS",
"S",
",",
" ",
"Ja",
"va",
"Script",
" ",
"and",
" ",
"images",
".",
" ",
"Make",
" ",
"sure",
" ",
"to",
" ",
"use",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"trail",
"ing",
" ",
"slash",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Exam",
"ples",
":",
" ",
"\"",
"http",
"://",
"foo",
".",
"com",
"/",
"media",
"/\"",
",",
" ",
"\"/",
"media",
"/\"",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ADM",
"IN",
"\\u",
"MEDIA",
"\\u",
"PREF",
"IX",
" ",
"=",
" ",
"'/",
"media",
"/'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"STATI",
"C",
"\\u",
"URL_",
"=_",
"'/",
"static",
"/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"location",
"s",
" ",
"of",
" ",
"static",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"STATI",
"CF",
"ILE",
"S",
"\\u",
"DIRS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Put",
" ",
"string",
"s",
" ",
"here",
",",
" ",
"like",
" ",
"\"/",
"home",
"/",
"html",
"/",
"static",
"\"",
" ",
"or",
" ",
"\"",
"C",
":/",
"www",
"/",
"django",
"/",
"static",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Al",
"way",
"s",
" ",
"use",
" ",
"forward",
" ",
"slash",
"es",
",",
" ",
"even",
" ",
"on",
" ",
"Window",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"forget",
" ",
"to",
" ",
"use",
" ",
"abs",
"olute",
" ",
"path",
"s",
",",
" ",
"not",
" ",
"relative",
" ",
"path",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"List",
" ",
"of",
" ",
"finde",
"r",
" ",
"classe",
"s",
" ",
"tha",
"t",
" ",
"know",
" ",
"how",
" ",
"to",
" ",
"find",
" ",
"static",
" ",
"files",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"vari",
"ous",
" ",
"location",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"STATI",
"CF",
"ILE",
"S",
"\\u",
"FIND",
"ERS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"static",
"files",
".",
"finde",
"rs",
".",
"File",
"System",
"Fin",
"der",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"static",
"files",
".",
"finde",
"rs",
".",
"App",
"Director",
"ies",
"Fin",
"der",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"'",
"django",
".",
"contrib",
".",
"static",
"files",
".",
"finde",
"rs",
".",
"Default",
"Stor",
"age",
"Fin",
"der",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SEC",
"RET",
"\\u",
"KEY_",
"=_",
"'",
"v2",
"824",
"l",
"&",
"2",
"-",
"n",
"+",
"4",
"zz",
"nb",
"sk",
"9c",
"-",
"ap",
"5",
"i",
")",
"b3",
"e8",
"b",
"+",
"%",
"*",
"a",
"=",
"dx",
"ql",
"ah",
"m",
"^",
"%)",
"6",
"8",
"jn",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEMPLATES_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"BACK",
"END",
"'_",
":_",
"'",
"django",
".",
"template",
".",
"back",
"ends",
".",
"django",
".",
"Dj",
"ang",
"o",
"Templa",
"tes",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"DIR",
"S",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"\"",
"template",
"s",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"APP",
"\\u",
"DIR",
"S",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"OPTION",
"S",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"context",
"\\u",
"process",
"ors",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"template",
".",
"context",
"\\u",
"process",
"ors",
".",
"debug",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"template",
".",
"context",
"\\u",
"process",
"ors",
".",
"request",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"auth",
".",
"context",
"\\u",
"process",
"ors",
".",
"auth",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"message",
"s",
".",
"context",
"\\u",
"process",
"ors",
".",
"message",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MIDDLE",
"WARE",
"\\u",
"CLASSES_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"middle",
"ware",
".",
"common",
".",
"Common",
"Mid",
"dle",
"ware",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"session",
"s",
".",
"middle",
"ware",
".",
"Sess",
"ion",
"Mid",
"dle",
"ware",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"middle",
"ware",
".",
"csr",
"f",
".",
"Cs",
"rf",
"View",
"Mid",
"dle",
"ware",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"auth",
".",
"middle",
"ware",
".",
"Auth",
"entica",
"tion",
"Mid",
"dle",
"ware",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"message",
"s",
".",
"middle",
"ware",
".",
"Messag",
"e",
"Mid",
"dle",
"ware",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ROO",
"T",
"\\u",
"URLCONF_",
"=_",
"'",
"urls",
"'_",
"\\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_",
"imp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"imp_",
"._",
"find",
"\\u",
"module_",
"(_",
"'",
"django",
"\\u",
"comment",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"django",
"\\u",
"comments_",
"=_",
"'",
"django",
"\\u",
"comment",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"django",
"\\u",
"comments_",
"=_",
"'",
"django",
".",
"contrib",
".",
"comment",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"INSTALLE",
"D",
"\\u",
"APPS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"admin",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"auth",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"contenttype",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"session",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"contrib",
".",
"sites",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"django",
"\\u",
"comments_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"multiple",
".",
"blog",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"multiple",
".",
"project",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
"\\u",
"comment",
"s",
"\\u",
"xt",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
"\\u",
"markup",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"import_",
"VERSION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"VERSION_",
"[_",
"1_",
"]_",
"<_",
"7_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"INSTALLE",
"D",
"\\u",
"APPS_",
"=_",
"INSTALLE",
"D",
"\\u",
"APPS_",
"+_",
"(_",
"'",
"south",
"'_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EMA",
"IL",
"\\u",
"HOST",
" ",
" ",
"=",
" ",
"\"",
"smt",
"p",
".",
"gma",
"il",
".",
"com",
"\"",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EMA",
"IL",
"\\u",
"PORT",
" ",
" ",
"=",
" ",
"\"",
"587",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EMA",
"IL",
"\\u",
"HOST",
"\\u",
"USER",
" ",
"=",
" ",
"\"",
"user",
"name",
"@",
"gma",
"il",
".",
"com",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EMA",
"IL",
"\\u",
"HOST",
"\\u",
"PASS",
"WORD",
" ",
"=",
" ",
"\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EMA",
"IL",
"\\u",
"USE",
"\\u",
"TLS",
" ",
" ",
" ",
"=",
" ",
"Tru",
"e",
" ",
"#",
" ",
"Ye",
"s",
" ",
"for",
" ",
"Gm",
"ail",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"DEF",
"AUL",
"T",
"\\u",
"FROM",
"\\u",
"EMA",
"IL",
" ",
" ",
"=",
" ",
"\"",
"Ali",
"ce",
" ",
"Blog",
"gs",
" ",
"<",
"alic",
"e",
"@",
"example",
".",
"com",
">\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SERVER",
"\\u",
"EMA",
"IL",
" ",
" ",
" ",
" ",
"=",
" ",
"DEF",
"AUL",
"T",
"\\u",
"FROM",
"\\u",
"EMAIL_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fil",
"l",
" ",
"in",
" ",
"actual",
" ",
"EMA",
"IL",
" ",
"settings",
" ",
"above",
",",
" ",
"and",
" ",
"comment",
" ",
"out",
" ",
"the",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"follow",
"ing",
" ",
"line",
" ",
"to",
" ",
"let",
" ",
"this",
" ",
"django",
" ",
"demo",
" ",
"sendin",
"g",
" ",
"emails_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"EMA",
"IL",
"\\u",
"BACKEND_",
"=_",
"'",
"django",
".",
"core",
".",
"mail",
".",
"back",
"ends",
".",
"console",
".",
"Ema",
"il",
"Back",
"end",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMMENT",
"S",
"\\u",
"APP_",
"=_",
"\"",
"django",
"\\u",
"comment",
"s",
"\\u",
"xt",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"COMMENT",
"S",
"\\u",
"XT",
"D",
"\\u",
"CONFIRM",
"\\u",
"EMAIL_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"COMMENT",
"S",
"\\u",
"XT",
"D",
"\\u",
"SAL",
"T_",
"=_",
"b",
"\"",
"es",
"-",
"war",
"-",
"ein",
"mal",
"-",
"una",
"-",
"bell",
"a",
"-",
"princ",
"esa",
"-",
"in",
"-",
"a",
"-",
"beautif",
"ul",
"-",
"cast",
"le",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"COMMENT",
"S",
"\\u",
"XT",
"D",
"\\u",
"MAX",
"\\u",
"THREAD",
"\\u",
"LEVEL_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"COMMENT",
"S",
"\\u",
"XT",
"D",
"\\u",
"MAX",
"\\u",
"THREAD",
"\\u",
"LE",
"VEL",
"\\u",
"BY",
"\\u",
"APP",
"\\u",
"MODEL_",
"=_",
"{_",
"'",
"project",
"s",
".",
"release",
"'_",
":_",
"1_",
"}_"
] | [
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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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
] |
Constant in conditional expression or statement | darcyliu/storyboard/boto/regioninfo.py | [
{
"content": " def endElement(self, name, value, connection):\n if name == 'regionName':\n self.name = value\n elif name == 'regionEndpoint':\n self.endpoint = value\n else:\n setattr(self, name, value)",
"metadata": "root.RegionInfo.endElement",
"header": "['class', 'RegionInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 41
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Constant_",
"in_",
"conditional",
"_",
"expression_",
"or_",
"statement_",
"[SEP]_",
"class_",
"Region",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"end",
"Element_",
"(_",
"self_",
",_",
"name_",
",_",
"value_",
",_",
"connection_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"name_",
"==_",
"'",
"region",
"Name",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"name_",
"==_",
"'",
"region",
"End",
"point",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"endpoint_",
"=_",
"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_",
"(_",
"self_",
",_",
"name_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_used_limits.py | [
{
"content": " def _do_test_used_limits(self, reserved):\n fake_req = FakeRequest(self.fake_context, reserved=reserved)\n obj = {\n \"limits\": {\n \"rate\": [],\n \"absolute\": {},\n },\n }\n res = wsgi.ResponseObject(obj)\n quota_map = {\n 'totalRAMUsed': 'ram',\n 'totalCoresUsed': 'cores',\n 'totalInstancesUsed': 'instances',\n 'totalFloatingIpsUsed': 'floating_ips',\n 'totalSecurityGroupsUsed': 'security_groups',\n 'totalServerGroupsUsed': 'server_groups',\n }\n limits = {}\n expected_abs_limits = []\n for display_name, q in six.iteritems(quota_map):\n limits[q] = {'limit': len(display_name),\n 'in_use': len(display_name) / 2,\n 'reserved': len(display_name) / 3}\n if (self.include_server_group_quotas or\n display_name != 'totalServerGroupsUsed'):\n expected_abs_limits.append(display_name)\n\n def stub_get_project_quotas(context, project_id, usages=True):\n return limits\n\n self.stubs.Set(quota.QUOTAS, \"get_project_quotas\",\n stub_get_project_quotas)\n if self.ext_mgr is not None:\n self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(False)\n self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(\n self.include_server_group_quotas)\n self.mox.ReplayAll()\n\n self.controller.index(fake_req, res)\n abs_limits = res.obj['limits']['absolute']\n for limit in expected_abs_limits:\n value = abs_limits[limit]\n r = limits[quota_map[limit]]['reserved'] if reserved else 0\n self.assertEqual(limits[quota_map[limit]]['in_use'] + r, value)",
"metadata": "root.UsedLimitsTestCaseV21._do_test_used_limits",
"header": "['class', 'UsedLimitsTestCaseV21', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 52
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Us",
"ed",
"Limit",
"s",
"Test",
"Case",
"V2",
"1_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"do",
"\\u",
"test\\u",
"used",
"\\u",
"limits_",
"(_",
"self_",
",_",
"reserved_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fake",
"\\u",
"req_",
"=_",
"Fake",
"Request_",
"(_",
"self_",
"._",
"fake",
"\\u",
"context_",
",_",
"reserved_",
"=_",
"reserved_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"limit",
"s",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rate",
"\"_",
":_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"abs",
"olute",
"\"_",
":_",
"{_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"=_",
"wsgi_",
"._",
"Respons",
"e",
"Object_",
"(_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quot",
"a",
"\\u",
"map_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"RAM",
"Us",
"ed",
"'_",
":_",
"'",
"ram",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"Core",
"s",
"Us",
"ed",
"'_",
":_",
"'",
"cores",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"Insta",
"nce",
"s",
"Us",
"ed",
"'_",
":_",
"'",
"instance",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"Float",
"ing",
"Ips",
"Us",
"ed",
"'_",
":_",
"'",
"float",
"ing",
"\\u",
"ips",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"Secur",
"it",
"y",
"Group",
"s",
"Us",
"ed",
"'_",
":_",
"'",
"security",
"\\u",
"group",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"total",
"Server",
"Group",
"s",
"Us",
"ed",
"'_",
":_",
"'",
"server",
"\\u",
"group",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"limits_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"abs",
"\\u",
"limits_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"display",
"\\u",
"name_",
",_",
"q_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"quot",
"a",
"\\u",
"map_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"limits_",
"[_",
"q_",
"]_",
"=_",
"{_",
"'",
"limit",
"'_",
":_",
"len_",
"(_",
"display",
"\\u",
"name_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"in",
"\\u",
"use",
"'_",
":_",
"len_",
"(_",
"display",
"\\u",
"name_",
")_",
"/_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"reserve",
"d",
"'_",
":_",
"len_",
"(_",
"display",
"\\u",
"name_",
")_",
"/_",
"3_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"self_",
"._",
"include",
"\\u",
"server",
"\\u",
"group",
"\\u",
"quotas_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"display",
"\\u",
"name_",
"!=_",
"'",
"total",
"Server",
"Group",
"s",
"Us",
"ed",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected",
"\\u",
"abs",
"\\u",
"limits_",
"._",
"append_",
"(_",
"display",
"\\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_",
"def_",
"stub",
"\\u",
"get",
"\\u",
"project",
"\\u",
"quotas_",
"(_",
"context_",
",_",
"project",
"\\u",
"id_",
",_",
"usages_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"limits_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"stubs_",
"._",
"Set_",
"(_",
"quota_",
"._",
"QUOTA",
"S_",
",_",
"\"",
"get",
"\\u",
"project",
"\\u",
"quotas",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"stub",
"\\u",
"get",
"\\u",
"project",
"\\u",
"quotas_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"ext",
"\\u",
"mgr_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ext",
"\\u",
"mgr_",
"._",
"is",
"\\u",
"loaded_",
"(_",
"'",
"os",
"-",
"used",
"-",
"limit",
"s",
"-",
"for",
"-",
"admin",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ext",
"\\u",
"mgr_",
"._",
"is",
"\\u",
"loaded_",
"(_",
"'",
"os",
"-",
"server",
"-",
"group",
"-",
"quotas",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"include",
"\\u",
"server",
"\\u",
"group",
"\\u",
"quotas_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"mox_",
"._",
"Repl",
"ay",
"All_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"controller_",
"._",
"index_",
"(_",
"fake",
"\\u",
"req_",
",_",
"res_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"abs",
"\\u",
"limits_",
"=_",
"res_",
"._",
"obj_",
"[_",
"'",
"limit",
"s",
"'_",
"]_",
"[_",
"'",
"abs",
"olute",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"limit_",
"in_",
"expected",
"\\u",
"abs",
"\\u",
"limits_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"abs",
"\\u",
"limits_",
"[_",
"limit_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"limits_",
"[_",
"quot",
"a",
"\\u",
"map_",
"[_",
"limit_",
"]_",
"]_",
"[_",
"'",
"reserve",
"d",
"'_",
"]_",
"if_",
"reserved_",
"else_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"limits_",
"[_",
"quot",
"a",
"\\u",
"map_",
"[_",
"limit_",
"]_",
"]_",
"[_",
"'",
"in",
"\\u",
"use",
"'_",
"]_",
"+_",
"r_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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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
] |
Unused import | apache/libcloud/libcloud/dns/drivers/linode.py | [
{
"content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n__all__ = [\n 'LinodeDNSDriver'\n]\n\nfrom libcloud.utils.misc import merge_valid_keys, get_new_obj\nfrom libcloud.common.linode import (API_ROOT, LinodeException,\n LinodeConnection, LinodeResponse)\nfrom libcloud.dns.types import Provider, RecordType\nfrom libcloud.dns.types import ZoneDoesNotExistError, RecordDoesNotExistError\nfrom libcloud.dns.base import DNSDriver, Zone, Record\n\n\nVALID_ZONE_EXTRA_PARAMS = ['SOA_Email', 'Refresh_sec', 'Retry_sec',\n 'Expire_sec', 'status', 'master_ips']\n\nVALID_RECORD_EXTRA_PARAMS = ['Priority', 'Weight', 'Port', 'Protocol',\n 'TTL_sec']\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class LinodeDNSResponse(LinodeResponse):",
"metadata": "root.LinodeDNSResponse",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": " def _make_excp(self, error):\n result = super(LinodeDNSResponse, self)._make_excp(error)\n if isinstance(result, LinodeException) and result.code == 5:\n context = self.connection.context\n\n if context['resource'] == 'zone':\n result = ZoneDoesNotExistError(value='',\n driver=self.connection.driver,\n zone_id=context['id'])\n\n elif context['resource'] == 'record':\n result = RecordDoesNotExistError(value='',\n driver=self.connection.driver,\n record_id=context['id'])\n return result",
"metadata": "root.LinodeDNSResponse._make_excp",
"header": "['class', 'LinodeDNSResponse', '(', 'LinodeResponse', ')', ':', '___EOS___']",
"index": 35
},
{
"content": "class LinodeDNSConnection(LinodeConnection):\n responseCls = LinodeDNSResponse",
"metadata": "root.LinodeDNSConnection",
"header": "['module', '___EOS___']",
"index": 52
},
{
"content": "class LinodeDNSDriver(DNSDriver):\n type = Provider.LINODE\n name = 'Linode DNS'\n website = 'http://www.linode.com/'\n connectionCls = LinodeDNSConnection\n\n RECORD_TYPE_MAP = {\n RecordType.NS: 'NS',\n RecordType.MX: 'MX',\n RecordType.A: 'A',\n RecordType.AAAA: 'AAAA',\n RecordType.CNAME: 'CNAME',\n RecordType.TXT: 'TXT',\n RecordType.SRV: 'SRV',\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.LinodeDNSDriver",
"header": "['module', '___EOS___']",
"index": 56
},
{
"content": " def list_zones(self):\n params = {'api_action': 'domain.list'}\n data = self.connection.request(API_ROOT, params=params).objects[0]\n zones = self._to_zones(data)\n return zones",
"metadata": "root.LinodeDNSDriver.list_zones",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 72
},
{
"content": " def list_records(self, zone):\n params = {'api_action': 'domain.resource.list', 'DOMAINID': zone.id}\n\n self.connection.set_context(context={'resource': 'zone',\n 'id': zone.id})\n data = self.connection.request(API_ROOT, params=params).objects[0]\n records = self._to_records(items=data, zone=zone)\n return records",
"metadata": "root.LinodeDNSDriver.list_records",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 78
},
{
"content": " def get_zone(self, zone_id):\n params = {'api_action': 'domain.list', 'DomainID': zone_id}\n self.connection.set_context(context={'resource': 'zone',\n 'id': zone_id})\n data = self.connection.request(API_ROOT, params=params).objects[0]\n zones = self._to_zones(data)\n\n if len(zones) != 1:\n raise ZoneDoesNotExistError(value='', driver=self, zone_id=zone_id)\n\n return zones[0]",
"metadata": "root.LinodeDNSDriver.get_zone",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 87
},
{
"content": " def get_record(self, zone_id, record_id):\n zone = self.get_zone(zone_id=zone_id)\n params = {'api_action': 'domain.resource.list', 'DomainID': zone_id,\n 'ResourceID': record_id}\n self.connection.set_context(context={'resource': 'record',\n 'id': record_id})\n data = self.connection.request(API_ROOT, params=params).objects[0]\n records = self._to_records(items=data, zone=zone)\n\n if len(records) != 1:\n raise RecordDoesNotExistError(value='', driver=self,\n record_id=record_id)\n\n return records[0]",
"metadata": "root.LinodeDNSDriver.get_record",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 99
},
{
"content": " def create_zone(self, domain, type='master', ttl=None, extra=None):\n \"\"\"\n Create a new zone.\n\n API docs: http://www.linode.com/api/dns/domain.create\n \"\"\"\n params = {'api_action': 'domain.create', 'Type': type,\n 'Domain': domain}\n\n if ttl:\n params['TTL_sec'] = ttl\n\n merged = merge_valid_keys(params=params,\n valid_keys=VALID_ZONE_EXTRA_PARAMS,\n extra=extra)\n data = self.connection.request(API_ROOT, params=params).objects[0]\n zone = Zone(id=data['DomainID'], domain=domain, type=type, ttl=ttl,\n extra=merged, driver=self)\n return zone",
"metadata": "root.LinodeDNSDriver.create_zone",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 114
},
{
"content": " def update_zone(self, zone, domain=None, type=None, ttl=None, extra=None):\n \"\"\"\n Update an existing zone.\n\n API docs: http://www.linode.com/api/dns/domain.update\n \"\"\"\n params = {'api_action': 'domain.update', 'DomainID': zone.id}\n\n if type:\n params['Type'] = type\n\n if domain:\n params['Domain'] = domain\n\n if ttl:\n params['TTL_sec'] = ttl\n\n merged = merge_valid_keys(params=params,\n valid_keys=VALID_ZONE_EXTRA_PARAMS,\n extra=extra)\n self.connection.request(API_ROOT, params=params).objects[0]\n updated_zone = get_new_obj(obj=zone, klass=Zone,\n attributes={'domain': domain,\n 'type': type, 'ttl': ttl,\n 'extra': merged})\n return updated_zone",
"metadata": "root.LinodeDNSDriver.update_zone",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 134
},
{
"content": " def create_record(self, name, zone, type, data, extra=None):\n \"\"\"\n Create a new record.\n\n API docs: http://www.linode.com/api/dns/domain.resource.create\n \"\"\"\n params = {'api_action': 'domain.resource.create', 'DomainID': zone.id,\n 'Name': name, 'Target': data,\n 'Type': self.RECORD_TYPE_MAP[type]}\n merged = merge_valid_keys(params=params,\n valid_keys=VALID_RECORD_EXTRA_PARAMS,\n extra=extra)\n\n result = self.connection.request(API_ROOT, params=params).objects[0]\n record = Record(id=result['ResourceID'], name=name, type=type,\n data=data, extra=merged, zone=zone, driver=self,\n ttl=merged.get('TTL_sec', None))\n return record",
"metadata": "root.LinodeDNSDriver.create_record",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 161
},
{
"content": " def update_record(self, record, name=None, type=None, data=None,\n extra=None):\n \"\"\"\n Update an existing record.\n\n API docs: http://www.linode.com/api/dns/domain.resource.update\n \"\"\"\n params = {'api_action': 'domain.resource.update',\n 'ResourceID': record.id, 'DomainID': record.zone.id}\n\n if name:\n params['Name'] = name\n\n if data:\n params['Target'] = data\n\n if type is not None:\n params['Type'] = self.RECORD_TYPE_MAP[type]\n\n merged = merge_valid_keys(params=params,\n valid_keys=VALID_RECORD_EXTRA_PARAMS,\n extra=extra)\n\n self.connection.request(API_ROOT, params=params).objects[0]\n updated_record = get_new_obj(obj=record, klass=Record,\n attributes={'name': name, 'data': data,\n 'type': type,\n 'extra': merged})\n return updated_record",
"metadata": "root.LinodeDNSDriver.update_record",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 180
},
{
"content": " def delete_zone(self, zone):\n params = {'api_action': 'domain.delete', 'DomainID': zone.id}\n\n self.connection.set_context(context={'resource': 'zone',\n 'id': zone.id})\n data = self.connection.request(API_ROOT, params=params).objects[0]\n\n return 'DomainID' in data",
"metadata": "root.LinodeDNSDriver.delete_zone",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 210
},
{
"content": " def delete_record(self, record):\n params = {'api_action': 'domain.resource.delete',\n 'DomainID': record.zone.id, 'ResourceID': record.id}\n\n self.connection.set_context(context={'resource': 'record',\n 'id': record.id})\n data = self.connection.request(API_ROOT, params=params).objects[0]\n\n return 'ResourceID' in data",
"metadata": "root.LinodeDNSDriver.delete_record",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 219
},
{
"content": " def _to_zones(self, items):\n \"\"\"\n Convert a list of items to the Zone objects.\n \"\"\"\n zones = []\n\n for item in items:\n zones.append(self._to_zone(item))\n\n return zones",
"metadata": "root.LinodeDNSDriver._to_zones",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 229
},
{
"content": " def _to_zone(self, item):\n \"\"\"\n Build an Zone object from the item dictionary.\n \"\"\"\n extra = {'SOA_Email': item['SOA_EMAIL'], 'status': item['STATUS'],\n 'description': item['DESCRIPTION']}\n zone = Zone(id=item['DOMAINID'], domain=item['DOMAIN'],\n type=item['TYPE'], ttl=item['TTL_SEC'], driver=self,\n extra=extra)\n return zone",
"metadata": "root.LinodeDNSDriver._to_zone",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 240
},
{
"content": " def _to_records(self, items, zone=None):\n \"\"\"\n Convert a list of items to the Record objects.\n \"\"\"\n records = []\n\n for item in items:\n records.append(self._to_record(item=item, zone=zone))\n\n return records",
"metadata": "root.LinodeDNSDriver._to_records",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 251
},
{
"content": " def _to_record(self, item, zone=None):\n \"\"\"\n Build a Record object from the item dictionary.\n \"\"\"\n extra = {'protocol': item['PROTOCOL'], 'ttl_sec': item['TTL_SEC'],\n 'port': item['PORT'], 'weight': item['WEIGHT']}\n type = self._string_to_record_type(item['TYPE'])\n record = Record(id=item['RESOURCEID'], name=item['NAME'], type=type,\n data=item['TARGET'], zone=zone, driver=self,\n ttl=item['TTL_SEC'], extra=extra)\n return record",
"metadata": "root.LinodeDNSDriver._to_record",
"header": "['class', 'LinodeDNSDriver', '(', 'DNSDriver', ')', ':', '___EOS___']",
"index": 262
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"to",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"Sof",
"twa",
"re",
" ",
"Foun",
"dati",
"on",
" ",
"(",
"AS",
"F",
")",
" ",
"under",
" ",
"one",
" ",
"or",
" ",
"more_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contributor",
" ",
"license",
" ",
"agreement",
"s",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"NOTICE",
" ",
"file",
" ",
"distributed",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"work",
" ",
"for",
" ",
"addition",
"al",
" ",
"informati",
"on",
" ",
"regarding",
" ",
"copyr",
"ight",
" ",
"owner",
"ship",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"AS",
"F",
" ",
"license",
"s",
" ",
"this",
" ",
"file",
" ",
"to",
" ",
"You",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"License",
".",
" ",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Lin",
"ode",
"DNS",
"Drive",
"r",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"utils_",
"._",
"misc_",
"import_",
"merge",
"\\u",
"valid",
"\\u",
"keys_",
",_",
"get",
"\\u",
"new",
"\\u",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"common_",
"._",
"lino",
"de_",
"import_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"Lin",
"ode",
"Exception_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lin",
"ode",
"Connection_",
",_",
"Lin",
"ode",
"Response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"dns_",
"._",
"types_",
"import_",
"Provider_",
",_",
"Record",
"Type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"dns_",
"._",
"types_",
"import_",
"Zon",
"e",
"Do",
"es",
"Not",
"Exist",
"Error_",
",_",
"Record",
"Do",
"es",
"Not",
"Exist",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"dns_",
"._",
"base_",
"import_",
"DNS",
"Driver_",
",_",
"Zone_",
",_",
"Record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"VALID",
"\\u",
"ZONE",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
"=_",
"[_",
"'",
"SOA",
"\\u",
"Ema",
"il",
"'_",
",_",
"'",
"Refr",
"esh",
"\\u",
"sec",
"'_",
",_",
"'",
"Retr",
"y",
"\\u",
"sec",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Expire",
"\\u",
"sec",
"'_",
",_",
"'",
"status",
"'_",
",_",
"'",
"master",
"\\u",
"ips",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"VALID",
"\\u",
"RECORD",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
"=_",
"[_",
"'",
"Prior",
"it",
"y",
"'_",
",_",
"'",
"Weig",
"ht",
"'_",
",_",
"'",
"Port",
"'_",
",_",
"'",
"Proto",
"col",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"TTL",
"\\u",
"sec",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Lin",
"ode",
"DNS",
"Response_",
"(_",
"Lin",
"ode",
"Response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Response_",
"(_",
"Lin",
"ode",
"Response_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u",
"make",
"\\u",
"exc",
"p_",
"(_",
"self_",
",_",
"error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"super_",
"(_",
"Lin",
"ode",
"DNS",
"Response_",
",_",
"self_",
")_",
"._",
"\\u",
"make",
"\\u",
"exc",
"p_",
"(_",
"error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"result_",
",_",
"Lin",
"ode",
"Exception_",
")_",
"and_",
"result_",
"._",
"code_",
"==_",
"5_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"self_",
"._",
"connection_",
"._",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"context_",
"[_",
"'",
"resource",
"'_",
"]_",
"==_",
"'",
"zone",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"Zon",
"e",
"Do",
"es",
"Not",
"Exist",
"Error_",
"(_",
"value_",
"=_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"driver_",
"=_",
"self_",
"._",
"connection_",
"._",
"driver_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"zone",
"\\u",
"id_",
"=_",
"context_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"context_",
"[_",
"'",
"resource",
"'_",
"]_",
"==_",
"'",
"record",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"Record",
"Do",
"es",
"Not",
"Exist",
"Error_",
"(_",
"value_",
"=_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"driver_",
"=_",
"self_",
"._",
"connection_",
"._",
"driver_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"\\u",
"id_",
"=_",
"context_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
"\\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_",
"Lin",
"ode",
"DNS",
"Connection_",
"(_",
"Lin",
"ode",
"Connection_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response",
"Cls",
"_",
"=_",
"Lin",
"ode",
"DNS",
"Response_",
"\\u\\u\\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_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type_",
"=_",
"Provider_",
"._",
"LIN",
"ODE",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"'",
"Lin",
"ode",
" ",
"DNS",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"website_",
"=_",
"'",
"http",
"://",
"www",
".",
"lino",
"de",
".",
"com",
"/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"connecti",
"on",
"Cls",
"_",
"=_",
"Lin",
"ode",
"DNS",
"Connection_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RECORD",
"\\u",
"TYPE",
"\\u",
"MAP_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"NS_",
":_",
"'",
"NS",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"MX",
"_",
":_",
"'",
"MX",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"A_",
":_",
"'",
"A",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"AAAA",
"_",
":_",
"'",
"AAAA",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"CNA",
"ME_",
":_",
"'",
"CNA",
"ME",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"TXT",
"_",
":_",
"'",
"TXT",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"Type_",
"._",
"SRV",
"_",
":_",
"'",
"SRV",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"list",
"\\u",
"zones_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"list",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zones_",
"=_",
"self_",
"._",
"\\u",
"to",
"\\u",
"zones_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zones_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"list",
"\\u",
"records_",
"(_",
"self_",
",_",
"zone_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"resource",
".",
"list",
"'_",
",_",
"'",
"DOM",
"AIN",
"ID",
"'_",
":_",
"zone_",
"._",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"set\\u",
"context_",
"(_",
"context_",
"=_",
"{_",
"'",
"resource",
"'_",
":_",
"'",
"zone",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"zone_",
"._",
"id_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"records_",
"=_",
"self_",
"._",
"\\u",
"to",
"\\u",
"records_",
"(_",
"items_",
"=_",
"data_",
",_",
"zone_",
"=_",
"zone_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"records_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"zone_",
"(_",
"self_",
",_",
"zone",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"list",
"'_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"zone",
"\\u",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"set\\u",
"context_",
"(_",
"context_",
"=_",
"{_",
"'",
"resource",
"'_",
":_",
"'",
"zone",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"zone",
"\\u",
"id_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zones_",
"=_",
"self_",
"._",
"\\u",
"to",
"\\u",
"zones_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"zones_",
")_",
"!=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Zon",
"e",
"Do",
"es",
"Not",
"Exist",
"Error_",
"(_",
"value_",
"=_",
"''_",
",_",
"driver_",
"=_",
"self_",
",_",
"zone",
"\\u",
"id_",
"=_",
"zone",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"zones_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"record_",
"(_",
"self_",
",_",
"zone",
"\\u",
"id_",
",_",
"record",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"zone_",
"=_",
"self_",
"._",
"get",
"\\u",
"zone_",
"(_",
"zone",
"\\u",
"id_",
"=_",
"zone",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"resource",
".",
"list",
"'_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"zone",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Reso",
"urc",
"e",
"ID",
"'_",
":_",
"record",
"\\u",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"set\\u",
"context_",
"(_",
"context_",
"=_",
"{_",
"'",
"resource",
"'_",
":_",
"'",
"record",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"record",
"\\u",
"id_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"records_",
"=_",
"self_",
"._",
"\\u",
"to",
"\\u",
"records_",
"(_",
"items_",
"=_",
"data_",
",_",
"zone_",
"=_",
"zone_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"records_",
")_",
"!=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Record",
"Do",
"es",
"Not",
"Exist",
"Error_",
"(_",
"value_",
"=_",
"''_",
",_",
"driver_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"\\u",
"id_",
"=_",
"record",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"records_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"zone_",
"(_",
"self_",
",_",
"domain_",
",_",
"type_",
"=_",
"'",
"master",
"'_",
",_",
"ttl_",
"=_",
"None_",
",_",
"extra_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"zone",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"API",
" ",
"docs",
":",
" ",
"http",
"://",
"www",
".",
"lino",
"de",
".",
"com",
"/",
"api",
"/",
"dns",
"/",
"domain",
".",
"create",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"create",
"'_",
",_",
"'",
"Type",
"'_",
":_",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Doma",
"in",
"'_",
":_",
"domain_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"ttl_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"TTL",
"\\u",
"sec",
"'_",
"]_",
"=_",
"ttl_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"merged_",
"=_",
"merge",
"\\u",
"valid",
"\\u",
"keys_",
"(_",
"params_",
"=_",
"params_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"valid",
"\\u",
"keys_",
"=_",
"VALID",
"\\u",
"ZONE",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zone_",
"=_",
"Zone_",
"(_",
"id_",
"=_",
"data_",
"[_",
"'",
"Doma",
"in",
"ID",
"'_",
"]_",
",_",
"domain_",
"=_",
"domain_",
",_",
"type_",
"=_",
"type_",
",_",
"ttl_",
"=_",
"ttl_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"merged_",
",_",
"driver_",
"=_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zone_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"update",
"\\u",
"zone_",
"(_",
"self_",
",_",
"zone_",
",_",
"domain_",
"=_",
"None_",
",_",
"type_",
"=_",
"None_",
",_",
"ttl_",
"=_",
"None_",
",_",
"extra_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Update",
" ",
"an",
" ",
"exist",
"ing",
" ",
"zone",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"API",
" ",
"docs",
":",
" ",
"http",
"://",
"www",
".",
"lino",
"de",
".",
"com",
"/",
"api",
"/",
"dns",
"/",
"domain",
".",
"update",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"update",
"'_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"zone_",
"._",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"Type",
"'_",
"]_",
"=_",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"domain_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"Doma",
"in",
"'_",
"]_",
"=_",
"domain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"ttl_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"TTL",
"\\u",
"sec",
"'_",
"]_",
"=_",
"ttl_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"merged_",
"=_",
"merge",
"\\u",
"valid",
"\\u",
"keys_",
"(_",
"params_",
"=_",
"params_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"valid",
"\\u",
"keys_",
"=_",
"VALID",
"\\u",
"ZONE",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"update",
"d\\u",
"zone_",
"=_",
"get",
"\\u",
"new",
"\\u",
"obj_",
"(_",
"obj_",
"=_",
"zone_",
",_",
"klass_",
"=_",
"Zone_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"attributes_",
"=_",
"{_",
"'",
"domain",
"'_",
":_",
"domain_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"type",
"'_",
":_",
"type_",
",_",
"'",
"ttl",
"'_",
":_",
"ttl_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"extra",
"'_",
":_",
"merged_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"update",
"d\\u",
"zone_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"record_",
"(_",
"self_",
",_",
"name_",
",_",
"zone_",
",_",
"type_",
",_",
"data_",
",_",
"extra_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"record",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"API",
" ",
"docs",
":",
" ",
"http",
"://",
"www",
".",
"lino",
"de",
".",
"com",
"/",
"api",
"/",
"dns",
"/",
"domain",
".",
"resource",
".",
"create",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"resource",
".",
"create",
"'_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"zone_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Name",
"'_",
":_",
"name_",
",_",
"'",
"Target",
"'_",
":_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Type",
"'_",
":_",
"self_",
"._",
"RECORD",
"\\u",
"TYPE",
"\\u",
"MAP_",
"[_",
"type_",
"]_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"merged_",
"=_",
"merge",
"\\u",
"valid",
"\\u",
"keys_",
"(_",
"params_",
"=_",
"params_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"valid",
"\\u",
"keys_",
"=_",
"VALID",
"\\u",
"RECORD",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"Record_",
"(_",
"id_",
"=_",
"result_",
"[_",
"'",
"Reso",
"urc",
"e",
"ID",
"'_",
"]_",
",_",
"name_",
"=_",
"name_",
",_",
"type_",
"=_",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"data_",
",_",
"extra_",
"=_",
"merged_",
",_",
"zone_",
"=_",
"zone_",
",_",
"driver_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ttl_",
"=_",
"merged_",
"._",
"get_",
"(_",
"'",
"TTL",
"\\u",
"sec",
"'_",
",_",
"None_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"update",
"\\u",
"record_",
"(_",
"self_",
",_",
"record_",
",_",
"name_",
"=_",
"None_",
",_",
"type_",
"=_",
"None_",
",_",
"data_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Update",
" ",
"an",
" ",
"exist",
"ing",
" ",
"record",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"API",
" ",
"docs",
":",
" ",
"http",
"://",
"www",
".",
"lino",
"de",
".",
"com",
"/",
"api",
"/",
"dns",
"/",
"domain",
".",
"resource",
".",
"update",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"resource",
".",
"update",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Reso",
"urc",
"e",
"ID",
"'_",
":_",
"record_",
"._",
"id_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"record_",
"._",
"zone_",
"._",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"Name",
"'_",
"]_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"Target",
"'_",
"]_",
"=_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"type_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"'",
"Type",
"'_",
"]_",
"=_",
"self_",
"._",
"RECORD",
"\\u",
"TYPE",
"\\u",
"MAP_",
"[_",
"type_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"merged_",
"=_",
"merge",
"\\u",
"valid",
"\\u",
"keys_",
"(_",
"params_",
"=_",
"params_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"valid",
"\\u",
"keys_",
"=_",
"VALID",
"\\u",
"RECORD",
"\\u",
"EXTRA",
"\\u",
"PARAMS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"update",
"d\\u",
"record_",
"=_",
"get",
"\\u",
"new",
"\\u",
"obj_",
"(_",
"obj_",
"=_",
"record_",
",_",
"klass_",
"=_",
"Record_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"attributes_",
"=_",
"{_",
"'",
"name",
"'_",
":_",
"name_",
",_",
"'",
"data",
"'_",
":_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"type",
"'_",
":_",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"extra",
"'_",
":_",
"merged_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"update",
"d\\u",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete",
"\\u",
"zone_",
"(_",
"self_",
",_",
"zone_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"delete",
"'_",
",_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"zone_",
"._",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"set\\u",
"context_",
"(_",
"context_",
"=_",
"{_",
"'",
"resource",
"'_",
":_",
"'",
"zone",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"zone_",
"._",
"id_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"'",
"Doma",
"in",
"ID",
"'_",
"in_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete",
"\\u",
"record_",
"(_",
"self_",
",_",
"record_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"api",
"\\u",
"action",
"'_",
":_",
"'",
"domain",
".",
"resource",
".",
"delete",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Doma",
"in",
"ID",
"'_",
":_",
"record_",
"._",
"zone_",
"._",
"id_",
",_",
"'",
"Reso",
"urc",
"e",
"ID",
"'_",
":_",
"record_",
"._",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connection_",
"._",
"set\\u",
"context_",
"(_",
"context_",
"=_",
"{_",
"'",
"resource",
"'_",
":_",
"'",
"record",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"record_",
"._",
"id_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"connection_",
"._",
"request_",
"(_",
"API",
"\\u",
"ROOT_",
",_",
"params_",
"=_",
"params_",
")_",
"._",
"objects_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"'",
"Reso",
"urc",
"e",
"ID",
"'_",
"in_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"to",
"\\u",
"zones_",
"(_",
"self_",
",_",
"items_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Convert",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"items",
" ",
"to",
" ",
"the",
" ",
"Zon",
"e",
" ",
"object",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zones_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"item_",
"in_",
"items_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"zones_",
"._",
"append_",
"(_",
"self_",
"._",
"\\u",
"to",
"\\u",
"zone_",
"(_",
"item_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"zones_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"to",
"\\u",
"zone_",
"(_",
"self_",
",_",
"item_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Build",
" ",
"an",
" ",
"Zon",
"e",
" ",
"object",
" ",
"from",
" ",
"the",
" ",
"item",
" ",
"dictionar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"SOA",
"\\u",
"Ema",
"il",
"'_",
":_",
"item_",
"[_",
"'",
"SOA",
"\\u",
"EMA",
"IL",
"'_",
"]_",
",_",
"'",
"status",
"'_",
":_",
"item_",
"[_",
"'",
"STATUS",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"item_",
"[_",
"'",
"DESCRIPT",
"ION",
"'_",
"]_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"zone_",
"=_",
"Zone_",
"(_",
"id_",
"=_",
"item_",
"[_",
"'",
"DOM",
"AIN",
"ID",
"'_",
"]_",
",_",
"domain_",
"=_",
"item_",
"[_",
"'",
"DOM",
"AIN",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"type_",
"=_",
"item_",
"[_",
"'",
"TYPE",
"'_",
"]_",
",_",
"ttl_",
"=_",
"item_",
"[_",
"'",
"TTL",
"\\u",
"SEC",
"'_",
"]_",
",_",
"driver_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"zone_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"to",
"\\u",
"records_",
"(_",
"self_",
",_",
"items_",
",_",
"zone_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Convert",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"items",
" ",
"to",
" ",
"the",
" ",
"Record",
" ",
"object",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"records_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"item_",
"in_",
"items_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"records_",
"._",
"append_",
"(_",
"self_",
"._",
"\\u",
"to",
"\\u",
"record_",
"(_",
"item_",
"=_",
"item_",
",_",
"zone_",
"=_",
"zone_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"records_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lin",
"ode",
"DNS",
"Driver_",
"(_",
"DNS",
"Driver_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"to",
"\\u",
"record_",
"(_",
"self_",
",_",
"item_",
",_",
"zone_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Build",
" ",
"a",
" ",
"Record",
" ",
"object",
" ",
"from",
" ",
"the",
" ",
"item",
" ",
"dictionar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"protoc",
"ol",
"'_",
":_",
"item_",
"[_",
"'",
"PROTOCOL",
"'_",
"]_",
",_",
"'",
"ttl",
"\\u",
"sec",
"'_",
":_",
"item_",
"[_",
"'",
"TTL",
"\\u",
"SEC",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"port",
"'_",
":_",
"item_",
"[_",
"'",
"PORT",
"'_",
"]_",
",_",
"'",
"weight",
"'_",
":_",
"item_",
"[_",
"'",
"WEIGHT",
"'_",
"]_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"type_",
"=_",
"self_",
"._",
"\\u",
"string",
"\\u",
"to",
"\\u",
"record",
"\\u",
"type_",
"(_",
"item_",
"[_",
"'",
"TYPE",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"Record_",
"(_",
"id_",
"=_",
"item_",
"[_",
"'",
"RES",
"OUR",
"CE",
"ID",
"'_",
"]_",
",_",
"name_",
"=_",
"item_",
"[_",
"'",
"NAME",
"'_",
"]_",
",_",
"type_",
"=_",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"item_",
"[_",
"'",
"TARGET",
"'_",
"]_",
",_",
"zone_",
"=_",
"zone_",
",_",
"driver_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ttl_",
"=_",
"item_",
"[_",
"'",
"TTL",
"\\u",
"SEC",
"'_",
"]_",
",_",
"extra_",
"=_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"record_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | asterisk/ari-py/ari_test/client_test.py | [
{
"content": "#!/usr/bin/env python\n\nimport ari\nimport httpretty\nimport json\nimport requests\nimport unittest\nimport urllib\n\nfrom ari_test.utils import AriTestCase\n\n\nGET = httpretty.GET\nPUT = httpretty.PUT\nPOST = httpretty.POST\nDELETE = httpretty.DELETE\n\n\n# noinspection PyDocstring\n\n\nif __name__ == '__main__':\n unittest.main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ClientTest(AriTestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.ClientTest",
"header": "['module', '___EOS___']",
"index": 19
},
{
"content": " def test_docs(self):\n fp = urllib.urlopen(\"http://ari.py/ari/api-docs/resources.json\")\n try:\n actual = json.load(fp)\n self.assertEqual(self.BASE_URL, actual['basePath'])\n finally:\n fp.close()",
"metadata": "root.ClientTest.test_docs",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def test_empty_listing(self):\n self.serve(GET, 'channels', body='[]')\n actual = self.uut.channels.list()\n self.assertEqual([], actual)",
"metadata": "root.ClientTest.test_empty_listing",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def test_one_listing(self):\n self.serve(GET, 'channels', body='[{\"id\": \"test-channel\"}]')\n self.serve(DELETE, 'channels', 'test-channel')\n\n actual = self.uut.channels.list()\n self.assertEqual(1, len(actual))\n actual[0].hangup()",
"metadata": "root.ClientTest.test_one_listing",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def test_play(self):\n self.serve(GET, 'channels', 'test-channel',\n body='{\"id\": \"test-channel\"}')\n self.serve(POST, 'channels', 'test-channel', 'play',\n body='{\"id\": \"test-playback\"}')\n self.serve(DELETE, 'playbacks', 'test-playback')\n\n channel = self.uut.channels.get(channelId='test-channel')\n playback = channel.play(media='sound:test-sound')\n playback.stop()",
"metadata": "root.ClientTest.test_play",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def test_bad_resource(self):\n try:\n self.uut.i_am_not_a_resource.list()\n self.fail(\"How did it find that resource?\")\n except AttributeError:\n pass",
"metadata": "root.ClientTest.test_bad_resource",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 52
},
{
"content": " def test_bad_repo_method(self):\n try:\n self.uut.channels.i_am_not_a_method()\n self.fail(\"How did it find that method?\")\n except AttributeError:\n pass",
"metadata": "root.ClientTest.test_bad_repo_method",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 59
},
{
"content": " def test_bad_object_method(self):\n self.serve(GET, 'channels', 'test-channel',\n body='{\"id\": \"test-channel\"}')\n\n try:\n channel = self.uut.channels.get(channelId='test-channel')\n channel.i_am_not_a_method()\n self.fail(\"How did it find that method?\")\n except AttributeError:\n pass",
"metadata": "root.ClientTest.test_bad_object_method",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 66
},
{
"content": " def test_bad_param(self):\n try:\n self.uut.channels.list(i_am_not_a_param='asdf')\n self.fail(\"How did it find that param?\")\n except TypeError:\n pass",
"metadata": "root.ClientTest.test_bad_param",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 77
},
{
"content": " def test_bad_response(self):\n self.serve(GET, 'channels', body='{\"message\": \"This is just a test\"}',\n status=500)\n try:\n self.uut.channels.list()\n self.fail(\"Should have thrown an exception\")\n except requests.HTTPError as e:\n self.assertEqual(500, e.response.status_code)\n self.assertEqual(\n {\"message\": \"This is just a test\"}, e.response.json())",
"metadata": "root.ClientTest.test_bad_response",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 84
},
{
"content": " def test_endpoints(self):\n self.serve(GET, 'endpoints',\n body='[{\"technology\": \"TEST\", \"resource\": \"1234\"}]')\n self.serve(GET, 'endpoints', 'TEST', '1234',\n body='{\"technology\": \"TEST\", \"resource\": \"1234\"}')\n\n endpoints = self.uut.endpoints.list()\n self.assertEqual(1, len(endpoints))\n endpoint = endpoints[0].get()\n self.assertEqual('TEST', endpoint.json['technology'])\n self.assertEqual('1234', endpoint.json['resource'])",
"metadata": "root.ClientTest.test_endpoints",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 95
},
{
"content": " def test_live_recording(self):\n self.serve(GET, 'recordings', 'live', 'test-recording',\n body='{\"name\": \"test-recording\"}')\n self.serve(DELETE, 'recordings', 'live', 'test-recording', status=204)\n\n recording = self.uut.recordings.getLive(recordingName='test-recording')\n recording.cancel()",
"metadata": "root.ClientTest.test_live_recording",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 107
},
{
"content": " def test_stored_recording(self):\n self.serve(GET, 'recordings', 'stored', 'test-recording',\n body='{\"name\": \"test-recording\"}')\n self.serve(DELETE, 'recordings', 'stored', 'test-recording',\n status=204)\n\n recording = self.uut.recordings.getStored(\n recordingName='test-recording')\n recording.deleteStored()",
"metadata": "root.ClientTest.test_stored_recording",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 115
},
{
"content": " def test_mailboxes(self):\n self.serve(PUT, 'mailboxes', '1000',\n body='{\"name\": \"1000\", \"old_messages\": \"1\", \"new_messages\": \"3\"}')\n\n mailbox = self.uut.mailboxes.update(\n mailboxName='1000',\n oldMessages='1',\n newMessages='3')\n self.assertEqual('1000', mailbox['name'])\n self.assertEqual('1', mailbox['old_messages'])\n self.assertEqual('3', mailbox['new_messages'])",
"metadata": "root.ClientTest.test_mailboxes",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 125
},
{
"content": " def test_device_state(self):\n self.serve(PUT, 'deviceStates', 'foobar',\n body='{\"name\": \"foobar\", \"state\": \"BUSY\"}')\n device_state = self.uut.deviceStates.update(\n deviceName='foobar',\n deviceState='BUSY')\n self.assertEqual('foobar', device_state['name'])\n self.assertEqual('BUSY', device_state['state'])",
"metadata": "root.ClientTest.test_device_state",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 137
},
{
"content": " def setUp(self):\n super(ClientTest, self).setUp()\n self.uut = ari.connect('http://ari.py/', 'test', 'test')",
"metadata": "root.ClientTest.setUp",
"header": "['class', 'ClientTest', '(', 'AriTestCase', ')', ':', '___EOS___']",
"index": 146
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"ari",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"httpretty_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"requests_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ari",
"\\u",
"test_",
"._",
"utils_",
"import_",
"Ari",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"GET_",
"=_",
"httpretty_",
"._",
"GET_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PUT_",
"=_",
"httpretty_",
"._",
"PUT_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"POST_",
"=_",
"httpretty_",
"._",
"POST_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DELETE_",
"=_",
"httpretty_",
"._",
"DELETE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"noin",
"spect",
"ion",
" ",
"Py",
"Docs",
"tring_",
"\\u\\u\\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 ",
" _",
"unittest_",
"._",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"docs_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fp_",
"=_",
"urllib_",
"._",
"urlopen_",
"(_",
"\"",
"http",
"://",
"ari",
".",
"py",
"/",
"ari",
"/",
"api",
"-",
"docs",
"/",
"resource",
"s",
".",
"json",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actual_",
"=_",
"json_",
"._",
"load_",
"(_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"BASE",
"\\u",
"URL_",
",_",
"actual_",
"[_",
"'",
"base",
"Path",
"'_",
"]_",
")_",
"\\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 ",
" _",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"empty",
"\\u",
"listing_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"body_",
"=_",
"'[]'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"[_",
"]_",
",_",
"actual_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"one",
"\\u",
"listing_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"body_",
"=_",
"'[{",
"\"",
"id",
"\":",
" ",
"\"",
"test",
"-",
"channel",
"\"}]",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"DELETE_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"'",
"test",
"-",
"channel",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"actual_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"actual_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"[_",
"0_",
"]_",
"._",
"hang",
"up_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"play_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"'",
"test",
"-",
"channel",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"id",
"\":",
" ",
"\"",
"test",
"-",
"channel",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"POST_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"'",
"test",
"-",
"channel",
"'_",
",_",
"'",
"play",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"id",
"\":",
" ",
"\"",
"test",
"-",
"playback",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"DELETE_",
",_",
"'",
"playback",
"s",
"'_",
",_",
"'",
"test",
"-",
"playback",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"channel_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"get_",
"(_",
"channel",
"Id_",
"=_",
"'",
"test",
"-",
"channel",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"playback",
"_",
"=_",
"channel_",
"._",
"play_",
"(_",
"media_",
"=_",
"'",
"sound",
":",
"test",
"-",
"sound",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"playback",
"_",
"._",
"stop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"bad",
"\\u",
"resource_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"uu",
"t_",
"._",
"i",
"\\u",
"am",
"\\u",
"not",
"\\u",
"a",
"\\u",
"resource_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Ho",
"w",
" ",
"did",
" ",
"it",
" ",
"find",
" ",
"tha",
"t",
" ",
"resource",
"?\"_",
")_",
"\\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_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"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",
"bad",
"\\u",
"repo",
"\\u",
"method_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"i",
"\\u",
"am",
"\\u",
"not",
"\\u",
"a",
"\\u",
"method_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Ho",
"w",
" ",
"did",
" ",
"it",
" ",
"find",
" ",
"tha",
"t",
" ",
"method",
"?\"_",
")_",
"\\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_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"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",
"bad",
"\\u",
"object\\u",
"method_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"'",
"test",
"-",
"channel",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"id",
"\":",
" ",
"\"",
"test",
"-",
"channel",
"\"}'_",
")_",
"\\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 ",
" _",
"channel_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"get_",
"(_",
"channel",
"Id_",
"=_",
"'",
"test",
"-",
"channel",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"channel_",
"._",
"i",
"\\u",
"am",
"\\u",
"not",
"\\u",
"a",
"\\u",
"method_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Ho",
"w",
" ",
"did",
" ",
"it",
" ",
"find",
" ",
"tha",
"t",
" ",
"method",
"?\"_",
")_",
"\\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_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"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",
"bad",
"\\u",
"param_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"list_",
"(_",
"i",
"\\u",
"am",
"\\u",
"not",
"\\u",
"a",
"\\u",
"param_",
"=_",
"'",
"asd",
"f",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Ho",
"w",
" ",
"did",
" ",
"it",
" ",
"find",
" ",
"tha",
"t",
" ",
"param",
"?\"_",
")_",
"\\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 ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"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",
"bad",
"\\u",
"response_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"channel",
"s",
"'_",
",_",
"body_",
"=_",
"'{",
"\"",
"message",
"\":",
" ",
"\"",
"Thi",
"s",
" ",
"is",
" ",
"just",
" ",
"a",
" ",
"test",
"\"}'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"status_",
"=_",
"500_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"uu",
"t_",
"._",
"channels_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Sho",
"ul",
"d",
" ",
"have",
" ",
"throw",
"n",
" ",
"an",
" ",
"exception",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"requests_",
"._",
"HTTP",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Equal_",
"(_",
"500_",
",_",
"e_",
"._",
"response_",
"._",
"status",
"\\u",
"code_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\"",
"message",
"\"_",
":_",
"\"",
"Thi",
"s",
" ",
"is",
" ",
"just",
" ",
"a",
" ",
"test",
"\"_",
"}_",
",_",
"e_",
"._",
"response_",
"._",
"json_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"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",
"endpoints_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"endpoint",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'[{",
"\"",
"technology",
"\":",
" ",
"\"",
"TEST",
"\",",
" ",
"\"",
"resource",
"\":",
" ",
"\"",
"1234",
"\"}]",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"endpoint",
"s",
"'_",
",_",
"'",
"TEST",
"'_",
",_",
"'",
"1234",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"technology",
"\":",
" ",
"\"",
"TEST",
"\",",
" ",
"\"",
"resource",
"\":",
" ",
"\"",
"1234",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"endpoints_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"endpoints_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"endpoints_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"endpoint_",
"=_",
"endpoints_",
"[_",
"0_",
"]_",
"._",
"get_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"TEST",
"'_",
",_",
"endpoint_",
"._",
"json_",
"[_",
"'",
"technology",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"1234",
"'_",
",_",
"endpoint_",
"._",
"json_",
"[_",
"'",
"resource",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"live",
"\\u",
"recording_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"recordings",
"'_",
",_",
"'",
"live",
"'_",
",_",
"'",
"test",
"-",
"record",
"ing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"name",
"\":",
" ",
"\"",
"test",
"-",
"record",
"ing",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"DELETE_",
",_",
"'",
"recordings",
"'_",
",_",
"'",
"live",
"'_",
",_",
"'",
"test",
"-",
"record",
"ing",
"'_",
",_",
"status_",
"=_",
"204_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"recording_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"recordings",
"_",
"._",
"get",
"Live",
"_",
"(_",
"record",
"ing",
"Name_",
"=_",
"'",
"test",
"-",
"record",
"ing",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"recording_",
"._",
"cancel_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"store",
"d\\u",
"recording_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"GET_",
",_",
"'",
"recordings",
"'_",
",_",
"'",
"store",
"d",
"'_",
",_",
"'",
"test",
"-",
"record",
"ing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"name",
"\":",
" ",
"\"",
"test",
"-",
"record",
"ing",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"serve_",
"(_",
"DELETE_",
",_",
"'",
"recordings",
"'_",
",_",
"'",
"store",
"d",
"'_",
",_",
"'",
"test",
"-",
"record",
"ing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"status_",
"=_",
"204_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"recording_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"recordings",
"_",
"._",
"get",
"Stor",
"ed_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"ing",
"Name_",
"=_",
"'",
"test",
"-",
"record",
"ing",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"recording_",
"._",
"delete",
"Stor",
"ed_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"mailbo",
"xes_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"PUT_",
",_",
"'",
"mailbo",
"xes",
"'_",
",_",
"'",
"1000",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"name",
"\":",
" ",
"\"",
"1000",
"\",",
" ",
"\"",
"old",
"\\u",
"message",
"s",
"\":",
" ",
"\"",
"1",
"\",",
" ",
"\"",
"new",
"\\u",
"message",
"s",
"\":",
" ",
"\"",
"3",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mailbox_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"mailbo",
"xes_",
"._",
"update_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"mailbo",
"x",
"Name_",
"=_",
"'",
"1000",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"old",
"Messages_",
"=_",
"'",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"Messages_",
"=_",
"'",
"3",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"1000",
"'_",
",_",
"mailbox_",
"[_",
"'",
"name",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"1",
"'_",
",_",
"mailbox_",
"[_",
"'",
"old",
"\\u",
"message",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"3",
"'_",
",_",
"mailbox_",
"[_",
"'",
"new",
"\\u",
"message",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"device",
"\\u",
"state_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"serve_",
"(_",
"PUT_",
",_",
"'",
"device",
"State",
"s",
"'_",
",_",
"'",
"fooba",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"'{",
"\"",
"name",
"\":",
" ",
"\"",
"fooba",
"r",
"\",",
" ",
"\"",
"state",
"\":",
" ",
"\"",
"BUS",
"Y",
"\"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"device",
"\\u",
"state_",
"=_",
"self_",
"._",
"uu",
"t_",
"._",
"device",
"States_",
"._",
"update_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"device",
"Name_",
"=_",
"'",
"fooba",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"device",
"State_",
"=_",
"'",
"BUS",
"Y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"fooba",
"r",
"'_",
",_",
"device",
"\\u",
"state_",
"[_",
"'",
"name",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"BUS",
"Y",
"'_",
",_",
"device",
"\\u",
"state_",
"[_",
"'",
"state",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Test_",
"(_",
"Ari",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Client",
"Test_",
",_",
"self_",
")_",
"._",
"set",
"Up_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"uu",
"t_",
"=_",
"ari",
"_",
"._",
"connect_",
"(_",
"'",
"http",
"://",
"ari",
".",
"py",
"/'_",
",_",
"'",
"test",
"'_",
",_",
"'",
"test",
"'_",
")_",
"\\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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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
] |
Comparison of constants | zynga/jasy/jasy/core/Config.py | [
{
"content": " def set(self, name, value, accept=None, parse=False):\n \"\"\"\n Saves the given value under the given field\n \"\"\"\n\n # Don't accept None value\n if value is None:\n return False\n\n # Parse value for easy type checks\n if parse:\n try:\n parsedValue = eval(value)\n except:\n pass\n else:\n value = parsedValue\n\n # Convert tuples/sets into JSON compatible array\n if type(value) in (tuple, set):\n value = list(value)\n\n # Check for given type\n if accept is not None and not matchesType(value, accept):\n print(Console.colorize(\" - Invalid value: %s\" % str(value), \"red\"))\n return False\n\n if \".\" in name:\n splits = name.split(\".\")\n current = self.__data\n for split in splits[:-1]:\n if not split in current:\n current[split] = {}\n\n current = current[split]\n\n current[splits[-1]] = value\n\n else:\n self.__data[name] = value\n\n return True",
"metadata": "root.Config.set",
"header": "['class', 'Config', ':', '___EOS___']",
"index": 334
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set_",
"(_",
"self_",
",_",
"name_",
",_",
"value_",
",_",
"accept_",
"=_",
"None_",
",_",
"parse_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Save",
"s",
" ",
"the",
" ",
"give",
"n",
" ",
"value",
" ",
"under",
" ",
"the",
" ",
"give",
"n",
" ",
"field",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"accept",
" ",
"Non",
"e",
" ",
"value_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"value_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pars",
"e",
" ",
"value",
" ",
"for",
" ",
"easy",
" ",
"type",
" ",
"checks_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"parse_",
":_",
"\\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 ",
" _",
"parsed",
"Value_",
"=_",
"eval_",
"(_",
"value_",
")_",
"\\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_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"parsed",
"Value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"tuple",
"s",
"/",
"sets",
" ",
"int",
"o",
" ",
"JSO",
"N",
" ",
"compatible",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
"(_",
"value_",
")_",
"in_",
"(_",
"tuple_",
",_",
"set_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"value_",
"=_",
"list_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"for",
" ",
"give",
"n",
" ",
"type_",
"\\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_",
"accept_",
"is_",
"not_",
"None_",
"and_",
"not_",
"matche",
"s",
"Type_",
"(_",
"value_",
",_",
"accept_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"Console_",
"._",
"colorize_",
"(_",
"\"",
" ",
" ",
"-",
" ",
"Inva",
"lid",
" ",
"value",
":",
" ",
"%",
"s",
"\"_",
"%_",
"str_",
"(_",
"value_",
")_",
",_",
"\"",
"red",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\".\"_",
"in_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"splits_",
"=_",
"name_",
"._",
"split_",
"(_",
"\".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"current_",
"=_",
"self_",
"._",
"\\u\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"split_",
"in_",
"splits_",
"[_",
":_",
"-_",
"1_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"split_",
"in_",
"current_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"current_",
"[_",
"split_",
"]_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"current_",
"=_",
"current_",
"[_",
"split_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"current_",
"[_",
"splits_",
"[_",
"-_",
"1_",
"]_",
"]_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"data_",
"[_",
"name_",
"]_",
"=_",
"value_",
"\\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_"
] | [
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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sort vars to TopSort\n \"\"\"\n s = find(s)\n if type(s) is SortVar:\n return TopSort()\n elif type(s) is FunctionSort:\n return FunctionSort(*(\n convert_from_sortvars(x) for x in s\n ))\n else:\n return s",
"metadata": "root.convert_from_sortvars",
"header": "['module', '___EOS___']",
"index": 104
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"module_",
"\\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_",
"convert",
"\\u",
"from",
"\\u",
"sort",
"vars_",
"(_",
"s_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Convert",
" ",
"sort",
" ",
"vars",
" ",
"to",
" ",
"Top",
"Sort",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"=_",
"find_",
"(_",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"type_",
"(_",
"s_",
")_",
"is_",
"Sort",
"Var_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Top",
"Sort_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"s_",
")_",
"is_",
"Function",
"Sort_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Function",
"Sort_",
"(_",
"*_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"convert",
"\\u",
"from",
"\\u",
"sort",
"vars_",
"(_",
"x_",
")_",
"for_",
"x_",
"in_",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"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
] |
Unused import | alphagov/performanceplatform-collector/tests/performanceplatform/collector/ga/plugins/test_department.py | [
{
"content": "from performanceplatform.collector.ga.plugins.department \\\n import ComputeDepartmentKey, try_get_department\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def test_try_get_department():\n from nose.tools import assert_equal\n assert_equal(try_get_department(\"<D1>\"), \"attorney-generals-office\")\n assert_equal(try_get_department(\"<D1><foo>\"), \"attorney-generals-office\")\n assert_equal(try_get_department(\"<foo>\"), \"<foo>\")",
"metadata": "root.test_try_get_department",
"header": "['module', '___EOS___']",
"index": 4
},
{
"content": "def test_mapping():\n from nose.tools import assert_equal, assert_in\n\n plugin = ComputeDepartmentKey(\"key_name\")\n documents = [{\"key_name\": \"<D10>\"}]\n (transformed_document, ) = plugin(documents)\n\n assert_in(\"department\", transformed_document)\n assert_equal(transformed_document[\"department\"],\n \"department-for-work-pensions\")",
"metadata": "root.test_mapping",
"header": "['module', '___EOS___']",
"index": 11
},
{
"content": "def test_fail_if_no_key_name_in_document():\n from nose.tools import assert_raises\n\n plugin = ComputeDepartmentKey(\"key_name\")\n documents = [{\"foo\": \"<D10>\"}]\n\n with assert_raises(AssertionError):\n plugin(documents)",
"metadata": "root.test_fail_if_no_key_name_in_document",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": "def test_unknown_department_code():\n from nose.tools import assert_equal\n\n plugin = ComputeDepartmentKey(\"key_name\")\n documents = [{\"key_name\": \"<DTHISDOESNOTEXIST>\"}]\n (transformed_document, ) = plugin(documents)\n\n assert_equal(transformed_document[\"department\"], \"<DTHISDOESNOTEXIST>\")",
"metadata": "root.test_unknown_department_code",
"header": "['module', '___EOS___']",
"index": 33
},
{
"content": "def test_takes_first_code():\n from nose.tools import assert_equal\n\n plugin = ComputeDepartmentKey(\"key_name\")\n documents = [{\"key_name\": \"<D10><D9>\"}]\n (transformed_document, ) = plugin(documents)\n\n assert_equal(transformed_document[\"department\"],\n \"department-for-work-pensions\")",
"metadata": "root.test_takes_first_code",
"header": "['module', '___EOS___']",
"index": 43
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"perform",
"anc",
"epl",
"at",
"form_",
"._",
"collector_",
"._",
"ga_",
"._",
"plugins_",
"._",
"department_",
"import_",
"Compute",
"Depart",
"ment",
"Key_",
",_",
"try",
"\\u",
"get",
"\\u",
"department_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"try",
"\\u",
"get",
"\\u",
"department_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"nose_",
"._",
"tools_",
"import_",
"assert",
"\\u",
"equal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"try",
"\\u",
"get",
"\\u",
"department_",
"(_",
"\"<",
"D1",
">\"_",
")_",
",_",
"\"",
"att",
"orn",
"ey",
"-",
"genera",
"ls",
"-",
"office",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"try",
"\\u",
"get",
"\\u",
"department_",
"(_",
"\"<",
"D1",
"><",
"foo",
">\"_",
")_",
",_",
"\"",
"att",
"orn",
"ey",
"-",
"genera",
"ls",
"-",
"office",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"try",
"\\u",
"get",
"\\u",
"department_",
"(_",
"\"<",
"foo",
">\"_",
")_",
",_",
"\"<",
"foo",
">\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"mapping_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"nose_",
"._",
"tools_",
"import_",
"assert",
"\\u",
"equal_",
",_",
"assert",
"\\u",
"in_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"plugin_",
"=_",
"Compute",
"Depart",
"ment",
"Key_",
"(_",
"\"",
"key",
"\\u",
"name",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"documents_",
"=_",
"[_",
"{_",
"\"",
"key",
"\\u",
"name",
"\"_",
":_",
"\"<",
"D1",
"0",
">\"_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"transforme",
"d\\u",
"document_",
",_",
")_",
"=_",
"plugin_",
"(_",
"documents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"\"",
"department",
"\"_",
",_",
"transforme",
"d\\u",
"document_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"transforme",
"d\\u",
"document_",
"[_",
"\"",
"department",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"department",
"-",
"for",
"-",
"work",
"-",
"pens",
"ion",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"fail",
"\\u",
"if",
"\\u",
"no",
"\\u",
"key",
"\\u",
"name",
"\\u",
"in",
"\\u",
"document_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"nose_",
"._",
"tools_",
"import_",
"assert",
"\\u",
"raises_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"plugin_",
"=_",
"Compute",
"Depart",
"ment",
"Key_",
"(_",
"\"",
"key",
"\\u",
"name",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"documents_",
"=_",
"[_",
"{_",
"\"",
"foo",
"\"_",
":_",
"\"<",
"D1",
"0",
">\"_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"Assert",
"ion",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plugin_",
"(_",
"documents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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",
"unknown",
"\\u",
"department",
"\\u",
"code_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"nose_",
"._",
"tools_",
"import_",
"assert",
"\\u",
"equal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"plugin_",
"=_",
"Compute",
"Depart",
"ment",
"Key_",
"(_",
"\"",
"key",
"\\u",
"name",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"documents_",
"=_",
"[_",
"{_",
"\"",
"key",
"\\u",
"name",
"\"_",
":_",
"\"<",
"DT",
"HIS",
"DO",
"ES",
"NOTE",
"XIST",
">\"_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"transforme",
"d\\u",
"document_",
",_",
")_",
"=_",
"plugin_",
"(_",
"documents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"transforme",
"d\\u",
"document_",
"[_",
"\"",
"department",
"\"_",
"]_",
",_",
"\"<",
"DT",
"HIS",
"DO",
"ES",
"NOTE",
"XIST",
">\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"take",
"s",
"\\u",
"first",
"\\u",
"code_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"nose_",
"._",
"tools_",
"import_",
"assert",
"\\u",
"equal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"plugin_",
"=_",
"Compute",
"Depart",
"ment",
"Key_",
"(_",
"\"",
"key",
"\\u",
"name",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"documents_",
"=_",
"[_",
"{_",
"\"",
"key",
"\\u",
"name",
"\"_",
":_",
"\"<",
"D1",
"0",
"><",
"D",
"9",
">\"_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"transforme",
"d\\u",
"document_",
",_",
")_",
"=_",
"plugin_",
"(_",
"documents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"transforme",
"d\\u",
"document_",
"[_",
"\"",
"department",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"department",
"-",
"for",
"-",
"work",
"-",
"pens",
"ion",
"s",
"\"_",
")_"
] | [
4,
4,
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,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | panoptes/POCS/panoptes/core.py | [
{
"content": " def check_mount_status(self):\n \"\"\" Checks the status of the PANOPTES system.\n\n This method will gather status information from the entire unit for reporting purproses.\n \"\"\"\n mount_status = {}\n try:\n mount_status = self.observatory.mount.status()\n self.db.insert_current('mount', mount_status)\n\n except Exception as e:\n self.logger.warning(\"Can't get status: {}\".format(e))\n\n return mount_status",
"metadata": "root.Panoptes.check_mount_status",
"header": "['class', 'Panoptes', '(', 'PanStateMachine', ',', 'PanStateLogic', ',', 'PanEventManager', ',', 'PanBase', ')', ':', '___EOS___']",
"index": 180
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Pan",
"opt",
"es_",
"(_",
"Pan",
"State",
"Machine_",
",_",
"Pan",
"State",
"Logic_",
",_",
"Pan",
"Event",
"Manager_",
",_",
"Pan",
"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_",
"check",
"\\u",
"mount",
"\\u",
"status_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Check",
"s",
" ",
"the",
" ",
"status",
" ",
"of",
" ",
"the",
" ",
"PAN",
"OPT",
"ES",
" ",
"system",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"will",
" ",
"gather",
" ",
"status",
" ",
"informati",
"on",
" ",
"from",
" ",
"the",
" ",
"entire",
" ",
"unit",
" ",
"for",
" ",
"reporting",
" ",
"pur",
"pros",
"es",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mount",
"\\u",
"status_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mount",
"\\u",
"status_",
"=_",
"self_",
"._",
"observa",
"tor",
"y_",
"._",
"mount_",
"._",
"status_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"db_",
"._",
"insert",
"\\u",
"current_",
"(_",
"'",
"mount",
"'_",
",_",
"mount",
"\\u",
"status_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"warning_",
"(_",
"\"",
"Can",
"'",
"t",
" ",
"get",
" ",
"status",
":",
" ",
"{}\"_",
"._",
"format_",
"(_",
"e_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"mount",
"\\u",
"status_",
"\\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
] |
Unused import | Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/horizon/tabs/base.py | [
{
"content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2012 Nebula, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport sys\n\nfrom django.template.loader import render_to_string\nfrom django.template import TemplateSyntaxError # noqa\nfrom django.utils.datastructures import SortedDict\n\nfrom horizon import exceptions\nfrom horizon.utils import html\n\nSEPARATOR = \"__\"\nCSS_TAB_GROUP_CLASSES = [\"nav\", \"nav-tabs\", \"ajax-tabs\"]\nCSS_ACTIVE_TAB_CLASSES = [\"active\"]\nCSS_DISABLED_TAB_CLASSES = [\"disabled\"]\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TabGroup(html.HTMLElement):\n \"\"\"A container class which knows how to manage and render\n :class:`~horizon.tabs.Tab` objects.\n\n .. attribute:: slug\n\n The URL slug and pseudo-unique identifier for this tab group.\n\n .. attribute:: template_name\n\n The name of the template which will be used to render this tab group.\n Default: ``\"horizon/common/_tab_group.html\"``\n\n .. attribute:: sticky\n\n Boolean to control whether the active tab state should be stored\n across requests for a given user. (State storage is all done\n client-side.)\n\n .. attribute:: param_name\n\n The name of the GET request parameter which will be used when\n requesting specific tab data. Default: ``tab``.\n\n .. attribute:: classes\n\n A list of CSS classes which should be displayed on this tab group.\n\n .. attribute:: attrs\n\n A dictionary of HTML attributes which should be rendered into the\n markup for this tab group.\n\n .. attribute:: selected\n\n Read-only property which is set to the instance of the\n currently-selected tab if there is one, otherwise ``None``.\n\n .. attribute:: active\n\n Read-only property which is set to the value of the current active tab.\n This may not be the same as the value of ``selected`` if no\n specific tab was requested via the ``GET`` parameter.\n \"\"\"\n slug = None\n template_name = \"horizon/common/_tab_group.html\"\n param_name = 'tab'\n sticky = False\n _selected = None\n _active = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.TabGroup",
"header": "['module', '___EOS___']",
"index": 31
},
{
"content": " @property\n def selected(self):\n return self._selected",
"metadata": "root.TabGroup.selected",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 82
},
{
"content": " @property\n def active(self):\n return self._active",
"metadata": "root.TabGroup.active",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 86
},
{
"content": " def __init__(self, request, **kwargs):\n super(TabGroup, self).__init__()\n if not hasattr(self, \"tabs\"):\n raise NotImplementedError('%s must declare a \"tabs\" attribute.'\n % self.__class__)\n self.request = request\n self.kwargs = kwargs\n self._data = None\n tab_instances = []\n for tab in self.tabs:\n tab_instances.append((tab.slug, tab(self, request)))\n self._tabs = SortedDict(tab_instances)\n if self.sticky:\n self.attrs['data-sticky-tabs'] = 'sticky'\n if not self._set_active_tab():\n self.tabs_not_available()",
"metadata": "root.TabGroup.__init__",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 90
},
{
"content": " def __repr__(self):\n return \"<%s: %s>\" % (self.__class__.__name__, self.slug)",
"metadata": "root.TabGroup.__repr__",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 107
},
{
"content": " def load_tab_data(self):\n \"\"\"Preload all data that for the tabs that will be displayed.\"\"\"\n for tab in self._tabs.values():\n if tab.load and not tab.data_loaded:\n try:\n tab._data = tab.get_context_data(self.request)\n except Exception:\n tab._data = False\n exceptions.handle(self.request)",
"metadata": "root.TabGroup.load_tab_data",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 110
},
{
"content": " def get_id(self):\n \"\"\"Returns the id for this tab group. Defaults to the value of the tab\n group's :attr:`horizon.tabs.Tab.slug`.\n \"\"\"\n return self.slug",
"metadata": "root.TabGroup.get_id",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 120
},
{
"content": " def get_default_classes(self):\n \"\"\"Returns a list of the default classes for the tab group. Defaults to\n ``[\"nav\", \"nav-tabs\", \"ajax-tabs\"]``.\n \"\"\"\n default_classes = super(TabGroup, self).get_default_classes()\n default_classes.extend(CSS_TAB_GROUP_CLASSES)\n return default_classes",
"metadata": "root.TabGroup.get_default_classes",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 126
},
{
"content": " def tabs_not_available(self):\n \"\"\"In the event that no tabs are either allowed or enabled, this method\n is the fallback handler. By default it's a no-op, but it exists\n to make redirecting or raising exceptions possible for subclasses.\n \"\"\"\n pass",
"metadata": "root.TabGroup.tabs_not_available",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 134
},
{
"content": " def _set_active_tab(self):\n marked_active = None\n\n # See if we have a selected tab via the GET parameter.\n tab = self.get_selected_tab()\n if tab:\n tab._active = True\n self._active = tab\n marked_active = tab\n\n # Iterate through to mark them all accordingly.\n for tab in self._tabs.values():\n if tab._allowed and tab._enabled and not marked_active:\n tab._active = True\n self._active = tab\n marked_active = True\n elif tab == marked_active:\n continue\n else:\n tab._active = False\n\n return marked_active",
"metadata": "root.TabGroup._set_active_tab",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 141
},
{
"content": " def render(self):\n \"\"\"Renders the HTML output for this tab group.\"\"\"\n return render_to_string(self.template_name, {\"tab_group\": self})",
"metadata": "root.TabGroup.render",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 164
},
{
"content": " def get_tabs(self):\n \"\"\"Returns a list of the allowed tabs for this tab group.\"\"\"\n return filter(lambda tab: tab._allowed, self._tabs.values())",
"metadata": "root.TabGroup.get_tabs",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 168
},
{
"content": " def get_tab(self, tab_name, allow_disabled=False):\n \"\"\"Returns a specific tab from this tab group.\n\n If the tab is not allowed or not enabled this method returns ``None``.\n\n If the tab is disabled but you wish to return it anyway, you can pass\n ``True`` to the allow_disabled argument.\n \"\"\"\n tab = self._tabs.get(tab_name, None)\n if tab and tab._allowed and (tab._enabled or allow_disabled):\n return tab\n return None",
"metadata": "root.TabGroup.get_tab",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 172
},
{
"content": " def get_loaded_tabs(self):\n return filter(lambda t: self.get_tab(t.slug), self._tabs.values())",
"metadata": "root.TabGroup.get_loaded_tabs",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 185
},
{
"content": " def get_selected_tab(self):\n \"\"\"Returns the tab specific by the GET request parameter.\n\n In the event that there is no GET request parameter, the value\n of the query parameter is invalid, or the tab is not allowed/enabled,\n the return value of this function is None.\n \"\"\"\n selected = self.request.GET.get(self.param_name, None)\n if selected:\n tab_group, tab_name = selected.split(SEPARATOR)\n if tab_group == self.get_id():\n self._selected = self.get_tab(tab_name)\n return self._selected",
"metadata": "root.TabGroup.get_selected_tab",
"header": "['class', 'TabGroup', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 188
},
{
"content": "class Tab(html.HTMLElement):\n \"\"\"A reusable interface for constructing a tab within a\n :class:`~horizon.tabs.TabGroup`.\n\n .. attribute:: name\n\n The display name for the tab which will be rendered as the text for\n the tab element in the HTML. Required.\n\n .. attribute:: slug\n\n The URL slug and id attribute for the tab. This should be unique for\n a given tab group. Required.\n\n .. attribute:: preload\n\n Determines whether the contents of the tab should be rendered into\n the page's HTML when the tab group is rendered, or whether it should\n be loaded dynamically when the tab is selected. Default: ``True``.\n\n .. attribute:: classes\n\n A list of CSS classes which should be displayed on this tab.\n\n .. attribute:: attrs\n\n A dictionary of HTML attributes which should be rendered into the\n markup for this tab.\n\n .. attribute:: load\n\n Read-only access to determine whether or not this tab's data should\n be loaded immediately.\n \"\"\"\n name = None\n slug = None\n preload = True\n _active = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.Tab",
"header": "['module', '___EOS___']",
"index": 203
},
{
"content": " def __init__(self, tab_group, request=None):\n super(Tab, self).__init__()\n # Priority: constructor, class-defined, fallback\n if not self.name:\n raise ValueError(\"%s must have a name.\" % self.__class__.__name__)\n self.name = unicode(self.name) # Force unicode.\n if not self.slug:\n raise ValueError(\"%s must have a slug.\" % self.__class__.__name__)\n self.tab_group = tab_group\n self.request = request\n if request:\n self._allowed = self.allowed(request)\n self._enabled = self.enabled(request)",
"metadata": "root.Tab.__init__",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 242
},
{
"content": " def __repr__(self):\n return \"<%s: %s>\" % (self.__class__.__name__, self.slug)",
"metadata": "root.Tab.__repr__",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 256
},
{
"content": " def is_active(self):\n \"\"\"Method to access whether or not this tab is the active tab.\"\"\"\n if self._active is None:\n self.tab_group._set_active_tab()\n return self._active",
"metadata": "root.Tab.is_active",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 259
},
{
"content": " @property\n def load(self):\n load_preloaded = self.preload or self.is_active()\n return load_preloaded and self._allowed and self._enabled",
"metadata": "root.Tab.load",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 265
},
{
"content": " @property\n def data(self):\n if getattr(self, \"_data\", None) is None:\n self._data = self.get_context_data(self.request)\n return self._data",
"metadata": "root.Tab.data",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 270
},
{
"content": " @property\n def data_loaded(self):\n return getattr(self, \"_data\", None) is not None",
"metadata": "root.Tab.data_loaded",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 276
},
{
"content": " def render(self):\n \"\"\"Renders the tab to HTML using the\n :meth:`~horizon.tabs.Tab.get_context_data` method and\n the :meth:`~horizon.tabs.Tab.get_template_name` method.\n\n If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load``\n is not ``True``, or\n either :meth:`~horizon.tabs.Tab.allowed` or\n :meth:`~horizon.tabs.Tab.enabled` returns ``False`` this method will\n return an empty string.\n \"\"\"\n if not self.load:\n return ''\n try:\n context = self.data\n except exceptions.Http302:\n raise\n except Exception:\n exc_type, exc_value, exc_traceback = sys.exc_info()\n raise TemplateSyntaxError, exc_value, exc_traceback\n return render_to_string(self.get_template_name(self.request), context)",
"metadata": "root.Tab.render",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 280
},
{
"content": " def get_id(self):\n \"\"\"Returns the id for this tab. Defaults to\n ``\"{{ tab_group.slug }}__{{ tab.slug }}\"``.\n \"\"\"\n return SEPARATOR.join([self.tab_group.slug, self.slug])",
"metadata": "root.Tab.get_id",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 302
},
{
"content": " def get_query_string(self):\n return \"=\".join((self.tab_group.param_name, self.get_id()))",
"metadata": "root.Tab.get_query_string",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 308
},
{
"content": " def get_default_classes(self):\n \"\"\"Returns a list of the default classes for the tab. Defaults to\n and empty list (``[]``), however additional classes may be added\n depending on the state of the tab as follows:\n\n If the tab is the active tab for the tab group, in which\n the class ``\"active\"`` will be added.\n\n If the tab is not enabled, the classes the class ``\"disabled\"``\n will be added.\n \"\"\"\n default_classes = super(Tab, self).get_default_classes()\n if self.is_active():\n default_classes.extend(CSS_ACTIVE_TAB_CLASSES)\n if not self._enabled:\n default_classes.extend(CSS_DISABLED_TAB_CLASSES)\n return default_classes",
"metadata": "root.Tab.get_default_classes",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 311
},
{
"content": " def get_template_name(self, request):\n \"\"\"Returns the name of the template to be used for rendering this tab.\n\n By default it returns the value of the ``template_name`` attribute\n on the ``Tab`` class.\n \"\"\"\n if not hasattr(self, \"template_name\"):\n raise AttributeError(\"%s must have a template_name attribute or \"\n \"override the get_template_name method.\"\n % self.__class__.__name__)\n return self.template_name",
"metadata": "root.Tab.get_template_name",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 329
},
{
"content": " def get_context_data(self, request):\n \"\"\"This method should return a dictionary of context data used to\n render the tab. Required.\n \"\"\"\n raise NotImplementedError(\"%s needs to define a get_context_data \"\n \"method.\" % self.__class__.__name__)",
"metadata": "root.Tab.get_context_data",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 341
},
{
"content": " def enabled(self, request):\n \"\"\"Determines whether or not the tab should be accessible\n (e.g. be rendered into the HTML on load and respond to a click event).\n\n If a tab returns ``False`` from ``enabled`` it will ignore the value\n of ``preload`` and only render the HTML of the tab after being clicked.\n\n The default behavior is to return ``True`` for all cases.\n \"\"\"\n return True",
"metadata": "root.Tab.enabled",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 348
},
{
"content": " def allowed(self, request):\n \"\"\"Determines whether or not the tab is displayed.\n\n Tab instances can override this method to specify conditions under\n which this tab should not be shown at all by returning ``False``.\n\n The default behavior is to return ``True`` for all cases.\n \"\"\"\n return True",
"metadata": "root.Tab.allowed",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 359
},
{
"content": " def post(self, request, *args, **kwargs):\n \"\"\"Handles POST data sent to a tab.\n\n Tab instances can override this method to have tab-specific POST logic\n without polluting the TabView code.\n\n The default behavior is to ignore POST data.\n \"\"\"\n pass",
"metadata": "root.Tab.post",
"header": "['class', 'Tab', '(', 'html', '.', 'HTMLElement', ')', ':', '___EOS___']",
"index": 369
},
{
"content": "class TableTab(Tab):\n \"\"\"A :class:`~horizon.tabs.Tab` class which knows how to deal with\n :class:`~horizon.tables.DataTable` classes rendered inside of it.\n\n This distinct class is required due to the complexity involved in handling\n both dynamic tab loading, dynamic table updating and table actions all\n within one view.\n\n .. attribute:: table_classes\n\n An iterable containing the :class:`~horizon.tables.DataTable` classes\n which this tab will contain. Equivalent to the\n :attr:`~horizon.tables.MultiTableView.table_classes` attribute on\n :class:`~horizon.tables.MultiTableView`. For each table class you\n need to define a corresponding ``get_{{ table_name }}_data`` method\n as with :class:`~horizon.tables.MultiTableView`.\n \"\"\"\n table_classes = None\n\n\n\n",
"metadata": "root.TableTab",
"header": "['module', '___EOS___']",
"index": 380
},
{
"content": " def __init__(self, tab_group, request):\n super(TableTab, self).__init__(tab_group, request)\n if not self.table_classes:\n class_name = self.__class__.__name__\n raise NotImplementedError(\"You must define a table_class \"\n \"attribute on %s\" % class_name)\n # Instantiate our table classes but don't assign data yet\n table_instances = [(table._meta.name,\n table(request, **tab_group.kwargs))\n for table in self.table_classes]\n self._tables = SortedDict(table_instances)\n self._table_data_loaded = False",
"metadata": "root.TableTab.__init__",
"header": "['class', 'TableTab', '(', 'Tab', ')', ':', '___EOS___']",
"index": 399
},
{
"content": " def load_table_data(self):\n \"\"\"Calls the ``get_{{ table_name }}_data`` methods for each table class\n and sets the data on the tables.\n \"\"\"\n # We only want the data to be loaded once, so we track if we have...\n if not self._table_data_loaded:\n for table_name, table in self._tables.items():\n # Fetch the data function.\n func_name = \"get_%s_data\" % table_name\n data_func = getattr(self, func_name, None)\n if data_func is None:\n cls_name = self.__class__.__name__\n raise NotImplementedError(\"You must define a %s method \"\n \"on %s.\" % (func_name, cls_name))\n # Load the data.\n table.data = data_func()\n table._meta.has_more_data = self.has_more_data(table)\n # Mark our data as loaded so we don't run the loaders again.\n self._table_data_loaded = True",
"metadata": "root.TableTab.load_table_data",
"header": "['class', 'TableTab', '(', 'Tab', ')', ':', '___EOS___']",
"index": 412
},
{
"content": " def get_context_data(self, request):\n \"\"\"Adds a ``{{ table_name }}_table`` item to the context for each table\n in the :attr:`~horizon.tabs.TableTab.table_classes` attribute.\n\n If only one table class is provided, a shortcut ``table`` context\n variable is also added containing the single table.\n \"\"\"\n context = {}\n # If the data hasn't been manually loaded before now,\n # make certain it's loaded before setting the context.\n self.load_table_data()\n for table_name, table in self._tables.items():\n # If there's only one table class, add a shortcut name as well.\n if len(self.table_classes) == 1:\n context[\"table\"] = table\n context[\"%s_table\" % table_name] = table\n return context",
"metadata": "root.TableTab.get_context_data",
"header": "['class', 'TableTab', '(', 'Tab', ')', ':', '___EOS___']",
"index": 432
},
{
"content": " def has_more_data(self, table):\n return False",
"metadata": "root.TableTab.has_more_data",
"header": "['class', 'TableTab', '(', 'Tab', ')', ':', '___EOS___']",
"index": 450
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"vim",
":",
" ",
"tabs",
"top",
"=",
"4",
" ",
"shift",
"widt",
"h",
"=",
"4",
" ",
"soft",
"tabs",
"top",
"=",
"4_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"Ne",
"bul",
"a",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"._",
"loader_",
"import_",
"render",
"\\u",
"to",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"import_",
"Templa",
"te",
"Syntax",
"Error_",
"#",
" ",
"no",
"qa_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"datastr",
"ucture",
"s_",
"import_",
"Sorte",
"d",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"exceptions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"._",
"utils_",
"import_",
"html_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SEPARATOR_",
"=_",
"\"\\u\\u",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CS",
"S",
"\\u",
"TAB",
"\\u",
"GROU",
"P",
"\\u",
"CLASSES_",
"=_",
"[_",
"\"",
"nav",
"\"_",
",_",
"\"",
"nav",
"-",
"tabs",
"\"_",
",_",
"\"",
"aja",
"x",
"-",
"tabs",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CS",
"S",
"\\u",
"ACTI",
"VE",
"\\u",
"TAB",
"\\u",
"CLASSES_",
"=_",
"[_",
"\"",
"active",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CS",
"S",
"\\u",
"DISABLED",
"\\u",
"TAB",
"\\u",
"CLASSES_",
"=_",
"[_",
"\"",
"disable",
"d",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"A",
" ",
"container",
" ",
"class",
" ",
"whi",
"ch",
" ",
"knows",
" ",
"how",
" ",
"to",
" ",
"manage",
" ",
"and",
" ",
"render",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
"`",
" ",
"object",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"slug",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"URL",
" ",
"slug",
" ",
"and",
" ",
"pseudo",
"-",
"unique",
" ",
"identifi",
"er",
" ",
"for",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"template",
"\\u",
"name",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"template",
" ",
"whi",
"ch",
" ",
"will",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"render",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Default",
":",
" ",
"``\"",
"horizon",
"/",
"common",
"/\\u",
"tab",
"\\u",
"group",
".",
"html",
"\"``",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"sticky",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Boo",
"lean",
" ",
"to",
" ",
"control",
" ",
"whe",
"ther",
" ",
"the",
" ",
"active",
" ",
"tab",
" ",
"state",
" ",
"shou",
"ld",
" ",
"be",
" ",
"store",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"acro",
"ss",
" ",
"request",
"s",
" ",
"for",
" ",
"a",
" ",
"give",
"n",
" ",
"user",
".",
" ",
"(",
"State",
" ",
"storage",
" ",
"is",
" ",
"all",
" ",
"don",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"client",
"-",
"side",
".)",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"param",
"\\u",
"name",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"GET",
" ",
"request",
" ",
"parameter",
" ",
"whi",
"ch",
" ",
"will",
" ",
"be",
" ",
"used",
" ",
"whe",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"request",
"ing",
" ",
"specific",
" ",
"tab",
" ",
"data",
".",
" ",
"Default",
":",
" ",
"``",
"tab",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"classe",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"CS",
"S",
" ",
"classe",
"s",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"be",
" ",
"displaye",
"d",
" ",
"on",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"attr",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"HTM",
"L",
" ",
"attribute",
"s",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"int",
"o",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"markup",
" ",
"for",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"selecte",
"d",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Read",
"-",
"only",
" ",
"property",
" ",
"whi",
"ch",
" ",
"is",
" ",
"set",
" ",
"to",
" ",
"the",
" ",
"instance",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"currentl",
"y",
"-",
"selecte",
"d",
" ",
"tab",
" ",
"if",
" ",
"there",
" ",
"is",
" ",
"one",
",",
" ",
"other",
"wis",
"e",
" ",
"``",
"Non",
"e",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"active",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Read",
"-",
"only",
" ",
"property",
" ",
"whi",
"ch",
" ",
"is",
" ",
"set",
" ",
"to",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"the",
" ",
"current",
" ",
"active",
" ",
"tab",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"may",
" ",
"not",
" ",
"be",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"``",
"selecte",
"d",
"``",
" ",
"if",
" ",
"no",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"specific",
" ",
"tab",
" ",
"was",
" ",
"request",
"ed",
" ",
"via",
" ",
"the",
" ",
"``",
"GET",
"``",
" ",
"parameter",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slug_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"template",
"\\u",
"name_",
"=_",
"\"",
"horizon",
"/",
"common",
"/\\u",
"tab",
"\\u",
"group",
".",
"html",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"param",
"\\u",
"name_",
"=_",
"'",
"tab",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sticky_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"selected_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"active_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"selected_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"selected_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\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_",
"active_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"active_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\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_",
",_",
"request_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Tab",
"Group_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"\"",
"tabs",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"'%",
"s",
" ",
"must",
" ",
"declar",
"e",
" ",
"a",
" ",
"\"",
"tabs",
"\"",
" ",
"attribute",
".'_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"request_",
"=_",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"kwargs_",
"=_",
"kwargs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"data_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tab",
"\\u",
"instances_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"tab_",
"in_",
"self_",
"._",
"tabs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tab",
"\\u",
"instances_",
"._",
"append_",
"(_",
"(_",
"tab_",
"._",
"slug_",
",_",
"tab_",
"(_",
"self_",
",_",
"request_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"tabs_",
"=_",
"Sorte",
"d",
"Dict_",
"(_",
"tab",
"\\u",
"instances_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"sticky_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"attrs_",
"[_",
"'",
"data",
"-",
"sticky",
"-",
"tabs",
"'_",
"]_",
"=_",
"'",
"sticky",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"set\\u",
"active",
"\\u",
"tab_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"tabs",
"\\u",
"not",
"\\u",
"available_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"repr\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"<",
"%",
"s",
":",
" ",
"%",
"s",
">\"_",
"%_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"self_",
"._",
"slug_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"load",
"\\u",
"tab",
"\\u",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Pre",
"load",
" ",
"all",
" ",
"data",
" ",
"tha",
"t",
" ",
"for",
" ",
"the",
" ",
"tabs",
" ",
"tha",
"t",
" ",
"will",
" ",
"be",
" ",
"displaye",
"d",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"tab_",
"in_",
"self_",
"._",
"\\u",
"tabs_",
"._",
"values_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tab_",
"._",
"load_",
"and_",
"not_",
"tab_",
"._",
"data\\u",
"loaded_",
":_",
"\\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 ",
" ",
"_",
"tab_",
"._",
"\\u",
"data_",
"=_",
"tab_",
"._",
"get",
"\\u",
"context",
"\\u",
"data_",
"(_",
"self_",
"._",
"request_",
")_",
"\\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 ",
" ",
"_",
"tab_",
"._",
"\\u",
"data_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exceptions_",
"._",
"handle_",
"(_",
"self_",
"._",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"id_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"id",
" ",
"for",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"the",
" ",
"tab",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"group",
"'",
"s",
" ",
":",
"attr",
":`",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"slug",
"`.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"slug_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"default",
"\\u",
"classes_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"the",
" ",
"default",
" ",
"classe",
"s",
" ",
"for",
" ",
"the",
" ",
"tab",
" ",
"group",
".",
" ",
"Default",
"s",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``[",
"\"",
"nav",
"\",",
" ",
"\"",
"nav",
"-",
"tabs",
"\",",
" ",
"\"",
"aja",
"x",
"-",
"tabs",
"\"]",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"default",
"\\u",
"classes_",
"=_",
"super_",
"(_",
"Tab",
"Group_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"default",
"\\u",
"classes_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"default",
"\\u",
"classes_",
"._",
"extend_",
"(_",
"CS",
"S",
"\\u",
"TAB",
"\\u",
"GROU",
"P",
"\\u",
"CLASSES_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"default",
"\\u",
"classes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tabs",
"\\u",
"not",
"\\u",
"available_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"In",
" ",
"the",
" ",
"event",
" ",
"tha",
"t",
" ",
"no",
" ",
"tabs",
" ",
"are",
" ",
"eit",
"her",
" ",
"allow",
"ed",
" ",
"or",
" ",
"enable",
"d",
",",
" ",
"this",
" ",
"method",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"the",
" ",
"fall",
"back",
" ",
"handler",
".",
" ",
"By",
" ",
"default",
" ",
"it",
"'",
"s",
" ",
"a",
" ",
"no",
"-",
"op",
",",
" ",
"but",
" ",
"it",
" ",
"exist",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"make",
" ",
"redirec",
"ting",
" ",
"or",
" ",
"rais",
"ing",
" ",
"exception",
"s",
" ",
"possib",
"le",
" ",
"for",
" ",
"subclasses",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"set\\u",
"active",
"\\u",
"tab_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"marked",
"\\u",
"active_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"if",
" ",
"we",
" ",
"have",
" ",
"a",
" ",
"selecte",
"d",
" ",
"tab",
" ",
"via",
" ",
"the",
" ",
"GET",
" ",
"parameter",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"tab_",
"=_",
"self_",
"._",
"get",
"\\u",
"selecte",
"d\\u",
"tab_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"tab_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tab_",
"._",
"\\u",
"active_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"active_",
"=_",
"tab_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"marked",
"\\u",
"active_",
"=_",
"tab_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Iterat",
"e",
" ",
"through",
" ",
"to",
" ",
"mark",
" ",
"them",
" ",
"all",
" ",
"according",
"ly",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"tab_",
"in_",
"self_",
"._",
"\\u",
"tabs_",
"._",
"values_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tab_",
"._",
"\\u",
"allowed_",
"and_",
"tab_",
"._",
"\\u",
"enabled_",
"and_",
"not_",
"marked",
"\\u",
"active_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tab_",
"._",
"\\u",
"active_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"active_",
"=_",
"tab_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"marked",
"\\u",
"active_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"tab_",
"==_",
"marked",
"\\u",
"active_",
":_",
"\\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_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tab_",
"._",
"\\u",
"active_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"marked",
"\\u",
"active_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Render",
"s",
" ",
"the",
" ",
"HTM",
"L",
" ",
"output",
" ",
"for",
" ",
"this",
" ",
"tab",
" ",
"group",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"self_",
"._",
"template",
"\\u",
"name_",
",_",
"{_",
"\"",
"tab",
"\\u",
"group",
"\"_",
":_",
"self_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"tabs_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"the",
" ",
"allow",
"ed",
" ",
"tabs",
" ",
"for",
" ",
"this",
" ",
"tab",
" ",
"group",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"filter_",
"(_",
"lambda_",
"tab_",
":_",
"tab_",
"._",
"\\u",
"allowed_",
",_",
"self_",
"._",
"\\u",
"tabs_",
"._",
"values_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"tab_",
"(_",
"self_",
",_",
"tab",
"\\u",
"name_",
",_",
"allow",
"\\u",
"disabled_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"specific",
" ",
"tab",
" ",
"from",
" ",
"this",
" ",
"tab",
" ",
"group",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"not",
" ",
"allow",
"ed",
" ",
"or",
" ",
"not",
" ",
"enable",
"d",
" ",
"this",
" ",
"method",
" ",
"return",
"s",
" ",
"``",
"Non",
"e",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"disable",
"d",
" ",
"but",
" ",
"you",
" ",
"wish",
" ",
"to",
" ",
"return",
" ",
"it",
" ",
"anyway",
",",
" ",
"you",
" ",
"can",
" ",
"pass",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"Tru",
"e",
"``",
" ",
"to",
" ",
"the",
" ",
"allow",
"\\u",
"disable",
"d",
" ",
"argu",
"ment",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tab_",
"=_",
"self_",
"._",
"\\u",
"tabs_",
"._",
"get_",
"(_",
"tab",
"\\u",
"name_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"tab_",
"and_",
"tab_",
"._",
"\\u",
"allowed_",
"and_",
"(_",
"tab_",
"._",
"\\u",
"enabled_",
"or_",
"allow",
"\\u",
"disabled_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"tab_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"load",
"ed",
"\\u",
"tabs_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter_",
"(_",
"lambda_",
"t_",
":_",
"self_",
"._",
"get",
"\\u",
"tab_",
"(_",
"t_",
"._",
"slug_",
")_",
",_",
"self_",
"._",
"\\u",
"tabs_",
"._",
"values_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab",
"Group_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"selecte",
"d\\u",
"tab_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"tab",
" ",
"specific",
" ",
"by",
" ",
"the",
" ",
"GET",
" ",
"request",
" ",
"parameter",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"In",
" ",
"the",
" ",
"event",
" ",
"tha",
"t",
" ",
"there",
" ",
"is",
" ",
"no",
" ",
"GET",
" ",
"request",
" ",
"parameter",
",",
" ",
"the",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"the",
" ",
"query",
" ",
"parameter",
" ",
"is",
" ",
"invalid",
",",
" ",
"or",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"not",
" ",
"allow",
"ed",
"/",
"enable",
"d",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"return",
" ",
"value",
" ",
"of",
" ",
"this",
" ",
"function",
" ",
"is",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"selected_",
"=_",
"self_",
"._",
"request_",
"._",
"GET_",
"._",
"get_",
"(_",
"self_",
"._",
"param",
"\\u",
"name_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"selected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tab",
"\\u",
"group_",
",_",
"tab",
"\\u",
"name_",
"=_",
"selected_",
"._",
"split_",
"(_",
"SEPARATOR_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"tab",
"\\u",
"group_",
"==_",
"self_",
"._",
"get",
"\\u",
"id_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"selected_",
"=_",
"self_",
"._",
"get",
"\\u",
"tab_",
"(_",
"tab",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"selected_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"A",
" ",
"reus",
"able",
" ",
"interface",
" ",
"for",
" ",
"constructi",
"ng",
" ",
"a",
" ",
"tab",
" ",
"within",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
"Group",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"name",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"display",
" ",
"name",
" ",
"for",
" ",
"the",
" ",
"tab",
" ",
"whi",
"ch",
" ",
"will",
" ",
"be",
" ",
"render",
"ed",
" ",
"as",
" ",
"the",
" ",
"text",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"tab",
" ",
"element",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
".",
" ",
"Requ",
"ired",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"slug",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"URL",
" ",
"slug",
" ",
"and",
" ",
"id",
" ",
"attribute",
" ",
"for",
" ",
"the",
" ",
"tab",
".",
" ",
"Thi",
"s",
" ",
"shou",
"ld",
" ",
"be",
" ",
"unique",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"give",
"n",
" ",
"tab",
" ",
"group",
".",
" ",
"Requ",
"ired",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"prelo",
"ad",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Det",
"erm",
"ine",
"s",
" ",
"whe",
"ther",
" ",
"the",
" ",
"content",
"s",
" ",
"of",
" ",
"the",
" ",
"tab",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"int",
"o",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"page",
"'",
"s",
" ",
"HTM",
"L",
" ",
"whe",
"n",
" ",
"the",
" ",
"tab",
" ",
"group",
" ",
"is",
" ",
"render",
"ed",
",",
" ",
"or",
" ",
"whe",
"ther",
" ",
"it",
" ",
"shou",
"ld",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"load",
"ed",
" ",
"dynami",
"call",
"y",
" ",
"whe",
"n",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"selecte",
"d",
".",
" ",
"Default",
":",
" ",
"``",
"Tru",
"e",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"classe",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"CS",
"S",
" ",
"classe",
"s",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"be",
" ",
"displaye",
"d",
" ",
"on",
" ",
"this",
" ",
"tab",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"attr",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"HTM",
"L",
" ",
"attribute",
"s",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"int",
"o",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"markup",
" ",
"for",
" ",
"this",
" ",
"tab",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"load",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Read",
"-",
"only",
" ",
"access",
" ",
"to",
" ",
"dete",
"rmin",
"e",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"this",
" ",
"tab",
"'",
"s",
" ",
"data",
" ",
"shou",
"ld",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"load",
"ed",
" ",
"immediate",
"ly",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slug_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prelo",
"ad_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"active_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"tab",
"\\u",
"group_",
",_",
"request_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Tab_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Prior",
"it",
"y",
":",
" ",
"construct",
"or",
",",
" ",
"class",
"-",
"defin",
"ed",
",",
" ",
"fallback_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"%",
"s",
" ",
"must",
" ",
"have",
" ",
"a",
" ",
"name",
".\"_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"unicode_",
"(_",
"self_",
"._",
"name_",
")_",
"#",
" ",
"Force",
" ",
"unicode",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"slug_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"%",
"s",
" ",
"must",
" ",
"have",
" ",
"a",
" ",
"slug",
".\"_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"tab",
"\\u",
"group_",
"=_",
"tab",
"\\u",
"group_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"request_",
"=_",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"allowed_",
"=_",
"self_",
"._",
"allowed_",
"(_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"enabled_",
"=_",
"self_",
"._",
"enabled_",
"(_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"repr\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"<",
"%",
"s",
":",
" ",
"%",
"s",
">\"_",
"%_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"self_",
"._",
"slug_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"is",
"\\u",
"active_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Meth",
"od",
" ",
"to",
" ",
"access",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"this",
" ",
"tab",
" ",
"is",
" ",
"the",
" ",
"active",
" ",
"tab",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"active_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"tab",
"\\u",
"group_",
"._",
"\\u",
"set\\u",
"active",
"\\u",
"tab_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"active_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\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_",
"load_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"load",
"\\u",
"prelo",
"aded",
"_",
"=_",
"self_",
"._",
"prelo",
"ad_",
"or_",
"self_",
"._",
"is",
"\\u",
"active_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"load",
"\\u",
"prelo",
"aded",
"_",
"and_",
"self_",
"._",
"\\u",
"allowed_",
"and_",
"self_",
"._",
"\\u",
"enabled_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\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_",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"getattr_",
"(_",
"self_",
",_",
"\"\\u",
"data",
"\"_",
",_",
"None_",
")_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"data_",
"=_",
"self_",
"._",
"get",
"\\u",
"context",
"\\u",
"data_",
"(_",
"self_",
"._",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\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_",
"data\\u",
"loaded_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"getattr_",
"(_",
"self_",
",_",
"\"\\u",
"data",
"\"_",
",_",
"None_",
")_",
"is_",
"not_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Render",
"s",
" ",
"the",
" ",
"tab",
" ",
"to",
" ",
"HTM",
"L",
" ",
"usi",
"ng",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"meth",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"get",
"\\u",
"context",
"\\u",
"data",
"`",
" ",
"method",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
":",
"meth",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"get",
"\\u",
"template",
"\\u",
"name",
"`",
" ",
"method",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
":",
"attr",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"prelo",
"ad",
"`",
" ",
"is",
" ",
"``",
"Fal",
"se",
"``",
" ",
"and",
" ",
"``",
"force",
"\\u",
"load",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"not",
" ",
"``",
"Tru",
"e",
"``",
",",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"eit",
"her",
" ",
":",
"meth",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"allow",
"ed",
"`",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"meth",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
".",
"enable",
"d",
"`",
" ",
"return",
"s",
" ",
"``",
"Fal",
"se",
"``",
" ",
"this",
" ",
"method",
" ",
"will",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"return",
" ",
"an",
" ",
"empty",
" ",
"string",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"load_",
":_",
"\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"self_",
"._",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exceptions_",
"._",
"Http",
"302_",
":_",
"\\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_",
"Exception_",
":_",
"\\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_",
"raise_",
"Templa",
"te",
"Syntax",
"Error_",
",_",
"exc",
"\\u",
"value_",
",_",
"exc",
"\\u",
"traceback_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"self_",
"._",
"get",
"\\u",
"template",
"\\u",
"name_",
"(_",
"self_",
"._",
"request_",
")_",
",_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"id_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"id",
" ",
"for",
" ",
"this",
" ",
"tab",
".",
" ",
"Default",
"s",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``\"",
"{{",
" ",
"tab",
"\\u",
"group",
".",
"slug",
" ",
"}}\\",
"u\\u",
"{{",
" ",
"tab",
".",
"slug",
" ",
"}}",
"\"``",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"SEPARATOR_",
"._",
"join_",
"(_",
"[_",
"self_",
"._",
"tab",
"\\u",
"group_",
"._",
"slug_",
",_",
"self_",
"._",
"slug_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"query",
"\\u",
"string_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"=\"_",
"._",
"join_",
"(_",
"(_",
"self_",
"._",
"tab",
"\\u",
"group_",
"._",
"param",
"\\u",
"name_",
",_",
"self_",
"._",
"get",
"\\u",
"id_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"default",
"\\u",
"classes_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"the",
" ",
"default",
" ",
"classe",
"s",
" ",
"for",
" ",
"the",
" ",
"tab",
".",
" ",
"Default",
"s",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"empty",
" ",
"list",
" ",
"(",
"``[",
"]``",
"),",
" ",
"how",
"ever",
" ",
"addition",
"al",
" ",
"classe",
"s",
" ",
"may",
" ",
"be",
" ",
"adde",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"depend",
"ing",
" ",
"on",
" ",
"the",
" ",
"state",
" ",
"of",
" ",
"the",
" ",
"tab",
" ",
"as",
" ",
"follow",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"the",
" ",
"active",
" ",
"tab",
" ",
"for",
" ",
"the",
" ",
"tab",
" ",
"group",
",",
" ",
"in",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"class",
" ",
"``\"",
"active",
"\"``",
" ",
"will",
" ",
"be",
" ",
"adde",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"not",
" ",
"enable",
"d",
",",
" ",
"the",
" ",
"classe",
"s",
" ",
"the",
" ",
"class",
" ",
"``\"",
"disable",
"d",
"\"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"will",
" ",
"be",
" ",
"adde",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"default",
"\\u",
"classes_",
"=_",
"super_",
"(_",
"Tab_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"default",
"\\u",
"classes_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"is",
"\\u",
"active_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"default",
"\\u",
"classes_",
"._",
"extend_",
"(_",
"CS",
"S",
"\\u",
"ACTI",
"VE",
"\\u",
"TAB",
"\\u",
"CLASSES_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"enabled_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"default",
"\\u",
"classes_",
"._",
"extend_",
"(_",
"CS",
"S",
"\\u",
"DISABLED",
"\\u",
"TAB",
"\\u",
"CLASSES_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"default",
"\\u",
"classes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"template",
"\\u",
"name_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"template",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"render",
"ing",
" ",
"this",
" ",
"tab",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"By",
" ",
"default",
" ",
"it",
" ",
"return",
"s",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"the",
" ",
"``",
"template",
"\\u",
"name",
"``",
" ",
"attribute",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"on",
" ",
"the",
" ",
"``",
"Tab",
"``",
" ",
"class",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"\"",
"template",
"\\u",
"name",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Attribute",
"Error_",
"(_",
"\"%",
"s",
" ",
"must",
" ",
"have",
" ",
"a",
" ",
"template",
"\\u",
"name",
" ",
"attribute",
" ",
"or",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"override",
" ",
"the",
" ",
"get",
"\\u",
"template",
"\\u",
"name",
" ",
"method",
".\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"template",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"context",
"\\u",
"data_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Thi",
"s",
" ",
"method",
" ",
"shou",
"ld",
" ",
"return",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"context",
" ",
"data",
" ",
"used",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"render",
" ",
"the",
" ",
"tab",
".",
" ",
"Requ",
"ired",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"\"%",
"s",
" ",
"need",
"s",
" ",
"to",
" ",
"defin",
"e",
" ",
"a",
" ",
"get",
"\\u",
"context",
"\\u",
"data",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"method",
".\"_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"enabled_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Det",
"erm",
"ine",
"s",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"the",
" ",
"tab",
" ",
"shou",
"ld",
" ",
"be",
" ",
"accessible",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"e",
".",
"g",
".",
" ",
"be",
" ",
"render",
"ed",
" ",
"int",
"o",
" ",
"the",
" ",
"HTM",
"L",
" ",
"on",
" ",
"load",
" ",
"and",
" ",
"respond",
" ",
"to",
" ",
"a",
" ",
"click",
" ",
"event",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"a",
" ",
"tab",
" ",
"return",
"s",
" ",
"``",
"Fal",
"se",
"``",
" ",
"from",
" ",
"``",
"enable",
"d",
"``",
" ",
"it",
" ",
"will",
" ",
"ignore",
" ",
"the",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"``",
"prelo",
"ad",
"``",
" ",
"and",
" ",
"only",
" ",
"render",
" ",
"the",
" ",
"HTM",
"L",
" ",
"of",
" ",
"the",
" ",
"tab",
" ",
"after",
" ",
"bei",
"ng",
" ",
"click",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"default",
" ",
"behavior",
" ",
"is",
" ",
"to",
" ",
"return",
" ",
"``",
"Tru",
"e",
"``",
" ",
"for",
" ",
"all",
" ",
"case",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"allowed_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Det",
"erm",
"ine",
"s",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"the",
" ",
"tab",
" ",
"is",
" ",
"displaye",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tab",
" ",
"instance",
"s",
" ",
"can",
" ",
"override",
" ",
"this",
" ",
"method",
" ",
"to",
" ",
"speci",
"fy",
" ",
"condition",
"s",
" ",
"under",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"whi",
"ch",
" ",
"this",
" ",
"tab",
" ",
"shou",
"ld",
" ",
"not",
" ",
"be",
" ",
"shown",
" ",
"at",
" ",
"all",
" ",
"by",
" ",
"return",
"ing",
" ",
"``",
"Fal",
"se",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"default",
" ",
"behavior",
" ",
"is",
" ",
"to",
" ",
"return",
" ",
"``",
"Tru",
"e",
"``",
" ",
"for",
" ",
"all",
" ",
"case",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tab_",
"(_",
"html_",
"._",
"HTM",
"LE",
"lement",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"post_",
"(_",
"self_",
",_",
"request_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Handle",
"s",
" ",
"POST",
" ",
"data",
" ",
"sent",
" ",
"to",
" ",
"a",
" ",
"tab",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tab",
" ",
"instance",
"s",
" ",
"can",
" ",
"override",
" ",
"this",
" ",
"method",
" ",
"to",
" ",
"have",
" ",
"tab",
"-",
"specific",
" ",
"POST",
" ",
"logic",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"with",
"out",
" ",
"poll",
"uti",
"ng",
" ",
"the",
" ",
"Tab",
"View",
" ",
"code",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"default",
" ",
"behavior",
" ",
"is",
" ",
"to",
" ",
"ignore",
" ",
"POST",
" ",
"data",
".",
"\\",
"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_",
"Table",
"Tab_",
"(_",
"Tab_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"A",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Tab",
"`",
" ",
"class",
" ",
"whi",
"ch",
" ",
"knows",
" ",
"how",
" ",
"to",
" ",
"deal",
" ",
"with",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tables",
".",
"Data",
"Table",
"`",
" ",
"classe",
"s",
" ",
"render",
"ed",
" ",
"insi",
"de",
" ",
"of",
" ",
"it",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"distinct",
" ",
"class",
" ",
"is",
" ",
"require",
"d",
" ",
"due",
" ",
"to",
" ",
"the",
" ",
"complex",
"it",
"y",
" ",
"involved",
" ",
"in",
" ",
"handling",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bot",
"h",
" ",
"dynami",
"c",
" ",
"tab",
" ",
"load",
"ing",
",",
" ",
"dynami",
"c",
" ",
"table",
" ",
"updat",
"ing",
" ",
"and",
" ",
"table",
" ",
"action",
"s",
" ",
"all",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"within",
" ",
"one",
" ",
"view",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"attribute",
"::",
" ",
"table",
"\\u",
"classe",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"iterable",
" ",
"contain",
"ing",
" ",
"the",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tables",
".",
"Data",
"Table",
"`",
" ",
"classe",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"whi",
"ch",
" ",
"this",
" ",
"tab",
" ",
"will",
" ",
"contain",
".",
" ",
"Equivalent",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"attr",
":`",
"~",
"horizon",
".",
"tables",
".",
"Multi",
"Table",
"View",
".",
"table",
"\\u",
"classe",
"s",
"`",
" ",
"attribute",
" ",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tables",
".",
"Multi",
"Table",
"View",
"`.",
" ",
"For",
" ",
"each",
" ",
"table",
" ",
"class",
" ",
"you",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"need",
" ",
"to",
" ",
"defin",
"e",
" ",
"a",
" ",
"correspond",
"ing",
" ",
"``",
"get",
"\\u{",
"{",
" ",
"table",
"\\u",
"name",
" ",
"}}\\",
"uda",
"ta",
"``",
" ",
"method",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"as",
" ",
"with",
" ",
":",
"class",
":`",
"~",
"horizon",
".",
"tables",
".",
"Multi",
"Table",
"View",
"`.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"classes_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Table",
"Tab_",
"(_",
"Tab_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"tab",
"\\u",
"group_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Table",
"Tab_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"tab",
"\\u",
"group_",
",_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"table",
"\\u",
"classes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class",
"\\u",
"name_",
"=_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"\"",
"You",
" ",
"must",
" ",
"defin",
"e",
" ",
"a",
" ",
"table",
"\\u",
"class",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"attribute",
" ",
"on",
" ",
"%",
"s",
"\"_",
"%_",
"class",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Instantiate",
" ",
"our",
" ",
"table",
" ",
"classe",
"s",
" ",
"but",
" ",
"don",
"'",
"t",
" ",
"assign",
" ",
"data",
" ",
"ye",
"t_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"table",
"\\u",
"instances_",
"=_",
"[_",
"(_",
"table_",
"._",
"\\u",
"meta_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"(_",
"request_",
",_",
"**_",
"tab",
"\\u",
"group_",
"._",
"kwargs_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"table_",
"in_",
"self_",
"._",
"table",
"\\u",
"classes_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"tables_",
"=_",
"Sorte",
"d",
"Dict_",
"(_",
"table",
"\\u",
"instances_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"table",
"\\u",
"data\\u",
"loaded_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Table",
"Tab_",
"(_",
"Tab_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"load",
"\\u",
"table",
"\\u",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Calls",
" ",
"the",
" ",
"``",
"get",
"\\u{",
"{",
" ",
"table",
"\\u",
"name",
" ",
"}}\\",
"uda",
"ta",
"``",
" ",
"method",
"s",
" ",
"for",
" ",
"each",
" ",
"table",
" ",
"class",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"sets",
" ",
"the",
" ",
"data",
" ",
"on",
" ",
"the",
" ",
"tables",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"only",
" ",
"want",
" ",
"the",
" ",
"data",
" ",
"to",
" ",
"be",
" ",
"load",
"ed",
" ",
"onc",
"e",
",",
" ",
"so",
" ",
"we",
" ",
"track",
" ",
"if",
" ",
"we",
" ",
"have",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"table",
"\\u",
"data\\u",
"loaded_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"table",
"\\u",
"name_",
",_",
"table_",
"in_",
"self_",
"._",
"\\u",
"tables_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fe",
"tch",
" ",
"the",
" ",
"data",
" ",
"function",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"func",
"\\u",
"name_",
"=_",
"\"",
"get",
"\\u",
"%",
"s",
"\\u",
"data",
"\"_",
"%_",
"table",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"func_",
"=_",
"getattr_",
"(_",
"self_",
",_",
"func",
"\\u",
"name_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"data\\u",
"func_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"cls",
"\\u",
"name_",
"=_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"\"",
"You",
" ",
"must",
" ",
"defin",
"e",
" ",
"a",
" ",
"%",
"s",
" ",
"method",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"on",
" ",
"%",
"s",
".\"_",
"%_",
"(_",
"func",
"\\u",
"name_",
",_",
"cls",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Load",
" ",
"the",
" ",
"data",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"table_",
"._",
"data_",
"=_",
"data\\u",
"func_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table_",
"._",
"\\u",
"meta_",
"._",
"has",
"\\u",
"more",
"\\u",
"data_",
"=_",
"self_",
"._",
"has",
"\\u",
"more",
"\\u",
"data_",
"(_",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Mark",
" ",
"our",
" ",
"data",
" ",
"as",
" ",
"load",
"ed",
" ",
"so",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"run",
" ",
"the",
" ",
"load",
"ers",
" ",
"again",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"table",
"\\u",
"data\\u",
"loaded_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Table",
"Tab_",
"(_",
"Tab_",
")_",
":_",
"\\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",
"context",
"\\u",
"data_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Add",
"s",
" ",
"a",
" ",
"``",
"{{",
" ",
"table",
"\\u",
"name",
" ",
"}}\\",
"uta",
"ble",
"``",
" ",
"item",
" ",
"to",
" ",
"the",
" ",
"context",
" ",
"for",
" ",
"each",
" ",
"table",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
":",
"attr",
":`",
"~",
"horizon",
".",
"tabs",
".",
"Table",
"Tab",
".",
"table",
"\\u",
"classe",
"s",
"`",
" ",
"attribute",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"only",
" ",
"one",
" ",
"table",
" ",
"class",
" ",
"is",
" ",
"provided",
",",
" ",
"a",
" ",
"shortcut",
" ",
"``",
"table",
"``",
" ",
"context",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"variab",
"le",
" ",
"is",
" ",
"als",
"o",
" ",
"adde",
"d",
" ",
"contain",
"ing",
" ",
"the",
" ",
"single",
" ",
"table",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"the",
" ",
"data",
" ",
"hasn",
"'",
"t",
" ",
"bee",
"n",
" ",
"manu",
"ally",
" ",
"load",
"ed",
" ",
"bef",
"ore",
" ",
"now",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"make",
" ",
"cert",
"ain",
" ",
"it",
"'",
"s",
" ",
"load",
"ed",
" ",
"bef",
"ore",
" ",
"setti",
"ng",
" ",
"the",
" ",
"context",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"load",
"\\u",
"table",
"\\u",
"data_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"table",
"\\u",
"name_",
",_",
"table_",
"in_",
"self_",
"._",
"\\u",
"tables_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"there",
"'",
"s",
" ",
"only",
" ",
"one",
" ",
"table",
" ",
"class",
",",
" ",
"add",
" ",
"a",
" ",
"shortcut",
" ",
"name",
" ",
"as",
" ",
"well",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"self_",
"._",
"table",
"\\u",
"classes_",
")_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"\"",
"table",
"\"_",
"]_",
"=_",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"context_",
"[_",
"\"%",
"s",
"\\u",
"table",
"\"_",
"%_",
"table",
"\\u",
"name_",
"]_",
"=_",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Table",
"Tab_",
"(_",
"Tab_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"has",
"\\u",
"more",
"\\u",
"data_",
"(_",
"self_",
",_",
"table_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Comparison of constants | rougier/freetype-py/examples/wordle.py | [
{
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n#\n# FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier\n# Distributed under the terms of the new BSD license.\n#\n# -----------------------------------------------------------------------------\nimport math\nimport numpy as np\nfrom freetype import *\nimport matplotlib.pyplot as plt\n\n\n\n\nif __name__ == '__main__':\n from PIL import Image\n\n n_words = 100\n H, W, dpi = 600, 800, 72.0\n I = np.zeros((H, W, 3), dtype=np.ubyte)\n S = np.random.normal(0,1,n_words)\n S = (S-S.min())/(S.max()-S.min())\n S = np.sort(1-np.sqrt(S))[::-1]\n sizes = (12 + S*48).astype(int).tolist()\n\n\n fails = 0\n for size in sizes:\n angle = np.random.randint(-25,25)\n L = make_label('Hello', './Vera.ttf', size, angle=angle)\n h,w = L.shape\n if h < H and w < W:\n x0 = W//2 + (np.random.uniform()-.1)*50\n y0 = H//2 + (np.random.uniform()-.1)*50\n for dx,dy in spiral():\n c = .25+.75*np.random.random()\n x = int(x0+dx)\n y = int(y0+dy)\n if x <= w//2 or y <= h//2 or x >= (W-w//2) or y >= (H-h//2):\n fails += 1\n break\n if (I[y-h//2:y-h//2+h, x-w//2:x-w//2+w,0] * L).sum() == 0:\n I[y-h//2:y-h//2+h, x-w//2:x-w//2+w,0] |= (c * L).astype(int)\n I[y-h//2:y-h//2+h, x-w//2:x-w//2+w,1] |= (c * L).astype(int)\n I[y-h//2:y-h//2+h, x-w//2:x-w//2+w,2] |= (c * L).astype(int)\n break\n\n print (\"Number of fails: {}\".format(fails))\n fig = plt.figure(figsize=(W/dpi,H/dpi), dpi=dpi)\n ax = fig.add_axes([0,0,1,1], frameon=False)\n ax.imshow(I, interpolation='nearest', cmap=plt.cm.gray, origin='upper')\n #plt.axis('off')\n plt.show()\n I = Image.fromarray(I[::-1,::1,::1], mode='RGB')\n I.save('wordle.png')\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"-------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Free",
"Type",
" ",
"high",
"-",
"level",
" ",
"python",
" ",
"API",
" ",
"-",
" ",
"Copy",
"right",
" ",
"2011",
"-",
"201",
"5",
" ",
"Nic",
"ola",
"s",
" ",
"P",
".",
" ",
"Rou",
"gie",
"r_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Distribut",
"ed",
" ",
"under",
" ",
"the",
" ",
"term",
"s",
" ",
"of",
" ",
"the",
" ",
"new",
" ",
"BS",
"D",
" ",
"license",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"-------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"math_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"free",
"type_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"matplotlib_",
"._",
"pyplot_",
"as_",
"plt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"PIL_",
"import_",
"Image_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"n",
"\\u",
"words_",
"=_",
"100_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"H_",
",_",
"W_",
",_",
"dpi_",
"=_",
"600_",
",_",
"800_",
",_",
"72.",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"I_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"(_",
"H_",
",_",
"W_",
",_",
"3_",
")_",
",_",
"dtype_",
"=_",
"np_",
"._",
"ubyte_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"S_",
"=_",
"np_",
"._",
"random_",
"._",
"normal_",
"(_",
"0_",
",_",
"1_",
",_",
"n",
"\\u",
"words_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"S_",
"=_",
"(_",
"S_",
"-_",
"S_",
"._",
"min_",
"(_",
")_",
")_",
"/_",
"(_",
"S_",
"._",
"max_",
"(_",
")_",
"-_",
"S_",
"._",
"min_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"S_",
"=_",
"np_",
"._",
"sort_",
"(_",
"1_",
"-_",
"np_",
"._",
"sqrt_",
"(_",
"S_",
")_",
")_",
"[_",
":_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sizes_",
"=_",
"(_",
"12_",
"+_",
"S_",
"*_",
"48_",
")_",
"._",
"astype_",
"(_",
"int_",
")_",
"._",
"tolist_",
"(_",
")_",
"\\u\\u\\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_",
"fails_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"size_",
"in_",
"sizes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"angle_",
"=_",
"np_",
"._",
"random_",
"._",
"randint_",
"(_",
"-_",
"25_",
",_",
"25_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"L_",
"=_",
"make",
"\\u",
"label_",
"(_",
"'",
"Hell",
"o",
"'_",
",_",
"'./",
"Ver",
"a",
".",
"tt",
"f",
"'_",
",_",
"size_",
",_",
"angle_",
"=_",
"angle_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"h_",
",_",
"w_",
"=_",
"L_",
"._",
"shape_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"h_",
"<_",
"H_",
"and_",
"w_",
"<_",
"W_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x0_",
"=_",
"W_",
"//_",
"2_",
"+_",
"(_",
"np_",
"._",
"random_",
"._",
"uniform_",
"(_",
")_",
"-_",
".1_",
")_",
"*_",
"50_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y0_",
"=_",
"H_",
"//_",
"2_",
"+_",
"(_",
"np_",
"._",
"random_",
"._",
"uniform_",
"(_",
")_",
"-_",
".1_",
")_",
"*_",
"50_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"dx_",
",_",
"dy_",
"in_",
"spir",
"al_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
".25_",
"+_",
".75",
"_",
"*_",
"np_",
"._",
"random_",
"._",
"random_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"int_",
"(_",
"x0_",
"+_",
"dx_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y_",
"=_",
"int_",
"(_",
"y0_",
"+_",
"dy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"x_",
"<=_",
"w_",
"//_",
"2_",
"or_",
"y_",
"<=_",
"h_",
"//_",
"2_",
"or_",
"x_",
">=_",
"(_",
"W_",
"-_",
"w_",
"//_",
"2_",
")_",
"or_",
"y_",
">=_",
"(_",
"H_",
"-_",
"h_",
"//_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"fails_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"(_",
"I_",
"[_",
"y_",
"-_",
"h_",
"//_",
"2_",
":_",
"y_",
"-_",
"h_",
"//_",
"2_",
"+_",
"h_",
",_",
"x_",
"-_",
"w_",
"//_",
"2_",
":_",
"x_",
"-_",
"w_",
"//_",
"2_",
"+_",
"w_",
",_",
"0_",
"]_",
"*_",
"L_",
")_",
"._",
"sum_",
"(_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"I_",
"[_",
"y_",
"-_",
"h_",
"//_",
"2_",
":_",
"y_",
"-_",
"h_",
"//_",
"2_",
"+_",
"h_",
",_",
"x_",
"-_",
"w_",
"//_",
"2_",
":_",
"x_",
"-_",
"w_",
"//_",
"2_",
"+_",
"w_",
",_",
"0_",
"]_",
"|=_",
"(_",
"c_",
"*_",
"L_",
")_",
"._",
"astype_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"I_",
"[_",
"y_",
"-_",
"h_",
"//_",
"2_",
":_",
"y_",
"-_",
"h_",
"//_",
"2_",
"+_",
"h_",
",_",
"x_",
"-_",
"w_",
"//_",
"2_",
":_",
"x_",
"-_",
"w_",
"//_",
"2_",
"+_",
"w_",
",_",
"1_",
"]_",
"|=_",
"(_",
"c_",
"*_",
"L_",
")_",
"._",
"astype_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"I_",
"[_",
"y_",
"-_",
"h_",
"//_",
"2_",
":_",
"y_",
"-_",
"h_",
"//_",
"2_",
"+_",
"h_",
",_",
"x_",
"-_",
"w_",
"//_",
"2_",
":_",
"x_",
"-_",
"w_",
"//_",
"2_",
"+_",
"w_",
",_",
"2_",
"]_",
"|=_",
"(_",
"c_",
"*_",
"L_",
")_",
"._",
"astype_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"(_",
"\"",
"Number",
" ",
"of",
" ",
"fail",
"s",
":",
" ",
"{}\"_",
"._",
"format_",
"(_",
"fails_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fig_",
"=_",
"plt_",
"._",
"figure_",
"(_",
"figsize_",
"=_",
"(_",
"W_",
"/_",
"dpi_",
",_",
"H_",
"/_",
"dpi_",
")_",
",_",
"dpi_",
"=_",
"dpi_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ax_",
"=_",
"fig_",
"._",
"add",
"\\u",
"axes_",
"(_",
"[_",
"0_",
",_",
"0_",
",_",
"1_",
",_",
"1_",
"]_",
",_",
"frame",
"on_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ax_",
"._",
"imshow_",
"(_",
"I_",
",_",
"interpolation_",
"=_",
"'",
"near",
"est",
"'_",
",_",
"cmap_",
"=_",
"plt_",
"._",
"cm_",
"._",
"gray_",
",_",
"origin_",
"=_",
"'",
"upper",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"plt",
".",
"axis",
"('",
"off",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"plt_",
"._",
"show_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"I_",
"=_",
"Image_",
"._",
"froma",
"rray_",
"(_",
"I_",
"[_",
":_",
":_",
"-_",
"1_",
",_",
":_",
":_",
"1_",
",_",
":_",
":_",
"1_",
"]_",
",_",
"mode_",
"=_",
"'",
"RGB",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"I_",
"._",
"save_",
"(_",
"'",
"word",
"le",
".",
"png",
"'_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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
] |
Unused local variable | jmcnamara/XlsxWriter/xlsxwriter/test/helperfunctions.py | [
{
"content": "def _vml_to_list(vml_str):\n # Convert an Excel generated VML string into a list for comparison testing.\n #\n # The VML data in the testcases is taken from Excel 2007 files. The data\n # has to be massaged significantly to make it suitable for comparison.\n #\n # The VML produced by XlsxWriter can be parsed as ordinary XML.\n vml_str = vml_str.replace(\"\\r\", \"\")\n\n vml = vml_str.split(\"\\n\")\n vml_str = ''\n\n for line in vml:\n # Skip blank lines.\n if not line:\n continue\n\n # Strip leading and trailing whitespace.\n line = line.strip()\n\n # Convert VMLs attribute quotes.\n line = line.replace(\"'\", '\"')\n\n # Add space between attributes.\n if re.search('\"$', line):\n line += \" \"\n\n # Add newline after element end.\n if re.search('>$', line):\n line += \"\\n\"\n\n # Split multiple elements.\n line = line.replace('><', \">\\n<\")\n\n # Put all of Anchor on one line.\n if line == \"<x:Anchor>\\n\":\n line = line.strip()\n\n vml_str += line\n\n # Remove the final newline.\n vml_str = vml_str.rstrip()\n\n return vml_str.split(\"\\n\")",
"metadata": "root._vml_to_list",
"header": "['module', '___EOS___']",
"index": 34
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"vm",
"l\\u",
"to",
"\\u",
"list_",
"(_",
"vm",
"l\\u",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"an",
" ",
"Exce",
"l",
" ",
"generat",
"ed",
" ",
"VM",
"L",
" ",
"string",
" ",
"int",
"o",
" ",
"a",
" ",
"list",
" ",
"for",
" ",
"compa",
"ris",
"on",
" ",
"testi",
"ng",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"VM",
"L",
" ",
"data",
" ",
"in",
" ",
"the",
" ",
"testcases",
" ",
"is",
" ",
"take",
"n",
" ",
"from",
" ",
"Exce",
"l",
" ",
"2007",
" ",
"files",
".",
" ",
"The",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"has",
" ",
"to",
" ",
"be",
" ",
"mass",
"age",
"d",
" ",
"significant",
"ly",
" ",
"to",
" ",
"make",
" ",
"it",
" ",
"suit",
"able",
" ",
"for",
" ",
"compa",
"ris",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"VM",
"L",
" ",
"produce",
"d",
" ",
"by",
" ",
"Xl",
"sx",
"Write",
"r",
" ",
"can",
" ",
"be",
" ",
"parsed",
" ",
"as",
" ",
"ordina",
"ry",
" ",
"XML",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vm",
"l\\u",
"str_",
"=_",
"vm",
"l\\u",
"str_",
"._",
"replace_",
"(_",
"\"\\\\",
"r",
"\"_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"vm",
"l_",
"=_",
"vm",
"l\\u",
"str_",
"._",
"split_",
"(_",
"\"\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vm",
"l\\u",
"str_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"line_",
"in_",
"vm",
"l_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ski",
"p",
" ",
"blank",
" ",
"lines",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"line_",
":_",
"\\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_",
"#",
" ",
"Strip",
" ",
"lead",
"ing",
" ",
"and",
" ",
"trail",
"ing",
" ",
"whitespace",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"line_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"VM",
"Ls",
" ",
"attribute",
" ",
"quote",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line_",
"=_",
"line_",
"._",
"replace_",
"(_",
"\"'\"_",
",_",
"'\"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"space",
" ",
"bet",
"ween",
" ",
"attribute",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"re_",
"._",
"search_",
"(_",
"'\"",
"$'_",
",_",
"line_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"+=_",
"\"",
" ",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"newline",
" ",
"after",
" ",
"element",
" ",
"end",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"re_",
"._",
"search_",
"(_",
"'>",
"$'_",
",_",
"line_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"+=_",
"\"\\\\",
"n",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Split",
" ",
"multiple",
" ",
"element",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"line_",
"=_",
"line_",
"._",
"replace_",
"(_",
"'><",
"'_",
",_",
"\">",
"\\\\",
"n",
"<\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Put",
" ",
"all",
" ",
"of",
" ",
"Anc",
"hor",
" ",
"on",
" ",
"one",
" ",
"line",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"line_",
"==_",
"\"<",
"x",
":",
"Anc",
"hor",
">\\\\",
"n",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"vm",
"l\\u",
"str_",
"+=_",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Remove",
" ",
"the",
" ",
"final",
" ",
"newline",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"vm",
"l\\u",
"str_",
"=_",
"vm",
"l\\u",
"str_",
"._",
"rstrip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"vm",
"l\\u",
"str_",
"._",
"split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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
] |
Unused import | tobspr/RenderPipeline/rpplugins/env_probes/plugin.py | [
{
"content": "\"\"\"\n\nRenderPipeline\n\nCopyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\"\"\"\n\nfrom panda3d.core import PTAInt\n\nfrom rpcore.globals import Globals\nfrom rpcore.util.shader_input_blocks import SimpleInputBlock\nfrom rpcore.pluginbase.base_plugin import BasePlugin\nfrom rpcore.stages.cull_lights_stage import CullLightsStage\n\nfrom .probe_manager import ProbeManager\nfrom .environment_capture_stage import EnvironmentCaptureStage\nfrom .apply_envprobes_stage import ApplyEnvprobesStage\nfrom .cull_probes_stage import CullProbesStage\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Plugin(BasePlugin):\n\n name = \"Environment Probes\"\n author = \"tobspr <tobias.springer1@gmail.com>\"\n description = (\"This plugin adds support for environment probes, containing \"\n \"diffuse and specular information. This enables accurate \"\n \"reflections, and can also be used to simulate GI.\")\n version = \"beta (!)\"\n\n\n\n",
"metadata": "root.Plugin",
"header": "['module', '___EOS___']",
"index": 39
},
{
"content": " def on_stage_setup(self):\n self.probe_mgr = ProbeManager()\n self.probe_mgr.resolution = self.get_setting(\"probe_resolution\")\n self.probe_mgr.diffuse_resolution = self.get_setting(\"diffuse_probe_resolution\")\n self.probe_mgr.max_probes = self.get_setting(\"max_probes\")\n self.probe_mgr.init()\n self._setup_stages()",
"metadata": "root.Plugin.on_stage_setup",
"header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']",
"index": 48
},
{
"content": " def _setup_stages(self):\n \"\"\" Setups all stages \"\"\"\n # Create the stage to generate and update the cubemaps\n self.capture_stage = self.create_stage(EnvironmentCaptureStage)\n self.capture_stage.resolution = self.probe_mgr.resolution\n self.capture_stage.diffuse_resolution = self.probe_mgr.diffuse_resolution\n self.capture_stage.storage_tex = self.probe_mgr.cubemap_storage\n self.capture_stage.storage_tex_diffuse = self.probe_mgr.diffuse_storage\n\n # Create the stage to cull the cubemaps\n self.cull_stage = self.create_stage(CullProbesStage)\n\n # Create the stage to apply the cubemaps\n self.apply_stage = self.create_stage(ApplyEnvprobesStage)\n\n if self.is_plugin_enabled(\"scattering\"):\n self.capture_stage.required_pipes += [\"ScatteringIBLSpecular\", \"ScatteringIBLDiffuse\"]\n\n if self.is_plugin_enabled(\"pssm\"):\n self.capture_stage.required_pipes += [\"PSSMSceneSunShadowMapPCF\"]\n self.capture_stage.required_inputs += [\"PSSMSceneSunShadowMVP\"]\n\n self._setup_inputs()",
"metadata": "root.Plugin._setup_stages",
"header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']",
"index": 56
},
{
"content": " def _setup_inputs(self):\n \"\"\" Sets all required inputs \"\"\"\n self.pta_probes = PTAInt.empty_array(1)\n\n # Construct the UBO which stores all environment probe data\n self.data_ubo = SimpleInputBlock(\"EnvProbes\")\n self.data_ubo.add_input(\"num_probes\", self.pta_probes)\n self.data_ubo.add_input(\"cubemaps\", self.probe_mgr.cubemap_storage)\n self.data_ubo.add_input(\"diffuse_cubemaps\", self.probe_mgr.diffuse_storage)\n self.data_ubo.add_input(\"dataset\", self.probe_mgr.dataset_storage)\n self._pipeline.stage_mgr.input_blocks.append(self.data_ubo)\n\n # Use the UBO in light culling\n CullLightsStage.required_inputs.append(\"EnvProbes\")",
"metadata": "root.Plugin._setup_inputs",
"header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']",
"index": 80
},
{
"content": " def on_pre_render_update(self):\n if self._pipeline.task_scheduler.is_scheduled(\"envprobes_select_and_cull\"):\n self.probe_mgr.update()\n self.pta_probes[0] = self.probe_mgr.num_probes\n probe = self.probe_mgr.find_probe_to_update()\n if probe:\n probe.last_update = Globals.clock.get_frame_count()\n self.capture_stage.active = True\n self.capture_stage.set_probe(probe)\n\n if self.is_plugin_enabled(\"pssm\"):\n self.get_plugin_instance(\"pssm\").scene_shadow_stage.request_focus(\n probe.bounds.get_center(), probe.bounds.get_radius()\n )\n else:\n self.capture_stage.active = False",
"metadata": "root.Plugin.on_pre_render_update",
"header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']",
"index": 95
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"\\",
"10",
";",
"Render",
"Pipe",
"line",
"\\",
"10",
";",
"\\",
"10",
";",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2014",
"-",
"2016",
" ",
"tob",
"spr",
" ",
"<",
"tob",
"ias",
".",
"spring",
"er1",
"@",
"gma",
"il",
".",
"com",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"Permi",
"ssion",
" ",
"is",
" ",
"here",
"by",
" ",
"grant",
"ed",
",",
" ",
"free",
" ",
"of",
" ",
"charge",
",",
" ",
"to",
" ",
"any",
" ",
"person",
" ",
"obtain",
"ing",
" ",
"a",
" ",
"copy",
"\\",
"10",
";",
"of",
" ",
"this",
" ",
"software",
" ",
"and",
" ",
"associate",
"d",
" ",
"documentation",
" ",
"files",
" ",
"(",
"the",
" ",
"\"",
"Sof",
"twa",
"re",
"\")",
",",
" ",
"to",
" ",
"deal",
"\\",
"10",
";",
"in",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"with",
"out",
" ",
"restriction",
",",
" ",
"inclu",
"ding",
" ",
"with",
"out",
" ",
"limit",
"ation",
" ",
"the",
" ",
"rights",
"\\",
"10",
";",
"to",
" ",
"use",
",",
" ",
"copy",
",",
" ",
"modif",
"y",
",",
" ",
"merge",
",",
" ",
"publi",
"sh",
",",
" ",
"distribute",
",",
" ",
"subli",
"cens",
"e",
",",
" ",
"and",
"/",
"or",
" ",
"sell",
"\\",
"10",
";",
"copie",
"s",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
",",
" ",
"and",
" ",
"to",
" ",
"permit",
" ",
"person",
"s",
" ",
"to",
" ",
"who",
"m",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"is",
"\\",
"10",
";",
"fur",
"nish",
"ed",
" ",
"to",
" ",
"do",
" ",
"so",
",",
" ",
"subject",
" ",
"to",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
" ",
"and",
" ",
"this",
" ",
"permissi",
"on",
" ",
"notice",
" ",
"sha",
"ll",
" ",
"be",
" ",
"include",
"d",
" ",
"in",
"\\",
"10",
";",
"all",
" ",
"copie",
"s",
" ",
"or",
" ",
"substa",
"nti",
"al",
" ",
"porti",
"ons",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"THE",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"\"",
"AS",
" ",
"IS",
"\",",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TY",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"EXPR",
"ESS",
" ",
"OR",
"\\",
"10",
";",
"IMPL",
"IED",
",",
" ",
"INC",
"LU",
"DING",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
" ",
"THE",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
",",
"\\",
"10",
";",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"AND",
" ",
"NON",
"INF",
"RING",
"EME",
"NT",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
"\\",
"10",
";",
"AUTHOR",
"S",
" ",
"OR",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"CLA",
"IM",
",",
" ",
"DA",
"MAGE",
"S",
" ",
"OR",
" ",
"OTHER",
"\\",
"10",
";",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"AN",
" ",
"ACTI",
"ON",
" ",
"OF",
" ",
"CONTR",
"ACT",
",",
" ",
"TOR",
"T",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
",",
" ",
"ARI",
"SIN",
"G",
" ",
"FROM",
",",
"\\",
"10",
";",
"OUT",
" ",
"OF",
" ",
"OR",
" ",
"IN",
" ",
"CONNECTION",
" ",
"WITH",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"OR",
" ",
"THE",
" ",
"USE",
" ",
"OR",
" ",
"OTHER",
" ",
"DEA",
"LING",
"S",
" ",
"IN",
"\\",
"10",
";",
"THE",
" ",
"SOFT",
"WARE",
".",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"panda",
"3d_",
"._",
"core_",
"import_",
"PT",
"AI",
"nt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"rpc",
"ore_",
"._",
"globals_",
"import_",
"Globals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rpc",
"ore_",
"._",
"util_",
"._",
"shade",
"r",
"\\u",
"input",
"\\u",
"blocks_",
"import_",
"Simple",
"Inp",
"ut",
"Block_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rpc",
"ore_",
"._",
"plugin",
"base_",
"._",
"base",
"\\u",
"plugin_",
"import_",
"Base",
"Plugin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rpc",
"ore_",
"._",
"stages_",
"._",
"cul",
"l\\u",
"lights",
"\\u",
"stage_",
"import_",
"Cul",
"l",
"Light",
"s",
"Stage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"prob",
"e\\u",
"manager_",
"import_",
"Probe",
"Manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"environ",
"ment",
"\\u",
"captur",
"e\\u",
"stage_",
"import_",
"Environ",
"ment",
"Captur",
"e",
"Stage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"appl",
"y",
"\\u",
"env",
"probes",
"\\u",
"stage_",
"import_",
"Apply",
"Env",
"probes",
"Stage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"cul",
"l\\u",
"probes",
"\\u",
"stage_",
"import_",
"Cul",
"l",
"Probe",
"s",
"Stage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"\"",
"Environ",
"ment",
" ",
"Probe",
"s",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"author_",
"=_",
"\"",
"tob",
"spr",
" ",
"<",
"tob",
"ias",
".",
"spring",
"er1",
"@",
"gma",
"il",
".",
"com",
">\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"description_",
"=_",
"(_",
"\"",
"Thi",
"s",
" ",
"plugin",
" ",
"adds",
" ",
"support",
" ",
"for",
" ",
"environ",
"ment",
" ",
"probes",
",",
" ",
"contain",
"ing",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"diffuse",
" ",
"and",
" ",
"specular",
" ",
"informati",
"on",
".",
" ",
"Thi",
"s",
" ",
"enable",
"s",
" ",
"accurate",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"reflection",
"s",
",",
" ",
"and",
" ",
"can",
" ",
"als",
"o",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"simulat",
"e",
" ",
"GI",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"version_",
"=_",
"\"",
"beta",
" ",
"(!",
")\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"on",
"\\u",
"stage",
"\\u",
"setup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"=_",
"Probe",
"Manager_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"resolution_",
"=_",
"self_",
"._",
"get",
"\\u",
"setting_",
"(_",
"\"",
"prob",
"e\\u",
"resolu",
"tion",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"diffuse",
"\\u",
"resolution_",
"=_",
"self_",
"._",
"get",
"\\u",
"setting_",
"(_",
"\"",
"diffuse",
"\\u",
"prob",
"e\\u",
"resolu",
"tion",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"max",
"\\u",
"probes",
"_",
"=_",
"self_",
"._",
"get",
"\\u",
"setting_",
"(_",
"\"",
"max",
"\\u",
"probes",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"init_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"setup",
"\\u",
"stages_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup",
"\\u",
"stages_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Set",
"ups",
" ",
"all",
" ",
"stage",
"s",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"the",
" ",
"stage",
" ",
"to",
" ",
"generat",
"e",
" ",
"and",
" ",
"update",
" ",
"the",
" ",
"cube",
"maps_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"=_",
"self_",
"._",
"create",
"\\u",
"stage_",
"(_",
"Environ",
"ment",
"Captur",
"e",
"Stage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"resolution_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"resolution_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"diffuse",
"\\u",
"resolution_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"diffuse",
"\\u",
"resolution_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"storage",
"\\u",
"tex_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"cube",
"map",
"\\u",
"storage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"storage",
"\\u",
"tex",
"\\u",
"diffuse",
"_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"diffuse",
"\\u",
"storage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"the",
" ",
"stage",
" ",
"to",
" ",
"cul",
"l",
" ",
"the",
" ",
"cube",
"maps_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"cul",
"l\\u",
"stage_",
"=_",
"self_",
"._",
"create",
"\\u",
"stage_",
"(_",
"Cul",
"l",
"Probe",
"s",
"Stage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"the",
" ",
"stage",
" ",
"to",
" ",
"appl",
"y",
" ",
"the",
" ",
"cube",
"maps_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"appl",
"y",
"\\u",
"stage_",
"=_",
"self_",
"._",
"create",
"\\u",
"stage_",
"(_",
"Apply",
"Env",
"probes",
"Stage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"is",
"\\u",
"plugin",
"\\u",
"enabled_",
"(_",
"\"",
"scatter",
"ing",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"require",
"d\\u",
"pipes_",
"+=_",
"[_",
"\"",
"Scatter",
"ing",
"IB",
"LS",
"pec",
"ular",
"\"_",
",_",
"\"",
"Scatter",
"ing",
"IB",
"LD",
"iff",
"use",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"is",
"\\u",
"plugin",
"\\u",
"enabled_",
"(_",
"\"",
"pss",
"m",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"require",
"d\\u",
"pipes_",
"+=_",
"[_",
"\"",
"PS",
"SMS",
"cen",
"e",
"Sun",
"Shad",
"ow",
"Map",
"PC",
"F",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"require",
"d\\u",
"inputs_",
"+=_",
"[_",
"\"",
"PS",
"SMS",
"cen",
"e",
"Sun",
"Shad",
"ow",
"MV",
"P",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"setup",
"\\u",
"inputs_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup",
"\\u",
"inputs_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Set",
"s",
" ",
"all",
" ",
"require",
"d",
" ",
"inputs",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"pta",
"\\u",
"probes",
"_",
"=_",
"PT",
"AI",
"nt_",
"._",
"empty",
"\\u",
"array_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"the",
" ",
"UB",
"O",
" ",
"whi",
"ch",
" ",
"store",
"s",
" ",
"all",
" ",
"environ",
"ment",
" ",
"prob",
"e",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"data\\u",
"ub",
"o_",
"=_",
"Simple",
"Inp",
"ut",
"Block_",
"(_",
"\"",
"Env",
"Probe",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"data\\u",
"ub",
"o_",
"._",
"add",
"\\u",
"input_",
"(_",
"\"",
"num",
"\\u",
"probes",
"\"_",
",_",
"self_",
"._",
"pta",
"\\u",
"probes",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"data\\u",
"ub",
"o_",
"._",
"add",
"\\u",
"input_",
"(_",
"\"",
"cube",
"maps",
"\"_",
",_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"cube",
"map",
"\\u",
"storage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"data\\u",
"ub",
"o_",
"._",
"add",
"\\u",
"input_",
"(_",
"\"",
"diffuse",
"\\u",
"cube",
"maps",
"\"_",
",_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"diffuse",
"\\u",
"storage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"data\\u",
"ub",
"o_",
"._",
"add",
"\\u",
"input_",
"(_",
"\"",
"dataset",
"\"_",
",_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"dataset",
"\\u",
"storage_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"pipeline_",
"._",
"stage",
"\\u",
"mgr_",
"._",
"input",
"\\u",
"blocks_",
"._",
"append_",
"(_",
"self_",
"._",
"data\\u",
"ub",
"o_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"e",
" ",
"the",
" ",
"UB",
"O",
" ",
"in",
" ",
"light",
" ",
"cul",
"ling_",
"\\u\\u\\uNL\\u\\u\\u_",
"Cul",
"l",
"Light",
"s",
"Stage_",
"._",
"require",
"d\\u",
"inputs_",
"._",
"append_",
"(_",
"\"",
"Env",
"Probe",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"\\u",
"pre",
"\\u",
"render",
"\\u",
"update_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"\\u",
"pipeline_",
"._",
"task",
"\\u",
"scheduler_",
"._",
"is",
"\\u",
"schedule",
"d_",
"(_",
"\"",
"env",
"probes",
"\\u",
"select",
"\\u",
"and",
"\\u",
"cul",
"l",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"pta",
"\\u",
"probes",
"_",
"[_",
"0_",
"]_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"num",
"\\u",
"probes",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"probe_",
"=_",
"self_",
"._",
"prob",
"e\\u",
"mgr_",
"._",
"find",
"\\u",
"prob",
"e\\u",
"to",
"\\u",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"probe_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"probe_",
"._",
"last",
"\\u",
"update_",
"=_",
"Globals_",
"._",
"clock_",
"._",
"get",
"\\u",
"frame",
"\\u",
"count_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"active_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"captur",
"e\\u",
"stage_",
"._",
"set\\u",
"probe_",
"(_",
"probe_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"is",
"\\u",
"plugin",
"\\u",
"enabled_",
"(_",
"\"",
"pss",
"m",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"get",
"\\u",
"plugin",
"\\u",
"instance_",
"(_",
"\"",
"pss",
"m",
"\"_",
")_",
"._",
"scen",
"e\\u",
"shadow",
"\\u",
"stage_",
"._",
"request",
"\\u",
"focus_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"probe_",
"._",
"bounds_",
"._",
"get",
"\\u",
"center_",
"(_",
")_",
",_",
"probe_",
"._",
"bounds_",
"._",
"get",
"\\u",
"radius_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\u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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | Kozea/WeasyPrint/weasyprint/draw.py | [
{
"content": "def clip_border_segment(context, enable_hinting, style, width, side,\n border_box, border_widths=None, radii=None):\n \"\"\"Clip one segment of box border.\n\n The strategy is to remove the zones not needed because of the style or the\n side before painting.\n\n \"\"\"\n if enable_hinting and style != 'dotted' and (\n # Borders smaller than 1 device unit would disappear\n # without anti-aliasing.\n math.hypot(*context.user_to_device(width, 0)) >= 1 and\n math.hypot(*context.user_to_device(0, width)) >= 1):\n # Avoid an artifact in the corner joining two solid borders\n # of the same color.\n context.set_antialias(cairo.ANTIALIAS_NONE)\n\n bbx, bby, bbw, bbh = border_box\n (tlh, tlv), (trh, trv), (brh, brv), (blh, blv) = radii or 4 * ((0, 0),)\n bt, br, bb, bl = border_widths or 4 * (width,)\n\n def transition_point(x1, y1, x2, y2):\n \"\"\"Get the point use for border transition.\n\n The extra boolean returned is ``True`` if the point is in the padding\n box (ie. the padding box is rounded).\n\n This point is not specified. We must be sure to be inside the rounded\n padding box, and in the zone defined in the \"transition zone\" allowed\n by the specification. We chose the corner of the transition zone. It's\n easy to get and gives quite good results, but it seems to be different\n from what other browsers do.\n\n \"\"\"\n return (\n ((x1, y1), True) if abs(x1) > abs(x2) and abs(y1) > abs(y2)\n else ((x2, y2), False))\n\n def corner_half_length(a, b):\n \"\"\"Return the length of the half of one ellipsis corner.\n\n Inspired by [Ramanujan, S., \"Modular Equations and Approximations to\n pi\" Quart. J. Pure. Appl. Math., vol. 45 (1913-1914), pp. 350-372],\n wonderfully explained by Dr Rob.\n\n http://mathforum.org/dr.math/faq/formulas/\n\n \"\"\"\n x = (a - b) / (a + b)\n return math.pi / 8 * (a + b) * (\n 1 + 3 * x ** 2 / (10 + math.sqrt(4 - 3 * x ** 2)))\n\n if side == 'top':\n (px1, py1), rounded1 = transition_point(tlh, tlv, bl, bt)\n (px2, py2), rounded2 = transition_point(-trh, trv, -br, bt)\n width = bt\n way = 1\n angle = 1\n main_offset = bby\n elif side == 'right':\n (px1, py1), rounded1 = transition_point(-trh, trv, -br, bt)\n (px2, py2), rounded2 = transition_point(-brh, -brv, -br, -bb)\n width = br\n way = 1\n angle = 2\n main_offset = bbx + bbw\n elif side == 'bottom':\n (px1, py1), rounded1 = transition_point(blh, -blv, bl, -bb)\n (px2, py2), rounded2 = transition_point(-brh, -brv, -br, -bb)\n width = bb\n way = -1\n angle = 3\n main_offset = bby + bbh\n elif side == 'left':\n (px1, py1), rounded1 = transition_point(tlh, tlv, bl, bt)\n (px2, py2), rounded2 = transition_point(blh, -blv, bl, -bb)\n width = bl\n way = -1\n angle = 4\n main_offset = bbx\n\n if side in ('top', 'bottom'):\n a1, b1 = px1 - bl / 2, way * py1 - width / 2\n a2, b2 = -px2 - br / 2, way * py2 - width / 2\n line_length = bbw - px1 + px2\n length = bbw\n context.move_to(bbx + bbw, main_offset)\n context.rel_line_to(-bbw, 0)\n context.rel_line_to(px1, py1)\n context.rel_line_to(-px1 + bbw + px2, -py1 + py2)\n elif side in ('left', 'right'):\n a1, b1 = -way * px1 - width / 2, py1 - bt / 2\n a2, b2 = -way * px2 - width / 2, -py2 - bb / 2\n line_length = bbh - py1 + py2\n length = bbh\n context.move_to(main_offset, bby + bbh)\n context.rel_line_to(0, -bbh)\n context.rel_line_to(px1, py1)\n context.rel_line_to(-px1 + px2, -py1 + bbh + py2)\n\n context.set_fill_rule(cairo.FILL_RULE_EVEN_ODD)\n if style in ('dotted', 'dashed'):\n dash = width if style == 'dotted' else 3 * width\n if rounded1 or rounded2:\n # At least one of the two corners is rounded\n chl1 = corner_half_length(a1, b1)\n chl2 = corner_half_length(a2, b2)\n length = line_length + chl1 + chl2\n dash_length = round(length / dash)\n if rounded1 and rounded2:\n # 2x dashes\n dash = length / (dash_length + dash_length % 2)\n else:\n # 2x - 1/2 dashes\n dash = length / (dash_length + dash_length % 2 - 0.5)\n dashes1 = int(math.ceil((chl1 - dash / 2) / dash))\n dashes2 = int(math.ceil((chl2 - dash / 2) / dash))\n line = int(math.floor(line_length / dash))\n\n def draw_dots(dashes, line, way, x, y, px, py, chl):\n if not dashes:\n return line + 1, 0\n for i in range(0, dashes, 2):\n i += 0.5 # half dash\n angle1 = (\n ((2 * angle - way) + i * way * dash / chl) /\n 4 * math.pi)\n angle2 = (min if way > 0 else max)(\n ((2 * angle - way) + (i + 1) * way * dash / chl) /\n 4 * math.pi,\n angle * math.pi / 2)\n if side in ('top', 'bottom'):\n context.move_to(x + px, main_offset + py)\n context.line_to(\n x + px - way * px * 1 / math.tan(angle2),\n main_offset)\n context.line_to(\n x + px - way * px * 1 / math.tan(angle1),\n main_offset)\n elif side in ('left', 'right'):\n context.move_to(main_offset + px, y + py)\n context.line_to(\n main_offset,\n y + py + way * py * math.tan(angle2))\n context.line_to(\n main_offset,\n y + py + way * py * math.tan(angle1))\n if angle2 == angle * math.pi / 2:\n offset = (angle1 - angle2) / ((\n ((2 * angle - way) + (i + 1) * way * dash / chl) /\n 4 * math.pi) - angle1)\n line += 1\n break\n else:\n offset = 1 - (\n (angle * math.pi / 2 - angle2) / (angle2 - angle1))\n return line, offset\n\n line, offset = draw_dots(\n dashes1, line, way, bbx, bby, px1, py1, chl1)\n line = draw_dots(\n dashes2, line, -way, bbx + bbw, bby + bbh, px2, py2, chl2)[0]\n\n if line_length > 1e-6:\n for i in range(0, line, 2):\n i += offset\n if side in ('top', 'bottom'):\n x1 = max(bbx + px1 + i * dash, bbx + px1)\n x2 = min(bbx + px1 + (i + 1) * dash, bbx + bbw + px2)\n y1 = main_offset - (width if way < 0 else 0)\n y2 = y1 + width\n elif side in ('left', 'right'):\n y1 = max(bby + py1 + i * dash, bby + py1)\n y2 = min(bby + py1 + (i + 1) * dash, bby + bbh + py2)\n x1 = main_offset - (width if way > 0 else 0)\n x2 = x1 + width\n context.rectangle(x1, y1, x2 - x1, y2 - y1)\n else:\n # 2x + 1 dashes\n context.clip()\n dash = length / (\n round(length / dash) - (round(length / dash) + 1) % 2) or 1\n for i in range(0, int(round(length / dash)), 2):\n if side == 'top':\n context.rectangle(\n bbx + i * dash, bby, dash, width)\n elif side == 'right':\n context.rectangle(\n bbx + bbw - width, bby + i * dash, width, dash)\n elif side == 'bottom':\n context.rectangle(\n bbx + i * dash, bby + bbh - width, dash, width)\n elif side == 'left':\n context.rectangle(\n bbx, bby + i * dash, width, dash)\n context.clip()",
"metadata": "root.clip_border_segment",
"header": "['module', '___EOS___']",
"index": 429
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"clip",
"\\u",
"border",
"\\u",
"segment_",
"(_",
"context_",
",_",
"enable",
"\\u",
"hin",
"ting_",
",_",
"style_",
",_",
"width_",
",_",
"side_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"border",
"\\u",
"box_",
",_",
"border",
"\\u",
"widths_",
"=_",
"None_",
",_",
"radii_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Clip",
" ",
"one",
" ",
"segment",
" ",
"of",
" ",
"box",
" ",
"border",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"strat",
"eg",
"y",
" ",
"is",
" ",
"to",
" ",
"remove",
" ",
"the",
" ",
"zone",
"s",
" ",
"not",
" ",
"need",
"ed",
" ",
"bec",
"aus",
"e",
" ",
"of",
" ",
"the",
" ",
"style",
" ",
"or",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"side",
" ",
"bef",
"ore",
" ",
"pain",
"ting",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"enable",
"\\u",
"hin",
"ting_",
"and_",
"style_",
"!=_",
"'",
"dot",
"ted",
"'_",
"and_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Border",
"s",
" ",
"small",
"er",
" ",
"than",
" ",
"1",
" ",
"device",
" ",
"unit",
" ",
"wou",
"ld",
" ",
"disapp",
"ear_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"with",
"out",
" ",
"anti",
"-",
"alias",
"ing",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"math_",
"._",
"hypot",
"_",
"(_",
"*_",
"context_",
"._",
"user",
"\\u",
"to",
"\\u",
"device_",
"(_",
"width_",
",_",
"0_",
")_",
")_",
">=_",
"1_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"math_",
"._",
"hypot",
"_",
"(_",
"*_",
"context_",
"._",
"user",
"\\u",
"to",
"\\u",
"device_",
"(_",
"0_",
",_",
"width_",
")_",
")_",
">=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Av",
"oid",
" ",
"an",
" ",
"artifact",
" ",
"in",
" ",
"the",
" ",
"corn",
"er",
" ",
"join",
"ing",
" ",
"two",
" ",
"solid",
" ",
"borders_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"same",
" ",
"color",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"._",
"set\\u",
"antia",
"lias",
"_",
"(_",
"cairo_",
"._",
"ANTI",
"ALIAS",
"\\u",
"NONE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"bb",
"x_",
",_",
"bby",
"_",
",_",
"bb",
"w_",
",_",
"bb",
"h_",
"=_",
"border",
"\\u",
"box_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"tl",
"h_",
",_",
"tlv",
"_",
")_",
",_",
"(_",
"tr",
"h_",
",_",
"tr",
"v_",
")_",
",_",
"(_",
"br",
"h_",
",_",
"br",
"v_",
")_",
",_",
"(_",
"bl",
"h_",
",_",
"bl",
"v_",
")_",
"=_",
"radii_",
"or_",
"4_",
"*_",
"(_",
"(_",
"0_",
",_",
"0_",
")_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bt_",
",_",
"br_",
",_",
"bb_",
",_",
"bl_",
"=_",
"border",
"\\u",
"widths_",
"or_",
"4_",
"*_",
"(_",
"width_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"x1_",
",_",
"y1_",
",_",
"x2_",
",_",
"y2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Get",
" ",
"the",
" ",
"point",
" ",
"use",
" ",
"for",
" ",
"border",
" ",
"transiti",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"extra",
" ",
"boolean",
" ",
"return",
"ed",
" ",
"is",
" ",
"``",
"Tru",
"e",
"``",
" ",
"if",
" ",
"the",
" ",
"point",
" ",
"is",
" ",
"in",
" ",
"the",
" ",
"padd",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"box",
" ",
"(",
"ie",
".",
" ",
"the",
" ",
"padd",
"ing",
" ",
"box",
" ",
"is",
" ",
"rounded",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"point",
" ",
"is",
" ",
"not",
" ",
"specified",
".",
" ",
"We",
" ",
"must",
" ",
"be",
" ",
"sure",
" ",
"to",
" ",
"be",
" ",
"insi",
"de",
" ",
"the",
" ",
"rounded",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"padd",
"ing",
" ",
"box",
",",
" ",
"and",
" ",
"in",
" ",
"the",
" ",
"zone",
" ",
"defin",
"ed",
" ",
"in",
" ",
"the",
" ",
"\"",
"transiti",
"on",
" ",
"zone",
"\"",
" ",
"allow",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"by",
" ",
"the",
" ",
"specifica",
"tion",
".",
" ",
"We",
" ",
"chos",
"e",
" ",
"the",
" ",
"corn",
"er",
" ",
"of",
" ",
"the",
" ",
"transiti",
"on",
" ",
"zone",
".",
" ",
"It",
"'",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"easy",
" ",
"to",
" ",
"get",
" ",
"and",
" ",
"give",
"s",
" ",
"quite",
" ",
"good",
" ",
"results",
",",
" ",
"but",
" ",
"it",
" ",
"see",
"ms",
" ",
"to",
" ",
"be",
" ",
"different",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"from",
" ",
"what",
" ",
"other",
" ",
"browsers",
" ",
"do",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"x1_",
",_",
"y1_",
")_",
",_",
"True_",
")_",
"if_",
"abs_",
"(_",
"x1_",
")_",
">_",
"abs_",
"(_",
"x2_",
")_",
"and_",
"abs_",
"(_",
"y1_",
")_",
">_",
"abs_",
"(_",
"y2_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"else_",
"(_",
"(_",
"x2_",
",_",
"y2_",
")_",
",_",
"False_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"corn",
"er",
"\\u",
"half",
"\\u",
"length_",
"(_",
"a_",
",_",
"b_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
" ",
"the",
" ",
"length",
" ",
"of",
" ",
"the",
" ",
"half",
" ",
"of",
" ",
"one",
" ",
"ellipsi",
"s",
" ",
"corn",
"er",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ins",
"pir",
"ed",
" ",
"by",
" ",
"[",
"Ram",
"anu",
"jan",
",",
" ",
"S",
".,",
" ",
"\"",
"Modul",
"ar",
" ",
"Equation",
"s",
" ",
"and",
" ",
"Approx",
"imat",
"ion",
"s",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pi",
"\"",
" ",
"Quart",
".",
" ",
"J",
".",
" ",
"Pur",
"e",
".",
" ",
"Appl",
".",
" ",
"Math",
".,",
" ",
"vol",
".",
" ",
"4",
"5",
" ",
"(",
"191",
"3",
"-1",
"914",
"),",
" ",
"pp",
".",
" ",
"350",
"-",
"372",
"],",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"won",
"der",
"full",
"y",
" ",
"explaine",
"d",
" ",
"by",
" ",
"Dr",
" ",
"Rob",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"http",
"://",
"math",
"forum",
".",
"org",
"/",
"dr",
".",
"math",
"/",
"faq",
"/",
"formulas",
"/",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"(_",
"a_",
"-_",
"b_",
")_",
"/_",
"(_",
"a_",
"+_",
"b_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"math_",
"._",
"pi_",
"/_",
"8_",
"*_",
"(_",
"a_",
"+_",
"b_",
")_",
"*_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"1_",
"+_",
"3_",
"*_",
"x_",
"**_",
"2_",
"/_",
"(_",
"10_",
"+_",
"math_",
"._",
"sqrt_",
"(_",
"4_",
"-_",
"3_",
"*_",
"x_",
"**_",
"2_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"side_",
"==_",
"'",
"top",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
",_",
"rounded",
"1_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"tl",
"h_",
",_",
"tlv",
"_",
",_",
"bl_",
",_",
"bt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"px",
"2_",
",_",
"py2",
"_",
")_",
",_",
"rounded",
"2_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"-_",
"tr",
"h_",
",_",
"tr",
"v_",
",_",
"-_",
"br_",
",_",
"bt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"width_",
"=_",
"bt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"way_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"main",
"\\u",
"offset_",
"=_",
"bby",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"right",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
",_",
"rounded",
"1_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"-_",
"tr",
"h_",
",_",
"tr",
"v_",
",_",
"-_",
"br_",
",_",
"bt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"px",
"2_",
",_",
"py2",
"_",
")_",
",_",
"rounded",
"2_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"-_",
"br",
"h_",
",_",
"-_",
"br",
"v_",
",_",
"-_",
"br_",
",_",
"-_",
"bb_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"width_",
"=_",
"br_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"way_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"main",
"\\u",
"offset_",
"=_",
"bb",
"x_",
"+_",
"bb",
"w_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"bottom",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
",_",
"rounded",
"1_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"bl",
"h_",
",_",
"-_",
"bl",
"v_",
",_",
"bl_",
",_",
"-_",
"bb_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"px",
"2_",
",_",
"py2",
"_",
")_",
",_",
"rounded",
"2_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"-_",
"br",
"h_",
",_",
"-_",
"br",
"v_",
",_",
"-_",
"br_",
",_",
"-_",
"bb_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"width_",
"=_",
"bb_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"way_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"main",
"\\u",
"offset_",
"=_",
"bby",
"_",
"+_",
"bb",
"h_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"left",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
",_",
"rounded",
"1_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"tl",
"h_",
",_",
"tlv",
"_",
",_",
"bl_",
",_",
"bt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"px",
"2_",
",_",
"py2",
"_",
")_",
",_",
"rounded",
"2_",
"=_",
"transiti",
"on",
"\\u",
"point_",
"(_",
"bl",
"h_",
",_",
"-_",
"bl",
"v_",
",_",
"bl_",
",_",
"-_",
"bb_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"width_",
"=_",
"bl_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"way_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"main",
"\\u",
"offset_",
"=_",
"bb",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"side_",
"in_",
"(_",
"'",
"top",
"'_",
",_",
"'",
"bottom",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"a1_",
",_",
"b1_",
"=_",
"px",
"1_",
"-_",
"bl_",
"/_",
"2_",
",_",
"way_",
"*_",
"py",
"1_",
"-_",
"width_",
"/_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a2_",
",_",
"b2_",
"=_",
"-_",
"px",
"2_",
"-_",
"br_",
"/_",
"2_",
",_",
"way_",
"*_",
"py2",
"_",
"-_",
"width_",
"/_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line",
"\\u",
"length_",
"=_",
"bb",
"w_",
"-_",
"px",
"1_",
"+_",
"px",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"length_",
"=_",
"bb",
"w_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"move",
"\\u",
"to_",
"(_",
"bb",
"x_",
"+_",
"bb",
"w_",
",_",
"main",
"\\u",
"offset_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"-_",
"bb",
"w_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"-_",
"px",
"1_",
"+_",
"bb",
"w_",
"+_",
"px",
"2_",
",_",
"-_",
"py",
"1_",
"+_",
"py2",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"in_",
"(_",
"'",
"left",
"'_",
",_",
"'",
"right",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"a1_",
",_",
"b1_",
"=_",
"-_",
"way_",
"*_",
"px",
"1_",
"-_",
"width_",
"/_",
"2_",
",_",
"py",
"1_",
"-_",
"bt_",
"/_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"a2_",
",_",
"b2_",
"=_",
"-_",
"way_",
"*_",
"px",
"2_",
"-_",
"width_",
"/_",
"2_",
",_",
"-_",
"py2",
"_",
"-_",
"bb_",
"/_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line",
"\\u",
"length_",
"=_",
"bb",
"h_",
"-_",
"py",
"1_",
"+_",
"py2",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"length_",
"=_",
"bb",
"h_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"move",
"\\u",
"to_",
"(_",
"main",
"\\u",
"offset_",
",_",
"bby",
"_",
"+_",
"bb",
"h_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"0_",
",_",
"-_",
"bb",
"h_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"px",
"1_",
",_",
"py",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"rel",
"\\u",
"line",
"\\u",
"to_",
"(_",
"-_",
"px",
"1_",
"+_",
"px",
"2_",
",_",
"-_",
"py",
"1_",
"+_",
"bb",
"h_",
"+_",
"py2",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"context_",
"._",
"set\\u",
"fill",
"\\u",
"rule_",
"(_",
"cairo_",
"._",
"FILL",
"\\u",
"RULE",
"\\u",
"EVE",
"N",
"\\u",
"OD",
"D_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"style_",
"in_",
"(_",
"'",
"dot",
"ted",
"'_",
",_",
"'",
"dashed",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dash_",
"=_",
"width_",
"if_",
"style_",
"==_",
"'",
"dot",
"ted",
"'_",
"else_",
"3_",
"*_",
"width_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"rounded",
"1_",
"or_",
"rounded",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"At",
" ",
"leas",
"t",
" ",
"one",
" ",
"of",
" ",
"the",
" ",
"two",
" ",
"corners",
" ",
"is",
" ",
"rounded",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"chl",
"1_",
"=_",
"corn",
"er",
"\\u",
"half",
"\\u",
"length_",
"(_",
"a1_",
",_",
"b1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"chl",
"2_",
"=_",
"corn",
"er",
"\\u",
"half",
"\\u",
"length_",
"(_",
"a2_",
",_",
"b2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"length_",
"=_",
"line",
"\\u",
"length_",
"+_",
"chl",
"1_",
"+_",
"chl",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dash",
"\\u",
"length_",
"=_",
"round_",
"(_",
"length_",
"/_",
"dash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"rounded",
"1_",
"and_",
"rounded",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"2x",
" ",
"dashes",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dash_",
"=_",
"length_",
"/_",
"(_",
"dash",
"\\u",
"length_",
"+_",
"dash",
"\\u",
"length_",
"%_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"2x",
" ",
"-",
" ",
"1",
"/",
"2",
" ",
"dashes",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dash_",
"=_",
"length_",
"/_",
"(_",
"dash",
"\\u",
"length_",
"+_",
"dash",
"\\u",
"length_",
"%_",
"2_",
"-_",
"0.5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"dashes",
"1_",
"=_",
"int_",
"(_",
"math_",
"._",
"ceil_",
"(_",
"(_",
"chl",
"1_",
"-_",
"dash_",
"/_",
"2_",
")_",
"/_",
"dash_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dashes",
"2_",
"=_",
"int_",
"(_",
"math_",
"._",
"ceil_",
"(_",
"(_",
"chl",
"2_",
"-_",
"dash_",
"/_",
"2_",
")_",
"/_",
"dash_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"=_",
"int_",
"(_",
"math_",
"._",
"floor_",
"(_",
"line",
"\\u",
"length_",
"/_",
"dash_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"draw",
"\\u",
"dots_",
"(_",
"dashes",
"_",
",_",
"line_",
",_",
"way_",
",_",
"x_",
",_",
"y_",
",_",
"px_",
",_",
"py_",
",_",
"chl",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"dashes",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"line_",
"+_",
"1_",
",_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"dashes",
"_",
",_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"i_",
"+=_",
"0.5_",
"#",
" ",
"half",
" ",
"dash_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle",
"1_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"2_",
"*_",
"angle_",
"-_",
"way_",
")_",
"+_",
"i_",
"*_",
"way_",
"*_",
"dash_",
"/_",
"chl",
"_",
")_",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"4_",
"*_",
"math_",
"._",
"pi_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"angle",
"2_",
"=_",
"(_",
"min_",
"if_",
"way_",
">_",
"0_",
"else_",
"max_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"2_",
"*_",
"angle_",
"-_",
"way_",
")_",
"+_",
"(_",
"i_",
"+_",
"1_",
")_",
"*_",
"way_",
"*_",
"dash_",
"/_",
"chl",
"_",
")_",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"4_",
"*_",
"math_",
"._",
"pi_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"angle_",
"*_",
"math_",
"._",
"pi_",
"/_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"side_",
"in_",
"(_",
"'",
"top",
"'_",
",_",
"'",
"bottom",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"context_",
"._",
"move",
"\\u",
"to_",
"(_",
"x_",
"+_",
"px_",
",_",
"main",
"\\u",
"offset_",
"+_",
"py_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"line",
"\\u",
"to_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"+_",
"px_",
"-_",
"way_",
"*_",
"px_",
"*_",
"1_",
"/_",
"math_",
"._",
"tan_",
"(_",
"angle",
"2_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"main",
"\\u",
"offset_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"line",
"\\u",
"to_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"+_",
"px_",
"-_",
"way_",
"*_",
"px_",
"*_",
"1_",
"/_",
"math_",
"._",
"tan_",
"(_",
"angle",
"1_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"main",
"\\u",
"offset_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"in_",
"(_",
"'",
"left",
"'_",
",_",
"'",
"right",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"context_",
"._",
"move",
"\\u",
"to_",
"(_",
"main",
"\\u",
"offset_",
"+_",
"px_",
",_",
"y_",
"+_",
"py_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"line",
"\\u",
"to_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"main",
"\\u",
"offset_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"y_",
"+_",
"py_",
"+_",
"way_",
"*_",
"py_",
"*_",
"math_",
"._",
"tan_",
"(_",
"angle",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"line",
"\\u",
"to_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"main",
"\\u",
"offset_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"y_",
"+_",
"py_",
"+_",
"way_",
"*_",
"py_",
"*_",
"math_",
"._",
"tan_",
"(_",
"angle",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"angle",
"2_",
"==_",
"angle_",
"*_",
"math_",
"._",
"pi_",
"/_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"offset_",
"=_",
"(_",
"angle",
"1_",
"-_",
"angle",
"2_",
")_",
"/_",
"(_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"2_",
"*_",
"angle_",
"-_",
"way_",
")_",
"+_",
"(_",
"i_",
"+_",
"1_",
")_",
"*_",
"way_",
"*_",
"dash_",
"/_",
"chl",
"_",
")_",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"4_",
"*_",
"math_",
"._",
"pi_",
")_",
"-_",
"angle",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"offset_",
"=_",
"1_",
"-_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"angle_",
"*_",
"math_",
"._",
"pi_",
"/_",
"2_",
"-_",
"angle",
"2_",
")_",
"/_",
"(_",
"angle",
"2_",
"-_",
"angle",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"line_",
",_",
"offset_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"line_",
",_",
"offset_",
"=_",
"draw",
"\\u",
"dots_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"dashes",
"1_",
",_",
"line_",
",_",
"way_",
",_",
"bb",
"x_",
",_",
"bby",
"_",
",_",
"px",
"1_",
",_",
"py",
"1_",
",_",
"chl",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"=_",
"draw",
"\\u",
"dots_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"dashes",
"2_",
",_",
"line_",
",_",
"-_",
"way_",
",_",
"bb",
"x_",
"+_",
"bb",
"w_",
",_",
"bby",
"_",
"+_",
"bb",
"h_",
",_",
"px",
"2_",
",_",
"py2",
"_",
",_",
"chl",
"2_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"line",
"\\u",
"length_",
">_",
"1e-6_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"line_",
",_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"i_",
"+=_",
"offset_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"side_",
"in_",
"(_",
"'",
"top",
"'_",
",_",
"'",
"bottom",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"x1_",
"=_",
"max_",
"(_",
"bb",
"x_",
"+_",
"px",
"1_",
"+_",
"i_",
"*_",
"dash_",
",_",
"bb",
"x_",
"+_",
"px",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x2_",
"=_",
"min_",
"(_",
"bb",
"x_",
"+_",
"px",
"1_",
"+_",
"(_",
"i_",
"+_",
"1_",
")_",
"*_",
"dash_",
",_",
"bb",
"x_",
"+_",
"bb",
"w_",
"+_",
"px",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y1_",
"=_",
"main",
"\\u",
"offset_",
"-_",
"(_",
"width_",
"if_",
"way_",
"<_",
"0_",
"else_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y2_",
"=_",
"y1_",
"+_",
"width_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"in_",
"(_",
"'",
"left",
"'_",
",_",
"'",
"right",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"y1_",
"=_",
"max_",
"(_",
"bby",
"_",
"+_",
"py",
"1_",
"+_",
"i_",
"*_",
"dash_",
",_",
"bby",
"_",
"+_",
"py",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y2_",
"=_",
"min_",
"(_",
"bby",
"_",
"+_",
"py",
"1_",
"+_",
"(_",
"i_",
"+_",
"1_",
")_",
"*_",
"dash_",
",_",
"bby",
"_",
"+_",
"bb",
"h_",
"+_",
"py2",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x1_",
"=_",
"main",
"\\u",
"offset_",
"-_",
"(_",
"width_",
"if_",
"way_",
">_",
"0_",
"else_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x2_",
"=_",
"x1_",
"+_",
"width_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"context_",
"._",
"rectangle_",
"(_",
"x1_",
",_",
"y1_",
",_",
"x2_",
"-_",
"x1_",
",_",
"y2_",
"-_",
"y1_",
")_",
"\\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_",
"#",
" ",
"2x",
" ",
"+",
" ",
"1",
" ",
"dashes",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"._",
"clip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dash_",
"=_",
"length_",
"/_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"round_",
"(_",
"length_",
"/_",
"dash_",
")_",
"-_",
"(_",
"round_",
"(_",
"length_",
"/_",
"dash_",
")_",
"+_",
"1_",
")_",
"%_",
"2_",
")_",
"or_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"int_",
"(_",
"round_",
"(_",
"length_",
"/_",
"dash_",
")_",
")_",
",_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"side_",
"==_",
"'",
"top",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"context_",
"._",
"rectangle_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"bb",
"x_",
"+_",
"i_",
"*_",
"dash_",
",_",
"bby",
"_",
",_",
"dash_",
",_",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"right",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"context_",
"._",
"rectangle_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"bb",
"x_",
"+_",
"bb",
"w_",
"-_",
"width_",
",_",
"bby",
"_",
"+_",
"i_",
"*_",
"dash_",
",_",
"width_",
",_",
"dash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"bottom",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"context_",
"._",
"rectangle_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"bb",
"x_",
"+_",
"i_",
"*_",
"dash_",
",_",
"bby",
"_",
"+_",
"bb",
"h_",
"-_",
"width_",
",_",
"dash_",
",_",
"width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"side_",
"==_",
"'",
"left",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"context_",
"._",
"rectangle_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"bb",
"x_",
",_",
"bby",
"_",
"+_",
"i_",
"*_",
"dash_",
",_",
"width_",
",_",
"dash_",
")_",
"\\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_",
"context_",
"._",
"clip_",
"(_",
")_",
"\\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,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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | VisTrails/VisTrails/vistrails/db/versions/v0_3_0/domain/auto_gen.py | [
{
"content": " def db_add_data(self, data):\n self.__db_datas.append(data)",
"metadata": "root.DBAction.db_add_data",
"header": "['class', 'DBAction', '(', 'object', ')', ':', '___EOS___']",
"index": 588
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"DBA",
"ction_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"db",
"\\u",
"add",
"\\u",
"data_",
"(_",
"self_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"db",
"\\u",
"datas_",
"._",
"append_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | Yubico/yubikey-neo-manager/neoman/storage.py | [
{
"content": "# Copyright (c) 2013 Yubico AB\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or\n# without modification, are permitted provided that the following\n# conditions are met:\n#\n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# 2. Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided\n# with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\nimport os\nfrom PySide import QtCore\nfrom hashlib import sha1\n\n__all__ = [\n 'CONFIG_HOME',\n 'settings',\n 'capstore'\n]\n\nCONFIG_HOME = os.path.join(os.path.expanduser('~'), '.neoman')\n\nsettings = QtCore.QSettings(os.path.join(CONFIG_HOME, 'settings.ini'),\n QtCore.QSettings.IniFormat)\n\n\n\n\ncapstore = AppletCapStore(os.path.join(CONFIG_HOME, 'applets'))\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class AppletCapStore(object):\n\n\n\n\n\n",
"metadata": "root.AppletCapStore",
"header": "['module', '___EOS___']",
"index": 42
},
{
"content": " def __init__(self, basedir):\n self._dir = basedir",
"metadata": "root.AppletCapStore.__init__",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 44
},
{
"content": " def _build_fname(self, aid, version):\n return os.path.join(self._dir, aid, '%s.cap' % version)",
"metadata": "root.AppletCapStore._build_fname",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 47
},
{
"content": " def _validate_hash(self, fname, cap_sha1):\n with open(fname, 'rb') as cap:\n return sha1(cap.read()).hexdigest() == cap_sha1",
"metadata": "root.AppletCapStore._validate_hash",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def has_file(self, aid, version, cap_sha1=None):\n fname = self._build_fname(aid, version)\n if os.path.isfile(fname):\n if cap_sha1 and not self._validate_hash(fname, cap_sha1):\n return False\n return True\n return False",
"metadata": "root.AppletCapStore.has_file",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 54
},
{
"content": " def get_filename(self, aid, version, cap_sha1=None):\n fname = self._build_fname(aid, version)\n if not self.has_file(aid, version):\n raise ValueError(\"File not found: %s\" % fname)\n if cap_sha1 and not self._validate_hash(fname, cap_sha1):\n raise ValueError(\"Incorrect SHA1 hash!\")\n return fname",
"metadata": "root.AppletCapStore.get_filename",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 62
},
{
"content": " def store_data(self, aid, version, data, cap_sha1=None):\n fname = self._build_fname(aid, version)\n QtCore.QDir.root().mkpath(os.path.dirname(fname))\n target = QtCore.QFile(fname)\n target.open(QtCore.QIODevice.WriteOnly)\n if target.write(data) == -1:\n raise ValueError(\"Unable to write data!\")\n target.close()\n if cap_sha1 and not self._validate_hash(fname, cap_sha1):\n target.remove()\n raise ValueError(\"Incorrect SHA1 hash!\")",
"metadata": "root.AppletCapStore.store_data",
"header": "['class', 'AppletCapStore', '(', 'object', ')', ':', '___EOS___']",
"index": 70
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2013",
" ",
"Yu",
"bic",
"o",
" ",
"AB_",
"\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"with",
"out",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"condition",
"s",
" ",
"are",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"1",
".",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above",
" ",
"copyright_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"2",
".",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"AND",
" ",
"ANY",
" ",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
",",
" ",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LIMIT",
"ED",
" ",
"TO",
",",
" ",
"THE",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"AND",
" ",
"FIT",
"NESS",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"ARE",
" ",
"DISC",
"LAI",
"MED",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ER",
" ",
"OR",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"DIRECT",
",",
" ",
"INDI",
"RECT",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"INC",
"IDENT",
"AL",
",",
" ",
"SPECIAL",
",",
" ",
"EXE",
"MPL",
"ARY",
",",
" ",
"OR",
" ",
"CONS",
"EQU",
"ENTI",
"AL",
" ",
"DA",
"MAGE",
"S",
" ",
"(",
"INC",
"LU",
"DING",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",",
" ",
"PROC",
"URE",
"MENT",
" ",
"OF",
" ",
"SUBST",
"ITU",
"TE",
" ",
"GOOD",
"S",
" ",
"OR",
" ",
"SERVICES",
";_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LOSS",
" ",
"OF",
" ",
"USE",
",",
" ",
"DATA",
",",
" ",
"OR",
" ",
"PROF",
"IT",
"S",
";",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")",
" ",
"HO",
"WE",
"VER_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",",
" ",
"STRI",
"CT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
")",
" ",
"ARI",
"SIN",
"G",
" ",
"IN_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF",
" ",
"ADV",
"ISE",
"D",
" ",
"OF",
" ",
"THE",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"POS",
"SIB",
"ILI",
"TY",
" ",
"OF",
" ",
"SUC",
"H",
" ",
"DA",
"MAGE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"Py",
"Side_",
"import_",
"Qt",
"Core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"hashlib_",
"import_",
"sha1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CONFIG",
"\\u",
"HOM",
"E",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"settings",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"caps",
"tore",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CONFIG",
"\\u",
"HOME_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"'~'_",
")_",
",_",
"'.",
"neo",
"man",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"settings_",
"=_",
"Qt",
"Core_",
"._",
"QS",
"ettings_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"CONFIG",
"\\u",
"HOME_",
",_",
"'",
"settings",
".",
"ini",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Qt",
"Core_",
"._",
"QS",
"ettings_",
"._",
"Ini",
"Format_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"caps",
"tore_",
"=_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"CONFIG",
"\\u",
"HOME_",
",_",
"'",
"applet",
"s",
"'_",
")_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"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_",
",_",
"basedir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"dir_",
"=_",
"basedir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"build",
"\\u",
"fname_",
"(_",
"self_",
",_",
"aid_",
",_",
"version_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"self_",
"._",
"\\u",
"dir_",
",_",
"aid_",
",_",
"'%",
"s",
".",
"cap",
"'_",
"%_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"validat",
"e\\u",
"hash_",
"(_",
"self_",
",_",
"fname_",
",_",
"cap",
"\\u",
"sha1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"fname_",
",_",
"'",
"rb",
"'_",
")_",
"as_",
"cap_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"sha1_",
"(_",
"cap_",
"._",
"read_",
"(_",
")_",
")_",
"._",
"hexdigest_",
"(_",
")_",
"==_",
"cap",
"\\u",
"sha1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"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_",
"has",
"\\u",
"file_",
"(_",
"self_",
",_",
"aid_",
",_",
"version_",
",_",
"cap",
"\\u",
"sha1_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fname_",
"=_",
"self_",
"._",
"\\u",
"build",
"\\u",
"fname_",
"(_",
"aid_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"fname_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"cap",
"\\u",
"sha1_",
"and_",
"not_",
"self_",
"._",
"\\u",
"validat",
"e\\u",
"hash_",
"(_",
"fname_",
",_",
"cap",
"\\u",
"sha1_",
")_",
":_",
"\\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\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"filename_",
"(_",
"self_",
",_",
"aid_",
",_",
"version_",
",_",
"cap",
"\\u",
"sha1_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fname_",
"=_",
"self_",
"._",
"\\u",
"build",
"\\u",
"fname_",
"(_",
"aid_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"has",
"\\u",
"file_",
"(_",
"aid_",
",_",
"version_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"File",
" ",
"not",
" ",
"found",
":",
" ",
"%",
"s",
"\"_",
"%_",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cap",
"\\u",
"sha1_",
"and_",
"not_",
"self_",
"._",
"\\u",
"validat",
"e\\u",
"hash_",
"(_",
"fname_",
",_",
"cap",
"\\u",
"sha1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Inco",
"rrect",
" ",
"SHA",
"1",
" ",
"hash",
"!\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"fname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Apple",
"t",
"Cap",
"Store_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"store",
"\\u",
"data_",
"(_",
"self_",
",_",
"aid_",
",_",
"version_",
",_",
"data_",
",_",
"cap",
"\\u",
"sha1_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fname_",
"=_",
"self_",
"._",
"\\u",
"build",
"\\u",
"fname_",
"(_",
"aid_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Qt",
"Core_",
"._",
"QD",
"ir_",
"._",
"root_",
"(_",
")_",
"._",
"mk",
"path_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"fname_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"target_",
"=_",
"Qt",
"Core_",
"._",
"QF",
"ile_",
"(_",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"target_",
"._",
"open_",
"(_",
"Qt",
"Core_",
"._",
"QI",
"OD",
"evice",
"_",
"._",
"Write",
"Only_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"target_",
"._",
"write_",
"(_",
"data_",
")_",
"==_",
"-_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Una",
"ble",
" ",
"to",
" ",
"write",
" ",
"data",
"!\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"target_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cap",
"\\u",
"sha1_",
"and_",
"not_",
"self_",
"._",
"\\u",
"validat",
"e\\u",
"hash_",
"(_",
"fname_",
",_",
"cap",
"\\u",
"sha1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target_",
"._",
"remove_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"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,
2,
2,
2,
2,
2
] |
Unused local variable | tabatkins/bikeshed/bikeshed/widlparser/widlparser/markup.py | [
{
"content": " def addName(self, name):\n if (name):\n self.children.append(MarkupName(name))",
"metadata": "root.MarkupGenerator.addName",
"header": "['class', 'MarkupGenerator', '(', 'object', ')', ':', '___EOS___']",
"index": 33
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Mark",
"up",
"Generator_",
"(_",
"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",
"Name_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"children_",
"._",
"append_",
"(_",
"Mark",
"up",
"Name_",
"(_",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | concurrence/concurrence/lib/concurrence/io/buffered.py | [
{
"content": " def read(self, n = -1):\n reader = self._reader\n buffer = reader.buffer\n s = []\n if n == -1: #read all available bytes until EOF\n while True:\n s.append(buffer.read_bytes(-1))\n try:\n reader._read_more()\n except EOFError:\n buffer.flip()\n break\n else:\n while n > 0: #read uptill n avaiable bytes or EOF\n r = buffer.remaining \n if r > 0:\n s.append(buffer.read_bytes(min(n, r)))\n n -= r \n else:\n try:\n reader._read_more()\n except EOFError:\n buffer.flip()\n break \n return ''.join(s)",
"metadata": "root.CompatibleFile.read",
"header": "['class', 'CompatibleFile', '(', 'object', ')', ':', '___EOS___']",
"index": 151
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Compatible",
"File_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"read_",
"(_",
"self_",
",_",
"n_",
"=_",
"-_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"reader_",
"=_",
"self_",
"._",
"\\u",
"reader_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"buffer_",
"=_",
"reader_",
"._",
"buffer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"n_",
"==_",
"-_",
"1_",
":_",
"#",
"read",
" ",
"all",
" ",
"avail",
"able",
" ",
"bytes",
" ",
"unti",
"l",
" ",
"EOF_",
"\\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 ",
" _",
"s_",
"._",
"append_",
"(_",
"buffer_",
"._",
"read",
"\\u",
"bytes_",
"(_",
"-_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"reader_",
"._",
"\\u",
"read",
"\\u",
"more_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"EO",
"FE",
"rror_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"buffer_",
"._",
"flip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"n_",
">_",
"0_",
":_",
"#",
"read",
" ",
"upti",
"ll",
" ",
"n",
" ",
"ava",
"iable",
" ",
"bytes",
" ",
"or",
" ",
"EOF_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"buffer_",
"._",
"remaining_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"r_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"s_",
"._",
"append_",
"(_",
"buffer_",
"._",
"read",
"\\u",
"bytes_",
"(_",
"min_",
"(_",
"n_",
",_",
"r_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"n_",
"-=_",
"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 ",
" ",
"_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"reader_",
"._",
"\\u",
"read",
"\\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
] |
Comparison of constants | log2timeline/dfvfs/utils/review.py | [
{
"content": " def CheckRemoteGitState(self):\n \"\"\"Checks the state of the remote git repository.\n\n Returns:\n A boolean value to indicate if the state is sane.\n \"\"\"\n if self._command == u'close':\n if not self._git_helper.SynchronizeWithUpstream():\n print((\n u'{0:s} aborted - unable to synchronize with '\n u'upstream/master.').format(self._command.title()))\n return False\n\n elif self._command in (u'create', u'update'):\n if not self._git_helper.CheckSynchronizedWithUpstream():\n if not self._git_helper.SynchronizeWithUpstream():\n print((\n u'{0:s} aborted - unable to synchronize with '\n u'upstream/master.').format(self._command.title()))\n return False\n\n force_push = True\n else:\n force_push = False\n\n if not self._git_helper.PushToOrigin(\n self._active_branch, force=force_push):\n print(u'{0:s} aborted - unable to push updates to origin/{1:s}.'.format(\n self._command.title(), self._active_branch))\n return False\n\n elif self._command == u'lint':\n self._git_helper.CheckSynchronizedWithUpstream()\n\n elif self._command == u'merge':\n if not self._git_helper.SynchronizeWithOrigin():\n print((\n u'{0:s} aborted - unable to synchronize with '\n u'origin/master.').format(self._command.title()))\n return False\n\n return True",
"metadata": "root.ReviewHelper.CheckRemoteGitState",
"header": "['class', 'ReviewHelper', '(', 'object', ')', ':', '___EOS___']",
"index": 1391
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"Review",
"Helper_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Check",
"Remo",
"te",
"Git",
"State_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Check",
"s",
" ",
"the",
" ",
"state",
" ",
"of",
" ",
"the",
" ",
"remote",
" ",
"git",
" ",
"repos",
"itor",
"y",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"A",
" ",
"boolean",
" ",
"value",
" ",
"to",
" ",
"indicat",
"e",
" ",
"if",
" ",
"the",
" ",
"state",
" ",
"is",
" ",
"sane",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"command_",
"==_",
"u",
"'",
"close",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Synchronize",
"With",
"Ups",
"tream_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'{",
"0",
":",
"s",
"}",
" ",
"abort",
"ed",
" ",
"-",
" ",
"una",
"ble",
" ",
"to",
" ",
"synchronize",
" ",
"with",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"ups",
"tream",
"/",
"master",
".'_",
")_",
"._",
"format_",
"(_",
"self_",
"._",
"\\u",
"command_",
"._",
"title_",
"(_",
")_",
")_",
")_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"command_",
"in_",
"(_",
"u",
"'",
"create",
"'_",
",_",
"u",
"'",
"update",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Check",
"Synchronize",
"d",
"With",
"Ups",
"tream_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Synchronize",
"With",
"Ups",
"tream_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'{",
"0",
":",
"s",
"}",
" ",
"abort",
"ed",
" ",
"-",
" ",
"una",
"ble",
" ",
"to",
" ",
"synchronize",
" ",
"with",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"ups",
"tream",
"/",
"master",
".'_",
")_",
"._",
"format_",
"(_",
"self_",
"._",
"\\u",
"command_",
"._",
"title_",
"(_",
")_",
")_",
")_",
"\\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_",
"force",
"\\u",
"push_",
"=_",
"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 ",
" _",
"force",
"\\u",
"push_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Push",
"To",
"Origin_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"active",
"\\u",
"branch_",
",_",
"force_",
"=_",
"force",
"\\u",
"push_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"u",
"'{",
"0",
":",
"s",
"}",
" ",
"abort",
"ed",
" ",
"-",
" ",
"una",
"ble",
" ",
"to",
" ",
"push",
" ",
"update",
"s",
" ",
"to",
" ",
"orig",
"in",
"/{",
"1",
":",
"s",
"}.'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"command_",
"._",
"title_",
"(_",
")_",
",_",
"self_",
"._",
"\\u",
"active",
"\\u",
"branch_",
")_",
")_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"command_",
"==_",
"u",
"'",
"lint",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Check",
"Synchronize",
"d",
"With",
"Ups",
"tream_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"command_",
"==_",
"u",
"'",
"merge",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"\\u",
"git",
"\\u",
"helper_",
"._",
"Synchronize",
"With",
"Origin_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'{",
"0",
":",
"s",
"}",
" ",
"abort",
"ed",
" ",
"-",
" ",
"una",
"ble",
" ",
"to",
" ",
"synchronize",
" ",
"with",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"orig",
"in",
"/",
"master",
".'_",
")_",
"._",
"format_",
"(_",
"self_",
"._",
"\\u",
"command_",
"._",
"title_",
"(_",
")_",
")_",
")_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"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,
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
] |
Unused local variable | redapple/sql2graph/sql2graph/graph.py | [
{
"content": " def add_node(self, node):\n \"\"\"\n Add a node to the node list\n Returns the node position in the list\n \"\"\"\n # self.node_list.append(node)\n # do not actually store the Node,\n # just pretend it is at position X (current size of list)\n self.node_list_size += 1\n\n node.save_node_id(self.node_list_size)\n\n node_pk = node.get_entity_pk()\n if node_pk:\n self.reverse_lookup.append(node.entity.name, node_pk, node.get_node_id())\n else:\n print node, \"has no entity PK\"\n raise RuntimeError\n\n # reset last lookup cache\n self.last_lookup, self.last_lookup_result = None, None\n\n return node.get_node_id()",
"metadata": "root.NodeList.add_node",
"header": "['class', 'NodeList', '(', 'object', ')', ':', '___EOS___']",
"index": 122
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Node",
"List_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"node_",
"(_",
"self_",
",_",
"node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Add",
" ",
"a",
" ",
"node",
" ",
"to",
" ",
"the",
" ",
"node",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"node",
" ",
"position",
" ",
"in",
" ",
"the",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"self",
".",
"node",
"\\u",
"list",
".",
"append",
"(",
"node",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"do",
" ",
"not",
" ",
"actual",
"ly",
" ",
"store",
" ",
"the",
" ",
"Node",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"just",
" ",
"prete",
"nd",
" ",
"it",
" ",
"is",
" ",
"at",
" ",
"position",
" ",
"X",
" ",
"(",
"current",
" ",
"size",
" ",
"of",
" ",
"list",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"node",
"\\u",
"list",
"\\u",
"size_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"node_",
"._",
"save",
"\\u",
"node",
"\\u",
"id_",
"(_",
"self_",
"._",
"node",
"\\u",
"list",
"\\u",
"size_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"node",
"\\u",
"pk_",
"=_",
"node_",
"._",
"get",
"\\u",
"entity",
"\\u",
"pk_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"node",
"\\u",
"pk_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reverse",
"\\u",
"lookup_",
"._",
"append_",
"(_",
"node_",
"._",
"entity_",
"._",
"name_",
",_",
"node",
"\\u",
"pk_",
",_",
"node_",
"._",
"get",
"\\u",
"node",
"\\u",
"id_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"node_",
",_",
"\"",
"has",
" ",
"no",
" ",
"entity",
" ",
"PK",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Run",
"time",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reset",
" ",
"last",
" ",
"look",
"up",
" ",
"cache_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"last",
"\\u",
"lookup_",
",_",
"self_",
"._",
"last",
"\\u",
"look",
"up",
"\\u",
"result_",
"=_",
"None_",
",_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"node_",
"._",
"get",
"\\u",
"node",
"\\u",
"id_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | dropbox/changes/changes/jobs/update_local_repos.py | [
{
"content": "def update_local_repos():\n \"\"\"\n Updates repositories locally.\n \"\"\"\n repo_list = list(Repository.query.filter(\n Repository.status != RepositoryStatus.inactive,\n ))\n\n for repo in repo_list:\n vcs = repo.get_vcs()\n # Close the read transaction to avoid a long running transaction\n db.session.commit()\n\n if vcs is None:\n logger.warning('Repository %s has no VCS backend set', repo.id)\n continue\n\n try:\n if vcs.exists():\n vcs.update()\n else:\n vcs.clone()\n except ConcurrentUpdateError:\n # The repo is already updating already. No need to update.\n pass\n except CommandError:\n logging.exception('Failed to update %s', repo.url)",
"metadata": "root.update_local_repos",
"header": "['module', '___EOS___']",
"index": 10
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"update",
"\\u",
"local",
"\\u",
"repos_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Update",
"s",
" ",
"repos",
"itori",
"es",
" ",
"local",
"ly",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"repo",
"\\u",
"list_",
"=_",
"list_",
"(_",
"Repository_",
"._",
"query_",
"._",
"filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Repository_",
"._",
"status_",
"!=_",
"Repos",
"itor",
"y",
"Status_",
"._",
"inactive_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"repo_",
"in_",
"repo",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vcs_",
"=_",
"repo_",
"._",
"get",
"\\u",
"vcs_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Clos",
"e",
" ",
"the",
" ",
"read",
" ",
"transaction",
" ",
"to",
" ",
"avoid",
" ",
"a",
" ",
"long",
" ",
"runn",
"ing",
" ",
"transaction_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"session_",
"._",
"commit_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"vcs_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"warning_",
"(_",
"'",
"Repos",
"itor",
"y",
" ",
"%",
"s",
" ",
"has",
" ",
"no",
" ",
"VCS",
" ",
"back",
"end",
" ",
"set",
"'_",
",_",
"repo_",
"._",
"id_",
")_",
"\\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 ",
" _",
"if_",
"vcs_",
"._",
"exists_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vcs_",
"._",
"update_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vcs_",
"._",
"clone_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Conc",
"urrent",
"Update",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"repo",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"updat",
"ing",
" ",
"alr",
"ead",
"y",
".",
" ",
"No",
" ",
"need",
" ",
"to",
" ",
"update",
"._",
"\\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_",
"except_",
"Command",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"exception_",
"(_",
"'",
"Fail",
"ed",
" ",
"to",
" ",
"update",
" ",
"%",
"s",
"'_",
",_",
"repo_",
"._",
"url_",
")_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | vinitkumar/googlecl/src/googlecl/__init__.py | [
{
"content": "def get_xdg_path(filename, data_type, default_directories=None,\n create_missing_dir=False):\n \"\"\"Get the full path to a file using XDG file layout spec.\n\n Follows XDG Base Directory Specification.\n (http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).\n Tries default_directories and DEFAULT_GOOGLECL_DIR if no file is found\n via XDG spec.\n\n Keyword arguments:\n filename: Filename of the file.\n data_type: One of 'config' for config files or 'data' for data files.\n default_directories: List of directories to check if no file is found\n in directories specified by XDG spec and DEFAULT_GOOGLECL_DIR.\n Default None.\n create_missing_dir: Whether or not to create a missing config subdirectory\n in the default base directory. Default False.\n\n Returns:\n Path to config file, which may not exist. If create_missing_dir,\n the directory where the config file should be will be created if it\n does not exist.\n\n \"\"\"\n data_type = data_type.upper()\n if data_type not in ('CONFIG', 'DATA'):\n raise Exception('Invalid value for data_type: ' + data_type)\n xdg_home_dir = os.environ.get('XDG_' + data_type + '_HOME')\n if not xdg_home_dir:\n home_dir = os.path.expanduser('~')\n if data_type == 'DATA':\n xdg_home_dir = os.path.join(home_dir, '.local', 'share')\n elif data_type == 'CONFIG':\n # No variable defined, using $HOME/.config\n xdg_home_dir = os.path.join(home_dir, '.config')\n xdg_home_dir = os.path.join(xdg_home_dir, SUBDIR_NAME)\n\n xdg_dir_list = os.environ.get('XDG_' + data_type + '_DIRS')\n if not xdg_dir_list:\n if data_type == 'DATA':\n xdg_dir_list = '/usr/local/share/:/usr/share/'\n elif data_type == 'CONFIG':\n xdg_dir_list = '/etc/xdg'\n xdg_dir_list = [os.path.join(d, SUBDIR_NAME)\n for d in xdg_dir_list.split(':')]\n\n dir_list = [os.path.abspath('.'), xdg_home_dir] + xdg_dir_list +\\\n [DEFAULT_GOOGLECL_DIR]\n if default_directories:\n dir_list += default_directories\n for directory in dir_list:\n config_path = os.path.join(directory, filename)\n if os.path.isfile(config_path):\n return config_path\n LOG.debug('Could not find ' + filename + ' in any of ' + str(dir_list))\n\n if os.name == 'posix':\n default_dir = xdg_home_dir\n mode = 0700\n else:\n default_dir = DEFAULT_GOOGLECL_DIR\n mode = 0777\n if not os.path.isdir(default_dir) and create_missing_dir:\n try:\n os.makedirs(default_dir, mode)\n except OSError, err:\n LOG.error(err)\n return ''\n return os.path.join(default_dir, filename)",
"metadata": "root.get_xdg_path",
"header": "['module', '___EOS___']",
"index": 129
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"xdg",
"\\u",
"path_",
"(_",
"filename_",
",_",
"data\\u",
"type_",
",_",
"default",
"\\u",
"directories_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"create",
"\\u",
"missi",
"ng",
"\\u",
"dir_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Get",
" ",
"the",
" ",
"full",
" ",
"path",
" ",
"to",
" ",
"a",
" ",
"file",
" ",
"usi",
"ng",
" ",
"XD",
"G",
" ",
"file",
" ",
"layout",
" ",
"spec",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Follow",
"s",
" ",
"XD",
"G",
" ",
"Base",
" ",
"Director",
"y",
" ",
"Specification",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"http",
"://",
"standard",
"s",
".",
"freed",
"es",
"kto",
"p",
".",
"org",
"/",
"basedir",
"-",
"spec",
"/",
"basedir",
"-",
"spec",
"-",
"late",
"st",
".",
"html",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Trie",
"s",
" ",
"default",
"\\u",
"director",
"ies",
" ",
"and",
" ",
"DEF",
"AUL",
"T",
"\\u",
"GO",
"OG",
"LE",
"CL",
"\\u",
"DIR",
" ",
"if",
" ",
"no",
" ",
"file",
" ",
"is",
" ",
"found",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"via",
" ",
"XD",
"G",
" ",
"spec",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Key",
"word",
" ",
"argu",
"ment",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"filename",
":",
" ",
"File",
"name",
" ",
"of",
" ",
"the",
" ",
"file",
".",
"\\",
"10",
";",
" ",
" ",
"data\\u",
"type",
":",
" ",
"One",
" ",
"of",
" ",
"'",
"config",
"'",
" ",
"for",
" ",
"config",
" ",
"files",
" ",
"or",
" ",
"'",
"data",
"'",
" ",
"for",
" ",
"data",
" ",
"files",
".",
"\\",
"10",
";",
" ",
" ",
"default",
"\\u",
"director",
"ies",
":",
" ",
"List",
" ",
"of",
" ",
"director",
"ies",
" ",
"to",
" ",
"check",
" ",
"if",
" ",
"no",
" ",
"file",
" ",
"is",
" ",
"found",
"\\",
"10",
";",
" ",
" ",
"in",
" ",
"director",
"ies",
" ",
"specified",
" ",
"by",
" ",
"XD",
"G",
" ",
"spec",
" ",
"and",
" ",
"DEF",
"AUL",
"T",
"\\u",
"GO",
"OG",
"LE",
"CL",
"\\u",
"DIR",
".",
"\\",
"10",
";",
" ",
" ",
"Default",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
" ",
" ",
"create",
"\\u",
"missi",
"ng",
"\\u",
"dir",
":",
" ",
"Whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"to",
" ",
"create",
" ",
"a",
" ",
"missi",
"ng",
" ",
"config",
" ",
"subdirectory",
"\\",
"10",
";",
" ",
" ",
"in",
" ",
"the",
" ",
"default",
" ",
"base",
" ",
"director",
"y",
".",
" ",
"Default",
" ",
"Fal",
"se",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"Path",
" ",
"to",
" ",
"config",
" ",
"file",
",",
" ",
"whi",
"ch",
" ",
"may",
" ",
"not",
" ",
"exist",
".",
" ",
"If",
" ",
"create",
"\\u",
"missi",
"ng",
"\\u",
"dir",
",",
"\\",
"10",
";",
" ",
" ",
"the",
" ",
"director",
"y",
" ",
"where",
" ",
"the",
" ",
"config",
" ",
"file",
" ",
"shou",
"ld",
" ",
"be",
" ",
"will",
" ",
"be",
" ",
"created",
" ",
"if",
" ",
"it",
"\\",
"10",
";",
" ",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"type_",
"=_",
"data\\u",
"type_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"data\\u",
"type_",
"not_",
"in_",
"(_",
"'",
"CONFIG",
"'_",
",_",
"'",
"DATA",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Inva",
"lid",
" ",
"value",
" ",
"for",
" ",
"data\\u",
"type",
":",
" ",
"'_",
"+_",
"data\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"XD",
"G",
"\\u'_",
"+_",
"data\\u",
"type_",
"+_",
"'\\u",
"HOM",
"E",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"home",
"\\u",
"dir_",
"=_",
"os_",
"._",
"path_",
"._",
"expanduser_",
"(_",
"'~'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"data\\u",
"type_",
"==_",
"'",
"DATA",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"home",
"\\u",
"dir_",
",_",
"'.",
"local",
"'_",
",_",
"'",
"share",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"data\\u",
"type_",
"==_",
"'",
"CONFIG",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"No",
" ",
"variab",
"le",
" ",
"defin",
"ed",
",",
" ",
"usi",
"ng",
" ",
"$",
"HOM",
"E",
"/.",
"config_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"home",
"\\u",
"dir_",
",_",
"'.",
"config",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
",_",
"SUB",
"DIR",
"\\u",
"NAME_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"xdg",
"\\u",
"dir\\u",
"list_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"XD",
"G",
"\\u'_",
"+_",
"data\\u",
"type_",
"+_",
"'\\u",
"DIR",
"S",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"xdg",
"\\u",
"dir\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"data\\u",
"type_",
"==_",
"'",
"DATA",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xdg",
"\\u",
"dir\\u",
"list_",
"=_",
"'/",
"usr",
"/",
"local",
"/",
"share",
"/",
":/",
"usr",
"/",
"share",
"/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"data\\u",
"type_",
"==_",
"'",
"CONFIG",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xdg",
"\\u",
"dir\\u",
"list_",
"=_",
"'/",
"etc",
"/",
"xdg",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"xdg",
"\\u",
"dir\\u",
"list_",
"=_",
"[_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"d_",
",_",
"SUB",
"DIR",
"\\u",
"NAME_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"d_",
"in_",
"xdg",
"\\u",
"dir\\u",
"list_",
"._",
"split_",
"(_",
"':'_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dir\\u",
"list_",
"=_",
"[_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"'.'_",
")_",
",_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"]_",
"+_",
"xdg",
"\\u",
"dir\\u",
"list_",
"+_",
"[_",
"DEF",
"AUL",
"T",
"\\u",
"GO",
"OG",
"LE",
"CL",
"\\u",
"DIR_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"default",
"\\u",
"directories_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dir\\u",
"list_",
"+=_",
"default",
"\\u",
"directories_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"directory_",
"in_",
"dir\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"config",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"directory_",
",_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"config",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"config",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"'",
"Cou",
"ld",
" ",
"not",
" ",
"find",
" ",
"'_",
"+_",
"filename_",
"+_",
"'",
" ",
"in",
" ",
"any",
" ",
"of",
" ",
"'_",
"+_",
"str_",
"(_",
"dir\\u",
"list_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"os_",
"._",
"name_",
"==_",
"'",
"posix",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"default",
"\\u",
"dir_",
"=_",
"xdg",
"\\u",
"home",
"\\u",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mode_",
"=_",
"0_",
"700_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"default",
"\\u",
"dir_",
"=_",
"DEF",
"AUL",
"T",
"\\u",
"GO",
"OG",
"LE",
"CL",
"\\u",
"DIR_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mode_",
"=_",
"0_",
"777_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"isdir_",
"(_",
"default",
"\\u",
"dir_",
")_",
"and_",
"create",
"\\u",
"missi",
"ng",
"\\u",
"dir_",
":_",
"\\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_",
"._",
"makedirs_",
"(_",
"default",
"\\u",
"dir_",
",_",
"mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"OSE",
"rror_",
",_",
"err_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"LOG_",
"._",
"error_",
"(_",
"err_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"default",
"\\u",
"dir_",
",_",
"filename_",
")_",
"\\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,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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
] |
Comparison of constants | datadesk/python-documentcloud/documentcloud/MultipartPostHandler.py | [
{
"content": "#!/usr/bin/python\n\n####\n# 02/2006 Will Holcomb <wholcomb@gmail.com>\n\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published by the Free Software Foundation; either\n# version 2.1 of the License, or (at your option) any later version.\n\n# This library is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n# Lesser General Public License for more details.\n#\n# 7/26/07 Slightly modified by Brian Schneider\n# in order to support unicode files ( multipart_encode function )\n\"\"\"\nUsage:\n Enables the use of multipart/form-data for posting forms\n\nInspirations:\n Upload files in python:\n http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306\n urllib2_file:\n Fabien Seisen: <fabien@seisen.org>\n\nExample:\n import MultipartPostHandler, urllib2, cookielib\n\n cookies = cookielib.CookieJar()\n opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),\n MultipartPostHandler.MultipartPostHandler)\n params = { \"username\" : \"bob\", \"password\" : \"riviera\",\n \"file\" : open(\"filename\", \"rb\") }\n opener.open(\"http://wwww.bobsite.com/upload/\", params)\n\nFurther Example:\n The main function of this file is a sample which downloads a page and\n then uploads it to the W3C validator.\n\"\"\"\nimport os\nimport sys\nimport six\nimport tempfile\nimport mimetypes\nfrom os import SEEK_END\nif six.PY3:\n import io\n import urllib.parse\n import urllib.request\n from email.generator import _make_boundary as choose_boundary\nelse:\n import cStringIO as io\n from six.moves import urllib\n from mimetools import choose_boundary\n\n# Controls how sequences are uncoded. If true, elements\n# may be given multiple values byassigning a sequence.\ndoseq = 1\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[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_",
"#",
" ",
"02",
"/",
"2006",
" ",
"Wil",
"l",
" ",
"Hol",
"comb",
" ",
"<",
"who",
"lco",
"mb",
"@",
"gma",
"il",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"librar",
"y",
" ",
"is",
" ",
"free",
" ",
"software",
";",
" ",
"you",
" ",
"can",
" ",
"redis",
"tribut",
"e",
" ",
"it",
" ",
"and",
"/",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"modif",
"y",
" ",
"it",
" ",
"under",
" ",
"the",
" ",
"term",
"s",
" ",
"of",
" ",
"the",
" ",
"GN",
"U",
" ",
"Less",
"er",
" ",
"General",
" ",
"Public",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
" ",
"as",
" ",
"publi",
"shed",
" ",
"by",
" ",
"the",
" ",
"Free",
" ",
"Sof",
"twa",
"re",
" ",
"Foun",
"dati",
"on",
";",
" ",
"eit",
"her_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"version",
" ",
"2.1",
" ",
"of",
" ",
"the",
" ",
"License",
",",
" ",
"or",
" ",
"(",
"at",
" ",
"your",
" ",
"option",
")",
" ",
"any",
" ",
"late",
"r",
" ",
"version",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"librar",
"y",
" ",
"is",
" ",
"distributed",
" ",
"in",
" ",
"the",
" ",
"hop",
"e",
" ",
"tha",
"t",
" ",
"it",
" ",
"will",
" ",
"be",
" ",
"usef",
"ul",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"but",
" ",
"WITH",
"OUT",
" ",
"ANY",
" ",
"WAR",
"RAN",
"TY",
";",
" ",
"with",
"out",
" ",
"even",
" ",
"the",
" ",
"impli",
"ed",
" ",
"warr",
"ant",
"y",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"or",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"GN",
"U_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Less",
"er",
" ",
"General",
" ",
"Public",
" ",
"License",
" ",
"for",
" ",
"more",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"7",
"/",
"2",
"6",
"/",
"0",
"7",
" ",
"Sli",
"ght",
"ly",
" ",
"modifi",
"ed",
" ",
"by",
" ",
"Brian",
" ",
"Sch",
"nei",
"der_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"support",
" ",
"unicode",
" ",
"files",
" ",
"(",
" ",
"multip",
"art",
"\\u",
"encode",
" ",
"function",
" ",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Us",
"age",
":",
"\\",
"10",
";",
" ",
" ",
"Enable",
"s",
" ",
"the",
" ",
"use",
" ",
"of",
" ",
"multip",
"art",
"/",
"form",
"-",
"data",
" ",
"for",
" ",
"posting",
" ",
"forms",
"\\",
"10",
";",
"\\",
"10",
";",
"Ins",
"pirat",
"ion",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"Upload",
" ",
"files",
" ",
"in",
" ",
"python",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"http",
"://",
"asp",
"n",
".",
"active",
"state",
".",
"com",
"/",
"ASP",
"N",
"/",
"Coo",
"kb",
"ook",
"/",
"Pyth",
"on",
"/",
"Recip",
"e",
"/",
"146",
"306",
"\\",
"10",
";",
" ",
" ",
"url",
"lib",
"2",
"\\u",
"file",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fab",
"ien",
" ",
"Sei",
"sen",
":",
" ",
"<",
"fab",
"ien",
"@",
"seis",
"en",
".",
"org",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"Exam",
"ple",
":",
"\\",
"10",
";",
" ",
" ",
"import",
" ",
"Multipart",
"Post",
"Handle",
"r",
",",
" ",
"url",
"lib",
"2",
",",
" ",
"cookie",
"lib",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"cookie",
"s",
" ",
"=",
" ",
"cookie",
"lib",
".",
"Cooki",
"e",
"Jar",
"()",
"\\",
"10",
";",
" ",
" ",
"opene",
"r",
" ",
"=",
" ",
"url",
"lib",
"2",
".",
"build",
"\\u",
"opene",
"r",
"(",
"url",
"lib",
"2",
".",
"HTTP",
"Cooki",
"e",
"Process",
"or",
"(",
"cookie",
"s",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"Multipart",
"Post",
"Handle",
"r",
".",
"Multipart",
"Post",
"Handle",
"r",
")",
"\\",
"10",
";",
" ",
" ",
"params",
" ",
"=",
" ",
"{",
" ",
"\"",
"user",
"name",
"\"",
" ",
":",
" ",
"\"",
"bob",
"\",",
" ",
"\"",
"password",
"\"",
" ",
":",
" ",
"\"",
"riv",
"ier",
"a",
"\",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"\"",
"file",
"\"",
" ",
":",
" ",
"open",
"(\"",
"filename",
"\",",
" ",
"\"",
"rb",
"\")",
" ",
"}",
"\\",
"10",
";",
" ",
" ",
"opene",
"r",
".",
"open",
"(\"",
"http",
"://",
"www",
"w",
".",
"bob",
"site",
".",
"com",
"/",
"upload",
"/\"",
",",
" ",
"params",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"Fur",
"ther",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
" ",
" ",
"The",
" ",
"main",
" ",
"function",
" ",
"of",
" ",
"this",
" ",
"file",
" ",
"is",
" ",
"a",
" ",
"sample",
" ",
"whi",
"ch",
" ",
"download",
"s",
" ",
"a",
" ",
"page",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
"then",
" ",
"uploads",
" ",
"it",
" ",
"to",
" ",
"the",
" ",
"W3",
"C",
" ",
"validator",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tempfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"mimetypes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"os_",
"import_",
"SEE",
"K",
"\\u",
"END_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"six_",
"._",
"PY",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"io_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib_",
"._",
"parse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib_",
"._",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"email_",
"._",
"generator_",
"import_",
"\\u",
"make",
"\\u",
"boundary_",
"as_",
"choose",
"\\u",
"boundary_",
"\\u\\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_",
"c",
"String",
"IO_",
"as_",
"io_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"six_",
"._",
"moves_",
"import_",
"urllib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mime",
"tools_",
"import_",
"choose",
"\\u",
"boundary_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Control",
"s",
" ",
"how",
" ",
"sequence",
"s",
" ",
"are",
" ",
"unco",
"ded",
".",
" ",
"If",
" ",
"true",
",",
" ",
"elements_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"may",
" ",
"be",
" ",
"give",
"n",
" ",
"multiple",
" ",
"values",
" ",
"by",
"assign",
"ing",
" ",
"a",
" ",
"sequence",
"._",
"\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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
] |
Variable defined multiple times | Azure/azure-sdk-for-python/azure-batch/azure/batch/operations/compute_node_operations.py | [
{
"content": " def get_remote_login_settings(\n self, pool_id, node_id, compute_node_get_remote_login_settings_options=None, custom_headers={}, raw=False, **operation_config):\n \"\"\"\n Gets the settings required for remote login to a compute node.\n\n :param pool_id: The id of the pool that contains the compute node.\n :type pool_id: str\n :param node_id: The id of the compute node for which to obtain the\n remote login settings.\n :type node_id: str\n :param compute_node_get_remote_login_settings_options: Additional\n parameters for the operation\n :type compute_node_get_remote_login_settings_options:\n :class:`ComputeNodeGetRemoteLoginSettingsOptions\n <azure.batch.models.ComputeNodeGetRemoteLoginSettingsOptions>`\n :param dict custom_headers: headers that will be added to the request\n :param bool raw: returns the direct response alongside the\n deserialized response\n :param operation_config: :ref:`Operation configuration\n overrides<msrest:optionsforoperations>`.\n :rtype: :class:`ComputeNodeGetRemoteLoginSettingsResult\n <azure.batch.models.ComputeNodeGetRemoteLoginSettingsResult>`\n :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`\n if raw=true\n \"\"\"\n timeout = None\n if compute_node_get_remote_login_settings_options is not None:\n timeout = compute_node_get_remote_login_settings_options.timeout\n client_request_id = None\n if compute_node_get_remote_login_settings_options is not None:\n client_request_id = compute_node_get_remote_login_settings_options.client_request_id\n return_client_request_id = None\n if compute_node_get_remote_login_settings_options is not None:\n return_client_request_id = compute_node_get_remote_login_settings_options.return_client_request_id\n ocp_date = None\n if compute_node_get_remote_login_settings_options is not None:\n ocp_date = compute_node_get_remote_login_settings_options.ocp_date\n\n # Construct URL\n url = '/pools/{poolId}/nodes/{nodeId}/remoteloginsettings'\n path_format_arguments = {\n 'poolId': self._serialize.url(\"pool_id\", pool_id, 'str'),\n 'nodeId': self._serialize.url(\"node_id\", node_id, 'str')\n }\n url = self._client.format_url(url, **path_format_arguments)\n\n # Construct parameters\n query_parameters = {}\n query_parameters['api-version'] = self._serialize.query(\"self.config.api_version\", self.config.api_version, 'str')\n if timeout is not None:\n query_parameters['timeout'] = self._serialize.query(\"timeout\", timeout, 'int')\n\n # Construct headers\n header_parameters = {}\n header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'\n if self.config.generate_client_request_id:\n header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())\n if custom_headers:\n header_parameters.update(custom_headers)\n if self.config.accept_language is not None:\n header_parameters['accept-language'] = self._serialize.header(\"self.config.accept_language\", self.config.accept_language, 'str')\n if client_request_id is not None:\n header_parameters['client-request-id'] = self._serialize.header(\"client_request_id\", client_request_id, 'str')\n if return_client_request_id is not None:\n header_parameters['return-client-request-id'] = self._serialize.header(\"return_client_request_id\", return_client_request_id, 'bool')\n if ocp_date is not None:\n header_parameters['ocp-date'] = self._serialize.header(\"ocp_date\", ocp_date, 'rfc-1123')\n\n # Construct and send request\n request = self._client.get(url, query_parameters)\n response = self._client.send(request, header_parameters, **operation_config)\n\n if response.status_code not in [200]:\n raise models.BatchErrorException(self._deserialize, response)\n\n deserialized = None\n header_dict = {}\n\n if response.status_code == 200:\n deserialized = self._deserialize('ComputeNodeGetRemoteLoginSettingsResult', response)\n header_dict = {\n 'client-request-id': 'str',\n 'request-id': 'str',\n 'ETag': 'str',\n 'Last-Modified': 'rfc-1123',\n }\n\n if raw:\n client_raw_response = ClientRawResponse(deserialized, response)\n client_raw_response.add_headers(header_dict)\n return client_raw_response\n\n return deserialized",
"metadata": "root.ComputeNodeOperations.get_remote_login_settings",
"header": "['class', 'ComputeNodeOperations', '(', 'object', ')', ':', '___EOS___']",
"index": 794
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Compute",
"Node",
"Operations_",
"(_",
"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",
"remote",
"\\u",
"login",
"\\u",
"settings_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
",_",
"pool",
"\\u",
"id_",
",_",
"node",
"\\u",
"id_",
",_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"=_",
"None_",
",_",
"custom",
"\\u",
"headers_",
"=_",
"{_",
"}_",
",_",
"raw_",
"=_",
"False_",
",_",
"**_",
"operati",
"on",
"\\u",
"config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Get",
"s",
" ",
"the",
" ",
"settings",
" ",
"require",
"d",
" ",
"for",
" ",
"remote",
" ",
"login",
" ",
"to",
" ",
"a",
" ",
"compute",
" ",
"node",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"pool",
"\\u",
"id",
":",
" ",
"The",
" ",
"id",
" ",
"of",
" ",
"the",
" ",
"pool",
" ",
"tha",
"t",
" ",
"contain",
"s",
" ",
"the",
" ",
"compute",
" ",
"node",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"pool",
"\\u",
"id",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"node",
"\\u",
"id",
":",
" ",
"The",
" ",
"id",
" ",
"of",
" ",
"the",
" ",
"compute",
" ",
"node",
" ",
"for",
" ",
"whi",
"ch",
" ",
"to",
" ",
"obtain",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"remote",
" ",
"login",
" ",
"settings",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"node",
"\\u",
"id",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options",
":",
" ",
"Addition",
"al",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"parameter",
"s",
" ",
"for",
" ",
"the",
" ",
"operati",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
":",
"class",
":`",
"Compute",
"Node",
"Get",
"Remo",
"te",
"Logi",
"n",
"Sett",
"ings",
"Optio",
"ns",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"<",
"azu",
"re",
".",
"batch",
".",
"model",
"s",
".",
"Compute",
"Node",
"Get",
"Remo",
"te",
"Logi",
"n",
"Sett",
"ings",
"Optio",
"ns",
">`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"dict",
" ",
"custom",
"\\u",
"header",
"s",
":",
" ",
"header",
"s",
" ",
"tha",
"t",
" ",
"will",
" ",
"be",
" ",
"adde",
"d",
" ",
"to",
" ",
"the",
" ",
"request",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"bool",
" ",
"raw",
":",
" ",
"return",
"s",
" ",
"the",
" ",
"direct",
" ",
"response",
" ",
"along",
"side",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"deserialized",
" ",
"response",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"operati",
"on",
"\\u",
"config",
":",
" ",
":",
"ref",
":`",
"Opera",
"tion",
" ",
"configura",
"tion",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"override",
"s",
"<",
"msrest",
":",
"options",
"for",
"operati",
"ons",
">`",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"rty",
"pe",
":",
" ",
":",
"class",
":`",
"Compute",
"Node",
"Get",
"Remo",
"te",
"Logi",
"n",
"Sett",
"ings",
"Result",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"<",
"azu",
"re",
".",
"batch",
".",
"model",
"s",
".",
"Compute",
"Node",
"Get",
"Remo",
"te",
"Logi",
"n",
"Sett",
"ings",
"Result",
">`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"rty",
"pe",
":",
" ",
":",
"class",
":`",
"Client",
"Ra",
"w",
"Respons",
"e",
"<",
"msrest",
".",
"pipeline",
".",
"Client",
"Ra",
"w",
"Respons",
"e",
">`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"if",
" ",
"raw",
"=",
"true",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"timeout_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"timeout_",
"=_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"._",
"timeout_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"client",
"\\u",
"request",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client",
"\\u",
"request",
"\\u",
"id_",
"=_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"._",
"client",
"\\u",
"request",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
"=_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"._",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"oc",
"p",
"\\u",
"date_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"oc",
"p",
"\\u",
"date_",
"=_",
"compute",
"\\u",
"node",
"\\u",
"get",
"\\u",
"remote",
"\\u",
"login",
"\\u",
"settings",
"\\u",
"options_",
"._",
"oc",
"p",
"\\u",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"URL_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"url_",
"=_",
"'/",
"pools",
"/{",
"pool",
"Id",
"}/",
"nodes",
"/{",
"node",
"Id",
"}/",
"remote",
"login",
"settings",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"path",
"\\u",
"format\\u",
"arguments_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pool",
"Id",
"'_",
":_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"url_",
"(_",
"\"",
"pool",
"\\u",
"id",
"\"_",
",_",
"pool",
"\\u",
"id_",
",_",
"'",
"str",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
"Id",
"'_",
":_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"url_",
"(_",
"\"",
"node",
"\\u",
"id",
"\"_",
",_",
"node",
"\\u",
"id_",
",_",
"'",
"str",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"self_",
"._",
"\\u",
"client_",
"._",
"format\\u",
"url_",
"(_",
"url_",
",_",
"**_",
"path",
"\\u",
"format\\u",
"arguments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"parameters_",
"\\u\\u\\uNL\\u\\u\\u_",
"query",
"\\u",
"parameters_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query",
"\\u",
"parameters_",
"[_",
"'",
"api",
"-",
"version",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"query_",
"(_",
"\"",
"self",
".",
"config",
".",
"api",
"\\u",
"version",
"\"_",
",_",
"self_",
"._",
"config_",
"._",
"api",
"\\u",
"version_",
",_",
"'",
"str",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"timeout_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"parameters_",
"[_",
"'",
"timeo",
"ut",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"query_",
"(_",
"\"",
"timeo",
"ut",
"\"_",
",_",
"timeout_",
",_",
"'",
"int",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"headers_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"header",
"\\u",
"parameters_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header",
"\\u",
"parameters_",
"[_",
"'",
"Conten",
"t",
"-",
"Type",
"'_",
"]_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
";",
" ",
"odata",
"=",
"minima",
"lm",
"eta",
"data",
";",
" ",
"charset",
"=",
"utf",
"-",
"8",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"config_",
"._",
"generat",
"e\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"[_",
"'",
"x",
"-",
"ms",
"-",
"client",
"-",
"request",
"-",
"id",
"'_",
"]_",
"=_",
"str_",
"(_",
"uuid_",
"._",
"uuid1_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"custom",
"\\u",
"headers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"._",
"update_",
"(_",
"custom",
"\\u",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"config_",
"._",
"accept",
"\\u",
"language_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"[_",
"'",
"accept",
"-",
"language",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"header_",
"(_",
"\"",
"self",
".",
"config",
".",
"accept",
"\\u",
"language",
"\"_",
",_",
"self_",
"._",
"config_",
"._",
"accept",
"\\u",
"language_",
",_",
"'",
"str",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"client",
"\\u",
"request",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"[_",
"'",
"client",
"-",
"request",
"-",
"id",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"header_",
"(_",
"\"",
"client",
"\\u",
"request",
"\\u",
"id",
"\"_",
",_",
"client",
"\\u",
"request",
"\\u",
"id_",
",_",
"'",
"str",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"[_",
"'",
"return",
"-",
"client",
"-",
"request",
"-",
"id",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"header_",
"(_",
"\"",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id",
"\"_",
",_",
"return",
"\\u",
"client",
"\\u",
"request",
"\\u",
"id_",
",_",
"'",
"bool",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"oc",
"p",
"\\u",
"date_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"header",
"\\u",
"parameters_",
"[_",
"'",
"oc",
"p",
"-",
"date",
"'_",
"]_",
"=_",
"self_",
"._",
"\\u",
"serialize_",
"._",
"header_",
"(_",
"\"",
"oc",
"p",
"\\u",
"date",
"\"_",
",_",
"oc",
"p",
"\\u",
"date_",
",_",
"'",
"rfc",
"-1",
"123",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"and",
" ",
"send",
" ",
"request_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"request_",
"=_",
"self_",
"._",
"\\u",
"client_",
"._",
"get_",
"(_",
"url_",
",_",
"query",
"\\u",
"parameters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"\\u",
"client_",
"._",
"send_",
"(_",
"request_",
",_",
"header",
"\\u",
"parameters_",
",_",
"**_",
"operati",
"on",
"\\u",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"response_",
"._",
"status",
"\\u",
"code_",
"not_",
"in_",
"[_",
"200_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"models_",
"._",
"Bat",
"ch",
"Error",
"Exception_",
"(_",
"self_",
"._",
"\\u",
"deserialize_",
",_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"deserialized_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header",
"\\u",
"dict_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"response_",
"._",
"status",
"\\u",
"code_",
"==_",
"200_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"deserialized_",
"=_",
"self_",
"._",
"\\u",
"deserialize_",
"(_",
"'",
"Compute",
"Node",
"Get",
"Remo",
"te",
"Logi",
"n",
"Sett",
"ings",
"Result",
"'_",
",_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header",
"\\u",
"dict_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"client",
"-",
"request",
"-",
"id",
"'_",
":_",
"'",
"str",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"request",
"-",
"id",
"'_",
":_",
"'",
"str",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ET",
"ag",
"'_",
":_",
"'",
"str",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Las",
"t",
"-",
"Modifie",
"d",
"'_",
":_",
"'",
"rfc",
"-1",
"123",
"'_",
",_",
"\\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_",
"raw_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client",
"\\u",
"raw",
"\\u",
"response_",
"=_",
"Client",
"Ra",
"w",
"Response_",
"(_",
"deserialized_",
",_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client",
"\\u",
"raw",
"\\u",
"response_",
"._",
"add",
"\\u",
"headers_",
"(_",
"header",
"\\u",
"dict_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"client",
"\\u",
"raw",
"\\u",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"deserialized_",
"\\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,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ongo_bridge.py | [
{
"content": "from collections import OrderedDict\nfrom itertools import chain\nimport time\n\nfrom django.conf import settings\nfrom pandas.core.frame import DataFrame\n\n# an immediate fix to an error with the installation of pandas v0.15\ntry:\n from pandas.io.parsers import ExcelWriter\nexcept ImportError, e:\n from pandas import ExcelWriter\n\nfrom pyxform.survey_element import SurveyElement\nfrom pyxform.section import Section, RepeatingSection\nfrom pyxform.question import Question\n\nfrom onadata.apps.viewer.models.data_dictionary import DataDictionary\nfrom onadata.apps.viewer.models.parsed_instance import ParsedInstance\nfrom onadata.libs.exceptions import NoRecordsFoundError\nfrom onadata.libs.utils.common_tags import ID, XFORM_ID_STRING, STATUS,\\\n ATTACHMENTS, GEOLOCATION, UUID, SUBMISSION_TIME, NA_REP,\\\n BAMBOO_DATASET_ID, DELETEDAT, TAGS, NOTES, SUBMITTED_BY\nfrom onadata.libs.utils.export_tools import question_types_to_exclude\n\n\n# this is Mongo Collection where we will store the parsed submissions\nxform_instances = settings.MONGO_DB.instances\n\n# the bind type of select multiples that we use to compare\nMULTIPLE_SELECT_BIND_TYPE = u\"select\"\nGEOPOINT_BIND_TYPE = u\"geopoint\"\n\n# column group delimiters\nGROUP_DELIMITER_SLASH = '/'\nGROUP_DELIMITER_DOT = '.'\nDEFAULT_GROUP_DELIMITER = GROUP_DELIMITER_SLASH\nGROUP_DELIMITERS = [GROUP_DELIMITER_SLASH, GROUP_DELIMITER_DOT]\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 get_valid_sheet_name(sheet_name, existing_name_list):\n # truncate sheet_name to XLSDataFrameBuilder.SHEET_NAME_MAX_CHARS\n new_sheet_name = \\\n sheet_name[:XLSDataFrameBuilder.SHEET_NAME_MAX_CHARS]\n\n # make sure its unique within the list\n i = 1\n generated_name = new_sheet_name\n while generated_name in existing_name_list:\n digit_length = len(str(i))\n allowed_name_len = XLSDataFrameBuilder.SHEET_NAME_MAX_CHARS - \\\n digit_length\n # make name the required len\n if len(generated_name) > allowed_name_len:\n generated_name = generated_name[:allowed_name_len]\n generated_name = \"{0}{1}\".format(generated_name, i)\n i += 1\n return generated_name",
"metadata": "root.get_valid_sheet_name",
"header": "['module', '___EOS___']",
"index": 40
},
{
"content": "def remove_dups_from_list_maintain_order(l):\n return list(OrderedDict.fromkeys(l))",
"metadata": "root.remove_dups_from_list_maintain_order",
"header": "['module', '___EOS___']",
"index": 60
},
{
"content": "def get_prefix_from_xpath(xpath):\n xpath = str(xpath)\n parts = xpath.rsplit('/', 1)\n if len(parts) == 1:\n return None\n elif len(parts) == 2:\n return '%s/' % parts[0]\n else:\n raise ValueError(\n '%s cannot be prefixed, it returns %s' % (xpath, str(parts)))",
"metadata": "root.get_prefix_from_xpath",
"header": "['module', '___EOS___']",
"index": 64
},
{
"content": "class AbstractDataFrameBuilder(object):\n IGNORED_COLUMNS = [XFORM_ID_STRING, STATUS, ID, ATTACHMENTS, GEOLOCATION,\n BAMBOO_DATASET_ID, DELETEDAT, SUBMITTED_BY]\n # fields NOT within the form def that we want to include\n ADDITIONAL_COLUMNS = [UUID, SUBMISSION_TIME, TAGS, NOTES]\n BINARY_SELECT_MULTIPLES = False\n \"\"\"\n Group functionality used by any DataFrameBuilder i.e. XLS, CSV and KML\n \"\"\"\n\n\n\n\n\n\n\n",
"metadata": "root.AbstractDataFrameBuilder",
"header": "['module', '___EOS___']",
"index": 76
},
{
"content": " def __init__(self, username, id_string, filter_query=None,\n group_delimiter=DEFAULT_GROUP_DELIMITER,\n split_select_multiples=True, binary_select_multiples=False):\n self.username = username\n self.id_string = id_string\n self.filter_query = filter_query\n self.group_delimiter = group_delimiter\n self.split_select_multiples = split_select_multiples\n self.BINARY_SELECT_MULTIPLES = binary_select_multiples\n self._setup()",
"metadata": "root.AbstractDataFrameBuilder.__init__",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 85
},
{
"content": " def _setup(self):\n self.dd = DataDictionary.objects.get(user__username=self.username,\n id_string=self.id_string)\n self.select_multiples = self._collect_select_multiples(self.dd)\n self.gps_fields = self._collect_gps_fields(self.dd)",
"metadata": "root.AbstractDataFrameBuilder._setup",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 96
},
{
"content": " @classmethod\n def _fields_to_select(cls, dd):\n return [c.get_abbreviated_xpath()\n for c in dd.get_survey_elements() if isinstance(c, Question)]",
"metadata": "root.AbstractDataFrameBuilder._fields_to_select",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 102
},
{
"content": " @classmethod\n def _collect_select_multiples(cls, dd):\n return dict([(e.get_abbreviated_xpath(), [c.get_abbreviated_xpath()\n for c in e.children])\n for e in dd.get_survey_elements()\n if e.bind.get(\"type\") == \"select\"])",
"metadata": "root.AbstractDataFrameBuilder._collect_select_multiples",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 107
},
{
"content": " @classmethod\n def _split_select_multiples(cls, record, select_multiples,\n binary_select_multiples=False):\n \"\"\" Prefix contains the xpath and slash if we are within a repeat so\n that we can figure out which select multiples belong to which repeat\n \"\"\"\n for key, choices in select_multiples.items():\n # the select multiple might be blank or not exist in the record,\n # need to make those False\n selections = []\n if key in record:\n # split selected choices by spaces and join by / to the\n # element's xpath\n selections = [\"%s/%s\" % (key, r)\n for r in record[key].split(\" \")]\n # remove the column since we are adding separate columns\n # for each choice\n record.pop(key)\n if not binary_select_multiples:\n # add columns to record for every choice, with default\n # False and set to True for items in selections\n record.update(dict([(choice, choice in selections)\n for choice in choices]))\n else:\n YES = 1\n NO = 0\n record.update(\n dict([(choice, YES if choice in selections else NO)\n for choice in choices]))\n\n # recurs into repeats\n for record_key, record_item in record.items():\n if type(record_item) == list:\n for list_item in record_item:\n if type(list_item) == dict:\n cls._split_select_multiples(\n list_item, select_multiples)\n return record",
"metadata": "root.AbstractDataFrameBuilder._split_select_multiples",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 114
},
{
"content": " @classmethod\n def _collect_gps_fields(cls, dd):\n return [e.get_abbreviated_xpath() for e in dd.get_survey_elements()\n if e.bind.get(\"type\") == \"geopoint\"]",
"metadata": "root.AbstractDataFrameBuilder._collect_gps_fields",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 153
},
{
"content": " @classmethod\n def _tag_edit_string(cls, record):\n \"\"\"\n Turns a list of tags into a string representation.\n \"\"\"\n if '_tags' in record:\n tags = []\n for tag in record['_tags']:\n if ',' in tag and ' ' in tag:\n tags.append('\"%s\"' % tag)\n else:\n tags.append(tag)\n record.update({'_tags': u', '.join(sorted(tags))})",
"metadata": "root.AbstractDataFrameBuilder._tag_edit_string",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 158
},
{
"content": " @classmethod\n def _split_gps_fields(cls, record, gps_fields):\n updated_gps_fields = {}\n for key, value in record.iteritems():\n if key in gps_fields and isinstance(value, basestring):\n gps_xpaths = DataDictionary.get_additional_geopoint_xpaths(key)\n gps_parts = dict([(xpath, None) for xpath in gps_xpaths])\n # hack, check if its a list and grab the object within that\n parts = value.split(' ')\n # TODO: check whether or not we can have a gps recording\n # from ODKCollect that has less than four components,\n # for now we are assuming that this is not the case.\n if len(parts) == 4:\n gps_parts = dict(zip(gps_xpaths, parts))\n updated_gps_fields.update(gps_parts)\n # check for repeats within record i.e. in value\n elif type(value) == list:\n for list_item in value:\n if type(list_item) == dict:\n cls._split_gps_fields(list_item, gps_fields)\n record.update(updated_gps_fields)",
"metadata": "root.AbstractDataFrameBuilder._split_gps_fields",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 172
},
{
"content": " def _query_mongo(self, query='{}', start=0,\n limit=ParsedInstance.DEFAULT_LIMIT,\n fields='[]', count=False):\n # ParsedInstance.query_mongo takes params as json strings\n # so we dumps the fields dictionary\n count_args = {\n 'username': self.username,\n 'id_string': self.id_string,\n 'query': query,\n 'fields': '[]',\n 'sort': '{}',\n 'count': True\n }\n count_object = ParsedInstance.query_mongo(**count_args)\n record_count = count_object[0][\"count\"]\n if record_count == 0:\n raise NoRecordsFoundError(\"No records found for your query\")\n # if count was requested, return the count\n if count:\n return record_count\n else:\n query_args = {\n 'username': self.username,\n 'id_string': self.id_string,\n 'query': query,\n 'fields': fields,\n # TODO: we might want to add this in for the user\n # to sepcify a sort order\n 'sort': '{}',\n 'start': start,\n 'limit': limit,\n 'count': False\n }\n # use ParsedInstance.query_mongo\n cursor = ParsedInstance.query_mongo(**query_args)\n return cursor",
"metadata": "root.AbstractDataFrameBuilder._query_mongo",
"header": "['class', 'AbstractDataFrameBuilder', '(', 'object', ')', ':', '___EOS___']",
"index": 194
},
{
"content": "class XLSDataFrameBuilder(AbstractDataFrameBuilder):\n \"\"\"\n Generate structures from mongo and DataDictionary for a DataFrameXLSWriter\n\n This builder can choose to query the data in batches and write to a single\n ExcelWriter object using multiple instances of DataFrameXLSWriter\n \"\"\"\n INDEX_COLUMN = u\"_index\"\n PARENT_TABLE_NAME_COLUMN = u\"_parent_table_name\"\n PARENT_INDEX_COLUMN = u\"_parent_index\"\n EXTRA_COLUMNS = [INDEX_COLUMN, PARENT_TABLE_NAME_COLUMN,\n PARENT_INDEX_COLUMN]\n SHEET_NAME_MAX_CHARS = 30\n XLS_SHEET_COUNT_LIMIT = 255\n XLS_COLUMN_COUNT_MAX = 255\n CURRENT_INDEX_META = 'current_index'\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.XLSDataFrameBuilder",
"header": "['module', '___EOS___']",
"index": 232
},
{
"content": " def __init__(self, username, id_string, filter_query=None,\n group_delimiter=DEFAULT_GROUP_DELIMITER,\n split_select_multiples=True, binary_select_multiples=False):\n super(XLSDataFrameBuilder, self).__init__(\n username, id_string, filter_query, group_delimiter,\n split_select_multiples, binary_select_multiples)",
"metadata": "root.XLSDataFrameBuilder.__init__",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 249
},
{
"content": " def _setup(self):\n super(XLSDataFrameBuilder, self)._setup()\n # need to split columns, with repeats in individual sheets and\n # everything else on the default sheet\n self._generate_sections()",
"metadata": "root.XLSDataFrameBuilder._setup",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 256
},
{
"content": " def export_to(self, file_path, batchsize=1000):\n self.xls_writer = ExcelWriter(file_path)\n\n # get record count\n record_count = self._query_mongo(count=True)\n\n # query in batches and for each batch create an XLSDataFrameWriter and\n # write to existing xls_writer object\n start = 0\n header = True\n while start < record_count:\n cursor = self._query_mongo(self.filter_query, start=start,\n limit=batchsize)\n\n data = self._format_for_dataframe(cursor)\n\n # write all cursor's data to their respective sheets\n for section_name, section in self.sections.iteritems():\n records = data[section_name]\n # TODO: currently ignoring nested repeats\n # so ignore sections that have 0 records\n if len(records) > 0:\n # use a different group delimiter if needed\n columns = section[\"columns\"]\n if self.group_delimiter != DEFAULT_GROUP_DELIMITER:\n columns = [self.group_delimiter.join(col.split(\"/\"))\n for col in columns]\n columns = columns + self.EXTRA_COLUMNS\n writer = XLSDataFrameWriter(records, columns)\n writer.write_to_excel(self.xls_writer, section_name,\n header=header, index=False)\n header = False\n # increment counter(s)\n start += batchsize\n time.sleep(0.1)\n self.xls_writer.save()",
"metadata": "root.XLSDataFrameBuilder.export_to",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 262
},
{
"content": " def _format_for_dataframe(self, cursor):\n \"\"\"\n Format each record for consumption by a dataframe\n\n returns a dictionary with the key being the name of the sheet,\n and values a list of dicts to feed into a DataFrame\n \"\"\"\n data = dict((section_name, [])\n for section_name in self.sections.keys())\n\n main_section = self.sections[self.survey_name]\n main_sections_columns = main_section[\"columns\"]\n\n for record in cursor:\n # from record, we'll end up with multiple records, one for each\n # section we have\n\n # add records for the default section\n self._add_data_for_section(data[self.survey_name],\n record, main_sections_columns,\n self.survey_name)\n parent_index = main_section[self.CURRENT_INDEX_META]\n\n for sheet_name, section in self.sections.iteritems():\n # skip default section i.e survey name\n if sheet_name != self.survey_name:\n xpath = section[\"xpath\"]\n columns = section[\"columns\"]\n # TODO: handle nested repeats -ignoring nested repeats for\n # now which will not be in the top level record, perhaps\n # nest sections as well so we can recurs in and get them\n if xpath in record:\n repeat_records = record[xpath]\n # num_repeat_records = len(repeat_records)\n for repeat_record in repeat_records:\n self._add_data_for_section(\n data[sheet_name],\n repeat_record, columns, sheet_name,\n parent_index, self.survey_name)\n\n return data",
"metadata": "root.XLSDataFrameBuilder._format_for_dataframe",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 299
},
{
"content": " def _add_data_for_section(self, data_section, record, columns,\n section_name, parent_index=-1,\n parent_table_name=None):\n data_section.append({})\n self.sections[section_name][self.CURRENT_INDEX_META] += 1\n index = self.sections[section_name][self.CURRENT_INDEX_META]\n # data_section[len(data_section)-1].update(record) # we could simply do\n # this but end up with duplicate data from repeats\n\n if self.split_select_multiples:\n # find any select multiple(s) and add additional columns to record\n record = self._split_select_multiples(\n record, self.select_multiples)\n # alt, precision\n self._split_gps_fields(record, self.gps_fields)\n for column in columns:\n data_value = None\n try:\n data_value = record[column]\n except KeyError:\n # a record may not have responses for some elements simply\n # because they were not captured\n pass\n data_section[\n len(data_section) - 1].update({\n self.group_delimiter.join(column.split('/'))\n if self.group_delimiter != DEFAULT_GROUP_DELIMITER\n else column: data_value})\n\n data_section[len(data_section) - 1].update({\n XLSDataFrameBuilder.INDEX_COLUMN: index,\n XLSDataFrameBuilder.PARENT_INDEX_COLUMN: parent_index,\n XLSDataFrameBuilder.PARENT_TABLE_NAME_COLUMN: parent_table_name})\n\n # add ADDITIONAL_COLUMNS\n data_section[len(data_section) - 1].update(\n dict([(column, record[column] if column in record else None)\n for column in self.ADDITIONAL_COLUMNS]))",
"metadata": "root.XLSDataFrameBuilder._add_data_for_section",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 341
},
{
"content": " def _generate_sections(self):\n \"\"\"\n Split survey questions into separate sections for each xls sheet and\n columns for each section\n \"\"\"\n # clear list\n self.sections = OrderedDict()\n\n # dict of select multiple elements\n self.select_multiples = {}\n\n survey_element = self.dd.survey\n self.survey_name = get_valid_sheet_name(\n survey_element.name, self.sections.keys())\n self._create_section(\n self.survey_name, survey_element.get_abbreviated_xpath(), False)\n # build sections\n self._build_sections_recursive(self.survey_name, self.dd.get_survey())\n\n for section_name in self.sections:\n self.sections[section_name]['columns'] += self.ADDITIONAL_COLUMNS\n self.get_exceeds_xls_limits()",
"metadata": "root.XLSDataFrameBuilder._generate_sections",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 380
},
{
"content": " def _build_sections_recursive(self, section_name, element,\n is_repeating=False):\n \"\"\"Builds a section's children and recurses any repeating sections\n to build those as a separate section\n \"\"\"\n for child in element.children:\n # if a section, recurse\n if isinstance(child, Section):\n new_is_repeating = isinstance(child, RepeatingSection)\n new_section_name = section_name\n # if its repeating, build a new section\n if new_is_repeating:\n new_section_name = get_valid_sheet_name(\n child.name, self.sections.keys())\n self._create_section(\n new_section_name, child.get_abbreviated_xpath(), True)\n\n self._build_sections_recursive(\n new_section_name, child, new_is_repeating)\n else:\n # add to survey_sections\n child_bind_type = child.bind.get(u\"type\")\n if isinstance(child, Question) and not \\\n question_types_to_exclude(child.type)\\\n and not child_bind_type == MULTIPLE_SELECT_BIND_TYPE:\n self._add_column_to_section(section_name, child)\n elif child_bind_type == MULTIPLE_SELECT_BIND_TYPE:\n self.select_multiples[child.get_abbreviated_xpath()] = \\\n [option.get_abbreviated_xpath()\n for option in child.children]\n # if select multiple, get its choices and make them\n # columns\n if self.split_select_multiples:\n for option in child.children:\n self._add_column_to_section(section_name, option)\n else:\n self._add_column_to_section(section_name, child)\n\n # split gps fields within this section\n if child_bind_type == GEOPOINT_BIND_TYPE:\n # add columns for geopoint components\n for xpath in self.dd.get_additional_geopoint_xpaths(\n child.get_abbreviated_xpath()):\n self._add_column_to_section(section_name, xpath)",
"metadata": "root.XLSDataFrameBuilder._build_sections_recursive",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 403
},
{
"content": " def get_exceeds_xls_limits(self):\n if not hasattr(self, \"exceeds_xls_limits\"):\n self.exceeds_xls_limits = False\n if len(self.sections) > self.XLS_SHEET_COUNT_LIMIT:\n self.exceeds_xls_limits = True\n else:\n for section in self.sections.itervalues():\n if len(section[\"columns\"]) > self.XLS_COLUMN_COUNT_MAX:\n self.exceeds_xls_limits = True\n break\n return self.exceeds_xls_limits",
"metadata": "root.XLSDataFrameBuilder.get_exceeds_xls_limits",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 448
},
{
"content": " def _create_section(self, section_name, xpath, is_repeat):\n # index = len(self.sections)\n self.sections[section_name] = {\n \"name\": section_name, \"xpath\": xpath, \"columns\": [],\n \"is_repeat\": is_repeat, self.CURRENT_INDEX_META: 0}",
"metadata": "root.XLSDataFrameBuilder._create_section",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 460
},
{
"content": " def _add_column_to_section(self, sheet_name, column):\n section = self.sections[sheet_name]\n xpath = None\n if isinstance(column, SurveyElement):\n xpath = column.get_abbreviated_xpath()\n elif isinstance(column, basestring):\n xpath = column\n assert(xpath)\n # make sure column is not already in list\n if xpath not in section[\"columns\"]:\n section[\"columns\"].append(xpath)",
"metadata": "root.XLSDataFrameBuilder._add_column_to_section",
"header": "['class', 'XLSDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 466
},
{
"content": "class CSVDataFrameBuilder(AbstractDataFrameBuilder):\n\n\n\n\n\n",
"metadata": "root.CSVDataFrameBuilder",
"header": "['module', '___EOS___']",
"index": 479
},
{
"content": " def __init__(self, username, id_string, filter_query=None,\n group_delimiter=DEFAULT_GROUP_DELIMITER,\n split_select_multiples=True, binary_select_multiples=False):\n super(CSVDataFrameBuilder, self).__init__(\n username, id_string, filter_query, group_delimiter,\n split_select_multiples, binary_select_multiples)\n self.ordered_columns = OrderedDict()",
"metadata": "root.CSVDataFrameBuilder.__init__",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 481
},
{
"content": " def _setup(self):\n super(CSVDataFrameBuilder, self)._setup()",
"metadata": "root.CSVDataFrameBuilder._setup",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 489
},
{
"content": " @classmethod\n def _reindex(cls, key, value, ordered_columns, parent_prefix=None):\n \"\"\"\n Flatten list columns by appending an index, otherwise return as is\n \"\"\"\n d = {}\n\n # check for lists\n if type(value) is list and len(value) > 0 \\\n and key != NOTES and key != ATTACHMENTS:\n for index, item in enumerate(value):\n # start at 1\n index += 1\n # for each list check for dict, we want to transform the key of\n # this dict\n if type(item) is dict:\n for nested_key, nested_val in item.iteritems():\n # given the key \"children/details\" and nested_key/\n # abbreviated xpath\n # \"children/details/immunization/polio_1\",\n # generate [\"children\", index, \"immunization/polio_1\"]\n xpaths = [\n \"%s[%s]\" % (\n nested_key[:nested_key.index(key) + len(key)],\n index),\n nested_key[nested_key.index(key) + len(key) + 1:]]\n # re-create xpath the split on /\n xpaths = \"/\".join(xpaths).split(\"/\")\n new_prefix = xpaths[:-1]\n if type(nested_val) is list:\n # if nested_value is a list, rinse and repeat\n d.update(cls._reindex(\n nested_key, nested_val,\n ordered_columns, new_prefix))\n else:\n # it can only be a scalar\n # collapse xpath\n if parent_prefix:\n xpaths[0:len(parent_prefix)] = parent_prefix\n new_xpath = u\"/\".join(xpaths)\n # check if this key exists in our ordered columns\n if key in ordered_columns.keys():\n if new_xpath not in ordered_columns[key]:\n ordered_columns[key].append(new_xpath)\n d[new_xpath] = nested_val\n else:\n d[key] = value\n else:\n # anything that's not a list will be in the top level dict so its\n # safe to simply assign\n if key == NOTES:\n d[key] = u\"\\r\\n\".join(value)\n elif key == ATTACHMENTS:\n d[key] = []\n else:\n d[key] = value\n return d",
"metadata": "root.CSVDataFrameBuilder._reindex",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 492
},
{
"content": " @classmethod\n def _build_ordered_columns(cls, survey_element, ordered_columns,\n is_repeating_section=False):\n \"\"\"\n Build a flat ordered dict of column groups\n\n is_repeating_section ensures that child questions of repeating sections\n are not considered columns\n \"\"\"\n for child in survey_element.children:\n # child_xpath = child.get_abbreviated_xpath()\n if isinstance(child, Section):\n child_is_repeating = False\n if isinstance(child, RepeatingSection):\n ordered_columns[child.get_abbreviated_xpath()] = []\n child_is_repeating = True\n cls._build_ordered_columns(child, ordered_columns,\n child_is_repeating)\n elif isinstance(child, Question) and not \\\n question_types_to_exclude(child.type) and not\\\n is_repeating_section: # if is_repeating_section,\n # its parent already initiliased an empty list\n # so we dont add it to our list of columns,\n # the repeating columns list will be\n # generated when we reindex\n ordered_columns[child.get_abbreviated_xpath()] = None",
"metadata": "root.CSVDataFrameBuilder._build_ordered_columns",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 550
},
{
"content": " def _format_for_dataframe(self, cursor):\n # TODO: check for and handle empty results\n # add ordered columns for select multiples\n if self.split_select_multiples:\n for key, choices in self.select_multiples.items():\n # HACK to ensure choices are NOT duplicated\n self.ordered_columns[key] = \\\n remove_dups_from_list_maintain_order(choices)\n # add ordered columns for gps fields\n for key in self.gps_fields:\n gps_xpaths = self.dd.get_additional_geopoint_xpaths(key)\n self.ordered_columns[key] = [key] + gps_xpaths\n data = []\n for record in cursor:\n # split select multiples\n if self.split_select_multiples:\n record = self._split_select_multiples(\n record, self.select_multiples,\n self.BINARY_SELECT_MULTIPLES)\n # check for gps and split into components i.e. latitude, longitude,\n # altitude, precision\n self._split_gps_fields(record, self.gps_fields)\n self._tag_edit_string(record)\n flat_dict = {}\n # re index repeats\n for key, value in record.iteritems():\n reindexed = self._reindex(key, value, self.ordered_columns)\n flat_dict.update(reindexed)\n\n # if delimetr is diferent, replace within record as well\n if self.group_delimiter != DEFAULT_GROUP_DELIMITER:\n flat_dict = dict((self.group_delimiter.join(k.split('/')), v)\n for k, v in flat_dict.iteritems())\n data.append(flat_dict)\n return data",
"metadata": "root.CSVDataFrameBuilder._format_for_dataframe",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 577
},
{
"content": " def export_to(self, file_or_path, data_frame_max_size=30000):\n from math import ceil\n # get record count\n record_count = self._query_mongo(query=self.filter_query, count=True)\n\n self.ordered_columns = OrderedDict()\n self._build_ordered_columns(self.dd.survey, self.ordered_columns)\n\n # pandas will only export 30k records in a dataframe to a csv\n # - we need to create multiple 30k dataframes if required,\n # we need to go through all the records though so that\n # we can figure out the columns we need for repeats\n datas = []\n num_data_frames = \\\n int(ceil(float(record_count) / float(data_frame_max_size)))\n for i in range(num_data_frames):\n cursor = self._query_mongo(\n self.filter_query, start=(i * data_frame_max_size),\n limit=data_frame_max_size)\n data = self._format_for_dataframe(cursor)\n datas.append(data)\n\n columns = list(chain.from_iterable(\n [[xpath] if cols is None else cols\n for xpath, cols in self.ordered_columns.iteritems()]))\n\n # use a different group delimiter if needed\n if self.group_delimiter != DEFAULT_GROUP_DELIMITER:\n columns = [self.group_delimiter.join(col.split(\"/\"))\n for col in columns]\n\n # add extra columns\n columns += [col for col in self.ADDITIONAL_COLUMNS]\n\n header = True\n if hasattr(file_or_path, 'read'):\n csv_file = file_or_path\n close = False\n else:\n csv_file = open(file_or_path, \"wb\")\n close = True\n\n for data in datas:\n writer = CSVDataFrameWriter(data, columns)\n writer.write_to_csv(csv_file, header=header)\n header = False\n if close:\n csv_file.close()",
"metadata": "root.CSVDataFrameBuilder.export_to",
"header": "['class', 'CSVDataFrameBuilder', '(', 'AbstractDataFrameBuilder', ')', ':', '___EOS___']",
"index": 613
},
{
"content": "class XLSDataFrameWriter(object):\n",
"metadata": "root.XLSDataFrameWriter",
"header": "['module', '___EOS___']",
"index": 663
},
{
"content": " def __init__(self, records, columns):\n self.dataframe = DataFrame(records, columns=columns)",
"metadata": "root.XLSDataFrameWriter.__init__",
"header": "['class', 'XLSDataFrameWriter', '(', 'object', ')', ':', '___EOS___']",
"index": 664
},
{
"content": " def write_to_excel(self, excel_writer, sheet_name, header=False,\n index=False):\n self.dataframe.to_excel(excel_writer, sheet_name, header=header,\n index=index)",
"metadata": "root.XLSDataFrameWriter.write_to_excel",
"header": "['class', 'XLSDataFrameWriter', '(', 'object', ')', ':', '___EOS___']",
"index": 667
},
{
"content": "class CSVDataFrameWriter(object):\n",
"metadata": "root.CSVDataFrameWriter",
"header": "['module', '___EOS___']",
"index": 673
},
{
"content": " def __init__(self, records, columns):\n # TODO: if records is empty, raise a known exception\n # catch it in the view and handle\n assert(len(records) > 0)\n self.dataframe = DataFrame(records, columns=columns)\n\n # remove columns we don't want\n for col in AbstractDataFrameBuilder.IGNORED_COLUMNS:\n if col in self.dataframe.columns:\n del(self.dataframe[col])",
"metadata": "root.CSVDataFrameWriter.__init__",
"header": "['class', 'CSVDataFrameWriter', '(', 'object', ')', ':', '___EOS___']",
"index": 674
},
{
"content": " def write_to_csv(self, csv_file, header=True, index=False):\n na_rep = getattr(settings, 'NA_REP', NA_REP)\n self.dataframe.to_csv(csv_file, header=header, index=index,\n na_rep=na_rep, encoding='utf-8')",
"metadata": "root.CSVDataFrameWriter.write_to_csv",
"header": "['class', 'CSVDataFrameWriter', '(', 'object', ')', ':', '___EOS___']",
"index": 685
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"collections_",
"import_",
"Order",
"ed",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"itertools_",
"import_",
"chain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pandas_",
"._",
"core_",
"._",
"frame_",
"import_",
"Data",
"Frame_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"an",
" ",
"immediate",
" ",
"fix",
" ",
"to",
" ",
"an",
" ",
"error",
" ",
"with",
" ",
"the",
" ",
"installation",
" ",
"of",
" ",
"panda",
"s",
" ",
"v",
"0.15_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"pandas_",
"._",
"io_",
"._",
"parsers_",
"import_",
"Exce",
"l",
"Writer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"pandas_",
"import_",
"Exce",
"l",
"Writer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"pyx",
"form_",
"._",
"survey",
"\\u",
"element_",
"import_",
"Surv",
"ey",
"Element_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyx",
"form_",
"._",
"section_",
"import_",
"Section_",
",_",
"Repeat",
"ing",
"Section_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyx",
"form_",
"._",
"question_",
"import_",
"Question_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ona",
"data_",
"._",
"apps_",
"._",
"viewer_",
"._",
"models_",
"._",
"data\\u",
"dictionary_",
"import_",
"Data",
"Dictionary_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ona",
"data_",
"._",
"apps_",
"._",
"viewer_",
"._",
"models_",
"._",
"parsed",
"\\u",
"instance_",
"import_",
"Pars",
"ed",
"Instance_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ona",
"data_",
"._",
"libs_",
"._",
"exceptions_",
"import_",
"No",
"Record",
"s",
"Foun",
"d",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ona",
"data_",
"._",
"libs_",
"._",
"utils_",
"._",
"common",
"\\u",
"tags_",
"import_",
"ID_",
",_",
"XF",
"ORM",
"\\u",
"ID",
"\\u",
"STRING_",
",_",
"STATUS_",
",_",
"ATTACH",
"MENTS_",
",_",
"GEO",
"LOCATION_",
",_",
"UUID_",
",_",
"SUB",
"MISSI",
"ON",
"\\u",
"TIME_",
",_",
"NA",
"\\u",
"REP",
"_",
",_",
"BAM",
"BOO",
"\\u",
"DATASET",
"\\u",
"ID_",
",_",
"DELETED",
"AT_",
",_",
"TAGS_",
",_",
"NOTE",
"S_",
",_",
"SUBMIT",
"TED",
"\\u",
"BY",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ona",
"data_",
"._",
"libs_",
"._",
"utils_",
"._",
"export",
"\\u",
"tools_",
"import_",
"question",
"\\u",
"types",
"\\u",
"to",
"\\u",
"exclude_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"is",
" ",
"Mon",
"go",
" ",
"Collecti",
"on",
" ",
"where",
" ",
"we",
" ",
"will",
" ",
"store",
" ",
"the",
" ",
"parsed",
" ",
"submissions_",
"\\u\\u\\uNL\\u\\u\\u_",
"xform",
"\\u",
"instances_",
"=_",
"settings_",
"._",
"MONGO",
"\\u",
"DB_",
"._",
"instances_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"bind",
" ",
"type",
" ",
"of",
" ",
"select",
" ",
"multiple",
"s",
" ",
"tha",
"t",
" ",
"we",
" ",
"use",
" ",
"to",
" ",
"compare_",
"\\u\\u\\uNL\\u\\u\\u_",
"MULTIPLE",
"\\u",
"SELECT",
"\\u",
"BIND",
"\\u",
"TYPE_",
"=_",
"u",
"\"",
"select",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GEO",
"POINT",
"\\u",
"BIND",
"\\u",
"TYPE_",
"=_",
"u",
"\"",
"geop",
"oint",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"column",
" ",
"group",
" ",
"delimiter",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"GROU",
"P",
"\\u",
"DELIMITER",
"\\u",
"SLA",
"SH_",
"=_",
"'/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GROU",
"P",
"\\u",
"DELIMITER",
"\\u",
"DOT",
"_",
"=_",
"'.'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
"=_",
"GROU",
"P",
"\\u",
"DELIMITER",
"\\u",
"SLA",
"SH_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GROU",
"P",
"\\u",
"DELIMITER",
"S_",
"=_",
"[_",
"GROU",
"P",
"\\u",
"DELIMITER",
"\\u",
"SLA",
"SH_",
",_",
"GROU",
"P",
"\\u",
"DELIMITER",
"\\u",
"DOT",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"get",
"\\u",
"valid",
"\\u",
"sheet",
"\\u",
"name_",
"(_",
"sheet",
"\\u",
"name_",
",_",
"exist",
"ing",
"\\u",
"name",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"truncat",
"e",
" ",
"sheet",
"\\u",
"name",
" ",
"to",
" ",
"XL",
"SD",
"ata",
"Frame",
"Build",
"er",
".",
"SHE",
"ET",
"\\u",
"NAME",
"\\u",
"MAX",
"\\u",
"CHARS_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"sheet",
"\\u",
"name_",
"=_",
"sheet",
"\\u",
"name_",
"[_",
":_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"._",
"SHE",
"ET",
"\\u",
"NAME",
"\\u",
"MAX",
"\\u",
"CHARS_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"its",
" ",
"unique",
" ",
"within",
" ",
"the",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"i_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"generat",
"ed",
"\\u",
"name_",
"=_",
"new",
"\\u",
"sheet",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"generat",
"ed",
"\\u",
"name_",
"in_",
"exist",
"ing",
"\\u",
"name",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"digit",
"\\u",
"length_",
"=_",
"len_",
"(_",
"str_",
"(_",
"i_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"allow",
"ed",
"\\u",
"name",
"\\u",
"len_",
"=_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"._",
"SHE",
"ET",
"\\u",
"NAME",
"\\u",
"MAX",
"\\u",
"CHARS_",
"-_",
"digit",
"\\u",
"length_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"make",
" ",
"name",
" ",
"the",
" ",
"require",
"d",
" ",
"len_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"generat",
"ed",
"\\u",
"name_",
")_",
">_",
"allow",
"ed",
"\\u",
"name",
"\\u",
"len_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"generat",
"ed",
"\\u",
"name_",
"=_",
"generat",
"ed",
"\\u",
"name_",
"[_",
":_",
"allow",
"ed",
"\\u",
"name",
"\\u",
"len_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"generat",
"ed",
"\\u",
"name_",
"=_",
"\"{",
"0",
"}{",
"1",
"}\"_",
"._",
"format_",
"(_",
"generat",
"ed",
"\\u",
"name_",
",_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"generat",
"ed",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"remove",
"\\u",
"dup",
"s",
"\\u",
"from",
"\\u",
"list",
"\\u",
"maintain",
"\\u",
"order_",
"(_",
"l_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"list_",
"(_",
"Order",
"ed",
"Dict_",
"._",
"fromkeys_",
"(_",
"l_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"prefix",
"\\u",
"from",
"\\u",
"xpath_",
"(_",
"xpath_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xpath_",
"=_",
"str_",
"(_",
"xpath_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parts_",
"=_",
"xpath_",
"._",
"rsplit_",
"(_",
"'/'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"parts_",
")_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"len_",
"(_",
"parts_",
")_",
"==_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'%",
"s",
"/'_",
"%_",
"parts_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'%",
"s",
" ",
"cann",
"ot",
" ",
"be",
" ",
"prefixed",
",",
" ",
"it",
" ",
"return",
"s",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"xpath_",
",_",
"str_",
"(_",
"parts_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"IGNORE",
"D",
"\\u",
"COLUMNS_",
"=_",
"[_",
"XF",
"ORM",
"\\u",
"ID",
"\\u",
"STRING_",
",_",
"STATUS_",
",_",
"ID_",
",_",
"ATTACH",
"MENTS_",
",_",
"GEO",
"LOCATION_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"BAM",
"BOO",
"\\u",
"DATASET",
"\\u",
"ID_",
",_",
"DELETED",
"AT_",
",_",
"SUBMIT",
"TED",
"\\u",
"BY",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"fields",
" ",
"NOT",
" ",
"within",
" ",
"the",
" ",
"form",
" ",
"def",
" ",
"tha",
"t",
" ",
"we",
" ",
"want",
" ",
"to",
" ",
"include_",
"\\u\\u\\uNL\\u\\u\\u_",
"ADD",
"ITION",
"AL",
"\\u",
"COLUMNS_",
"=_",
"[_",
"UUID_",
",_",
"SUB",
"MISSI",
"ON",
"\\u",
"TIME_",
",_",
"TAGS_",
",_",
"NOTE",
"S_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"BIN",
"ARY",
"\\u",
"SELECT",
"\\u",
"MULTIPLE",
"S_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Group",
" ",
"functional",
"it",
"y",
" ",
"used",
" ",
"by",
" ",
"any",
" ",
"Data",
"Frame",
"Build",
"er",
" ",
"i",
".",
"e",
".",
" ",
"XL",
"S",
",",
" ",
"CSV",
" ",
"and",
" ",
"KML",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"username_",
",_",
"id",
"\\u",
"string_",
",_",
"filter",
"\\u",
"query_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"group",
"\\u",
"delimiter_",
"=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"True_",
",_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"username_",
"=_",
"username_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"id",
"\\u",
"string_",
"=_",
"id",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"filter",
"\\u",
"query_",
"=_",
"filter",
"\\u",
"query_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"=_",
"group",
"\\u",
"delimiter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"BIN",
"ARY",
"\\u",
"SELECT",
"\\u",
"MULTIPLE",
"S_",
"=_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"dd_",
"=_",
"Data",
"Dictionary_",
"._",
"objects_",
"._",
"get_",
"(_",
"user",
"\\u\\u",
"username_",
"=_",
"self_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"id",
"\\u",
"string_",
"=_",
"self_",
"._",
"id",
"\\u",
"string_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
"=_",
"self_",
"._",
"\\u",
"collect",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"self_",
"._",
"dd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"gps",
"\\u",
"fields_",
"=_",
"self_",
"._",
"\\u",
"collect",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"self_",
"._",
"dd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"\\u",
"fields",
"\\u",
"to",
"\\u",
"select_",
"(_",
"cls_",
",_",
"dd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"c_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"c_",
"in_",
"dd_",
"._",
"get",
"\\u",
"survey",
"\\u",
"elements_",
"(_",
")_",
"if_",
"isinstance_",
"(_",
"c_",
",_",
"Question_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"\\u",
"collect",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"cls_",
",_",
"dd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"dict_",
"(_",
"[_",
"(_",
"e_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
",_",
"[_",
"c_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"c_",
"in_",
"e_",
"._",
"children_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"e_",
"in_",
"dd_",
"._",
"get",
"\\u",
"survey",
"\\u",
"elements_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"e_",
"._",
"bind_",
"._",
"get_",
"(_",
"\"",
"type",
"\"_",
")_",
"==_",
"\"",
"select",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"\\u",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"cls_",
",_",
"record_",
",_",
"select",
"\\u",
"multiple",
"s_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Pref",
"ix",
" ",
"contain",
"s",
" ",
"the",
" ",
"xpa",
"th",
" ",
"and",
" ",
"slash",
" ",
"if",
" ",
"we",
" ",
"are",
" ",
"within",
" ",
"a",
" ",
"repeat",
" ",
"so",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tha",
"t",
" ",
"we",
" ",
"can",
" ",
"figure",
" ",
"out",
" ",
"whi",
"ch",
" ",
"select",
" ",
"multiple",
"s",
" ",
"belo",
"ng",
" ",
"to",
" ",
"whi",
"ch",
" ",
"repeat",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
",_",
"choices_",
"in_",
"select",
"\\u",
"multiple",
"s_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"the",
" ",
"select",
" ",
"multiple",
" ",
"mig",
"ht",
" ",
"be",
" ",
"blank",
" ",
"or",
" ",
"not",
" ",
"exist",
" ",
"in",
" ",
"the",
" ",
"record",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"need",
" ",
"to",
" ",
"make",
" ",
"tho",
"se",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"selections_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"key_",
"in_",
"record_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"split",
" ",
"selecte",
"d",
" ",
"choice",
"s",
" ",
"by",
" ",
"space",
"s",
" ",
"and",
" ",
"join",
" ",
"by",
" ",
"/",
" ",
"to",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"element",
"'",
"s",
" ",
"xpath_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"selections_",
"=_",
"[_",
"\"%",
"s",
"/",
"%",
"s",
"\"_",
"%_",
"(_",
"key_",
",_",
"r_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"r_",
"in_",
"record_",
"[_",
"key_",
"]_",
"._",
"split_",
"(_",
"\"",
" ",
"\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"remove",
" ",
"the",
" ",
"column",
" ",
"sinc",
"e",
" ",
"we",
" ",
"are",
" ",
"addin",
"g",
" ",
"separate",
" ",
"columns_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"each",
" ",
"choice_",
"\\u\\u\\uNL\\u\\u\\u_",
"record_",
"._",
"pop_",
"(_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"add",
" ",
"column",
"s",
" ",
"to",
" ",
"record",
" ",
"for",
" ",
"every",
" ",
"choice",
",",
" ",
"with",
" ",
"default_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fal",
"se",
" ",
"and",
" ",
"set",
" ",
"to",
" ",
"Tru",
"e",
" ",
"for",
" ",
"items",
" ",
"in",
" ",
"selections_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"record_",
"._",
"update_",
"(_",
"dict_",
"(_",
"[_",
"(_",
"choice_",
",_",
"choice_",
"in_",
"selections_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"choice_",
"in_",
"choices_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"YES_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"NO_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"._",
"update_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"dict_",
"(_",
"[_",
"(_",
"choice_",
",_",
"YES_",
"if_",
"choice_",
"in_",
"selections_",
"else_",
"NO_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"choice_",
"in_",
"choices_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"recurs",
" ",
"int",
"o",
" ",
"repeats_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"record",
"\\u",
"key_",
",_",
"record",
"\\u",
"item_",
"in_",
"record_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"type_",
"(_",
"record",
"\\u",
"item_",
")_",
"==_",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"list",
"\\u",
"item_",
"in_",
"record",
"\\u",
"item_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"type_",
"(_",
"list",
"\\u",
"item_",
")_",
"==_",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"cls_",
"._",
"\\u",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"list",
"\\u",
"item_",
",_",
"select",
"\\u",
"multiple",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"\\u",
"collect",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"cls_",
",_",
"dd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"e_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"for_",
"e_",
"in_",
"dd_",
"._",
"get",
"\\u",
"survey",
"\\u",
"elements_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"e_",
"._",
"bind_",
"._",
"get_",
"(_",
"\"",
"type",
"\"_",
")_",
"==_",
"\"",
"geop",
"oint",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"\\u",
"tag",
"\\u",
"edit",
"\\u",
"string_",
"(_",
"cls_",
",_",
"record_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Turn",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"tags",
" ",
"int",
"o",
" ",
"a",
" ",
"string",
" ",
"represent",
"ation",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'\\u",
"tags",
"'_",
"in_",
"record_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tags_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"tag_",
"in_",
"record_",
"[_",
"'\\u",
"tags",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"','_",
"in_",
"tag_",
"and_",
"'",
" ",
"'_",
"in_",
"tag_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"tags_",
"._",
"append_",
"(_",
"'\"",
"%",
"s",
"\"'_",
"%_",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"tags_",
"._",
"append_",
"(_",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"record_",
"._",
"update_",
"(_",
"{_",
"'\\u",
"tags",
"'_",
":_",
"u",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"sorted_",
"(_",
"tags_",
")_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"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_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"split",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"cls_",
",_",
"record_",
",_",
"gps",
"\\u",
"fields_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"update",
"d\\u",
"gps",
"\\u",
"fields_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
",_",
"value_",
"in_",
"record_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"key_",
"in_",
"gps",
"\\u",
"fields_",
"and_",
"isinstance_",
"(_",
"value_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gps",
"\\u",
"xpa",
"ths_",
"=_",
"Data",
"Dictionary_",
"._",
"get",
"\\u",
"addition",
"al",
"\\u",
"geop",
"oint",
"\\u",
"xpa",
"ths_",
"(_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"gps",
"\\u",
"parts_",
"=_",
"dict_",
"(_",
"[_",
"(_",
"xpath_",
",_",
"None_",
")_",
"for_",
"xpath_",
"in_",
"gps",
"\\u",
"xpa",
"ths_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"hack",
",",
" ",
"check",
" ",
"if",
" ",
"its",
" ",
"a",
" ",
"list",
" ",
"and",
" ",
"gra",
"b",
" ",
"the",
" ",
"object",
" ",
"within",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"parts_",
"=_",
"value_",
"._",
"split_",
"(_",
"'",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"check",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"we",
" ",
"can",
" ",
"have",
" ",
"a",
" ",
"gps",
" ",
"recording_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"OD",
"KC",
"olle",
"ct",
" ",
"tha",
"t",
" ",
"has",
" ",
"less",
" ",
"than",
" ",
"four",
" ",
"component",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"now",
" ",
"we",
" ",
"are",
" ",
"ass",
"umi",
"ng",
" ",
"tha",
"t",
" ",
"this",
" ",
"is",
" ",
"not",
" ",
"the",
" ",
"case",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"parts_",
")_",
"==_",
"4_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"gps",
"\\u",
"parts_",
"=_",
"dict_",
"(_",
"zip_",
"(_",
"gps",
"\\u",
"xpa",
"ths_",
",_",
"parts_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"update",
"d\\u",
"gps",
"\\u",
"fields_",
"._",
"update_",
"(_",
"gps",
"\\u",
"parts_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"check",
" ",
"for",
" ",
"repeat",
"s",
" ",
"within",
" ",
"record",
" ",
"i",
".",
"e",
".",
" ",
"in",
" ",
"value_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"value_",
")_",
"==_",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"list",
"\\u",
"item_",
"in_",
"value_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"type_",
"(_",
"list",
"\\u",
"item_",
")_",
"==_",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"cls_",
"._",
"\\u",
"split",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"list",
"\\u",
"item_",
",_",
"gps",
"\\u",
"fields_",
")_",
"\\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_",
"record_",
"._",
"update_",
"(_",
"update",
"d\\u",
"gps",
"\\u",
"fields_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Abstract",
"Data",
"Frame",
"Builder_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"query",
"\\u",
"mongo_",
"(_",
"self_",
",_",
"query_",
"=_",
"'{}'_",
",_",
"start_",
"=_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"limit_",
"=_",
"Pars",
"ed",
"Instance_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"LIMIT_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"'[]'_",
",_",
"count_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pars",
"ed",
"Insta",
"nce",
".",
"query",
"\\u",
"mongo",
" ",
"take",
"s",
" ",
"params",
" ",
"as",
" ",
"json",
" ",
"strings_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"we",
" ",
"dump",
"s",
" ",
"the",
" ",
"fields",
" ",
"dictionary_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"count",
"\\u",
"args_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"self_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"\\u",
"string",
"'_",
":_",
"self_",
"._",
"id",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"query",
"'_",
":_",
"query_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"'[]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sort",
"'_",
":_",
"'{}'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"count",
"'_",
":_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"count",
"\\u",
"object_",
"=_",
"Pars",
"ed",
"Instance_",
"._",
"query",
"\\u",
"mongo_",
"(_",
"**_",
"count",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record",
"\\u",
"count_",
"=_",
"count",
"\\u",
"object_",
"[_",
"0_",
"]_",
"[_",
"\"",
"count",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"record",
"\\u",
"count_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"No",
"Record",
"s",
"Foun",
"d",
"Error_",
"(_",
"\"",
"No",
" ",
"record",
"s",
" ",
"found",
" ",
"for",
" ",
"your",
" ",
"query",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"count",
" ",
"was",
" ",
"request",
"ed",
",",
" ",
"return",
" ",
"the",
" ",
"count_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"record",
"\\u",
"count_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query",
"\\u",
"args_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"self_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"\\u",
"string",
"'_",
":_",
"self_",
"._",
"id",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"query",
"'_",
":_",
"query_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"we",
" ",
"mig",
"ht",
" ",
"want",
" ",
"to",
" ",
"add",
" ",
"this",
" ",
"in",
" ",
"for",
" ",
"the",
" ",
"user_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"sep",
"cif",
"y",
" ",
"a",
" ",
"sort",
" ",
"order_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sort",
"'_",
":_",
"'{}'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"start",
"'_",
":_",
"start_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"limit",
"'_",
":_",
"limit_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"count",
"'_",
":_",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"use",
" ",
"Pars",
"ed",
"Insta",
"nce",
".",
"query",
"\\u",
"mongo_",
"\\u\\u\\uNL\\u\\u\\u_",
"cursor_",
"=_",
"Pars",
"ed",
"Instance_",
"._",
"query",
"\\u",
"mongo_",
"(_",
"**_",
"query",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"cursor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Generate",
" ",
"structure",
"s",
" ",
"from",
" ",
"mongo",
" ",
"and",
" ",
"Data",
"Dict",
"ionar",
"y",
" ",
"for",
" ",
"a",
" ",
"Data",
"Frame",
"XL",
"SW",
"riter",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"builde",
"r",
" ",
"can",
" ",
"choose",
" ",
"to",
" ",
"query",
" ",
"the",
" ",
"data",
" ",
"in",
" ",
"batche",
"s",
" ",
"and",
" ",
"write",
" ",
"to",
" ",
"a",
" ",
"single",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Exce",
"l",
"Write",
"r",
" ",
"object",
" ",
"usi",
"ng",
" ",
"multiple",
" ",
"instance",
"s",
" ",
"of",
" ",
"Data",
"Frame",
"XL",
"SW",
"riter",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"INDE",
"X",
"\\u",
"COLUMN_",
"=_",
"u",
"\"\\u",
"index",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PARENT",
"\\u",
"TAB",
"LE",
"\\u",
"NAME",
"\\u",
"COLUMN_",
"=_",
"u",
"\"\\u",
"parent",
"\\u",
"table",
"\\u",
"name",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PARENT",
"\\u",
"INDE",
"X",
"\\u",
"COLUMN_",
"=_",
"u",
"\"\\u",
"parent",
"\\u",
"index",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EXTRA",
"\\u",
"COLUMNS_",
"=_",
"[_",
"INDE",
"X",
"\\u",
"COLUMN_",
",_",
"PARENT",
"\\u",
"TAB",
"LE",
"\\u",
"NAME",
"\\u",
"COLUMN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"PARENT",
"\\u",
"INDE",
"X",
"\\u",
"COLUMN_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SHE",
"ET",
"\\u",
"NAME",
"\\u",
"MAX",
"\\u",
"CHARS_",
"=_",
"30_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"XL",
"S",
"\\u",
"SHE",
"ET",
"\\u",
"COUNT",
"\\u",
"LIMIT_",
"=_",
"255_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"XL",
"S",
"\\u",
"COL",
"UM",
"N",
"\\u",
"COUNT",
"\\u",
"MAX_",
"=_",
"255_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CURREN",
"T",
"\\u",
"INDE",
"X",
"\\u",
"META_",
"=_",
"'",
"current",
"\\u",
"index",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"username_",
",_",
"id",
"\\u",
"string_",
",_",
"filter",
"\\u",
"query_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"group",
"\\u",
"delimiter_",
"=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"True_",
",_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
",_",
"id",
"\\u",
"string_",
",_",
"filter",
"\\u",
"query_",
",_",
"group",
"\\u",
"delimiter_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
",_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
",_",
"self_",
")_",
"._",
"\\u",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"need",
" ",
"to",
" ",
"split",
" ",
"column",
"s",
",",
" ",
"with",
" ",
"repeat",
"s",
" ",
"in",
" ",
"individual",
" ",
"sheet",
"s",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"every",
"thing",
" ",
"else",
" ",
"on",
" ",
"the",
" ",
"default",
" ",
"sheet_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"generat",
"e\\u",
"sections_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"export",
"\\u",
"to_",
"(_",
"self_",
",_",
"file",
"\\u",
"path_",
",_",
"batchsize",
"_",
"=_",
"1000_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"xls",
"\\u",
"writer_",
"=_",
"Exce",
"l",
"Writer_",
"(_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"record",
" ",
"count_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"\\u",
"count_",
"=_",
"self_",
"._",
"\\u",
"query",
"\\u",
"mongo_",
"(_",
"count_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"query",
" ",
"in",
" ",
"batche",
"s",
" ",
"and",
" ",
"for",
" ",
"each",
" ",
"batch",
" ",
"create",
" ",
"an",
" ",
"XL",
"SD",
"ata",
"Frame",
"Write",
"r",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"write",
" ",
"to",
" ",
"exist",
"ing",
" ",
"xls",
"\\u",
"writer",
" ",
"object_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"start_",
"<_",
"record",
"\\u",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cursor_",
"=_",
"self_",
"._",
"\\u",
"query",
"\\u",
"mongo_",
"(_",
"self_",
"._",
"filter",
"\\u",
"query_",
",_",
"start_",
"=_",
"start_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"limit_",
"=_",
"batchsize",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"\\u",
"format\\u",
"for",
"\\u",
"dataframe_",
"(_",
"cursor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"write",
" ",
"all",
" ",
"cursor",
"'",
"s",
" ",
"data",
" ",
"to",
" ",
"thei",
"r",
" ",
"respec",
"tiv",
"e",
" ",
"sheets_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"section",
"\\u",
"name_",
",_",
"section_",
"in_",
"self_",
"._",
"sections_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"records_",
"=_",
"data_",
"[_",
"section",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"currentl",
"y",
" ",
"ign",
"orin",
"g",
" ",
"nest",
"ed",
" ",
"repeats_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"ignore",
" ",
"section",
"s",
" ",
"tha",
"t",
" ",
"have",
" ",
"0",
" ",
"records_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"records_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"use",
" ",
"a",
" ",
"different",
" ",
"group",
" ",
"delimiter",
" ",
"if",
" ",
"needed_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"columns_",
"=_",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"!=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"columns_",
"=_",
"[_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"._",
"join_",
"(_",
"col_",
"._",
"split_",
"(_",
"\"/\"_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"col_",
"in_",
"columns_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"columns_",
"=_",
"columns_",
"+_",
"self_",
"._",
"EXTRA",
"\\u",
"COLUMNS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"=_",
"XL",
"SD",
"ata",
"Frame",
"Writer_",
"(_",
"records_",
",_",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"._",
"write",
"\\u",
"to",
"\\u",
"excel_",
"(_",
"self_",
"._",
"xls",
"\\u",
"writer_",
",_",
"section",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"header_",
"=_",
"header_",
",_",
"index_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"header_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"increment",
" ",
"counter",
"(",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
"+=_",
"batchsize",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"0.1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"xls",
"\\u",
"writer_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"format\\u",
"for",
"\\u",
"dataframe_",
"(_",
"self_",
",_",
"cursor_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Format",
" ",
"each",
" ",
"record",
" ",
"for",
" ",
"consum",
"ption",
" ",
"by",
" ",
"a",
" ",
"dataframe",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"return",
"s",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"with",
" ",
"the",
" ",
"key",
" ",
"bei",
"ng",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"sheet",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"values",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"dict",
"s",
" ",
"to",
" ",
"feed",
" ",
"int",
"o",
" ",
"a",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"dict_",
"(_",
"(_",
"section",
"\\u",
"name_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"section",
"\\u",
"name_",
"in_",
"self_",
"._",
"sections_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"main",
"\\u",
"section_",
"=_",
"self_",
"._",
"sections_",
"[_",
"self_",
"._",
"survey",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"main",
"\\u",
"section",
"s",
"\\u",
"columns_",
"=_",
"main",
"\\u",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"record_",
"in_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"from",
" ",
"record",
",",
" ",
"we",
"'",
"ll",
" ",
"end",
" ",
"up",
" ",
"with",
" ",
"multiple",
" ",
"record",
"s",
",",
" ",
"one",
" ",
"for",
" ",
"each_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"section",
" ",
"we",
" ",
"have_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"record",
"s",
" ",
"for",
" ",
"the",
" ",
"default",
" ",
"section_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"data\\u",
"for",
"\\u",
"section_",
"(_",
"data_",
"[_",
"self_",
"._",
"survey",
"\\u",
"name_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"record_",
",_",
"main",
"\\u",
"section",
"s",
"\\u",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"survey",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"\\u",
"index_",
"=_",
"main",
"\\u",
"section_",
"[_",
"self_",
"._",
"CURREN",
"T",
"\\u",
"INDE",
"X",
"\\u",
"META_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"sheet",
"\\u",
"name_",
",_",
"section_",
"in_",
"self_",
"._",
"sections_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"skip",
" ",
"default",
" ",
"section",
" ",
"i",
".",
"e",
" ",
"survey",
" ",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"sheet",
"\\u",
"name_",
"!=_",
"self_",
"._",
"survey",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"xpath_",
"=_",
"section_",
"[_",
"\"",
"xpa",
"th",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"columns_",
"=_",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"handle",
" ",
"nest",
"ed",
" ",
"repeat",
"s",
" ",
"-",
"ign",
"orin",
"g",
" ",
"nest",
"ed",
" ",
"repeat",
"s",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"now",
" ",
"whi",
"ch",
" ",
"will",
" ",
"not",
" ",
"be",
" ",
"in",
" ",
"the",
" ",
"top",
" ",
"level",
" ",
"record",
",",
" ",
"per",
"hap",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"nest",
" ",
"section",
"s",
" ",
"as",
" ",
"well",
" ",
"so",
" ",
"we",
" ",
"can",
" ",
"recurs",
" ",
"in",
" ",
"and",
" ",
"get",
" ",
"them",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"xpath_",
"in_",
"record_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"repeat",
"\\u",
"records_",
"=_",
"record_",
"[_",
"xpath_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"num",
"\\u",
"repeat",
"\\u",
"record",
"s",
" ",
"=",
" ",
"len",
"(",
"repeat",
"\\u",
"record",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"repeat",
"\\u",
"record_",
"in_",
"repeat",
"\\u",
"records_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"data\\u",
"for",
"\\u",
"section_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"[_",
"sheet",
"\\u",
"name_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"repeat",
"\\u",
"record_",
",_",
"columns_",
",_",
"sheet",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parent",
"\\u",
"index_",
",_",
"self_",
"._",
"survey",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"add",
"\\u",
"data\\u",
"for",
"\\u",
"section_",
"(_",
"self_",
",_",
"data\\u",
"section_",
",_",
"record_",
",_",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"section",
"\\u",
"name_",
",_",
"parent",
"\\u",
"index_",
"=_",
"-_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parent",
"\\u",
"table",
"\\u",
"name_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"section_",
"._",
"append_",
"(_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"sections_",
"[_",
"section",
"\\u",
"name_",
"]_",
"[_",
"self_",
"._",
"CURREN",
"T",
"\\u",
"INDE",
"X",
"\\u",
"META_",
"]_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index_",
"=_",
"self_",
"._",
"sections_",
"[_",
"section",
"\\u",
"name_",
"]_",
"[_",
"self_",
"._",
"CURREN",
"T",
"\\u",
"INDE",
"X",
"\\u",
"META_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"data\\u",
"section",
"[",
"len",
"(",
"data\\u",
"section",
")-",
"1",
"].",
"update",
"(",
"record",
")",
" ",
"#",
" ",
"we",
" ",
"coul",
"d",
" ",
"simp",
"ly",
" ",
"do_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"but",
" ",
"end",
" ",
"up",
" ",
"with",
" ",
"duplicat",
"e",
" ",
"data",
" ",
"from",
" ",
"repeats_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"find",
" ",
"any",
" ",
"select",
" ",
"multiple",
"(",
"s",
")",
" ",
"and",
" ",
"add",
" ",
"addition",
"al",
" ",
"column",
"s",
" ",
"to",
" ",
"record_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"record_",
"=_",
"self_",
"._",
"\\u",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"record_",
",_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"alt",
",",
" ",
"precision_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"split",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"record_",
",_",
"self_",
"._",
"gps",
"\\u",
"fields_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"column_",
"in_",
"columns_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"value_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"value_",
"=_",
"record_",
"[_",
"column_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"a",
" ",
"record",
" ",
"may",
" ",
"not",
" ",
"have",
" ",
"response",
"s",
" ",
"for",
" ",
"some",
" ",
"element",
"s",
" ",
"simp",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bec",
"aus",
"e",
" ",
"the",
"y",
" ",
"wer",
"e",
" ",
"not",
" ",
"captured",
"_",
"\\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_",
"data\\u",
"section_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"len_",
"(_",
"data\\u",
"section_",
")_",
"-_",
"1_",
"]_",
"._",
"update_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"._",
"join_",
"(_",
"column_",
"._",
"split_",
"(_",
"'/'_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"!=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"else_",
"column_",
":_",
"data\\u",
"value_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data\\u",
"section_",
"[_",
"len_",
"(_",
"data\\u",
"section_",
")_",
"-_",
"1_",
"]_",
"._",
"update_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"._",
"INDE",
"X",
"\\u",
"COLUMN_",
":_",
"index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"._",
"PARENT",
"\\u",
"INDE",
"X",
"\\u",
"COLUMN_",
":_",
"parent",
"\\u",
"index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"._",
"PARENT",
"\\u",
"TAB",
"LE",
"\\u",
"NAME",
"\\u",
"COLUMN_",
":_",
"parent",
"\\u",
"table",
"\\u",
"name_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"ADD",
"ITION",
"AL",
"\\u",
"COLUMNS_",
"\\u\\u\\uNL\\u\\u\\u_",
"data\\u",
"section_",
"[_",
"len_",
"(_",
"data\\u",
"section_",
")_",
"-_",
"1_",
"]_",
"._",
"update_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"dict_",
"(_",
"[_",
"(_",
"column_",
",_",
"record_",
"[_",
"column_",
"]_",
"if_",
"column_",
"in_",
"record_",
"else_",
"None_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"column_",
"in_",
"self_",
"._",
"ADD",
"ITION",
"AL",
"\\u",
"COLUMNS_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"generat",
"e\\u",
"sections_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Split",
" ",
"survey",
" ",
"question",
"s",
" ",
"int",
"o",
" ",
"separate",
" ",
"section",
"s",
" ",
"for",
" ",
"each",
" ",
"xls",
" ",
"sheet",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"column",
"s",
" ",
"for",
" ",
"each",
" ",
"section",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"clear",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"sections_",
"=_",
"Order",
"ed",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"dict",
" ",
"of",
" ",
"select",
" ",
"multiple",
" ",
"elements_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"survey",
"\\u",
"element_",
"=_",
"self_",
"._",
"dd_",
"._",
"survey_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"survey",
"\\u",
"name_",
"=_",
"get",
"\\u",
"valid",
"\\u",
"sheet",
"\\u",
"name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"survey",
"\\u",
"element_",
"._",
"name_",
",_",
"self_",
"._",
"sections_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"section_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"survey",
"\\u",
"name_",
",_",
"survey",
"\\u",
"element_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"build",
" ",
"sections_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"build",
"\\u",
"section",
"s",
"\\u",
"recursive_",
"(_",
"self_",
"._",
"survey",
"\\u",
"name_",
",_",
"self_",
"._",
"dd_",
"._",
"get",
"\\u",
"survey_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"section",
"\\u",
"name_",
"in_",
"self_",
"._",
"sections_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"sections_",
"[_",
"section",
"\\u",
"name_",
"]_",
"[_",
"'",
"column",
"s",
"'_",
"]_",
"+=_",
"self_",
"._",
"ADD",
"ITION",
"AL",
"\\u",
"COLUMNS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"get",
"\\u",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"build",
"\\u",
"section",
"s",
"\\u",
"recursive_",
"(_",
"self_",
",_",
"section",
"\\u",
"name_",
",_",
"element_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"is",
"\\u",
"repeatin",
"g_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Build",
"s",
" ",
"a",
" ",
"section",
"'",
"s",
" ",
"child",
"ren",
" ",
"and",
" ",
"recurse",
"s",
" ",
"any",
" ",
"repeatin",
"g",
" ",
"section",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"build",
" ",
"tho",
"se",
" ",
"as",
" ",
"a",
" ",
"separate",
" ",
"section",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"child_",
"in_",
"element_",
"._",
"children_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"a",
" ",
"section",
",",
" ",
"recurse_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Section_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
"=_",
"isinstance_",
"(_",
"child_",
",_",
"Repeat",
"ing",
"Section_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"section",
"\\u",
"name_",
"=_",
"section",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"its",
" ",
"repeatin",
"g",
",",
" ",
"build",
" ",
"a",
" ",
"new",
" ",
"section_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"new",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"new",
"\\u",
"section",
"\\u",
"name_",
"=_",
"get",
"\\u",
"valid",
"\\u",
"sheet",
"\\u",
"name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"child_",
"._",
"name_",
",_",
"self_",
"._",
"sections_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"section_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"section",
"\\u",
"name_",
",_",
"child_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"build",
"\\u",
"section",
"s",
"\\u",
"recursive_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"section",
"\\u",
"name_",
",_",
"child_",
",_",
"new",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"add",
" ",
"to",
" ",
"survey",
"\\u",
"sections_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"child",
"\\u",
"bind",
"\\u",
"type_",
"=_",
"child_",
"._",
"bind_",
"._",
"get_",
"(_",
"u",
"\"",
"type",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Question_",
")_",
"and_",
"not_",
"question",
"\\u",
"types",
"\\u",
"to",
"\\u",
"exclude_",
"(_",
"child_",
"._",
"type_",
")_",
"and_",
"not_",
"child",
"\\u",
"bind",
"\\u",
"type_",
"==_",
"MULTIPLE",
"\\u",
"SELECT",
"\\u",
"BIND",
"\\u",
"TYPE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"\\u",
"add",
"\\u",
"column",
"\\u",
"to",
"\\u",
"section_",
"(_",
"section",
"\\u",
"name_",
",_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"child",
"\\u",
"bind",
"\\u",
"type_",
"==_",
"MULTIPLE",
"\\u",
"SELECT",
"\\u",
"BIND",
"\\u",
"TYPE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
"[_",
"child_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"]_",
"=_",
"[_",
"option_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"option_",
"in_",
"child_",
"._",
"children_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"select",
" ",
"multiple",
",",
" ",
"get",
" ",
"its",
" ",
"choice",
"s",
" ",
"and",
" ",
"make",
" ",
"them",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"columns_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"for_",
"option_",
"in_",
"child_",
"._",
"children_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"column",
"\\u",
"to",
"\\u",
"section_",
"(_",
"section",
"\\u",
"name_",
",_",
"option_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"column",
"\\u",
"to",
"\\u",
"section_",
"(_",
"section",
"\\u",
"name_",
",_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"split",
" ",
"gps",
" ",
"fields",
" ",
"within",
" ",
"this",
" ",
"section_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"child",
"\\u",
"bind",
"\\u",
"type_",
"==_",
"GEO",
"POINT",
"\\u",
"BIND",
"\\u",
"TYPE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"add",
" ",
"column",
"s",
" ",
"for",
" ",
"geop",
"oint",
" ",
"components_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"xpath_",
"in_",
"self_",
"._",
"dd_",
"._",
"get",
"\\u",
"addition",
"al",
"\\u",
"geop",
"oint",
"\\u",
"xpa",
"ths_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"child_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"column",
"\\u",
"to",
"\\u",
"section_",
"(_",
"section",
"\\u",
"name_",
",_",
"xpath_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"\"",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limit",
"s",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"sections_",
")_",
">_",
"self_",
"._",
"XL",
"S",
"\\u",
"SHE",
"ET",
"\\u",
"COUNT",
"\\u",
"LIMIT_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"=_",
"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 ",
" _",
"for_",
"section_",
"in_",
"self_",
"._",
"sections_",
"._",
"itervalues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"len_",
"(_",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
")_",
">_",
"self_",
"._",
"XL",
"S",
"\\u",
"COL",
"UM",
"N",
"\\u",
"COUNT",
"\\u",
"MAX_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"exceed",
"s",
"\\u",
"xls",
"\\u",
"limits_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"section_",
"(_",
"self_",
",_",
"section",
"\\u",
"name_",
",_",
"xpath_",
",_",
"is",
"\\u",
"repeat_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"index",
" ",
"=",
" ",
"len",
"(",
"self",
".",
"section",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"sections_",
"[_",
"section",
"\\u",
"name_",
"]_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"section",
"\\u",
"name_",
",_",
"\"",
"xpa",
"th",
"\"_",
":_",
"xpath_",
",_",
"\"",
"column",
"s",
"\"_",
":_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"is",
"\\u",
"repeat",
"\"_",
":_",
"is",
"\\u",
"repeat_",
",_",
"self_",
"._",
"CURREN",
"T",
"\\u",
"INDE",
"X",
"\\u",
"META_",
":_",
"0_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"add",
"\\u",
"column",
"\\u",
"to",
"\\u",
"section_",
"(_",
"self_",
",_",
"sheet",
"\\u",
"name_",
",_",
"column_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"section_",
"=_",
"self_",
"._",
"sections_",
"[_",
"sheet",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xpath_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"column_",
",_",
"Surv",
"ey",
"Element_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xpath_",
"=_",
"column_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"column_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xpath_",
"=_",
"column_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"(_",
"xpath_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"column",
" ",
"is",
" ",
"not",
" ",
"alr",
"ead",
"y",
" ",
"in",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"xpath_",
"not_",
"in_",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"section_",
"[_",
"\"",
"column",
"s",
"\"_",
"]_",
"._",
"append_",
"(_",
"xpath_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\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_",
",_",
"username_",
",_",
"id",
"\\u",
"string_",
",_",
"filter",
"\\u",
"query_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"group",
"\\u",
"delimiter_",
"=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"True_",
",_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"CSV",
"Data",
"Frame",
"Builder_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
",_",
"id",
"\\u",
"string_",
",_",
"filter",
"\\u",
"query_",
",_",
"group",
"\\u",
"delimiter_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
",_",
"binar",
"y",
"\\u",
"select",
"\\u",
"multiple",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
"=_",
"Order",
"ed",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"CSV",
"Data",
"Frame",
"Builder_",
",_",
"self_",
")_",
"._",
"\\u",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"reindex",
"_",
"(_",
"cls_",
",_",
"key_",
",_",
"value_",
",_",
"order",
"ed",
"\\u",
"columns_",
",_",
"parent",
"\\u",
"prefix_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Flatt",
"en",
" ",
"list",
" ",
"column",
"s",
" ",
"by",
" ",
"appendi",
"ng",
" ",
"an",
" ",
"index",
",",
" ",
"other",
"wis",
"e",
" ",
"return",
" ",
"as",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"check",
" ",
"for",
" ",
"lists_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
"(_",
"value_",
")_",
"is_",
"list_",
"and_",
"len_",
"(_",
"value_",
")_",
">_",
"0_",
"and_",
"key_",
"!=_",
"NOTE",
"S_",
"and_",
"key_",
"!=_",
"ATTACH",
"MENTS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"index_",
",_",
"item_",
"in_",
"enumerate_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"start",
" ",
"at",
" ",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"index_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"for",
" ",
"each",
" ",
"list",
" ",
"check",
" ",
"for",
" ",
"dict",
",",
" ",
"we",
" ",
"want",
" ",
"to",
" ",
"transform",
" ",
"the",
" ",
"key",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"dict_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
"(_",
"item_",
")_",
"is_",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"nest",
"ed",
"\\u",
"key_",
",_",
"nest",
"ed",
"\\u",
"val_",
"in_",
"item_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"give",
"n",
" ",
"the",
" ",
"key",
" ",
"\"",
"child",
"ren",
"/",
"deta",
"il",
"s",
"\"",
" ",
"and",
" ",
"nest",
"ed",
"\\u",
"key",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"abbrev",
"iate",
"d",
" ",
"xpath_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"",
"child",
"ren",
"/",
"deta",
"il",
"s",
"/",
"imm",
"uni",
"zatio",
"n",
"/",
"poli",
"o",
"\\u",
"1",
"\",",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"generat",
"e",
" ",
"[\"",
"child",
"ren",
"\",",
" ",
"index",
",",
" ",
"\"",
"imm",
"uni",
"zatio",
"n",
"/",
"poli",
"o",
"\\u",
"1",
"\"]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"xpa",
"ths_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
"[",
"%",
"s",
"]\"_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"nest",
"ed",
"\\u",
"key_",
"[_",
":_",
"nest",
"ed",
"\\u",
"key_",
"._",
"index_",
"(_",
"key_",
")_",
"+_",
"len_",
"(_",
"key_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"nest",
"ed",
"\\u",
"key_",
"[_",
"nest",
"ed",
"\\u",
"key_",
"._",
"index_",
"(_",
"key_",
")_",
"+_",
"len_",
"(_",
"key_",
")_",
"+_",
"1_",
":_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"re",
"-",
"create",
" ",
"xpa",
"th",
" ",
"the",
" ",
"split",
" ",
"on",
" ",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"xpa",
"ths_",
"=_",
"\"/\"_",
"._",
"join_",
"(_",
"xpa",
"ths_",
")_",
"._",
"split_",
"(_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"prefix_",
"=_",
"xpa",
"ths_",
"[_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"type_",
"(_",
"nest",
"ed",
"\\u",
"val_",
")_",
"is_",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"nest",
"ed",
"\\u",
"value",
" ",
"is",
" ",
"a",
" ",
"list",
",",
" ",
"rin",
"se",
" ",
"and",
" ",
"repeat_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"d_",
"._",
"update_",
"(_",
"cls_",
"._",
"\\u",
"reindex",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"nest",
"ed",
"\\u",
"key_",
",_",
"nest",
"ed",
"\\u",
"val_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"order",
"ed",
"\\u",
"columns_",
",_",
"new",
"\\u",
"prefix_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"it",
" ",
"can",
" ",
"only",
" ",
"be",
" ",
"a",
" ",
"scalar_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"collapse",
" ",
"xpath_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"parent",
"\\u",
"prefix_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"xpa",
"ths_",
"[_",
"0_",
":_",
"len_",
"(_",
"parent",
"\\u",
"prefix_",
")_",
"]_",
"=_",
"parent",
"\\u",
"prefix_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"new",
"\\u",
"xpath_",
"=_",
"u",
"\"/\"_",
"._",
"join_",
"(_",
"xpa",
"ths_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"check",
" ",
"if",
" ",
"this",
" ",
"key",
" ",
"exist",
"s",
" ",
"in",
" ",
"our",
" ",
"order",
"ed",
" ",
"columns_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"key_",
"in_",
"order",
"ed",
"\\u",
"columns_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"new",
"\\u",
"xpath_",
"not_",
"in_",
"order",
"ed",
"\\u",
"columns_",
"[_",
"key_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"order",
"ed",
"\\u",
"columns_",
"[_",
"key_",
"]_",
"._",
"append_",
"(_",
"new",
"\\u",
"xpath_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"d_",
"[_",
"new",
"\\u",
"xpath_",
"]_",
"=_",
"nest",
"ed",
"\\u",
"val_",
"\\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 ",
" ",
"_",
"d_",
"[_",
"key_",
"]_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"anyt",
"hing",
" ",
"tha",
"t",
"'",
"s",
" ",
"not",
" ",
"a",
" ",
"list",
" ",
"will",
" ",
"be",
" ",
"in",
" ",
"the",
" ",
"top",
" ",
"level",
" ",
"dict",
" ",
"so",
" ",
"its_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"safe",
" ",
"to",
" ",
"simp",
"ly",
" ",
"assign_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"key_",
"==_",
"NOTE",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"d_",
"[_",
"key_",
"]_",
"=_",
"u",
"\"\\\\",
"r",
"\\\\",
"n",
"\"_",
"._",
"join_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"key_",
"==_",
"ATTACH",
"MENTS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"d_",
"[_",
"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 ",
" _",
"d_",
"[_",
"key_",
"]_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\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_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"build",
"\\u",
"order",
"ed",
"\\u",
"columns_",
"(_",
"cls_",
",_",
"survey",
"\\u",
"element_",
",_",
"order",
"ed",
"\\u",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"is",
"\\u",
"repeatin",
"g",
"\\u",
"section_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Build",
" ",
"a",
" ",
"flat",
" ",
"order",
"ed",
" ",
"dict",
" ",
"of",
" ",
"column",
" ",
"group",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
"\\u",
"repeatin",
"g",
"\\u",
"section",
" ",
"ensure",
"s",
" ",
"tha",
"t",
" ",
"child",
" ",
"question",
"s",
" ",
"of",
" ",
"repeatin",
"g",
" ",
"section",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"are",
" ",
"not",
" ",
"consider",
"ed",
" ",
"column",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"child_",
"in_",
"survey",
"\\u",
"element_",
"._",
"children_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"child",
"\\u",
"xpa",
"th",
" ",
"=",
" ",
"child",
".",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpa",
"th",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Section_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"child",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Repeat",
"ing",
"Section_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"order",
"ed",
"\\u",
"columns_",
"[_",
"child_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"]_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cls_",
"._",
"\\u",
"build",
"\\u",
"order",
"ed",
"\\u",
"columns_",
"(_",
"child_",
",_",
"order",
"ed",
"\\u",
"columns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"child",
"\\u",
"is",
"\\u",
"repeatin",
"g_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"child_",
",_",
"Question_",
")_",
"and_",
"not_",
"question",
"\\u",
"types",
"\\u",
"to",
"\\u",
"exclude_",
"(_",
"child_",
"._",
"type_",
")_",
"and_",
"not_",
"is",
"\\u",
"repeatin",
"g",
"\\u",
"section_",
":_",
"#",
" ",
"if",
" ",
"is",
"\\u",
"repeatin",
"g",
"\\u",
"section",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"its",
" ",
"parent",
" ",
"alr",
"ead",
"y",
" ",
"init",
"ili",
"ase",
"d",
" ",
"an",
" ",
"empty",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"we",
" ",
"don",
"t",
" ",
"add",
" ",
"it",
" ",
"to",
" ",
"our",
" ",
"list",
" ",
"of",
" ",
"column",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"repeatin",
"g",
" ",
"column",
"s",
" ",
"list",
" ",
"will",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"generat",
"ed",
" ",
"whe",
"n",
" ",
"we",
" ",
"reindex",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"order",
"ed",
"\\u",
"columns_",
"[_",
"child_",
"._",
"get",
"\\u",
"abbrev",
"iate",
"d\\u",
"xpath_",
"(_",
")_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\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",
"format\\u",
"for",
"\\u",
"dataframe_",
"(_",
"self_",
",_",
"cursor_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"check",
" ",
"for",
" ",
"and",
" ",
"handle",
" ",
"empty",
" ",
"results_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"order",
"ed",
" ",
"column",
"s",
" ",
"for",
" ",
"select",
" ",
"multiple",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"key_",
",_",
"choices_",
"in_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"HA",
"CK",
" ",
"to",
" ",
"ensure",
" ",
"choice",
"s",
" ",
"are",
" ",
"NOT",
" ",
"duplicated",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
"[_",
"key_",
"]_",
"=_",
"remove",
"\\u",
"dup",
"s",
"\\u",
"from",
"\\u",
"list",
"\\u",
"maintain",
"\\u",
"order_",
"(_",
"choices_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"add",
" ",
"order",
"ed",
" ",
"column",
"s",
" ",
"for",
" ",
"gps",
" ",
"fields_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"key_",
"in_",
"self_",
"._",
"gps",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gps",
"\\u",
"xpa",
"ths_",
"=_",
"self_",
"._",
"dd_",
"._",
"get",
"\\u",
"addition",
"al",
"\\u",
"geop",
"oint",
"\\u",
"xpa",
"ths_",
"(_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
"[_",
"key_",
"]_",
"=_",
"[_",
"key_",
"]_",
"+_",
"gps",
"\\u",
"xpa",
"ths_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"record_",
"in_",
"cursor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"split",
" ",
"select",
" ",
"multiple",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"record_",
"=_",
"self_",
"._",
"\\u",
"split",
"\\u",
"select",
"\\u",
"multiple",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"record_",
",_",
"self_",
"._",
"select",
"\\u",
"multiple",
"s_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"BIN",
"ARY",
"\\u",
"SELECT",
"\\u",
"MULTIPLE",
"S_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"check",
" ",
"for",
" ",
"gps",
" ",
"and",
" ",
"split",
" ",
"int",
"o",
" ",
"component",
"s",
" ",
"i",
".",
"e",
".",
" ",
"latitude",
",",
" ",
"longitude",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"alti",
"tude",
",",
" ",
"precision_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"split",
"\\u",
"gps",
"\\u",
"fields_",
"(_",
"record_",
",_",
"self_",
"._",
"gps",
"\\u",
"fields_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"tag",
"\\u",
"edit",
"\\u",
"string_",
"(_",
"record_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flat",
"\\u",
"dict_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"re",
" ",
"index",
" ",
"repeats_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"key_",
",_",
"value_",
"in_",
"record_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"reindex",
"ed_",
"=_",
"self_",
"._",
"\\u",
"reindex",
"_",
"(_",
"key_",
",_",
"value_",
",_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flat",
"\\u",
"dict_",
"._",
"update_",
"(_",
"reindex",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"if",
" ",
"delim",
"etr",
" ",
"is",
" ",
"dif",
"eren",
"t",
",",
" ",
"replace",
" ",
"within",
" ",
"record",
" ",
"as",
" ",
"well_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"!=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"flat",
"\\u",
"dict_",
"=_",
"dict_",
"(_",
"(_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"._",
"join_",
"(_",
"k_",
"._",
"split_",
"(_",
"'/'_",
")_",
")_",
",_",
"v_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"flat",
"\\u",
"dict_",
"._",
"iteritems_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"._",
"append_",
"(_",
"flat",
"\\u",
"dict_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Builder_",
"(_",
"Abstract",
"Data",
"Frame",
"Builder_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"export",
"\\u",
"to_",
"(_",
"self_",
",_",
"file",
"\\u",
"or",
"\\u",
"path_",
",_",
"data\\u",
"frame",
"\\u",
"max",
"\\u",
"size_",
"=_",
"30000_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"math_",
"import_",
"ceil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"get",
" ",
"record",
" ",
"count_",
"\\u\\u\\uNL\\u\\u\\u_",
"record",
"\\u",
"count_",
"=_",
"self_",
"._",
"\\u",
"query",
"\\u",
"mongo_",
"(_",
"query_",
"=_",
"self_",
"._",
"filter",
"\\u",
"query_",
",_",
"count_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
"=_",
"Order",
"ed",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"build",
"\\u",
"order",
"ed",
"\\u",
"columns_",
"(_",
"self_",
"._",
"dd_",
"._",
"survey_",
",_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"panda",
"s",
" ",
"will",
" ",
"only",
" ",
"export",
" ",
"30",
"k",
" ",
"record",
"s",
" ",
"in",
" ",
"a",
" ",
"dataframe",
" ",
"to",
" ",
"a",
" ",
"csv_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"create",
" ",
"multiple",
" ",
"30",
"k",
" ",
"dataframe",
"s",
" ",
"if",
" ",
"require",
"d",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"go",
" ",
"through",
" ",
"all",
" ",
"the",
" ",
"record",
"s",
" ",
"tho",
"ugh",
" ",
"so",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
" ",
"can",
" ",
"figure",
" ",
"out",
" ",
"the",
" ",
"column",
"s",
" ",
"we",
" ",
"need",
" ",
"for",
" ",
"repeats_",
"\\u\\u\\uNL\\u\\u\\u_",
"datas_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"data\\u",
"frames_",
"=_",
"int_",
"(_",
"ceil_",
"(_",
"float_",
"(_",
"record",
"\\u",
"count_",
")_",
"/_",
"float_",
"(_",
"data\\u",
"frame",
"\\u",
"max",
"\\u",
"size_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"num",
"\\u",
"data\\u",
"frames_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cursor_",
"=_",
"self_",
"._",
"\\u",
"query",
"\\u",
"mongo_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"filter",
"\\u",
"query_",
",_",
"start_",
"=_",
"(_",
"i_",
"*_",
"data\\u",
"frame",
"\\u",
"max",
"\\u",
"size_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"limit_",
"=_",
"data\\u",
"frame",
"\\u",
"max",
"\\u",
"size_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"\\u",
"format\\u",
"for",
"\\u",
"dataframe_",
"(_",
"cursor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"datas_",
"._",
"append_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"columns_",
"=_",
"list_",
"(_",
"chain_",
"._",
"from",
"\\u",
"iterable_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"[_",
"xpath_",
"]_",
"if_",
"cols_",
"is_",
"None_",
"else_",
"cols_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"xpath_",
",_",
"cols_",
"in_",
"self_",
"._",
"order",
"ed",
"\\u",
"columns_",
"._",
"iteritems_",
"(_",
")_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"use",
" ",
"a",
" ",
"different",
" ",
"group",
" ",
"delimiter",
" ",
"if",
" ",
"needed_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"!=_",
"DEF",
"AUL",
"T",
"\\u",
"GROU",
"P",
"\\u",
"DELIMITER",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"columns_",
"=_",
"[_",
"self_",
"._",
"group",
"\\u",
"delimiter_",
"._",
"join_",
"(_",
"col_",
"._",
"split_",
"(_",
"\"/\"_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"col_",
"in_",
"columns_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"extra",
" ",
"columns_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"columns_",
"+=_",
"[_",
"col_",
"for_",
"col_",
"in_",
"self_",
"._",
"ADD",
"ITION",
"AL",
"\\u",
"COLUMNS_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"header_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"file",
"\\u",
"or",
"\\u",
"path_",
",_",
"'",
"read",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"csv",
"\\u",
"file_",
"=_",
"file",
"\\u",
"or",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"close_",
"=_",
"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 ",
" _",
"csv",
"\\u",
"file_",
"=_",
"open_",
"(_",
"file",
"\\u",
"or",
"\\u",
"path_",
",_",
"\"",
"wb",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"close_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"data_",
"in_",
"datas_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"writer_",
"=_",
"CSV",
"Data",
"Frame",
"Writer_",
"(_",
"data_",
",_",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"._",
"write",
"\\u",
"to",
"\\u",
"csv_",
"(_",
"csv",
"\\u",
"file_",
",_",
"header_",
"=_",
"header_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"close_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"csv",
"\\u",
"file_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Writer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Writer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"records_",
",_",
"columns_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"dataframe_",
"=_",
"Data",
"Frame_",
"(_",
"records_",
",_",
"columns_",
"=_",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"XL",
"SD",
"ata",
"Frame",
"Writer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"write",
"\\u",
"to",
"\\u",
"excel_",
"(_",
"self_",
",_",
"exce",
"l\\u",
"writer_",
",_",
"sheet",
"\\u",
"name_",
",_",
"header_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"dataframe_",
"._",
"to",
"\\u",
"excel_",
"(_",
"exce",
"l\\u",
"writer_",
",_",
"sheet",
"\\u",
"name_",
",_",
"header_",
"=_",
"header_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"index_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\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_",
"CSV",
"Data",
"Frame",
"Writer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Writer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"records_",
",_",
"columns_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"if",
" ",
"record",
"s",
" ",
"is",
" ",
"empty",
",",
" ",
"raise",
" ",
"a",
" ",
"know",
"n",
" ",
"exception_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"catch",
" ",
"it",
" ",
"in",
" ",
"the",
" ",
"view",
" ",
"and",
" ",
"handle_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"(_",
"len_",
"(_",
"records_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dataframe_",
"=_",
"Data",
"Frame_",
"(_",
"records_",
",_",
"columns_",
"=_",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"remove",
" ",
"column",
"s",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"want_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"col_",
"in_",
"Abstract",
"Data",
"Frame",
"Builder_",
"._",
"IGNORE",
"D",
"\\u",
"COLUMNS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"col_",
"in_",
"self_",
"._",
"dataframe_",
"._",
"columns_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"(_",
"self_",
"._",
"dataframe_",
"[_",
"col_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"CSV",
"Data",
"Frame",
"Writer_",
"(_",
"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_",
"write",
"\\u",
"to",
"\\u",
"csv_",
"(_",
"self_",
",_",
"csv",
"\\u",
"file_",
",_",
"header_",
"=_",
"True_",
",_",
"index_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"na",
"\\u",
"rep_",
"=_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"NA",
"\\u",
"REP",
"'_",
",_",
"NA",
"\\u",
"REP",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dataframe_",
"._",
"to",
"\\u",
"csv_",
"(_",
"csv",
"\\u",
"file_",
",_",
"header_",
"=_",
"header_",
",_",
"index_",
"=_",
"index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"na",
"\\u",
"rep_",
"=_",
"na",
"\\u",
"rep_",
",_",
"encoding_",
"=_",
"'",
"utf",
"-",
"8",
"'_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | seomoz/shovel/test/test_run.py | [
{
"content": " def test_tasks_none_found(self):\n '''Display the correct thing when no tasks are found'''\n actual = self.stdout('test/examples/run/none', 'tasks')\n expected = ['No tasks found!']\n self.assertEqual(actual, expected)",
"metadata": "root.TestRun.test_tasks_none_found",
"header": "['class', 'TestRun', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 109
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Test",
"Run_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"task",
"s",
"\\u",
"none",
"\\u",
"found_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Display",
" ",
"the",
" ",
"correct",
" ",
"thing",
" ",
"whe",
"n",
" ",
"no",
" ",
"task",
"s",
" ",
"are",
" ",
"found",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"=_",
"self_",
"._",
"stdout_",
"(_",
"'",
"test",
"/",
"example",
"s",
"/",
"run",
"/",
"none",
"'_",
",_",
"'",
"task",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"[_",
"'",
"No",
" ",
"task",
"s",
" ",
"found",
"!'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual_",
",_",
"expected_",
")_"
] | [
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
] |
Unused import | saltstack/salt/tests/unit/states/boto_lc_test.py | [
{
"content": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`\n'''\n# Import Python libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing Libs\nfrom salttesting import skipIf, TestCase\nfrom salttesting.mock import (\n NO_MOCK,\n NO_MOCK_REASON,\n MagicMock,\n patch)\n\nfrom salttesting.helpers import ensure_in_syspath\nfrom salt.exceptions import SaltInvocationError\n\nensure_in_syspath('../../')\n\n# Import Salt Libs\nfrom salt.states import boto_lc\n\nboto_lc.__salt__ = {}\nboto_lc.__opts__ = {}\n\n\n\n\nif __name__ == '__main__':\n from integration import run_tests\n run_tests(BotoLcTestCase, needs_daemon=False)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "@skipIf(NO_MOCK, NO_MOCK_REASON)\nclass BotoLcTestCase(TestCase):\n '''\n Test cases for salt.states.boto_lc\n '''\n # 'present' function tests: 1\n\n\n # 'absent' function tests: 1\n",
"metadata": "root.BotoLcTestCase",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": " def test_present(self):\n '''\n Test to ensure the launch configuration exists.\n '''\n name = 'mylc'\n image_id = 'ami-0b9c9f62'\n\n ret = {'name': name,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n self.assertRaises(SaltInvocationError, boto_lc.present, name,\n image_id, user_data=True, cloud_init=True)\n\n mock = MagicMock(side_effect=[True, False])\n with patch.dict(boto_lc.__salt__,\n {'boto_asg.launch_configuration_exists': mock}):\n comt = ('Launch configuration present.')\n ret.update({'comment': comt})\n self.assertDictEqual(boto_lc.present(name, image_id), ret)\n\n with patch.dict(boto_lc.__opts__, {'test': True}):\n comt = ('Launch configuration set to be created.')\n ret.update({'comment': comt, 'result': None})\n self.assertDictEqual(boto_lc.present(name, image_id), ret)",
"metadata": "root.BotoLcTestCase.test_present",
"header": "['class', 'BotoLcTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def test_absent(self):\n '''\n Test to ensure the named launch configuration is deleted.\n '''\n name = 'mylc'\n\n ret = {'name': name,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n mock = MagicMock(side_effect=[False, True])\n with patch.dict(boto_lc.__salt__,\n {'boto_asg.launch_configuration_exists': mock}):\n comt = ('Launch configuration does not exist.')\n ret.update({'comment': comt})\n self.assertDictEqual(boto_lc.absent(name), ret)\n\n with patch.dict(boto_lc.__opts__, {'test': True}):\n comt = ('Launch configuration set to be deleted.')\n ret.update({'comment': comt, 'result': None})\n self.assertDictEqual(boto_lc.absent(name), ret)",
"metadata": "root.BotoLcTestCase.test_absent",
"header": "['class', 'BotoLcTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 63
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"code",
"author",
":",
" ",
":",
"email",
":`",
"Ja",
"ye",
"sh",
" ",
"Kar",
"iy",
"a",
" ",
"<",
"ja",
"ye",
"sh",
"k",
"@",
"salt",
"stack",
".",
"com",
">`",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Import",
" ",
"Pyth",
"on",
" ",
"libs_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Import",
" ",
"Sal",
"t",
" ",
"Test",
"ing",
" ",
"Lib",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"salt",
"testing_",
"import_",
"skip",
"If_",
",_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"salt",
"testing_",
"._",
"mock_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"NO",
"\\u",
"MOC",
"K_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"NO",
"\\u",
"MOC",
"K",
"\\u",
"REASON",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Mag",
"ic",
"Mock_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"patch_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"salt",
"testing_",
"._",
"helpers_",
"import_",
"ensure",
"\\u",
"in",
"\\u",
"sysp",
"ath_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"salt_",
"._",
"exceptions_",
"import_",
"Sal",
"t",
"Invoca",
"tion",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ensure",
"\\u",
"in",
"\\u",
"sysp",
"ath_",
"(_",
"'../../",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Import",
" ",
"Sal",
"t",
" ",
"Lib",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"salt_",
"._",
"states_",
"import_",
"boto",
"\\u",
"lc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"salt\\u\\u_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"opts",
"\\u\\u_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"\\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 ",
" _",
"from_",
"integration_",
"import_",
"run",
"\\u",
"tests_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run",
"\\u",
"tests_",
"(_",
"Bot",
"o",
"Lc",
"Test",
"Case_",
",_",
"need",
"s",
"\\u",
"daemon_",
"=_",
"False_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"skip",
"If_",
"(_",
"NO",
"\\u",
"MOC",
"K_",
",_",
"NO",
"\\u",
"MOC",
"K",
"\\u",
"REASON",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class_",
"Bot",
"o",
"Lc",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"case",
"s",
" ",
"for",
" ",
"salt",
".",
"state",
"s",
".",
"boto",
"\\u",
"lc",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"'",
"presen",
"t",
"'",
" ",
"function",
" ",
"tests",
":",
" ",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"'",
"absen",
"t",
"'",
" ",
"function",
" ",
"tests",
":",
" ",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Bot",
"o",
"Lc",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"present_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"to",
" ",
"ensure",
" ",
"the",
" ",
"launch",
" ",
"configura",
"tion",
" ",
"exist",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"'",
"myl",
"c",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image",
"\\u",
"id_",
"=_",
"'",
"ami",
"-0",
"b9",
"c9",
"f6",
"2",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ret_",
"=_",
"{_",
"'",
"name",
"'_",
":_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"result",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"change",
"s",
"'_",
":_",
"{_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"comment",
"'_",
":_",
"''_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Sal",
"t",
"Invoca",
"tion",
"Error_",
",_",
"boto",
"\\u",
"lc_",
"._",
"present_",
",_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"image",
"\\u",
"id_",
",_",
"user",
"\\u",
"data_",
"=_",
"True_",
",_",
"cloud",
"\\u",
"init_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"=_",
"Mag",
"ic",
"Mock_",
"(_",
"side",
"\\u",
"effect_",
"=_",
"[_",
"True_",
",_",
"False_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"patch_",
"._",
"dict_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"salt\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"boto",
"\\u",
"asg",
".",
"launch",
"\\u",
"configura",
"tion",
"\\u",
"exist",
"s",
"'_",
":_",
"mock_",
"}_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"com",
"t_",
"=_",
"(_",
"'",
"Launch",
" ",
"configura",
"tion",
" ",
"presen",
"t",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"update_",
"(_",
"{_",
"'",
"comment",
"'_",
":_",
"com",
"t_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Dict",
"Equal_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"present_",
"(_",
"name_",
",_",
"image",
"\\u",
"id_",
")_",
",_",
"ret_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"patch_",
"._",
"dict_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"opts",
"\\u\\u_",
",_",
"{_",
"'",
"test",
"'_",
":_",
"True_",
"}_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"com",
"t_",
"=_",
"(_",
"'",
"Launch",
" ",
"configura",
"tion",
" ",
"set",
" ",
"to",
" ",
"be",
" ",
"created",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"update_",
"(_",
"{_",
"'",
"comment",
"'_",
":_",
"com",
"t_",
",_",
"'",
"result",
"'_",
":_",
"None_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Dict",
"Equal_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"present_",
"(_",
"name_",
",_",
"image",
"\\u",
"id_",
")_",
",_",
"ret_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Bot",
"o",
"Lc",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"absen",
"t_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"to",
" ",
"ensure",
" ",
"the",
" ",
"named",
" ",
"launch",
" ",
"configura",
"tion",
" ",
"is",
" ",
"delete",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"'",
"myl",
"c",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ret_",
"=_",
"{_",
"'",
"name",
"'_",
":_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"result",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"change",
"s",
"'_",
":_",
"{_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"comment",
"'_",
":_",
"''_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"=_",
"Mag",
"ic",
"Mock_",
"(_",
"side",
"\\u",
"effect_",
"=_",
"[_",
"False_",
",_",
"True_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"patch_",
"._",
"dict_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"salt\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"boto",
"\\u",
"asg",
".",
"launch",
"\\u",
"configura",
"tion",
"\\u",
"exist",
"s",
"'_",
":_",
"mock_",
"}_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"com",
"t_",
"=_",
"(_",
"'",
"Launch",
" ",
"configura",
"tion",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"update_",
"(_",
"{_",
"'",
"comment",
"'_",
":_",
"com",
"t_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Dict",
"Equal_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"absen",
"t_",
"(_",
"name_",
")_",
",_",
"ret_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"patch_",
"._",
"dict_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"\\u\\u",
"opts",
"\\u\\u_",
",_",
"{_",
"'",
"test",
"'_",
":_",
"True_",
"}_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"com",
"t_",
"=_",
"(_",
"'",
"Launch",
" ",
"configura",
"tion",
" ",
"set",
" ",
"to",
" ",
"be",
" ",
"delete",
"d",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"update_",
"(_",
"{_",
"'",
"comment",
"'_",
":_",
"com",
"t_",
",_",
"'",
"result",
"'_",
":_",
"None_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Dict",
"Equal_",
"(_",
"boto",
"\\u",
"lc_",
"._",
"absen",
"t_",
"(_",
"name_",
")_",
",_",
"ret_",
")_",
"\\u\\u\\uNEWLINE\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | chineking/cola/cola/cluster/master.py | [
{
"content": " def run_job(self, job_name, unzip=False, \n wait_for_workers=False):\n if wait_for_workers:\n while not self.stopped.is_set():\n if len(self.worker_tracker.workers) > 0:\n break\n stopped = self.stopped.wait(3)\n if stopped:\n return\n\n if unzip:\n self._unzip(job_name)\n \n job_path = os.path.join(self.job_dir, job_name)\n job_desc = import_job_desc(job_path)\n job_master = JobMaster(self.ctx, job_name, job_desc, \n self.worker_tracker.workers.keys())\n job_master.init()\n self.job_tracker.register_job(job_name, job_master)\n self._register_runned_job(job_name, job_desc)\n \n zip_file = os.path.join(self.zip_dir, job_name+'.zip')\n for worker in job_master.workers:\n FileTransportClient(worker, zip_file).send_file()\n \n self.logger.debug(\n 'entering the master prepare stage, job id: %s' % job_name)\n self.logger.debug(\n 'job available workers: %s' % job_master.workers)\n stage = Stage(job_master.workers, 'prepare', logger=self.logger)\n prepared_ok = stage.barrier(True, job_name)\n if not prepared_ok:\n self.logger.error(\"prepare for running failed\")\n return\n \n self.logger.debug(\n 'entering the master run_job stage, job id: %s' % job_name)\n stage = Stage(job_master.workers, 'run_job', logger=self.logger)\n run_ok = stage.barrier(True, job_name)\n if not run_ok:\n self.logger.error(\"run job failed, job id: %s\" % job_name)",
"metadata": "root.Master.run_job",
"header": "['class', 'Master', '(', 'object', ')', ':', '___EOS___']",
"index": 266
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Master_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"run",
"\\u",
"job_",
"(_",
"self_",
",_",
"job",
"\\u",
"name_",
",_",
"unzip",
"_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"wait",
"\\u",
"for",
"\\u",
"workers_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"wait",
"\\u",
"for",
"\\u",
"workers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"not_",
"self_",
"._",
"stopped_",
"._",
"is",
"\\u",
"set_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"self_",
"._",
"worker",
"\\u",
"tracker_",
"._",
"workers_",
")_",
">_",
"0_",
":_",
"\\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_",
"stopped_",
"=_",
"self_",
"._",
"stopped_",
"._",
"wait_",
"(_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"stopped_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"unzip",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"unzip",
"_",
"(_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"job",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"self_",
"._",
"job",
"\\u",
"dir_",
",_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"desc_",
"=_",
"import",
"\\u",
"job",
"\\u",
"desc_",
"(_",
"job",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"master_",
"=_",
"Jo",
"b",
"Master_",
"(_",
"self_",
"._",
"ctx_",
",_",
"job",
"\\u",
"name_",
",_",
"job",
"\\u",
"desc_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"worker",
"\\u",
"tracker_",
"._",
"workers_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"master_",
"._",
"init_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"job",
"\\u",
"tracker_",
"._",
"register",
"\\u",
"job_",
"(_",
"job",
"\\u",
"name_",
",_",
"job",
"\\u",
"master_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"register",
"\\u",
"runn",
"ed",
"\\u",
"job_",
"(_",
"job",
"\\u",
"name_",
",_",
"job",
"\\u",
"desc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"zip",
"\\u",
"file_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"self_",
"._",
"zip",
"\\u",
"dir_",
",_",
"job",
"\\u",
"name_",
"+_",
"'.",
"zip",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"worker_",
"in_",
"job",
"\\u",
"master_",
"._",
"workers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"File",
"Transp",
"ort",
"Client_",
"(_",
"worker_",
",_",
"zip",
"\\u",
"file_",
")_",
"._",
"send",
"\\u",
"file_",
"(_",
")_",
"\\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_",
"'",
"entering",
" ",
"the",
" ",
"master",
" ",
"prepar",
"e",
" ",
"stage",
",",
" ",
"job",
" ",
"id",
":",
" ",
"%",
"s",
"'_",
"%_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"job",
" ",
"avail",
"able",
" ",
"worker",
"s",
":",
" ",
"%",
"s",
"'_",
"%_",
"job",
"\\u",
"master_",
"._",
"workers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stage_",
"=_",
"Stage_",
"(_",
"job",
"\\u",
"master_",
"._",
"workers_",
",_",
"'",
"prepar",
"e",
"'_",
",_",
"logger_",
"=_",
"self_",
"._",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prepared",
"\\u",
"ok_",
"=_",
"stage_",
"._",
"barrier",
"_",
"(_",
"True_",
",_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"prepared",
"\\u",
"ok_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"error_",
"(_",
"\"",
"prepar",
"e",
" ",
"for",
" ",
"runn",
"ing",
" ",
"fail",
"ed",
"\"_",
")_",
"\\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_",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"entering",
" ",
"the",
" ",
"master",
" ",
"run",
"\\u",
"job",
" ",
"stage",
",",
" ",
"job",
" ",
"id",
":",
" ",
"%",
"s",
"'_",
"%_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stage_",
"=_",
"Stage_",
"(_",
"job",
"\\u",
"master_",
"._",
"workers_",
",_",
"'",
"run",
"\\u",
"job",
"'_",
",_",
"logger_",
"=_",
"self_",
"._",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run",
"\\u",
"ok_",
"=_",
"stage_",
"._",
"barrier",
"_",
"(_",
"True_",
",_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"run",
"\\u",
"ok_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"error_",
"(_",
"\"",
"run",
" ",
"job",
" ",
"fail",
"ed",
",",
" ",
"job",
" ",
"id",
":",
" ",
"%",
"s",
"\"_",
"%_",
"job",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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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
] |
Unused local variable | graphql-python/graphene/graphene/core/classtypes/tests/test_uniontype.py | [
{
"content": "def test_uniontype():\n class Human(ObjectType):\n name = String()\n\n class Pet(ObjectType):\n name = String()\n\n class Thing(UnionType):\n '''Thing union description'''\n class Meta:\n types = [Human, Pet]\n\n schema = Schema()\n\n object_type = schema.T(Thing)\n assert isinstance(object_type, GraphQLUnionType)\n assert Thing._meta.type_name == 'Thing'\n assert object_type.description == 'Thing union description'\n assert object_type.get_possible_types() == [schema.T(Human), schema.T(Pet)]",
"metadata": "root.test_uniontype",
"header": "['module', '___EOS___']",
"index": 9
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"uni",
"ont",
"ype_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"Huma",
"n_",
"(_",
"Object",
"Type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"String_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Pet",
"_",
"(_",
"Object",
"Type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"String_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Thing_",
"(_",
"Uni",
"on",
"Type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Thin",
"g",
" ",
"uni",
"on",
" ",
"description",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class_",
"Meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"types_",
"=_",
"[_",
"Huma",
"n_",
",_",
"Pet",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"schema_",
"=_",
"Schema_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"object\\u",
"type_",
"=_",
"schema_",
"._",
"T_",
"(_",
"Thing_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"isinstance_",
"(_",
"object\\u",
"type_",
",_",
"Graph",
"QL",
"Uni",
"on",
"Type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"Thing_",
"._",
"\\u",
"meta_",
"._",
"type",
"\\u",
"name_",
"==_",
"'",
"Thin",
"g",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"object\\u",
"type_",
"._",
"description_",
"==_",
"'",
"Thin",
"g",
" ",
"uni",
"on",
" ",
"description",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"object\\u",
"type_",
"._",
"get",
"\\u",
"possib",
"le",
"\\u",
"types_",
"(_",
")_",
"==_",
"[_",
"schema_",
"._",
"T_",
"(_",
"Huma",
"n_",
")_",
",_",
"schema_",
"._",
"T_",
"(_",
"Pet",
"_",
")_",
"]_"
] | [
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
] |
Comparison of constants | nsqio/pynsq/nsq/reader.py | [
{
"content": " def _finish_query_lookupd(self, response, lookupd_url):\n if response.error:\n logger.warning('[%s] lookupd %s query error: %s',\n self.name, lookupd_url, response.error)\n return\n\n try:\n lookup_data = json.loads(response.body)\n except ValueError:\n logger.warning('[%s] lookupd %s failed to parse JSON: %r',\n self.name, lookupd_url, response.body)\n return\n\n if lookup_data['status_code'] != 200:\n logger.warning('[%s] lookupd %s responded with %d',\n self.name, lookupd_url, lookup_data['status_code'])\n return\n\n for producer in lookup_data['data']['producers']:\n # TODO: this can be dropped for 1.0\n address = producer.get('broadcast_address', producer.get('address'))\n assert address\n self.connect_to_nsqd(address, producer['tcp_port'])",
"metadata": "root.Reader._finish_query_lookupd",
"header": "['class', 'Reader', '(', 'Client', ')', ':', '___EOS___']",
"index": 583
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"Reader_",
"(_",
"Client_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"finish",
"\\u",
"query",
"\\u",
"look",
"upd",
"_",
"(_",
"self_",
",_",
"response_",
",_",
"look",
"upd",
"\\u",
"url_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"response_",
"._",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"warning_",
"(_",
"'[",
"%",
"s",
"]",
" ",
"look",
"upd",
" ",
"%",
"s",
" ",
"query",
" ",
"error",
":",
" ",
"%",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
",_",
"look",
"upd",
"\\u",
"url_",
",_",
"response_",
"._",
"error_",
")_",
"\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"look",
"up",
"\\u",
"data_",
"=_",
"json_",
"._",
"loads_",
"(_",
"response_",
"._",
"body_",
")_",
"\\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 ",
" _",
"logger_",
"._",
"warning_",
"(_",
"'[",
"%",
"s",
"]",
" ",
"look",
"upd",
" ",
"%",
"s",
" ",
"fail",
"ed",
" ",
"to",
" ",
"parse",
" ",
"JSO",
"N",
":",
" ",
"%",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
",_",
"look",
"upd",
"\\u",
"url_",
",_",
"response_",
"._",
"body_",
")_",
"\\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_",
"if_",
"look",
"up",
"\\u",
"data_",
"[_",
"'",
"status",
"\\u",
"code",
"'_",
"]_",
"!=_",
"200_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"warning_",
"(_",
"'[",
"%",
"s",
"]",
" ",
"look",
"upd",
" ",
"%",
"s",
" ",
"respond",
"ed",
" ",
"with",
" ",
"%",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
",_",
"look",
"upd",
"\\u",
"url_",
",_",
"look",
"up",
"\\u",
"data_",
"[_",
"'",
"status",
"\\u",
"code",
"'_",
"]_",
")_",
"\\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_",
"for_",
"producer_",
"in_",
"look",
"up",
"\\u",
"data_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"'",
"producer",
"s",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"this",
" ",
"can",
" ",
"be",
" ",
"dropped",
" ",
"for",
" ",
"1.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"address_",
"=_",
"producer_",
"._",
"get_",
"(_",
"'",
"broadcast",
"\\u",
"address",
"'_",
",_",
"producer_",
"._",
"get_",
"(_",
"'",
"address",
"'_",
")_",
")_",
"\\u\\u\\uNEW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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | racker/python-raxcli/raxcli/apps/registry/commands/account/rate-limits.py | [
{
"content": "# Copyright 2013 Rackspace\n#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\n\nfrom raxcli.apps.registry.utils import BaseRegistryListCommand\nfrom raxcli.apps.registry.utils import get_client\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class RateLimitsCommand(BaseRegistryListCommand):\n \"\"\"\n Return account rate limits\n \"\"\"\n log = logging.getLogger(__name__)\n",
"metadata": "root.RateLimitsCommand",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": " def take_action(self, parsed_args):\n client = get_client(parsed_args)\n value = client.account.get_limits()\n\n rate_tuples = [(k,\n value['rate'][k]['window'],\n value['rate'][k]['used'],\n value['rate'][k]['limit'])\n for k in value['rate'].keys()]\n\n return (('Rate', 'Window', 'Used', 'Limit'),\n rate_tuples)",
"metadata": "root.RateLimitsCommand.take_action",
"header": "['class', 'RateLimitsCommand', '(', 'BaseRegistryListCommand', ')', ':', '___EOS___']",
"index": 29
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2013",
" ",
"Rack",
"space_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"to",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"Sof",
"twa",
"re",
" ",
"Foun",
"dati",
"on",
" ",
"(",
"AS",
"F",
")",
" ",
"under",
" ",
"one",
" ",
"or",
" ",
"more_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contributor",
" ",
"license",
" ",
"agreement",
"s",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"NOTICE",
" ",
"file",
" ",
"distributed",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"work",
" ",
"for",
" ",
"addition",
"al",
" ",
"informati",
"on",
" ",
"regarding",
" ",
"copyr",
"ight",
" ",
"owner",
"ship",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"AS",
"F",
" ",
"license",
"s",
" ",
"this",
" ",
"file",
" ",
"to",
" ",
"You",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"License",
".",
" ",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"rax",
"cli_",
"._",
"apps_",
"._",
"registry_",
"._",
"utils_",
"import_",
"Base",
"Regi",
"stry",
"List",
"Command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rax",
"cli_",
"._",
"apps_",
"._",
"registry_",
"._",
"utils_",
"import_",
"get",
"\\u",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Rat",
"e",
"Limit",
"s",
"Command_",
"(_",
"Base",
"Regi",
"stry",
"List",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"account",
" ",
"rate",
" ",
"limit",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Rat",
"e",
"Limit",
"s",
"Command_",
"(_",
"Base",
"Regi",
"stry",
"List",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"take",
"\\u",
"action_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"get",
"\\u",
"client_",
"(_",
"parsed",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"client_",
"._",
"account_",
"._",
"get",
"\\u",
"limits_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rate",
"\\u",
"tuples_",
"=_",
"[_",
"(_",
"k_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"[_",
"'",
"rate",
"'_",
"]_",
"[_",
"k_",
"]_",
"[_",
"'",
"window",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"[_",
"'",
"rate",
"'_",
"]_",
"[_",
"k_",
"]_",
"[_",
"'",
"used",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"[_",
"'",
"rate",
"'_",
"]_",
"[_",
"k_",
"]_",
"[_",
"'",
"limit",
"'_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
"in_",
"value_",
"[_",
"'",
"rate",
"'_",
"]_",
"._",
"keys_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"(_",
"(_",
"'",
"Rat",
"e",
"'_",
",_",
"'",
"Window",
"'_",
",_",
"'",
"Us",
"ed",
"'_",
",_",
"'",
"Limit",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"rate",
"\\u",
"tuples_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | openstack/freezer-web-ui/disaster_recovery/api/api.py | [
{
"content": " def jobs(self, session_id):\n session = self.get(session_id, json=True)\n jobs = []\n\n if session is None:\n return jobs\n\n try:\n jobs = [utils.JobsInSessionObject(k,\n session_id,\n v['client_id'],\n v['result'])\n for k, v in session['jobs'].iteritems()]\n except AttributeError as error:\n LOG.error(error.message)\n return jobs",
"metadata": "root.Session.jobs",
"header": "['class', 'Session', '(', 'object', ')', ':', '___EOS___']",
"index": 319
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Session_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"jobs_",
"(_",
"self_",
",_",
"session",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"session_",
"=_",
"self_",
"._",
"get_",
"(_",
"session",
"\\u",
"id_",
",_",
"json_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"jobs_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"session_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"jobs_",
"\\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 ",
" _",
"jobs_",
"=_",
"[_",
"utils_",
"._",
"Jo",
"bs",
"In",
"Sess",
"ion",
"Object_",
"(_",
"k_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"session",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"'",
"client",
"\\u",
"id",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
"[_",
"'",
"result",
"'_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"session_",
"[_",
"'",
"jobs",
"'_",
"]_",
"._",
"iteritems_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
"as_",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"LOG_",
"._",
"error_",
"(_",
"error_",
"._",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"jobs_",
"\\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
] |
Unused import | SublimeGit/SublimeGit/sgit/sublimegit.py | [
{
"content": "# coding: utf-8\nimport sys\nimport logging\nimport webbrowser\n\nimport sublime\nfrom sublime_plugin import WindowCommand\n\nfrom . import __version__\n\n\nlogger = logging.getLogger('SublimeGit.sublimegit')\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class SublimeGitVersionCommand(WindowCommand):\n \"\"\"\n Show the currently installed version of SublimeGit.\n \"\"\"\n",
"metadata": "root.SublimeGitVersionCommand",
"header": "['module', '___EOS___']",
"index": 14
},
{
"content": " def run(self):\n sublime.message_dialog(\"You have SublimeGit %s\" % __version__)",
"metadata": "root.SublimeGitVersionCommand.run",
"header": "['class', 'SublimeGitVersionCommand', '(', 'WindowCommand', ')', ':', '___EOS___']",
"index": 19
},
{
"content": "class SublimeGitDocumentationCommand(WindowCommand):\n \"\"\"\n Open a webbrowser to the online SublimeGit documentation.\n \"\"\"\n\n URL = \"https://docs.sublimegit.net/?utm_source=st%s&utm_medium=command&utm_campaign=docs\"\n",
"metadata": "root.SublimeGitDocumentationCommand",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": " def run(self):\n url = self.URL % sys.version_info[0]\n webbrowser.open(url)",
"metadata": "root.SublimeGitDocumentationCommand.run",
"header": "['class', 'SublimeGitDocumentationCommand', '(', 'WindowCommand', ')', ':', '___EOS___']",
"index": 30
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"webbrowser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sublime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sublim",
"e\\u",
"plugin_",
"import_",
"Window",
"Command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"import_",
"\\u\\u",
"version\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"'",
"Sub",
"lim",
"e",
"Git",
".",
"sublim",
"egi",
"t",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Sub",
"lim",
"e",
"Git",
"Version",
"Command_",
"(_",
"Window",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Show",
" ",
"the",
" ",
"currentl",
"y",
" ",
"install",
"ed",
" ",
"version",
" ",
"of",
" ",
"Sub",
"lim",
"e",
"Git",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Sub",
"lim",
"e",
"Git",
"Version",
"Command_",
"(_",
"Window",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sublime_",
"._",
"message",
"\\u",
"dialog_",
"(_",
"\"",
"You",
" ",
"have",
" ",
"Sub",
"lim",
"e",
"Git",
" ",
"%",
"s",
"\"_",
"%_",
"\\u\\u",
"version\\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_",
"Sub",
"lim",
"e",
"Git",
"Document",
"ation",
"Command_",
"(_",
"Window",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Open",
" ",
"a",
" ",
"web",
"browse",
"r",
" ",
"to",
" ",
"the",
" ",
"onli",
"ne",
" ",
"Sub",
"lim",
"e",
"Git",
" ",
"documentation",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"URL_",
"=_",
"\"",
"https",
"://",
"docs",
".",
"sublim",
"egi",
"t",
".",
"net",
"/?",
"utm",
"\\u",
"source",
"=",
"st",
"%",
"s",
"&",
"utm",
"\\u",
"medium",
"=",
"command",
"&",
"utm",
"\\u",
"camp",
"aig",
"n",
"=",
"docs",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Sub",
"lim",
"e",
"Git",
"Document",
"ation",
"Command_",
"(_",
"Window",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
"=_",
"self_",
"._",
"URL_",
"%_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"webbrowser_",
"._",
"open_",
"(_",
"url_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Signature mismatch in overriding method | google/grr/grr/lib/rdfvalue.py | [
{
"content": "class RDFValue(object):\n \"\"\"Baseclass for values.\n\n RDFValues are serialized to and from the data store.\n \"\"\"\n __metaclass__ = RDFValueMetaclass\n\n # This is how the attribute will be serialized to the data store. It must\n # indicate both the type emitted by SerializeToDataStore() and expected by\n # ParseFromDataStore()\n data_store_type = \"bytes\"\n\n # URL pointing to a help page about this value type.\n context_help_url = None\n\n _age = 0\n\n # Mark as dirty each time we modify this object.\n dirty = False\n\n # If this value was created as part of an AFF4 attribute, the attribute is\n # assigned here.\n attribute_instance = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # The operators this type supports in the query language\n operators = dict(contains=(1, \"ContainsMatch\"))",
"metadata": "root.RDFValue",
"header": "['module', '___EOS___']",
"index": 71
},
{
"content": " def __init__(self, initializer=None, age=None):\n \"\"\"Constructor must be able to take no args.\n\n Args:\n initializer: Optional parameter to construct from.\n age: The age of this entry as an RDFDatetime. If not provided, create a\n new instance.\n\n Raises:\n InitializeError: if we can not be initialized from this parameter.\n \"\"\"\n # Default timestamp is now.\n if age is None:\n age = RDFDatetime(age=0)\n\n self._age = age\n\n # Allow an RDFValue to be initialized from an identical RDFValue.\n if initializer.__class__ == self.__class__:\n self.ParseFromString(initializer.SerializeToString())\n\n elif initializer is not None:\n self.ParseFromString(initializer)",
"metadata": "root.RDFValue.__init__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 95
},
{
"content": " def Copy(self):\n \"\"\"Make a new copy of this RDFValue.\"\"\"\n return self.__class__(initializer=self.SerializeToString())",
"metadata": "root.RDFValue.Copy",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 119
},
{
"content": " def __copy__(self):\n return self.Copy()",
"metadata": "root.RDFValue.__copy__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 123
},
{
"content": " @property\n def age(self):\n if self._age.__class__ is not RDFDatetime:\n self._age = RDFDatetime(self._age, age=0)\n\n return self._age",
"metadata": "root.RDFValue.age",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 126
},
{
"content": " @age.setter\n def age(self, value):\n \"\"\"When assigning to this attribute it must be an RDFDatetime.\"\"\"\n self._age = RDFDatetime(value, age=0)",
"metadata": "root.RDFValue.age",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 133
},
{
"content": " def ParseFromDataStore(self, data_store_obj):\n \"\"\"Serialize from an object read from the datastore.\"\"\"\n return self.ParseFromString(data_store_obj)",
"metadata": "root.RDFValue.ParseFromDataStore",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 138
},
{
"content": " @abc.abstractmethod\n def ParseFromString(self, string):\n \"\"\"Given a string, parse ourselves from it.\"\"\"\n pass",
"metadata": "root.RDFValue.ParseFromString",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 142
},
{
"content": " def SerializeToDataStore(self):\n \"\"\"Serialize to a datastore compatible form.\"\"\"\n return self.SerializeToString()",
"metadata": "root.RDFValue.SerializeToDataStore",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 147
},
{
"content": " @abc.abstractmethod\n def SerializeToString(self):\n \"\"\"Serialize into a string which can be parsed using ParseFromString.\"\"\"",
"metadata": "root.RDFValue.SerializeToString",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 151
},
{
"content": " def __getstate__(self):\n \"\"\"Support the pickle protocol.\"\"\"\n # __pickled_rdfvalue is used to mark RDFValues pickled via the new way.\n return dict(__pickled_rdfvalue=True,\n age=int(self.age),\n data=self.SerializeToString())",
"metadata": "root.RDFValue.__getstate__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 155
},
{
"content": " def __setstate__(self, data):\n \"\"\"Support the pickle protocol.\"\"\"\n if \"__pickled_rdfvalue\" in data:\n self.ParseFromString(data[\"data\"])\n self.age = RDFDatetime(data[\"age\"])\n else:\n self.__dict__ = data",
"metadata": "root.RDFValue.__setstate__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 162
},
{
"content": " def AsProto(self):\n \"\"\"Serialize into an RDFValue protobuf.\"\"\"\n return jobs_pb2.EmbeddedRDFValue(age=int(self.age),\n name=self.__class__.__name__,\n data=self.SerializeToString())",
"metadata": "root.RDFValue.AsProto",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 170
},
{
"content": " def __iter__(self):\n \"\"\"This allows every RDFValue to be iterated over.\"\"\"\n yield self",
"metadata": "root.RDFValue.__iter__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 176
},
{
"content": " def __hash__(self):\n return hash(self.SerializeToString())",
"metadata": "root.RDFValue.__hash__",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 180
},
{
"content": " def Summary(self):\n \"\"\"Return a summary representation of the object.\"\"\"\n return str(self)",
"metadata": "root.RDFValue.Summary",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 183
},
{
"content": " @classmethod\n def Fields(cls):\n \"\"\"Return a list of fields which can be queried from this value.\"\"\"\n return []",
"metadata": "root.RDFValue.Fields",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 187
},
{
"content": " @staticmethod\n def ContainsMatch(attribute, filter_implemention, regex):\n return filter_implemention.PredicateContainsFilter(attribute, regex)",
"metadata": "root.RDFValue.ContainsMatch",
"header": "['class', 'RDFValue', '(', 'object', ')', ':', '___EOS___']",
"index": 192
},
{
"content": "class RDFBytes(RDFValue):\n \"\"\"An attribute which holds bytes.\"\"\"\n data_store_type = \"bytes\"\n\n _value = \"\"\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.RDFBytes",
"header": "['module', '___EOS___']",
"index": 200
},
{
"content": " def ParseFromString(self, string):\n # TODO(user): this needs some more test coverage, particularly around\n # submitting unicode strings and byte literals in the UI forms.\n if isinstance(string, unicode):\n self._value = utils.SmartStr(string)\n else:\n self._value = string",
"metadata": "root.RDFBytes.ParseFromString",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 206
},
{
"content": " def SerializeToString(self):\n return self._value",
"metadata": "root.RDFBytes.SerializeToString",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 214
},
{
"content": " def __str__(self):\n return utils.SmartStr(self._value)",
"metadata": "root.RDFBytes.__str__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 217
},
{
"content": " def __lt__(self, other):\n if isinstance(other, self.__class__):\n return self._value < other._value # pylint: disable=protected-access\n else:\n return self._value < other",
"metadata": "root.RDFBytes.__lt__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 220
},
{
"content": " def __gt__(self, other):\n if isinstance(other, self.__class__):\n return self._value > other._value # pylint: disable=protected-access\n else:\n return self._value > other",
"metadata": "root.RDFBytes.__gt__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 226
},
{
"content": " def __eq__(self, other):\n if isinstance(other, self.__class__):\n return self._value == other._value # pylint: disable=protected-access\n else:\n return self._value == other",
"metadata": "root.RDFBytes.__eq__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 232
},
{
"content": " def __ne__(self, other):\n return not self.__eq__(other)",
"metadata": "root.RDFBytes.__ne__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 238
},
{
"content": " def __hash__(self):\n return hash(self._value)",
"metadata": "root.RDFBytes.__hash__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 241
},
{
"content": " def __bool__(self):\n return bool(self._value)",
"metadata": "root.RDFBytes.__bool__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 244
},
{
"content": " def __nonzero__(self):\n return bool(self._value)",
"metadata": "root.RDFBytes.__nonzero__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 247
},
{
"content": " def __len__(self):\n return len(self._value)",
"metadata": "root.RDFBytes.__len__",
"header": "['class', 'RDFBytes', '(', 'RDFValue', ')', ':', '___EOS___']",
"index": 250
},
{
"content": "class RDFString(RDFBytes):\n \"\"\"Represent a simple string.\"\"\"\n\n data_store_type = \"string\"\n\n _value = u\"\"\n\n\n operators = RDFValue.operators.copy()\n operators[\"matches\"] = (1, \"ContainsMatch\")\n operators[\"=\"] = (1, \"ContainsMatch\")\n operators[\"startswith\"] = (1, \"Startswith\")\n\n\n\n\n\n\n",
"metadata": "root.RDFString",
"header": "['module', '___EOS___']",
"index": 264
},
{
"content": " @staticmethod\n def Startswith(attribute, filter_implemention, string):\n return filter_implemention.PredicateContainsFilter(\n attribute, \"^\" + utils.EscapeRegex(string))",
"metadata": "root.RDFString.Startswith",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 271
},
{
"content": " def format(self, *args, **kwargs): # pylint: disable=invalid-name\n return self._value.format(*args, **kwargs)",
"metadata": "root.RDFString.format",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 281
},
{
"content": " def split(self, *args, **kwargs): # pylint: disable=invalid-name\n return self._value.split(*args, **kwargs)",
"metadata": "root.RDFString.split",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 284
},
{
"content": " def __unicode__(self):\n return utils.SmartUnicode(self._value)",
"metadata": "root.RDFString.__unicode__",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 287
},
{
"content": " def __getitem__(self, value):\n return self._value.__getitem__(value)",
"metadata": "root.RDFString.__getitem__",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 290
},
{
"content": " def ParseFromString(self, string):\n # This handles the cases when we're initialized from Unicode strings.\n self._value = utils.SmartStr(string)",
"metadata": "root.RDFString.ParseFromString",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 293
},
{
"content": " def SerializeToString(self):\n return utils.SmartStr(self._value)",
"metadata": "root.RDFString.SerializeToString",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 297
},
{
"content": " def SerializeToDataStore(self):\n return utils.SmartUnicode(self._value)",
"metadata": "root.RDFString.SerializeToDataStore",
"header": "['class', 'RDFString', '(', 'RDFBytes', ')', ':', '___EOS___']",
"index": 300
},
{
"content": "@functools.total_ordering\nclass RDFInteger(RDFString):\n \"\"\"Represent an integer.\"\"\"\n\n data_store_type = \"integer\"\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 operators = {\"<\": (1, \"LessThan\"),\n \">\": (1, \"GreaterThan\"),\n \"=\": (1, \"Equal\")}",
"metadata": "root.RDFInteger",
"header": "['module', '___EOS___']",
"index": 320
},
{
"content": " @staticmethod\n def IsNumeric(value):\n return isinstance(value, (int, long, float, RDFInteger))",
"metadata": "root.RDFInteger.IsNumeric",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 326
},
{
"content": " def __init__(self, initializer=None, age=None):\n super(RDFInteger, self).__init__(initializer=initializer, age=age)\n if initializer is None:\n self._value = 0\n else:\n self.ParseFromString(initializer)",
"metadata": "root.RDFInteger.__init__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 330
},
{
"content": " def ParseFromString(self, string):\n self._value = 0\n if string:\n try:\n self._value = int(string)\n except TypeError as e:\n raise DecodeError(e)",
"metadata": "root.RDFInteger.ParseFromString",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 337
},
{
"content": " def SerializeToDataStore(self):\n \"\"\"Use varint to store the integer.\"\"\"\n return int(self._value)",
"metadata": "root.RDFInteger.SerializeToDataStore",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 345
},
{
"content": " def Set(self, value):\n if isinstance(value, (long, int)):\n self._value = value\n else:\n self.ParseFromString(value)",
"metadata": "root.RDFInteger.Set",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 349
},
{
"content": " def __long__(self):\n return long(self._value)",
"metadata": "root.RDFInteger.__long__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 355
},
{
"content": " def __int__(self):\n return int(self._value)",
"metadata": "root.RDFInteger.__int__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 358
},
{
"content": " def __float__(self):\n return float(self._value)",
"metadata": "root.RDFInteger.__float__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 361
},
{
"content": " def __index__(self):\n return self._value",
"metadata": "root.RDFInteger.__index__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 364
},
{
"content": " def __eq__(self, other):\n return self._value == other",
"metadata": "root.RDFInteger.__eq__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 367
},
{
"content": " def __lt__(self, other):\n return self._value < other",
"metadata": "root.RDFInteger.__lt__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 370
},
{
"content": " def __and__(self, other):\n return self._value & other",
"metadata": "root.RDFInteger.__and__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 373
},
{
"content": " def __rand__(self, other):\n return self._value & other",
"metadata": "root.RDFInteger.__rand__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 376
},
{
"content": " def __iand__(self, other):\n self._value &= other\n return self",
"metadata": "root.RDFInteger.__iand__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 379
},
{
"content": " def __or__(self, other):\n return self._value | other",
"metadata": "root.RDFInteger.__or__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 383
},
{
"content": " def __ror__(self, other):\n return self._value | other",
"metadata": "root.RDFInteger.__ror__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 386
},
{
"content": " def __ior__(self, other):\n self._value |= other\n return self",
"metadata": "root.RDFInteger.__ior__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 389
},
{
"content": " def __add__(self, other):\n return self._value + other",
"metadata": "root.RDFInteger.__add__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 393
},
{
"content": " def __radd__(self, other):\n return self._value + other",
"metadata": "root.RDFInteger.__radd__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 396
},
{
"content": " def __iadd__(self, other):\n self._value += other\n return self",
"metadata": "root.RDFInteger.__iadd__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 399
},
{
"content": " def __sub__(self, other):\n return self._value - other",
"metadata": "root.RDFInteger.__sub__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 403
},
{
"content": " def __rsub__(self, other):\n return other - self._value",
"metadata": "root.RDFInteger.__rsub__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 406
},
{
"content": " def __isub__(self, other):\n self._value -= other\n return self",
"metadata": "root.RDFInteger.__isub__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 409
},
{
"content": " def __mul__(self, other):\n return self._value * other",
"metadata": "root.RDFInteger.__mul__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 413
},
{
"content": " def __rmul__(self, other):\n return self._value * other",
"metadata": "root.RDFInteger.__rmul__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 416
},
{
"content": " def __div__(self, other):\n return self._value / other",
"metadata": "root.RDFInteger.__div__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 419
},
{
"content": " def __rdiv__(self, other):\n return other / self._value",
"metadata": "root.RDFInteger.__rdiv__",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 422
},
{
"content": " @staticmethod\n def LessThan(attribute, filter_implemention, value):\n return filter_implemention.PredicateLessThanFilter(attribute, long(value))",
"metadata": "root.RDFInteger.LessThan",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 425
},
{
"content": " @staticmethod\n def GreaterThan(attribute, filter_implemention, value):\n return filter_implemention.PredicateGreaterThanFilter(\n attribute, long(value))",
"metadata": "root.RDFInteger.GreaterThan",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 429
},
{
"content": " @staticmethod\n def Equal(attribute, filter_implemention, value):\n return filter_implemention.PredicateNumericEqualFilter(\n attribute, long(value))",
"metadata": "root.RDFInteger.Equal",
"header": "['class', 'RDFInteger', '(', 'RDFString', ')', ':', '___EOS___']",
"index": 434
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Signature_",
"mismatch_",
"in_",
"overrid",
"ing_",
"method_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Base",
"class",
" ",
"for",
" ",
"values",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"RDF",
"Value",
"s",
" ",
"are",
" ",
"serialize",
"d",
" ",
"to",
" ",
"and",
" ",
"from",
" ",
"the",
" ",
"data",
" ",
"store",
".",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u",
"metaclass\\u\\u_",
"=_",
"RDF",
"Value",
"Meta",
"class_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"how",
" ",
"the",
" ",
"attribute",
" ",
"will",
" ",
"be",
" ",
"serialize",
"d",
" ",
"to",
" ",
"the",
" ",
"data",
" ",
"store",
".",
" ",
"It",
" ",
"must",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"indicat",
"e",
" ",
"bot",
"h",
" ",
"the",
" ",
"type",
" ",
"emitte",
"d",
" ",
"by",
" ",
"Seriali",
"ze",
"To",
"Data",
"Stor",
"e",
"()",
" ",
"and",
" ",
"expected",
" ",
"by_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pars",
"e",
"Fro",
"m",
"Data",
"Stor",
"e",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"data\\u",
"store",
"\\u",
"type_",
"=_",
"\"",
"bytes",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"URL",
" ",
"pointi",
"ng",
" ",
"to",
" ",
"a",
" ",
"help",
" ",
"page",
" ",
"abo",
"ut",
" ",
"this",
" ",
"value",
" ",
"type",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"context",
"\\u",
"help",
"\\u",
"url_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"age_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Mark",
" ",
"as",
" ",
"dir",
"ty",
" ",
"each",
" ",
"time",
" ",
"we",
" ",
"modif",
"y",
" ",
"this",
" ",
"object",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"dirty_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"this",
" ",
"value",
" ",
"was",
" ",
"created",
" ",
"as",
" ",
"part",
" ",
"of",
" ",
"an",
" ",
"AFF",
"4",
" ",
"attribute",
",",
" ",
"the",
" ",
"attribute",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"assign",
"ed",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"attribute",
"\\u",
"instance_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"opera",
"tors",
" ",
"this",
" ",
"type",
" ",
"support",
"s",
" ",
"in",
" ",
"the",
" ",
"query",
" ",
"language_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"operators_",
"=_",
"dict_",
"(_",
"contains_",
"=_",
"(_",
"1_",
",_",
"\"",
"Contain",
"s",
"Match",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"initializer_",
"=_",
"None_",
",_",
"age_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Constructor",
" ",
"must",
" ",
"be",
" ",
"able",
" ",
"to",
" ",
"take",
" ",
"no",
" ",
"args",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"initializer",
":",
" ",
"Optio",
"nal",
" ",
"parameter",
" ",
"to",
" ",
"construct",
" ",
"from",
".",
"\\",
"10",
";",
" ",
" ",
"age",
":",
" ",
"The",
" ",
"age",
" ",
"of",
" ",
"this",
" ",
"entry",
" ",
"as",
" ",
"an",
" ",
"RDF",
"Date",
"time",
".",
" ",
"If",
" ",
"not",
" ",
"provided",
",",
" ",
"create",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
"new",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Rai",
"ses",
":",
"\\",
"10",
";",
" ",
" ",
"Initializ",
"e",
"Error",
":",
" ",
"if",
" ",
"we",
" ",
"can",
" ",
"not",
" ",
"be",
" ",
"initialize",
"d",
" ",
"from",
" ",
"this",
" ",
"parameter",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Default",
" ",
"timestamp",
" ",
"is",
" ",
"now",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"age_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"age_",
"=_",
"RDF",
"Datetime_",
"(_",
"age_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"age_",
"=_",
"age_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
"ow",
" ",
"an",
" ",
"RDF",
"Value",
" ",
"to",
" ",
"be",
" ",
"initialize",
"d",
" ",
"from",
" ",
"an",
" ",
"identi",
"cal",
" ",
"RDF",
"Value",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"initializer_",
"._",
"\\u\\u",
"class\\u\\u_",
"==_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"initializer_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"initializer_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"initializer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"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_",
"Copy_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Make",
" ",
"a",
" ",
"new",
" ",
"copy",
" ",
"of",
" ",
"this",
" ",
"RDF",
"Value",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"(_",
"initializer_",
"=_",
"self_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"copy",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"Copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"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_",
"age_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"\\u",
"age_",
"._",
"\\u\\u",
"class\\u\\u_",
"is_",
"not_",
"RDF",
"Datetime_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"age_",
"=_",
"RDF",
"Datetime_",
"(_",
"self_",
"._",
"\\u",
"age_",
",_",
"age_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"age_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"age_",
"._",
"setter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"age_",
"(_",
"self_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Whe",
"n",
" ",
"assign",
"ing",
" ",
"to",
" ",
"this",
" ",
"attribute",
" ",
"it",
" ",
"must",
" ",
"be",
" ",
"an",
" ",
"RDF",
"Date",
"time",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"age_",
"=_",
"RDF",
"Datetime_",
"(_",
"value_",
",_",
"age_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Pars",
"e",
"Fro",
"m",
"Data",
"Store_",
"(_",
"self_",
",_",
"data\\u",
"store",
"\\u",
"obj_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Seriali",
"ze",
" ",
"from",
" ",
"an",
" ",
"object",
" ",
"read",
" ",
"from",
" ",
"the",
" ",
"datast",
"ore",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"data\\u",
"store",
"\\u",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"abc_",
"._",
"abstractmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"self_",
",_",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Give",
"n",
" ",
"a",
" ",
"string",
",",
" ",
"parse",
" ",
"ours",
"elv",
"es",
" ",
"from",
" ",
"it",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Seriali",
"ze",
"To",
"Data",
"Store_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Seriali",
"ze",
" ",
"to",
" ",
"a",
" ",
"datast",
"ore",
" ",
"compatible",
" ",
"form",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"abc_",
"._",
"abstractmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"Seriali",
"ze",
"To",
"String_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Seriali",
"ze",
" ",
"int",
"o",
" ",
"a",
" ",
"string",
" ",
"whi",
"ch",
" ",
"can",
" ",
"be",
" ",
"parsed",
" ",
"usi",
"ng",
" ",
"Pars",
"e",
"Fro",
"m",
"String",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Supp",
"ort",
" ",
"the",
" ",
"pickle",
" ",
"protoc",
"ol",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"\\u\\u",
"pickled",
"\\u",
"rdf",
"value",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"mark",
" ",
"RDF",
"Value",
"s",
" ",
"pickled",
" ",
"via",
" ",
"the",
" ",
"new",
" ",
"way",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"dict_",
"(_",
"\\u\\u",
"pickled",
"\\u",
"rdfvalue_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"age_",
"=_",
"int_",
"(_",
"self_",
"._",
"age_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"setstate",
"\\u\\u_",
"(_",
"self_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Supp",
"ort",
" ",
"the",
" ",
"pickle",
" ",
"protoc",
"ol",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"\\u\\u",
"pickled",
"\\u",
"rdf",
"value",
"\"_",
"in_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"data_",
"[_",
"\"",
"data",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"age_",
"=_",
"RDF",
"Datetime_",
"(_",
"data_",
"[_",
"\"",
"age",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"=_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"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_",
"As",
"Proto_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Seriali",
"ze",
" ",
"int",
"o",
" ",
"an",
" ",
"RDF",
"Value",
" ",
"proto",
"buf",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"jobs",
"\\u",
"pb2_",
"._",
"Emb",
"edd",
"ed",
"RDF",
"Value_",
"(_",
"age_",
"=_",
"int_",
"(_",
"self_",
"._",
"age_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"iter\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Thi",
"s",
" ",
"allow",
"s",
" ",
"every",
" ",
"RDF",
"Value",
" ",
"to",
" ",
"be",
" ",
"iterate",
"d",
" ",
"over",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"hash\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"hash_",
"(_",
"self_",
"._",
"Seriali",
"ze",
"To",
"String_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Summary_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
" ",
"a",
" ",
"summar",
"y",
" ",
"represent",
"ation",
" ",
"of",
" ",
"the",
" ",
"object",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"str_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"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_",
"Fields_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"fields",
" ",
"whi",
"ch",
" ",
"can",
" ",
"be",
" ",
"queried",
" ",
"from",
" ",
"this",
" ",
"value",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Value_",
"(_",
"object_",
")_",
":_",
"\\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_",
"Contain",
"s",
"Match_",
"(_",
"attribute_",
",_",
"filter",
"\\u",
"implement",
"ion_",
",_",
"regex_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter",
"\\u",
"implement",
"ion_",
"._",
"Predicate",
"Contain",
"s",
"Filter_",
"(_",
"attribute_",
",_",
"regex_",
")_",
"\\u\\u\\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_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"An",
" ",
"attribute",
" ",
"whi",
"ch",
" ",
"hold",
"s",
" ",
"bytes",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"store",
"\\u",
"type_",
"=_",
"\"",
"bytes",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"value_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"self_",
",_",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
"(",
"user",
"):",
" ",
"this",
" ",
"need",
"s",
" ",
"some",
" ",
"more",
" ",
"test",
" ",
"covera",
"ge",
",",
" ",
"partic",
"ular",
"ly",
" ",
"around_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"submit",
"ting",
" ",
"unicode",
" ",
"string",
"s",
" ",
"and",
" ",
"byte",
" ",
"literal",
"s",
" ",
"in",
" ",
"the",
" ",
"UI",
" ",
"forms",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"string_",
",_",
"unicode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"utils_",
"._",
"Sma",
"rt",
"Str_",
"(_",
"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 ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\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_",
"Seriali",
"ze",
"To",
"String_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\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_",
"utils_",
"._",
"Sma",
"rt",
"Str_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"lt\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"other_",
",_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"<_",
"other_",
"._",
"\\u",
"value_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"protect",
"ed",
"-",
"access_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"<_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\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",
"gt",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"other_",
",_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
">_",
"other_",
"._",
"\\u",
"value_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"protect",
"ed",
"-",
"access_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
">_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\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",
"eq\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"other_",
",_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"==_",
"other_",
"._",
"\\u",
"value_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"protect",
"ed",
"-",
"access_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"==_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\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",
"ne\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"not_",
"self_",
"._",
"\\u\\u",
"eq\\u\\u_",
"(_",
"other_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"hash\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"hash_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"bool\\u",
"\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"bool_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"nonzero\\u",
"\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"bool_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Bytes_",
"(_",
"RDF",
"Value_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"len\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"len_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Represent",
" ",
"a",
" ",
"simple",
" ",
"string",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data\\u",
"store",
"\\u",
"type_",
"=_",
"\"",
"string",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\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\\uDEDENT\\u\\u\\u_",
"operators_",
"=_",
"RDF",
"Value_",
"._",
"operators_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"operators_",
"[_",
"\"",
"matche",
"s",
"\"_",
"]_",
"=_",
"(_",
"1_",
",_",
"\"",
"Contain",
"s",
"Match",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"operators_",
"[_",
"\"=\"_",
"]_",
"=_",
"(_",
"1_",
",_",
"\"",
"Contain",
"s",
"Match",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"operators_",
"[_",
"\"",
"startswith",
"\"_",
"]_",
"=_",
"(_",
"1_",
",_",
"\"",
"Start",
"swi",
"th",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"Start",
"swi",
"th_",
"(_",
"attribute_",
",_",
"filter",
"\\u",
"implement",
"ion_",
",_",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter",
"\\u",
"implement",
"ion_",
"._",
"Predicate",
"Contain",
"s",
"Filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"attribute_",
",_",
"\"",
"^",
"\"_",
"+_",
"utils_",
"._",
"Esc",
"ape",
"Regex_",
"(_",
"string_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"format_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"invalid",
"-",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"._",
"format_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"split_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"invalid",
"-",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"._",
"split_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\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_",
"utils_",
"._",
"Sma",
"rt",
"Unicode_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\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_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"._",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"self_",
",_",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"handle",
"s",
" ",
"the",
" ",
"case",
"s",
" ",
"whe",
"n",
" ",
"we",
"'",
"re",
" ",
"initialize",
"d",
" ",
"from",
" ",
"Unic",
"ode",
" ",
"string",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"utils_",
"._",
"Sma",
"rt",
"Str_",
"(_",
"string_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Seriali",
"ze",
"To",
"String_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"utils_",
"._",
"Sma",
"rt",
"Str_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"String_",
"(_",
"RDF",
"Bytes_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Seriali",
"ze",
"To",
"Data",
"Store_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"utils_",
"._",
"Sma",
"rt",
"Unicode_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"functools_",
"._",
"total",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Represent",
" ",
"an",
" ",
"integ",
"er",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data\\u",
"store",
"\\u",
"type_",
"=_",
"\"",
"integ",
"er",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u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uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"operators_",
"=_",
"{_",
"\"<\"_",
":_",
"(_",
"1_",
",_",
"\"",
"Less",
"Than",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\">\"_",
":_",
"(_",
"1_",
",_",
"\"",
"Great",
"er",
"Than",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"=\"_",
":_",
"(_",
"1_",
",_",
"\"",
"Equal",
"\"_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"Is",
"Numeric_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"isinstance_",
"(_",
"value_",
",_",
"(_",
"int_",
",_",
"long_",
",_",
"float_",
",_",
"RDF",
"Integer_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
",_",
"initializer_",
"=_",
"None_",
",_",
"age_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"RDF",
"Integer_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"initializer_",
"=_",
"initializer_",
",_",
"age_",
"=_",
"age_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"initializer_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"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 ",
" _",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"initializer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"self_",
",_",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"string_",
":_",
"\\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",
"value_",
"=_",
"int_",
"(_",
"string_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Type",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Decode",
"Error_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"Seriali",
"ze",
"To",
"Data",
"Store_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Us",
"e",
" ",
"vari",
"nt",
" ",
"to",
" ",
"store",
" ",
"the",
" ",
"integ",
"er",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"int_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Set_",
"(_",
"self_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"value_",
",_",
"(_",
"long_",
",_",
"int_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"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 ",
" _",
"self_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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",
"long",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"long_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"int\\u",
"\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"int_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"float",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"float_",
"(_",
"self_",
"._",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"index",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"self_",
"._",
"\\u",
"value_",
"==_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"lt\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"<_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"and",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"&_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rand",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"&_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"ian",
"d\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"&=_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"or\\u\\u",
"_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"|_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"ror",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"|_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"ior",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"|=_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"add\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"+_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rad",
"d\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"+_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"iad",
"d\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"+=_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"sub\\u",
"\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"-_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rsu",
"b",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"other_",
"-_",
"self_",
"._",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"isu",
"b",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"-=_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"mul\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"*_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rm",
"ul",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"*_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"div\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"/_",
"other_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rdi",
"v",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"other_",
"/_",
"self_",
"._",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"Less",
"Than",
"_",
"(_",
"attribute_",
",_",
"filter",
"\\u",
"implement",
"ion_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter",
"\\u",
"implement",
"ion_",
"._",
"Predicate",
"Less",
"Than",
"Filter_",
"(_",
"attribute_",
",_",
"long_",
"(_",
"value_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"Great",
"er",
"Than",
"_",
"(_",
"attribute_",
",_",
"filter",
"\\u",
"implement",
"ion_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter",
"\\u",
"implement",
"ion_",
"._",
"Predicate",
"Great",
"er",
"Than",
"Filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"attribute_",
",_",
"long_",
"(_",
"value_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"RDF",
"Integer_",
"(_",
"RDF",
"String_",
")_",
":_",
"\\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_",
"Equal_",
"(_",
"attribute_",
",_",
"filter",
"\\u",
"implement",
"ion_",
",_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"filter",
"\\u",
"implement",
"ion_",
"._",
"Predicate",
"Numer",
"ic",
"Equal",
"Filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"attribute_",
",_",
"long_",
"(_",
"value_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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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,
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
] |
Unused import | CenterForOpenScience/osf.io/tests/models/test_user.py | [
{
"content": "import mock\nimport datetime\n\nfrom modularodm import Q\nfrom nose.tools import * # flake8: noqa (PEP8 asserts)\n\nfrom framework import auth\nfrom framework.auth import exceptions\nfrom framework.exceptions import PermissionsError\nfrom website import models, project\nfrom tests import base\nfrom tests.base import fake\nfrom tests import factories\nfrom framework.celery_tasks import handlers\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestUser(base.OsfTestCase):\n\n\n # Regression test for https://github.com/CenterForOpenScience/osf.io/issues/2454\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.TestUser",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": " def setUp(self):\n super(TestUser, self).setUp()\n self.user = factories.AuthUserFactory()",
"metadata": "root.TestUser.setUp",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " def tearDown(self):\n models.Node.remove()\n models.User.remove()\n models.Session.remove()\n super(TestUser, self).tearDown()",
"metadata": "root.TestUser.tearDown",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 21
},
{
"content": " def test_add_unconfirmed_email_when_email_verifications_is_None(self):\n\n self.user.email_verifications = None\n self.user.save()\n email = fake.email()\n self.user.add_unconfirmed_email(email)\n self.user.save()\n assert_in(email, self.user.unconfirmed_emails)",
"metadata": "root.TestUser.test_add_unconfirmed_email_when_email_verifications_is_None",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def test_unconfirmed_emails(self):\n assert_equal(\n self.user.unconfirmed_emails,\n []\n )\n self.user.add_unconfirmed_email('foo@bar.com')\n assert_equal(\n self.user.unconfirmed_emails,\n ['foo@bar.com']\n )\n\n # email_verifications field may be None\n self.user.email_verifications = None\n self.user.save()\n assert_equal(self.user.unconfirmed_emails, [])",
"metadata": "root.TestUser.test_unconfirmed_emails",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def test_unconfirmed_emails_unregistered_user(self):\n\n assert_equal(\n factories.UnregUserFactory().unconfirmed_emails,\n []\n )",
"metadata": "root.TestUser.test_unconfirmed_emails_unregistered_user",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 53
},
{
"content": " def test_unconfirmed_emails_unconfirmed_user(self):\n user = factories.UnconfirmedUserFactory()\n\n assert_equal(\n user.unconfirmed_emails,\n [user.username]\n )",
"metadata": "root.TestUser.test_unconfirmed_emails_unconfirmed_user",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 60
},
{
"content": " def test_remove_unconfirmed_email(self):\n self.user.add_unconfirmed_email('foo@bar.com')\n self.user.save()\n\n assert_in('foo@bar.com', self.user.unconfirmed_emails) # sanity check\n\n self.user.remove_unconfirmed_email('foo@bar.com')\n self.user.save()\n\n assert_not_in('foo@bar.com', self.user.unconfirmed_emails)",
"metadata": "root.TestUser.test_remove_unconfirmed_email",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 68
},
{
"content": " def test_confirm_email(self):\n token = self.user.add_unconfirmed_email('foo@bar.com')\n self.user.confirm_email(token)\n\n assert_not_in('foo@bar.com', self.user.unconfirmed_emails)\n assert_in('foo@bar.com', self.user.emails)",
"metadata": "root.TestUser.test_confirm_email",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def test_confirm_email_comparison_is_case_insensitive(self):\n u = factories.UnconfirmedUserFactory.build(\n username='letsgettacos@lgt.com'\n )\n u.add_unconfirmed_email('LetsGetTacos@LGT.com')\n u.save()\n assert_false(u.is_confirmed) # sanity check\n\n token = u.get_confirmation_token('LetsGetTacos@LGT.com')\n\n confirmed = u.confirm_email(token)\n assert_true(confirmed)\n assert_true(u.is_confirmed)",
"metadata": "root.TestUser.test_confirm_email_comparison_is_case_insensitive",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 86
},
{
"content": " def test_cannot_remove_primary_email_from_email_list(self):\n with assert_raises(PermissionsError) as e:\n self.user.remove_email(self.user.username)\n assert_equal(e.exception.message, \"Can't remove primary email\")",
"metadata": "root.TestUser.test_cannot_remove_primary_email_from_email_list",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 100
},
{
"content": " def test_add_same_unconfirmed_email_twice(self):\n email = \"test@example.com\"\n token1 = self.user.add_unconfirmed_email(email)\n self.user.save()\n self.user.reload()\n assert_equal(token1, self.user.get_confirmation_token(email))\n assert_equal(email, self.user._get_unconfirmed_email_for_token(token1))\n\n token2 = self.user.add_unconfirmed_email(email)\n self.user.save()\n self.user.reload()\n assert_not_equal(token1, self.user.get_confirmation_token(email))\n assert_equal(token2, self.user.get_confirmation_token(email))\n assert_equal(email, self.user._get_unconfirmed_email_for_token(token2))\n with assert_raises(exceptions.InvalidTokenError):\n self.user._get_unconfirmed_email_for_token(token1)",
"metadata": "root.TestUser.test_add_same_unconfirmed_email_twice",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 105
},
{
"content": " def test_contributed_property(self):\n projects_contributed_to = project.model.Node.find(Q('contributors', 'eq', self.user._id))\n assert_equal(list(self.user.contributed), list(projects_contributed_to))",
"metadata": "root.TestUser.test_contributed_property",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 122
},
{
"content": " def test_contributor_to_property(self):\n normal_node = factories.ProjectFactory(creator=self.user)\n normal_contributed_node = factories.ProjectFactory()\n normal_contributed_node.add_contributor(self.user)\n normal_contributed_node.save()\n deleted_node = factories.ProjectFactory(creator=self.user, is_deleted=True)\n bookmark_collection_node = factories.BookmarkCollectionFactory(creator=self.user)\n collection_node = factories.CollectionFactory(creator=self.user)\n project_to_be_invisible_on = factories.ProjectFactory()\n project_to_be_invisible_on.add_contributor(self.user, visible=False)\n project_to_be_invisible_on.save()\n contributor_to_nodes = [node._id for node in self.user.contributor_to]\n\n assert_in(normal_node._id, contributor_to_nodes)\n assert_in(normal_contributed_node._id, contributor_to_nodes)\n assert_in(project_to_be_invisible_on._id, contributor_to_nodes)\n assert_not_in(deleted_node._id, contributor_to_nodes)\n assert_not_in(bookmark_collection_node._id, contributor_to_nodes)\n assert_not_in(collection_node._id, contributor_to_nodes)",
"metadata": "root.TestUser.test_contributor_to_property",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 126
},
{
"content": " def test_visible_contributor_to_property(self):\n invisible_contributor = factories.UserFactory()\n normal_node = factories.ProjectFactory(creator=invisible_contributor)\n deleted_node = factories.ProjectFactory(creator=invisible_contributor, is_deleted=True)\n bookmark_collection_node = factories.BookmarkCollectionFactory(creator=invisible_contributor)\n collection_node = factories.CollectionFactory(creator=invisible_contributor)\n project_to_be_invisible_on = factories.ProjectFactory()\n project_to_be_invisible_on.add_contributor(invisible_contributor, visible=False)\n project_to_be_invisible_on.save()\n visible_contributor_to_nodes = [node._id for node in invisible_contributor.visible_contributor_to]\n\n assert_in(normal_node._id, visible_contributor_to_nodes)\n assert_not_in(deleted_node._id, visible_contributor_to_nodes)\n assert_not_in(bookmark_collection_node._id, visible_contributor_to_nodes)\n assert_not_in(collection_node._id, visible_contributor_to_nodes)\n assert_not_in(project_to_be_invisible_on._id, visible_contributor_to_nodes)",
"metadata": "root.TestUser.test_visible_contributor_to_property",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 146
},
{
"content": " def test_created_property(self):\n # make sure there's at least one project\n factories.ProjectFactory(creator=self.user)\n projects_created_by_user = project.model.Node.find(Q('creator', 'eq', self.user._id))\n assert_equal(list(self.user.created), list(projects_created_by_user))",
"metadata": "root.TestUser.test_created_property",
"header": "['class', 'TestUser', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 163
},
{
"content": "class TestUserMerging(base.OsfTestCase):\n ADDONS_UNDER_TEST = {\n 'deletable': {\n 'user_settings': factories.MockAddonUserSettings,\n 'node_settings': factories.MockAddonNodeSettings,\n },\n 'unmergeable': {\n 'user_settings': factories.MockAddonUserSettings,\n 'node_settings': factories.MockAddonNodeSettings,\n },\n 'mergeable': {\n 'user_settings': factories.MockAddonUserSettingsMergeable,\n 'node_settings': factories.MockAddonNodeSettings,\n }\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.TestUserMerging",
"header": "['module', '___EOS___']",
"index": 170
},
{
"content": " def setUp(self):\n super(TestUserMerging, self).setUp()\n self.user = factories.UserFactory()\n with self.context:\n handlers.celery_before_request()",
"metadata": "root.TestUserMerging.setUp",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 186
},
{
"content": " def _add_unconfirmed_user(self):\n\n self.unconfirmed = factories.UnconfirmedUserFactory()\n\n self.user.system_tags = ['shared', 'user']\n self.unconfirmed.system_tags = ['shared', 'unconfirmed']",
"metadata": "root.TestUserMerging._add_unconfirmed_user",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 192
},
{
"content": " def _add_unregistered_user(self):\n self.unregistered = factories.UnregUserFactory()\n\n self.project_with_unreg_contrib = factories.ProjectFactory()\n self.project_with_unreg_contrib.add_unregistered_contributor(\n fullname='Unreg',\n email=self.unregistered.username,\n auth=auth.Auth(self.project_with_unreg_contrib.creator)\n )\n self.project_with_unreg_contrib.save()",
"metadata": "root.TestUserMerging._add_unregistered_user",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 199
},
{
"content": " def test_can_be_merged_no_addons(self):\n # No addons present\n assert_true(self.user.can_be_merged)",
"metadata": "root.TestUserMerging.test_can_be_merged_no_addons",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 210
},
{
"content": " def test_can_be_merged_unmergable_addon(self):\n self.user.add_addon('unmergeable')\n\n assert_false(self.user.can_be_merged)",
"metadata": "root.TestUserMerging.test_can_be_merged_unmergable_addon",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 214
},
{
"content": " def test_can_be_merged_mergable_addon(self):\n self.user.add_addon('mergeable')\n\n assert_true(self.user.can_be_merged)",
"metadata": "root.TestUserMerging.test_can_be_merged_mergable_addon",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 219
},
{
"content": " def test_can_be_merged_both_addons(self):\n self.user.add_addon('mergeable')\n self.user.add_addon('unmergeable')\n\n assert_false(self.user.can_be_merged)",
"metadata": "root.TestUserMerging.test_can_be_merged_both_addons",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 224
},
{
"content": " def test_can_be_merged_delete_unmergable_addon(self):\n self.user.add_addon('mergeable')\n self.user.add_addon('deletable')\n self.user.delete_addon('deletable')\n\n assert_true(self.user.can_be_merged)",
"metadata": "root.TestUserMerging.test_can_be_merged_delete_unmergable_addon",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 230
},
{
"content": " def test_merge_unconfirmed_into_unmergeable(self):\n self.user.add_addon('unmergeable')\n self.user.save()\n # sanity check\n assert_false(self.user.can_be_merged)\n\n unconf = factories.UnconfirmedUserFactory()\n # make sure this doesn't raise an exception\n self.user.merge_user(unconf)\n\n unreg = factories.UnregUserFactory()\n # make sure this doesn't raise an exception\n self.user.merge_user(unreg)",
"metadata": "root.TestUserMerging.test_merge_unconfirmed_into_unmergeable",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 237
},
{
"content": " def test_merge_unmergeable_into_mergeable(self):\n # These states should never happen in the current codebase...\n # but that's why we have tests.\n unconfirmed = factories.UnconfirmedUserFactory()\n unconfirmed.add_addon('unmergeable')\n\n with assert_raises(exceptions.MergeConflictError):\n self.user.merge_user(unconfirmed)\n\n unregistered = factories.UnregUserFactory()\n unregistered.add_addon('unmergeable')\n\n with assert_raises(exceptions.MergeConflictError):\n self.user.merge_user(unregistered)",
"metadata": "root.TestUserMerging.test_merge_unmergeable_into_mergeable",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 251
},
{
"content": " def test_merge_unmergeabled_into_unmergeable(self):\n self.user.add_addon('unmergeable')\n # These states should never happen in the current codebase...\n # but that's why we have tests.\n unconfirmed = factories.UnconfirmedUserFactory()\n unconfirmed.add_addon('unmergeable')\n\n with assert_raises(exceptions.MergeConflictError):\n self.user.merge_user(unconfirmed)\n\n unregistered = factories.UnregUserFactory()\n unregistered.add_addon('unmergeable')\n\n with assert_raises(exceptions.MergeConflictError):\n self.user.merge_user(unregistered)",
"metadata": "root.TestUserMerging.test_merge_unmergeabled_into_unmergeable",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 266
},
{
"content": " @mock.patch('website.mailchimp_utils.get_mailchimp_api')\n def test_merge(self, mock_get_mailchimp_api):\n other_user = factories.UserFactory()\n other_user.save()\n\n # define values for users' fields\n today = datetime.datetime.now()\n yesterday = today - datetime.timedelta(days=1)\n\n self.user.comments_viewed_timestamp['shared_gt'] = today\n other_user.comments_viewed_timestamp['shared_gt'] = yesterday\n self.user.comments_viewed_timestamp['shared_lt'] = yesterday\n other_user.comments_viewed_timestamp['shared_lt'] = today\n self.user.comments_viewed_timestamp['user'] = yesterday\n other_user.comments_viewed_timestamp['other'] = yesterday\n\n self.user.email_verifications = {'user': {'email': 'a'}}\n other_user.email_verifications = {'other': {'email': 'b'}}\n\n self.user.external_accounts = [factories.ExternalAccountFactory()]\n other_user.external_accounts = [factories.ExternalAccountFactory()]\n\n self.user.mailchimp_mailing_lists = {\n 'user': True,\n 'shared_gt': True,\n 'shared_lt': False,\n }\n other_user.mailchimp_mailing_lists = {\n 'other': True,\n 'shared_gt': False,\n 'shared_lt': True,\n }\n\n self.user.piwik_token = 'abc'\n other_user.piwik_token = 'def'\n\n self.user.security_messages = {\n 'user': today,\n 'shared': today,\n }\n other_user.security_messages = {\n 'other': today,\n 'shared': today,\n }\n\n self.user.system_tags = ['user', 'shared']\n other_user.system_tags = ['other', 'shared']\n\n self.user.watched = [factories.WatchConfigFactory()]\n other_user.watched = [factories.WatchConfigFactory()]\n\n self.user.save()\n other_user.save()\n\n # define expected behavior for ALL FIELDS of the User object\n default_to_master_user_fields = [\n '_id',\n 'date_confirmed',\n 'date_disabled',\n 'date_last_login',\n 'date_registered',\n 'email_last_sent',\n 'family_name',\n 'fullname',\n 'given_name',\n 'is_claimed',\n 'is_invited',\n 'is_registered',\n 'jobs',\n 'locale',\n 'merged_by',\n 'middle_names',\n 'password',\n 'piwik_token',\n 'recently_added',\n 'schools',\n 'social',\n 'suffix',\n 'timezone',\n 'username',\n 'mailing_lists',\n 'verification_key',\n '_affiliated_institutions',\n 'contributor_added_email_records'\n ]\n\n calculated_fields = {\n 'comments_viewed_timestamp': {\n 'user': yesterday,\n 'other': yesterday,\n 'shared_gt': today,\n 'shared_lt': today,\n },\n 'email_verifications': {\n 'user': {'email': 'a'},\n 'other': {'email': 'b'},\n },\n 'emails': [\n self.user.username,\n other_user.username,\n ],\n 'external_accounts': [\n self.user.external_accounts[0]._id,\n other_user.external_accounts[0]._id,\n ],\n 'mailchimp_mailing_lists': {\n 'user': True,\n 'other': True,\n 'shared_gt': True,\n 'shared_lt': True,\n },\n 'osf_mailing_lists': {\n 'Open Science Framework Help': True\n },\n 'security_messages': {\n 'user': today,\n 'other': today,\n 'shared': today,\n },\n 'system_tags': ['user', 'shared', 'other'],\n 'unclaimed_records': {},\n 'watched': [\n self.user.watched[0]._id,\n other_user.watched[0]._id,\n ],\n }\n\n # from the explicit rules above, compile expected field/value pairs\n expected = {}\n expected.update(calculated_fields)\n for key in default_to_master_user_fields:\n expected[key] = getattr(self.user, key)\n\n # ensure all fields of the user object have an explicit expectation\n assert_equal(\n set(expected.keys()),\n set(self.user._fields),\n )\n\n # mock mailchimp\n mock_client = mock.MagicMock()\n mock_get_mailchimp_api.return_value = mock_client\n mock_client.lists.list.return_value = {'data': [{'id': x, 'list_name': list_name} for x, list_name in enumerate(self.user.mailchimp_mailing_lists)]}\n\n # perform the merge\n self.user.merge_user(other_user)\n self.user.save()\n handlers.celery_teardown_request()\n\n # check each field/value pair\n for k, v in expected.iteritems():\n assert_equal(\n getattr(self.user, k),\n v,\n # \"{} doesn't match expectation\".format(k)\n )\n\n # check fields set on merged user\n assert_equal(other_user.merged_by, self.user)\n\n assert_equal(\n 0,\n models.Session.find(\n Q('data.auth_user_id', 'eq', other_user._id)\n ).count()\n )",
"metadata": "root.TestUserMerging.test_merge",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 282
},
{
"content": " def test_merge_unconfirmed(self):\n self._add_unconfirmed_user()\n unconfirmed_username = self.unconfirmed.username\n self.user.merge_user(self.unconfirmed)\n\n assert_true(self.unconfirmed.is_merged)\n assert_equal(self.unconfirmed.merged_by, self.user)\n\n assert_true(self.user.is_claimed)\n assert_false(self.user.is_invited)\n\n # TODO: test profile fields - jobs, schools, social\n # TODO: test security_messages\n # TODO: test mailing_lists\n\n assert_equal(self.user.system_tags, ['shared', 'user', 'unconfirmed'])\n\n # TODO: test emails\n # TODO: test watched\n # TODO: test external_accounts\n\n assert_equal(self.unconfirmed.email_verifications, {})\n assert_is_none(self.unconfirmed.username)\n assert_is_none(self.unconfirmed.password)\n assert_is_none(self.unconfirmed.verification_key)\n # The mergee's email no longer needs to be confirmed by merger\n unconfirmed_emails = [record['email'] for record in self.user.email_verifications.values()]\n assert_not_in(unconfirmed_username, unconfirmed_emails)",
"metadata": "root.TestUserMerging.test_merge_unconfirmed",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 449
},
{
"content": " def test_merge_unregistered(self):\n # test only those behaviors that are not tested with unconfirmed users\n self._add_unregistered_user()\n\n self.user.merge_user(self.unregistered)\n\n self.project_with_unreg_contrib.reload()\n assert_true(self.user.is_invited)\n assert_in(self.user, self.project_with_unreg_contrib.contributors)",
"metadata": "root.TestUserMerging.test_merge_unregistered",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 478
},
{
"content": " @mock.patch('website.project.views.contributor.mails.send_mail')\n def test_merge_doesnt_send_signal(self, mock_notify):\n #Explictly reconnect signal as it is disconnected by default for test\n project.signals.contributor_added.connect(project.views.contributor.notify_added_contributor)\n other_user = factories.UserFactory()\n self.user.merge_user(other_user)\n assert_equal(other_user.merged_by._id, self.user._id)\n assert_false(mock_notify.called)",
"metadata": "root.TestUserMerging.test_merge_doesnt_send_signal",
"header": "['class', 'TestUserMerging', '(', 'base', '.', 'OsfTestCase', ')', ':', '___EOS___']",
"index": 488
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"modula",
"rod",
"m_",
"import_",
"Q_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nose_",
"._",
"tools_",
"import_",
"*_",
"#",
" ",
"flake",
"8",
":",
" ",
"no",
"qa",
" ",
"(",
"PE",
"P",
"8",
" ",
"asserts",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"framework_",
"import_",
"auth_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"framework_",
"._",
"auth_",
"import_",
"exceptions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"framework_",
"._",
"exceptions_",
"import_",
"Permi",
"ssion",
"s",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"website_",
"import_",
"models_",
",_",
"project_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"import_",
"base_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"._",
"base_",
"import_",
"fake_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"import_",
"factories_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"framework_",
"._",
"celery",
"\\u",
"tasks_",
"import_",
"handlers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"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_",
"#",
" ",
"Regr",
"ession",
" ",
"test",
" ",
"for",
" ",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Center",
"For",
"Open",
"Sci",
"ence",
"/",
"os",
"f",
".",
"io",
"/",
"issue",
"s",
"/",
"245",
"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\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Test",
"User_",
",_",
"self_",
")_",
"._",
"set",
"Up_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"=_",
"factories_",
"._",
"Auth",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"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 ",
" _",
"models_",
"._",
"Node_",
"._",
"remove_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"models_",
"._",
"User_",
"._",
"remove_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"models_",
"._",
"Session_",
"._",
"remove_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"Test",
"User_",
",_",
"self_",
")_",
"._",
"tear",
"Down_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email",
"\\u",
"whe",
"n",
"\\u",
"email",
"\\u",
"verification",
"s",
"\\u",
"is",
"\\u",
"None_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"email",
"\\u",
"verification",
"s_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email_",
"=_",
"fake_",
"._",
"email_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"email_",
",_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unconfi",
"rmed",
"\\u",
"emails_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"email",
"\\u",
"verification",
"s",
" ",
"field",
" ",
"may",
" ",
"be",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"email",
"\\u",
"verification",
"s_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unconfi",
"rmed",
"\\u",
"email",
"s",
"\\u",
"unregister",
"ed",
"\\u",
"user_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"factories_",
"._",
"Unre",
"g",
"User",
"Factory_",
"(_",
")_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unconfi",
"rmed",
"\\u",
"email",
"s",
"\\u",
"unconfi",
"rmed",
"\\u",
"user_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"user_",
"._",
"username_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"remove",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
")_",
"#",
" ",
"sanity",
" ",
"check_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"remove",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"confirm",
"\\u",
"email_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"token_",
"=_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"confirm",
"\\u",
"email_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"unconfi",
"rmed",
"\\u",
"emails_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"'",
"foo",
"@",
"bar",
".",
"com",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"emails_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"confirm",
"\\u",
"email",
"\\u",
"compa",
"ris",
"on",
"\\u",
"is",
"\\u",
"case",
"\\u",
"inse",
"nsitive",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"u_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"._",
"build_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
"=_",
"'",
"lets",
"gett",
"acos",
"@",
"lg",
"t",
".",
"com",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"'",
"Let",
"s",
"Get",
"Tac",
"os",
"@",
"LG",
"T",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"u_",
"._",
"is",
"\\u",
"confirmed_",
")_",
"#",
" ",
"sanity",
" ",
"check_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"token_",
"=_",
"u_",
"._",
"get",
"\\u",
"confirmation",
"\\u",
"token_",
"(_",
"'",
"Let",
"s",
"Get",
"Tac",
"os",
"@",
"LG",
"T",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"confirmed_",
"=_",
"u_",
"._",
"confirm",
"\\u",
"email_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"confirmed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"u_",
"._",
"is",
"\\u",
"confirmed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"cann",
"ot",
"\\u",
"remove",
"\\u",
"primary",
"\\u",
"email",
"\\u",
"from",
"\\u",
"email",
"\\u",
"list_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"Permi",
"ssion",
"s",
"Error_",
")_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"remove",
"\\u",
"email_",
"(_",
"self_",
"._",
"user_",
"._",
"username_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"e_",
"._",
"exception_",
"._",
"message_",
",_",
"\"",
"Can",
"'",
"t",
" ",
"remove",
" ",
"primary",
" ",
"email",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"add",
"\\u",
"same",
"\\u",
"unconfi",
"rmed",
"\\u",
"email",
"\\u",
"twi",
"ce_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"email_",
"=_",
"\"",
"test",
"@",
"example",
".",
"com",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"token",
"1_",
"=_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"reload_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"token",
"1_",
",_",
"self_",
"._",
"user_",
"._",
"get",
"\\u",
"confirmation",
"\\u",
"token_",
"(_",
"email_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"email_",
",_",
"self_",
"._",
"user_",
"._",
"\\u",
"get",
"\\u",
"unconfi",
"rmed",
"\\u",
"email",
"\\u",
"for",
"\\u",
"token_",
"(_",
"token",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"token",
"2_",
"=_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"email_",
"(_",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"reload_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"equal_",
"(_",
"token",
"1_",
",_",
"self_",
"._",
"user_",
"._",
"get",
"\\u",
"confirmation",
"\\u",
"token_",
"(_",
"email_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"token",
"2_",
",_",
"self_",
"._",
"user_",
"._",
"get",
"\\u",
"confirmation",
"\\u",
"token_",
"(_",
"email_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"email_",
",_",
"self_",
"._",
"user_",
"._",
"\\u",
"get",
"\\u",
"unconfi",
"rmed",
"\\u",
"email",
"\\u",
"for",
"\\u",
"token_",
"(_",
"token",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"exceptions_",
"._",
"Inva",
"lid",
"Token",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"\\u",
"get",
"\\u",
"unconfi",
"rmed",
"\\u",
"email",
"\\u",
"for",
"\\u",
"token_",
"(_",
"token",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"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",
"contribute",
"d\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"project",
"s",
"\\u",
"contribute",
"d\\u",
"to_",
"=_",
"project_",
"._",
"model_",
"._",
"Node_",
"._",
"find_",
"(_",
"Q_",
"(_",
"'",
"contributor",
"s",
"'_",
",_",
"'",
"eq",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"\\u",
"id_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"list_",
"(_",
"self_",
"._",
"user_",
"._",
"contribute",
"d_",
")_",
",_",
"list_",
"(_",
"project",
"s",
"\\u",
"contribute",
"d\\u",
"to_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"contributor",
"\\u",
"to",
"\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"normal",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
"creator_",
"=_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"normal",
"\\u",
"contribute",
"d\\u",
"node_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"normal",
"\\u",
"contribute",
"d\\u",
"node_",
"._",
"add",
"\\u",
"contributor_",
"(_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"normal",
"\\u",
"contribute",
"d\\u",
"node_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"delete",
"d\\u",
"node_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
"creator_",
"=_",
"self_",
"._",
"user_",
",_",
"is",
"\\u",
"deleted_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bookmark",
"\\u",
"collection",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Bookmark",
"Collecti",
"on",
"Factory_",
"(_",
"creator_",
"=_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"collection",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Collecti",
"on",
"Factory_",
"(_",
"creator_",
"=_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"add",
"\\u",
"contributor_",
"(_",
"self_",
"._",
"user_",
",_",
"visible_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
"=_",
"[_",
"node_",
"._",
"\\u",
"id_",
"for_",
"node_",
"in_",
"self_",
"._",
"user_",
"._",
"contributor",
"\\u",
"to_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"normal",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"normal",
"\\u",
"contribute",
"d\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"delete",
"d\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"bookmark",
"\\u",
"collection",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"collection",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"invisible",
"\\u",
"contributor_",
"=_",
"factories_",
"._",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"normal",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
"creator_",
"=_",
"invisible",
"\\u",
"contributor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"delete",
"d\\u",
"node_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
"creator_",
"=_",
"invisible",
"\\u",
"contributor_",
",_",
"is",
"\\u",
"deleted_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bookmark",
"\\u",
"collection",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Bookmark",
"Collecti",
"on",
"Factory_",
"(_",
"creator_",
"=_",
"invisible",
"\\u",
"contributor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"collection",
"\\u",
"node_",
"=_",
"factories_",
"._",
"Collecti",
"on",
"Factory_",
"(_",
"creator_",
"=_",
"invisible",
"\\u",
"contributor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"add",
"\\u",
"contributor_",
"(_",
"invisible",
"\\u",
"contributor_",
",_",
"visible_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
"=_",
"[_",
"node_",
"._",
"\\u",
"id_",
"for_",
"node_",
"in_",
"invisible",
"\\u",
"contributor_",
"._",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"normal",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"delete",
"d\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"bookmark",
"\\u",
"collection",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"collection",
"\\u",
"node_",
"._",
"\\u",
"id_",
",_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"project",
"\\u",
"to",
"\\u",
"be",
"\\u",
"invisible",
"\\u",
"on_",
"._",
"\\u",
"id_",
",_",
"visi",
"ble",
"\\u",
"contributor",
"\\u",
"to",
"\\u",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"created",
"\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"there",
"'",
"s",
" ",
"at",
" ",
"leas",
"t",
" ",
"one",
" ",
"project_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"factories_",
"._",
"Project",
"Factory_",
"(_",
"creator_",
"=_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"project",
"s",
"\\u",
"created",
"\\u",
"by",
"\\u",
"user_",
"=_",
"project_",
"._",
"model_",
"._",
"Node_",
"._",
"find_",
"(_",
"Q_",
"(_",
"'",
"creat",
"or",
"'_",
",_",
"'",
"eq",
"'_",
",_",
"self_",
"._",
"user_",
"._",
"\\u",
"id_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"list_",
"(_",
"self_",
"._",
"user_",
"._",
"created_",
")_",
",_",
"list_",
"(_",
"project",
"s",
"\\u",
"created",
"\\u",
"by",
"\\u",
"user_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ADDON",
"S",
"\\u",
"UNDER",
"\\u",
"TEST_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"delet",
"able",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"User",
"Settings_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"Node",
"Settings_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"unm",
"erge",
"able",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"User",
"Settings_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"Node",
"Settings_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"merge",
"able",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"User",
"Sett",
"ings",
"Merge",
"able_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
"\\u",
"settings",
"'_",
":_",
"factories_",
"._",
"Moc",
"k",
"Add",
"on",
"Node",
"Settings_",
",_",
"\\u\\u\\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_",
"\\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",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Test",
"User",
"Mer",
"ging",
"_",
",_",
"self_",
")_",
"._",
"set",
"Up_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"=_",
"factories_",
"._",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"context_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handlers_",
"._",
"celery",
"\\u",
"bef",
"ore",
"\\u",
"request_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"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_",
"\\u",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"user_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"unconfi",
"rmed",
"_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"system",
"\\u",
"tags_",
"=_",
"[_",
"'",
"shared",
"'_",
",_",
"'",
"user",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"system",
"\\u",
"tags_",
"=_",
"[_",
"'",
"shared",
"'_",
",_",
"'",
"unconfi",
"rmed",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"add",
"\\u",
"unregister",
"ed",
"\\u",
"user_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"unregister",
"ed_",
"=_",
"factories_",
"._",
"Unre",
"g",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"=_",
"factories_",
"._",
"Project",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"._",
"add",
"\\u",
"unregister",
"ed",
"\\u",
"contributor_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"fullname_",
"=_",
"'",
"Unre",
"g",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"email_",
"=_",
"self_",
"._",
"unregister",
"ed_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"auth_",
"=_",
"auth_",
"._",
"Auth_",
"(_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"._",
"creator_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"can",
"\\u",
"be",
"\\u",
"merge",
"d\\u",
"no",
"\\u",
"addons_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"No",
" ",
"addon",
"s",
" ",
"present_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"can",
"\\u",
"be",
"\\u",
"merge",
"d\\u",
"unm",
"erg",
"able",
"\\u",
"addon_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"can",
"\\u",
"be",
"\\u",
"merge",
"d\\u",
"mer",
"gab",
"le",
"\\u",
"addon_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"merge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"can",
"\\u",
"be",
"\\u",
"merge",
"d\\u",
"bot",
"h",
"\\u",
"addons_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"merge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"can",
"\\u",
"be",
"\\u",
"merge",
"d\\u",
"delete",
"\\u",
"unm",
"erg",
"able",
"\\u",
"addon_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"merge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"delet",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"delete",
"\\u",
"addon_",
"(_",
"'",
"delet",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"merge",
"\\u",
"unconfi",
"rmed",
"\\u",
"int",
"o",
"\\u",
"unm",
"erge",
"able_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"sanity",
" ",
"check_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"self_",
"._",
"user_",
"._",
"can",
"\\u",
"be",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"uncon",
"f_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"this",
" ",
"doe",
"sn",
"'",
"t",
" ",
"raise",
" ",
"an",
" ",
"exception_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"uncon",
"f_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"unre",
"g_",
"=_",
"factories_",
"._",
"Unre",
"g",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"this",
" ",
"doe",
"sn",
"'",
"t",
" ",
"raise",
" ",
"an",
" ",
"exception_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"unre",
"g_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"merge",
"\\u",
"unm",
"erge",
"able",
"\\u",
"int",
"o",
"\\u",
"merge",
"able_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"state",
"s",
" ",
"shou",
"ld",
" ",
"neve",
"r",
" ",
"happ",
"en",
" ",
"in",
" ",
"the",
" ",
"current",
" ",
"codeb",
"ase",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"but",
" ",
"tha",
"t",
"'",
"s",
" ",
"wh",
"y",
" ",
"we",
" ",
"have",
" ",
"tests",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"unconfi",
"rmed",
"_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unconfi",
"rmed",
"_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"exceptions_",
"._",
"Merge",
"Confl",
"ict",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"unconfi",
"rmed",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"unregister",
"ed_",
"=_",
"factories_",
"._",
"Unre",
"g",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unregister",
"ed_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"exceptions_",
"._",
"Merge",
"Confl",
"ict",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"unregister",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"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",
"merge",
"\\u",
"unm",
"erge",
"able",
"d\\u",
"int",
"o",
"\\u",
"unm",
"erge",
"able_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"state",
"s",
" ",
"shou",
"ld",
" ",
"neve",
"r",
" ",
"happ",
"en",
" ",
"in",
" ",
"the",
" ",
"current",
" ",
"codeb",
"ase",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"but",
" ",
"tha",
"t",
"'",
"s",
" ",
"wh",
"y",
" ",
"we",
" ",
"have",
" ",
"tests",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"unconfi",
"rmed",
"_",
"=_",
"factories_",
"._",
"Unco",
"nfi",
"rmed",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unconfi",
"rmed",
"_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"exceptions_",
"._",
"Merge",
"Confl",
"ict",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"unconfi",
"rmed",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"unregister",
"ed_",
"=_",
"factories_",
"._",
"Unre",
"g",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unregister",
"ed_",
"._",
"add",
"\\u",
"addon_",
"(_",
"'",
"unm",
"erge",
"able",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"assert",
"\\u",
"raises_",
"(_",
"exceptions_",
"._",
"Merge",
"Confl",
"ict",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"unregister",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"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_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"webs",
"ite",
".",
"mail",
"chi",
"mp",
"\\u",
"util",
"s",
".",
"get",
"\\u",
"mail",
"chi",
"mp",
"\\u",
"api",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"merge_",
"(_",
"self_",
",_",
"mock",
"\\u",
"get",
"\\u",
"mail",
"chi",
"mp",
"\\u",
"api_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"other",
"\\u",
"user_",
"=_",
"factories_",
"._",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"defin",
"e",
" ",
"values",
" ",
"for",
" ",
"users",
"'",
" ",
"fields_",
"\\u\\u\\uNL\\u\\u\\u_",
"today_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yesterday",
"_",
"=_",
"today_",
"-_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"shared",
"\\u",
"gt",
"'_",
"]_",
"=_",
"today_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"shared",
"\\u",
"gt",
"'_",
"]_",
"=_",
"yesterday",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"shared",
"\\u",
"lt",
"'_",
"]_",
"=_",
"yesterday",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"shared",
"\\u",
"lt",
"'_",
"]_",
"=_",
"today_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"user",
"'_",
"]_",
"=_",
"yesterday",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp_",
"[_",
"'",
"other",
"'_",
"]_",
"=_",
"yesterday",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"email",
"\\u",
"verification",
"s_",
"=_",
"{_",
"'",
"user",
"'_",
":_",
"{_",
"'",
"email",
"'_",
":_",
"'",
"a",
"'_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"email",
"\\u",
"verification",
"s_",
"=_",
"{_",
"'",
"other",
"'_",
":_",
"{_",
"'",
"email",
"'_",
":_",
"'",
"b",
"'_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"external",
"\\u",
"accounts_",
"=_",
"[_",
"factories_",
"._",
"Exter",
"nal",
"Account",
"Factory_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"external",
"\\u",
"accounts_",
"=_",
"[_",
"factories_",
"._",
"Exter",
"nal",
"Account",
"Factory_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"mail",
"chi",
"mp",
"\\u",
"mailing",
"\\u",
"lists_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"gt",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"lt",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"mail",
"chi",
"mp",
"\\u",
"mailing",
"\\u",
"lists_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"gt",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"lt",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"pi",
"wik",
"\\u",
"token_",
"=_",
"'",
"abc",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"pi",
"wik",
"\\u",
"token_",
"=_",
"'",
"def",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"security",
"\\u",
"messages_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"security",
"\\u",
"messages_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"system",
"\\u",
"tags_",
"=_",
"[_",
"'",
"user",
"'_",
",_",
"'",
"shared",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"system",
"\\u",
"tags_",
"=_",
"[_",
"'",
"other",
"'_",
",_",
"'",
"shared",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"watched",
"_",
"=_",
"[_",
"factories_",
"._",
"Watch",
"Config",
"Factory_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"watched",
"_",
"=_",
"[_",
"factories_",
"._",
"Watch",
"Config",
"Factory_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"defin",
"e",
" ",
"expected",
" ",
"behavior",
" ",
"for",
" ",
"ALL",
" ",
"FIELDS",
" ",
"of",
" ",
"the",
" ",
"User",
" ",
"object_",
"\\u\\u\\uNL\\u\\u\\u_",
"default",
"\\u",
"to",
"\\u",
"master",
"\\u",
"user",
"\\u",
"fields_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\u",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"date",
"\\u",
"confirm",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"date",
"\\u",
"disable",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"date",
"\\u",
"last",
"\\u",
"login",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"date",
"\\u",
"register",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"\\u",
"last",
"\\u",
"sent",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"famil",
"y",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"full",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"give",
"n",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"claimed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"invite",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"register",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"jobs",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"locale",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"merge",
"d\\u",
"by",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"middle",
"\\u",
"names",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pi",
"wik",
"\\u",
"token",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"recent",
"ly",
"\\u",
"adde",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"school",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"social",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"suff",
"ix",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"timezon",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"mailing",
"\\u",
"lists",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"verification",
"\\u",
"key",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\u",
"affi",
"liat",
"ed",
"\\u",
"institution",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"contributor",
"\\u",
"adde",
"d\\u",
"email",
"\\u",
"record",
"s",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"calculated",
"\\u",
"fields_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"comment",
"s",
"\\u",
"viewed",
"\\u",
"timestamp",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"yesterday",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"yesterday",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"gt",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"lt",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"\\u",
"verification",
"s",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"{_",
"'",
"email",
"'_",
":_",
"'",
"a",
"'_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"{_",
"'",
"email",
"'_",
":_",
"'",
"b",
"'_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"s",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"username_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"external",
"\\u",
"account",
"s",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"external",
"\\u",
"accounts_",
"[_",
"0_",
"]_",
"._",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"external",
"\\u",
"accounts_",
"[_",
"0_",
"]_",
"._",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"mail",
"chi",
"mp",
"\\u",
"mailing",
"\\u",
"lists",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"gt",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"\\u",
"lt",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"os",
"f",
"\\u",
"mailing",
"\\u",
"lists",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Open",
" ",
"Sci",
"ence",
" ",
"Frame",
"work",
" ",
"Help",
"'_",
":_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"security",
"\\u",
"message",
"s",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shared",
"'_",
":_",
"today_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"system",
"\\u",
"tags",
"'_",
":_",
"[_",
"'",
"user",
"'_",
",_",
"'",
"shared",
"'_",
",_",
"'",
"other",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"uncl",
"aime",
"d\\u",
"record",
"s",
"'_",
":_",
"{_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"watched",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"watched",
"_",
"[_",
"0_",
"]_",
"._",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"other",
"\\u",
"user_",
"._",
"watched",
"_",
"[_",
"0_",
"]_",
"._",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"the",
" ",
"explicit",
" ",
"rule",
"s",
" ",
"above",
",",
" ",
"compile",
" ",
"expected",
" ",
"field",
"/",
"value",
" ",
"pairs_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"._",
"update_",
"(_",
"calculated",
"\\u",
"fields_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"default",
"\\u",
"to",
"\\u",
"master",
"\\u",
"user",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"[_",
"key_",
"]_",
"=_",
"getattr_",
"(_",
"self_",
"._",
"user_",
",_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ensure",
" ",
"all",
" ",
"fields",
" ",
"of",
" ",
"the",
" ",
"user",
" ",
"object",
" ",
"have",
" ",
"an",
" ",
"explicit",
" ",
"expectation",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"set_",
"(_",
"expected_",
"._",
"keys_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"set_",
"(_",
"self_",
"._",
"user_",
"._",
"\\u",
"fields_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"mock",
" ",
"mail",
"chi",
"mp_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"client_",
"=_",
"mock_",
"._",
"Mag",
"ic",
"Mock_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"get",
"\\u",
"mail",
"chi",
"mp",
"\\u",
"api_",
"._",
"return",
"\\u",
"value_",
"=_",
"mock",
"\\u",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"client_",
"._",
"lists_",
"._",
"list_",
"._",
"return",
"\\u",
"value_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"[_",
"{_",
"'",
"id",
"'_",
":_",
"x_",
",_",
"'",
"list",
"\\u",
"name",
"'_",
":_",
"list",
"\\u",
"name_",
"}_",
"for_",
"x_",
",_",
"list",
"\\u",
"name_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"user_",
"._",
"mail",
"chi",
"mp",
"\\u",
"mailing",
"\\u",
"lists_",
")_",
"]_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"perform",
" ",
"the",
" ",
"merge_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"other",
"\\u",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handlers_",
"._",
"celery",
"\\u",
"tear",
"down",
"\\u",
"request_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"check",
" ",
"each",
" ",
"field",
"/",
"value",
" ",
"pair_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"expected_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"getattr_",
"(_",
"self_",
"._",
"user_",
",_",
"k_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"{}",
" ",
"doe",
"sn",
"'",
"t",
" ",
"match",
" ",
"expectation",
"\".",
"format",
"(",
"k",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"check",
" ",
"fields",
" ",
"set",
" ",
"on",
" ",
"merge",
"d",
" ",
"user_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"other",
"\\u",
"user_",
"._",
"merge",
"d\\u",
"by_",
",_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"models_",
"._",
"Session_",
"._",
"find_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Q_",
"(_",
"'",
"data",
".",
"auth",
"\\u",
"user",
"\\u",
"id",
"'_",
",_",
"'",
"eq",
"'_",
",_",
"other",
"\\u",
"user_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"._",
"count_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"merge",
"\\u",
"unconfi",
"rmed",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"unconfi",
"rmed",
"\\u",
"user_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unconfi",
"rmed",
"\\u",
"username_",
"=_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"username_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"is",
"\\u",
"merged_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"merge",
"d\\u",
"by_",
",_",
"self_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"user_",
"._",
"is",
"\\u",
"claimed",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"self_",
"._",
"user_",
"._",
"is",
"\\u",
"invite",
"d_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"profile",
" ",
"fields",
" ",
"-",
" ",
"jobs",
",",
" ",
"school",
"s",
",",
" ",
"social",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"security",
"\\u",
"messages_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"mailing",
"\\u",
"lists_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"self_",
"._",
"user_",
"._",
"system",
"\\u",
"tags_",
",_",
"[_",
"'",
"shared",
"'_",
",_",
"'",
"user",
"'_",
",_",
"'",
"unconfi",
"rmed",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"emails_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"watched",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"test",
" ",
"external",
"\\u",
"accounts_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"email",
"\\u",
"verification",
"s_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"is",
"\\u",
"none_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"username_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"is",
"\\u",
"none_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"password_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"is",
"\\u",
"none_",
"(_",
"self_",
"._",
"unconfi",
"rmed",
"_",
"._",
"verification",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"merge",
"e",
"'",
"s",
" ",
"email",
" ",
"no",
" ",
"long",
"er",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"confirm",
"ed",
" ",
"by",
" ",
"merger",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"unconfi",
"rmed",
"\\u",
"emails_",
"=_",
"[_",
"record_",
"[_",
"'",
"email",
"'_",
"]_",
"for_",
"record_",
"in_",
"self_",
"._",
"user_",
"._",
"email",
"\\u",
"verification",
"s_",
"._",
"values_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"not",
"\\u",
"in_",
"(_",
"unconfi",
"rmed",
"\\u",
"username_",
",_",
"unconfi",
"rmed",
"\\u",
"emails_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"merge",
"\\u",
"unregister",
"ed_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"test",
" ",
"only",
" ",
"tho",
"se",
" ",
"behavior",
"s",
" ",
"tha",
"t",
" ",
"are",
" ",
"not",
" ",
"tested",
" ",
"with",
" ",
"unconfi",
"rmed",
" ",
"users_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"add",
"\\u",
"unregister",
"ed",
"\\u",
"user_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"self_",
"._",
"unregister",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"._",
"reload_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"self_",
"._",
"user_",
"._",
"is",
"\\u",
"invite",
"d_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"in_",
"(_",
"self_",
"._",
"user_",
",_",
"self_",
"._",
"project",
"\\u",
"with",
"\\u",
"unre",
"g",
"\\u",
"contrib_",
"._",
"contributor",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"User",
"Mer",
"ging",
"_",
"(_",
"base_",
"._",
"Os",
"f",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"webs",
"ite",
".",
"project",
".",
"views",
".",
"contributor",
".",
"mails",
".",
"send",
"\\u",
"mail",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"merge",
"\\u",
"doesnt",
"\\u",
"send",
"\\u",
"signal_",
"(_",
"self_",
",_",
"mock",
"\\u",
"notify_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"Exp",
"lic",
"tl",
"y",
" ",
"reconnect",
" ",
"signal",
" ",
"as",
" ",
"it",
" ",
"is",
" ",
"disconnected",
" ",
"by",
" ",
"default",
" ",
"for",
" ",
"test_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"project_",
"._",
"signals_",
"._",
"contributor",
"\\u",
"added_",
"._",
"connect_",
"(_",
"project_",
"._",
"views_",
"._",
"contributor_",
"._",
"notif",
"y",
"\\u",
"adde",
"d\\u",
"contributor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"other",
"\\u",
"user_",
"=_",
"factories_",
"._",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user_",
"._",
"merge",
"\\u",
"user_",
"(_",
"other",
"\\u",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"equal_",
"(_",
"other",
"\\u",
"user_",
"._",
"merge",
"d\\u",
"by_",
"._",
"\\u",
"id_",
",_",
"self_",
"._",
"user_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"false_",
"(_",
"mock",
"\\u",
"notify_",
"._",
"called_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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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
] |
Unreachable code | chalasr/Flask-P2P/venv/lib/python2.7/site-packages/wheel/test/test_tagopt.py | [
{
"content": "def test_universal_tag(temp_pkg):\n subprocess.check_call(\n [sys.executable, 'setup.py', 'bdist_wheel', '--universal'],\n cwd=str(temp_pkg))\n dist_dir = temp_pkg.join('dist')\n assert dist_dir.check(dir=1)\n wheels = dist_dir.listdir()\n assert len(wheels) == 1\n assert wheels[0].basename.startswith('Test-1.0-py2.py3-')\n assert wheels[0].ext == '.whl'",
"metadata": "root.test_universal_tag",
"header": "['module', '___EOS___']",
"index": 54
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"universal",
"\\u",
"tag_",
"(_",
"temp",
"\\u",
"pkg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"subprocess_",
"._",
"check",
"\\u",
"call_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"sys_",
"._",
"executable_",
",_",
"'",
"setup",
".",
"py",
"'_",
",_",
"'",
"bdist",
"\\u",
"wheel",
"'_",
",_",
"'--",
"universal",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cwd_",
"=_",
"str_",
"(_",
"temp",
"\\u",
"pkg_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dist",
"\\u",
"dir_",
"=_",
"temp",
"\\u",
"pkg_",
"._",
"join_",
"(_",
"'",
"dist",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"dist",
"\\u",
"dir_",
"._",
"check_",
"(_",
"dir_",
"=_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"wheel",
"s_",
"=_",
"dist",
"\\u",
"dir_",
"._",
"listdir_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"len_",
"(_",
"wheel",
"s_",
")_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"wheel",
"s_",
"[_",
"0_",
"]_",
"._",
"basename_",
"._",
"startswith_",
"(_",
"'",
"Test",
"-1",
".0",
"-",
"py2",
".",
"py3",
"-'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"wheel",
"s_",
"[_",
"0_",
"]_",
"._",
"ext_",
"==_",
"'.",
"wh",
"l",
"'_",
"\\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
] |
Imprecise assert | ClusterHQ/flocker/flocker/test/test_testtools.py | [
{
"content": " def test_on_error(self):\n \"\"\"\n If the child process exits with a non-zero exit status, ``run_process``\n raises ``CalledProcessError`` initialized with the command, exit\n status, and any output.\n \"\"\"\n command = self._failing_shell(b\"echo goodbye\")\n exception = self._run_fail(command)\n expected = (1, command, b\"goodbye\\n\")\n actual = (\n exception.returncode, exception.cmd, exception.output\n )\n self.assertEqual(expected, actual)",
"metadata": "root.RunProcessTests.test_on_error",
"header": "['class', 'RunProcessTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 47
},
{
"content": " def test_exception_str(self):\n \"\"\"\n The exception raised by ``run_process`` has a string representation\n that includes the output from the failed child process.\n \"\"\"\n exception = self._run_fail(self._failing_shell(b\"echo hello\"))\n self.assertIn(\"hello\", str(exception))",
"metadata": "root.RunProcessTests.test_exception_str",
"header": "['class', 'RunProcessTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 61
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Run",
"Process",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"on",
"\\u",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"child",
" ",
"process",
" ",
"exits",
" ",
"with",
" ",
"a",
" ",
"non",
"-",
"zero",
" ",
"exit",
" ",
"status",
",",
" ",
"``",
"run",
"\\u",
"process",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"raise",
"s",
" ",
"``",
"Call",
"ed",
"Process",
"Error",
"``",
" ",
"initialize",
"d",
" ",
"with",
" ",
"the",
" ",
"command",
",",
" ",
"exit",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"status",
",",
" ",
"and",
" ",
"any",
" ",
"output",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"command_",
"=_",
"self_",
"._",
"\\u",
"faili",
"ng",
"\\u",
"shell_",
"(_",
"b",
"\"",
"echo",
" ",
"good",
"bye",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exception_",
"=_",
"self_",
"._",
"\\u",
"run",
"\\u",
"fail_",
"(_",
"command_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"(_",
"1_",
",_",
"command_",
",_",
"b",
"\"",
"good",
"bye",
"\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"returncode_",
",_",
"exception_",
"._",
"cmd_",
",_",
"exception_",
"._",
"output_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"actual_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Run",
"Process",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"exception",
"\\u",
"str_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"exception",
" ",
"raise",
"d",
" ",
"by",
" ",
"``",
"run",
"\\u",
"process",
"``",
" ",
"has",
" ",
"a",
" ",
"string",
" ",
"represent",
"ation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tha",
"t",
" ",
"include",
"s",
" ",
"the",
" ",
"output",
" ",
"from",
" ",
"the",
" ",
"fail",
"ed",
" ",
"child",
" ",
"process",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exception_",
"=_",
"self_",
"._",
"\\u",
"run",
"\\u",
"fail_",
"(_",
"self_",
"._",
"\\u",
"faili",
"ng",
"\\u",
"shell_",
"(_",
"b",
"\"",
"echo",
" ",
"hell",
"o",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"In_",
"(_",
"\"",
"hell",
"o",
"\"_",
",_",
"str_",
"(_",
"exception_",
")_",
")_"
] | [
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | andycasey/ads/ads/tests/test_base.py | [
{
"content": " def test_token(self):\n \"\"\"\n the token should be set in the following order:\n - (first in list) environmental variables defined in TOKEN_ENVIRON_VARS\n - (first in list) files on disk defined in TOKEN_FILES\n - ads.config.token\n \"\"\"\n def reset_token():\n bq.token = None\n\n # In-place override of the config variables responsible for identifying\n # how to look for a token\n ads.base.TOKEN_ENVIRON_VARS = ['TOKEN_1', 'TOKEN_2']\n os.environ['TOKEN_1'] = \"tok1\"\n os.environ['TOKEN_2'] = \"tok2\"\n\n # Write temporary file and override the config variable with the\n # tempfile paths\n tf1, tf2 = NamedTemporaryFile(), NamedTemporaryFile()\n tf1.write('tok3\\n'.encode(\"utf-8\"))\n tf2.write(' tok4 '.encode(\"utf-8\"))\n [f.flush() for f in [tf1, tf2]]\n [f.seek(0) for f in [tf1, tf2]]\n ads.base.TOKEN_FILES = [tf1.name, tf2.name]\n\n bq = BaseQuery()\n\n self.assertEqual(bq.token, 'tok1')\n reset_token()\n del os.environ['TOKEN_1']\n\n self.assertEqual(bq.token, 'tok2')\n reset_token()\n del os.environ['TOKEN_2']\n\n self.assertEqual(bq.token, 'tok3')\n reset_token()\n tf1.close()\n\n self.assertEqual(bq.token, 'tok4')\n reset_token()\n tf2.close()\n\n self.assertEqual(bq.token, None)\n\n ads.config.token = \"tok5\"\n self.assertEqual(BaseQuery().token, \"tok5\")",
"metadata": "root.TestBaseQuery.test_token",
"header": "['class', 'TestBaseQuery', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 39
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Test",
"Base",
"Query_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"token_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"token",
" ",
"shou",
"ld",
" ",
"be",
" ",
"set",
" ",
"in",
" ",
"the",
" ",
"follow",
"ing",
" ",
"order",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"(",
"first",
" ",
"in",
" ",
"list",
")",
" ",
"environ",
"menta",
"l",
" ",
"variab",
"les",
" ",
"defin",
"ed",
" ",
"in",
" ",
"TOKEN",
"\\u",
"ENV",
"IRO",
"N",
"\\u",
"VARS",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"(",
"first",
" ",
"in",
" ",
"list",
")",
" ",
"files",
" ",
"on",
" ",
"disk",
" ",
"defin",
"ed",
" ",
"in",
" ",
"TOKEN",
"\\u",
"FILE",
"S",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"ads",
".",
"config",
".",
"token",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"reset",
"\\u",
"token_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bq",
"_",
"._",
"token_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
"-",
"place",
" ",
"override",
" ",
"of",
" ",
"the",
" ",
"config",
" ",
"variab",
"les",
" ",
"responsib",
"le",
" ",
"for",
" ",
"identify",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"how",
" ",
"to",
" ",
"look",
" ",
"for",
" ",
"a",
" ",
"token_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ads_",
"._",
"base_",
"._",
"TOKEN",
"\\u",
"ENV",
"IRO",
"N",
"\\u",
"VARS",
"_",
"=_",
"[_",
"'",
"TOKEN",
"\\u",
"1",
"'_",
",_",
"'",
"TOKEN",
"\\u",
"2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"environ_",
"[_",
"'",
"TOKEN",
"\\u",
"1",
"'_",
"]_",
"=_",
"\"",
"tok",
"1",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"environ_",
"[_",
"'",
"TOKEN",
"\\u",
"2",
"'_",
"]_",
"=_",
"\"",
"tok",
"2",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Write",
" ",
"temporar",
"y",
" ",
"file",
" ",
"and",
" ",
"override",
" ",
"the",
" ",
"config",
" ",
"variab",
"le",
" ",
"with",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tempfile",
" ",
"paths_",
"\\u\\u\\uNL\\u\\u\\u_",
"tf",
"1_",
",_",
"tf",
"2_",
"=_",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
",_",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tf",
"1_",
"._",
"write_",
"(_",
"'",
"tok",
"3",
"\\\\",
"n",
"'_",
"._",
"encode_",
"(_",
"\"",
"utf",
"-",
"8",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tf",
"2_",
"._",
"write_",
"(_",
"'",
" ",
"tok",
"4",
" ",
"'_",
"._",
"encode_",
"(_",
"\"",
"utf",
"-",
"8",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[_",
"f_",
"._",
"flush_",
"(_",
")_",
"for_",
"f_",
"in_",
"[_",
"tf",
"1_",
",_",
"tf",
"2_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[_",
"f_",
"._",
"seek_",
"(_",
"0_",
")_",
"for_",
"f_",
"in_",
"[_",
"tf",
"1_",
",_",
"tf",
"2_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ads_",
"._",
"base_",
"._",
"TOKEN",
"\\u",
"FILES_",
"=_",
"[_",
"tf",
"1_",
"._",
"name_",
",_",
"tf",
"2_",
"._",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bq",
"_",
"=_",
"Base",
"Query_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bq",
"_",
"._",
"token_",
",_",
"'",
"tok",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reset",
"\\u",
"token_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"os_",
"._",
"environ_",
"[_",
"'",
"TOKEN",
"\\u",
"1",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bq",
"_",
"._",
"token_",
",_",
"'",
"tok",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reset",
"\\u",
"token_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"os_",
"._",
"environ_",
"[_",
"'",
"TOKEN",
"\\u",
"2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bq",
"_",
"._",
"token_",
",_",
"'",
"tok",
"3",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reset",
"\\u",
"token_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tf",
"1_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bq",
"_",
"._",
"token_",
",_",
"'",
"tok",
"4",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reset",
"\\u",
"token_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tf",
"2_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bq",
"_",
"._",
"token_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ads_",
"._",
"config_",
"._",
"token_",
"=_",
"\"",
"tok",
"5",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"Base",
"Query_",
"(_",
")_",
"._",
"token_",
",_",
"\"",
"tok",
"5",
"\"_",
")_",
"\\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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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
] |
An assert statement has a side-effect | JeffHeard/sondra/sondra/tests/test_requests_auth.py | [
{
"content": "def test_basic_method_access(suite, basic_user):\n jwt = _login(basic_user)\n headers = _auth_header(jwt)\n\n result = requests.get('http://localhost:5000/api/simple-app/simple-documents.authenticated-method;json', headers=headers)\n assert result.ok, result.text\n\n result = requests.get('http://localhost:5000/api/simple-app/simple-documents.authorized-method;json', headers=headers)\n assert not result.ok, result.text\n\n result = requests.get('http://localhost:5000/api/authorized-app/simple-documents.simple-none-return;json', headers=headers)\n assert not result.ok, result.text\n\n result = requests.get('http://localhost:5000/api/authenticated-app/authenticated-documents.simple-none-return;json', headers=headers)\n assert result.ok, result.text\n\n result = requests.get('http://localhost:5000/api/authorized-app/authorized-documents.simple-none-return;json', headers=headers)\n assert not result.ok, result.text\n\n _logout(jwt)",
"metadata": "root.test_basic_method_access",
"header": "['module', '___EOS___']",
"index": 408
}
] | [] | [] | 0 | true | [
"[CLS]_",
"An",
"_",
"assert_",
"statement_",
"has_",
"a_",
"side_",
"-_",
"effect_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"basic",
"\\u",
"method",
"\\u",
"access_",
"(_",
"suite_",
",_",
"basic",
"\\u",
"user_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"jwt_",
"=_",
"\\u",
"login_",
"(_",
"basic",
"\\u",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"headers_",
"=_",
"\\u",
"auth",
"\\u",
"header_",
"(_",
"jwt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"requests_",
"._",
"get_",
"(_",
"'",
"http",
"://",
"local",
"host",
":",
"5000",
"/",
"api",
"/",
"simple",
"-",
"app",
"/",
"simple",
"-",
"document",
"s",
".",
"authenticat",
"ed",
"-",
"method",
";",
"json",
"'_",
",_",
"headers_",
"=_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"result_",
"._",
"ok_",
",_",
"result_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"requests_",
"._",
"get_",
"(_",
"'",
"http",
"://",
"local",
"host",
":",
"5000",
"/",
"api",
"/",
"simple",
"-",
"app",
"/",
"simple",
"-",
"document",
"s",
".",
"authoriz",
"ed",
"-",
"method",
";",
"json",
"'_",
",_",
"headers_",
"=_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"not_",
"result_",
"._",
"ok_",
",_",
"result_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"requests_",
"._",
"get_",
"(_",
"'",
"http",
"://",
"local",
"host",
":",
"5000",
"/",
"api",
"/",
"authoriz",
"ed",
"-",
"app",
"/",
"simple",
"-",
"document",
"s",
".",
"simple",
"-",
"none",
"-",
"return",
";",
"json",
"'_",
",_",
"headers_",
"=_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"not_",
"result_",
"._",
"ok_",
",_",
"result_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"requests_",
"._",
"get_",
"(_",
"'",
"http",
"://",
"local",
"host",
":",
"5000",
"/",
"api",
"/",
"authenticat",
"ed",
"-",
"app",
"/",
"authenticat",
"ed",
"-",
"document",
"s",
".",
"simple",
"-",
"none",
"-",
"return",
";",
"json",
"'_",
",_",
"headers_",
"=_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"result_",
"._",
"ok_",
",_",
"result_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"requests_",
"._",
"get_",
"(_",
"'",
"http",
"://",
"local",
"host",
":",
"5000",
"/",
"api",
"/",
"authoriz",
"ed",
"-",
"app",
"/",
"authoriz",
"ed",
"-",
"document",
"s",
".",
"simple",
"-",
"none",
"-",
"return",
";",
"json",
"'_",
",_",
"headers_",
"=_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"not_",
"result_",
"._",
"ok_",
",_",
"result_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"logout_",
"(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with_connectivity_check(\"http://www.google.com\")\n def test_iterator(self):\n try:\n reader = GAnalytics()\n\n it = reader.get_data(\n metrics='visitors',\n start_date='2005-1-1',\n dimensions='date',\n max_results=10, chunksize=5,\n index_col=0)\n\n df1 = next(it)\n df2 = next(it)\n\n for df in [df1, df2]:\n self.assertIsInstance(df, pd.DataFrame)\n self.assertIsInstance(df.index, pd.DatetimeIndex)\n self.assertEqual(len(df), 5)\n self.assertTrue('date' not in df)\n self.assertEqual(df.index.name, 'date')\n self.assertTrue('visitors' in df)\n\n self.assertTrue((df2.index > df1.index).all())\n\n except AuthenticationConfigError:\n raise nose.SkipTest(\"authentication error\")",
"metadata": "root.TestGoogle.test_iterator",
"header": "['class', 'TestGoogle', '(', 'tm', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 86
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"guard",
"ed_",
"next_",
"in_",
"generator_",
"[SEP]_",
"class_",
"Test",
"Goo",
"gle_",
"(_",
"tm_",
"._",
"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_",
"@_",
"with",
"\\u",
"connecti",
"vity",
"\\u",
"check_",
"(_",
"\"",
"http",
"://",
"www",
".",
"google",
".",
"com",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"iterator_",
"(_",
"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 ",
" _",
"reader_",
"=_",
"GA",
"nal",
"yti",
"cs_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"it_",
"=_",
"reader_",
"._",
"get",
"\\u",
"data_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"metrics_",
"=_",
"'",
"visitor",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"start",
"\\u",
"date_",
"=_",
"'",
"2005",
"-1",
"-1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dimensions_",
"=_",
"'",
"date",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"max",
"\\u",
"results_",
"=_",
"10_",
",_",
"chunksize_",
"=_",
"5_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index",
"\\u",
"col_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"df1_",
"=_",
"next_",
"(_",
"it_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"df2_",
"=_",
"next_",
"(_",
"it_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"df_",
"in_",
"[_",
"df1_",
",_",
"df2_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"df_",
",_",
"pd_",
"._",
"Data",
"Frame_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"df_",
"._",
"index_",
",_",
"pd_",
"._",
"Date",
"time",
"Index_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"df_",
")_",
",_",
"5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"date",
"'_",
"not_",
"in_",
"df_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"df_",
"._",
"index_",
"._",
"name_",
",_",
"'",
"date",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"visitor",
"s",
"'_",
"in_",
"df_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"(_",
"df2_",
"._",
"index_",
">_",
"df1_",
"._",
"index_",
")_",
"._",
"all_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Auth",
"entica",
"tion",
"Config",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"nose_",
"._",
"Ski",
"p",
"Test_",
"(_",
"\"",
"authenticat",
"ion",
" ",
"error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | mne-tools/mne-python/mne/viz/topo.py | [
{
"content": "def _plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None,\n border='none', ylim=None, scalings=None, title=None,\n proj=False, vline=(0.,), hline=(0.,), fig_facecolor='k',\n fig_background=None, axis_facecolor='k', font_color='w',\n merge_grads=False, show=True):\n \"\"\"Plot 2D topography of evoked responses.\n\n Clicking on the plot of an individual sensor opens a new figure showing\n the evoked response for the selected sensor.\n\n Parameters\n ----------\n evoked : list of Evoked | Evoked\n The evoked response to plot.\n layout : instance of Layout | None\n Layout instance specifying sensor positions (does not need to\n be specified for Neuromag data). If possible, the correct layout is\n inferred from the data.\n layout_scale: float\n Scaling factor for adjusting the relative size of the layout\n on the canvas\n color : list of color objects | color object | None\n Everything matplotlib accepts to specify colors. If not list-like,\n the color specified will be repeated. If None, colors are\n automatically drawn.\n border : str\n matplotlib borders style to be used for each sensor plot.\n ylim : dict | None\n ylim for plots (after scaling has been applied). The value\n determines the upper and lower subplot limits. e.g.\n ylim = dict(eeg=[-20, 20]). Valid keys are eeg, mag, grad. If None,\n the ylim parameter for each channel is determined by the maximum\n absolute peak.\n scalings : dict | None\n The scalings of the channel types to be applied for plotting. If None,`\n defaults to `dict(eeg=1e6, grad=1e13, mag=1e15)`.\n title : str\n Title of the figure.\n proj : bool | 'interactive'\n If true SSP projections are applied before display. If 'interactive',\n a check box for reversible selection of SSP projection vectors will\n be shown.\n vline : list of floats | None\n The values at which to show a vertical line.\n hline : list of floats | None\n The values at which to show a horizontal line.\n fig_facecolor : str | obj\n The figure face color. Defaults to black.\n fig_background : None | numpy ndarray\n A background image for the figure. This must work with a call to\n plt.imshow. Defaults to None.\n axis_facecolor : str | obj\n The face color to be used for each sensor plot. Defaults to black.\n font_color : str | obj\n The color of text in the colorbar and title. Defaults to white.\n merge_grads : bool\n Whether to use RMS value of gradiometer pairs. Only works for Neuromag\n data. Defaults to False.\n show : bool\n Show figure if True.\n\n Returns\n -------\n fig : Instance of matplotlib.figure.Figure\n Images of evoked responses at sensor locations\n \"\"\"\n if not type(evoked) in (tuple, list):\n evoked = [evoked]\n\n if type(color) in (tuple, list):\n if len(color) != len(evoked):\n raise ValueError('Lists of evoked objects and colors'\n ' must have the same length')\n elif color is None:\n colors = ['w'] + COLORS\n stop = (slice(len(evoked)) if len(evoked) < len(colors)\n else slice(len(colors)))\n color = cycle(colors[stop])\n if len(evoked) > len(colors):\n warn('More evoked objects than colors available. You should pass '\n 'a list of unique colors.')\n else:\n color = cycle([color])\n\n times = evoked[0].times\n if not all((e.times == times).all() for e in evoked):\n raise ValueError('All evoked.times must be the same')\n\n evoked = [e.copy() for e in evoked]\n info = evoked[0].info\n ch_names = evoked[0].ch_names\n scalings = _handle_default('scalings', scalings)\n if not all(e.ch_names == ch_names for e in evoked):\n raise ValueError('All evoked.picks must be the same')\n ch_names = _clean_names(ch_names)\n if merge_grads:\n picks = _pair_grad_sensors(info, topomap_coords=False)\n chs = list()\n for pick in picks[::2]:\n ch = info['chs'][pick]\n ch['ch_name'] = ch['ch_name'][:-1] + 'X'\n chs.append(ch)\n info['chs'] = chs\n info['bads'] = list() # bads dropped on pair_grad_sensors\n info._update_redundant()\n info._check_consistency()\n new_picks = list()\n for e in evoked:\n data = _merge_grad_data(e.data[picks]) * scalings['grad']\n e.data = data\n new_picks.append(range(len(data)))\n picks = new_picks\n types_used = ['grad']\n y_label = 'RMS amplitude (%s)' % _handle_default('units')['grad']\n\n if layout is None:\n layout = find_layout(info)\n\n if not merge_grads:\n # XXX. at the moment we are committed to 1- / 2-sensor-types layouts\n chs_in_layout = set(layout.names) & set(ch_names)\n types_used = set(channel_type(info, ch_names.index(ch))\n for ch in chs_in_layout)\n # remove possible reference meg channels\n types_used = set.difference(types_used, set('ref_meg'))\n # one check for all vendors\n meg_types = set(('mag', 'grad'))\n is_meg = len(set.intersection(types_used, meg_types)) > 0\n if is_meg:\n types_used = list(types_used)[::-1] # -> restore kwarg order\n picks = [pick_types(info, meg=kk, ref_meg=False, exclude=[])\n for kk in types_used]\n else:\n types_used_kwargs = dict((t, True) for t in types_used)\n picks = [pick_types(info, meg=False, exclude=[],\n **types_used_kwargs)]\n assert isinstance(picks, list) and len(types_used) == len(picks)\n\n for e in evoked:\n for pick, ch_type in zip(picks, types_used):\n e.data[pick] = e.data[pick] * scalings[ch_type]\n\n if proj is True and all(e.proj is not True for e in evoked):\n evoked = [e.apply_proj() for e in evoked]\n elif proj == 'interactive': # let it fail early.\n for e in evoked:\n _check_delayed_ssp(e)\n # Y labels for picked plots must be reconstructed\n y_label = ['Amplitude (%s)' % _handle_default('units')[channel_type(\n info, ch_idx)] for ch_idx in range(len(chs_in_layout))]\n\n if ylim is None:\n def set_ylim(x):\n return np.abs(x).max()\n ylim_ = [set_ylim([e.data[t] for e in evoked]) for t in picks]\n ymax = np.array(ylim_)\n ylim_ = (-ymax, ymax)\n elif isinstance(ylim, dict):\n ylim_ = _handle_default('ylim', ylim)\n ylim_ = [ylim_[kk] for kk in types_used]\n # extra unpack to avoid bug #1700\n if len(ylim_) == 1:\n ylim_ = ylim_[0]\n else:\n ylim_ = zip(*[np.array(yl) for yl in ylim_])\n else:\n raise ValueError('ylim must be None ore a dict')\n\n data = [e.data for e in evoked]\n show_func = partial(_plot_timeseries_unified, data=data,\n color=color, times=times, vline=vline, hline=hline)\n click_func = partial(_plot_timeseries, data=data,\n color=color, times=times, vline=vline, hline=hline)\n\n fig = _plot_topo(info=info, times=times, show_func=show_func,\n click_func=click_func, layout=layout,\n colorbar=False, ylim=ylim_, cmap=None,\n layout_scale=layout_scale, border=border,\n fig_facecolor=fig_facecolor, font_color=font_color,\n axis_facecolor=axis_facecolor, title=title,\n x_label='Time (s)', y_label=y_label, unified=True)\n\n if fig_background is not None:\n add_background_image(fig, fig_background)\n\n if proj == 'interactive':\n for e in evoked:\n _check_delayed_ssp(e)\n params = dict(evokeds=evoked, times=times,\n plot_update_proj_callback=_plot_update_evoked_topo_proj,\n projs=evoked[0].info['projs'], fig=fig)\n _draw_proj_checkbox(None, params)\n\n plt_show(show)\n return fig",
"metadata": "root._plot_evoked_topo",
"header": "['module', '___EOS___']",
"index": 418
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"plot",
"\\u",
"evo",
"ked",
"\\u",
"topo_",
"(_",
"evo",
"ked",
"_",
",_",
"layout_",
"=_",
"None_",
",_",
"layout",
"\\u",
"scale_",
"=_",
"0.94",
"5_",
",_",
"color_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"border_",
"=_",
"'",
"none",
"'_",
",_",
"ylim_",
"=_",
"None_",
",_",
"scal",
"ings_",
"=_",
"None_",
",_",
"title_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"proj_",
"=_",
"False_",
",_",
"vlin",
"e_",
"=_",
"(_",
"0._",
",_",
")_",
",_",
"hline",
"_",
"=_",
"(_",
"0._",
",_",
")_",
",_",
"fig",
"\\u",
"facecolor_",
"=_",
"'",
"k",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fig",
"\\u",
"background_",
"=_",
"None_",
",_",
"axis",
"\\u",
"facecolor_",
"=_",
"'",
"k",
"'_",
",_",
"font",
"\\u",
"color_",
"=_",
"'",
"w",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"merge",
"\\u",
"grads_",
"=_",
"False_",
",_",
"show_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Plot",
" ",
"2",
"D",
" ",
"topo",
"graph",
"y",
" ",
"of",
" ",
"evo",
"ked",
" ",
"response",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Click",
"ing",
" ",
"on",
" ",
"the",
" ",
"plot",
" ",
"of",
" ",
"an",
" ",
"individual",
" ",
"sensor",
" ",
"opens",
" ",
"a",
" ",
"new",
" ",
"figure",
" ",
"showin",
"g",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"evo",
"ked",
" ",
"response",
" ",
"for",
" ",
"the",
" ",
"selecte",
"d",
" ",
"sensor",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"evo",
"ked",
" ",
":",
" ",
"list",
" ",
"of",
" ",
"Ev",
"oke",
"d",
" ",
"|",
" ",
"Ev",
"oke",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"evo",
"ked",
" ",
"response",
" ",
"to",
" ",
"plot",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"layout",
" ",
":",
" ",
"instance",
" ",
"of",
" ",
"Lay",
"out",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Lay",
"out",
" ",
"instance",
" ",
"speci",
"fy",
"ing",
" ",
"sensor",
" ",
"position",
"s",
" ",
"(",
"doe",
"s",
" ",
"not",
" ",
"need",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"specified",
" ",
"for",
" ",
"Neu",
"rom",
"ag",
" ",
"data",
").",
" ",
"If",
" ",
"possib",
"le",
",",
" ",
"the",
" ",
"correct",
" ",
"layout",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inferred",
" ",
"from",
" ",
"the",
" ",
"data",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"layout",
"\\u",
"scale",
":",
" ",
"float",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sca",
"ling",
" ",
"factor",
" ",
"for",
" ",
"adjust",
"ing",
" ",
"the",
" ",
"relative",
" ",
"size",
" ",
"of",
" ",
"the",
" ",
"layout",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"on",
" ",
"the",
" ",
"canv",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"color",
" ",
":",
" ",
"list",
" ",
"of",
" ",
"color",
" ",
"object",
"s",
" ",
"|",
" ",
"color",
" ",
"object",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Every",
"thing",
" ",
"mat",
"plotlib",
" ",
"accepts",
" ",
"to",
" ",
"speci",
"fy",
" ",
"colors",
".",
" ",
"If",
" ",
"not",
" ",
"list",
"-",
"like",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"color",
" ",
"specified",
" ",
"will",
" ",
"be",
" ",
"repeated",
".",
" ",
"If",
" ",
"Non",
"e",
",",
" ",
"colors",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"draw",
"n",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"border",
" ",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mat",
"plotlib",
" ",
"border",
"s",
" ",
"style",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"each",
" ",
"sensor",
" ",
"plot",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ylim",
" ",
":",
" ",
"dict",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ylim",
" ",
"for",
" ",
"plots",
" ",
"(",
"after",
" ",
"scal",
"ing",
" ",
"has",
" ",
"bee",
"n",
" ",
"applied",
").",
" ",
"The",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"dete",
"rmin",
"es",
" ",
"the",
" ",
"upper",
" ",
"and",
" ",
"lower",
" ",
"subplot",
" ",
"limit",
"s",
".",
" ",
"e",
".",
"g",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ylim",
" ",
"=",
" ",
"dict",
"(",
"ee",
"g",
"=[",
"-",
"20",
",",
" ",
"20",
"])",
".",
" ",
"Valid",
" ",
"keys",
" ",
"are",
" ",
"ee",
"g",
",",
" ",
"mag",
",",
" ",
"grad",
".",
" ",
"If",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"ylim",
" ",
"parameter",
" ",
"for",
" ",
"each",
" ",
"channel",
" ",
"is",
" ",
"dete",
"rmin",
"ed",
" ",
"by",
" ",
"the",
" ",
"maxim",
"um",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"abs",
"olute",
" ",
"peak",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"scal",
"ings",
" ",
":",
" ",
"dict",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"scal",
"ings",
" ",
"of",
" ",
"the",
" ",
"channel",
" ",
"types",
" ",
"to",
" ",
"be",
" ",
"applied",
" ",
"for",
" ",
"plott",
"ing",
".",
" ",
"If",
" ",
"Non",
"e",
",",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"default",
"s",
" ",
"to",
" ",
"`",
"dict",
"(",
"ee",
"g",
"=",
"1e",
"6",
",",
" ",
"grad",
"=",
"1e1",
"3",
",",
" ",
"mag",
"=",
"1e1",
"5",
")`",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"title",
" ",
":",
" ",
"str",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tit",
"le",
" ",
"of",
" ",
"the",
" ",
"figure",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"proj",
" ",
":",
" ",
"bool",
" ",
"|",
" ",
"'",
"interactive",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"true",
" ",
"SSP",
" ",
"projections",
" ",
"are",
" ",
"applied",
" ",
"bef",
"ore",
" ",
"display",
".",
" ",
"If",
" ",
"'",
"interactive",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"check",
" ",
"box",
" ",
"for",
" ",
"reversi",
"ble",
" ",
"selection",
" ",
"of",
" ",
"SSP",
" ",
"projecti",
"on",
" ",
"vector",
"s",
" ",
"will",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"shown",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"vlin",
"e",
" ",
":",
" ",
"list",
" ",
"of",
" ",
"float",
"s",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"values",
" ",
"at",
" ",
"whi",
"ch",
" ",
"to",
" ",
"show",
" ",
"a",
" ",
"vertical",
" ",
"line",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"hline",
" ",
":",
" ",
"list",
" ",
"of",
" ",
"float",
"s",
" ",
"|",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"values",
" ",
"at",
" ",
"whi",
"ch",
" ",
"to",
" ",
"show",
" ",
"a",
" ",
"horizon",
"tal",
" ",
"line",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fig",
"\\u",
"face",
"color",
" ",
":",
" ",
"str",
" ",
"|",
" ",
"obj",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"figure",
" ",
"face",
" ",
"color",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"black",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fig",
"\\u",
"background",
" ",
":",
" ",
"Non",
"e",
" ",
"|",
" ",
"nump",
"y",
" ",
"ndar",
"ray",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"background",
" ",
"image",
" ",
"for",
" ",
"the",
" ",
"figure",
".",
" ",
"Thi",
"s",
" ",
"must",
" ",
"work",
" ",
"with",
" ",
"a",
" ",
"call",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"plt",
".",
"ims",
"how",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"axis",
"\\u",
"face",
"color",
" ",
":",
" ",
"str",
" ",
"|",
" ",
"obj",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"face",
" ",
"color",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"each",
" ",
"sensor",
" ",
"plot",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"black",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"font",
"\\u",
"color",
" ",
":",
" ",
"str",
" ",
"|",
" ",
"obj",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"color",
" ",
"of",
" ",
"text",
" ",
"in",
" ",
"the",
" ",
"colorbar",
" ",
"and",
" ",
"title",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"white",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"merge",
"\\u",
"grads",
" ",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whe",
"ther",
" ",
"to",
" ",
"use",
" ",
"RMS",
" ",
"value",
" ",
"of",
" ",
"gradi",
"ometer",
" ",
"pair",
"s",
".",
" ",
"On",
"ly",
" ",
"works",
" ",
"for",
" ",
"Neu",
"rom",
"ag",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"Fal",
"se",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"show",
" ",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Show",
" ",
"figure",
" ",
"if",
" ",
"Tru",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fig",
" ",
":",
" ",
"Insta",
"nce",
" ",
"of",
" ",
"mat",
"plotlib",
".",
"figure",
".",
"Fig",
"ure",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Image",
"s",
" ",
"of",
" ",
"evo",
"ked",
" ",
"response",
"s",
" ",
"at",
" ",
"sensor",
" ",
"location",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"type_",
"(_",
"evo",
"ked",
"_",
")_",
"in_",
"(_",
"tuple_",
",_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"evo",
"ked",
"_",
"=_",
"[_",
"evo",
"ked",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"type_",
"(_",
"color_",
")_",
"in_",
"(_",
"tuple_",
",_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"color_",
")_",
"!=_",
"len_",
"(_",
"evo",
"ked",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"List",
"s",
" ",
"of",
" ",
"evo",
"ked",
" ",
"object",
"s",
" ",
"and",
" ",
"colors",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"must",
" ",
"have",
" ",
"the",
" ",
"same",
" ",
"length",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"color_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"colors_",
"=_",
"[_",
"'",
"w",
"'_",
"]_",
"+_",
"COLORS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stop_",
"=_",
"(_",
"slice_",
"(_",
"len_",
"(_",
"evo",
"ked",
"_",
")_",
")_",
"if_",
"len_",
"(_",
"evo",
"ked",
"_",
")_",
"<_",
"len_",
"(_",
"colors_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"else_",
"slice_",
"(_",
"len_",
"(_",
"colors_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"color_",
"=_",
"cycle_",
"(_",
"colors_",
"[_",
"stop_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"evo",
"ked",
"_",
")_",
">_",
"len_",
"(_",
"colors_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"warn_",
"(_",
"'",
"Mor",
"e",
" ",
"evo",
"ked",
" ",
"object",
"s",
" ",
"than",
" ",
"colors",
" ",
"avail",
"able",
".",
" ",
"You",
" ",
"shou",
"ld",
" ",
"pass",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"a",
" ",
"list",
" ",
"of",
" ",
"unique",
" ",
"colors",
".'_",
")_",
"\\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 ",
" _",
"color_",
"=_",
"cycle_",
"(_",
"[_",
"color_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"times_",
"=_",
"evo",
"ked",
"_",
"[_",
"0_",
"]_",
"._",
"times_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"all_",
"(_",
"(_",
"e_",
"._",
"times_",
"==_",
"times_",
")_",
"._",
"all_",
"(_",
")_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"All",
" ",
"evo",
"ked",
".",
"times",
" ",
"must",
" ",
"be",
" ",
"the",
" ",
"same",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"evo",
"ked",
"_",
"=_",
"[_",
"e_",
"._",
"copy_",
"(_",
")_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info_",
"=_",
"evo",
"ked",
"_",
"[_",
"0_",
"]_",
"._",
"info_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ch",
"\\u",
"names_",
"=_",
"evo",
"ked",
"_",
"[_",
"0_",
"]_",
"._",
"ch",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scal",
"ings_",
"=_",
"\\u",
"handle",
"\\u",
"default_",
"(_",
"'",
"scal",
"ings",
"'_",
",_",
"scal",
"ings_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"all_",
"(_",
"e_",
"._",
"ch",
"\\u",
"names_",
"==_",
"ch",
"\\u",
"names_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"All",
" ",
"evo",
"ked",
".",
"picks",
" ",
"must",
" ",
"be",
" ",
"the",
" ",
"same",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ch",
"\\u",
"names_",
"=_",
"\\u",
"clean",
"\\u",
"names_",
"(_",
"ch",
"\\u",
"names_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"merge",
"\\u",
"grads_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"picks",
"_",
"=_",
"\\u",
"pair",
"\\u",
"grad",
"\\u",
"sensors_",
"(_",
"info_",
",_",
"topo",
"map",
"\\u",
"coords_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"chs",
"_",
"=_",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"pick_",
"in_",
"picks",
"_",
"[_",
":_",
":_",
"2_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ch_",
"=_",
"info_",
"[_",
"'",
"chs",
"'_",
"]_",
"[_",
"pick_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ch_",
"[_",
"'",
"ch",
"\\u",
"name",
"'_",
"]_",
"=_",
"ch_",
"[_",
"'",
"ch",
"\\u",
"name",
"'_",
"]_",
"[_",
":_",
"-_",
"1_",
"]_",
"+_",
"'",
"X",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"chs",
"_",
"._",
"append_",
"(_",
"ch_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"info_",
"[_",
"'",
"chs",
"'_",
"]_",
"=_",
"chs",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info_",
"[_",
"'",
"bad",
"s",
"'_",
"]_",
"=_",
"list_",
"(_",
")_",
"#",
" ",
"bad",
"s",
" ",
"dropped",
" ",
"on",
" ",
"pair",
"\\u",
"grad",
"\\u",
"sensors_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info_",
"._",
"\\u",
"update",
"\\u",
"redundant",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info_",
"._",
"\\u",
"check",
"\\u",
"consiste",
"ncy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"picks",
"_",
"=_",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"\\u",
"merge",
"\\u",
"grad",
"\\u",
"data_",
"(_",
"e_",
"._",
"data_",
"[_",
"picks",
"_",
"]_",
")_",
"*_",
"scal",
"ings_",
"[_",
"'",
"grad",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"e_",
"._",
"data_",
"=_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"picks",
"_",
"._",
"append_",
"(_",
"range_",
"(_",
"len_",
"(_",
"data_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"picks",
"_",
"=_",
"new",
"\\u",
"picks",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"types",
"\\u",
"used_",
"=_",
"[_",
"'",
"grad",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"label_",
"=_",
"'",
"RMS",
" ",
"amplitude",
" ",
"(%",
"s",
")'_",
"%_",
"\\u",
"handle",
"\\u",
"default_",
"(_",
"'",
"unit",
"s",
"'_",
")_",
"[_",
"'",
"grad",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"layout_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"layout_",
"=_",
"find",
"\\u",
"layout_",
"(_",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"merge",
"\\u",
"grads_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
".",
" ",
"at",
" ",
"the",
" ",
"moment",
" ",
"we",
" ",
"are",
" ",
"committ",
"ed",
" ",
"to",
" ",
"1",
"-",
" ",
"/",
" ",
"2",
"-",
"sensor",
"-",
"types",
" ",
"layouts",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"chs",
"\\u",
"in",
"\\u",
"layout_",
"=_",
"set_",
"(_",
"layout_",
"._",
"names_",
")_",
"&_",
"set_",
"(_",
"ch",
"\\u",
"names_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"types",
"\\u",
"used_",
"=_",
"set_",
"(_",
"channel",
"\\u",
"type_",
"(_",
"info_",
",_",
"ch",
"\\u",
"names_",
"._",
"index_",
"(_",
"ch_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"ch_",
"in_",
"chs",
"\\u",
"in",
"\\u",
"layout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"remove",
" ",
"possib",
"le",
" ",
"reference",
" ",
"me",
"g",
" ",
"channels_",
"\\u\\u\\uNL\\u\\u\\u_",
"types",
"\\u",
"used_",
"=_",
"set_",
"._",
"difference_",
"(_",
"types",
"\\u",
"used_",
",_",
"set_",
"(_",
"'",
"ref",
"\\u",
"me",
"g",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"one",
" ",
"check",
" ",
"for",
" ",
"all",
" ",
"vendor",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"me",
"g",
"\\u",
"types_",
"=_",
"set_",
"(_",
"(_",
"'",
"mag",
"'_",
",_",
"'",
"grad",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"me",
"g_",
"=_",
"len_",
"(_",
"set_",
"._",
"intersection_",
"(_",
"types",
"\\u",
"used_",
",_",
"me",
"g",
"\\u",
"types_",
")_",
")_",
">_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"is",
"\\u",
"me",
"g_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"types",
"\\u",
"used_",
"=_",
"list_",
"(_",
"types",
"\\u",
"used_",
")_",
"[_",
":_",
":_",
"-_",
"1_",
"]_",
"#",
" ",
"->",
" ",
"restore",
" ",
"kwarg",
" ",
"order_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"picks",
"_",
"=_",
"[_",
"pick",
"\\u",
"types_",
"(_",
"info_",
",_",
"me",
"g_",
"=_",
"kk_",
",_",
"ref",
"\\u",
"me",
"g_",
"=_",
"False_",
",_",
"exclude_",
"=_",
"[_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"kk_",
"in_",
"types",
"\\u",
"used_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"types",
"\\u",
"used",
"\\u",
"kwargs_",
"=_",
"dict_",
"(_",
"(_",
"t_",
",_",
"True_",
")_",
"for_",
"t_",
"in_",
"types",
"\\u",
"used_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"picks",
"_",
"=_",
"[_",
"pick",
"\\u",
"types_",
"(_",
"info_",
",_",
"me",
"g_",
"=_",
"False_",
",_",
"exclude_",
"=_",
"[_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"types",
"\\u",
"used",
"\\u",
"kwargs_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"isinstance_",
"(_",
"picks",
"_",
",_",
"list_",
")_",
"and_",
"len_",
"(_",
"types",
"\\u",
"used_",
")_",
"==_",
"len_",
"(_",
"picks",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"pick_",
",_",
"ch",
"\\u",
"type_",
"in_",
"zip_",
"(_",
"picks",
"_",
",_",
"types",
"\\u",
"used_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"e_",
"._",
"data_",
"[_",
"pick_",
"]_",
"=_",
"e_",
"._",
"data_",
"[_",
"pick_",
"]_",
"*_",
"scal",
"ings_",
"[_",
"ch",
"\\u",
"type_",
"]_",
"\\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_",
"proj_",
"is_",
"True_",
"and_",
"all_",
"(_",
"e_",
"._",
"proj_",
"is_",
"not_",
"True_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"evo",
"ked",
"_",
"=_",
"[_",
"e_",
"._",
"appl",
"y",
"\\u",
"proj_",
"(_",
")_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"proj_",
"==_",
"'",
"interactive",
"'_",
":_",
"#",
" ",
"let",
" ",
"it",
" ",
"fail",
" ",
"ear",
"ly",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"check",
"\\u",
"delayed",
"\\u",
"ssp",
"_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Y",
" ",
"labels",
" ",
"for",
" ",
"picked",
" ",
"plots",
" ",
"must",
" ",
"be",
" ",
"reconstruct",
"ed_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"y",
"\\u",
"label_",
"=_",
"[_",
"'",
"Amplitude",
" ",
"(%",
"s",
")'_",
"%_",
"\\u",
"handle",
"\\u",
"default_",
"(_",
"'",
"unit",
"s",
"'_",
")_",
"[_",
"channel",
"\\u",
"type_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"info_",
",_",
"ch",
"\\u",
"idx_",
")_",
"]_",
"for_",
"ch",
"\\u",
"idx_",
"in_",
"range_",
"(_",
"len_",
"(_",
"chs",
"\\u",
"in",
"\\u",
"layout_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"ylim_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set\\u",
"ylim_",
"(_",
"x_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"np_",
"._",
"abs_",
"(_",
"x_",
")_",
"._",
"max_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ylim",
"\\u_",
"=_",
"[_",
"set\\u",
"ylim_",
"(_",
"[_",
"e_",
"._",
"data_",
"[_",
"t_",
"]_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
"]_",
")_",
"for_",
"t_",
"in_",
"picks",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ymax_",
"=_",
"np_",
"._",
"array_",
"(_",
"ylim",
"\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ylim",
"\\u_",
"=_",
"(_",
"-_",
"ymax_",
",_",
"ymax_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"ylim_",
",_",
"dict_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ylim",
"\\u_",
"=_",
"\\u",
"handle",
"\\u",
"default_",
"(_",
"'",
"ylim",
"'_",
",_",
"ylim_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ylim",
"\\u_",
"=_",
"[_",
"ylim",
"\\u_",
"[_",
"kk_",
"]_",
"for_",
"kk_",
"in_",
"types",
"\\u",
"used_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"extra",
" ",
"unpack",
" ",
"to",
" ",
"avoid",
" ",
"bug",
" ",
"#",
"1700",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"ylim",
"\\u_",
")_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ylim",
"\\u_",
"=_",
"ylim",
"\\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 ",
" _",
"ylim",
"\\u_",
"=_",
"zip_",
"(_",
"*_",
"[_",
"np_",
"._",
"array_",
"(_",
"yl",
"_",
")_",
"for_",
"yl",
"_",
"in_",
"ylim",
"\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"ylim",
" ",
"must",
" ",
"be",
" ",
"Non",
"e",
" ",
"ore",
" ",
"a",
" ",
"dict",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"[_",
"e_",
"._",
"data_",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"show",
"\\u",
"func_",
"=_",
"partial_",
"(_",
"\\u",
"plot",
"\\u",
"times",
"eries",
"\\u",
"unifie",
"d_",
",_",
"data_",
"=_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"color_",
"=_",
"color_",
",_",
"times_",
"=_",
"times_",
",_",
"vlin",
"e_",
"=_",
"vlin",
"e_",
",_",
"hline",
"_",
"=_",
"hline",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"click",
"\\u",
"func_",
"=_",
"partial_",
"(_",
"\\u",
"plot",
"\\u",
"timeseries_",
",_",
"data_",
"=_",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"color_",
"=_",
"color_",
",_",
"times_",
"=_",
"times_",
",_",
"vlin",
"e_",
"=_",
"vlin",
"e_",
",_",
"hline",
"_",
"=_",
"hline",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fig_",
"=_",
"\\u",
"plot",
"\\u",
"topo_",
"(_",
"info_",
"=_",
"info_",
",_",
"times_",
"=_",
"times_",
",_",
"show",
"\\u",
"func_",
"=_",
"show",
"\\u",
"func_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"click",
"\\u",
"func_",
"=_",
"click",
"\\u",
"func_",
",_",
"layout_",
"=_",
"layout_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"colorbar_",
"=_",
"False_",
",_",
"ylim_",
"=_",
"ylim",
"\\u_",
",_",
"cmap_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"layout",
"\\u",
"scale_",
"=_",
"layout",
"\\u",
"scale_",
",_",
"border_",
"=_",
"border_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fig",
"\\u",
"facecolor_",
"=_",
"fig",
"\\u",
"facecolor_",
",_",
"font",
"\\u",
"color_",
"=_",
"font",
"\\u",
"color_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"axis",
"\\u",
"facecolor_",
"=_",
"axis",
"\\u",
"facecolor_",
",_",
"title_",
"=_",
"title_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"x",
"\\u",
"label_",
"=_",
"'",
"Time",
" ",
"(",
"s",
")'_",
",_",
"y",
"\\u",
"label_",
"=_",
"y",
"\\u",
"label_",
",_",
"unifie",
"d_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"fig",
"\\u",
"background_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"add",
"\\u",
"background",
"\\u",
"image_",
"(_",
"fig_",
",_",
"fig",
"\\u",
"background_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"proj_",
"==_",
"'",
"interactive",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"e_",
"in_",
"evo",
"ked",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"check",
"\\u",
"delayed",
"\\u",
"ssp",
"_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"params_",
"=_",
"dict_",
"(_",
"evo",
"ked",
"s_",
"=_",
"evo",
"ked",
"_",
",_",
"times_",
"=_",
"times_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"plot",
"\\u",
"update",
"\\u",
"proj",
"\\u",
"callback_",
"=_",
"\\u",
"plot",
"\\u",
"update",
"\\u",
"evo",
"ked",
"\\u",
"topo",
"\\u",
"proj_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"proj",
"s_",
"=_",
"evo",
"ked",
"_",
"[_",
"0_",
"]_",
"._",
"info_",
"[_",
"'",
"proj",
"s",
"'_",
"]_",
",_",
"fig_",
"=_",
"fig_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"draw",
"\\u",
"proj",
"\\u",
"checkbox_",
"(_",
"None_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"plt",
"\\u",
"show_",
"(_",
"show_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"fig_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | ODM2/ODMToolsPython/odmtools/lib/ObjectListView/OLVEvent.py | [
{
"content": " def __init__(self, objectListView, rowIndex, subItemIndex, rowModel, cellValue, editor, userCancelled):\n CellEditEvent.__init__(self, olv_EVT_CELL_EDIT_FINISHING)\n self.SetParameters(objectListView, rowIndex, subItemIndex, rowModel, cellValue, editor)\n self.userCancelled = userCancelled",
"metadata": "root.CellEditFinishingEvent.__init__",
"header": "['class', 'CellEditFinishingEvent', '(', 'CellEditEvent', ')', ':', '___EOS___']",
"index": 161
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Cel",
"l",
"Edit",
"Finish",
"ing",
"Event_",
"(_",
"Cel",
"l",
"Edit",
"Event_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"object",
"List",
"View_",
",_",
"row",
"Index_",
",_",
"sub",
"Item",
"Index_",
",_",
"row",
"Model_",
",_",
"cell",
"Value_",
",_",
"editor_",
",_",
"user",
"Cancel",
"led_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Cel",
"l",
"Edit",
"Event_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"ol",
"v",
"\\u",
"EV",
"T",
"\\u",
"CELL",
"\\u",
"EDIT",
"\\u",
"FINISH",
"ING_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"Set",
"Parameters_",
"(_",
"object",
"List",
"View_",
",_",
"row",
"Index_",
",_",
"sub",
"Item",
"Index_",
",_",
"row",
"Model_",
",_",
"cell",
"Value_",
",_",
"editor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user",
"Cancel",
"led_",
"=_",
"user",
"Cancel",
"led_",
"\\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
] |
Except block handles 'BaseException' | basilfx/Course-Face3D/face3d/absfile.py | [
{
"content": " def __init__(self, filename):\n # Check if file exists\n if not os.path.exists(filename):\n raise Exception(\"Data file does not exist\")\n\n # Create variables\n self.data = {}\n self.row_size = False\n self.col_size = False\n\n # Now read the file and create an XYZ matrix\n with open(filename, 'r') as file_handle:\n # Helper for dimension\n def read_dimension(dimension):\n line = file_handle.readline()\n data = line.strip().split(\" \")\n\n if len(data) == 2 and data[1] == dimension:\n return int(data[0])\n else:\n raise Exception(\"Invalid header: expected '%s'\" % dimension)\n\n # Helper for data order\n def read_data_type():\n line = file_handle.readline()\n data = line.strip().split(\" \", 1)\n\n if len(data) == 2 and data[0] == \"pixels\":\n return data[1][1:-2].split(\" \")\n else:\n raise Exception(\"Invalid header: expected data type\")\n\n # Helper for reading data lines\n def read_data(data_type):\n # Initialize result array\n data_type = numpy.int if data_type == 'flag' else numpy.float\n result = numpy.zeros(self.col_size * self.row_size, dtype=data_type)\n index = 0\n\n # Read line\n line = file_handle.readline()\n data = line.strip().split(\" \")\n\n for value in data:\n try:\n # Convert string to correct format\n result[index] = data_type(value)\n\n # Increment index\n index = index + 1\n except ValueError:\n print \"Unexpected input: expected '%s', got '%s'\" % (data_type, value)\n\n # In case of invalid values, mask invalid values\n if data_type == numpy.float:\n result[result == AbsFile.invalid_value] = numpy.nan\n\n # Return reshaped array\n return result.reshape(self.row_size, self.col_size)\n\n # Read the header of the file\n self.row_size = read_dimension('rows')\n self.col_size = read_dimension('columns')\n self.data_type = read_data_type()\n\n # Read the actual data\n for current_data_type in self.data_type:\n self.data[current_data_type] = read_data(current_data_type)",
"metadata": "root.AbsFile.__init__",
"header": "['class', 'AbsFile', '(', 'object', ')', ':', '___NEWLINE___', '# Class variables', '___NL___', '___EOS___']",
"index": 12
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Abs",
"File_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Class",
" ",
"variables_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"if",
" ",
"file",
" ",
"exists_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\"",
"Data",
" ",
"file",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"variables_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"row",
"\\u",
"size_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"col",
"\\u",
"size_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"No",
"w",
" ",
"read",
" ",
"the",
" ",
"file",
" ",
"and",
" ",
"create",
" ",
"an",
" ",
"XY",
"Z",
" ",
"matrix_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"open_",
"(_",
"filename_",
",_",
"'",
"r",
"'_",
")_",
"as_",
"file",
"\\u",
"handle_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Help",
"er",
" ",
"for",
" ",
"dimension_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"read",
"\\u",
"dimension_",
"(_",
"dimension_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"file",
"\\u",
"handle_",
"._",
"readline_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"._",
"split_",
"(_",
"\"",
" ",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"data_",
")_",
"==_",
"2_",
"and_",
"data_",
"[_",
"1_",
"]_",
"==_",
"dimension_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"int_",
"(_",
"data_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Exception_",
"(_",
"\"",
"Inva",
"lid",
" ",
"header",
":",
" ",
"expected",
" ",
"'%",
"s",
"'\"_",
"%_",
"dimension_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Help",
"er",
" ",
"for",
" ",
"data",
" ",
"order_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"read",
"\\u",
"data\\u",
"type_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"file",
"\\u",
"handle_",
"._",
"readline_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"._",
"split_",
"(_",
"\"",
" ",
"\"_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"data_",
")_",
"==_",
"2_",
"and_",
"data_",
"[_",
"0_",
"]_",
"==_",
"\"",
"pixel",
"s",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"data_",
"[_",
"1_",
"]_",
"[_",
"1_",
":_",
"-_",
"2_",
"]_",
"._",
"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 ",
" ",
"_",
"raise_",
"Exception_",
"(_",
"\"",
"Inva",
"lid",
" ",
"header",
":",
" ",
"expected",
" ",
"data",
" ",
"type",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Help",
"er",
" ",
"for",
" ",
"readi",
"ng",
" ",
"data",
" ",
"lines_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"read",
"\\u",
"data_",
"(_",
"data\\u",
"type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Initializ",
"e",
" ",
"result",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"type_",
"=_",
"numpy_",
"._",
"int_",
"if_",
"data\\u",
"type_",
"==_",
"'",
"flag",
"'_",
"else_",
"numpy_",
"._",
"float_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"numpy_",
"._",
"zeros_",
"(_",
"self_",
"._",
"col",
"\\u",
"size_",
"*_",
"self_",
"._",
"row",
"\\u",
"size_",
",_",
"dtype_",
"=_",
"data\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"line_",
"=_",
"file",
"\\u",
"handle_",
"._",
"readline_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"._",
"split_",
"(_",
"\"",
" ",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"value_",
"in_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"string",
" ",
"to",
" ",
"correct",
" ",
"format_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"result_",
"[_",
"index_",
"]_",
"=_",
"data\\u",
"type_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Increment",
" ",
"index_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"index_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"print_",
"\"",
"Une",
"xpe",
"cte",
"d",
" ",
"input",
":",
" ",
"expected",
" ",
"'%",
"s",
"',",
" ",
"got",
" ",
"'%",
"s",
"'\"_",
"%_",
"(_",
"data\\u",
"type_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"case",
" ",
"of",
" ",
"invalid",
" ",
"values",
",",
" ",
"mask",
" ",
"invalid",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"data\\u",
"type_",
"==_",
"numpy_",
"._",
"float_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"result_",
"[_",
"result_",
"==_",
"Abs",
"File_",
"._",
"invalid",
"\\u",
"value_",
"]_",
"=_",
"numpy_",
"._",
"nan_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Return",
" ",
"reshape",
"d",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"._",
"reshape_",
"(_",
"self_",
"._",
"row",
"\\u",
"size_",
",_",
"self_",
"._",
"col",
"\\u",
"size_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"the",
" ",
"header",
" ",
"of",
" ",
"the",
" ",
"file_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"row",
"\\u",
"size_",
"=_",
"read",
"\\u",
"dimension_",
"(_",
"'",
"rows",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"col",
"\\u",
"size_",
"=_",
"read",
"\\u",
"dimension_",
"(_",
"'",
"column",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"data\\u",
"type_",
"=_",
"read",
"\\u",
"data\\u",
"type_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"the",
" ",
"actual",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"current",
"\\u",
"data\\u",
"type_",
"in_",
"self_",
"._",
"data\\u",
"type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"data_",
"[_",
"current",
"\\u",
"data\\u",
"type_",
"]_",
"=_",
"read",
"\\u",
"data_",
"(_",
"current",
"\\u",
"data\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
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
] |
Except block handles 'BaseException' | pinax/symposion/symposion/schedule/models.py | [
{
"content": " @property\n def content(self):\n \"\"\"\n Return the content this slot represents.\n @@@ hard-coded for presentation for now\n \"\"\"\n try:\n return self.content_ptr\n except ObjectDoesNotExist:\n return None",
"metadata": "root.Slot.content",
"header": "['class', 'Slot', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 110
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Slot_",
"(_",
"models_",
"._",
"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_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"content_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"content",
" ",
"this",
" ",
"slot",
" ",
"represent",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@@",
"@",
" ",
"hard",
"-",
"code",
"d",
" ",
"for",
" ",
"presentation",
" ",
"for",
" ",
"now",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"content",
"\\u",
"ptr_",
"\\u\\u\\uNEWLINE\\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 ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | Yelp/mrjob/mrjob/tools/emr/s3_tmpwatch.py | [
{
"content": "def main(cl_args=None):\n option_parser = _make_option_parser()\n options, args = option_parser.parse_args(cl_args)\n\n MRJob.set_up_logging(quiet=options.quiet, verbose=options.verbose)\n\n # make sure time and uris are given\n if not args or len(args) < 2:\n option_parser.error('Please specify time and one or more URIs')\n\n time_old = _process_time(args[0])\n\n for path in args[1:]:\n _s3_cleanup(path, time_old,\n dry_run=options.test,\n **_runner_kwargs(options))",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 63
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"main_",
"(_",
"cl",
"\\u",
"args_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"option",
"\\u",
"parser_",
"=_",
"\\u",
"make",
"\\u",
"option",
"\\u",
"parser_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
",_",
"args_",
"=_",
"option",
"\\u",
"parser_",
"._",
"parse",
"\\u",
"args_",
"(_",
"cl",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MR",
"Job_",
"._",
"set\\u",
"up",
"\\u",
"logging_",
"(_",
"quiet_",
"=_",
"options_",
"._",
"quiet_",
",_",
"verbose_",
"=_",
"options_",
"._",
"verbose_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"time",
" ",
"and",
" ",
"uris",
" ",
"are",
" ",
"given_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"args_",
"or_",
"len_",
"(_",
"args_",
")_",
"<_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"option",
"\\u",
"parser_",
"._",
"error_",
"(_",
"'",
"Ple",
"ase",
" ",
"speci",
"fy",
" ",
"time",
" ",
"and",
" ",
"one",
" ",
"or",
" ",
"more",
" ",
"URI",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"time",
"\\u",
"old_",
"=_",
"\\u",
"process",
"\\u",
"time_",
"(_",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"path_",
"in_",
"args_",
"[_",
"1_",
":_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"s3",
"\\u",
"cleanup_",
"(_",
"path_",
",_",
"time",
"\\u",
"old_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dry",
"\\u",
"run_",
"=_",
"options_",
"._",
"test_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"\\u",
"runn",
"er",
"\\u",
"kwargs_",
"(_",
"options_",
")_",
")_",
"\\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
] |
Comparison of constants | ucb-sts/sts/sts/event_dag.py | [
{
"content": " def insert_atomic_inputs(self, atomic_inputs, events_list=None):\n '''Insert inputs into events_list in the same relative order as the\n original events list. This method is needed because set union as used in\n delta debugging does not make sense for event sequences (events are ordered)'''\n # Note: events_list should never be None (I think), since it does not make\n # sense to insert inputs into the original sequence that are already present\n if events_list is None:\n raise ValueError(\"Shouldn't be adding inputs to the original trace\")\n\n inputs = self._expand_atomics(atomic_inputs)\n\n if not all(e in self._event2idx for e in inputs):\n raise ValueError(\"Not all inputs present in original events list %s\" %\n [e for e in input if e not in self._event2idx])\n if not all(e in self._event2idx for e in events_list):\n raise ValueError(\"Not all events in original events list %s\" %\n [e for e in events_list if e not in self._event2idx])\n\n result = []\n for _, successor in enumerate(events_list):\n orig_successor_idx = self._event2idx[successor]\n while len(inputs) > 0 and orig_successor_idx > self._event2idx[inputs[0]]:\n # If the current successor did in fact come after the next input in the\n # original trace, insert next input here\n input = inputs.pop(0)\n result.append(input)\n result.append(successor)\n\n # Any remaining inputs should be appended at the end -- they had no\n # successors\n result += inputs\n # Deal with newly added host migrations\n result = self._straighten_inserted_migrations(result)\n return EventDagView(self, result)",
"metadata": "root.EventDag.insert_atomic_inputs",
"header": "['class', 'EventDag', '(', 'object', ')', ':', '___EOS___']",
"index": 358
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"Event",
"Da",
"g_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"insert",
"\\u",
"atomi",
"c\\u",
"inputs_",
"(_",
"self_",
",_",
"atomi",
"c\\u",
"inputs_",
",_",
"events",
"\\u",
"list_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Insert",
" ",
"inputs",
" ",
"int",
"o",
" ",
"events",
"\\u",
"list",
" ",
"in",
" ",
"the",
" ",
"same",
" ",
"relative",
" ",
"order",
" ",
"as",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"original",
" ",
"events",
" ",
"list",
".",
" ",
"Thi",
"s",
" ",
"method",
" ",
"is",
" ",
"need",
"ed",
" ",
"bec",
"aus",
"e",
" ",
"set",
" ",
"uni",
"on",
" ",
"as",
" ",
"used",
" ",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"delta",
" ",
"debugg",
"ing",
" ",
"doe",
"s",
" ",
"not",
" ",
"make",
" ",
"sense",
" ",
"for",
" ",
"event",
" ",
"sequence",
"s",
" ",
"(",
"events",
" ",
"are",
" ",
"order",
"ed",
")'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Not",
"e",
":",
" ",
"events",
"\\u",
"list",
" ",
"shou",
"ld",
" ",
"neve",
"r",
" ",
"be",
" ",
"Non",
"e",
" ",
"(",
"I",
" ",
"think",
"),",
" ",
"sinc",
"e",
" ",
"it",
" ",
"doe",
"s",
" ",
"not",
" ",
"make_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sense",
" ",
"to",
" ",
"insert",
" ",
"inputs",
" ",
"int",
"o",
" ",
"the",
" ",
"original",
" ",
"sequence",
" ",
"tha",
"t",
" ",
"are",
" ",
"alr",
"ead",
"y",
" ",
"present_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"events",
"\\u",
"list_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Sho",
"ul",
"dn",
"'",
"t",
" ",
"be",
" ",
"addin",
"g",
" ",
"inputs",
" ",
"to",
" ",
"the",
" ",
"original",
" ",
"trace",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"inputs_",
"=_",
"self_",
"._",
"\\u",
"expand",
"\\u",
"atomi",
"cs_",
"(_",
"atomi",
"c\\u",
"inputs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"all_",
"(_",
"e_",
"in_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"for_",
"e_",
"in_",
"inputs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Not",
" ",
"all",
" ",
"inputs",
" ",
"presen",
"t",
" ",
"in",
" ",
"original",
" ",
"events",
" ",
"list",
" ",
"%",
"s",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"e_",
"for_",
"e_",
"in_",
"input_",
"if_",
"e_",
"not_",
"in_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"all_",
"(_",
"e_",
"in_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"for_",
"e_",
"in_",
"events",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Not",
" ",
"all",
" ",
"events",
" ",
"in",
" ",
"original",
" ",
"events",
" ",
"list",
" ",
"%",
"s",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"e_",
"for_",
"e_",
"in_",
"events",
"\\u",
"list_",
"if_",
"e_",
"not_",
"in_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u_",
",_",
"successor",
"_",
"in_",
"enumerate_",
"(_",
"events",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"orig",
"\\u",
"successor",
"\\u",
"idx_",
"=_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"[_",
"successor",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"len_",
"(_",
"inputs_",
")_",
">_",
"0_",
"and_",
"orig",
"\\u",
"successor",
"\\u",
"idx_",
">_",
"self_",
"._",
"\\u",
"event",
"2i",
"dx_",
"[_",
"inputs_",
"[_",
"0_",
"]_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"the",
" ",
"current",
" ",
"successor",
" ",
"did",
" ",
"in",
" ",
"fact",
" ",
"come",
" ",
"after",
" ",
"the",
" ",
"next",
" ",
"input",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"original",
" ",
"trace",
",",
" ",
"insert",
" ",
"next",
" ",
"input",
" ",
"here_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"input_",
"=_",
"inputs_",
"._",
"pop_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"input_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"successor",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Any",
" ",
"rema",
"inin",
"g",
" ",
"inputs",
" ",
"shou",
"ld",
" ",
"be",
" ",
"append",
"ed",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"--",
" ",
"the",
"y",
" ",
"had",
" ",
"no_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"successors_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"+=_",
"inputs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Deal",
" ",
"with",
" ",
"newl",
"y",
" ",
"adde",
"d",
" ",
"host",
" ",
"migrations_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"\\u",
"straight",
"en",
"\\u",
"inserted",
"\\u",
"migrations_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Event",
"Da",
"g",
"View_",
"(_",
"self_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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
] |
Unused import | HonzaKral/django-threadedcomments/examples/core/views.py | [
{
"content": "from django.shortcuts import render_to_response, get_object_or_404\nfrom django.template.context import RequestContext\nfrom django.views.decorators.csrf import csrf_protect\nfrom .models import Message\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def home(request):\n context = {\n 'messages': Message.objects.all(),\n }\n return render_to_response('core/home.html', context, context_instance=RequestContext(request))",
"metadata": "root.home",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "@csrf_protect\ndef message(request, id):\n context = {\n 'message': get_object_or_404(Message, pk=id),\n }\n return render_to_response('core/message.html', context, context_instance=RequestContext(request))",
"metadata": "root.message",
"header": "['module', '___EOS___']",
"index": 13
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"shortcuts_",
"import_",
"render",
"\\u",
"to",
"\\u",
"response_",
",_",
"get",
"\\u",
"object\\u",
"or",
"\\u",
"404_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"._",
"context_",
"import_",
"Request",
"Context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"views_",
"._",
"decorators_",
"._",
"csrf_",
"import_",
"csr",
"f",
"\\u",
"protect",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"models_",
"import_",
"Message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"home_",
"(_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"s",
"'_",
":_",
"Message_",
"._",
"objects_",
"._",
"all_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"render",
"\\u",
"to",
"\\u",
"response_",
"(_",
"'",
"core",
"/",
"home",
".",
"html",
"'_",
",_",
"context_",
",_",
"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_",
"@_",
"csr",
"f",
"\\u",
"protect",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"message_",
"(_",
"request_",
",_",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"'_",
":_",
"get",
"\\u",
"object\\u",
"or",
"\\u",
"404_",
"(_",
"Message_",
",_",
"pk_",
"=_",
"id_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"render",
"\\u",
"to",
"\\u",
"response_",
"(_",
"'",
"core",
"/",
"message",
".",
"html",
"'_",
",_",
"context_",
",_",
"context",
"\\u",
"instance_",
"=_",
"Request",
"Context_",
"(_",
"request_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | karlnapf/kameleon-mcmc/kameleon_mcmc/distribution/Discrete.py | [
{
"content": " def __str__(self):\n s = self.__class__.__name__ + \"=[\"\n s += \"num_objects=\" + str(self.num_objects)\n s += \", omega=\" + str(self.omega)\n s += \", cdf=\" + str(self.cdf)\n s += \", support=\" + str(self.support)\n s += \", \" + Distribution.__str__(self)\n s += \"]\"\n return s",
"metadata": "root.Discrete.__str__",
"header": "['class', 'Discrete', '(', 'Distribution', ')', ':', '___EOS___']",
"index": 28
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Discr",
"ete",
"_",
"(_",
"Distribution_",
")_",
":_",
"\\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 ",
" _",
"s_",
"=_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
"+_",
"\"=",
"[\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\"",
"num",
"\\u",
"object",
"s",
"=\"_",
"+_",
"str_",
"(_",
"self_",
"._",
"num",
"\\u",
"objects_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\",",
" ",
"omega",
"=\"_",
"+_",
"str_",
"(_",
"self_",
"._",
"omega_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\",",
" ",
"cdf",
"=\"_",
"+_",
"str_",
"(_",
"self_",
"._",
"cdf_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\",",
" ",
"support",
"=\"_",
"+_",
"str_",
"(_",
"self_",
"._",
"support_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\",",
" ",
"\"_",
"+_",
"Distribution_",
"._",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s_",
"+=_",
"\"]\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"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
] |
Unused local variable | openprocurement/openprocurement.api/src/openprocurement/api/tests/cancellation.py | [
{
"content": " def test_patch_tender_cancellation(self):\n response = self.app.post_json('/tenders/{}/cancellations'.format(\n self.tender_id), {'data': {'reason': 'cancellation reason'}})\n self.assertEqual(response.status, '201 Created')\n self.assertEqual(response.content_type, 'application/json')\n cancellation = response.json['data']\n\n response = self.app.patch_json('/tenders/{}/cancellations/{}'.format(self.tender_id, cancellation['id']), {\"data\": {\"status\": \"active\"}})\n self.assertEqual(response.status, '200 OK')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['data'][\"status\"], \"active\")\n\n response = self.app.get('/tenders/{}'.format(self.tender_id))\n self.assertEqual(response.status, '200 OK')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['data'][\"status\"], 'cancelled')\n self.assertNotIn(\"bids\", response.json['data'])\n\n response = self.app.patch_json('/tenders/{}/cancellations/{}'.format(self.tender_id, cancellation['id']), {\"data\": {\"status\": \"pending\"}}, status=403)\n self.assertEqual(response.status, '403 Forbidden')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['errors'][0][\"description\"], \"Can't update cancellation in current (cancelled) tender status\")\n\n response = self.app.patch_json('/tenders/{}/cancellations/some_id'.format(self.tender_id), {\"data\": {\"status\": \"active\"}}, status=404)\n self.assertEqual(response.status, '404 Not Found')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['status'], 'error')\n self.assertEqual(response.json['errors'], [\n {u'description': u'Not Found', u'location':\n u'url', u'name': u'cancellation_id'}\n ])\n\n response = self.app.patch_json('/tenders/some_id/cancellations/some_id', {\"data\": {\"status\": \"active\"}}, status=404)\n self.assertEqual(response.status, '404 Not Found')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['status'], 'error')\n self.assertEqual(response.json['errors'], [\n {u'description': u'Not Found', u'location':\n u'url', u'name': u'tender_id'}\n ])\n\n response = self.app.get('/tenders/{}/cancellations/{}'.format(self.tender_id, cancellation['id']))\n self.assertEqual(response.status, '200 OK')\n self.assertEqual(response.content_type, 'application/json')\n self.assertEqual(response.json['data'][\"status\"], \"active\")\n self.assertEqual(response.json['data'][\"reason\"], \"cancellation reason\")",
"metadata": "root.TenderCancellationResourceTest.test_patch_tender_cancellation",
"header": "['class', 'TenderCancellationResourceTest', '(', 'BaseTenderWebTest', ')', ':', '___EOS___']",
"index": 138
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Tend",
"er",
"Cancel",
"lation",
"Reso",
"urc",
"e",
"Test_",
"(_",
"Base",
"Tend",
"er",
"Web",
"Test_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"patch",
"\\u",
"tender",
"\\u",
"cancellat",
"ion_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"post",
"\\u",
"json_",
"(_",
"'/",
"tender",
"s",
"/{}/",
"cancellat",
"ion",
"s",
"'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"tender",
"\\u",
"id_",
")_",
",_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"reason",
"'_",
":_",
"'",
"cancellat",
"ion",
" ",
"reason",
"'_",
"}_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"201",
" ",
"Creat",
"ed",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cancellat",
"ion_",
"=_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"patch",
"\\u",
"json_",
"(_",
"'/",
"tender",
"s",
"/{}/",
"cancellat",
"ion",
"s",
"/{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"tender",
"\\u",
"id_",
",_",
"cancellat",
"ion_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
",_",
"{_",
"\"",
"data",
"\"_",
":_",
"{_",
"\"",
"status",
"\"_",
":_",
"\"",
"active",
"\"_",
"}_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"200",
" ",
"OK",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"\"",
"status",
"\"_",
"]_",
",_",
"\"",
"active",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"get_",
"(_",
"'/",
"tender",
"s",
"/{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"tender",
"\\u",
"id_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"200",
" ",
"OK",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"\"",
"status",
"\"_",
"]_",
",_",
"'",
"cancel",
"led",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Not",
"In_",
"(_",
"\"",
"bids",
"\"_",
",_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"patch",
"\\u",
"json_",
"(_",
"'/",
"tender",
"s",
"/{}/",
"cancellat",
"ion",
"s",
"/{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"tender",
"\\u",
"id_",
",_",
"cancellat",
"ion_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
",_",
"{_",
"\"",
"data",
"\"_",
":_",
"{_",
"\"",
"status",
"\"_",
":_",
"\"",
"pend",
"ing",
"\"_",
"}_",
"}_",
",_",
"status_",
"=_",
"403_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"403",
" ",
"For",
"bid",
"den",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"error",
"s",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"\"",
"description",
"\"_",
"]_",
",_",
"\"",
"Can",
"'",
"t",
" ",
"update",
" ",
"cancellat",
"ion",
" ",
"in",
" ",
"current",
" ",
"(",
"cancel",
"led",
")",
" ",
"tender",
" ",
"status",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"patch",
"\\u",
"json_",
"(_",
"'/",
"tender",
"s",
"/{}/",
"cancellat",
"ion",
"s",
"/",
"some",
"\\u",
"id",
"'_",
"._",
"format_",
"(_",
"self_",
"._",
"tender",
"\\u",
"id_",
")_",
",_",
"{_",
"\"",
"data",
"\"_",
":_",
"{_",
"\"",
"status",
"\"_",
":_",
"\"",
"active",
"\"_",
"}_",
"}_",
",_",
"status_",
"=_",
"404_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"404",
" ",
"Not",
" ",
"Foun",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"status",
"'_",
"]_",
",_",
"'",
"error",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"error",
"s",
"'_",
"]_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"u",
"'",
"description",
"'_",
":_",
"u",
"'",
"Not",
" ",
"Foun",
"d",
"'_",
",_",
"u",
"'",
"location",
"'_",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"url",
"'_",
",_",
"u",
"'",
"name",
"'_",
":_",
"u",
"'",
"cancellat",
"ion",
"\\u",
"id",
"'_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"patch",
"\\u",
"json_",
"(_",
"'/",
"tender",
"s",
"/",
"some",
"\\u",
"id",
"/",
"cancellat",
"ion",
"s",
"/",
"some",
"\\u",
"id",
"'_",
",_",
"{_",
"\"",
"data",
"\"_",
":_",
"{_",
"\"",
"status",
"\"_",
":_",
"\"",
"active",
"\"_",
"}_",
"}_",
",_",
"status_",
"=_",
"404_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"404",
" ",
"Not",
" ",
"Foun",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"status",
"'_",
"]_",
",_",
"'",
"error",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"error",
"s",
"'_",
"]_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"u",
"'",
"description",
"'_",
":_",
"u",
"'",
"Not",
" ",
"Foun",
"d",
"'_",
",_",
"u",
"'",
"location",
"'_",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"url",
"'_",
",_",
"u",
"'",
"name",
"'_",
":_",
"u",
"'",
"tender",
"\\u",
"id",
"'_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"app_",
"._",
"get_",
"(_",
"'/",
"tender",
"s",
"/{}/",
"cancellat",
"ion",
"s",
"/{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"tender",
"\\u",
"id_",
",_",
"cancellat",
"ion_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"status_",
",_",
"'",
"200",
" ",
"OK",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"content",
"\\u",
"type_",
",_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"\"",
"status",
"\"_",
"]_",
",_",
"\"",
"active",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"response_",
"._",
"json_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"\"",
"reason",
"\"_",
"]_",
",_",
"\"",
"cancellat",
"ion",
" ",
"reason",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
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
] |
Unused local variable | AppScale/appscale/AppServer/google/appengine/ext/gql/__init__.py | [
{
"content": " def __Operate(self, args, keyword_args, used_args, operator, params):\n \"\"\"Create a single output value from params using the operator string given.\n\n Args:\n args,keyword_args: arguments passed in for binding purposes (used in\n binding positional and keyword based arguments).\n used_args: set of numeric arguments accessed in this call.\n values are ints representing used zero-based positional arguments.\n used as an output parameter with new used arguments appended to the\n list.\n operator: string representing the operator to use 'nop' just returns\n the first value from params.\n params: parameter list to operate on (positional references, named\n references, or literals).\n\n Returns:\n A value which can be used as part of a GQL filter description (either a\n list of datastore types -- for use with IN, or a single datastore type --\n for use with other filters).\n \"\"\"\n if not params:\n return None\n\n param_values = []\n for param in params:\n if isinstance(param, Literal):\n value = param.Get()\n else:\n value = self.__GetParam(param, args, keyword_args, used_args=used_args)\n if isinstance(param, int):\n used_args.add(param - 1)\n logging.log(LOG_LEVEL, 'found param for bind: %s value: %s',\n param, value)\n param_values.append(value)\n\n logging.log(LOG_LEVEL, '%s Operating on values: %s',\n operator, repr(param_values))\n\n if operator in self.__cast_operators:\n result = self.__cast_operators[operator](self, param_values)\n else:\n self.__Error('Operation %s is invalid' % operator)\n\n return result",
"metadata": "root.GQL.__Operate",
"header": "['class', 'GQL', '(', 'object', ')', ':', '___EOS___']",
"index": 596
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"GQ",
"L_",
"(_",
"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",
"Opera",
"te_",
"(_",
"self_",
",_",
"args_",
",_",
"keyw",
"ord",
"\\u",
"args_",
",_",
"used",
"\\u",
"args_",
",_",
"operator_",
",_",
"params_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"single",
" ",
"output",
" ",
"value",
" ",
"from",
" ",
"params",
" ",
"usi",
"ng",
" ",
"the",
" ",
"opera",
"tor",
" ",
"string",
" ",
"give",
"n",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"args",
",",
"keyw",
"ord",
"\\u",
"args",
":",
" ",
"argu",
"ment",
"s",
" ",
"pass",
"ed",
" ",
"in",
" ",
"for",
" ",
"bindi",
"ng",
" ",
"purpose",
"s",
" ",
"(",
"used",
" ",
"in",
"\\",
"10",
";",
" ",
" ",
"bindi",
"ng",
" ",
"positional",
" ",
"and",
" ",
"keyw",
"ord",
" ",
"based",
" ",
"argu",
"ment",
"s",
").",
"\\",
"10",
";",
" ",
" ",
"used",
"\\u",
"args",
":",
" ",
"set",
" ",
"of",
" ",
"numeri",
"c",
" ",
"argu",
"ment",
"s",
" ",
"accesse",
"d",
" ",
"in",
" ",
"this",
" ",
"call",
".",
"\\",
"10",
";",
" ",
" ",
"values",
" ",
"are",
" ",
"ints",
" ",
"represent",
"ing",
" ",
"used",
" ",
"zero",
"-",
"based",
" ",
"positional",
" ",
"argu",
"ment",
"s",
".",
"\\",
"10",
";",
" ",
" ",
"used",
" ",
"as",
" ",
"an",
" ",
"output",
" ",
"parameter",
" ",
"with",
" ",
"new",
" ",
"used",
" ",
"argu",
"ment",
"s",
" ",
"append",
"ed",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
"list",
".",
"\\",
"10",
";",
" ",
" ",
"opera",
"tor",
":",
" ",
"string",
" ",
"represent",
"ing",
" ",
"the",
" ",
"opera",
"tor",
" ",
"to",
" ",
"use",
" ",
"'",
"nop",
"'",
" ",
"just",
" ",
"return",
"s",
"\\",
"10",
";",
" ",
" ",
"the",
" ",
"first",
" ",
"value",
" ",
"from",
" ",
"params",
".",
"\\",
"10",
";",
" ",
" ",
"params",
":",
" ",
"parameter",
" ",
"list",
" ",
"to",
" ",
"operate",
" ",
"on",
" ",
"(",
"positional",
" ",
"reference",
"s",
",",
" ",
"named",
"\\",
"10",
";",
" ",
" ",
"reference",
"s",
",",
" ",
"or",
" ",
"literal",
"s",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"A",
" ",
"value",
" ",
"whi",
"ch",
" ",
"can",
" ",
"be",
" ",
"used",
" ",
"as",
" ",
"part",
" ",
"of",
" ",
"a",
" ",
"GQ",
"L",
" ",
"filter",
" ",
"description",
" ",
"(",
"eit",
"her",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
"list",
" ",
"of",
" ",
"datast",
"ore",
" ",
"types",
" ",
"--",
" ",
"for",
" ",
"use",
" ",
"with",
" ",
"IN",
",",
" ",
"or",
" ",
"a",
" ",
"single",
" ",
"datast",
"ore",
" ",
"type",
" ",
"--",
"\\",
"10",
";",
" ",
" ",
"for",
" ",
"use",
" ",
"with",
" ",
"other",
" ",
"filter",
"s",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"params_",
":_",
"\\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_",
"param",
"\\u",
"values_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"param_",
"in_",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"param_",
",_",
"Literal_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"param_",
"._",
"Get_",
"(_",
")_",
"\\u\\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_",
"=_",
"self_",
"._",
"\\u\\u",
"Get",
"Param_",
"(_",
"param_",
",_",
"args_",
",_",
"keyw",
"ord",
"\\u",
"args_",
",_",
"used",
"\\u",
"args_",
"=_",
"used",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"param_",
",_",
"int_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"used",
"\\u",
"args_",
"._",
"add_",
"(_",
"param_",
"-_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"log_",
"(_",
"LOG",
"\\u",
"LEVEL_",
",_",
"'",
"found",
" ",
"param",
" ",
"for",
" ",
"bind",
":",
" ",
"%",
"s",
" ",
"value",
":",
" ",
"%",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"param_",
",_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"param",
"\\u",
"values_",
"._",
"append_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"log_",
"(_",
"LOG",
"\\u",
"LEVEL_",
",_",
"'%",
"s",
" ",
"Opera",
"ting",
" ",
"on",
" ",
"values",
":",
" ",
"%",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"operator_",
",_",
"repr_",
"(_",
"param",
"\\u",
"values_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"operator_",
"in_",
"self_",
"._",
"\\u\\u",
"cast",
"\\u",
"operators_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"self_",
"._",
"\\u\\u",
"cast",
"\\u",
"operators_",
"[_",
"operator_",
"]_",
"(_",
"self_",
",_",
"param",
"\\u",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"Error_",
"(_",
"'",
"Opera",
"tion",
" ",
"%",
"s",
" ",
"is",
" ",
"invalid",
"'_",
"%_",
"operator_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
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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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
] |
Except block handles 'BaseException' | maraoz/proofofexistence/babel/localtime/_win32.py | [
{
"content": "try:\n import _winreg as winreg\nexcept ImportError:\n try:\n import winreg\n except ImportError:\n winreg = None\n\nfrom babel.core import get_global\nimport pytz\n\n\n# When building the cldr data on windows this module gets imported.\n# Because at that point there is no global.dat yet this call will\n# fail. We want to catch it down in that case then and just assume\n# the mapping was empty.\ntry:\n tz_names = get_global('windows_zone_mapping')\nexcept RuntimeError:\n tz_names = {}\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"\\u",
"winreg_",
"as_",
"winreg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"winreg_",
"\\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 ",
" _",
"winreg_",
"=_",
"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_",
"from_",
"babel",
"_",
"._",
"core_",
"import_",
"get",
"\\u",
"global_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pytz_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Whe",
"n",
" ",
"buildi",
"ng",
" ",
"the",
" ",
"cl",
"dr",
" ",
"data",
" ",
"on",
" ",
"windows",
" ",
"this",
" ",
"module",
" ",
"gets",
" ",
"import",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Be",
"caus",
"e",
" ",
"at",
" ",
"tha",
"t",
" ",
"point",
" ",
"there",
" ",
"is",
" ",
"no",
" ",
"global",
".",
"dat",
" ",
"ye",
"t",
" ",
"this",
" ",
"call",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fail",
".",
" ",
" ",
"We",
" ",
"want",
" ",
"to",
" ",
"catch",
" ",
"it",
" ",
"down",
" ",
"in",
" ",
"tha",
"t",
" ",
"case",
" ",
"then",
" ",
"and",
" ",
"just",
" ",
"assume",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"mapping",
" ",
"was",
" ",
"empty",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\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
] |
Duplicate key in dict literal | mozilla/kitsune/kitsune/questions/views.py | [
{
"content": "@mobile_template('questions/{mobile/}question_details.html')\n@anonymous_csrf # Need this so the anon csrf gets set for watch forms.\ndef question_details(request, template, question_id, form=None,\n watch_form=None, answer_preview=None, **extra_kwargs):\n \"\"\"View the answers to a question.\"\"\"\n ans_ = _answers_data(request, question_id, form, watch_form,\n answer_preview)\n question = ans_['question']\n\n if question.is_spam and not request.user.has_perm('flagit.can_moderate'):\n raise Http404('No question matches the given query.')\n\n # Try to parse troubleshooting data as JSON.\n troubleshooting_json = question.metadata.get('troubleshooting')\n question.metadata['troubleshooting_parsed'] = (\n parse_troubleshooting(troubleshooting_json))\n\n if request.user.is_authenticated():\n ct = ContentType.objects.get_for_model(request.user)\n ans_['images'] = ImageAttachment.objects.filter(creator=request.user,\n content_type=ct)\n\n extra_kwargs.update(ans_)\n\n products = Product.objects.filter(visible=True)\n topics = topics_for(product=question.product)\n\n related_documents = question.related_documents\n related_questions = question.related_questions\n\n extra_kwargs.update({'all_products': products, 'all_topics': topics,\n 'product': question.product, 'topic': question.topic,\n 'related_documents': related_documents,\n 'related_questions': related_questions})\n\n if not request.MOBILE:\n # Add noindex to questions without a solution.\n if not question.solution_id:\n extra_kwargs.update(robots_noindex=True)\n\n return render(request, template, extra_kwargs)",
"metadata": "root.question_details",
"header": "['module', '___EOS___']",
"index": 397
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Duplicate",
"_",
"key_",
"in_",
"dict_",
"literal_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mobile",
"\\u",
"template_",
"(_",
"'",
"question",
"s",
"/{",
"mobile",
"/",
"}",
"question",
"\\u",
"deta",
"il",
"s",
".",
"html",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"anonym",
"ous",
"\\u",
"csrf_",
"#",
" ",
"Ne",
"ed",
" ",
"this",
" ",
"so",
" ",
"the",
" ",
"anon",
" ",
"csr",
"f",
" ",
"gets",
" ",
"set",
" ",
"for",
" ",
"watch",
" ",
"forms",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"question",
"\\u",
"details_",
"(_",
"request_",
",_",
"template_",
",_",
"question",
"\\u",
"id_",
",_",
"form_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"watch",
"\\u",
"form_",
"=_",
"None_",
",_",
"answer",
"\\u",
"preview_",
"=_",
"None_",
",_",
"**_",
"extra",
"\\u",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"View",
" ",
"the",
" ",
"answer",
"s",
" ",
"to",
" ",
"a",
" ",
"question",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ans",
"\\u_",
"=_",
"\\u",
"answer",
"s",
"\\u",
"data_",
"(_",
"request_",
",_",
"question",
"\\u",
"id_",
",_",
"form_",
",_",
"watch",
"\\u",
"form_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"answer",
"\\u",
"preview_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"question_",
"=_",
"ans",
"\\u_",
"[_",
"'",
"question",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"question_",
"._",
"is",
"\\u",
"spam_",
"and_",
"not_",
"request_",
"._",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"'",
"flag",
"it",
".",
"can",
"\\u",
"moderate",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Http404_",
"(_",
"'",
"No",
" ",
"question",
" ",
"matche",
"s",
" ",
"the",
" ",
"give",
"n",
" ",
"query",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Tr",
"y",
" ",
"to",
" ",
"parse",
" ",
"trouble",
"shoot",
"ing",
" ",
"data",
" ",
"as",
" ",
"JSO",
"N",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"trouble",
"shoot",
"ing",
"\\u",
"json_",
"=_",
"question_",
"._",
"metadata_",
"._",
"get_",
"(_",
"'",
"trouble",
"shoot",
"ing",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"question_",
"._",
"metadata_",
"[_",
"'",
"trouble",
"shoot",
"ing",
"\\u",
"parsed",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"parse",
"\\u",
"trouble",
"shoot",
"ing_",
"(_",
"trouble",
"shoot",
"ing",
"\\u",
"json_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"request_",
"._",
"user_",
"._",
"is",
"\\u",
"authenticated_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ct_",
"=_",
"Conten",
"t",
"Type_",
"._",
"objects_",
"._",
"get",
"\\u",
"for",
"\\u",
"model_",
"(_",
"request_",
"._",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ans",
"\\u_",
"[_",
"'",
"images",
"'_",
"]_",
"=_",
"Image",
"Attachment_",
"._",
"objects_",
"._",
"filter_",
"(_",
"creator_",
"=_",
"request_",
"._",
"user_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"ct_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"extra",
"\\u",
"kwargs_",
"._",
"update_",
"(_",
"ans",
"\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"products_",
"=_",
"Product_",
"._",
"objects_",
"._",
"filter_",
"(_",
"visible_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"topics_",
"=_",
"topic",
"s",
"\\u",
"for_",
"(_",
"product_",
"=_",
"question_",
"._",
"product_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"relate",
"d\\u",
"documents_",
"=_",
"question_",
"._",
"relate",
"d\\u",
"documents_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"relate",
"d\\u",
"questions_",
"=_",
"question_",
"._",
"relate",
"d\\u",
"questions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra",
"\\u",
"kwargs_",
"._",
"update_",
"(_",
"{_",
"'",
"all",
"\\u",
"products",
"'_",
":_",
"products_",
",_",
"'",
"all",
"\\u",
"topic",
"s",
"'_",
":_",
"topics_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"product",
"'_",
":_",
"question_",
"._",
"product_",
",_",
"'",
"topic",
"'_",
":_",
"question_",
"._",
"topic_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"relate",
"d\\u",
"document",
"s",
"'_",
":_",
"relate",
"d\\u",
"documents_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"relate",
"d\\u",
"question",
"s",
"'_",
":_",
"relate",
"d\\u",
"questions_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"request_",
"._",
"MOB",
"ILE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"noin",
"dex",
" ",
"to",
" ",
"question",
"s",
" ",
"with",
"out",
" ",
"a",
" ",
"solut",
"ion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"question_",
"._",
"solut",
"ion",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"extra",
"\\u",
"kwargs_",
"._",
"update_",
"(_",
"robots",
"\\u",
"noin",
"dex_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"render_",
"(_",
"request_",
",_",
"template_",
",_",
"extra",
"\\u",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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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
] |
Testing equality to None | eldarion-gondor/pykube/pykube/config.py | [
{
"content": " @classmethod\n def from_service_account(cls, path=\"/var/run/secrets/kubernetes.io/serviceaccount\"):\n with open(os.path.join(path, \"token\")) as fp:\n token = fp.read()\n host = os.environ.get(\"PYKUBE_KUBERNETES_SERVICE_HOST\")\n if host is None:\n host = os.environ[\"KUBERNETES_SERVICE_HOST\"]\n port = os.environ.get(\"PYKUBE_KUBERNETES_SERVICE_PORT\")\n if port is None:\n port = os.environ[\"KUBERNETES_SERVICE_PORT\"]\n doc = {\n \"clusters\": [\n {\n \"name\": \"self\",\n \"cluster\": {\n \"server\": \"https://{}:{}\".format(host, port),\n \"certificate-authority\": os.path.join(path, \"ca.crt\"),\n },\n },\n ],\n \"users\": [\n {\n \"name\": \"self\",\n \"user\": {\n \"token\": token,\n },\n },\n ],\n \"contexts\": [\n {\n \"name\": \"self\",\n \"context\": {\n \"cluster\": \"self\",\n \"user\": \"self\",\n },\n }\n ],\n \"current-context\": \"self\",\n }\n self = cls(doc)\n return self",
"metadata": "root.KubeConfig.from_service_account",
"header": "['class', 'KubeConfig', '(', 'object', ')', ':', '___EOS___']",
"index": 19
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Ku",
"be",
"Config_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"from",
"\\u",
"service",
"\\u",
"account_",
"(_",
"cls_",
",_",
"path_",
"=_",
"\"/",
"var",
"/",
"run",
"/",
"secret",
"s",
"/",
"kubernetes",
".",
"io",
"/",
"service",
"account",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"path_",
",_",
"\"",
"token",
"\"_",
")_",
")_",
"as_",
"fp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"token_",
"=_",
"fp_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"host_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"\"",
"PY",
"KU",
"BE",
"\\u",
"KU",
"BER",
"NET",
"ES",
"\\u",
"SERV",
"ICE",
"\\u",
"HOST",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"host_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"host_",
"=_",
"os_",
"._",
"environ_",
"[_",
"\"",
"KU",
"BER",
"NET",
"ES",
"\\u",
"SERV",
"ICE",
"\\u",
"HOST",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"port_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"\"",
"PY",
"KU",
"BE",
"\\u",
"KU",
"BER",
"NET",
"ES",
"\\u",
"SERV",
"ICE",
"\\u",
"PORT",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"port_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"port_",
"=_",
"os_",
"._",
"environ_",
"[_",
"\"",
"KU",
"BER",
"NET",
"ES",
"\\u",
"SERV",
"ICE",
"\\u",
"PORT",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"doc_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cluster",
"s",
"\"_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cluster",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"server",
"\"_",
":_",
"\"",
"https",
"://{}",
":{}\"_",
"._",
"format_",
"(_",
"host_",
",_",
"port_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"certifica",
"te",
"-",
"authori",
"ty",
"\"_",
":_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"path_",
",_",
"\"",
"ca",
".",
"crt",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"users",
"\"_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"user",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"token",
"\"_",
":_",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"context",
"s",
"\"_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"context",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cluster",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"user",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"current",
"-",
"context",
"\"_",
":_",
"\"",
"self",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"=_",
"cls_",
"(_",
"doc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
First parameter of a method is not named 'self' | goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/orm/relationships.py | [
{
"content": " def _set_cascade(self, cascade):\n cascade = CascadeOptions(cascade)\n if 'mapper' in self.__dict__:\n self._check_cascade_settings(cascade)\n self._cascade = cascade\n\n if self._dependency_processor:\n self._dependency_processor.cascade = cascade",
"metadata": "root.RelationshipProperty._set_cascade",
"header": "['class', 'RelationshipProperty', '(', 'StrategizedProperty', ')', ':', '___EOS___']",
"index": 1668
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Relationship",
"Property_",
"(_",
"Strat",
"egi",
"zed",
"Property_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"set\\u",
"cascade_",
"(_",
"self_",
",_",
"cascade_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cascade_",
"=_",
"Casca",
"de",
"Options_",
"(_",
"cascade_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"mapper",
"'_",
"in_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"check",
"\\u",
"cascade",
"\\u",
"settings_",
"(_",
"cascade_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"cascade_",
"=_",
"cascade_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"dependen",
"cy",
"\\u",
"processor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"dependen",
"cy",
"\\u",
"processor_",
"._",
"cascade_",
"=_",
"cascade_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | basho/riak-python-client/riak/tests/test_btypes.py | [
{
"content": " def test_multiget_bucket_types(self):\n btype = self.client.bucket_type('no_siblings')\n bucket = btype.bucket(self.bucket_name)\n\n for i in range(100):\n obj = bucket.new(self.key_name + str(i))\n obj.data = {'id': i}\n obj.store()\n\n mget = bucket.multiget([self.key_name + str(i) for i in range(100)])\n for mobj in mget:\n self.assertIsInstance(mobj, RiakObject)\n self.assertEqual(bucket, mobj.bucket)\n self.assertEqual(btype, mobj.bucket.bucket_type)",
"metadata": "root.BucketTypeTests.test_multiget_bucket_types",
"header": "['class', 'BucketTypeTests', '(', 'IntegrationTestBase', ',', 'unittest', '.', 'TestCase', ',', 'Comparison', ')', ':', '___EOS___']",
"index": 137
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Buck",
"et",
"Type",
"Tests_",
"(_",
"Integrati",
"on",
"Test",
"Base_",
",_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Compari",
"son_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"multi",
"get",
"\\u",
"bucket",
"\\u",
"types_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bt",
"ype_",
"=_",
"self_",
"._",
"client_",
"._",
"bucket",
"\\u",
"type_",
"(_",
"'",
"no",
"\\u",
"siblings",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bucket_",
"=_",
"bt",
"ype_",
"._",
"bucket_",
"(_",
"self_",
"._",
"bucket",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"100_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"obj_",
"=_",
"bucket_",
"._",
"new_",
"(_",
"self_",
"._",
"key",
"\\u",
"name_",
"+_",
"str_",
"(_",
"i_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj_",
"._",
"data_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"i_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj_",
"._",
"store_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mg",
"et_",
"=_",
"bucket_",
"._",
"multi",
"get_",
"(_",
"[_",
"self_",
"._",
"key",
"\\u",
"name_",
"+_",
"str_",
"(_",
"i_",
")_",
"for_",
"i_",
"in_",
"range_",
"(_",
"100_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"mobj_",
"in_",
"mg",
"et_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"mobj_",
",_",
"Ri",
"ak",
"Object_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bucket_",
",_",
"mobj_",
"._",
"bucket_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"bt",
"ype_",
",_",
"mobj_",
"._",
"bucket_",
"._",
"bucket",
"\\u",
"type_",
")_",
"\\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
] |
First parameter of a method is not named 'self' | rossant/ipymd/ipymd/formats/python.py | [
{
"content": " def parse_text_var(self, m):\n self.append(m.group(0))",
"metadata": "root.PythonSplitLexer.parse_text_var",
"header": "['class', 'PythonSplitLexer', '(', 'BaseLexer', ')', ':', '___EOS___']",
"index": 78
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Pyth",
"on",
"Split",
"Lexer_",
"(_",
"Base",
"Lexer_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"parse",
"\\u",
"text",
"\\u",
"var_",
"(_",
"self_",
",_",
"m_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"append_",
"(_",
"m_",
"._",
"group_",
"(_",
"0_",
")_",
")_",
"\\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
] |
Unused import | openstack/rally/tests/unit/plugins/openstack/context/nova/test_keypairs.py | [
{
"content": "# Copyright 2014: Rackspace UK\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport mock\n\nfrom rally.plugins.openstack.context.nova import keypairs\nfrom tests.unit import test\n\nCTX = \"rally.plugins.openstack.context.nova\"\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class KeyPairContextTestCase(test.TestCase):\n\n\n\n",
"metadata": "root.KeyPairContextTestCase",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": " def setUp(self):\n super(KeyPairContextTestCase, self).setUp()\n self.users = 2\n\n task = {\"uuid\": \"foo_task_id\"}\n self.ctx_with_keys = {\n \"users\": [\n {\n \"keypair\": {\n \"id\": \"key_id_1\",\n \"key\": \"key_1\",\n \"name\": \"key_name_1\"\n },\n \"credential\": \"credential_1\"\n },\n {\n \"keypair\": {\n \"id\": \"key_id_2\",\n \"key\": \"key_2\",\n \"name\": \"key_name_2\"\n },\n \"credential\": \"credential_2\"\n },\n ],\n \"task\": task\n }\n self.ctx_without_keys = {\n \"users\": [{\"credential\": \"credential_1\"},\n {\"credential\": \"credential_2\"}],\n \"task\": task\n }",
"metadata": "root.KeyPairContextTestCase.setUp",
"header": "['class', 'KeyPairContextTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def test_keypair_setup(self):\n keypair_ctx = keypairs.Keypair(self.ctx_without_keys)\n keypair_ctx._generate_keypair = mock.Mock(side_effect=[\n {\"id\": \"key_id_1\", \"key\": \"key_1\", \"name\": \"key_name_1\"},\n {\"id\": \"key_id_2\", \"key\": \"key_2\", \"name\": \"key_name_2\"},\n ])\n\n keypair_ctx.setup()\n self.assertEqual(keypair_ctx.context, self.ctx_with_keys)\n\n keypair_ctx._generate_keypair.assert_has_calls(\n [mock.call(\"credential_1\"), mock.call(\"credential_2\")])",
"metadata": "root.KeyPairContextTestCase.test_keypair_setup",
"header": "['class', 'KeyPairContextTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 57
},
{
"content": " @mock.patch(\"%s.keypairs.resource_manager.cleanup\" % CTX)\n def test_keypair_cleanup(self, mock_cleanup):\n keypair_ctx = keypairs.Keypair(self.ctx_with_keys)\n keypair_ctx.cleanup()\n mock_cleanup.assert_called_once_with(names=[\"nova.keypairs\"],\n users=self.ctx_with_keys[\"users\"])",
"metadata": "root.KeyPairContextTestCase.test_keypair_cleanup",
"header": "['class', 'KeyPairContextTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 70
},
{
"content": " @mock.patch(\"rally.osclients.Clients\")\n def test_keypair_generate(self, mock_clients):\n mock_keypairs = mock_clients.return_value.nova.return_value.keypairs\n mock_keypair = mock_keypairs.create.return_value\n mock_keypair.public_key = \"public_key\"\n mock_keypair.private_key = \"private_key\"\n mock_keypair.id = \"key_id\"\n keypair_ctx = keypairs.Keypair(self.ctx_without_keys)\n keypair_ctx.generate_random_name = mock.Mock()\n key = keypair_ctx._generate_keypair(\"credential\")\n\n self.assertEqual({\n \"id\": \"key_id\",\n \"name\": keypair_ctx.generate_random_name.return_value,\n \"private\": \"private_key\",\n \"public\": \"public_key\"\n }, key)\n\n mock_clients.assert_has_calls([\n mock.call().nova().keypairs.delete(\n keypair_ctx.generate_random_name.return_value),\n mock.call().nova().keypairs.create(\n keypair_ctx.generate_random_name.return_value)\n ])",
"metadata": "root.KeyPairContextTestCase.test_keypair_generate",
"header": "['class', 'KeyPairContextTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 77
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2014",
":",
" ",
"Rack",
"space",
" ",
"UK",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"rally",
"_",
"._",
"plugins_",
"._",
"openstack_",
"._",
"context_",
"._",
"nova_",
"import_",
"keypairs",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"._",
"unit_",
"import_",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CT",
"X_",
"=_",
"\"",
"rally",
".",
"plugin",
"s",
".",
"openst",
"ack",
".",
"context",
".",
"nova",
"\"_",
"\\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_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
"(_",
"test_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
"(_",
"test_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
",_",
"self_",
")_",
"._",
"set",
"Up_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"users_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"task_",
"=_",
"{_",
"\"",
"uuid",
"\"_",
":_",
"\"",
"foo",
"\\u",
"task",
"\\u",
"id",
"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ctx",
"\\u",
"with",
"\\u",
"keys_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"users",
"\"_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"keypa",
"ir",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"id",
"\"_",
":_",
"\"",
"key",
"\\u",
"id",
"\\u",
"1",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"key",
"\"_",
":_",
"\"",
"key",
"\\u",
"1",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"\"",
"key",
"\\u",
"name",
"\\u",
"1",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cred",
"ential",
"\"_",
":_",
"\"",
"cred",
"ential",
"\\u",
"1",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"keypa",
"ir",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"id",
"\"_",
":_",
"\"",
"key",
"\\u",
"id",
"\\u",
"2",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"key",
"\"_",
":_",
"\"",
"key",
"\\u",
"2",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"\"",
"key",
"\\u",
"name",
"\\u",
"2",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cred",
"ential",
"\"_",
":_",
"\"",
"cred",
"ential",
"\\u",
"2",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"task",
"\"_",
":_",
"task_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ctx",
"\\u",
"with",
"out",
"\\u",
"keys_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"users",
"\"_",
":_",
"[_",
"{_",
"\"",
"cred",
"ential",
"\"_",
":_",
"\"",
"cred",
"ential",
"\\u",
"1",
"\"_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\"",
"cred",
"ential",
"\"_",
":_",
"\"",
"cred",
"ential",
"\\u",
"2",
"\"_",
"}_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"task",
"\"_",
":_",
"task_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
"(_",
"test_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"keypa",
"ir",
"\\u",
"setup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"keypa",
"ir",
"\\u",
"ctx_",
"=_",
"keypairs",
"_",
"._",
"Keyp",
"air_",
"(_",
"self_",
"._",
"ctx",
"\\u",
"with",
"out",
"\\u",
"keys_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"\\u",
"generat",
"e\\u",
"keypair_",
"=_",
"mock_",
"._",
"Mock_",
"(_",
"side",
"\\u",
"effect_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\"",
"id",
"\"_",
":_",
"\"",
"key",
"\\u",
"id",
"\\u",
"1",
"\"_",
",_",
"\"",
"key",
"\"_",
":_",
"\"",
"key",
"\\u",
"1",
"\"_",
",_",
"\"",
"name",
"\"_",
":_",
"\"",
"key",
"\\u",
"name",
"\\u",
"1",
"\"_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\"",
"id",
"\"_",
":_",
"\"",
"key",
"\\u",
"id",
"\\u",
"2",
"\"_",
",_",
"\"",
"key",
"\"_",
":_",
"\"",
"key",
"\\u",
"2",
"\"_",
",_",
"\"",
"name",
"\"_",
":_",
"\"",
"key",
"\\u",
"name",
"\\u",
"2",
"\"_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"context_",
",_",
"self_",
"._",
"ctx",
"\\u",
"with",
"\\u",
"keys_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"\\u",
"generat",
"e\\u",
"keypair_",
"._",
"assert",
"\\u",
"has",
"\\u",
"calls_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"mock_",
"._",
"call_",
"(_",
"\"",
"cred",
"ential",
"\\u",
"1",
"\"_",
")_",
",_",
"mock_",
"._",
"call_",
"(_",
"\"",
"cred",
"ential",
"\\u",
"2",
"\"_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
"(_",
"test_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"\"%",
"s",
".",
"keypairs",
".",
"resource",
"\\u",
"manage",
"r",
".",
"clean",
"up",
"\"_",
"%_",
"CT",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"keypa",
"ir",
"\\u",
"cleanup_",
"(_",
"self_",
",_",
"mock",
"\\u",
"cleanup_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"keypa",
"ir",
"\\u",
"ctx_",
"=_",
"keypairs",
"_",
"._",
"Keyp",
"air_",
"(_",
"self_",
"._",
"ctx",
"\\u",
"with",
"\\u",
"keys_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"cleanup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"cleanup_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"names_",
"=_",
"[_",
"\"",
"nova",
".",
"keypairs",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"users_",
"=_",
"self_",
"._",
"ctx",
"\\u",
"with",
"\\u",
"keys_",
"[_",
"\"",
"users",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Key",
"Pair",
"Context",
"Test",
"Case_",
"(_",
"test_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"\"",
"rally",
".",
"osc",
"lien",
"ts",
".",
"Client",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"keypa",
"ir",
"\\u",
"generate_",
"(_",
"self_",
",_",
"mock",
"\\u",
"clients_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"keypairs",
"_",
"=_",
"mock",
"\\u",
"clients_",
"._",
"return",
"\\u",
"value_",
"._",
"nova_",
"._",
"return",
"\\u",
"value_",
"._",
"keypairs",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"keypair_",
"=_",
"mock",
"\\u",
"keypairs",
"_",
"._",
"create_",
"._",
"return",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"keypair_",
"._",
"public",
"\\u",
"key_",
"=_",
"\"",
"public",
"\\u",
"key",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"keypair_",
"._",
"private",
"\\u",
"key_",
"=_",
"\"",
"private",
"\\u",
"key",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"keypair_",
"._",
"id_",
"=_",
"\"",
"key",
"\\u",
"id",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"=_",
"keypairs",
"_",
"._",
"Keyp",
"air_",
"(_",
"self_",
"._",
"ctx",
"\\u",
"with",
"out",
"\\u",
"keys_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"generat",
"e\\u",
"random",
"\\u",
"name_",
"=_",
"mock_",
"._",
"Mock_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key_",
"=_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"\\u",
"generat",
"e\\u",
"keypair_",
"(_",
"\"",
"cred",
"ential",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"id",
"\"_",
":_",
"\"",
"key",
"\\u",
"id",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"generat",
"e\\u",
"random",
"\\u",
"name_",
"._",
"return",
"\\u",
"value_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"private",
"\"_",
":_",
"\"",
"private",
"\\u",
"key",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"public",
"\"_",
":_",
"\"",
"public",
"\\u",
"key",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"clients_",
"._",
"assert",
"\\u",
"has",
"\\u",
"calls_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"._",
"call_",
"(_",
")_",
"._",
"nova_",
"(_",
")_",
"._",
"keypairs",
"_",
"._",
"delete_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"keypa",
"ir",
"\\u",
"ctx_",
"._",
"generat",
"e\\u",
"random",
"\\u",
"name_",
"._",
"return",
"\\u",
"value_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | shellderp/sublime-robot-plugin/lib/robot/variables/__init__.py | [
{
"content": "# Copyright 2008-2012 Nokia Siemens Networks Oyj\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\"\"\"Implements handling and resolving of variables.\n\nThis package is likely to change radically in RF 2.8. External code should use\nfunctionality provided directly by this package with care.\n\"\"\"\n\nimport os\nimport tempfile\n\nfrom robot import utils\nfrom robot.output import LOGGER\n\nfrom .isvar import is_var, is_scalar_var, is_list_var\nfrom .variables import Variables\nfrom .variableassigner import VariableAssigner\nfrom .variablesplitter import VariableSplitter\n\n\nGLOBAL_VARIABLES = Variables()\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def init_global_variables(settings):\n GLOBAL_VARIABLES.clear()\n _set_cli_vars(settings)\n for name, value in [ ('${TEMPDIR}', utils.abspath(tempfile.gettempdir())),\n ('${EXECDIR}', utils.abspath('.')),\n ('${/}', os.sep),\n ('${:}', os.pathsep),\n ('${\\\\n}', os.linesep),\n ('${SPACE}', ' '),\n ('${EMPTY}', ''),\n ('@{EMPTY}', ()),\n ('${True}', True),\n ('${False}', False),\n ('${None}', None),\n ('${null}', None),\n ('${OUTPUT_DIR}', settings['OutputDir']),\n ('${OUTPUT_FILE}', settings['Output']),\n ('${REPORT_FILE}', settings['Report']),\n ('${LOG_FILE}', settings['Log']),\n ('${DEBUG_FILE}', settings['DebugFile']),\n ('${PREV_TEST_NAME}', ''),\n ('${PREV_TEST_STATUS}', ''),\n ('${PREV_TEST_MESSAGE}', '') ]:\n GLOBAL_VARIABLES[name] = value",
"metadata": "root.init_global_variables",
"header": "['module', '___EOS___']",
"index": 35
},
{
"content": "def _set_cli_vars(settings):\n for path, args in settings['VariableFiles']:\n try:\n GLOBAL_VARIABLES.set_from_file(path, args)\n except:\n msg, details = utils.get_error_details()\n LOGGER.error(msg)\n LOGGER.info(details)\n for varstr in settings['Variables']:\n try:\n name, value = varstr.split(':', 1)\n except ValueError:\n name, value = varstr, ''\n GLOBAL_VARIABLES['${%s}' % name] = value",
"metadata": "root._set_cli_vars",
"header": "['module', '___EOS___']",
"index": 61
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"2008",
"-",
"2012",
" ",
"No",
"kia",
" ",
"Sie",
"mens",
" ",
"Network",
"s",
" ",
"O",
"yj",
"_",
"\\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_",
"\"\"\"",
"Impl",
"ement",
"s",
" ",
"handling",
" ",
"and",
" ",
"resolv",
"ing",
" ",
"of",
" ",
"variab",
"les",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"package",
" ",
"is",
" ",
"like",
"ly",
" ",
"to",
" ",
"change",
" ",
"radic",
"ally",
" ",
"in",
" ",
"RF",
" ",
"2.8",
".",
" ",
"Exter",
"nal",
" ",
"code",
" ",
"shou",
"ld",
" ",
"use",
"\\",
"10",
";",
"functional",
"it",
"y",
" ",
"provided",
" ",
"direct",
"ly",
" ",
"by",
" ",
"this",
" ",
"package",
" ",
"with",
" ",
"care",
".",
"\\",
"10",
";\"\"\"_",
"\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"robot_",
"import_",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"robot_",
"._",
"output_",
"import_",
"LOGGER_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"is",
"var_",
"import_",
"is",
"\\u",
"var_",
",_",
"is",
"\\u",
"scala",
"r",
"\\u",
"var_",
",_",
"is",
"\\u",
"list",
"\\u",
"var_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"variables_",
"import_",
"Variables_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"variab",
"leas",
"signer_",
"import_",
"Varia",
"ble",
"Assign",
"er_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"variab",
"les",
"plit",
"ter_",
"import_",
"Varia",
"ble",
"Splitter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"GLOB",
"AL",
"\\u",
"VARIABLES",
"_",
"=_",
"Variables_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"init",
"\\u",
"global",
"\\u",
"variables_",
"(_",
"settings_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"GLOB",
"AL",
"\\u",
"VARIABLES",
"_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"set\\u",
"cli",
"\\u",
"vars_",
"(_",
"settings_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"name_",
",_",
"value_",
"in_",
"[_",
"(_",
"'$",
"{",
"TEMP",
"DIR",
"}'_",
",_",
"utils_",
"._",
"abspath_",
"(_",
"tempfile_",
"._",
"gettempdir_",
"(_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"EXEC",
"DIR",
"}'_",
",_",
"utils_",
"._",
"abspath_",
"(_",
"'.'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"/",
"}'_",
",_",
"os_",
"._",
"sep_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{:",
"}'_",
",_",
"os_",
"._",
"pathsep_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{\\\\",
"\\\\",
"n",
"}'_",
",_",
"os_",
"._",
"linesep_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"SPACE",
"}'_",
",_",
"'",
" ",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"EMP",
"TY",
"}'_",
",_",
"''_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'@",
"{",
"EMP",
"TY",
"}'_",
",_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"Tru",
"e",
"}'_",
",_",
"True_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"Fal",
"se",
"}'_",
",_",
"False_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"Non",
"e",
"}'_",
",_",
"None_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"null",
"}'_",
",_",
"None_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"OUTPU",
"T",
"\\u",
"DIR",
"}'_",
",_",
"settings_",
"[_",
"'",
"Output",
"Dir",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"OUTPU",
"T",
"\\u",
"FILE",
"}'_",
",_",
"settings_",
"[_",
"'",
"Output",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"REPORT",
"\\u",
"FILE",
"}'_",
",_",
"settings_",
"[_",
"'",
"Report",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"LOG",
"\\u",
"FILE",
"}'_",
",_",
"settings_",
"[_",
"'",
"Log",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"DEBU",
"G",
"\\u",
"FILE",
"}'_",
",_",
"settings_",
"[_",
"'",
"Deb",
"ug",
"File",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"PRE",
"V",
"\\u",
"TEST",
"\\u",
"NAME",
"}'_",
",_",
"''_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"PRE",
"V",
"\\u",
"TEST",
"\\u",
"STATUS",
"}'_",
",_",
"''_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'$",
"{",
"PRE",
"V",
"\\u",
"TEST",
"\\u",
"MESSAGE",
"}'_",
",_",
"''_",
")_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"GLOB",
"AL",
"\\u",
"VARIABLES",
"_",
"[_",
"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_",
"def_",
"\\u",
"set\\u",
"cli",
"\\u",
"vars_",
"(_",
"settings_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"path_",
",_",
"args_",
"in_",
"settings_",
"[_",
"'",
"Varia",
"ble",
"Files",
"'_",
"]_",
":_",
"\\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 ",
" _",
"GLOB",
"AL",
"\\u",
"VARIABLES",
"_",
"._",
"set\\u",
"from",
"\\u",
"file_",
"(_",
"path_",
",_",
"args_",
")_",
"\\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 ",
" _",
"msg_",
",_",
"details_",
"=_",
"utils_",
"._",
"get",
"\\u",
"error",
"\\u",
"details_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOGGER_",
"._",
"error_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOGGER_",
"._",
"info_",
"(_",
"details_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"vars",
"tr_",
"in_",
"settings_",
"[_",
"'",
"Varia",
"bles",
"'_",
"]_",
":_",
"\\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 ",
" _",
"name_",
",_",
"value_",
"=_",
"vars",
"tr_",
"._",
"split_",
"(_",
"':'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
",_",
"value_",
"=_",
"vars",
"tr_",
",_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"GLOB",
"AL",
"\\u",
"VARIABLES",
"_",
"[_",
"'$",
"{%",
"s",
"}'_",
"%_",
"name_",
"]_",
"=_",
"value_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | kayhayen/Nuitka/nuitka/tree/ReformulationImportStatements.py | [
{
"content": "# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com\n#\n# Part of \"Nuitka\", an optimizing Python compiler that is compatible and\n# integrates with CPython, but also works on its own.\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\"\"\" Reformulation of import statements.\n\nConsult the developer manual for information. TODO: Add ability to sync\nsource code comments with developer manual sections.\n\n\"\"\"\n\nfrom nuitka import Options\nfrom nuitka.nodes.AssignNodes import (\n ExpressionTargetVariableRef,\n StatementAssignmentVariable\n)\nfrom nuitka.nodes.ImportNodes import (\n ExpressionImportModule,\n ExpressionImportModuleHard,\n ExpressionImportName,\n StatementImportStar\n)\nfrom nuitka.nodes.StatementNodes import StatementsSequence\nfrom nuitka.PythonVersions import python_version\nfrom nuitka.tree import SyntaxErrors\n\nfrom .Helpers import mangleName\n\n# For checking afterwards, if __future__ imports really were at the beginning\n# of the file.\n_future_import_nodes = []\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def checkFutureImportsOnlyAtStart(body):\n # Check if a __future__ imports really were at the beginning of the file.\n for node in body:\n if node in _future_import_nodes:\n _future_import_nodes.remove(node)\n else:\n if _future_import_nodes:\n SyntaxErrors.raiseSyntaxError(\n reason = \"\"\"\\\nfrom __future__ imports must occur at the beginning of the file\"\"\",\n col_offset = 1\n if python_version >= 300 or \\\n not Options.isFullCompat() else\n None,\n source_ref = _future_import_nodes[0].source_ref\n )",
"metadata": "root.checkFutureImportsOnlyAtStart",
"header": "['module', '___EOS___']",
"index": 45
},
{
"content": "def buildImportFromNode(provider, node, source_ref):\n # \"from .. import ..\" statements. This may trigger a star import, or\n # multiple names being looked up from the given module variable name.\n\n module_name = node.module if node.module is not None else \"\"\n level = node.level\n\n # Importing from \"__future__\" module may enable flags to the parser,\n # that we need to know.\n if module_name == \"__future__\":\n # Future imports we see are all legal, and known to work.\n\n if not provider.isCompiledPythonModule():\n SyntaxErrors.raiseSyntaxError(\n reason = \"\"\"\\\nfrom __future__ imports must occur at the beginning of the file\"\"\",\n col_offset = 8\n if python_version >= 300 or \\\n not Options.isFullCompat()\n else None,\n source_ref = source_ref\n )\n\n\n for import_desc in node.names:\n object_name, _local_name = import_desc.name, import_desc.asname\n\n enableFutureFeature(\n object_name = object_name,\n future_spec = source_ref.getFutureSpec(),\n source_ref = source_ref\n )\n\n # Remember it for checks to be applied once module is complete.\n node.source_ref = source_ref\n _future_import_nodes.append(node)\n\n target_names = []\n import_names = []\n\n for import_desc in node.names:\n object_name, local_name = import_desc.name, import_desc.asname\n\n if object_name == '*':\n target_names.append(None)\n else:\n target_names.append(\n local_name\n if local_name is not None else\n object_name\n )\n\n import_names.append(object_name)\n\n if None in target_names:\n # More than \"*\" is a syntax error in Python, need not care about this at\n # all, it's only allowed value for import list in this case.\n assert target_names == [None]\n\n # Python3 made this a syntax error unfortunately.\n if not provider.isCompiledPythonModule() and python_version >= 300:\n SyntaxErrors.raiseSyntaxError(\n \"import * only allowed at module level\",\n provider.getSourceReference()\n )\n\n if provider.isExpressionFunctionBody():\n provider.markAsStarImportContaining()\n\n return StatementImportStar(\n module_import = ExpressionImportModule(\n module_name = module_name,\n import_list = ('*',),\n level = level,\n source_ref = source_ref\n ),\n source_ref = source_ref\n )\n else:\n # Make __future__ imports \"hard\" immediately, they cannot be any other\n # way.\n def makeImportName(import_name):\n if module_name == \"__future__\":\n return ExpressionImportModuleHard(\n module_name = \"__future__\",\n import_name = import_name,\n source_ref = source_ref\n )\n else:\n # TODO: This ought to use a temporary variable for multiple\n # names, instead of importing multiple times.\n\n return ExpressionImportName(\n module = ExpressionImportModule(\n module_name = module_name,\n import_list = tuple(import_names),\n level = level,\n source_ref = source_ref\n ),\n import_name = import_name,\n source_ref = source_ref\n )\n\n\n import_nodes = []\n\n for target_name, import_name in zip(target_names, import_names):\n import_nodes.append(\n StatementAssignmentVariable(\n variable_ref = ExpressionTargetVariableRef(\n variable_name = mangleName(target_name, provider),\n source_ref = source_ref\n ),\n source = makeImportName(\n import_name = import_name,\n ),\n source_ref = source_ref\n )\n )\n\n # Note: Each import is sequential. It can succeed, and the failure of a\n # later one is not changing one. We can therefore have a sequence of\n # imports that only import one thing therefore.\n return StatementsSequence(\n statements = import_nodes,\n source_ref = source_ref\n )",
"metadata": "root.buildImportFromNode",
"header": "['module', '___EOS___']",
"index": 63
},
{
"content": "def enableFutureFeature(object_name, future_spec, source_ref):\n if object_name == \"unicode_literals\":\n future_spec.enableUnicodeLiterals()\n elif object_name == \"absolute_import\":\n future_spec.enableAbsoluteImport()\n elif object_name == \"division\":\n future_spec.enableFutureDivision()\n elif object_name == \"print_function\":\n future_spec.enableFuturePrint()\n elif object_name == \"barry_as_FLUFL\" and python_version >= 300:\n future_spec.enableBarry()\n elif object_name == \"generator_stop\":\n future_spec.enableGeneratorStop()\n elif object_name == \"braces\":\n SyntaxErrors.raiseSyntaxError(\n \"not a chance\",\n source_ref\n )\n elif object_name in (\"nested_scopes\", \"generators\", \"with_statement\"):\n # These are enabled in all cases already.\n pass\n else:\n SyntaxErrors.raiseSyntaxError(\n \"future feature %s is not defined\" % object_name,\n source_ref\n )",
"metadata": "root.enableFutureFeature",
"header": "['module', '___EOS___']",
"index": 192
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2016",
",",
" ",
"Ka",
"y",
" ",
"Ha",
"yen",
",",
" ",
"mail",
"to",
":",
"ka",
"y",
".",
"hay",
"en",
"@",
"gma",
"il",
".",
"com_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Part",
" ",
"of",
" ",
"\"",
"Nu",
"itk",
"a",
"\",",
" ",
"an",
" ",
"optim",
"izi",
"ng",
" ",
"Pyth",
"on",
" ",
"compiler",
" ",
"tha",
"t",
" ",
"is",
" ",
"compatible",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"integrate",
"s",
" ",
"with",
" ",
"CP",
"yth",
"on",
",",
" ",
"but",
" ",
"als",
"o",
" ",
"works",
" ",
"on",
" ",
"its",
" ",
"own",
"._",
"\\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_",
"\"\"\"",
" ",
"Ref",
"orm",
"ulation",
" ",
"of",
" ",
"import",
" ",
"statem",
"ents",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Consult",
" ",
"the",
" ",
"developer",
" ",
"manu",
"al",
" ",
"for",
" ",
"informati",
"on",
".",
" ",
"TOD",
"O",
":",
" ",
"Add",
" ",
"abilit",
"y",
" ",
"to",
" ",
"sync",
"\\",
"10",
";",
"source",
" ",
"code",
" ",
"comment",
"s",
" ",
"with",
" ",
"developer",
" ",
"manu",
"al",
" ",
"section",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"import_",
"Options_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"._",
"nodes_",
"._",
"Assign",
"Nodes_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Expression",
"Target",
"Varia",
"ble",
"Ref_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"State",
"ment",
"Assign",
"ment",
"Variable_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"._",
"nodes_",
"._",
"Import",
"Nodes_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Expression",
"Import",
"Module_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Expression",
"Import",
"Modul",
"e",
"Hard",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Expression",
"Import",
"Name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"State",
"ment",
"Import",
"Star_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"._",
"nodes_",
"._",
"State",
"ment",
"Nodes_",
"import_",
"State",
"ment",
"s",
"Sequence_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"._",
"Pyth",
"on",
"Version",
"s_",
"import_",
"python",
"\\u",
"version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nu",
"itk",
"a_",
"._",
"tree_",
"import_",
"Syntax",
"Errors_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"Helpers_",
"import_",
"mangle",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"checking",
" ",
"after",
"ward",
"s",
",",
" ",
"if",
" ",
"\\u\\u",
"future",
"\\u\\u",
" ",
"import",
"s",
" ",
"reall",
"y",
" ",
"wer",
"e",
" ",
"at",
" ",
"the",
" ",
"beginn",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
"=_",
"[_",
"]_",
"\\u\\u\\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_",
"def_",
"check",
"Fu",
"ture",
"Imports",
"On",
"ly",
"At",
"Start_",
"(_",
"body_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"if",
" ",
"a",
" ",
"\\u\\u",
"future",
"\\u\\u",
" ",
"import",
"s",
" ",
"reall",
"y",
" ",
"wer",
"e",
" ",
"at",
" ",
"the",
" ",
"beginn",
"ing",
" ",
"of",
" ",
"the",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"node_",
"in_",
"body_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"node_",
"in_",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
"._",
"remove_",
"(_",
"node_",
")_",
"\\u\\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_",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Syntax",
"Errors_",
"._",
"raise",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reason_",
"=_",
"\"\"\"",
"\\\\",
"\\",
"10",
";",
"from",
" ",
"\\u\\u",
"future",
"\\u\\u",
" ",
"import",
"s",
" ",
"must",
" ",
"occur",
" ",
"at",
" ",
"the",
" ",
"beginn",
"ing",
" ",
"of",
" ",
"the",
" ",
"file",
"\"\"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"col",
"\\u",
"offset_",
"=_",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"python",
"\\u",
"version_",
">=_",
"300_",
"or_",
"not_",
"Options_",
"._",
"is",
"Full",
"Compat",
"_",
"(_",
")_",
"else_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
"[_",
"0_",
"]_",
"._",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"Import",
"Fro",
"m",
"Node_",
"(_",
"provider_",
",_",
"node_",
",_",
"source",
"\\u",
"ref_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"\"",
"from",
" ",
"..",
" ",
"import",
" ",
"..",
"\"",
" ",
"statem",
"ents",
".",
" ",
"Thi",
"s",
" ",
"may",
" ",
"trigger",
" ",
"a",
" ",
"star",
" ",
"import",
",",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"multiple",
" ",
"names",
" ",
"bei",
"ng",
" ",
"looke",
"d",
" ",
"up",
" ",
"from",
" ",
"the",
" ",
"give",
"n",
" ",
"module",
" ",
"variab",
"le",
" ",
"name",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"module",
"\\u",
"name_",
"=_",
"node_",
"._",
"module_",
"if_",
"node_",
"._",
"module_",
"is_",
"not_",
"None_",
"else_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"level_",
"=_",
"node_",
"._",
"level_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Import",
"ing",
" ",
"from",
" ",
"\"\\u\\u",
"future",
"\\u\\u\"",
" ",
"module",
" ",
"may",
" ",
"enable",
" ",
"flags",
" ",
"to",
" ",
"the",
" ",
"parser",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tha",
"t",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"know",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"module",
"\\u",
"name_",
"==_",
"\"\\u\\u",
"future",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fu",
"ture",
" ",
"import",
"s",
" ",
"we",
" ",
"see",
" ",
"are",
" ",
"all",
" ",
"lega",
"l",
",",
" ",
"and",
" ",
"know",
"n",
" ",
"to",
" ",
"work",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"provider_",
"._",
"is",
"Compiled",
"Pyth",
"on",
"Module_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Syntax",
"Errors_",
"._",
"raise",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reason_",
"=_",
"\"\"\"",
"\\\\",
"\\",
"10",
";",
"from",
" ",
"\\u\\u",
"future",
"\\u\\u",
" ",
"import",
"s",
" ",
"must",
" ",
"occur",
" ",
"at",
" ",
"the",
" ",
"beginn",
"ing",
" ",
"of",
" ",
"the",
" ",
"file",
"\"\"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"col",
"\\u",
"offset_",
"=_",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"python",
"\\u",
"version_",
">=_",
"300_",
"or_",
"not_",
"Options_",
"._",
"is",
"Full",
"Compat",
"_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"else_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\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_",
"import",
"\\u",
"desc_",
"in_",
"node_",
"._",
"names_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object\\u",
"name_",
",_",
"\\u",
"local",
"\\u",
"name_",
"=_",
"import",
"\\u",
"desc_",
"._",
"name_",
",_",
"import",
"\\u",
"desc_",
"._",
"asn",
"ame_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"enable",
"Fu",
"ture",
"Feature_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"object\\u",
"name_",
"=_",
"object\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"future",
"\\u",
"spec_",
"=_",
"source",
"\\u",
"ref_",
"._",
"get",
"Fu",
"ture",
"Spec_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Reme",
"mber",
" ",
"it",
" ",
"for",
" ",
"checks",
" ",
"to",
" ",
"be",
" ",
"applied",
" ",
"onc",
"e",
" ",
"module",
" ",
"is",
" ",
"complete",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"node_",
"._",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"future",
"\\u",
"import",
"\\u",
"nodes_",
"._",
"append_",
"(_",
"node_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"target",
"\\u",
"names_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import",
"\\u",
"names_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"import",
"\\u",
"desc_",
"in_",
"node_",
"._",
"names_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object\\u",
"name_",
",_",
"local",
"\\u",
"name_",
"=_",
"import",
"\\u",
"desc_",
"._",
"name_",
",_",
"import",
"\\u",
"desc_",
"._",
"asn",
"ame_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"object\\u",
"name_",
"==_",
"'*'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"names_",
"._",
"append_",
"(_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"names_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"local",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"local",
"\\u",
"name_",
"is_",
"not_",
"None_",
"else_",
"\\u\\u\\uNL\\u\\u\\u_",
"object\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"import",
"\\u",
"names_",
"._",
"append_",
"(_",
"object\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"None_",
"in_",
"target",
"\\u",
"names_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Mor",
"e",
" ",
"than",
" ",
"\"*",
"\"",
" ",
"is",
" ",
"a",
" ",
"synta",
"x",
" ",
"error",
" ",
"in",
" ",
"Pyth",
"on",
",",
" ",
"need",
" ",
"not",
" ",
"care",
" ",
"abo",
"ut",
" ",
"this",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"all",
",",
" ",
"it",
"'",
"s",
" ",
"only",
" ",
"allow",
"ed",
" ",
"value",
" ",
"for",
" ",
"import",
" ",
"list",
" ",
"in",
" ",
" ",
"this",
" ",
"case",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"target",
"\\u",
"names_",
"==_",
"[_",
"None_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
"3",
" ",
"made",
" ",
"this",
" ",
"a",
" ",
"synta",
"x",
" ",
"error",
" ",
"unfo",
"rtu",
"nat",
"el",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"provider_",
"._",
"is",
"Compiled",
"Pyth",
"on",
"Module_",
"(_",
")_",
"and_",
"python",
"\\u",
"version_",
">=_",
"300_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Syntax",
"Errors_",
"._",
"raise",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"import",
" ",
"*",
" ",
"only",
" ",
"allow",
"ed",
" ",
"at",
" ",
"module",
" ",
"level",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"provider_",
"._",
"get",
"Sou",
"rce",
"Reference_",
"(_",
")_",
"\\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_",
"provider_",
"._",
"is",
"Expression",
"Function",
"Body_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"provider_",
"._",
"mark",
"As",
"Star",
"Import",
"Contain",
"ing_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"State",
"ment",
"Import",
"Star_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"module",
"\\u",
"import_",
"=_",
"Expression",
"Import",
"Module_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"module",
"\\u",
"name_",
"=_",
"module",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"import",
"\\u",
"list_",
"=_",
"(_",
"'*'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"level_",
"=_",
"level_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\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_",
"#",
" ",
"Make",
" ",
"\\u\\u",
"future",
"\\u\\u",
" ",
"import",
"s",
" ",
"\"",
"hard",
"\"",
" ",
"immediate",
"ly",
",",
" ",
"the",
"y",
" ",
"cann",
"ot",
" ",
"be",
" ",
"any",
" ",
"other_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"way",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"make",
"Import",
"Name_",
"(_",
"import",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"module",
"\\u",
"name_",
"==_",
"\"\\u\\u",
"future",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Expression",
"Import",
"Modul",
"e",
"Hard",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"module",
"\\u",
"name_",
"=_",
"\"\\u\\u",
"future",
"\\u\\u\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"import",
"\\u",
"name_",
"=_",
"import",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\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_",
"#",
" ",
"TOD",
"O",
":",
" ",
"Thi",
"s",
" ",
"ou",
"ght",
" ",
"to",
" ",
"use",
" ",
"a",
" ",
"temporar",
"y",
" ",
"variab",
"le",
" ",
"for",
" ",
"multiple_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"names",
",",
" ",
"inst",
"ead",
" ",
"of",
" ",
"import",
"ing",
" ",
"multiple",
" ",
"times",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Expression",
"Import",
"Name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"module_",
"=_",
"Expression",
"Import",
"Module_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"module",
"\\u",
"name_",
"=_",
"module",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"import",
"\\u",
"list_",
"=_",
"tuple_",
"(_",
"import",
"\\u",
"names_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"level_",
"=_",
"level_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"import",
"\\u",
"name_",
"=_",
"import",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\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_",
"import",
"\\u",
"nodes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"target",
"\\u",
"name_",
",_",
"import",
"\\u",
"name_",
"in_",
"zip_",
"(_",
"target",
"\\u",
"names_",
",_",
"import",
"\\u",
"names_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import",
"\\u",
"nodes_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"State",
"ment",
"Assign",
"ment",
"Variable_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"variab",
"le",
"\\u",
"ref_",
"=_",
"Expression",
"Target",
"Varia",
"ble",
"Ref_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"variab",
"le",
"\\u",
"name_",
"=_",
"mangle",
"Name_",
"(_",
"target",
"\\u",
"name_",
",_",
"provider_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source_",
"=_",
"make",
"Import",
"Name_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"import",
"\\u",
"name_",
"=_",
"import",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
":",
" ",
"Ea",
"ch",
" ",
"import",
" ",
"is",
" ",
"sequential",
".",
" ",
"It",
" ",
"can",
" ",
"succe",
"ed",
",",
" ",
"and",
" ",
"the",
" ",
"fail",
"ure",
" ",
"of",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"late",
"r",
" ",
"one",
" ",
"is",
" ",
"not",
" ",
"chang",
"ing",
" ",
"one",
".",
" ",
"We",
" ",
"can",
" ",
"there",
"fore",
" ",
"have",
" ",
"a",
" ",
"sequence",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"import",
"s",
" ",
"tha",
"t",
" ",
"only",
" ",
"import",
" ",
"one",
" ",
"thing",
" ",
"there",
"fore",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"State",
"ment",
"s",
"Sequence_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"statements_",
"=_",
"import",
"\\u",
"nodes_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"=_",
"source",
"\\u",
"ref_",
"\\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_",
"def_",
"enable",
"Fu",
"ture",
"Feature_",
"(_",
"object\\u",
"name_",
",_",
"future",
"\\u",
"spec_",
",_",
"source",
"\\u",
"ref_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"object\\u",
"name_",
"==_",
"\"",
"unicode",
"\\u",
"literal",
"s",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Unic",
"ode",
"Lite",
"ral",
"s_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"abs",
"olute",
"\\u",
"import",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Abs",
"olute",
"Import_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"divisi",
"on",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Fu",
"ture",
"Divis",
"ion_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"print",
"\\u",
"function",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Fu",
"ture",
"Print_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"barr",
"y",
"\\u",
"as",
"\\u",
"FLU",
"FL",
"\"_",
"and_",
"python",
"\\u",
"version_",
">=_",
"300_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Barr",
"y_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"generat",
"or",
"\\u",
"stop",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"future",
"\\u",
"spec_",
"._",
"enable",
"Generat",
"or",
"Stop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"==_",
"\"",
"braces",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Syntax",
"Errors_",
"._",
"raise",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"not",
" ",
"a",
" ",
"chan",
"ce",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"object\\u",
"name_",
"in_",
"(_",
"\"",
"nest",
"ed",
"\\u",
"scope",
"s",
"\"_",
",_",
"\"",
"generat",
"ors",
"\"_",
",_",
"\"",
"with",
"\\u",
"statem",
"ent",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"are",
" ",
"enable",
"d",
" ",
"in",
" ",
"all",
" ",
"case",
"s",
" ",
"alr",
"ead",
"y",
"._",
"\\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_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Syntax",
"Errors_",
"._",
"raise",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"future",
" ",
"feature",
" ",
"%",
"s",
" ",
"is",
" ",
"not",
" ",
"defin",
"ed",
"\"_",
"%_",
"object\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"ref_",
"\\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,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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
] |
Unused import | twitter/pycascading/python/pycascading/cogroup.py | [
{
"content": "#\n# Copyright 2011 Twitter, Inc.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"Operations related to a CoGroup pipe.\"\"\"\n\n__author__ = 'Gabor Szabo'\n\n\nimport cascading.pipe\nimport cascading.pipe.cogroup\nimport cascading.operation\n\nfrom pycascading.pipe import Operation, coerce_to_fields, _Stackable\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CoGroup(Operation):\n\n \"\"\"CoGroup two or more streams on common fields.\n\n This is a PyCascading wrapper around a Cascading CoGroup.\n \"\"\"\n\n\n",
"metadata": "root.CoGroup",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": " def __init__(self, *args, **kwargs):\n \"\"\"Create a Cascading CoGroup pipe.\n\n Arguments:\n args[0] -- the fields on which to join\n\n Keyword arguments:\n group_name -- the groupName parameter for Cascading\n group_fields -- the fields on which to group\n declared_fields -- the declaredFields parameter for Cascading\n result_group_fields -- the resultGroupFields parameter for Cascading\n joiner -- the joiner parameter for Cascading\n num_self_joins -- the numSelfJoins parameter for Cascading\n lhs -- the lhs parameter for Cascading\n lhs_group_fields -- the lhsGroupFields parameter for Cascading\n rhs -- the rhs parameter for Cascading\n rhs_group_fields -- the rhsGroupFields parameter for Cascading\n \"\"\"\n Operation.__init__(self)\n self.__args = args\n self.__kwargs = kwargs",
"metadata": "root.CoGroup.__init__",
"header": "['class', 'CoGroup', '(', 'Operation', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def __create_args(self,\n group_name=None,\n pipes=None, group_fields=None, declared_fields=None,\n result_group_fields=None, joiner=None,\n pipe=None, num_self_joins=None,\n lhs=None, lhs_group_fields=None,\n rhs=None, rhs_group_fields=None):\n # We can use an unnamed parameter only for group_fields\n if self.__args:\n group_fields = [coerce_to_fields(f) for f in self.__args[0]]\n args = []\n if group_name:\n args.append(str(group_name))\n if lhs:\n args.append(lhs.get_assembly())\n args.append(coerce_to_fields(lhs_group_fields))\n args.append(rhs.get_assembly())\n args.append(coerce_to_fields(rhs_group_fields))\n if declared_fields:\n args.append(coerce_to_fields(declared_fields))\n if result_group_fields:\n args.append(coerce_to_fields(result_group_fields))\n if joiner:\n args.append(joiner)\n elif pipes:\n args.append([p.get_assembly() for p in pipes])\n if group_fields:\n args.append([coerce_to_fields(f) for f in group_fields])\n if declared_fields:\n args.append(coerce_to_fields(declared_fields))\n if result_group_fields:\n args.append(coerce_to_fields(result_group_fields))\n else:\n args.append(None)\n if joiner is None:\n joiner = cascading.pipe.cogroup.InnerJoin()\n args.append(joiner)\n elif pipe:\n args.append(pipe.get_assembly())\n args.append(coerce_to_fields(group_fields))\n args.append(int(num_self_joins))\n if declared_fields:\n args.append(coerce_to_fields(declared_fields))\n if result_group_fields:\n args.append(coerce_to_fields(result_group_fields))\n if joiner:\n args.append(joiner)\n return args",
"metadata": "root.CoGroup.__create_args",
"header": "['class', 'CoGroup', '(', 'Operation', ')', ':', '___EOS___']",
"index": 56
},
{
"content": " def _create_with_parent(self, parent):\n if isinstance(parent, _Stackable):\n args = self.__create_args(pipes=parent.stack, **self.__kwargs)\n else:\n args = self.__create_args(pipe=parent, **self.__kwargs)\n return cascading.pipe.CoGroup(*args)",
"metadata": "root.CoGroup._create_with_parent",
"header": "['class', 'CoGroup', '(', 'Operation', ')', ':', '___EOS___']",
"index": 105
},
{
"content": "def inner_join(*args, **kwargs):\n \"\"\"Shortcut for an inner join.\"\"\"\n kwargs['joiner'] = cascading.pipe.cogroup.InnerJoin()\n if not 'declared_fields' in kwargs:\n kwargs['declared_fields'] = None\n return CoGroup(*args, **kwargs)",
"metadata": "root.inner_join",
"header": "['module', '___EOS___']",
"index": 113
},
{
"content": "def outer_join(*args, **kwargs):\n \"\"\"Shortcut for an outer join.\"\"\"\n kwargs['joiner'] = cascading.pipe.cogroup.OuterJoin()\n if not 'declared_fields' in kwargs:\n kwargs['declared_fields'] = None\n return CoGroup(*args, **kwargs)",
"metadata": "root.outer_join",
"header": "['module', '___EOS___']",
"index": 121
},
{
"content": "def left_outer_join(*args, **kwargs):\n \"\"\"Shortcut for a left outer join.\"\"\"\n # The documentation says a Cascading RightJoin is a right inner join, but\n # that's not true, it's really an outer join as it should be.\n kwargs['joiner'] = cascading.pipe.cogroup.LeftJoin()\n if not 'declared_fields' in kwargs:\n kwargs['declared_fields'] = None\n return CoGroup(*args, **kwargs)",
"metadata": "root.left_outer_join",
"header": "['module', '___EOS___']",
"index": 129
},
{
"content": "def right_outer_join(*args, **kwargs):\n \"\"\"Shortcut for a right outer join.\"\"\"\n kwargs['joiner'] = cascading.pipe.cogroup.RightJoin()\n if not 'declared_fields' in kwargs:\n kwargs['declared_fields'] = None\n return CoGroup(*args, **kwargs)",
"metadata": "root.right_outer_join",
"header": "['module', '___EOS___']",
"index": 139
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2011",
" ",
"Twit",
"ter",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Opera",
"tion",
"s",
" ",
"relate",
"d",
" ",
"to",
" ",
"a",
" ",
"Co",
"Group",
" ",
"pipe",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"author\\u\\u_",
"=_",
"'",
"Gab",
"or",
" ",
"Sz",
"abo",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"cas",
"cad",
"ing_",
"._",
"operation_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pyca",
"sca",
"ding_",
"._",
"pipe_",
"import_",
"Operation_",
",_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
",_",
"\\u",
"Stack",
"able_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Co",
"Group_",
"(_",
"Operation_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Co",
"Group",
" ",
"two",
" ",
"or",
" ",
"more",
" ",
"stream",
"s",
" ",
"on",
" ",
"common",
" ",
"fields",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"Py",
"Casca",
"ding",
" ",
"wrapp",
"er",
" ",
"aro",
"und",
" ",
"a",
" ",
"Casca",
"ding",
" ",
"Co",
"Group",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Co",
"Group_",
"(_",
"Operation_",
")_",
":_",
"\\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 ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"Casca",
"ding",
" ",
"Co",
"Group",
" ",
"pipe",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"ument",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"args",
"[",
"0",
"]",
" ",
"--",
" ",
"the",
" ",
"fields",
" ",
"on",
" ",
"whi",
"ch",
" ",
"to",
" ",
"join",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Key",
"word",
" ",
"argu",
"ment",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"group",
"\\u",
"name",
" ",
"--",
" ",
"the",
" ",
"group",
"Name",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"group",
"\\u",
"fields",
" ",
"--",
" ",
"the",
" ",
"fields",
" ",
"on",
" ",
"whi",
"ch",
" ",
"to",
" ",
"group",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"declared",
"\\u",
"fields",
" ",
"--",
" ",
"the",
" ",
"declared",
"Field",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"result",
"\\u",
"group",
"\\u",
"fields",
" ",
"--",
" ",
"the",
" ",
"result",
"Group",
"Field",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"joine",
"r",
" ",
"--",
" ",
"the",
" ",
"joine",
"r",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"num",
"\\u",
"self",
"\\u",
"joins",
" ",
"--",
" ",
"the",
" ",
"num",
"Self",
"Join",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"lh",
"s",
" ",
"--",
" ",
"the",
" ",
"lh",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"lh",
"s",
"\\u",
"group",
"\\u",
"fields",
" ",
"--",
" ",
"the",
" ",
"lh",
"s",
"Group",
"Field",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"rhs",
" ",
"--",
" ",
"the",
" ",
"rhs",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"rhs",
"\\u",
"group",
"\\u",
"fields",
" ",
"--",
" ",
"the",
" ",
"rhs",
"Group",
"Field",
"s",
" ",
"parameter",
" ",
"for",
" ",
"Casca",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Operation_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"args_",
"=_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"kwargs_",
"=_",
"kwargs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Co",
"Group_",
"(_",
"Operation_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"create",
"\\u",
"args_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"group",
"\\u",
"name_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pipes_",
"=_",
"None_",
",_",
"group",
"\\u",
"fields_",
"=_",
"None_",
",_",
"declared",
"\\u",
"fields_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"result",
"\\u",
"group",
"\\u",
"fields_",
"=_",
"None_",
",_",
"joine",
"r_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pipe_",
"=_",
"None_",
",_",
"num",
"\\u",
"self",
"\\u",
"joins",
"_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"lhs_",
"=_",
"None_",
",_",
"lh",
"s",
"\\u",
"group",
"\\u",
"fields_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"rhs_",
"=_",
"None_",
",_",
"rhs",
"\\u",
"group",
"\\u",
"fields_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"can",
" ",
"use",
" ",
"an",
" ",
"unn",
"ame",
"d",
" ",
"parameter",
" ",
"only",
" ",
"for",
" ",
"group",
"\\u",
"fields_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"\\u\\u",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"group",
"\\u",
"fields_",
"=_",
"[_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"f_",
")_",
"for_",
"f_",
"in_",
"self_",
"._",
"\\u\\u",
"args_",
"[_",
"0_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"args_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"group",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"str_",
"(_",
"group",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"lhs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"lhs_",
"._",
"get",
"\\u",
"assembly_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"lh",
"s",
"\\u",
"group",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"rhs_",
"._",
"get",
"\\u",
"assembly_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"rhs",
"\\u",
"group",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"declared",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"declared",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"result",
"\\u",
"group",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"result",
"\\u",
"group",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"joine",
"r_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"joine",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"pipes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"[_",
"p_",
"._",
"get",
"\\u",
"assembly_",
"(_",
")_",
"for_",
"p_",
"in_",
"pipes_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"group",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"[_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"f_",
")_",
"for_",
"f_",
"in_",
"group",
"\\u",
"fields_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"declared",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"declared",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"result",
"\\u",
"group",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"result",
"\\u",
"group",
"\\u",
"fields_",
")_",
")_",
"\\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 ",
" ",
"_",
"args_",
"._",
"append_",
"(_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"joine",
"r_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"joine",
"r_",
"=_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"._",
"In",
"ner",
"Join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"joine",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"pipe_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"pipe_",
"._",
"get",
"\\u",
"assembly_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"group",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"append_",
"(_",
"int_",
"(_",
"num",
"\\u",
"self",
"\\u",
"joins",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"declared",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"declared",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"result",
"\\u",
"group",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"args_",
"._",
"append_",
"(_",
"coerce",
"\\u",
"to",
"\\u",
"fields_",
"(_",
"result",
"\\u",
"group",
"\\u",
"fields_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"joine",
"r_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"._",
"append_",
"(_",
"joine",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Co",
"Group_",
"(_",
"Operation_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"with",
"\\u",
"parent_",
"(_",
"self_",
",_",
"parent_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"parent_",
",_",
"\\u",
"Stack",
"able_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"=_",
"self_",
"._",
"\\u\\u",
"create",
"\\u",
"args_",
"(_",
"pipes_",
"=_",
"parent_",
"._",
"stack_",
",_",
"**_",
"self_",
"._",
"\\u\\u",
"kwargs_",
")_",
"\\u\\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_",
"=_",
"self_",
"._",
"\\u\\u",
"create",
"\\u",
"args_",
"(_",
"pipe_",
"=_",
"parent_",
",_",
"**_",
"self_",
"._",
"\\u\\u",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"Co",
"Group_",
"(_",
"*_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"inner",
"\\u",
"join_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Short",
"cut",
" ",
"for",
" ",
"an",
" ",
"inner",
" ",
"join",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"[_",
"'",
"joine",
"r",
"'_",
"]_",
"=_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"._",
"In",
"ner",
"Join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"'",
"declared",
"\\u",
"fields",
"'_",
"in_",
"kwargs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"[_",
"'",
"declared",
"\\u",
"fields",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Co",
"Group_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"outer",
"\\u",
"join_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Short",
"cut",
" ",
"for",
" ",
"an",
" ",
"outer",
" ",
"join",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"[_",
"'",
"joine",
"r",
"'_",
"]_",
"=_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"._",
"Out",
"er",
"Join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"'",
"declared",
"\\u",
"fields",
"'_",
"in_",
"kwargs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"[_",
"'",
"declared",
"\\u",
"fields",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Co",
"Group_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"left",
"\\u",
"outer",
"\\u",
"join_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Short",
"cut",
" ",
"for",
" ",
"a",
" ",
"left",
" ",
"outer",
" ",
"join",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"documentation",
" ",
"say",
"s",
" ",
"a",
" ",
"Casca",
"ding",
" ",
"Rig",
"ht",
"Join",
" ",
"is",
" ",
"a",
" ",
"right",
" ",
"inner",
" ",
"join",
",",
" ",
"but",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tha",
"t",
"'",
"s",
" ",
"not",
" ",
"true",
",",
" ",
"it",
"'",
"s",
" ",
"reall",
"y",
" ",
"an",
" ",
"outer",
" ",
"join",
" ",
"as",
" ",
"it",
" ",
"shou",
"ld",
" ",
"be",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"kwargs_",
"[_",
"'",
"joine",
"r",
"'_",
"]_",
"=_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"._",
"Le",
"ft",
"Join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"'",
"declared",
"\\u",
"fields",
"'_",
"in_",
"kwargs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"[_",
"'",
"declared",
"\\u",
"fields",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Co",
"Group_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"right",
"\\u",
"outer",
"\\u",
"join_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Short",
"cut",
" ",
"for",
" ",
"a",
" ",
"right",
" ",
"outer",
" ",
"join",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"[_",
"'",
"joine",
"r",
"'_",
"]_",
"=_",
"cas",
"cad",
"ing_",
"._",
"pipe_",
"._",
"cog",
"roup_",
"._",
"Rig",
"ht",
"Join_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"'",
"declared",
"\\u",
"fields",
"'_",
"in_",
"kwargs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"[_",
"'",
"declared",
"\\u",
"fields",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | Crystalnix/omaha-server/omaha_server/omaha/migrations/0014_auto_20150112_1025.py | [
{
"content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('omaha', '0013_data_app'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='data',\n name='app',\n field=models.ForeignKey(to='omaha.Application'),\n preserve_default=True,\n ),\n ]",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 6
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"migrations_",
"._",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dependencies_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"oma",
"ha",
"'_",
",_",
"'",
"001",
"3",
"\\u",
"data\\u",
"app",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"operations_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"migrations_",
"._",
"Alter",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"model",
"\\u",
"name_",
"=_",
"'",
"data",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"app",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"to_",
"=_",
"'",
"oma",
"ha",
".",
"Applica",
"tion",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"preserve",
"\\u",
"default_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | edgewall/trac/trac/wiki/model.py | [
{
"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2003-2009 Edgewall Software\n# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>\n# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part of this distribution. The terms\n# are also available at http://trac.edgewall.org/wiki/TracLicense.\n#\n# This software consists of voluntary contributions made by many\n# individuals. For the exact contribution history, see the revision\n# history and logs, available at http://trac.edgewall.org/log/.\n#\n# Author: Jonas Borgström <jonas@edgewall.com>\n# Christopher Lenz <cmlenz@gmx.de>\n\nfrom trac.core import *\nfrom trac.resource import Resource\nfrom trac.util.datefmt import datetime_now, from_utimestamp, to_utimestamp, utc\nfrom trac.util.translation import _\nfrom trac.wiki.api import WikiSystem, validate_page_name\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class WikiPage(object):\n \"\"\"Represents a wiki page (new or existing).\n\n :since 1.0.3: the `ipnr` is deprecated and will be removed in 1.3.1\n \"\"\"\n\n realm = WikiSystem.realm\n\n\n\n\n\n exists = property(lambda self: self.version > 0)\n\n\n\n\n",
"metadata": "root.WikiPage",
"header": "['module', '___EOS___']",
"index": 25
},
{
"content": " @property\n def resource(self):\n return Resource(self.realm, self.name, self._resource_version)",
"metadata": "root.WikiPage.resource",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def __init__(self, env, name=None, version=None):\n \"\"\"Create a new page object or retrieves an existing page.\n\n :param env: an `Environment` object.\n :param name: the page name or a `Resource` object.\n :param version: the page version. The value takes precedence over the\n `Resource` version when both are specified.\n \"\"\"\n self.env = env\n if version:\n try:\n version = int(version)\n except ValueError:\n version = None\n\n if isinstance(name, Resource):\n resource = name\n name = resource.id\n if version is None and resource.version is not None:\n try:\n version = int(resource.version)\n except ValueError:\n version = None\n\n self.name = name\n # The version attribute always returns the version of the page,\n # however resource.version will be None when version hasn't been\n # specified when creating the object and the object represents the\n # most recent version of the page. This behavior is used in web_ui.py\n # to determine whether to render a versioned page, or just the most\n # recent version of the page.\n self._resource_version = version\n if name:\n self._fetch(name, version)\n else:\n self.version = 0\n self.text = self.comment = self.author = ''\n self.time = None\n self.readonly = 0\n self.old_text = self.text\n self.old_readonly = self.readonly",
"metadata": "root.WikiPage.__init__",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def _fetch(self, name, version=None):\n if version is not None:\n sql = \"\"\"SELECT version, time, author, text, comment, readonly\n FROM wiki WHERE name=%s AND version=%s\"\"\"\n args = (name, int(version))\n else:\n sql = \"\"\"SELECT version, time, author, text, comment, readonly\n FROM wiki WHERE name=%s ORDER BY version DESC LIMIT 1\"\"\"\n args = (name,)\n for version, time, author, text, comment, readonly in \\\n self.env.db_query(sql, args):\n self.version = int(version)\n self.author = author\n self.time = from_utimestamp(time)\n self.text = text\n self.comment = comment\n self.readonly = int(readonly) if readonly else 0\n break\n else:\n self.version = 0\n self.text = self.comment = self.author = ''\n self.time = None\n self.readonly = 0",
"metadata": "root.WikiPage._fetch",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def __repr__(self):\n if self.name is None:\n name = self.name\n else:\n name = u'%s@%s' % (self.name, self.version)\n return '<%s %r>' % (self.__class__.__name__, name)",
"metadata": "root.WikiPage.__repr__",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 103
},
{
"content": " def delete(self, version=None):\n \"\"\"Delete one or all versions of a page.\n \"\"\"\n if not self.exists:\n raise TracError(_(\"Cannot delete non-existent page\"))\n\n with self.env.db_transaction as db:\n if version is None:\n # Delete a wiki page completely\n db(\"DELETE FROM wiki WHERE name=%s\", (self.name,))\n self.env.log.info(\"Deleted page %s\", self.name)\n else:\n # Delete only a specific page version\n db(\"DELETE FROM wiki WHERE name=%s and version=%s\",\n (self.name, version))\n self.env.log.info(\"Deleted version %d of page %s\", version,\n self.name)\n\n if version is None or version == self.version:\n self._fetch(self.name, None)\n\n if not self.exists:\n # Invalidate page name cache\n del WikiSystem(self.env).pages\n # Delete orphaned attachments\n from trac.attachment import Attachment\n Attachment.delete_all(self.env, self.realm, self.name)\n\n # Let change listeners know about the deletion\n if not self.exists:\n for listener in WikiSystem(self.env).change_listeners:\n listener.wiki_page_deleted(self)\n else:\n for listener in WikiSystem(self.env).change_listeners:\n if hasattr(listener, 'wiki_page_version_deleted'):\n listener.wiki_page_version_deleted(self)",
"metadata": "root.WikiPage.delete",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 112
},
{
"content": " def save(self, author, comment, remote_addr=None, t=None):\n \"\"\"Save a new version of a page.\n\n :since 1.0.3: `remote_addr` is optional and deprecated, and will be\n removed in 1.3.1\n \"\"\"\n if not validate_page_name(self.name):\n raise TracError(_(\"Invalid Wiki page name '%(name)s'\",\n name=self.name))\n\n new_text = self.text != self.old_text\n if not new_text and self.readonly == self.old_readonly:\n raise TracError(_(\"Page not modified\"))\n t = t or datetime_now(utc)\n\n with self.env.db_transaction as db:\n if new_text:\n db(\"\"\"INSERT INTO wiki (name, version, time, author, ipnr,\n text, comment, readonly)\n VALUES (%s,%s,%s,%s,%s,%s,%s,%s)\n \"\"\", (self.name, self.version + 1, to_utimestamp(t),\n author, remote_addr, self.text, comment,\n self.readonly))\n self.version += 1\n else:\n db(\"UPDATE wiki SET readonly=%s WHERE name=%s\",\n (self.readonly, self.name))\n if self.version == 1:\n # Invalidate page name cache\n del WikiSystem(self.env).pages\n\n self.author = author\n self.comment = comment\n self.time = t\n\n for listener in WikiSystem(self.env).change_listeners:\n if self.version == 1:\n listener.wiki_page_added(self)\n else:\n from trac.util import arity\n if arity(listener.wiki_page_changed) == 6:\n listener.wiki_page_changed(self, self.version, t,\n comment, author, remote_addr)\n else:\n listener.wiki_page_changed(self, self.version, t,\n comment, author)\n\n self.old_readonly = self.readonly\n self.old_text = self.text",
"metadata": "root.WikiPage.save",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 149
},
{
"content": " def rename(self, new_name):\n \"\"\"Rename wiki page in-place, keeping the history intact.\n Renaming a page this way will eventually leave dangling references\n to the old page - which literally doesn't exist anymore.\n \"\"\"\n if not self.exists:\n raise TracError(_(\"Cannot rename non-existent page\"))\n\n if not validate_page_name(new_name):\n raise TracError(_(\"Invalid Wiki page name '%(name)s'\",\n name=new_name))\n old_name = self.name\n\n with self.env.db_transaction as db:\n new_page = WikiPage(self.env, new_name)\n if new_page.exists:\n raise TracError(_(\"Can't rename to existing %(name)s page.\",\n name=new_name))\n\n db(\"UPDATE wiki SET name=%s WHERE name=%s\", (new_name, old_name))\n # Invalidate page name cache\n del WikiSystem(self.env).pages\n # Reparent attachments\n from trac.attachment import Attachment\n Attachment.reparent_all(self.env, self.realm, old_name,\n self.realm, new_name)\n\n self.name = new_name\n self.env.log.info(\"Renamed page %s to %s\", old_name, new_name)\n\n for listener in WikiSystem(self.env).change_listeners:\n if hasattr(listener, 'wiki_page_renamed'):\n listener.wiki_page_renamed(self, old_name)",
"metadata": "root.WikiPage.rename",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 199
},
{
"content": " def edit_comment(self, new_comment):\n \"\"\"Edit comment of wiki page version in-place.\"\"\"\n if not self.exists:\n raise TracError(_(\"Cannot edit comment of non-existent page\"))\n\n old_comment = self.comment\n\n with self.env.db_transaction as db:\n db(\"UPDATE wiki SET comment=%s WHERE name=%s AND version=%s\",\n (new_comment, self.name, self.version))\n\n self.comment = new_comment\n self.env.log.info(\"Changed comment on page %s version %s to %s\",\n self.name, self.version, new_comment)\n\n for listener in WikiSystem(self.env).change_listeners:\n if hasattr(listener, 'wiki_page_comment_modified'):\n listener.wiki_page_comment_modified(self, old_comment)",
"metadata": "root.WikiPage.edit_comment",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 233
},
{
"content": " def get_history(self):\n \"\"\"Retrieve the edit history of a wiki page.\n\n :return: a tuple containing the `version`, `datetime`, `author`,\n `comment` and `ipnr`.\n :since 1.0.3: use of `ipnr` is deprecated and will be removed in 1.3.1\n \"\"\"\n for version, ts, author, comment, ipnr in self.env.db_query(\"\"\"\n SELECT version, time, author, comment, ipnr FROM wiki\n WHERE name=%s AND version<=%s ORDER BY version DESC\n \"\"\", (self.name, self.version)):\n yield version, from_utimestamp(ts), author, comment, ipnr",
"metadata": "root.WikiPage.get_history",
"header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']",
"index": 252
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2003",
"-",
"200",
"9",
" ",
"Ed",
"ge",
"wall",
" ",
"Sof",
"twa",
"re_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2003",
"-",
"2005",
" ",
"Jon",
"as",
" ",
"Bor",
"gst",
"r",
"\\",
"246",
";",
"m",
" ",
"<",
"jon",
"as",
"@",
"edge",
"wall",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2005",
" ",
"Christ",
"oph",
"er",
" ",
"Len",
"z",
" ",
"<",
"cml",
"enz",
"@",
"gm",
"x",
".",
"de",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"software",
" ",
"is",
" ",
"license",
"d",
" ",
"as",
" ",
"descri",
"bed",
" ",
"in",
" ",
"the",
" ",
"file",
" ",
"COPY",
"ING",
",",
" ",
"which_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"shou",
"ld",
" ",
"have",
" ",
"receive",
"d",
" ",
"as",
" ",
"part",
" ",
"of",
" ",
"this",
" ",
"distribu",
"tion",
".",
" ",
"The",
" ",
"terms_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"are",
" ",
"als",
"o",
" ",
"avail",
"able",
" ",
"at",
" ",
"http",
"://",
"trac",
".",
"edge",
"wall",
".",
"org",
"/",
"wiki",
"/",
"Trac",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"software",
" ",
"consi",
"sts",
" ",
"of",
" ",
"volu",
"nta",
"ry",
" ",
"contributions",
" ",
"made",
" ",
"by",
" ",
"many_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"individual",
"s",
".",
" ",
"For",
" ",
"the",
" ",
"exact",
" ",
"contribution",
" ",
"histo",
"ry",
",",
" ",
"see",
" ",
"the",
" ",
"revision_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"histo",
"ry",
" ",
"and",
" ",
"logs",
",",
" ",
"avail",
"able",
" ",
"at",
" ",
"http",
"://",
"trac",
".",
"edge",
"wall",
".",
"org",
"/",
"log",
"/.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Author",
":",
" ",
"Jon",
"as",
" ",
"Bor",
"gst",
"r",
"\\",
"246",
";",
"m",
" ",
"<",
"jon",
"as",
"@",
"edge",
"wall",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"Christ",
"oph",
"er",
" ",
"Len",
"z",
" ",
"<",
"cml",
"enz",
"@",
"gm",
"x",
".",
"de",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"core_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"resource_",
"import_",
"Resource_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"util_",
"._",
"datefmt_",
"import_",
"datetime",
"\\u",
"now_",
",_",
"from",
"\\u",
"utime",
"stamp_",
",_",
"to",
"\\u",
"utime",
"stamp_",
",_",
"utc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"util_",
"._",
"translation_",
"import_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"wiki_",
"._",
"api_",
"import_",
"Wiki",
"System_",
",_",
"validat",
"e\\u",
"page",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Represent",
"s",
" ",
"a",
" ",
"wiki",
" ",
"page",
" ",
"(",
"new",
" ",
"or",
" ",
"exist",
"ing",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"sinc",
"e",
" ",
"1.0",
".3",
":",
" ",
"the",
" ",
"`",
"ip",
"nr",
"`",
" ",
"is",
" ",
"depre",
"cated",
" ",
"and",
" ",
"will",
" ",
"be",
" ",
"remove",
"d",
" ",
"in",
" ",
"1.3",
".1",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"realm_",
"=_",
"Wiki",
"System_",
"._",
"realm_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"exists_",
"=_",
"property_",
"(_",
"lambda_",
"self_",
":_",
"self_",
"._",
"version_",
">_",
"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_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"resource_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Resource_",
"(_",
"self_",
"._",
"realm_",
",_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"\\u",
"resource",
"\\u",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"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_",
",_",
"env_",
",_",
"name_",
"=_",
"None_",
",_",
"version_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"page",
" ",
"object",
" ",
"or",
" ",
"retrieve",
"s",
" ",
"an",
" ",
"exist",
"ing",
" ",
"page",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"env",
":",
" ",
"an",
" ",
"`",
"Environ",
"ment",
"`",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"name",
":",
" ",
"the",
" ",
"page",
" ",
"name",
" ",
"or",
" ",
"a",
" ",
"`",
"Reso",
"urc",
"e",
"`",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"version",
":",
" ",
"the",
" ",
"page",
" ",
"version",
".",
" ",
"The",
" ",
"value",
" ",
"take",
"s",
" ",
"preceden",
"ce",
" ",
"over",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
"`",
"Reso",
"urc",
"e",
"`",
" ",
"version",
" ",
"whe",
"n",
" ",
"bot",
"h",
" ",
"are",
" ",
"specified",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"=_",
"env_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"version_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"version_",
"=_",
"int_",
"(_",
"version_",
")_",
"\\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 ",
" _",
"version_",
"=_",
"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_",
"isinstance_",
"(_",
"name_",
",_",
"Resource_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"resource_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"resource_",
"._",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"version_",
"is_",
"None_",
"and_",
"resource_",
"._",
"version_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"version_",
"=_",
"int_",
"(_",
"resource_",
"._",
"version_",
")_",
"\\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 ",
" ",
"_",
"version_",
"=_",
"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_",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"version",
" ",
"attribute",
" ",
"alw",
"ay",
"s",
" ",
"return",
"s",
" ",
"the",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"page",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"how",
"ever",
" ",
"resource",
".",
"version",
" ",
"will",
" ",
"be",
" ",
"Non",
"e",
" ",
"whe",
"n",
" ",
"version",
" ",
"hasn",
"'",
"t",
" ",
"bee",
"n_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"specified",
" ",
"whe",
"n",
" ",
"creati",
"ng",
" ",
"the",
" ",
"object",
" ",
"and",
" ",
"the",
" ",
"object",
" ",
"represent",
"s",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"most",
" ",
"recent",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"page",
".",
" ",
"Thi",
"s",
" ",
"behavior",
" ",
"is",
" ",
"used",
" ",
"in",
" ",
"web",
"\\u",
"ui",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"dete",
"rmin",
"e",
" ",
"whe",
"ther",
" ",
"to",
" ",
"render",
" ",
"a",
" ",
"versioned",
" ",
"page",
",",
" ",
"or",
" ",
"just",
" ",
"the",
" ",
"most",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"recent",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"page",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"resource",
"\\u",
"version_",
"=_",
"version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"fetch_",
"(_",
"name_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"text_",
"=_",
"self_",
"._",
"comment_",
"=_",
"self_",
"._",
"author_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"time_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"readonly_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"old",
"\\u",
"text_",
"=_",
"self_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"old",
"\\u",
"readonly_",
"=_",
"self_",
"._",
"readonly_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"fetch_",
"(_",
"self_",
",_",
"name_",
",_",
"version_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"version_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sql_",
"=_",
"\"\"\"",
"SELECT",
" ",
"version",
",",
" ",
"time",
",",
" ",
"author",
",",
" ",
"text",
",",
" ",
"comment",
",",
" ",
"read",
"only",
"\\",
"10",
";",
" ",
" ",
" ",
"FROM",
" ",
"wiki",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
" ",
"AND",
" ",
"version",
"=",
"%",
"s",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"(_",
"name_",
",_",
"int_",
"(_",
"version_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sql_",
"=_",
"\"\"\"",
"SELECT",
" ",
"version",
",",
" ",
"time",
",",
" ",
"author",
",",
" ",
"text",
",",
" ",
"comment",
",",
" ",
"read",
"only",
"\\",
"10",
";",
" ",
" ",
" ",
"FROM",
" ",
"wiki",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
" ",
"ORDE",
"R",
" ",
"BY",
" ",
"version",
" ",
"DESC",
" ",
"LIMIT",
" ",
"1",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"(_",
"name_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"version_",
",_",
"time_",
",_",
"author_",
",_",
"text_",
",_",
"comment_",
",_",
"readonly_",
"in_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"query_",
"(_",
"sql_",
",_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"int_",
"(_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"author_",
"=_",
"author_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"time_",
"=_",
"from",
"\\u",
"utime",
"stamp_",
"(_",
"time_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"text_",
"=_",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"comment_",
"=_",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"readonly_",
"=_",
"int_",
"(_",
"readonly_",
")_",
"if_",
"readonly_",
"else_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"text_",
"=_",
"self_",
"._",
"comment_",
"=_",
"self_",
"._",
"author_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"time_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"readonly_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"repr\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"name_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"self_",
"._",
"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 ",
" _",
"name_",
"=_",
"u",
"'%",
"s",
"@",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"'<",
"%",
"s",
" ",
"%",
"r",
">'_",
"%_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"delete_",
"(_",
"self_",
",_",
"version_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Delete",
" ",
"one",
" ",
"or",
" ",
"all",
" ",
"version",
"s",
" ",
"of",
" ",
"a",
" ",
"page",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Cann",
"ot",
" ",
"delete",
" ",
"non",
"-",
"existen",
"t",
" ",
"page",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"transaction_",
"as_",
"db_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"version_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Delete",
" ",
"a",
" ",
"wiki",
" ",
"page",
" ",
"complete",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"(_",
"\"",
"DELET",
"E",
" ",
"FROM",
" ",
"wiki",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
"\"_",
",_",
"(_",
"self_",
"._",
"name_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"._",
"log_",
"._",
"info_",
"(_",
"\"",
"Delete",
"d",
" ",
"page",
" ",
"%",
"s",
"\"_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Delete",
" ",
"only",
" ",
"a",
" ",
"specific",
" ",
"page",
" ",
"version_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"(_",
"\"",
"DELET",
"E",
" ",
"FROM",
" ",
"wiki",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
" ",
"and",
" ",
"version",
"=",
"%",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"self_",
"._",
"name_",
",_",
"version_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"._",
"log_",
"._",
"info_",
"(_",
"\"",
"Delete",
"d",
" ",
"version",
" ",
"%",
"d",
" ",
"of",
" ",
"page",
" ",
"%",
"s",
"\"_",
",_",
"version_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"version_",
"is_",
"None_",
"or_",
"version_",
"==_",
"self_",
"._",
"version_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"fetch_",
"(_",
"self_",
"._",
"name_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Inva",
"lida",
"te",
" ",
"page",
" ",
"name",
" ",
"cache_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"pages_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Delete",
" ",
"orphan",
"ed",
" ",
"attachments_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"attachment_",
"import_",
"Attachment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Attachment_",
"._",
"delete",
"\\u",
"all_",
"(_",
"self_",
"._",
"env_",
",_",
"self_",
"._",
"realm_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Let",
" ",
"change",
" ",
"listeners",
" ",
"know",
" ",
"abo",
"ut",
" ",
"the",
" ",
"deletion_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"listener_",
"in_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"change",
"\\u",
"listeners_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"deleted_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"listener_",
"in_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"change",
"\\u",
"listeners_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"listener_",
",_",
"'",
"wiki",
"\\u",
"page",
"\\u",
"version",
"\\u",
"delete",
"d",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"version",
"\\u",
"deleted_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"save_",
"(_",
"self_",
",_",
"author_",
",_",
"comment_",
",_",
"remote",
"\\u",
"addr_",
"=_",
"None_",
",_",
"t_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Save",
" ",
"a",
" ",
"new",
" ",
"version",
" ",
"of",
" ",
"a",
" ",
"page",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"sinc",
"e",
" ",
"1.0",
".3",
":",
" ",
"`",
"remote",
"\\u",
"addr",
"`",
" ",
"is",
" ",
"option",
"al",
" ",
"and",
" ",
"depre",
"cated",
",",
" ",
"and",
" ",
"will",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"remove",
"d",
" ",
"in",
" ",
"1.3",
".1",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"validat",
"e\\u",
"page",
"\\u",
"name_",
"(_",
"self_",
"._",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Inva",
"lid",
" ",
"Wiki",
" ",
"page",
" ",
"name",
" ",
"'%",
"(",
"name",
")",
"s",
"'\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"self_",
"._",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"new",
"\\u",
"text_",
"=_",
"self_",
"._",
"text_",
"!=_",
"self_",
"._",
"old",
"\\u",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"new",
"\\u",
"text_",
"and_",
"self_",
"._",
"readonly_",
"==_",
"self_",
"._",
"old",
"\\u",
"readonly_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Page",
" ",
"not",
" ",
"modifi",
"ed",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"t_",
"=_",
"t_",
"or_",
"datetime",
"\\u",
"now_",
"(_",
"utc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"transaction_",
"as_",
"db_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"new",
"\\u",
"text_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"(_",
"\"\"\"",
"INSERT",
" ",
"INT",
"O",
" ",
"wiki",
" ",
"(",
"name",
",",
" ",
"version",
",",
" ",
"time",
",",
" ",
"author",
",",
" ",
"ip",
"nr",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"text",
",",
" ",
"comment",
",",
" ",
"read",
"only",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"VALU",
"ES",
" ",
"(%",
"s",
",%",
"s",
",%",
"s",
",%",
"s",
",%",
"s",
",%",
"s",
",%",
"s",
",%",
"s",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
",_",
"(_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"version_",
"+_",
"1_",
",_",
"to",
"\\u",
"utime",
"stamp_",
"(_",
"t_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
",_",
"remote",
"\\u",
"addr_",
",_",
"self_",
"._",
"text_",
",_",
"comment_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"readonly_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"version_",
"+=_",
"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 ",
" _",
"db_",
"(_",
"\"",
"UPDATE",
" ",
"wiki",
" ",
"SET",
" ",
"read",
"only",
"=",
"%",
"s",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"self_",
"._",
"readonly_",
",_",
"self_",
"._",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"version_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Inva",
"lida",
"te",
" ",
"page",
" ",
"name",
" ",
"cache_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"pages_",
"\\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_",
"._",
"author_",
"=_",
"author_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"comment_",
"=_",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"time_",
"=_",
"t_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"listener_",
"in_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"change",
"\\u",
"listeners_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"version_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"added_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"trac",
"_",
"._",
"util_",
"import_",
"arity_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"arity_",
"(_",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"changed_",
")_",
"==_",
"6_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"changed_",
"(_",
"self_",
",_",
"self_",
"._",
"version_",
",_",
"t_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"comment_",
",_",
"author_",
",_",
"remote",
"\\u",
"addr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"changed_",
"(_",
"self_",
",_",
"self_",
"._",
"version_",
",_",
"t_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"comment_",
",_",
"author_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"old",
"\\u",
"readonly_",
"=_",
"self_",
"._",
"readonly_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"old",
"\\u",
"text_",
"=_",
"self_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rename_",
"(_",
"self_",
",_",
"new",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Rename",
" ",
"wiki",
" ",
"page",
" ",
"in",
"-",
"place",
",",
" ",
"keep",
"ing",
" ",
"the",
" ",
"histo",
"ry",
" ",
"inta",
"ct",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ren",
"amin",
"g",
" ",
"a",
" ",
"page",
" ",
"this",
" ",
"way",
" ",
"will",
" ",
"eventual",
"ly",
" ",
"lea",
"ve",
" ",
"dan",
"glin",
"g",
" ",
"reference",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"the",
" ",
"old",
" ",
"page",
" ",
"-",
" ",
"whi",
"ch",
" ",
"literal",
"ly",
" ",
"doe",
"sn",
"'",
"t",
" ",
"exist",
" ",
"any",
"more",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Cann",
"ot",
" ",
"rename",
" ",
"non",
"-",
"existen",
"t",
" ",
"page",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"validat",
"e\\u",
"page",
"\\u",
"name_",
"(_",
"new",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Inva",
"lid",
" ",
"Wiki",
" ",
"page",
" ",
"name",
" ",
"'%",
"(",
"name",
")",
"s",
"'\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"new",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"old",
"\\u",
"name_",
"=_",
"self_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"transaction_",
"as_",
"db_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"page_",
"=_",
"Wiki",
"Page_",
"(_",
"self_",
"._",
"env_",
",_",
"new",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"new",
"\\u",
"page_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Can",
"'",
"t",
" ",
"rename",
" ",
"to",
" ",
"exist",
"ing",
" ",
"%",
"(",
"name",
")",
"s",
" ",
"page",
".\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"new",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"db_",
"(_",
"\"",
"UPDATE",
" ",
"wiki",
" ",
"SET",
" ",
"name",
"=",
"%",
"s",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
"\"_",
",_",
"(_",
"new",
"\\u",
"name_",
",_",
"old",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Inva",
"lida",
"te",
" ",
"page",
" ",
"name",
" ",
"cache_",
"\\u\\u\\uNL\\u\\u\\u_",
"del_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"pages_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Rep",
"arent",
" ",
"attachments_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"trac",
"_",
"._",
"attachment_",
"import_",
"Attachment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Attachment_",
"._",
"repar",
"ent",
"\\u",
"all_",
"(_",
"self_",
"._",
"env_",
",_",
"self_",
"._",
"realm_",
",_",
"old",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"realm_",
",_",
"new",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"new",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"._",
"log_",
"._",
"info_",
"(_",
"\"",
"Rename",
"d",
" ",
"page",
" ",
"%",
"s",
" ",
"to",
" ",
"%",
"s",
"\"_",
",_",
"old",
"\\u",
"name_",
",_",
"new",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"listener_",
"in_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"change",
"\\u",
"listeners_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"listener_",
",_",
"'",
"wiki",
"\\u",
"page",
"\\u",
"renamed",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"renamed",
"_",
"(_",
"self_",
",_",
"old",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"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_",
"edit",
"\\u",
"comment_",
"(_",
"self_",
",_",
"new",
"\\u",
"comment_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Edit",
" ",
"comment",
" ",
"of",
" ",
"wiki",
" ",
"page",
" ",
"version",
" ",
"in",
"-",
"place",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Trac",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Cann",
"ot",
" ",
"edit",
" ",
"comment",
" ",
"of",
" ",
"non",
"-",
"existen",
"t",
" ",
"page",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"old",
"\\u",
"comment_",
"=_",
"self_",
"._",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"transaction_",
"as_",
"db_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"(_",
"\"",
"UPDATE",
" ",
"wiki",
" ",
"SET",
" ",
"comment",
"=",
"%",
"s",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
" ",
"AND",
" ",
"version",
"=",
"%",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"new",
"\\u",
"comment_",
",_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"version_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"comment_",
"=_",
"new",
"\\u",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"._",
"log_",
"._",
"info_",
"(_",
"\"",
"Change",
"d",
" ",
"comment",
" ",
"on",
" ",
"page",
" ",
"%",
"s",
" ",
"version",
" ",
"%",
"s",
" ",
"to",
" ",
"%",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"version_",
",_",
"new",
"\\u",
"comment_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"listener_",
"in_",
"Wiki",
"System_",
"(_",
"self_",
"._",
"env_",
")_",
"._",
"change",
"\\u",
"listeners_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"listener_",
",_",
"'",
"wiki",
"\\u",
"page",
"\\u",
"comment",
"\\u",
"modifi",
"ed",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"listener_",
"._",
"wiki",
"\\u",
"page",
"\\u",
"comment",
"\\u",
"modified_",
"(_",
"self_",
",_",
"old",
"\\u",
"comment_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wiki",
"Page_",
"(_",
"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_",
"get",
"\\u",
"history_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Retrieve",
" ",
"the",
" ",
"edit",
" ",
"histo",
"ry",
" ",
"of",
" ",
"a",
" ",
"wiki",
" ",
"page",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"a",
" ",
"tuple",
" ",
"contain",
"ing",
" ",
"the",
" ",
"`",
"version",
"`",
",",
" ",
"`",
"datetime",
"`",
",",
" ",
"`",
"author",
"`",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"`",
"comment",
"`",
" ",
"and",
" ",
"`",
"ip",
"nr",
"`.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"sinc",
"e",
" ",
"1.0",
".3",
":",
" ",
"use",
" ",
"of",
" ",
"`",
"ip",
"nr",
"`",
" ",
"is",
" ",
"depre",
"cated",
" ",
"and",
" ",
"will",
" ",
"be",
" ",
"remove",
"d",
" ",
"in",
" ",
"1.3",
".1",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"version_",
",_",
"ts_",
",_",
"author_",
",_",
"comment_",
",_",
"ip",
"nr_",
"in_",
"self_",
"._",
"env_",
"._",
"db",
"\\u",
"query_",
"(_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"SELECT",
" ",
"version",
",",
" ",
"time",
",",
" ",
"author",
",",
" ",
"comment",
",",
" ",
"ip",
"nr",
" ",
"FROM",
" ",
"wiki",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"WHE",
"RE",
" ",
"name",
"=",
"%",
"s",
" ",
"AND",
" ",
"version",
"<=",
"%",
"s",
" ",
"ORDE",
"R",
" ",
"BY",
" ",
"version",
" ",
"DESC",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
",_",
"(_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"version_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"version_",
",_",
"from",
"\\u",
"utime",
"stamp_",
"(_",
"ts_",
")_",
",_",
"author_",
",_",
"comment_",
",_",
"ip",
"nr_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | missionpinball/mpf/mpf/media_controller/elements/character_picker.py | [
{
"content": "\"\"\"Contains the parent class of the CharacterPicker DisplayElement\"\"\"\n\n# character_picker.py\n# Mission Pinball Framework\n# Written by Brian Madden & Gabe Knuth\n# Released under the MIT License. (See license info at the end of this file.)\n\n# Documentation and more info at http://missionpinball.com/mpf\n\nfrom collections import deque\nfrom copy import deepcopy\nfrom mpf.media_controller.core.display import DisplayElement\nfrom mpf.system.timing import Timing\nimport pygame\n\n\n\n\ndisplay_element_class = CharacterPicker\ncreate_asset_manager = False\n\n\n# The MIT License (MIT)\n\n# Copyright (c) 2013-2015 Brian Madden and Gabe Knuth\n\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CharacterPicker(DisplayElement):\n \"\"\"Represents an character picker display element.\n\n Args:\n slide: The Slide object this animation is being added to.\n machine: The main machine object.\n x: The horizontal position offset for the placement of this element.\n y: The vertical position offset for the placement of this element.\n h_pos: The horizontal anchor.\n v_pos: The vertical anchor.\n\n Note: Full documentation on the use of the x, y, h_pos, and v_pos arguments\n can be found at: https://missionpinball.com/docs/displays/display-elements/positioning/\n\n \"\"\"\n\n\n\n\n\n\n",
"metadata": "root.CharacterPicker",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": " def __init__(self, slide, machine, x=None, y=None, h_pos=None,\n v_pos=None, layer=0, **kwargs):\n\n super(CharacterPicker, self).__init__(slide, x, y, h_pos, v_pos, layer)\n\n self.fonts = machine.display.fonts\n self.slide = slide\n self.machine = machine\n self.layer = layer\n self.config = deepcopy(kwargs)\n self.char_list = deque()\n self.cursor_position = 0\n self.selected_char = ''\n self.registered_event_handlers = list()\n\n if 'selected_char_color' not in self.config:\n self.config['selected_char_color'] = 0\n\n if 'selected_char_bg' not in self.config:\n self.config['selected_char_bg'] = 15\n\n if 'char_width' not in self.config:\n self.config['char_width'] = 11\n\n if 'width' not in self.config:\n self.config['width'] = None\n\n if 'height' not in self.config:\n self.config['height'] = 15\n\n if 'char_x_offset' not in self.config:\n self.config['char_x_offset'] = 0\n\n if 'char_y_offset' not in self.config:\n self.config['char_y_offset'] = 0\n\n if 'shift_left_tag' not in self.config:\n self.config['shift_left_tag'] = 'left_flipper'\n\n if 'shift_right_tag' not in self.config:\n self.config['shift_right_tag'] = 'right_flipper'\n\n if 'select_tag' not in self.config:\n self.config['select_tag'] = 'start'\n\n if 'name' in self.config:\n self.name = self.config['name']\n else:\n self.name = 'character_picker'\n\n if 'char_list' not in self.config:\n self.config['char_list'] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n if 'max_chars' not in self.config:\n self.config['max_chars'] = 3\n\n if 'timeout' not in self.config:\n self.config['timeout'] = None\n else:\n self.config['timeout'] = (\n Timing.string_to_secs(self.config['timeout']))\n\n if 'back_char' not in self.config:\n self.config['back_char'] = 'back_arrow_7x7'\n\n if 'end_char' not in self.config:\n self.config['end_char'] = 'end_11x7'\n\n if 'back_char_selected' not in self.config:\n self.config['back_char_selected'] = 'back_arrow_7x7_selected'\n\n if 'end_char_selected' not in self.config:\n self.config['end_char_selected'] = 'end_11x7_selected'\n\n if 'image_padding' not in self.config:\n self.config['image_padding'] = 1\n\n if 'return_param' not in self.config:\n self.config['return_param'] = 'award'\n\n self.config['selected_char_color'] = (\n self.adjust_color(self.config['selected_char_color']))\n self.config['selected_char_bg'] = (\n self.adjust_color(self.config['selected_char_bg']))\n\n self.adjust_colors(**self.config)\n\n self.config['color'] = self.adjusted_color\n self.config['bg_color'] = self.adjusted_bg_color\n\n self.char_list.extend(self.config['char_list'])\n self.char_list.append('back')\n self.char_list.append('end')\n self.char_list.rotate(len(self.char_list)/2)\n\n self.cursor_position = len(self.char_list)/2\n self.selected_char = self.char_list[self.cursor_position]\n\n self.machine._set_machine_var(name=self.name + '_chars_entered',\n value='')\n\n self.setup_switch_handlers()\n\n self.render()",
"metadata": "root.CharacterPicker.__init__",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 32
},
{
"content": " def setup_switch_handlers(self):\n\n self.registered_event_handlers.append(self.machine.events.add_handler(\n 'switch_' + self.config['shift_left_tag'] + '_active',\n self.shift, places=1))\n self.registered_event_handlers.append(self.machine.events.add_handler(\n 'switch_' + self.config['shift_right_tag'] + '_active',\n self.shift, places=-1))\n self.registered_event_handlers.append(self.machine.events.add_handler(\n 'switch_' + self.config['select_tag'] + '_active',\n self.select))",
"metadata": "root.CharacterPicker.setup_switch_handlers",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 137
},
{
"content": " def shift(self, places=1):\n\n if places > 0:\n self.machine.events.post(self.name + '_shift_left')\n else:\n self.machine.events.post(self.name + '_shift_right')\n\n self.char_list.rotate(places)\n self.selected_char = self.char_list[self.cursor_position]\n self.render()",
"metadata": "root.CharacterPicker.shift",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 149
},
{
"content": " def select(self):\n if self.selected_char == 'back':\n self.machine._set_machine_var(name=self.name + '_chars_entered',\n value=self.machine.machine_vars[self.name + '_chars_entered'][:-1])\n self.machine.events.post(self.name + '_select_back')\n elif self.selected_char == 'end':\n self.machine.events.post(self.name + '_select_end')\n self.complete()\n else:\n self.machine.events.post(self.name + '_select')\n self.machine._set_machine_var(name=self.name + '_chars_entered',\n value=self.machine.machine_vars[self.name + '_chars_entered'] +\n self.selected_char)\n\n if (len(self.machine.machine_vars[self.name + '_chars_entered']) ==\n self.config['max_chars']):\n self.complete()",
"metadata": "root.CharacterPicker.select",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 160
},
{
"content": " def render(self):\n back_surface = (\n self.machine.images[self.config['back_char']].image_surface)\n end_surface = (\n self.machine.images[self.config['end_char']].image_surface)\n\n total_width = len(self.char_list) * self.config['char_width'] + (\n back_surface.get_width() + end_surface.get_width() +\n (self.config['image_padding'] * 4))\n\n self.create_element_surface(total_width, self.config['height'])\n\n current_x_position = 0\n\n for index, x in enumerate(self.char_list):\n\n if x == 'back':\n char_surface = back_surface\n next_offset = char_surface.get_width() + (\n 2 * self.config['image_padding'])\n x_offset = self.config['image_padding']\n\n elif x == 'end':\n char_surface = end_surface\n next_offset = char_surface.get_width() + (\n 2 * self.config['image_padding'])\n x_offset = self.config['image_padding']\n else:\n char_surface = self.fonts.render(text=x, **self.config)\n\n next_offset = self.config['char_width']\n x_offset = (((self.config['char_width'] -\n char_surface.get_width()) / 2) +\n self.config['char_x_offset'])\n\n if index == self.cursor_position:\n\n if x == 'back':\n char_surface = self.machine.images[\n self.config['back_char_selected']].image_surface\n bg_width = char_surface.get_width() + (\n 2 * self.config['image_padding'])\n elif x == 'end':\n char_surface = self.machine.images[\n self.config['end_char_selected']].image_surface\n bg_width = char_surface.get_width() + (\n 2 * self.config['image_padding'])\n else:\n highlighted_config = deepcopy(self.config)\n highlighted_config['color'] = (\n self.config['selected_char_color'])\n highlighted_config['bg_color'] = (\n self.config['selected_char_bg'])\n char_surface = self.fonts.render(text=x,\n **highlighted_config)\n bg_width = self.config['char_width']\n\n pygame.draw.rect(self.element_surface,\n self.config['selected_char_bg'],\n (current_x_position, # left\n 0, # top\n bg_width, # width\n self.config['height'])) # height\n\n self.element_surface.blit(char_surface, (\n current_x_position+x_offset, self.config['char_y_offset']))\n\n current_x_position += next_offset\n\n # reduce the element surface to the width specified:\n if self.config['width']:\n rendered_char_surface = self.element_surface\n self.create_element_surface(self.config['width'],\n self.config['height'])\n\n h_offset = (rendered_char_surface.get_width() -\n self.config['width']) / -2\n self.element_surface.blit(rendered_char_surface, (h_offset, 0))\n\n self.set_position(self.x, self.y, self.h_pos, self.v_pos)\n self.dirty = True\n self.slide.refresh(force_dirty=True)",
"metadata": "root.CharacterPicker.render",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 178
},
{
"content": " def complete(self):\n self.scrub()\n\n name = self.machine.machine_vars[self.name + '_chars_entered']\n\n if not name:\n name = ' '\n\n self.machine.machine_vars[self.name + '_chars_entered'] = ''\n\n return_param = {self.config['return_param']:\n self.config['text_variables'][self.config['return_param']]}\n\n self.machine.send(bcp_command='trigger',\n name=self.name + '_complete',\n player_name=name,\n **return_param)",
"metadata": "root.CharacterPicker.complete",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 261
},
{
"content": " def scrub(self):\n self.machine.events.remove_handlers_by_keys(\n self.registered_event_handlers)\n self.registered_event_handlers = list()",
"metadata": "root.CharacterPicker.scrub",
"header": "['class', 'CharacterPicker', '(', 'DisplayElement', ')', ':', '___EOS___']",
"index": 279
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Contain",
"s",
" ",
"the",
" ",
"parent",
" ",
"class",
" ",
"of",
" ",
"the",
" ",
"Char",
"acte",
"r",
"Picke",
"r",
" ",
"Display",
"Element",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"character",
"\\u",
"picker",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Mission",
" ",
"Pin",
"bal",
"l",
" ",
"Framework_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Writ",
"ten",
" ",
"by",
" ",
"Brian",
" ",
"Mad",
"den",
" ",
"&",
" ",
"Gab",
"e",
" ",
"Kn",
"uth_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Release",
"d",
" ",
"under",
" ",
"the",
" ",
"MIT",
" ",
"License",
".",
" ",
"(",
"See",
" ",
"license",
" ",
"info",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"this",
" ",
"file",
".)",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"ation",
" ",
"and",
" ",
"more",
" ",
"info",
" ",
"at",
" ",
"http",
"://",
"missio",
"npi",
"nba",
"ll",
".",
"com",
"/",
"mpf",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"collections_",
"import_",
"deque_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"copy_",
"import_",
"deepcopy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mpf",
"_",
"._",
"media",
"\\u",
"controller_",
"._",
"core_",
"._",
"display_",
"import_",
"Display",
"Element_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mpf",
"_",
"._",
"system_",
"._",
"timing_",
"import_",
"Tim",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pygame_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"display",
"\\u",
"element",
"\\u",
"class_",
"=_",
"Char",
"acte",
"r",
"Picke",
"r_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"create",
"\\u",
"asset",
"\\u",
"manager_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"MIT",
" ",
"License",
" ",
"(",
"MIT",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2013",
"-",
"201",
"5",
" ",
"Brian",
" ",
"Mad",
"den",
" ",
"and",
" ",
"Gab",
"e",
" ",
"Kn",
"uth_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Permi",
"ssion",
" ",
"is",
" ",
"here",
"by",
" ",
"grant",
"ed",
",",
" ",
"free",
" ",
"of",
" ",
"charge",
",",
" ",
"to",
" ",
"any",
" ",
"person",
" ",
"obtain",
"ing",
" ",
"a",
" ",
"copy_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"this",
" ",
"software",
" ",
"and",
" ",
"associate",
"d",
" ",
"documentation",
" ",
"files",
" ",
"(",
"the",
" ",
"\"",
"Sof",
"twa",
"re",
"\")",
",",
" ",
"to",
" ",
"deal",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"with",
"out",
" ",
"restriction",
",",
" ",
"inclu",
"ding",
" ",
"with",
"out",
" ",
"limit",
"ation",
" ",
"the",
" ",
"rights_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"use",
",",
" ",
"copy",
",",
" ",
"modif",
"y",
",",
" ",
"merge",
",",
" ",
"publi",
"sh",
",",
" ",
"distribute",
",",
" ",
"subli",
"cens",
"e",
",",
" ",
"and",
"/",
"or",
" ",
"sell",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"copie",
"s",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
",",
" ",
"and",
" ",
"to",
" ",
"permit",
" ",
"person",
"s",
" ",
"to",
" ",
"who",
"m",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fur",
"nish",
"ed",
" ",
"to",
" ",
"do",
" ",
"so",
",",
" ",
"subject",
" ",
"to",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
" ",
"and",
" ",
"this",
" ",
"permissi",
"on",
" ",
"notice",
" ",
"sha",
"ll",
" ",
"be",
" ",
"include",
"d",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"all",
" ",
"copie",
"s",
" ",
"or",
" ",
"substa",
"nti",
"al",
" ",
"porti",
"ons",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"\"",
"AS",
" ",
"IS",
"\",",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TY",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"EXPR",
"ESS",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"IMPL",
"IED",
",",
" ",
"INC",
"LU",
"DING",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
" ",
"THE",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"AND",
" ",
"NON",
"INF",
"RING",
"EME",
"NT",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"AUTHOR",
"S",
" ",
"OR",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"CLA",
"IM",
",",
" ",
"DA",
"MAGE",
"S",
" ",
"OR",
" ",
"OTHER",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"AN",
" ",
"ACTI",
"ON",
" ",
"OF",
" ",
"CONTR",
"ACT",
",",
" ",
"TOR",
"T",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
",",
" ",
"ARI",
"SIN",
"G",
" ",
"FROM",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"OUT",
" ",
"OF",
" ",
"OR",
" ",
"IN",
" ",
"CONNECTION",
" ",
"WITH",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"OR",
" ",
"THE",
" ",
"USE",
" ",
"OR",
" ",
"OTHER",
" ",
"DEA",
"LING",
"S",
" ",
"IN_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THE",
" ",
"SOFT",
"WARE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Represent",
"s",
" ",
"an",
" ",
"character",
" ",
"picker",
" ",
"display",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"slide",
":",
" ",
"The",
" ",
"Slide",
" ",
"object",
" ",
"this",
" ",
"animati",
"on",
" ",
"is",
" ",
"bei",
"ng",
" ",
"adde",
"d",
" ",
"to",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"machine",
":",
" ",
"The",
" ",
"main",
" ",
"machine",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"x",
":",
" ",
"The",
" ",
"horizon",
"tal",
" ",
"position",
" ",
"offset",
" ",
"for",
" ",
"the",
" ",
"placem",
"ent",
" ",
"of",
" ",
"this",
" ",
"element",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"y",
":",
" ",
"The",
" ",
"vertical",
" ",
"position",
" ",
"offset",
" ",
"for",
" ",
"the",
" ",
"placem",
"ent",
" ",
"of",
" ",
"this",
" ",
"element",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"h",
"\\u",
"pos",
":",
" ",
"The",
" ",
"horizon",
"tal",
" ",
"anchor",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"v",
"\\u",
"pos",
":",
" ",
"The",
" ",
"vertical",
" ",
"anchor",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"e",
":",
" ",
"Full",
" ",
"documentation",
" ",
"on",
" ",
"the",
" ",
"use",
" ",
"of",
" ",
"the",
" ",
"x",
",",
" ",
"y",
",",
" ",
"h",
"\\u",
"pos",
",",
" ",
"and",
" ",
"v",
"\\u",
"pos",
" ",
"argu",
"ment",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"can",
" ",
"be",
" ",
"found",
" ",
"at",
":",
" ",
"https",
"://",
"missio",
"npi",
"nba",
"ll",
".",
"com",
"/",
"docs",
"/",
"display",
"s",
"/",
"display",
"-",
"element",
"s",
"/",
"position",
"ing",
"/",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"slide_",
",_",
"machine_",
",_",
"x_",
"=_",
"None_",
",_",
"y_",
"=_",
"None_",
",_",
"h",
"\\u",
"pos_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"v",
"\\u",
"pos_",
"=_",
"None_",
",_",
"layer_",
"=_",
"0_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Char",
"acte",
"r",
"Picke",
"r_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"slide_",
",_",
"x_",
",_",
"y_",
",_",
"h",
"\\u",
"pos_",
",_",
"v",
"\\u",
"pos_",
",_",
"layer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"fonts_",
"=_",
"machine_",
"._",
"display_",
"._",
"fonts_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"slide_",
"=_",
"slide_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"machine_",
"=_",
"machine_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"layer_",
"=_",
"layer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"config_",
"=_",
"deepcopy_",
"(_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"=_",
"deque_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"cursor",
"\\u",
"position_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
"=_",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"color",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"color",
"'_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"]_",
"=_",
"15_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"]_",
"=_",
"11_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"widt",
"h",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"widt",
"h",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"height",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"height",
"'_",
"]_",
"=_",
"15_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"char",
"\\u",
"x",
"\\u",
"offset",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"x",
"\\u",
"offset",
"'_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"char",
"\\u",
"y",
"\\u",
"offset",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"y",
"\\u",
"offset",
"'_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"shift",
"\\u",
"left",
"\\u",
"tag",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"shift",
"\\u",
"left",
"\\u",
"tag",
"'_",
"]_",
"=_",
"'",
"left",
"\\u",
"flip",
"per",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"shift",
"\\u",
"right",
"\\u",
"tag",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"shift",
"\\u",
"right",
"\\u",
"tag",
"'_",
"]_",
"=_",
"'",
"right",
"\\u",
"flip",
"per",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"select",
"\\u",
"tag",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"select",
"\\u",
"tag",
"'_",
"]_",
"=_",
"'",
"start",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"name",
"'_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"self_",
"._",
"config_",
"[_",
"'",
"name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"'",
"character",
"\\u",
"picker",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"char",
"\\u",
"list",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"list",
"'_",
"]_",
"=_",
"'",
"ABCDE",
"FG",
"HI",
"JK",
"LM",
"NOP",
"QR",
"STU",
"VW",
"XY",
"Z",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"max",
"\\u",
"char",
"s",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"max",
"\\u",
"char",
"s",
"'_",
"]_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"timeo",
"ut",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"timeo",
"ut",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"timeo",
"ut",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tim",
"ing_",
"._",
"string",
"\\u",
"to",
"\\u",
"secs_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"timeo",
"ut",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"back",
"\\u",
"char",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"back",
"\\u",
"char",
"'_",
"]_",
"=_",
"'",
"back",
"\\u",
"arrow",
"\\u",
"7",
"x",
"7",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"end",
"\\u",
"char",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"end",
"\\u",
"char",
"'_",
"]_",
"=_",
"'",
"end",
"\\u",
"11",
"x",
"7",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"back",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"back",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"]_",
"=_",
"'",
"back",
"\\u",
"arrow",
"\\u",
"7",
"x",
"7",
"\\u",
"selecte",
"d",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"end",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"end",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"]_",
"=_",
"'",
"end",
"\\u",
"11",
"x",
"7",
"\\u",
"selecte",
"d",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"return",
"\\u",
"param",
"'_",
"not_",
"in_",
"self_",
"._",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"[_",
"'",
"return",
"\\u",
"param",
"'_",
"]_",
"=_",
"'",
"award",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"color",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"adjust",
"\\u",
"color_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"color",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"adjust",
"\\u",
"color_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"adjust",
"\\u",
"colors_",
"(_",
"**_",
"self_",
"._",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"color",
"'_",
"]_",
"=_",
"self_",
"._",
"adjusted",
"\\u",
"color_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"bg",
"\\u",
"color",
"'_",
"]_",
"=_",
"self_",
"._",
"adjusted",
"\\u",
"bg",
"\\u",
"color_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"._",
"extend_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"list",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"._",
"append_",
"(_",
"'",
"back",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"._",
"append_",
"(_",
"'",
"end",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"._",
"rotate_",
"(_",
"len_",
"(_",
"self_",
"._",
"char",
"\\u",
"list_",
")_",
"/_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"cursor",
"\\u",
"position_",
"=_",
"len_",
"(_",
"self_",
"._",
"char",
"\\u",
"list_",
")_",
"/_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
"=_",
"self_",
"._",
"char",
"\\u",
"list_",
"[_",
"self_",
"._",
"cursor",
"\\u",
"position_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"\\u",
"set\\u",
"machine",
"\\u",
"var_",
"(_",
"name_",
"=_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"setup",
"\\u",
"switch",
"\\u",
"handlers_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"render_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"setup",
"\\u",
"switch",
"\\u",
"handlers_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
"._",
"append_",
"(_",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"add",
"\\u",
"handler_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"switch",
"\\u'_",
"+_",
"self_",
"._",
"config_",
"[_",
"'",
"shift",
"\\u",
"left",
"\\u",
"tag",
"'_",
"]_",
"+_",
"'\\u",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"shift_",
",_",
"places_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
"._",
"append_",
"(_",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"add",
"\\u",
"handler_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"switch",
"\\u'_",
"+_",
"self_",
"._",
"config_",
"[_",
"'",
"shift",
"\\u",
"right",
"\\u",
"tag",
"'_",
"]_",
"+_",
"'\\u",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"shift_",
",_",
"places_",
"=_",
"-_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
"._",
"append_",
"(_",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"add",
"\\u",
"handler_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"switch",
"\\u'_",
"+_",
"self_",
"._",
"config_",
"[_",
"'",
"select",
"\\u",
"tag",
"'_",
"]_",
"+_",
"'\\u",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"select_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"shift_",
"(_",
"self_",
",_",
"places_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"places_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"post_",
"(_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"shift",
"\\u",
"left",
"'_",
")_",
"\\u\\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_",
"._",
"machine_",
"._",
"events_",
"._",
"post_",
"(_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"shift",
"\\u",
"right",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"char",
"\\u",
"list_",
"._",
"rotate_",
"(_",
"places_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
"=_",
"self_",
"._",
"char",
"\\u",
"list_",
"[_",
"self_",
"._",
"cursor",
"\\u",
"position_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"render_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"select_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
"==_",
"'",
"back",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"machine_",
"._",
"\\u",
"set\\u",
"machine",
"\\u",
"var_",
"(_",
"name_",
"=_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"self_",
"._",
"machine_",
"._",
"machine",
"\\u",
"vars_",
"[_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
"]_",
"[_",
":_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"post_",
"(_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"select",
"\\u",
"back",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
"==_",
"'",
"end",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"post_",
"(_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"select",
"\\u",
"end",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"complete_",
"(_",
")_",
"\\u\\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_",
"._",
"machine_",
"._",
"events_",
"._",
"post_",
"(_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"select",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"\\u",
"set\\u",
"machine",
"\\u",
"var_",
"(_",
"name_",
"=_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"value_",
"=_",
"self_",
"._",
"machine_",
"._",
"machine",
"\\u",
"vars_",
"[_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
"]_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"selecte",
"d\\u",
"char_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"len_",
"(_",
"self_",
"._",
"machine_",
"._",
"machine",
"\\u",
"vars_",
"[_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
"]_",
")_",
"==_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"max",
"\\u",
"char",
"s",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"complete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\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_",
"render_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"back",
"\\u",
"surface_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"images_",
"[_",
"self_",
"._",
"config_",
"[_",
"'",
"back",
"\\u",
"char",
"'_",
"]_",
"]_",
"._",
"image",
"\\u",
"surface_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"end",
"\\u",
"surface_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"images_",
"[_",
"self_",
"._",
"config_",
"[_",
"'",
"end",
"\\u",
"char",
"'_",
"]_",
"]_",
"._",
"image",
"\\u",
"surface_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"total",
"\\u",
"width_",
"=_",
"len_",
"(_",
"self_",
"._",
"char",
"\\u",
"list_",
")_",
"*_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"]_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"back",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"end",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
"*_",
"4_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"create",
"\\u",
"element",
"\\u",
"surface_",
"(_",
"total",
"\\u",
"width_",
",_",
"self_",
"._",
"config_",
"[_",
"'",
"height",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"current",
"\\u",
"x",
"\\u",
"position_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"index_",
",_",
"x_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"char",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"x_",
"==_",
"'",
"back",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"char",
"\\u",
"surface_",
"=_",
"back",
"\\u",
"surface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"next",
"\\u",
"offset_",
"=_",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"2_",
"*_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x",
"\\u",
"offset_",
"=_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"x_",
"==_",
"'",
"end",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"char",
"\\u",
"surface_",
"=_",
"end",
"\\u",
"surface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"next",
"\\u",
"offset_",
"=_",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"2_",
"*_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x",
"\\u",
"offset_",
"=_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"char",
"\\u",
"surface_",
"=_",
"self_",
"._",
"fonts_",
"._",
"render_",
"(_",
"text_",
"=_",
"x_",
",_",
"**_",
"self_",
"._",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"next",
"\\u",
"offset_",
"=_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x",
"\\u",
"offset_",
"=_",
"(_",
"(_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"]_",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
")_",
"/_",
"2_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"x",
"\\u",
"offset",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"index_",
"==_",
"self_",
"._",
"cursor",
"\\u",
"position_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"x_",
"==_",
"'",
"back",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"char",
"\\u",
"surface_",
"=_",
"self_",
"._",
"machine_",
"._",
"images_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"back",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"]_",
"]_",
"._",
"image",
"\\u",
"surface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bg",
"\\u",
"width_",
"=_",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"2_",
"*_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"x_",
"==_",
"'",
"end",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"char",
"\\u",
"surface_",
"=_",
"self_",
"._",
"machine_",
"._",
"images_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"end",
"\\u",
"char",
"\\u",
"selecte",
"d",
"'_",
"]_",
"]_",
"._",
"image",
"\\u",
"surface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bg",
"\\u",
"width_",
"=_",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"2_",
"*_",
"self_",
"._",
"config_",
"[_",
"'",
"image",
"\\u",
"padd",
"ing",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"highlighted",
"\\u",
"config_",
"=_",
"deepcopy_",
"(_",
"self_",
"._",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"highlighted",
"\\u",
"config_",
"[_",
"'",
"color",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"color",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"highlighted",
"\\u",
"config_",
"[_",
"'",
"bg",
"\\u",
"color",
"'_",
"]_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"char",
"\\u",
"surface_",
"=_",
"self_",
"._",
"fonts_",
"._",
"render_",
"(_",
"text_",
"=_",
"x_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"highlighted",
"\\u",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bg",
"\\u",
"width_",
"=_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"widt",
"h",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"pygame_",
"._",
"draw_",
"._",
"rect_",
"(_",
"self_",
"._",
"element",
"\\u",
"surface_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"selecte",
"d\\u",
"char",
"\\u",
"bg",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"current",
"\\u",
"x",
"\\u",
"position_",
",_",
"#",
" ",
"left_",
"\\u\\u\\uNL\\u\\u\\u_",
"0_",
",_",
"#",
" ",
"top_",
"\\u\\u\\uNL\\u\\u\\u_",
"bg",
"\\u",
"width_",
",_",
"#",
" ",
"width_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"height",
"'_",
"]_",
")_",
")_",
"#",
" ",
"height_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"element",
"\\u",
"surface_",
"._",
"blit_",
"(_",
"char",
"\\u",
"surface_",
",_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"current",
"\\u",
"x",
"\\u",
"position_",
"+_",
"x",
"\\u",
"offset_",
",_",
"self_",
"._",
"config_",
"[_",
"'",
"char",
"\\u",
"y",
"\\u",
"offset",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"current",
"\\u",
"x",
"\\u",
"position_",
"+=_",
"next",
"\\u",
"offset_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reduce",
" ",
"the",
" ",
"element",
" ",
"surf",
"ace",
" ",
"to",
" ",
"the",
" ",
"widt",
"h",
" ",
"specified",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"config_",
"[_",
"'",
"widt",
"h",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"render",
"ed",
"\\u",
"char",
"\\u",
"surface_",
"=_",
"self_",
"._",
"element",
"\\u",
"surface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"create",
"\\u",
"element",
"\\u",
"surface_",
"(_",
"self_",
"._",
"config_",
"[_",
"'",
"widt",
"h",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"height",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"h",
"\\u",
"offset_",
"=_",
"(_",
"render",
"ed",
"\\u",
"char",
"\\u",
"surface_",
"._",
"get",
"\\u",
"width_",
"(_",
")_",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"widt",
"h",
"'_",
"]_",
")_",
"/_",
"-_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"element",
"\\u",
"surface_",
"._",
"blit_",
"(_",
"render",
"ed",
"\\u",
"char",
"\\u",
"surface_",
",_",
"(_",
"h",
"\\u",
"offset_",
",_",
"0_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"set\\u",
"position_",
"(_",
"self_",
"._",
"x_",
",_",
"self_",
"._",
"y_",
",_",
"self_",
"._",
"h",
"\\u",
"pos_",
",_",
"self_",
"._",
"v",
"\\u",
"pos_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dirty_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"slide_",
"._",
"refresh_",
"(_",
"force",
"\\u",
"dirty_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"complete_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"scrub",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"self_",
"._",
"machine_",
"._",
"machine",
"\\u",
"vars_",
"[_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"'",
" ",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"machine",
"\\u",
"vars_",
"[_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"char",
"s",
"\\u",
"enter",
"ed",
"'_",
"]_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return",
"\\u",
"param_",
"=_",
"{_",
"self_",
"._",
"config_",
"[_",
"'",
"return",
"\\u",
"param",
"'_",
"]_",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"config_",
"[_",
"'",
"text",
"\\u",
"variab",
"les",
"'_",
"]_",
"[_",
"self_",
"._",
"config_",
"[_",
"'",
"return",
"\\u",
"param",
"'_",
"]_",
"]_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"machine_",
"._",
"send_",
"(_",
"bc",
"p",
"\\u",
"command_",
"=_",
"'",
"trigger",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"self_",
"._",
"name_",
"+_",
"'\\u",
"complete",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"player",
"\\u",
"name_",
"=_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"return",
"\\u",
"param_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Char",
"acte",
"r",
"Picke",
"r_",
"(_",
"Display",
"Element_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"scrub",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"machine_",
"._",
"events_",
"._",
"remove",
"\\u",
"handler",
"s",
"\\u",
"by",
"\\u",
"keys_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"register",
"ed",
"\\u",
"event",
"\\u",
"handlers_",
"=_",
"list_",
"(_",
")_",
"\\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,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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | aparo/pyes/pyes/tests.py | [
{
"content": " def checkRaises(self, excClass, callableObj, *args, **kwargs):\n \"\"\"Assert that calling callableObj with *args and **kwargs raises an\n exception of type excClass, and return the exception object so that\n further tests on it can be performed.\n \"\"\"\n try:\n callableObj(*args, **kwargs)\n except excClass as e:\n return e\n else:\n raise self.failureException(\"Expected exception %s not raised\" % excClass)",
"metadata": "root.ESTestCase.checkRaises",
"header": "['class', 'ESTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 40
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"EST",
"est",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"check",
"Raises_",
"(_",
"self_",
",_",
"exc",
"Class_",
",_",
"calla",
"ble",
"Obj_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Assert",
" ",
"tha",
"t",
" ",
"calling",
" ",
"calla",
"ble",
"Obj",
" ",
"with",
" ",
"*",
"args",
" ",
"and",
" ",
"**",
"kwarg",
"s",
" ",
"raise",
"s",
" ",
"an",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exception",
" ",
"of",
" ",
"type",
" ",
"exc",
"Class",
",",
" ",
"and",
" ",
"return",
" ",
"the",
" ",
"exception",
" ",
"object",
" ",
"so",
" ",
"tha",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fur",
"ther",
" ",
"tests",
" ",
"on",
" ",
"it",
" ",
"can",
" ",
"be",
" ",
"perform",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"calla",
"ble",
"Obj_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exc",
"Class_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"e_",
"\\u\\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_",
"self_",
"._",
"fail",
"ure",
"Exception_",
"(_",
"\"",
"Expect",
"ed",
" ",
"exception",
" ",
"%",
"s",
" ",
"not",
" ",
"raise",
"d",
"\"_",
"%_",
"exc",
"Class_",
")_",
"\\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
] |
Unused import | ImageEngine/gaffer/python/GafferUI/Window.py | [
{
"content": "##########################################################################\n#\n# Copyright (c) 2011-2012, John Haddon. All rights reserved.\n# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport sys\nimport warnings\n\nimport IECore\n\nimport GafferUI\nimport Gaffer\n\nQtCore = GafferUI._qtImport( \"QtCore\" )\nQtGui = GafferUI._qtImport( \"QtGui\" )\n\n\n\n# this single instance is used by all window widgets\n_windowEventFilter = _WindowEventFilter()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Window( GafferUI.ContainerWidget ) :\n\n\tSizeMode = IECore.Enum.create( \"Fixed\", \"Manual\", \"Automatic\" )\n\n\t## \\todo Remove the deprecated resizable argument\n\n\n\n\t## Overridden from the base class to ensure that\n\t# window.setVisible( True ) also raises and unminimizes\n\t# the window.\n\n\n\n\n\n\t## Adding a child window causes the child to stay\n\t# on top of the parent at all times. This is useful for\n\t# preventing dialogues and the like from disappearing behind\n\t# the main window. Note that the parent will keep the child\n\t# window alive until it is removed using removeChild() -\n\t# passing removeOnClose=True provides a convenient mechanism\n\t# for removing it automatically when it is closed.\n\n\t## Returns a list of all the windows parented to this one.\n\n\t## \\deprecated\n\n\t## \\deprecated\n\n\n\n\t## Resizes the window to fit the requirements of the current child.\n\t# The shrink or expand arguments may be set to False to prevent the\n\t# window becoming smaller or larger than its current size if that is\n\t# not desired.\n\n\n\n\n\n\n\n\t## Requests that this window be closed - this function may either be called\n\t# directly or in response to the user attempting to close the window.\n\t# If successful, setVisible( False ) will be called on the window and True will\n\t# be returned. However, the window may choose to deny the request in which case\n\t# the window will remain visible and False will be returned. The latter possibility\n\t# is to allow windows to take appropriate action when closing a window would mean a\n\t# user losing work. If a window is not visible on entry to this function then no\n\t# action is taken and False is returned.\n\n\t## Subclasses may override this to deny the closing of a window triggered\n\t# either by user action or by a call to close(). Simply return False to\n\t# prevent the closing.\n\n\t## A signal emitted when the window has been closed successfully, either through\n\t# user action or a call to close()\n\n\t__caughtKeysSet = None\n",
"metadata": "root.Window",
"header": "['module', '___EOS___']",
"index": 48
},
{
"content": "\tdef __init__( self, title=\"GafferUI.Window\", borderWidth=0, resizeable=None, child=None, sizeMode=SizeMode.Manual, icon=\"GafferLogoMini.png\", parenting=None ) :\n\n\t\tGafferUI.ContainerWidget.__init__(\n\t\t\tself,\n\t\t\tQtGui.QWidget( None, QtCore.Qt.WindowFlags( QtCore.Qt.Window ) ),\n\t\t\tparenting = parenting\n\t\t)\n\n\t\tself.__child = None\n\t\tself.__childWindows = set()\n\t\tself.__qtLayout = QtGui.QGridLayout()\n\t\tself.__qtLayout.setContentsMargins( borderWidth, borderWidth, borderWidth, borderWidth )\n\t\tself.__qtLayout.setSizeConstraint( QtGui.QLayout.SetMinAndMaxSize )\n\n\t\t# The initial size of a widget in qt \"depends on the user's platform and screen geometry\".\n\t\t# In other words, it is useless. We use this flag to determine whether or not our size is\n\t\t# this meaningless initial size, or whether it has been set appropriately. This is needed in\n\t\t# resizeToFitChild().\n\t\tself.__sizeValid = False\n\n\t\tif len( self.__caughtKeys() ):\n\t\t\t# set up a key press handler, so we can catch various key presses and stop them being handled by the\n\t\t\t# host application\n\t\t\tself.__keyPressConnection = self.keyPressSignal().connect( Gaffer.WeakMethod( self.__keyPress ) )\n\n\n\t\t# \\todo Does this hurt performance? Maybe keyPressSignal() should set this up when it's called?\n\t\tself._qtWidget().setFocusPolicy( QtCore.Qt.ClickFocus )\n\n\t\tself._qtWidget().setLayout( self.__qtLayout )\n\n\t\tself._qtWidget().installEventFilter( _windowEventFilter )\n\n\t\tself._qtWidget().setObjectName(\"gafferWindow\")\n\n\t\tself._setStyleSheet()\n\n\t\tself.setTitle( title )\n\t\tself.setIcon( icon )\n\n\t\tif resizeable is not None :\n\t\t\tself.setResizeable( resizeable )\n\t\telse :\n\t\t\tself.setSizeMode( sizeMode )\n\n\t\tself.__closedSignal = GafferUI.WidgetSignal()\n\n\t\tself.setChild( child )",
"metadata": "root.Window.__init__",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 53
},
{
"content": "\tdef setTitle( self, title ) :\n\n\t\tself._qtWidget().setWindowTitle( title )",
"metadata": "root.Window.setTitle",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 102
},
{
"content": "\tdef getTitle( self ) :\n\n\t\treturn self._qtWidget().windowTitle()",
"metadata": "root.Window.getTitle",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 106
},
{
"content": "\tdef setVisible( self, visible ) :\n\n\t\tGafferUI.Widget.setVisible( self, visible )\n\n\t\tif self.visible() :\n\t\t\tif self._qtWidget().isMinimized() :\n\t\t\t\tself._qtWidget().showNormal()\n\t\t\tself._qtWidget().raise_()",
"metadata": "root.Window.setVisible",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 113
},
{
"content": "\tdef removeChild( self, child ) :\n\n\t\tassert( child is self.__child or child in self.__childWindows )\n\t\tchild._qtWidget().setParent( None )\n\t\tchild._applyVisibility()\n\t\tif child is self.__child :\n\t\t\tself.__child = None\n\t\telse :\n\t\t\tself.__childWindows.remove( child )",
"metadata": "root.Window.removeChild",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 122
},
{
"content": "\tdef addChild( self, child ) :\n\n\t\tif isinstance( child, Window ) :\n\t\t\tself.addChildWindow( child )\n\t\telse :\n\t\t\tif self.getChild() is not None :\n\t\t\t\traise Exception( \"Window can only hold one child\" )\n\t\t\tself.setChild( child )",
"metadata": "root.Window.addChild",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 132
},
{
"content": "\tdef setChild( self, child ) :\n\n\t\toldChild = self.getChild()\n\t\tif oldChild is not None :\n\t\t\tself.removeChild( oldChild )\n\n\t\tif child is not None :\n\n\t\t\toldParent = child.parent()\n\t\t\tif oldParent is not None :\n\t\t\t\toldParent.removeChild( child )\n\n\t\t\tself.__child = child\n\t\t\tself.__qtLayout.addWidget( child._qtWidget(), 0, 0 )\n\t\t\tchild._applyVisibility()",
"metadata": "root.Window.setChild",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 141
},
{
"content": "\tdef getChild( self ) :\n\n\t\treturn self.__child",
"metadata": "root.Window.getChild",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 157
},
{
"content": "\tdef addChildWindow( self, childWindow, removeOnClose=False ) :\n\n\t\tassert( isinstance( childWindow, Window ) )\n\n\t\toldParent = childWindow.parent()\n\t\tif oldParent is not None :\n\t\t\toldParent.removeChild( childWindow )\n\n\t\tself.__childWindows.add( childWindow )\n\n\t\t# We have the following criteria for child windows :\n\t\t#\n\t\t#\t- they must always stay on top of their parent\n\t\t#\t\t- even when the parent is fullscreen\n\t\t#\t- they must open somewhere sensible by default\n\t\t#\t\t- ideally centered on the parent\n\t\t#\t- they must take focus nicely when asked (by PathChooserDialogue for instance)\n\t\t#\n\t\t# On OS X, the Tool window type does an excellent job\n\t\t# of all of that, as well as looking pretty. But if we use\n\t\t# the Dialog window type, they disappear behind full screen\n\t\t# windows.\n\t\t#\n\t\t# On Linux, the Tool window type does a poor job, opening\n\t\t# in arbitrary places, and displaying various focus problems.\n\t\t# The Dialog type on the other hand does a much better job. Of\n\t\t# course, this being X11, different window managers will do different\n\t\t# things, but on the whole the Dialog type seems best for X11.\n\t\tchildWindowType = QtCore.Qt.Tool if sys.platform == \"darwin\" else QtCore.Qt.Dialog\n\t\tchildWindowFlags = ( childWindow._qtWidget().windowFlags() & ~QtCore.Qt.WindowType_Mask ) | childWindowType\n\t\tchildWindow._qtWidget().setParent( self._qtWidget(), childWindowFlags )\n\t\tchildWindow._applyVisibility()\n\n\t\tif removeOnClose :\n\t\t\tchildWindow.__removeOnCloseConnection = childWindow.closedSignal().connect( lambda w : w.parent().removeChild( w ) )",
"metadata": "root.Window.addChildWindow",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 168
},
{
"content": "\tdef childWindows( self ) :\n\n\t\treturn list( self.__childWindows )",
"metadata": "root.Window.childWindows",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 205
},
{
"content": "\tdef setResizeable( self, resizeable ) :\n\n\t\twarnings.warn( \"Window.setResizeable() is deprecated, use Window.setSizeMode() instead.\", DeprecationWarning, 2 )\n\t\tif resizeable :\n\t\t\tself.setSizeMode( self.SizeMode.Manual )\n\t\telse :\n\t\t\tself.setSizeMode( self.SizeMode.Fixed )",
"metadata": "root.Window.setResizeable",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 210
},
{
"content": "\tdef getResizeable( self ) :\n\n\t\twarnings.warn( \"Window.getResizeable() is deprecated, use Window.getSizeMode() instead.\", DeprecationWarning, 2 )\n\t\treturn self.getSizeMode() == self.SizeMode.Manual",
"metadata": "root.Window.getResizeable",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 219
},
{
"content": "\tdef setSizeMode( self, sizeMode ) :\n\n\t\tself.__sizeMode = sizeMode\n\t\tif sizeMode == self.SizeMode.Manual :\n\t\t\tself.__qtLayout.setSizeConstraint( QtGui.QLayout.SetDefaultConstraint )\n\t\telse :\n\t\t\tself.__qtLayout.setSizeConstraint( QtGui.QLayout.SetFixedSize )",
"metadata": "root.Window.setSizeMode",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 224
},
{
"content": "\tdef getSizeMode( self ) :\n\n\t\treturn self.__sizeMode",
"metadata": "root.Window.getSizeMode",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 232
},
{
"content": "\tdef resizeToFitChild( self, shrink=True, expand=True ) :\n\n\t\ts = self._qtWidget().size()\n\t\tsizeHint = self._qtWidget().sizeHint()\n\n\t\tif expand or not self.__sizeValid :\n\t\t\ts = s.expandedTo( sizeHint )\n\t\tif shrink or not self.__sizeValid :\n\t\t\ts = s.boundedTo( sizeHint )\n\n\t\tself._qtWidget().resize( s )",
"metadata": "root.Window.resizeToFitChild",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 240
},
{
"content": "\tdef setPosition( self, position ) :\n\n\t\tself._qtWidget().move( position.x, position.y )",
"metadata": "root.Window.setPosition",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 252
},
{
"content": "\tdef getPosition( self ) :\n\n\t\treturn IECore.V2i( self._qtWidget().x(), self._qtWidget().y() )",
"metadata": "root.Window.getPosition",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 256
},
{
"content": "\tdef setFullScreen( self, fullScreen ) :\n\n\t\tif fullScreen :\n\t\t\tself._qtWidget().showFullScreen()\n\t\telse :\n\t\t\tself._qtWidget().showNormal()",
"metadata": "root.Window.setFullScreen",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 260
},
{
"content": "\tdef getFullScreen( self ) :\n\n\t\treturn self._qtWidget().isFullScreen()",
"metadata": "root.Window.getFullScreen",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 267
},
{
"content": "\tdef setIcon( self, imageOrImageFileName ) :\n\n\t\tif isinstance( imageOrImageFileName, basestring ) :\n\t\t\tself.__image = GafferUI.Image( imageOrImageFileName )\n\t\telse :\n\t\t\tself.__image = imageOrImageFileName\n\n\t\tself._qtWidget().setWindowIcon( QtGui.QIcon( self.__image._qtPixmap() ) )",
"metadata": "root.Window.setIcon",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 271
},
{
"content": "\tdef getIcon( self ) :\n\n\t\treturn self.__image",
"metadata": "root.Window.getIcon",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 280
},
{
"content": "\tdef close( self ) :\n\n\t\tif not self.getVisible() :\n\t\t\treturn False\n\n\t\tif self._acceptsClose() :\n\t\t\tself.setVisible( False )\n\t\t\tself.closedSignal()( self )\n\t\t\treturn True\n\t\telse :\n\t\t\treturn False",
"metadata": "root.Window.close",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 292
},
{
"content": "\tdef _acceptsClose( self ) :\n\n\t\treturn True",
"metadata": "root.Window._acceptsClose",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 307
},
{
"content": "\tdef closedSignal( self ) :\n\n\t\treturn self.__closedSignal",
"metadata": "root.Window.closedSignal",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 313
},
{
"content": "\t@classmethod\n\tdef __caughtKeys( cls ):\n\n\t\tif cls.__caughtKeysSet is None:\n\n\t\t\ttry:\n\t\t\t\t# are we in maya? If so, we need to catch the ctrl and shift key presses to prevent\n\t\t\t\t# maya from handling them and doing crazy focus stealing stuff\n\t\t\t\timport maya\n\t\t\t\tcls.__caughtKeysSet = set( [\"Control\", \"Shift\"] )\n\t\t\texcept ImportError:\n\t\t\t\tcls.__caughtKeysSet = set()\n\n\t\treturn cls.__caughtKeysSet",
"metadata": "root.Window.__caughtKeys",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 318
},
{
"content": "\tdef __keyPress( self, widget, event ):\n\n\t\treturn event.key in self.__caughtKeys()",
"metadata": "root.Window.__keyPress",
"header": "['class', 'Window', '(', 'GafferUI', '.', 'ContainerWidget', ')', ':', '___EOS___']",
"index": 333
},
{
"content": "class _WindowEventFilter( QtCore.QObject ) :\n\n",
"metadata": "root._WindowEventFilter",
"header": "['module', '___EOS___']",
"index": 337
},
{
"content": "\tdef __init__( self ) :\n\n\t\tQtCore.QObject.__init__( self )",
"metadata": "root._WindowEventFilter.__init__",
"header": "['class', '_WindowEventFilter', '(', 'QtCore', '.', 'QObject', ')', ':', '___EOS___']",
"index": 339
},
{
"content": "\tdef eventFilter( self, qObject, qEvent ) :\n\n\t\ttype = qEvent.type()\n\n\t\tif type==QtCore.QEvent.Close :\n\t\t\twidget = GafferUI.Widget._owner( qObject )\n\t\t\tclosed = widget.close()\n\t\t\tif closed :\n\t\t\t\tqEvent.accept()\n\t\t\telse :\n\t\t\t\tqEvent.ignore()\n\t\t\treturn True\n\t\telif type==QtCore.QEvent.LayoutRequest :\n\t\t\twidget = GafferUI.Widget._owner( qObject )\n\t\t\tif widget.getSizeMode() == widget.SizeMode.Automatic :\n\t\t\t\twidget.resizeToFitChild()\n\t\t\t\treturn True\n\t\telif type==QtCore.QEvent.Resize :\n\t\t\twidget = GafferUI.Widget._owner( qObject )\n\t\t\twidget._Window__sizeValid = True\n\n\t\treturn False",
"metadata": "root._WindowEventFilter.eventFilter",
"header": "['class', '_WindowEventFilter', '(', 'QtCore', '.', 'QObject', ')', ':', '___EOS___']",
"index": 343
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2011",
"-",
"2012",
",",
" ",
"Joh",
"n",
" ",
"Had",
"don",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2011",
"-",
"2012",
",",
" ",
"Image",
" ",
"Engine",
" ",
"Desig",
"n",
" ",
"Inc",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Redistributi",
"on",
" ",
"and",
" ",
"use",
" ",
"in",
" ",
"source",
" ",
"and",
" ",
"binar",
"y",
" ",
"forms",
",",
" ",
"with",
" ",
"or",
" ",
"with",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
" ",
"are",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Nei",
"ther",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"Joh",
"n",
" ",
"Had",
"don",
" ",
"nor",
" ",
"the",
" ",
"names",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"any",
" ",
"other",
" ",
"contributor",
"s",
" ",
"to",
" ",
"this",
" ",
"software",
" ",
"may",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"endo",
"rse",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"promote",
" ",
"products",
" ",
"derive",
"d",
" ",
"from",
" ",
"this",
" ",
"software",
" ",
"with",
"out",
" ",
"specific",
" ",
"prior_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"writt",
"en",
" ",
"permissi",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THIS",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"BY",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"AND",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"\"",
"AS_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"IS",
"\"",
" ",
"AND",
" ",
"ANY",
" ",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
",",
" ",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THE",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"AND",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PUR",
"POS",
"E",
" ",
"ARE",
" ",
"DISC",
"LAI",
"MED",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"OWNER",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"DIRECT",
",",
" ",
"INDI",
"RECT",
",",
" ",
"INC",
"IDENT",
"AL",
",",
" ",
"SPECIAL",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"EXE",
"MPL",
"ARY",
",",
" ",
"OR",
" ",
"CONS",
"EQU",
"ENTI",
"AL",
" ",
"DA",
"MAGE",
"S",
" ",
"(",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROC",
"URE",
"MENT",
" ",
"OF",
" ",
"SUBST",
"ITU",
"TE",
" ",
"GOOD",
"S",
" ",
"OR",
" ",
"SERVICES",
";",
" ",
"LOSS",
" ",
"OF",
" ",
"USE",
",",
" ",
"DATA",
",",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROF",
"IT",
"S",
";",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")",
" ",
"HO",
"WE",
"VER",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",",
" ",
"STRI",
"CT",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
")",
" ",
"ARI",
"SIN",
"G",
" ",
"IN",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF",
" ",
"ADV",
"ISE",
"D",
" ",
"OF",
" ",
"THE",
" ",
"POS",
"SIB",
"ILI",
"TY",
" ",
"OF",
" ",
"SUC",
"H",
" ",
"DA",
"MAGE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"warnings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"IE",
"Core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"UI_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Qt",
"Core_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"\\u",
"qt",
"Import_",
"(_",
"\"",
"Qt",
"Core",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Qt",
"Gui_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"\\u",
"qt",
"Import_",
"(_",
"\"",
"Qt",
"Gui",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"single",
" ",
"instance",
" ",
"is",
" ",
"used",
" ",
"by",
" ",
"all",
" ",
"window",
" ",
"widgets_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u",
"window",
"Event",
"Filter_",
"=_",
"\\u",
"Window",
"Event",
"Filter_",
"(_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"Size",
"Mode_",
"=_",
"IE",
"Core_",
"._",
"Enum_",
"._",
"create_",
"(_",
"\"",
"Fix",
"ed",
"\"_",
",_",
"\"",
"Manu",
"al",
"\"_",
",_",
"\"",
"Automat",
"ic",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"\\\\",
"todo",
" ",
"Remove",
" ",
"the",
" ",
"depre",
"cated",
" ",
"resizable",
" ",
"argument_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Over",
"rid",
"den",
" ",
"from",
" ",
"the",
" ",
"base",
" ",
"class",
" ",
"to",
" ",
"ensure",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"window",
".",
"set",
"Vis",
"ibl",
"e",
"(",
" ",
"Tru",
"e",
" ",
")",
" ",
"als",
"o",
" ",
"raise",
"s",
" ",
"and",
" ",
"unm",
"ini",
"mi",
"zes",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"window",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Add",
"ing",
" ",
"a",
" ",
"child",
" ",
"window",
" ",
"caus",
"es",
" ",
"the",
" ",
"child",
" ",
"to",
" ",
"stay",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"on",
" ",
"top",
" ",
"of",
" ",
"the",
" ",
"parent",
" ",
"at",
" ",
"all",
" ",
"times",
".",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"prevent",
"ing",
" ",
"dialogue",
"s",
" ",
"and",
" ",
"the",
" ",
"like",
" ",
"from",
" ",
"disapp",
"ear",
"ing",
" ",
"beh",
"ind_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"main",
" ",
"window",
".",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"the",
" ",
"parent",
" ",
"will",
" ",
"keep",
" ",
"the",
" ",
"child_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"window",
" ",
"alive",
" ",
"unti",
"l",
" ",
"it",
" ",
"is",
" ",
"remove",
"d",
" ",
"usi",
"ng",
" ",
"remove",
"Chil",
"d",
"()",
" ",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"passi",
"ng",
" ",
"remove",
"On",
"Clos",
"e",
"=",
"Tru",
"e",
" ",
"provide",
"s",
" ",
"a",
" ",
"convenien",
"t",
" ",
"mechanism",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"remo",
"ving",
" ",
"it",
" ",
"automati",
"call",
"y",
" ",
"whe",
"n",
" ",
"it",
" ",
"is",
" ",
"close",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"all",
" ",
"the",
" ",
"windows",
" ",
"parent",
"ed",
" ",
"to",
" ",
"this",
" ",
"one",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"\\\\",
"deprecated_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"\\\\",
"deprecated_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Resize",
"s",
" ",
"the",
" ",
"window",
" ",
"to",
" ",
"fit",
" ",
"the",
" ",
"require",
"ment",
"s",
" ",
"of",
" ",
"the",
" ",
"current",
" ",
"child",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"shrink",
" ",
"or",
" ",
"expand",
" ",
"argu",
"ment",
"s",
" ",
"may",
" ",
"be",
" ",
"set",
" ",
"to",
" ",
"Fal",
"se",
" ",
"to",
" ",
"prevent",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"window",
" ",
"bec",
"omin",
"g",
" ",
"small",
"er",
" ",
"or",
" ",
"large",
"r",
" ",
"than",
" ",
"its",
" ",
"current",
" ",
"size",
" ",
"if",
" ",
"tha",
"t",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"desi",
"red",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Request",
"s",
" ",
"tha",
"t",
" ",
"this",
" ",
"window",
" ",
"be",
" ",
"close",
"d",
" ",
"-",
" ",
"this",
" ",
"function",
" ",
"may",
" ",
"eit",
"her",
" ",
"be",
" ",
"called_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"direct",
"ly",
" ",
"or",
" ",
"in",
" ",
"response",
" ",
"to",
" ",
"the",
" ",
"user",
" ",
"atte",
"mpt",
"ing",
" ",
"to",
" ",
"close",
" ",
"the",
" ",
"window",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"success",
"ful",
",",
" ",
"set",
"Vis",
"ibl",
"e",
"(",
" ",
"Fal",
"se",
" ",
")",
" ",
"will",
" ",
"be",
" ",
"call",
"ed",
" ",
"on",
" ",
"the",
" ",
"window",
" ",
"and",
" ",
"Tru",
"e",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"be",
" ",
"return",
"ed",
".",
" ",
"Ho",
"we",
"ver",
",",
" ",
"the",
" ",
"window",
" ",
"may",
" ",
"choose",
" ",
"to",
" ",
"deny",
" ",
"the",
" ",
"request",
" ",
"in",
" ",
"whi",
"ch",
" ",
"case_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"window",
" ",
"will",
" ",
"rema",
"in",
" ",
"visi",
"ble",
" ",
"and",
" ",
"Fal",
"se",
" ",
"will",
" ",
"be",
" ",
"return",
"ed",
".",
" ",
"The",
" ",
"latt",
"er",
" ",
"possibilit",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"is",
" ",
"to",
" ",
"allow",
" ",
"windows",
" ",
"to",
" ",
"take",
" ",
"appropr",
"iate",
" ",
"action",
" ",
"whe",
"n",
" ",
"clos",
"ing",
" ",
"a",
" ",
"window",
" ",
"wou",
"ld",
" ",
"mean",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"user",
" ",
"los",
"ing",
" ",
"work",
".",
" ",
"If",
" ",
"a",
" ",
"window",
" ",
"is",
" ",
"not",
" ",
"visi",
"ble",
" ",
"on",
" ",
"entry",
" ",
"to",
" ",
"this",
" ",
"function",
" ",
"then",
" ",
"no_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"action",
" ",
"is",
" ",
"take",
"n",
" ",
"and",
" ",
"Fal",
"se",
" ",
"is",
" ",
"return",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Subc",
"lasse",
"s",
" ",
"may",
" ",
"override",
" ",
"this",
" ",
"to",
" ",
"deny",
" ",
"the",
" ",
"clos",
"ing",
" ",
"of",
" ",
"a",
" ",
"window",
" ",
"triggered_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"eit",
"her",
" ",
"by",
" ",
"user",
" ",
"action",
" ",
"or",
" ",
"by",
" ",
"a",
" ",
"call",
" ",
"to",
" ",
"close",
"()",
".",
" ",
"Simp",
"ly",
" ",
"return",
" ",
"Fal",
"se",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"prevent",
" ",
"the",
" ",
"clos",
"ing",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"A",
" ",
"signal",
" ",
"emitte",
"d",
" ",
"whe",
"n",
" ",
"the",
" ",
"window",
" ",
"has",
" ",
"bee",
"n",
" ",
"close",
"d",
" ",
"success",
"full",
"y",
",",
" ",
"eit",
"her",
" ",
"through_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"user",
" ",
"action",
" ",
"or",
" ",
"a",
" ",
"call",
" ",
"to",
" ",
"close",
"()",
"_",
"\\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",
"cau",
"ght",
"Keys",
"Set_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"title_",
"=_",
"\"",
"Ga",
"ffer",
"UI",
".",
"Window",
"\"_",
",_",
"border",
"Width_",
"=_",
"0_",
",_",
"resiz",
"eab",
"le_",
"=_",
"None_",
",_",
"child_",
"=_",
"None_",
",_",
"size",
"Mode_",
"=_",
"Size",
"Mode_",
"._",
"Manu",
"al_",
",_",
"icon_",
"=_",
"\"",
"Ga",
"ffer",
"Logo",
"Mini",
".",
"png",
"\"_",
",_",
"parent",
"ing_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Qt",
"Gui_",
"._",
"QW",
"idge",
"t_",
"(_",
"None_",
",_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Window",
"Flags_",
"(_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Window_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parent",
"ing_",
"=_",
"parent",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"child_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"child",
"Windows_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"=_",
"Qt",
"Gui_",
"._",
"QG",
"rid",
"Layout_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"._",
"set",
"Conten",
"ts",
"Margins_",
"(_",
"border",
"Width_",
",_",
"border",
"Width_",
",_",
"border",
"Width_",
",_",
"border",
"Width_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"._",
"set",
"Size",
"Constraint_",
"(_",
"Qt",
"Gui_",
"._",
"QL",
"ayout",
"_",
"._",
"Set",
"Min",
"And",
"Max",
"Size_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"initial",
" ",
"size",
" ",
"of",
" ",
"a",
" ",
"widget",
" ",
"in",
" ",
"qt",
" ",
"\"",
"depend",
"s",
" ",
"on",
" ",
"the",
" ",
"user",
"'",
"s",
" ",
"platform",
" ",
"and",
" ",
"screen",
" ",
"geom",
"etry",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"other",
" ",
"words",
",",
" ",
"it",
" ",
"is",
" ",
"usel",
"ess",
".",
" ",
"We",
" ",
"use",
" ",
"this",
" ",
"flag",
" ",
"to",
" ",
"dete",
"rmin",
"e",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"our",
" ",
"size",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"meaning",
"less",
" ",
"initial",
" ",
"size",
",",
" ",
"or",
" ",
"whe",
"ther",
" ",
"it",
" ",
"has",
" ",
"bee",
"n",
" ",
"set",
" ",
"appropr",
"iate",
"ly",
".",
" ",
"Thi",
"s",
" ",
"is",
" ",
"need",
"ed",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"resiz",
"e",
"To",
"Fit",
"Chil",
"d",
"()",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"size",
"Valid_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"set",
" ",
"up",
" ",
"a",
" ",
"key",
" ",
"press",
" ",
"handler",
",",
" ",
"so",
" ",
"we",
" ",
"can",
" ",
"catch",
" ",
"vari",
"ous",
" ",
"key",
" ",
"presse",
"s",
" ",
"and",
" ",
"stop",
" ",
"them",
" ",
"bei",
"ng",
" ",
"handle",
"d",
" ",
"by",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"host",
" ",
"application_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"key",
"Press",
"Connection_",
"=_",
"self_",
"._",
"key",
"Press",
"Signal_",
"(_",
")_",
"._",
"connect_",
"(_",
"Ga",
"ffer",
"_",
"._",
"Wea",
"k",
"Method_",
"(_",
"self_",
"._",
"\\u\\u",
"key",
"Press_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\\\\",
"todo",
" ",
"Do",
"es",
" ",
"this",
" ",
"hur",
"t",
" ",
"perform",
"anc",
"e",
"?",
" ",
"Ma",
"yb",
"e",
" ",
"key",
"Press",
"Signal",
"()",
" ",
"shou",
"ld",
" ",
"set",
" ",
"this",
" ",
"up",
" ",
"whe",
"n",
" ",
"it",
"'",
"s",
" ",
"call",
"ed",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Foc",
"us",
"Policy_",
"(_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Click",
"Focus_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Layout_",
"(_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"install",
"Event",
"Filter_",
"(_",
"\\u",
"window",
"Event",
"Filter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Object",
"Name_",
"(_",
"\"",
"ga",
"ffer",
"Window",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"set",
"Style",
"Sheet_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"set",
"Title_",
"(_",
"title_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"set",
"Icon_",
"(_",
"icon_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"resiz",
"eab",
"le_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"set",
"Resize",
"able_",
"(_",
"resiz",
"eab",
"le_",
")_",
"\\u\\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_",
"self_",
"._",
"set",
"Size",
"Mode_",
"(_",
"size",
"Mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"close",
"d",
"Signal_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Wid",
"get",
"Signal_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"set",
"Child_",
"(_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Title_",
"(_",
"self_",
",_",
"title_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Window",
"Title_",
"(_",
"title_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Title_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"window",
"Title_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Visible_",
"(_",
"self_",
",_",
"visible_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"Ga",
"ffer",
"UI_",
"._",
"Widget_",
"._",
"set",
"Visible_",
"(_",
"self_",
",_",
"visible_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"visible_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"if_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"is",
"Minimiz",
"ed_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"show",
"Normal_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"raise",
"\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"remove",
"Child_",
"(_",
"self_",
",_",
"child_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"assert_",
"(_",
"child_",
"is_",
"self_",
"._",
"\\u\\u",
"child_",
"or_",
"child_",
"in_",
"self_",
"._",
"\\u\\u",
"child",
"Windows_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Parent_",
"(_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child_",
"._",
"\\u",
"appl",
"y",
"Visibility_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"child_",
"is_",
"self_",
"._",
"\\u\\u",
"child_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"child_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"child",
"Windows_",
"._",
"remove_",
"(_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"Child_",
"(_",
"self_",
",_",
"child_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Window_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"add",
"Chil",
"d",
"Window_",
"(_",
"child_",
")_",
"\\u\\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_",
"if_",
"self_",
"._",
"get",
"Child_",
"(_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"raise_",
"Exception_",
"(_",
"\"",
"Window",
" ",
"can",
" ",
"only",
" ",
"hold",
" ",
"one",
" ",
"child",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"set",
"Child_",
"(_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Child_",
"(_",
"self_",
",_",
"child_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"old",
"Child_",
"=_",
"self_",
"._",
"get",
"Child_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"old",
"Child_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"remove",
"Child_",
"(_",
"old",
"Child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"child_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"old",
"Parent_",
"=_",
"child_",
"._",
"parent_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"old",
"Parent_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"old",
"Parent_",
"._",
"remove",
"Child_",
"(_",
"child_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"child_",
"=_",
"child_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"._",
"add",
"Widget_",
"(_",
"child_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
",_",
"0_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child_",
"._",
"\\u",
"appl",
"y",
"Visibility_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Child_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u\\u",
"child_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"Chil",
"d",
"Window_",
"(_",
"self_",
",_",
"child",
"Window_",
",_",
"remove",
"On",
"Close_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"assert_",
"(_",
"isinstance_",
"(_",
"child",
"Window_",
",_",
"Window_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"old",
"Parent_",
"=_",
"child",
"Window_",
"._",
"parent_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"old",
"Parent_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"old",
"Parent_",
"._",
"remove",
"Child_",
"(_",
"child",
"Window_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"child",
"Windows_",
"._",
"add_",
"(_",
"child",
"Window_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"have",
" ",
"the",
" ",
"follow",
"ing",
" ",
"crite",
"ria",
" ",
"for",
" ",
"child",
" ",
"windows",
" ",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"\t",
"-",
" ",
"the",
"y",
" ",
"must",
" ",
"alw",
"ay",
"s",
" ",
"stay",
" ",
"on",
" ",
"top",
" ",
"of",
" ",
"thei",
"r",
" ",
"parent_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"\t",
"\t",
"-",
" ",
"even",
" ",
"whe",
"n",
" ",
"the",
" ",
"parent",
" ",
"is",
" ",
"fullscreen",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"\t",
"-",
" ",
"the",
"y",
" ",
"must",
" ",
"open",
" ",
"some",
"where",
" ",
"sensi",
"ble",
" ",
"by",
" ",
"default_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"\t",
"\t",
"-",
" ",
"ideal",
"ly",
" ",
"centered",
" ",
"on",
" ",
"the",
" ",
"parent_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"\t",
"-",
" ",
"the",
"y",
" ",
"must",
" ",
"take",
" ",
"foc",
"us",
" ",
"nice",
"ly",
" ",
"whe",
"n",
" ",
"ask",
"ed",
" ",
"(",
"by",
" ",
"Path",
"Choose",
"r",
"Dialog",
"ue",
" ",
"for",
" ",
"instance",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"On",
" ",
"OS",
" ",
"X",
",",
" ",
"the",
" ",
"Tool",
" ",
"window",
" ",
"type",
" ",
"doe",
"s",
" ",
"an",
" ",
"exce",
"llen",
"t",
" ",
"job_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"all",
" ",
"of",
" ",
"tha",
"t",
",",
" ",
"as",
" ",
"well",
" ",
"as",
" ",
"look",
"ing",
" ",
"pretty",
".",
" ",
"Bu",
"t",
" ",
"if",
" ",
"we",
" ",
"use_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"Dialog",
" ",
"window",
" ",
"type",
",",
" ",
"the",
"y",
" ",
"disapp",
"ear",
" ",
"beh",
"ind",
" ",
"full",
" ",
"screen_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"windows",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"On",
" ",
"Lin",
"ux",
",",
" ",
"the",
" ",
"Tool",
" ",
"window",
" ",
"type",
" ",
"doe",
"s",
" ",
"a",
" ",
"poo",
"r",
" ",
"job",
",",
" ",
"opening",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"arbitra",
"ry",
" ",
"place",
"s",
",",
" ",
"and",
" ",
"display",
"ing",
" ",
"vari",
"ous",
" ",
"foc",
"us",
" ",
"problem",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"Dialog",
" ",
"type",
" ",
"on",
" ",
"the",
" ",
"other",
" ",
"hand",
" ",
"doe",
"s",
" ",
"a",
" ",
"muc",
"h",
" ",
"bett",
"er",
" ",
"job",
".",
" ",
"Of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"course",
",",
" ",
"this",
" ",
"bei",
"ng",
" ",
"X1",
"1",
",",
" ",
"different",
" ",
"window",
" ",
"manage",
"rs",
" ",
"will",
" ",
"do",
" ",
"different",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"thing",
"s",
",",
" ",
"but",
" ",
"on",
" ",
"the",
" ",
"whole",
" ",
"the",
" ",
"Dialog",
" ",
"type",
" ",
"see",
"ms",
" ",
"best",
" ",
"for",
" ",
"X1",
"1._",
"\\u\\u\\uNL\\u\\u\\u_",
"child",
"Window",
"Type_",
"=_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Tool_",
"if_",
"sys_",
"._",
"platform_",
"==_",
"\"",
"dar",
"win",
"\"_",
"else_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Dialog_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child",
"Window",
"Flags_",
"=_",
"(_",
"child",
"Window_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"window",
"Flags_",
"(_",
")_",
"&_",
"~_",
"Qt",
"Core_",
"._",
"Qt_",
"._",
"Window",
"Type",
"\\u",
"Mask_",
")_",
"|_",
"child",
"Window",
"Type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child",
"Window_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Parent_",
"(_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
",_",
"child",
"Window",
"Flags_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child",
"Window_",
"._",
"\\u",
"appl",
"y",
"Visibility_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"remove",
"On",
"Close_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"child",
"Window_",
"._",
"\\u\\u",
"remove",
"On",
"Clos",
"e",
"Connection_",
"=_",
"child",
"Window_",
"._",
"close",
"d",
"Signal_",
"(_",
")_",
"._",
"connect_",
"(_",
"lambda_",
"w_",
":_",
"w_",
"._",
"parent_",
"(_",
")_",
"._",
"remove",
"Child_",
"(_",
"w_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"child",
"Windows_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"list_",
"(_",
"self_",
"._",
"\\u\\u",
"child",
"Windows_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Resize",
"able_",
"(_",
"self_",
",_",
"resiz",
"eab",
"le_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"warnings_",
"._",
"warn_",
"(_",
"\"",
"Window",
".",
"set",
"Resize",
"able",
"()",
" ",
"is",
" ",
"depre",
"cated",
",",
" ",
"use",
" ",
"Window",
".",
"set",
"Size",
"Mode",
"()",
" ",
"inst",
"ead",
".\"_",
",_",
"Dep",
"reca",
"tion",
"Warning_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"resiz",
"eab",
"le_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"set",
"Size",
"Mode_",
"(_",
"self_",
"._",
"Size",
"Mode_",
"._",
"Manu",
"al_",
")_",
"\\u\\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_",
"self_",
"._",
"set",
"Size",
"Mode_",
"(_",
"self_",
"._",
"Size",
"Mode_",
"._",
"Fixed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Resize",
"able_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"warnings_",
"._",
"warn_",
"(_",
"\"",
"Window",
".",
"get",
"Resize",
"able",
"()",
" ",
"is",
" ",
"depre",
"cated",
",",
" ",
"use",
" ",
"Window",
".",
"get",
"Size",
"Mode",
"()",
" ",
"inst",
"ead",
".\"_",
",_",
"Dep",
"reca",
"tion",
"Warning_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"get",
"Size",
"Mode_",
"(_",
")_",
"==_",
"self_",
"._",
"Size",
"Mode_",
"._",
"Manu",
"al_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Size",
"Mode_",
"(_",
"self_",
",_",
"size",
"Mode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"\\u\\u",
"size",
"Mode_",
"=_",
"size",
"Mode_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"size",
"Mode_",
"==_",
"self_",
"._",
"Size",
"Mode_",
"._",
"Manu",
"al_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"._",
"set",
"Size",
"Constraint_",
"(_",
"Qt",
"Gui_",
"._",
"QL",
"ayout",
"_",
"._",
"Set",
"Default",
"Constraint_",
")_",
"\\u\\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_",
"self_",
"._",
"\\u\\u",
"qt",
"Layout_",
"._",
"set",
"Size",
"Constraint_",
"(_",
"Qt",
"Gui_",
"._",
"QL",
"ayout",
"_",
"._",
"Set",
"Fix",
"ed",
"Size_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Size",
"Mode_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u\\u",
"size",
"Mode_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"resiz",
"e",
"To",
"Fit",
"Child_",
"(_",
"self_",
",_",
"shrink",
"_",
"=_",
"True_",
",_",
"expand_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"s_",
"=_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"size_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"size",
"Hint_",
"=_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"size",
"Hint_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"expand_",
"or_",
"not_",
"self_",
"._",
"\\u\\u",
"size",
"Valid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"s_",
"=_",
"s_",
"._",
"expand",
"ed",
"To_",
"(_",
"size",
"Hint_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"shrink",
"_",
"or_",
"not_",
"self_",
"._",
"\\u\\u",
"size",
"Valid_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"s_",
"=_",
"s_",
"._",
"bounded",
"To_",
"(_",
"size",
"Hint_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"resize_",
"(_",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Position_",
"(_",
"self_",
",_",
"position_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"move_",
"(_",
"position_",
"._",
"x_",
",_",
"position_",
"._",
"y_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Position_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"x_",
"(_",
")_",
",_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"y_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Full",
"Screen_",
"(_",
"self_",
",_",
"full",
"Screen_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"full",
"Screen_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"show",
"Full",
"Screen_",
"(_",
")_",
"\\u\\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_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"show",
"Normal_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Full",
"Screen_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"is",
"Full",
"Screen_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"Icon_",
"(_",
"self_",
",_",
"image",
"Or",
"Image",
"File",
"Name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"isinstance_",
"(_",
"image",
"Or",
"Image",
"File",
"Name_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"image_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Image_",
"(_",
"image",
"Or",
"Image",
"File",
"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\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"image_",
"=_",
"image",
"Or",
"Image",
"File",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"qt",
"Widget_",
"(_",
")_",
"._",
"set",
"Window",
"Icon_",
"(_",
"Qt",
"Gui_",
"._",
"QI",
"con_",
"(_",
"self_",
"._",
"\\u\\u",
"image_",
"._",
"\\u",
"qt",
"Pixmap_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Icon_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u\\u",
"image_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\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\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"not_",
"self_",
"._",
"get",
"Visible_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"accepts",
"Close_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"set",
"Visible_",
"(_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"close",
"d",
"Signal_",
"(_",
")_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"accepts",
"Close_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"close",
"d",
"Signal_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"self_",
"._",
"\\u\\u",
"close",
"d",
"Signal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"cau",
"ght",
"Keys_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"cls_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys",
"Set_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"are",
" ",
"we",
" ",
"in",
" ",
"maya",
"?",
" ",
"If",
" ",
"so",
",",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"catch",
" ",
"the",
" ",
"ctrl",
" ",
"and",
" ",
"shift",
" ",
"key",
" ",
"presse",
"s",
" ",
"to",
" ",
"prevent",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"maya",
" ",
"from",
" ",
"handling",
" ",
"them",
" ",
"and",
" ",
"doi",
"ng",
" ",
"cra",
"zy",
" ",
"foc",
"us",
" ",
"stea",
"ling",
" ",
"stuff_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"import_",
"maya",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cls_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys",
"Set_",
"=_",
"set_",
"(_",
"[_",
"\"",
"Control",
"\"_",
",_",
"\"",
"Shi",
"ft",
"\"_",
"]_",
")_",
"\\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\t",
"\t\t\t_",
"cls_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys",
"Set_",
"=_",
"set_",
"(_",
")_",
"\\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_",
"cls_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys",
"Set_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Containe",
"r",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"key",
"Press_",
"(_",
"self_",
",_",
"widget_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"return_",
"event_",
"._",
"key_",
"in_",
"self_",
"._",
"\\u\\u",
"cau",
"ght",
"Keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"\\u",
"Window",
"Event",
"Filter_",
"(_",
"Qt",
"Core_",
"._",
"QO",
"bject_",
")_",
":_",
"\\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",
"Window",
"Event",
"Filter_",
"(_",
"Qt",
"Core_",
"._",
"QO",
"bject_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"Qt",
"Core_",
"._",
"QO",
"bject_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Window",
"Event",
"Filter_",
"(_",
"Qt",
"Core_",
"._",
"QO",
"bject_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"event",
"Filter_",
"(_",
"self_",
",_",
"q",
"Object_",
",_",
"q",
"Event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"type_",
"=_",
"q",
"Event_",
"._",
"type_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
"==_",
"Qt",
"Core_",
"._",
"QE",
"vent_",
"._",
"Close_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"widget_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Widget_",
"._",
"\\u",
"owner_",
"(_",
"q",
"Object_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"closed_",
"=_",
"widget_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"closed_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"q",
"Event_",
"._",
"accept_",
"(_",
")_",
"\\u\\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_",
"q",
"Event_",
"._",
"ignore_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"==_",
"Qt",
"Core_",
"._",
"QE",
"vent_",
"._",
"Lay",
"out",
"Request_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"widget_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Widget_",
"._",
"\\u",
"owner_",
"(_",
"q",
"Object_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"widget_",
"._",
"get",
"Size",
"Mode_",
"(_",
")_",
"==_",
"widget_",
"._",
"Size",
"Mode_",
"._",
"Automat",
"ic_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"widget_",
"._",
"resiz",
"e",
"To",
"Fit",
"Child_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"==_",
"Qt",
"Core_",
"._",
"QE",
"vent_",
"._",
"Resize",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"widget_",
"=_",
"Ga",
"ffer",
"UI_",
"._",
"Widget_",
"._",
"\\u",
"owner_",
"(_",
"q",
"Object_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"widget_",
"._",
"\\u",
"Window",
"\\u\\u",
"size",
"Valid_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
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
] |
Unused import | opendns/OpenResolve/resolverapi/__init__.py | [
{
"content": "import os\n\nfrom flask import Flask, jsonify\nfrom flask_restful import Api\nfrom dns.resolver import Resolver\nfrom flask_cors import CORS\n\n\ndns_resolver = Resolver()\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def create_app(config_name):\n app = Flask(__name__)\n if config_name == 'dev':\n app.config.from_object('resolverapi.config.DevelopmentConfig')\n else:\n app.config.from_object('resolverapi.config.BaseConfig')\n\n # Get nameservers from environment variable or default to OpenDNS resolvers\n if os.environ.get('RESOLVERS'):\n app.config['RESOLVERS'] = [addr.strip() for addr in os.environ.get('RESOLVERS').split(',')]\n # Respond with Access-Control-Allow-Origin headers. Use * to accept all\n if os.environ.get('CORS_ORIGIN'):\n CORS(app, origins=os.environ.get('CORS_ORIGIN'))\n\n dns_resolver.lifetime = 3.0\n\n from resolverapi.endpoints import ReverseLookup\n from resolverapi.endpoints import LookupRecordType\n api = Api(app)\n api.add_resource(ReverseLookup, '/reverse/<ip>')\n api.add_resource(LookupRecordType, '/<rdtype>/<domain>')\n\n @app.route('/')\n def root():\n \"\"\"Provide user a link to the main page. Also this route acts as a health check, returns 200.\"\"\"\n return jsonify({'message': \"Check out www.openresolve.com for usage.\"}), 200\n\n return app",
"metadata": "root.create_app",
"header": "['module', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | 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_",
"flask_",
"import_",
"Flask_",
",_",
"jsonify_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"fla",
"sk",
"\\u",
"restful",
"_",
"import_",
"Api_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"dns_",
"._",
"resolver_",
"import_",
"Resolver_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"fla",
"sk",
"\\u",
"cors",
"_",
"import_",
"CORS",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dns",
"\\u",
"resolver_",
"=_",
"Resolver_",
"(_",
")_",
"\\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_",
"create",
"\\u",
"app_",
"(_",
"config",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"Flask_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"config",
"\\u",
"name_",
"==_",
"'",
"dev",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"config_",
"._",
"from",
"\\u",
"object_",
"(_",
"'",
"resolver",
"api",
".",
"config",
".",
"Dev",
"elo",
"pme",
"nt",
"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 ",
" _",
"app_",
"._",
"config_",
"._",
"from",
"\\u",
"object_",
"(_",
"'",
"resolver",
"api",
".",
"config",
".",
"Base",
"Config",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"nameservers",
" ",
"from",
" ",
"environ",
"ment",
" ",
"variab",
"le",
" ",
"or",
" ",
"default",
" ",
"to",
" ",
"Open",
"DNS",
" ",
"resolver",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"RESOL",
"VER",
"S",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"config_",
"[_",
"'",
"RESOL",
"VER",
"S",
"'_",
"]_",
"=_",
"[_",
"addr_",
"._",
"strip_",
"(_",
")_",
"for_",
"addr_",
"in_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"RESOL",
"VER",
"S",
"'_",
")_",
"._",
"split_",
"(_",
"','_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Respo",
"nd",
" ",
"with",
" ",
"Access",
"-",
"Control",
"-",
"All",
"ow",
"-",
"Orig",
"in",
" ",
"header",
"s",
".",
" ",
"Us",
"e",
" ",
"*",
" ",
"to",
" ",
"accept",
" ",
"all_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"CORS",
"\\u",
"ORIGIN",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"CORS",
"_",
"(_",
"app_",
",_",
"origins",
"_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"CORS",
"\\u",
"ORIGIN",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"dns",
"\\u",
"resolver_",
"._",
"lifetime_",
"=_",
"3.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"resolver",
"api_",
"._",
"endpoints_",
"import_",
"Revers",
"e",
"Lookup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"resolver",
"api_",
"._",
"endpoints_",
"import_",
"Look",
"up",
"Record",
"Type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"=_",
"Api_",
"(_",
"app_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"add",
"\\u",
"resource_",
"(_",
"Revers",
"e",
"Lookup_",
",_",
"'/",
"reverse",
"/",
"<",
"ip",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"add",
"\\u",
"resource_",
"(_",
"Look",
"up",
"Record",
"Type_",
",_",
"'/",
"<",
"rdt",
"ype",
">/",
"<",
"domain",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"app_",
"._",
"route_",
"(_",
"'/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"root_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Prov",
"ide",
" ",
"user",
" ",
"a",
" ",
"link",
" ",
"to",
" ",
"the",
" ",
"main",
" ",
"page",
".",
" ",
"Al",
"so",
" ",
"this",
" ",
"route",
" ",
"acts",
" ",
"as",
" ",
"a",
" ",
"health",
" ",
"check",
",",
" ",
"return",
"s",
" ",
"200.",
"\"\"\"_",
"\\u\\u\\uN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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Modification of parameter with default | requests/requests-oauthlib/tests/test_oauth2_session.py | [
{
"content": " def test_authorized_false(self):\n sess = OAuth2Session('foo')\n self.assertFalse(sess.authorized)",
"metadata": "root.OAuth2SessionTest.test_authorized_false",
"header": "['class', 'OAuth2SessionTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 210
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Modifica",
"tion_",
"of_",
"parameter_",
"with_",
"default_",
"[SEP]_",
"class_",
"OA",
"uth",
"2",
"Sess",
"ion",
"Test_",
"(_",
"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",
"authoriz",
"ed",
"\\u",
"false_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sess_",
"=_",
"OA",
"uth",
"2",
"Session_",
"(_",
"'",
"foo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"sess_",
"._",
"authorized_",
")_",
"\\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
] |
Imprecise assert | CiscoSystems/avos/openstack_dashboard/test/tests/quotas.py | [
{
"content": " @test.create_stubs({api.nova: ('server_list',\n 'flavor_list',\n 'tenant_quota_get',),\n api.network: ('tenant_floating_ip_list',\n 'floating_ip_supported'),\n api.base: ('is_service_enabled',),\n cinder: ('volume_list', 'volume_snapshot_list',\n 'tenant_quota_get',)})\n def test_tenant_quota_usages(self):\n servers = [s for s in self.servers.list()\n if s.tenant_id == self.request.user.tenant_id]\n\n api.base.is_service_enabled(IsA(http.HttpRequest),\n 'volume').AndReturn(True)\n api.base.is_service_enabled(IsA(http.HttpRequest),\n 'network').AndReturn(False)\n api.nova.flavor_list(IsA(http.HttpRequest)) \\\n .AndReturn(self.flavors.list())\n api.nova.tenant_quota_get(IsA(http.HttpRequest), '1') \\\n .AndReturn(self.quotas.first())\n api.network.floating_ip_supported(IsA(http.HttpRequest)) \\\n .AndReturn(True)\n api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \\\n .AndReturn(self.floating_ips.list())\n search_opts = {'tenant_id': self.request.user.tenant_id}\n api.nova.server_list(IsA(http.HttpRequest), search_opts=search_opts,\n all_tenants=True) \\\n .AndReturn([servers, False])\n opts = {'alltenants': 1, 'tenant_id': self.request.user.tenant_id}\n cinder.volume_list(IsA(http.HttpRequest), opts) \\\n .AndReturn(self.volumes.list())\n cinder.volume_snapshot_list(IsA(http.HttpRequest), opts) \\\n .AndReturn(self.snapshots.list())\n cinder.tenant_quota_get(IsA(http.HttpRequest), '1') \\\n .AndReturn(self.cinder_quotas.first())\n\n self.mox.ReplayAll()\n\n quota_usages = quotas.tenant_quota_usages(self.request)\n expected_output = self.get_usages()\n\n # Compare internal structure of usages to expected.\n self.assertEqual(expected_output, quota_usages.usages)",
"metadata": "root.QuotaTests.test_tenant_quota_usages",
"header": "['class', 'QuotaTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']",
"index": 51
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Quota",
"Tests_",
"(_",
"test_",
"._",
"API",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"test_",
"._",
"create",
"\\u",
"stubs_",
"(_",
"{_",
"api_",
"._",
"nova_",
":_",
"(_",
"'",
"server",
"\\u",
"list",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"flavor",
"\\u",
"list",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"get",
"'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"network_",
":_",
"(_",
"'",
"tenan",
"t",
"\\u",
"float",
"ing",
"\\u",
"ip",
"\\u",
"list",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"float",
"ing",
"\\u",
"ip",
"\\u",
"support",
"ed",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"base_",
":_",
"(_",
"'",
"is",
"\\u",
"service",
"\\u",
"enable",
"d",
"'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cinder_",
":_",
"(_",
"'",
"volume",
"\\u",
"list",
"'_",
",_",
"'",
"volume",
"\\u",
"snapshot",
"\\u",
"list",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"get",
"'_",
",_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"usages_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"servers_",
"=_",
"[_",
"s_",
"for_",
"s_",
"in_",
"self_",
"._",
"servers_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"s_",
"._",
"tenan",
"t",
"\\u",
"id_",
"==_",
"self_",
"._",
"request_",
"._",
"user_",
"._",
"tenan",
"t",
"\\u",
"id_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"api_",
"._",
"base_",
"._",
"is",
"\\u",
"service",
"\\u",
"enabled_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"volume",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"base_",
"._",
"is",
"\\u",
"service",
"\\u",
"enabled_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"network",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"nova_",
"._",
"flavor",
"\\u",
"list_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"flavors_",
"._",
"list_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"nova_",
"._",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"get_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"'",
"1",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"quotas_",
"._",
"first_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"network_",
"._",
"float",
"ing",
"\\u",
"ip",
"\\u",
"supported_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
")_",
"._",
"And",
"Return_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"network_",
"._",
"tenan",
"t",
"\\u",
"float",
"ing",
"\\u",
"ip",
"\\u",
"list_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"float",
"ing",
"\\u",
"ips_",
"._",
"list_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"search",
"\\u",
"opts_",
"=_",
"{_",
"'",
"tenan",
"t",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"request_",
"._",
"user_",
"._",
"tenan",
"t",
"\\u",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"api_",
"._",
"nova_",
"._",
"server",
"\\u",
"list_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"search",
"\\u",
"opts_",
"=_",
"search",
"\\u",
"opts_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"all",
"\\u",
"tenants_",
"=_",
"True_",
")_",
"._",
"And",
"Return_",
"(_",
"[_",
"servers_",
",_",
"False_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"opts_",
"=_",
"{_",
"'",
"allt",
"ena",
"nts",
"'_",
":_",
"1_",
",_",
"'",
"tenan",
"t",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"request_",
"._",
"user_",
"._",
"tenan",
"t",
"\\u",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cinder_",
"._",
"volume",
"\\u",
"list_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"opts_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"volumes_",
"._",
"list_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cinder_",
"._",
"volume",
"\\u",
"snapshot",
"\\u",
"list_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"opts_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"snapshots_",
"._",
"list_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cinder_",
"._",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"get_",
"(_",
"Is",
"A_",
"(_",
"http_",
"._",
"Http",
"Request_",
")_",
",_",
"'",
"1",
"'_",
")_",
"._",
"And",
"Return_",
"(_",
"self_",
"._",
"cinde",
"r",
"\\u",
"quotas_",
"._",
"first_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"mox_",
"._",
"Repl",
"ay",
"All_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quot",
"a",
"\\u",
"usages_",
"=_",
"quotas_",
"._",
"tenan",
"t",
"\\u",
"quot",
"a",
"\\u",
"usages_",
"(_",
"self_",
"._",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"output_",
"=_",
"self_",
"._",
"get",
"\\u",
"usages_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Compare",
" ",
"internal",
" ",
"structure",
" ",
"of",
" ",
"usage",
"s",
" ",
"to",
" ",
"expected",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"output_",
",_",
"quot",
"a",
"\\u",
"usages_",
"._",
"usages_",
")_",
"\\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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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
] |
Unused import | liberation/django-elasticsearch/test_project/manage.py | [
{
"content": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"test_project.settings\")\n\n # hack to use current django_elasticsearch package\n sys.path.insert(0, '../')\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"environ_",
"._",
"setdefault_",
"(_",
"\"",
"DJANGO",
"\\u",
"SETTING",
"S",
"\\u",
"MODUL",
"E",
"\"_",
",_",
"\"",
"test\\u",
"project",
".",
"settings",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"hack",
" ",
"to",
" ",
"use",
" ",
"current",
" ",
"django",
"\\u",
"elastic",
"search",
" ",
"package_",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"'../",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"management_",
"import_",
"execute",
"\\u",
"from",
"\\u",
"command",
"\\u",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"execute",
"\\u",
"from",
"\\u",
"command",
"\\u",
"line_",
"(_",
"sys_",
"._",
"argv_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |