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
simpeg/simpeg/SimPEG/Examples/DC_Analytic_Dipole.py
[ { "content": "def run(plotIt=False):\n cs = 25.\n hx = [(cs,7, -1.3),(cs,21),(cs,7, 1.3)]\n hy = [(cs,7, -1.3),(cs,21),(cs,7, 1.3)]\n hz = [(cs,7, -1.3),(cs,20)]\n mesh = Mesh.TensorMesh([hx, hy, hz], 'CCN')\n sighalf = 1e-2\n sigma = np.ones(mesh.nC)*sighalf\n xtemp = np.linspace(-150, 150, 21)\n ytemp = np.linspace(-150, 150, 21)\n xyz_rxP = Utils.ndgrid(xtemp-10., ytemp, np.r_[0.])\n xyz_rxN = Utils.ndgrid(xtemp+10., ytemp, np.r_[0.])\n xyz_rxM = Utils.ndgrid(xtemp, ytemp, np.r_[0.])\n\n # if plotIt:\n # fig, ax = plt.subplots(1,1, figsize = (5,5))\n # mesh.plotSlice(sigma, grid=True, ax = ax)\n # ax.plot(xyz_rxP[:,0],xyz_rxP[:,1], 'w.')\n # ax.plot(xyz_rxN[:,0],xyz_rxN[:,1], 'r.', ms = 3)\n\n rx = DC.RxDipole(xyz_rxP, xyz_rxN)\n src = DC.SrcDipole([rx], [-200, 0, -12.5], [+200, 0, -12.5])\n survey = DC.SurveyDC([src])\n problem = DC.ProblemDC_CC(mesh)\n problem.pair(survey)\n try:\n from pymatsolver import MumpsSolver\n problem.Solver = MumpsSolver\n except Exception, e:\n pass\n data = survey.dpred(sigma)\n\n def DChalf(srclocP, srclocN, rxloc, sigma, I=1.):\n rp = (srclocP.reshape([1,-1])).repeat(rxloc.shape[0], axis = 0)\n rn = (srclocN.reshape([1,-1])).repeat(rxloc.shape[0], axis = 0)\n rP = np.sqrt(((rxloc-rp)**2).sum(axis=1))\n rN = np.sqrt(((rxloc-rn)**2).sum(axis=1))\n return I/(sigma*2.*np.pi)*(1/rP-1/rN)\n\n data_anaP = DChalf(np.r_[-200, 0, 0.],np.r_[+200, 0, 0.], xyz_rxP, sighalf)\n data_anaN = DChalf(np.r_[-200, 0, 0.],np.r_[+200, 0, 0.], xyz_rxN, sighalf)\n data_ana = data_anaP-data_anaN\n Data_ana = data_ana.reshape((21, 21), order = 'F')\n Data = data.reshape((21, 21), order = 'F')\n X = xyz_rxM[:,0].reshape((21, 21), order = 'F')\n Y = xyz_rxM[:,1].reshape((21, 21), order = 'F')\n\n if plotIt:\n import matplotlib.pyplot as plt\n fig, ax = plt.subplots(1,2, figsize = (12, 5))\n vmin = np.r_[data, data_ana].min()\n vmax = np.r_[data, data_ana].max()\n dat1 = ax[1].contourf(X, Y, Data, 60, vmin = vmin, vmax = vmax)\n dat0 = ax[0].contourf(X, Y, Data_ana, 60, vmin = vmin, vmax = vmax)\n cb0 = plt.colorbar(dat1, orientation = 'horizontal', ax = ax[0])\n cb1 = plt.colorbar(dat1, orientation = 'horizontal', ax = ax[1])\n ax[1].set_title('Analytic')\n ax[0].set_title('Computed')\n plt.show()\n\n return np.linalg.norm(data-data_ana)/np.linalg.norm(data_ana)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 3 } ]
[ { "span": "dat0 ", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 12 }, { "span": "cb0 ", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 11 }, { "span": "cb1 ", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "plot", "It_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "=_", "25.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hx", "_", "=_", "[_", "(_", "cs_", ",_", "7_", ",_", "-_", "1.3_", ")_", ",_", "(_", "cs_", ",_", "21_", ")_", ",_", "(_", "cs_", ",_", "7_", ",_", "1.3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hy_", "=_", "[_", "(_", "cs_", ",_", "7_", ",_", "-_", "1.3_", ")_", ",_", "(_", "cs_", ",_", "21_", ")_", ",_", "(_", "cs_", ",_", "7_", ",_", "1.3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hz_", "=_", "[_", "(_", "cs_", ",_", "7_", ",_", "-_", "1.3_", ")_", ",_", "(_", "cs_", ",_", "20_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mesh_", "=_", "Mesh_", "._", "Tensor", "Mesh_", "(_", "[_", "hx", "_", ",_", "hy_", ",_", "hz_", "]_", ",_", "'", "CC", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "half_", "=_", "1e-2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma_", "=_", "np_", "._", "ones_", "(_", "mesh_", "._", "n", "C_", ")_", "*_", "sig", "half_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xte", "mp_", "=_", "np_", "._", "linspace_", "(_", "-_", "150_", ",_", "150_", ",_", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yte", "mp_", "=_", "np_", "._", "linspace_", "(_", "-_", "150_", ",_", "150_", ",_", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xyz", "\\u", "rx", "P_", "=_", "Utils_", "._", "nd", "grid_", "(_", "xte", "mp_", "-_", "10._", ",_", "yte", "mp_", ",_", "np_", "._", "r\\u_", "[_", "0._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xyz", "\\u", "rx", "N_", "=_", "Utils_", "._", "nd", "grid_", "(_", "xte", "mp_", "+_", "10._", ",_", "yte", "mp_", ",_", "np_", "._", "r\\u_", "[_", "0._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xyz", "\\u", "rx", "M_", "=_", "Utils_", "._", "nd", "grid_", "(_", "xte", "mp_", ",_", "yte", "mp_", ",_", "np_", "._", "r\\u_", "[_", "0._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "plot", "It", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fig", ",", " ", "ax", " ", "=", " ", "plt", ".", "subplot", "s", "(", "1", ",", "1", ",", " ", "figs", "ize", " ", "=", " ", "(", "5", ",", "5", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mesh", ".", "plot", "Slice", "(", "sigma", ",", " ", "grid", "=", "Tru", "e", ",", " ", "ax", " ", "=", " ", "ax", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ax", ".", "plot", "(", "xyz", "\\u", "rx", "P", "[:,", "0", "],", "xyz", "\\u", "rx", "P", "[:,", "1", "],", " ", "'", "w", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ax", ".", "plot", "(", "xyz", "\\u", "rx", "N", "[:,", "0", "],", "xyz", "\\u", "rx", "N", "[:,", "1", "],", " ", "'", "r", ".'", ",", " ", "ms", " ", "=", " ", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx_", "=_", "DC_", "._", "Rx", "Di", "pole", "_", "(_", "xyz", "\\u", "rx", "P_", ",_", "xyz", "\\u", "rx", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "DC_", "._", "Sr", "c", "Di", "pole", "_", "(_", "[_", "rx_", "]_", ",_", "[_", "-_", "200_", ",_", "0_", ",_", "-_", "12.", "5_", "]_", ",_", "[_", "+_", "200_", ",_", "0_", ",_", "-_", "12.", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "survey_", "=_", "DC_", "._", "Surv", "ey", "DC_", "(_", "[_", "src_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "problem_", "=_", "DC_", "._", "Prob", "lem", "DC", "\\u", "CC_", "(_", "mesh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "problem_", "._", "pair_", "(_", "survey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pymat", "solver_", "import_", "Mu", "mps", "Solver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "problem_", "._", "Solver_", "=_", "Mu", "mps", "Solver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "survey_", "._", "dpr", "ed_", "(_", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "DC", "half_", "(_", "src", "loc", "P_", ",_", "src", "loc", "N_", ",_", "rx", "loc_", ",_", "sigma_", ",_", "I_", "=_", "1._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rp_", "=_", "(_", "src", "loc", "P_", "._", "reshape_", "(_", "[_", "1_", ",_", "-_", "1_", "]_", ")_", ")_", "._", "repeat_", "(_", "rx", "loc_", "._", "shape_", "[_", "0_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "(_", "src", "loc", "N_", "._", "reshape_", "(_", "[_", "1_", ",_", "-_", "1_", "]_", ")_", ")_", "._", "repeat_", "(_", "rx", "loc_", "._", "shape_", "[_", "0_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "P_", "=_", "np_", "._", "sqrt_", "(_", "(_", "(_", "rx", "loc_", "-_", "rp_", ")_", "**_", "2_", ")_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "N_", "=_", "np_", "._", "sqrt_", "(_", "(_", "(_", "rx", "loc_", "-_", "rn_", ")_", "**_", "2_", ")_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "I_", "/_", "(_", "sigma_", "*_", "2._", "*_", "np_", "._", "pi_", ")_", "*_", "(_", "1_", "/_", "r", "P_", "-_", "1_", "/_", "r", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "ana", "P_", "=_", "DC", "half_", "(_", "np_", "._", "r\\u_", "[_", "-_", "200_", ",_", "0_", ",_", "0._", "]_", ",_", "np_", "._", "r\\u_", "[_", "+_", "200_", ",_", "0_", ",_", "0._", "]_", ",_", "xyz", "\\u", "rx", "P_", ",_", "sig", "half_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "ana", "N_", "=_", "DC", "half_", "(_", "np_", "._", "r\\u_", "[_", "-_", "200_", ",_", "0_", ",_", "0._", "]_", ",_", "np_", "._", "r\\u_", "[_", "+_", "200_", ",_", "0_", ",_", "0._", "]_", ",_", "xyz", "\\u", "rx", "N_", ",_", "sig", "half_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "ana", "_", "=_", "data\\u", "ana", "P_", "-_", "data\\u", "ana", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Data", "\\u", "ana", "_", "=_", "data\\u", "ana", "_", "._", "reshape_", "(_", "(_", "21_", ",_", "21_", ")_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Data_", "=_", "data_", "._", "reshape_", "(_", "(_", "21_", ",_", "21_", ")_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "xyz", "\\u", "rx", "M_", "[_", ":_", ",_", "0_", "]_", "._", "reshape_", "(_", "(_", "21_", ",_", "21_", ")_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "xyz", "\\u", "rx", "M_", "[_", ":_", ",_", "1_", "]_", "._", "reshape_", "(_", "(_", "21_", ",_", "21_", ")_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "plot", "It_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "1_", ",_", "2_", ",_", "figsize_", "=_", "(_", "12_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vmin_", "=_", "np_", "._", "r\\u_", "[_", "data_", ",_", "data\\u", "ana", "_", "]_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vmax_", "=_", "np_", "._", "r\\u_", "[_", "data_", ",_", "data\\u", "ana", "_", "]_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat", "1_", "=_", "ax_", "[_", "1_", "]_", "._", "conto", "urf", "_", "(_", "X_", ",_", "Y_", ",_", "Data_", ",_", "60_", ",_", "vmin_", "=_", "vmin_", ",_", "vmax_", "=_", "vmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat", "0_", "=_", "ax_", "[_", "0_", "]_", "._", "conto", "urf", "_", "(_", "X_", ",_", "Y_", ",_", "Data", "\\u", "ana", "_", ",_", "60_", ",_", "vmin_", "=_", "vmin_", ",_", "vmax_", "=_", "vmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb", "0_", "=_", "plt_", "._", "colorbar_", "(_", "dat", "1_", ",_", "orientation_", "=_", "'", "horizon", "tal", "'_", ",_", "ax_", "=_", "ax_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb", "1_", "=_", "plt_", "._", "colorbar_", "(_", "dat", "1_", ",_", "orientation_", "=_", "'", "horizon", "tal", "'_", ",_", "ax_", "=_", "ax_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "[_", "1_", "]_", "._", "set\\u", "title_", "(_", "'", "Analy", "tic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "[_", "0_", "]_", "._", "set\\u", "title_", "(_", "'", "Computed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "linalg_", "._", "norm_", "(_", "data_", "-_", "data\\u", "ana", "_", ")_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "data\\u", "ana", "_", ")_", "\\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,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 2, 2, 2, 2, 2, 2 ]
Unused import
tophatmonocle/ims_lti_py/ims_lti_py/__init__.py
[ { "content": "# Classes\nfrom tool_config import ToolConfig\nfrom tool_consumer import ToolConsumer\nfrom tool_provider import ToolProvider\nfrom outcome_request import OutcomeRequest\nfrom outcome_response import OutcomeResponse\n\n# Exceptions\nfrom utils import InvalidLTIConfigError, InvalidLTIRequestError\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from tool_config import ToolConfig", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 34 }, { "span": "from tool_consumer import ToolConsumer", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 38 }, { "span": "from tool_provider import ToolProvider", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 38 }, { "span": "from outcome_request import OutcomeRequest", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 42 }, { "span": "from outcome_response import OutcomeResponse", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 44 }, { "span": "from utils import InvalidLTIConfigError, InvalidLTIRequestError", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Classes_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tool", "\\u", "config_", "import_", "Tool", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tool", "\\u", "consumer_", "import_", "Tool", "Consumer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tool", "\\u", "provider_", "import_", "Tool", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "outco", "me", "\\u", "request_", "import_", "Outcome", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "outco", "me", "\\u", "response_", "import_", "Outcome", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "utils_", "import_", "Inva", "lid", "LT", "IC", "onfi", "g", "Error_", ",_", "Inva", "lid", "LT", "IR", "eque", "st", "Error_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
mrknow/filmkodi/plugin.video.mrknow/lib/mrknow_pLog.py
[ { "content": "# -*- coding: utf-8 -*-\n\ntry:\n import xbmc\nexcept:\n pass\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def log(self,msg='', level=2):\n plugin = \"plugin.video.mrknow\"\n try:\n msg = msg.encode('utf-8')\n except:\n pass\n try:\n xbmc.log(\"[%s] %s\" % (plugin, msg.__str__()), level)\n #print(\"[%s] %s\" % (plugin, msg.__str__()))\n except:\n #print(\"[%s] %s\" % (plugin, msg.__str__()))\n pass", "metadata": "root.pLog.log", "header": "['class', 'pLog', ':', '___EOS___']", "index": 13 } ]
[ { "span": "except:", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 7 }, { "span": "except:", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 15 }, { "span": "except:", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xbmc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "p", "Log_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "msg_", "=_", "''_", ",_", "level_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin_", "=_", "\"", "plugin", ".", "video", ".", "mr", "know", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xbmc_", "._", "log_", "(_", "\"[", "%", "s", "]", " ", "%", "s", "\"_", "%_", "(_", "plugin_", ",_", "msg_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ")_", ",_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "[", "%", "s", "]", " ", "%", "s", "\"", " ", "%", " ", "(", "plugin", ",", " ", "msg", ".\\u", "\\u", "str", "\\u\\u()", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "[", "%", "s", "]", " ", "%", "s", "\"", " ", "%", " ", "(", "plugin", ",", " ", "msg", ".\\u", "\\u", "str", "\\u\\u()", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Suspicious unused loop iteration variable
aarongarrett/inspyred/recipes/lexicographic.py
[ { "content": " def __init__(self, values=None, maximize=True):\n if values is None:\n values = []\n self.values = values\n try:\n iter(maximize)\n except TypeError:\n maximize = [maximize for v in values]\n self.maximize = maximize", "metadata": "root.Lexicographic.__init__", "header": "['class', 'Lexicographic', '(', 'object', ')', ':', '___EOS___']", "index": 4 } ]
[ { "span": "[maximize for v in values]", "start_line": 11, "start_column": 23, "end_line": 11, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "class_", "Lexi", "cog", "raph", "ic_", "(_", "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_", ",_", "values_", "=_", "None_", ",_", "maximize", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "values_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "values_", "=_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter_", "(_", "maximize", "_", ")_", "\\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 ", " _", "maximize", "_", "=_", "[_", "maximize", "_", "for_", "v_", "in_", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "maximize", "_", "=_", "maximize", "_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
geopython/pycsw/pycsw/ogc/csw/csw3.py
[ { "content": "# -*- coding: utf-8 -*-\n# =================================================================\n#\n# Authors: Tom Kralidis <tomkralidis@gmail.com>\n#\n# Copyright (c) 2015 Tom Kralidis\n#\n# Permission is hereby granted, free of charge, to any person\n# obtaining a copy of this software and associated documentation\n# files (the \"Software\"), to deal in the Software without\n# restriction, including without limitation the rights to use,\n# copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following\n# conditions:\n#\n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n#\n# =================================================================\n\nimport os\nimport sys\nimport cgi\nfrom time import time\nfrom six.moves.urllib.parse import quote, unquote\nfrom six import StringIO\nfrom six.moves.configparser import SafeConfigParser\nfrom pycsw.core.etree import etree\nfrom pycsw import oaipmh, opensearch, sru\nfrom pycsw.plugins.profiles import profile as pprofile\nimport pycsw.plugins.outputschemas\nfrom pycsw.core import config, log, metadata, util\nfrom pycsw.ogc.fes import fes2\nimport logging\n\nLOGGER = logging.getLogger(__name__)\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Csw3(object):\n ''' CSW 3.x server '''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Csw3", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self, server_csw):\n ''' Initialize CSW3 '''\n\n self.parent = server_csw\n self.version = '3.0.0'", "metadata": "root.Csw3.__init__", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def getcapabilities(self):\n ''' Handle GetCapabilities request '''\n serviceidentification = True\n serviceprovider = True\n operationsmetadata = True\n filtercaps = False\n languages = False\n\n # validate acceptformats\n LOGGER.debug('Validating ows20:AcceptFormats')\n LOGGER.debug(self.parent.context.model['operations']['GetCapabilities']['parameters']['acceptFormats']['values'])\n if 'acceptformats' in self.parent.kvp:\n bfound = False\n for fmt in self.parent.kvp['acceptformats'].split(','):\n if fmt in self.parent.context.model['operations']['GetCapabilities']['parameters']['acceptFormats']['values']:\n self.parent.mimetype = fmt\n bfound = True\n break\n if not bfound:\n return self.exceptionreport('InvalidParameterValue',\n 'acceptformats', 'Invalid acceptFormats parameter value: %s' %\n self.parent.kvp['acceptformats'])\n\n if 'sections' in self.parent.kvp and self.parent.kvp['sections'] != '':\n serviceidentification = False\n serviceprovider = False\n operationsmetadata = False\n for section in self.parent.kvp['sections'].split(','):\n if section == 'ServiceIdentification':\n serviceidentification = True\n if section == 'ServiceProvider':\n serviceprovider = True\n if section == 'OperationsMetadata':\n operationsmetadata = True\n if section == 'All':\n serviceidentification = True\n serviceprovider = True\n operationsmetadata = True\n filtercaps = True\n languages = True\n else:\n filtercaps = True\n languages = True\n\n # check extra parameters that may be def'd by profiles\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n result = \\\n self.parent.profiles['loaded'][prof].check_parameters(self.parent.kvp)\n if result is not None:\n return self.exceptionreport(result['code'],\n result['locator'], result['text'])\n\n # @updateSequence: get latest update to repository\n try:\n updatesequence = \\\n util.get_time_iso2unix(self.parent.repository.query_insert())\n except:\n updatesequence = None\n\n node = etree.Element(util.nspath_eval('csw30:Capabilities',\n self.parent.context.namespaces),\n nsmap=self.parent.context.namespaces, version='3.0.0',\n updateSequence=str(updatesequence))\n\n if 'updatesequence' in self.parent.kvp:\n if int(self.parent.kvp['updatesequence']) == updatesequence:\n return node\n elif int(self.parent.kvp['updatesequence']) > updatesequence:\n return self.exceptionreport('InvalidUpdateSequence',\n 'updatesequence',\n 'outputsequence specified (%s) is higher than server\\'s \\\n updatesequence (%s)' % (self.parent.kvp['updatesequence'],\n updatesequence))\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = '%s %s/csw/3.0/cswGetCapabilities.xsd' % \\\n (self.parent.context.namespaces['csw30'],\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n metadata_main = dict(self.parent.config.items('metadata:main'))\n\n if serviceidentification:\n LOGGER.debug('Writing section ServiceIdentification.')\n\n serviceidentification = etree.SubElement(node, \\\n util.nspath_eval('ows20:ServiceIdentification',\n self.parent.context.namespaces))\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Title', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_title', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Abstract', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_abstract', 'missing')\n\n keywords = etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Keywords', self.parent.context.namespaces))\n\n for k in \\\n metadata_main.get('identification_keywords').split(','):\n etree.SubElement(\n keywords, util.nspath_eval('ows20:Keyword',\n self.parent.context.namespaces)).text = k\n\n etree.SubElement(keywords,\n util.nspath_eval('ows20:Type', self.parent.context.namespaces),\n codeSpace='ISOTC211/19115').text = \\\n metadata_main.get('identification_keywords_type', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:ServiceType', self.parent.context.namespaces),\n codeSpace='OGC').text = 'CSW'\n\n for stv in self.parent.context.model['parameters']['version']['values']:\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:ServiceTypeVersion',\n self.parent.context.namespaces)).text = stv\n\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n prof_name = self.parent.profiles['loaded'][prof].name\n prof_val = self.parent.profiles['loaded'][prof].namespaces[prof_name]\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Profile',\n self.parent.context.namespaces)).text = prof_val\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Fees', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_fees', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:AccessConstraints',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_accessconstraints', 'missing')\n\n if serviceprovider:\n LOGGER.debug('Writing section ServiceProvider.')\n serviceprovider = etree.SubElement(node,\n util.nspath_eval('ows20:ServiceProvider', self.parent.context.namespaces))\n\n etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ProviderName', self.parent.context.namespaces)).text = \\\n metadata_main.get('provider_name', 'missing')\n\n providersite = etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ProviderSite', self.parent.context.namespaces))\n\n providersite.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n\n providersite.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n metadata_main.get('provider_url', 'missing')\n\n servicecontact = etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ServiceContact', self.parent.context.namespaces))\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:IndividualName',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_name', 'missing')\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:PositionName',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_position', 'missing')\n\n contactinfo = etree.SubElement(servicecontact,\n util.nspath_eval('ows20:ContactInfo', self.parent.context.namespaces))\n\n phone = etree.SubElement(contactinfo, util.nspath_eval('ows20:Phone',\n self.parent.context.namespaces))\n\n etree.SubElement(phone, util.nspath_eval('ows20:Voice',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_phone', 'missing')\n\n etree.SubElement(phone, util.nspath_eval('ows20:Facsimile',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_fax', 'missing')\n\n address = etree.SubElement(contactinfo,\n util.nspath_eval('ows20:Address', self.parent.context.namespaces))\n\n etree.SubElement(address,\n util.nspath_eval('ows20:DeliveryPoint',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_address', 'missing')\n\n etree.SubElement(address, util.nspath_eval('ows20:City',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_city', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:AdministrativeArea',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_stateorprovince', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:PostalCode',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_postalcode', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:Country', self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_country', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:ElectronicMailAddress',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_email', 'missing')\n\n url = etree.SubElement(contactinfo,\n util.nspath_eval('ows20:OnlineResource', self.parent.context.namespaces))\n\n url.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n\n url.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n metadata_main.get('contact_url', 'missing')\n\n etree.SubElement(contactinfo,\n util.nspath_eval('ows20:HoursOfService',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_hours', 'missing')\n\n etree.SubElement(contactinfo,\n util.nspath_eval('ows20:ContactInstructions',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_instructions', 'missing')\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:Role', self.parent.context.namespaces),\n codeSpace='ISOTC211/19115').text = \\\n metadata_main.get('contact_role', 'missing')\n\n if operationsmetadata:\n LOGGER.debug('Writing section OperationsMetadata.')\n operationsmetadata = etree.SubElement(node,\n util.nspath_eval('ows20:OperationsMetadata',\n self.parent.context.namespaces))\n\n for operation in self.parent.context.model['operations_order']:\n oper = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Operation', self.parent.context.namespaces),\n name=operation)\n\n dcp = etree.SubElement(oper, util.nspath_eval('ows20:DCP',\n self.parent.context.namespaces))\n\n http = etree.SubElement(dcp, util.nspath_eval('ows20:HTTP',\n self.parent.context.namespaces))\n\n if self.parent.context.model['operations'][operation]['methods']['get']:\n get = etree.SubElement(http, util.nspath_eval('ows20:Get',\n self.parent.context.namespaces))\n\n get.attrib[util.nspath_eval('xlink:type',\\\n self.parent.context.namespaces)] = 'simple'\n\n get.attrib[util.nspath_eval('xlink:href',\\\n self.parent.context.namespaces)] = self.parent.config.get('server', 'url')\n\n if self.parent.context.model['operations'][operation]['methods']['post']:\n post = etree.SubElement(http, util.nspath_eval('ows20:Post',\n self.parent.context.namespaces))\n post.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n post.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n self.parent.config.get('server', 'url')\n\n for parameter in \\\n sorted(self.parent.context.model['operations'][operation]['parameters']):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Parameter',\n self.parent.context.namespaces), name=parameter)\n\n param.append(self._write_allowed_values(self.parent.context.model['operations'][operation]['parameters'][parameter]['values']))\n\n if operation == 'GetRecords': # advertise queryables, MaxRecordDefault\n for qbl in sorted(self.parent.repository.queryables.keys()):\n if qbl not in ['_all', 'SupportedDublinCoreQueryables']:\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=qbl)\n\n param.append(self._write_allowed_values(self.parent.repository.queryables[qbl]))\n\n if self.parent.profiles is not None:\n for con in sorted(self.parent.context.model[\\\n 'operations']['GetRecords']['constraints'].keys()):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=con)\n\n param.append(self._write_allowed_values(self.parent.context.model['operations']['GetRecords']['constraints'][con]['values']))\n\n extra_constraints = {\n 'OpenSearchDescriptionDocument': ['%s?mode=opensearch&service=CSW&version=3.0.0&request=GetCapabilities' % self.parent.config.get('server', 'url')],\n 'MaxRecordDefault': self.parent.context.model['constraints']['MaxRecordDefault']['values'],\n }\n\n for key in sorted(extra_constraints.keys()):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=key)\n param.append(self._write_allowed_values(extra_constraints[key]))\n\n if 'FederatedCatalogues' in self.parent.context.model['constraints']:\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name='FederatedCatalogues')\n param.append(self._write_allowed_values(self.parent.context.model['constraints']['FederatedCatalogues']['values']))\n\n for parameter in sorted(self.parent.context.model['parameters'].keys()):\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Parameter', self.parent.context.namespaces),\n name=parameter)\n\n param.append(self._write_allowed_values(self.parent.context.model['parameters'][parameter]['values']))\n\n for qbl in sorted(self.parent.repository.queryables.keys()):\n if qbl == 'SupportedDublinCoreQueryables':\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name='CoreQueryables')\n param.append(self._write_allowed_values(self.parent.repository.queryables[qbl]))\n\n for constraint in sorted(self.parent.context.model['constraints'].keys()):\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Constraint', self.parent.context.namespaces),\n name=constraint)\n\n param.append(self._write_allowed_values(self.parent.context.model['constraints'][constraint]['values']))\n\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n ecnode = \\\n self.parent.profiles['loaded'][prof].get_extendedcapabilities()\n if ecnode is not None:\n operationsmetadata.append(ecnode)\n\n if languages:\n LOGGER.debug('Writing section ows:Languages')\n langs = etree.SubElement(node,\n util.nspath_eval('ows20:Languages', self.parent.context.namespaces))\n etree.SubElement(langs,\n util.nspath_eval('ows20:Language', self.parent.context.namespaces)).text = self.parent.language['639_code']\n\n if not filtercaps:\n return node\n\n # always write out Filter_Capabilities\n LOGGER.debug('Writing section Filter_Capabilities.')\n fltcaps = etree.SubElement(node,\n util.nspath_eval('fes20:Filter_Capabilities', self.parent.context.namespaces))\n\n conformance = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Conformance', self.parent.context.namespaces))\n\n for value in fes2.MODEL['Conformance']['values']:\n constraint = etree.SubElement(conformance,\n util.nspath_eval('fes20:Constraint', self.parent.context.namespaces),\n name=value)\n etree.SubElement(constraint,\n util.nspath_eval('ows11:NoValues', self.parent.context.namespaces))\n etree.SubElement(constraint,\n util.nspath_eval('ows11:DefaultValue', self.parent.context.namespaces)).text = 'TRUE'\n\n idcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Id_Capabilities', self.parent.context.namespaces))\n\n for idcap in fes2.MODEL['Ids']['values']:\n etree.SubElement(idcaps, util.nspath_eval('fes20:ResourceIdentifier',\n self.parent.context.namespaces), name=idcap)\n\n scalarcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Scalar_Capabilities', self.parent.context.namespaces))\n\n etree.SubElement(scalarcaps, util.nspath_eval('fes20:LogicalOperators',\n self.parent.context.namespaces))\n\n cmpops = etree.SubElement(scalarcaps,\n util.nspath_eval('fes20:ComparisonOperators', self.parent.context.namespaces))\n\n for cmpop in sorted(fes2.MODEL['ComparisonOperators'].keys()):\n etree.SubElement(cmpops,\n util.nspath_eval('fes20:ComparisonOperator',\n self.parent.context.namespaces), name=fes2.MODEL['ComparisonOperators'][cmpop]['opname'])\n\n spatialcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Spatial_Capabilities', self.parent.context.namespaces))\n\n geomops = etree.SubElement(spatialcaps,\n util.nspath_eval('fes20:GeometryOperands', self.parent.context.namespaces))\n\n for geomtype in \\\n fes2.MODEL['GeometryOperands']['values']:\n etree.SubElement(geomops,\n util.nspath_eval('fes20:GeometryOperand',\n self.parent.context.namespaces), name=geomtype)\n\n spatialops = etree.SubElement(spatialcaps,\n util.nspath_eval('fes20:SpatialOperators', self.parent.context.namespaces))\n\n for spatial_comparison in \\\n fes2.MODEL['SpatialOperators']['values']:\n etree.SubElement(spatialops,\n util.nspath_eval('fes20:SpatialOperator', self.parent.context.namespaces),\n name=spatial_comparison)\n\n functions = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Functions', self.parent.context.namespaces))\n\n for fnop in sorted(fes2.MODEL['Functions'].keys()):\n fn = etree.SubElement(functions,\n util.nspath_eval('fes20:Function', self.parent.context.namespaces),\n name=fnop)\n\n etree.SubElement(fn, util.nspath_eval('fes20:Returns',\n self.parent.context.namespaces)).text = \\\n fes2.MODEL['Functions'][fnop]['returns']\n\n return node", "metadata": "root.Csw3.getcapabilities", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def getdomain(self):\n ''' Handle GetDomain request '''\n if ('parametername' not in self.parent.kvp and\n 'valuereference' not in self.parent.kvp):\n return self.exceptionreport('MissingParameterValue',\n 'parametername', 'Missing value. \\\n One of valuereference or parametername must be specified')\n\n node = etree.Element(util.nspath_eval('csw30:GetDomainResponse',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces)\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = '%s %s/csw/3.0/cswGetDomain.xsd' % \\\n (self.parent.context.namespaces['csw30'],\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n if 'parametername' in self.parent.kvp:\n for pname in self.parent.kvp['parametername'].split(','):\n LOGGER.debug('Parsing parametername %s.' % pname)\n domainvalue = etree.SubElement(node,\n util.nspath_eval('csw30:DomainValues', self.parent.context.namespaces),\n type='csw30:Record', resultType='available')\n etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ParameterName',\n self.parent.context.namespaces)).text = pname\n try:\n operation, parameter = pname.split('.')\n except:\n return node\n if (operation in self.parent.context.model['operations'] and\n parameter in self.parent.context.model['operations'][operation]['parameters']):\n listofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ListOfValues', self.parent.context.namespaces))\n for val in \\\n sorted(self.parent.context.model['operations'][operation]\\\n ['parameters'][parameter]['values']):\n etree.SubElement(listofvalues,\n util.nspath_eval('csw30:Value',\n self.parent.context.namespaces)).text = val\n\n if 'valuereference' in self.parent.kvp:\n for pname in self.parent.kvp['valuereference'].split(','):\n LOGGER.debug('Parsing valuereference %s.' % pname)\n\n if pname.find('/') == 0: # it's an XPath\n pname2 = pname\n else: # it's a core queryable, map to internal typename model\n try:\n pname2 = self.parent.repository.queryables['_all'][pname]['dbcol']\n except:\n pname2 = pname\n\n # decipher typename\n dvtype = None\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n for prefix in self.parent.profiles['loaded'][prof].prefixes:\n if pname2.find(prefix) != -1:\n dvtype = self.parent.profiles['loaded'][prof].typename\n break\n if not dvtype:\n dvtype = 'csw30:Record'\n\n domainvalue = etree.SubElement(node,\n util.nspath_eval('csw30:DomainValues', self.parent.context.namespaces),\n type=dvtype, resultType='available')\n etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ValueReference',\n self.parent.context.namespaces)).text = pname\n\n try:\n LOGGER.debug(\n 'Querying repository property %s, typename %s, \\\n domainquerytype %s.' % \\\n (pname2, dvtype, self.parent.domainquerytype))\n\n results = self.parent.repository.query_domain(\n pname2, dvtype, self.parent.domainquerytype, True)\n\n LOGGER.debug('Results: %s' % str(len(results)))\n\n if self.parent.domainquerytype == 'range':\n rangeofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:RangeOfValues',\n self.parent.context.namespaces))\n\n etree.SubElement(rangeofvalues,\n util.nspath_eval('csw30:MinValue',\n self.parent.context.namespaces)).text = results[0][0]\n\n etree.SubElement(rangeofvalues,\n util.nspath_eval('csw30:MaxValue',\n self.parent.context.namespaces)).text = results[0][1]\n else:\n listofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ListOfValues',\n self.parent.context.namespaces))\n for result in results:\n LOGGER.debug(str(result))\n if (result is not None and\n result[0] is not None): # drop null values\n etree.SubElement(listofvalues,\n util.nspath_eval('csw30:Value',\n self.parent.context.namespaces),\n count=str(result[1])).text = result[0]\n except Exception as err:\n LOGGER.debug('No results for propertyname %s: %s.' %\n (pname2, str(err)))\n return node", "metadata": "root.Csw3.getdomain", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 486 }, { "content": " def getrecords(self):\n ''' Handle GetRecords request '''\n\n timestamp = util.get_today_and_now()\n\n if ('elementsetname' not in self.parent.kvp and\n 'elementname' not in self.parent.kvp):\n if self.parent.requesttype == 'GET':\n LOGGER.debug(self.parent.requesttype)\n self.parent.kvp['elementsetname'] = 'summary'\n else:\n # mutually exclusive required\n return self.exceptionreport('MissingParameterValue',\n 'elementsetname',\n 'Missing one of ElementSetName or ElementName parameter(s)')\n\n if 'elementsetname' in self.parent.kvp and 'elementname' in self.parent.kvp:\n # mutually exclusive required\n return self.exceptionreport('NoApplicableCode',\n 'elementsetname',\n 'Only ONE of ElementSetName or ElementName parameter(s) is permitted')\n\n if 'elementsetname' not in self.parent.kvp:\n self.parent.kvp['elementsetname'] = 'summary'\n\n if 'outputschema' not in self.parent.kvp:\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['csw30']\n\n LOGGER.debug(self.parent.context.model['operations']['GetRecords']['parameters']['outputSchema']['values'])\n if (self.parent.kvp['outputschema'] not in self.parent.context.model['operations']\n ['GetRecords']['parameters']['outputSchema']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputschema', 'Invalid outputSchema parameter value: %s' %\n self.parent.kvp['outputschema'])\n\n if 'outputformat' not in self.parent.kvp:\n self.parent.kvp['outputformat'] = 'application/xml'\n\n if 'HTTP_ACCEPT' in self.parent.environ:\n LOGGER.debug('Detected HTTP Accept header: %s', self.parent.environ['HTTP_ACCEPT'])\n formats_match = False\n if 'outputformat' in self.parent.kvp:\n LOGGER.debug(self.parent.kvp['outputformat'])\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n LOGGER.debug('Comparing %s and %s', ofmt, self.parent.kvp['outputformat'])\n if ofmt.split('/')[0] in self.parent.kvp['outputformat']:\n LOGGER.debug('FOUND OUTPUT MATCH')\n formats_match = True\n if not formats_match:\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'HTTP Accept header (%s) and outputformat (%s) must agree' %\n (self.parent.environ['HTTP_ACCEPT'], self.parent.kvp['outputformat']))\n else:\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n if ofmt in self.parent.context.model['operations']['GetRecords']['parameters']['outputFormat']['values']:\n self.parent.kvp['outputformat'] = ofmt\n break\n\n\n if (self.parent.kvp['outputformat'] not in self.parent.context.model['operations']\n ['GetRecords']['parameters']['outputFormat']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'Invalid outputFormat parameter value: %s' %\n self.parent.kvp['outputformat'])\n\n if 'outputformat' in self.parent.kvp:\n LOGGER.debug('Setting content type')\n self.parent.contenttype = self.parent.kvp['outputformat']\n if self.parent.kvp['outputformat'] == 'application/atom+xml':\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['atom']\n self.parent.mode = 'opensearch'\n\n if (('elementname' not in self.parent.kvp or\n len(self.parent.kvp['elementname']) == 0) and\n self.parent.kvp['elementsetname'] not in\n self.parent.context.model['operations']['GetRecords']['parameters']\n ['ElementSetName']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'elementsetname', 'Invalid ElementSetName parameter value: %s' %\n self.parent.kvp['elementsetname'])\n\n if 'typenames' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'typenames', 'Missing typenames parameter')\n\n if ('typenames' in self.parent.kvp and\n self.parent.requesttype == 'GET'): # passed via GET\n #self.parent.kvp['typenames'] = self.parent.kvp['typenames'].split(',')\n self.parent.kvp['typenames'] = ['csw:Record' if x=='Record' else x for x in self.parent.kvp['typenames'].split(',')]\n\n if 'namespace' in self.parent.kvp:\n LOGGER.debug('resolving KVP namespace bindings')\n LOGGER.debug(self.parent.kvp['typenames'])\n self.parent.kvp['typenames'] = self.resolve_nsmap(self.parent.kvp['typenames'])\n if 'elementname' in self.parent.kvp:\n LOGGER.debug(self.parent.kvp['elementname'])\n self.parent.kvp['elementname'] = self.resolve_nsmap(self.parent.kvp['elementname'].split(','))\n\n if 'typenames' in self.parent.kvp:\n for tname in self.parent.kvp['typenames']:\n #if tname == 'Record':\n # tname = 'csw:Record'\n if (tname not in self.parent.context.model['operations']['GetRecords']\n ['parameters']['typeNames']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'typenames', 'Invalid typeNames parameter value: %s' %\n tname)\n\n # check elementname's\n if 'elementname' in self.parent.kvp:\n for ename in self.parent.kvp['elementname']:\n if ename not in self.parent.repository.queryables['_all']:\n return self.exceptionreport('InvalidParameterValue',\n 'elementname', 'Invalid ElementName parameter value: %s' %\n ename)\n\n maxrecords_cfg = -1 # not set in config server.maxrecords\n\n if self.parent.config.has_option('server', 'maxrecords'):\n maxrecords_cfg = int(self.parent.config.get('server', 'maxrecords'))\n\n if 'maxrecords' in self.parent.kvp and self.parent.kvp['maxrecords'] == 'unlimited':\n LOGGER.debug('Detected maxrecords=unlimited')\n self.parent.kvp.pop('maxrecords')\n\n if 'maxrecords' not in self.parent.kvp: # not specified by client\n if maxrecords_cfg > -1: # specified in config\n self.parent.kvp['maxrecords'] = maxrecords_cfg\n else: # spec default\n self.parent.kvp['maxrecords'] = 10\n else: # specified by client\n if self.parent.kvp['maxrecords'] == '':\n self.parent.kvp['maxrecords'] = 10\n if maxrecords_cfg > -1: # set in config\n if int(self.parent.kvp['maxrecords']) > maxrecords_cfg:\n self.parent.kvp['maxrecords'] = maxrecords_cfg\n\n if any(x in ['bbox', 'q', 'time'] for x in self.parent.kvp):\n LOGGER.debug('OpenSearch Geo/Time parameters detected.')\n self.parent.kvp['constraintlanguage'] = 'FILTER'\n try:\n tmp_filter = opensearch.kvp2filterxml(self.parent.kvp, self.parent.context)\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue', 'bbox', str(err))\n\n if tmp_filter is not \"\":\n self.parent.kvp['constraint'] = tmp_filter\n LOGGER.debug('OpenSearch Geo/Time parameters to Filter: %s.' % self.parent.kvp['constraint'])\n\n if self.parent.requesttype == 'GET':\n if 'constraint' in self.parent.kvp:\n # GET request\n LOGGER.debug('csw:Constraint passed over HTTP GET.')\n if 'constraintlanguage' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'constraintlanguage',\n 'constraintlanguage required when constraint specified')\n if (self.parent.kvp['constraintlanguage'] not in\n self.parent.context.model['operations']['GetRecords']['parameters']\n ['CONSTRAINTLANGUAGE']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'constraintlanguage', 'Invalid constraintlanguage: %s'\n % self.parent.kvp['constraintlanguage'])\n if self.parent.kvp['constraintlanguage'] == 'CQL_TEXT':\n tmp = self.parent.kvp['constraint']\n self.parent.kvp['constraint'] = {}\n self.parent.kvp['constraint']['type'] = 'cql'\n self.parent.kvp['constraint']['where'] = \\\n self.parent._cql_update_queryables_mappings(tmp,\n self.parent.repository.queryables['_all'])\n self.parent.kvp['constraint']['values'] = {}\n elif self.parent.kvp['constraintlanguage'] == 'FILTER':\n # validate filter XML\n try:\n schema = os.path.join(self.parent.config.get('server', 'home'),\n 'core', 'schemas', 'ogc', 'filter', '1.1.0', 'filter.xsd')\n LOGGER.debug('Validating Filter %s.' %\n self.parent.kvp['constraint'])\n schema = etree.XMLSchema(file=schema)\n parser = etree.XMLParser(schema=schema, resolve_entities=False)\n doc = etree.fromstring(self.parent.kvp['constraint'], parser)\n LOGGER.debug('Filter is valid XML.')\n self.parent.kvp['constraint'] = {}\n self.parent.kvp['constraint']['type'] = 'filter'\n self.parent.kvp['constraint']['where'], self.parent.kvp['constraint']['values'] = \\\n fes2.parse(doc,\n self.parent.repository.queryables['_all'],\n self.parent.repository.dbtype,\n self.parent.context.namespaces, self.parent.orm, self.parent.language['text'], self.parent.repository.fts)\n except Exception as err:\n errortext = \\\n 'Exception: document not valid.\\nError: %s.' % str(err)\n\n LOGGER.debug(errortext)\n return self.exceptionreport('InvalidParameterValue',\n 'bbox', 'Invalid Filter query: %s' % errortext)\n else:\n self.parent.kvp['constraint'] = {}\n\n if 'sortby' not in self.parent.kvp:\n self.parent.kvp['sortby'] = None\n elif 'sortby' in self.parent.kvp and self.parent.requesttype == 'GET':\n LOGGER.debug('Sorted query specified.')\n tmp = self.parent.kvp['sortby']\n self.parent.kvp['sortby'] = {}\n\n try:\n name, order = tmp.rsplit(':', 1)\n except:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy value: must be in the format\\\n propertyname:A or propertyname:D')\n\n try:\n self.parent.kvp['sortby']['propertyname'] = \\\n self.parent.repository.queryables['_all'][name]['dbcol']\n if name.find('BoundingBox') != -1 or name.find('Envelope') != -1:\n # it's a spatial sort\n self.parent.kvp['sortby']['spatial'] = True\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy propertyname: %s' % name)\n\n if order not in ['A', 'D']:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy value: sort order must be \"A\" or \"D\"')\n\n if order == 'D':\n self.parent.kvp['sortby']['order'] = 'DESC'\n else:\n self.parent.kvp['sortby']['order'] = 'ASC'\n\n if 'startposition' not in self.parent.kvp:\n self.parent.kvp['startposition'] = 1\n\n if 'recordids' in self.parent.kvp and self.parent.kvp['recordids'] != '':\n # query repository\n LOGGER.debug('Querying repository with RECORD ids: %s.' % self.parent.kvp['recordids'])\n results = self.parent.repository.query_ids(self.parent.kvp['recordids'].split(','))\n matched = str(len(results))\n if len(results) == 0:\n return self.exceptionreport('NotFound', 'recordids',\n 'No records found for \\'%s\\'' % self.parent.kvp['recordids'])\n else:\n # query repository\n LOGGER.debug('Querying repository with constraint: %s,\\\n sortby: %s, typenames: %s, maxrecords: %s, startposition: %s.' %\n (self.parent.kvp['constraint'], self.parent.kvp['sortby'], self.parent.kvp['typenames'],\n self.parent.kvp['maxrecords'], self.parent.kvp['startposition']))\n\n try:\n matched, results = self.parent.repository.query(\n constraint=self.parent.kvp['constraint'],\n sortby=self.parent.kvp['sortby'], typenames=self.parent.kvp['typenames'],\n maxrecords=self.parent.kvp['maxrecords'],\n startposition=int(self.parent.kvp['startposition'])-1)\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue', 'constraint',\n 'Invalid query: %s' % err)\n\n if int(matched) == 0:\n returned = nextrecord = '0'\n else:\n if int(matched) < int(self.parent.kvp['maxrecords']):\n returned = matched\n nextrecord = '0'\n else:\n returned = str(self.parent.kvp['maxrecords'])\n if int(self.parent.kvp['startposition']) + int(self.parent.kvp['maxrecords']) >= int(matched):\n nextrecord = '0'\n else:\n nextrecord = str(int(self.parent.kvp['startposition']) + \\\n int(self.parent.kvp['maxrecords']))\n\n LOGGER.debug('Results: matched: %s, returned: %s, next: %s.' % \\\n (matched, returned, nextrecord))\n\n node = etree.Element(util.nspath_eval('csw30:GetRecordsResponse',\n self.parent.context.namespaces),\n nsmap=self.parent.context.namespaces, version='3.0.0')\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/csw/3.0/cswGetRecordsResponse.xsd' % \\\n (self.parent.context.namespaces['csw30'], self.parent.config.get('server', 'ogc_schemas_base'))\n\n if 'requestid' in self.parent.kvp and self.parent.kvp['requestid'] is not None:\n etree.SubElement(node, util.nspath_eval('csw:RequestId',\n self.parent.context.namespaces)).text = self.parent.kvp['requestid']\n\n etree.SubElement(node, util.nspath_eval('csw30:SearchStatus',\n self.parent.context.namespaces), timestamp=timestamp)\n\n #if 'where' not in self.parent.kvp['constraint'] and \\\n #self.parent.kvp['resulttype'] is None:\n # returned = '0'\n\n searchresults = etree.SubElement(node,\n util.nspath_eval('csw30:SearchResults', self.parent.context.namespaces),\n numberOfRecordsMatched=matched, numberOfRecordsReturned=returned,\n nextRecord=nextrecord, recordSchema=self.parent.kvp['outputschema'],\n expires=timestamp, status=get_resultset_status(matched, nextrecord))\n\n if self.parent.kvp['elementsetname'] is not None:\n searchresults.attrib['elementSet'] = self.parent.kvp['elementsetname']\n\n #if 'where' not in self.parent.kvp['constraint'] \\\n #and self.parent.kvp['resulttype'] is None:\n # LOGGER.debug('Empty result set returned.')\n # return node\n\n if results is not None:\n if len(results) < int(self.parent.kvp['maxrecords']):\n max1 = len(results)\n else:\n max1 = int(self.parent.kvp['startposition']) + (int(self.parent.kvp['maxrecords'])-1)\n LOGGER.debug('Presenting records %s - %s.' %\n (self.parent.kvp['startposition'], max1))\n\n for res in results:\n try:\n if (self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0' and\n 'csw:Record' in self.parent.kvp['typenames']):\n # serialize csw:Record inline\n searchresults.append(self._write_record(\n res, self.parent.repository.queryables['_all']))\n elif (self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0' and\n 'csw:Record' not in self.parent.kvp['typenames']):\n # serialize into csw:Record model\n\n for prof in self.parent.profiles['loaded']:\n # find source typename\n if self.parent.profiles['loaded'][prof].typename in \\\n self.parent.kvp['typenames']:\n typename = self.parent.profiles['loaded'][prof].typename\n break\n\n util.transform_mappings(self.parent.repository.queryables['_all'],\n self.parent.context.model['typenames'][typename]\\\n ['mappings']['csw:Record'], reverse=True)\n\n searchresults.append(self._write_record(\n res, self.parent.repository.queryables['_all']))\n elif self.parent.kvp['outputschema'] in self.parent.outputschemas: # use outputschema serializer\n searchresults.append(self.parent.outputschemas[self.parent.kvp['outputschema']].write_record(res, self.parent.kvp['elementsetname'], self.parent.context, self.parent.config.get('server', 'url')))\n else: # use profile serializer\n searchresults.append(\n self.parent.profiles['loaded'][self.parent.kvp['outputschema']].\\\n write_record(res, self.parent.kvp['elementsetname'],\n self.parent.kvp['outputschema'],\n self.parent.repository.queryables['_all']))\n except Exception as err:\n self.parent.response = self.exceptionreport(\n 'NoApplicableCode', 'service',\n 'Record serialization failed: %s' % str(err))\n return self.parent.response\n\n if (self.parent.config.has_option('server', 'federatedcatalogues') and\n 'distributedsearch' in self.parent.kvp and\n self.parent.kvp['distributedsearch'] and self.parent.kvp['hopcount'] > 0):\n # do distributed search\n\n LOGGER.debug('DistributedSearch specified (hopCount: %s).' %\n self.parent.kvp['hopcount'])\n\n from owslib.csw import CatalogueServiceWeb\n from owslib.ows import ExceptionReport\n for fedcat in \\\n self.parent.config.get('server', 'federatedcatalogues').split(','):\n LOGGER.debug('Performing distributed search on federated \\\n catalogue: %s.' % fedcat)\n try:\n start_time = time()\n remotecsw = CatalogueServiceWeb(fedcat, skip_caps=True)\n remotecsw.getrecords2(xml=self.parent.request,\n esn=self.parent.kvp['elementsetname'],\n outputschema=self.parent.kvp['outputschema'])\n\n fsr = etree.SubElement(searchresults, util.nspath_eval(\n 'csw30:FederatedSearchResult',\n self.parent.context.namespaces),\n catalogueURL=fedcat.request)\n\n msg = 'Distributed search results from catalogue %s: %s.' % (fedcat, remotecsw.results)\n LOGGER.debug(msg)\n fsr.append(etree.Comment(msg))\n\n search_result = etree.SubElement(fsr, util.nspath_eval(\n 'csw30:searchResult', self.parent.context.namespaces),\n recordSchema=self.parent.kvp['outputschema'],\n elementSetName=self.parent.kvp['elementsetname'],\n numberOfRecordsMatched=fedcat.results['matches'],\n numberOfRecordsReturned=fedcat.results['returned'],\n nextRecord=fedcat.results['nextrecord'],\n elapsedTime=get_elapsed_time(start_time, time()),\n status=get_resultset_status(\n fedcat.results['matches'],\n fedcat.results['nextrecord']))\n\n search_result.append(remotecsw.records)\n except ExceptionReport as err:\n error_string = 'remote CSW %s returned exception: ' % fedcat\n searchresults.append(etree.Comment(\n ' %s\\n\\n%s ' % (error_string, err)))\n LOGGER.debug(str(err))\n except Exception as err:\n error_string = 'remote CSW %s returned error: ' % fedcat\n searchresults.append(etree.Comment(\n ' %s\\n\\n%s ' % (error_string, err)))\n LOGGER.debug(str(err))\n\n# if len(dsresults) > 0: # return DistributedSearch results\n# for resultset in dsresults:\n# if isinstance(resultset, etree._Comment):\n# searchresults.append(resultset)\n# for rec in resultset:\n# searchresults.append(etree.fromstring(resultset[rec].xml, self.parent.context.parser))\n\n searchresults.attrib['elapsedTime'] = get_elapsed_time(self.parent.process_time_start, time())\n\n if 'responsehandler' in self.parent.kvp: # process the handler\n self.parent._process_responsehandler(etree.tostring(node,\n pretty_print=self.parent.pretty_print))\n else:\n return node", "metadata": "root.Csw3.getrecords", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 596 }, { "content": " def getrecordbyid(self, raw=False):\n ''' Handle GetRecordById request '''\n\n if 'id' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue', 'id',\n 'Missing id parameter')\n if len(self.parent.kvp['id']) < 1:\n return self.exceptionreport('InvalidParameterValue', 'id',\n 'Invalid id parameter')\n if 'outputschema' not in self.parent.kvp:\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['csw30']\n\n if 'HTTP_ACCEPT' in self.parent.environ:\n LOGGER.debug('Detected HTTP Accept header: %s', self.parent.environ['HTTP_ACCEPT'])\n formats_match = False\n if 'outputformat' in self.parent.kvp:\n LOGGER.debug(self.parent.kvp['outputformat'])\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n LOGGER.debug('Comparing %s and %s', ofmt, self.parent.kvp['outputformat'])\n if ofmt.split('/')[0] in self.parent.kvp['outputformat']:\n LOGGER.debug('FOUND OUTPUT MATCH')\n formats_match = True\n if not formats_match:\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'HTTP Accept header (%s) and outputformat (%s) must agree' %\n (self.parent.environ['HTTP_ACCEPT'], self.parent.kvp['outputformat']))\n else:\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n if ofmt in self.parent.context.model['operations']['GetRecords']['parameters']['outputFormat']['values']:\n self.parent.kvp['outputformat'] = ofmt\n break\n\n if ('outputformat' in self.parent.kvp and\n self.parent.kvp['outputformat'] not in\n self.parent.context.model['operations']['GetRecordById']['parameters']\n ['outputFormat']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'Invalid outputformat parameter %s' %\n self.parent.kvp['outputformat'])\n\n if ('outputschema' in self.parent.kvp and self.parent.kvp['outputschema'] not in\n self.parent.context.model['operations']['GetRecordById']['parameters']\n ['outputSchema']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputschema', 'Invalid outputschema parameter %s' %\n self.parent.kvp['outputschema'])\n\n if 'outputformat' in self.parent.kvp:\n self.parent.contenttype = self.parent.kvp['outputformat']\n if self.parent.kvp['outputformat'] == 'application/atom+xml':\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['atom']\n self.parent.mode = 'opensearch'\n\n if 'elementsetname' not in self.parent.kvp:\n self.parent.kvp['elementsetname'] = 'summary'\n else:\n if (self.parent.kvp['elementsetname'] not in\n self.parent.context.model['operations']['GetRecordById']['parameters']\n ['ElementSetName']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'elementsetname', 'Invalid elementsetname parameter %s' %\n self.parent.kvp['elementsetname'])\n\n # query repository\n LOGGER.debug('Querying repository with ids: %s.' % self.parent.kvp['id'])\n results = self.parent.repository.query_ids([self.parent.kvp['id']])\n\n if raw: # GetRepositoryItem request\n LOGGER.debug('GetRepositoryItem request.')\n if len(results) > 0:\n return etree.fromstring(util.getqattr(results[0],\n self.parent.context.md_core_model['mappings']['pycsw:XML']), self.parent.context.parser)\n\n for result in results:\n if (util.getqattr(result,\n self.parent.context.md_core_model['mappings']['pycsw:Typename']) == 'csw:Record'\n and self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0'):\n # serialize record inline\n node = self._write_record(\n result, self.parent.repository.queryables['_all'])\n elif (self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0'):\n # serialize into csw:Record model\n typename = None\n\n for prof in self.parent.profiles['loaded']: # find source typename\n if self.parent.profiles['loaded'][prof].typename in \\\n [util.getqattr(result, self.parent.context.md_core_model['mappings']['pycsw:Typename'])]:\n typename = self.parent.profiles['loaded'][prof].typename\n break\n\n if typename is not None:\n util.transform_mappings(self.parent.repository.queryables['_all'],\n self.parent.context.model['typenames'][typename]\\\n ['mappings']['csw:Record'], reverse=True)\n\n node = self._write_record( result, self.parent.repository.queryables['_all'])\n elif self.parent.kvp['outputschema'] in self.parent.outputschemas: # use outputschema serializer\n node = self.parent.outputschemas[self.parent.kvp['outputschema']].write_record(result, self.parent.kvp['elementsetname'], self.parent.context, self.parent.config.get('server', 'url'))\n else: # it's a profile output\n node = self.parent.profiles['loaded'][self.parent.kvp['outputschema']].write_record(\n result, self.parent.kvp['elementsetname'],\n self.parent.kvp['outputschema'], self.parent.repository.queryables['_all'])\n\n if raw and len(results) == 0:\n return None\n\n if len(results) == 0:\n return self.exceptionreport('NotFound', 'id',\n 'No repository item found for \\'%s\\'' % self.parent.kvp['id'])\n\n return node", "metadata": "root.Csw3.getrecordbyid", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1024 }, { "content": " def getrepositoryitem(self):\n ''' Handle GetRepositoryItem request '''\n\n # similar to GetRecordById without csw:* wrapping\n node = self.parent.getrecordbyid(raw=True)\n if node is None:\n return self.exceptionreport('NotFound', 'id',\n 'No repository item found for \\'%s\\'' % self.parent.kvp['id'])\n else:\n return node", "metadata": "root.Csw3.getrepositoryitem", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1138 }, { "content": " def transaction(self):\n ''' Handle Transaction request '''\n\n try:\n self.parent._test_manager()\n except Exception as err:\n return self.exceptionreport('NoApplicableCode', 'transaction',\n str(err))\n\n inserted = 0\n updated = 0\n deleted = 0\n\n insertresults = []\n\n LOGGER.debug('Transaction list: %s' % self.parent.kvp['transactions'])\n\n for ttype in self.parent.kvp['transactions']:\n if ttype['type'] == 'insert':\n try:\n record = metadata.parse_record(self.parent.context,\n ttype['xml'], self.parent.repository)[0]\n except Exception as err:\n return self.exceptionreport('NoApplicableCode', 'insert',\n 'Transaction (insert) failed: record parsing failed: %s' \\\n % str(err))\n\n LOGGER.debug('Transaction operation: %s' % record)\n\n if not hasattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Identifier']):\n return self.exceptionreport('NoApplicableCode',\n 'insert', 'Record requires an identifier')\n\n # insert new record\n try:\n self.parent.repository.insert(record, 'local',\n util.get_today_and_now())\n\n inserted += 1\n insertresults.append(\n {'identifier': getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Identifier']),\n 'title': getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Title'])})\n except Exception as err:\n return self.exceptionreport('NoApplicableCode',\n 'insert', 'Transaction (insert) failed: %s.' % str(err))\n\n elif ttype['type'] == 'update':\n if 'constraint' not in ttype:\n # update full existing resource in repository\n try:\n record = metadata.parse_record(self.parent.context,\n ttype['xml'], self.parent.repository)[0]\n identifier = getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Identifier'])\n except Exception as err:\n return self.exceptionreport('NoApplicableCode', 'insert',\n 'Transaction (update) failed: record parsing failed: %s' \\\n % str(err))\n\n # query repository to see if record already exists\n LOGGER.debug('checking if record exists (%s)' % \\\n identifier)\n\n results = self.parent.repository.query_ids(ids=[identifier])\n\n if len(results) == 0:\n LOGGER.debug('id %s does not exist in repository' % \\\n identifier)\n else: # existing record, it's an update\n try:\n self.parent.repository.update(record)\n updated += 1\n except Exception as err:\n return self.exceptionreport('NoApplicableCode',\n 'update',\n 'Transaction (update) failed: %s.' % str(err))\n else: # update by record property and constraint\n # get / set XPath for property names\n for rp in ttype['recordproperty']:\n if rp['name'] not in self.parent.repository.queryables['_all']:\n # is it an XPath?\n if rp['name'].find('/') != -1:\n # scan outputschemas; if match, bind\n for osch in self.parent.outputschemas.values():\n for key, value in osch.XPATH_MAPPINGS.items():\n if value == rp['name']: # match\n rp['rp'] = {'xpath': value, 'name': key}\n rp['rp']['dbcol'] = self.parent.repository.queryables['_all'][key]\n break\n else:\n return self.exceptionreport('NoApplicableCode',\n 'update', 'Transaction (update) failed: invalid property2: %s.' % str(rp['name']))\n else:\n rp['rp']= \\\n self.parent.repository.queryables['_all'][rp['name']]\n\n LOGGER.debug('Record Properties: %s.' %\n ttype['recordproperty'])\n try:\n updated += self.parent.repository.update(record=None,\n recprops=ttype['recordproperty'],\n constraint=ttype['constraint'])\n except Exception as err:\n return self.exceptionreport('NoApplicableCode',\n 'update',\n 'Transaction (update) failed: %s.' % str(err))\n\n elif ttype['type'] == 'delete':\n deleted += self.parent.repository.delete(ttype['constraint'])\n\n node = etree.Element(util.nspath_eval('csw30:TransactionResponse',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces, version='3.0.0')\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = '%s %s/csw/3.0/cswTransaction.xsd' % \\\n (self.parent.context.namespaces['csw30'], self.parent.config.get('server', 'ogc_schemas_base'))\n\n node.append(\n self._write_transactionsummary(\n inserted=inserted, updated=updated, deleted=deleted))\n\n if (len(insertresults) > 0 and self.parent.kvp['verboseresponse']):\n # show insert result identifiers\n node.append(self._write_verboseresponse(insertresults))\n\n return node", "metadata": "root.Csw3.transaction", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1149 }, { "content": " def harvest(self):\n ''' Handle Harvest request '''\n\n service_identifier = None\n old_identifier = None\n deleted = []\n\n try:\n self.parent._test_manager()\n except Exception as err:\n return self.exceptionreport('NoApplicableCode', 'harvest', str(err))\n\n if self.parent.requesttype == 'GET':\n if 'resourcetype' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'resourcetype', 'Missing resourcetype parameter')\n if 'source' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'source', 'Missing source parameter')\n\n # validate resourcetype\n if (self.parent.kvp['resourcetype'] not in\n self.parent.context.model['operations']['Harvest']['parameters']['ResourceType']\n ['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'resourcetype', 'Invalid resource type parameter: %s.\\\n Allowable resourcetype values: %s' % (self.parent.kvp['resourcetype'],\n ','.join(self.parent.context.model['operations']['Harvest']['parameters']\n ['ResourceType']['values'])))\n\n if (self.parent.kvp['resourcetype'].find('opengis.net') == -1 and\n self.parent.kvp['resourcetype'].find('urn:geoss:waf') == -1):\n # fetch content-based resource\n LOGGER.debug('Fetching resource %s' % self.parent.kvp['source'])\n try:\n content = util.http_request('GET', self.parent.kvp['source'])\n except Exception as err:\n errortext = 'Error fetching resource %s.\\nError: %s.' % \\\n (self.parent.kvp['source'], str(err))\n LOGGER.debug(errortext)\n return self.exceptionreport('InvalidParameterValue', 'source',\n errortext)\n else: # it's a service URL\n content = self.parent.kvp['source']\n # query repository to see if service already exists\n LOGGER.debug('checking if service exists (%s)' % content)\n results = self.parent.repository.query_source(content)\n\n if len(results) > 0: # exists, keep identifier for update\n LOGGER.debug('Service already exists, keeping identifier and results')\n service_identifier = results[0].identifier\n service_results = results\n LOGGER.debug('Identifier is %s' % service_identifier)\n # return self.exceptionreport('NoApplicableCode', 'source',\n # 'Insert failed: service %s already in repository' % content)\n\n # parse resource into record\n try:\n records_parsed = metadata.parse_record(self.parent.context,\n content, self.parent.repository, self.parent.kvp['resourcetype'],\n pagesize=self.parent.csw_harvest_pagesize)\n except Exception as err:\n LOGGER.exception(err)\n return self.exceptionreport('NoApplicableCode', 'source',\n 'Harvest failed: record parsing failed: %s' % str(err))\n\n inserted = 0\n updated = 0\n ir = []\n\n LOGGER.debug('Total Records parsed: %d' % len(records_parsed))\n for record in records_parsed:\n if self.parent.kvp['resourcetype'] == 'urn:geoss:waf':\n src = record.source\n else:\n src = self.parent.kvp['source']\n\n setattr(record, self.parent.context.md_core_model['mappings']['pycsw:Source'],\n src)\n\n setattr(record, self.parent.context.md_core_model['mappings']['pycsw:InsertDate'],\n util.get_today_and_now())\n\n identifier = getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Identifier'])\n source = getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Source'])\n insert_date = getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:InsertDate'])\n title = getattr(record,\n self.parent.context.md_core_model['mappings']['pycsw:Title'])\n\n if record.type == 'service' and service_identifier is not None: # service endpoint\n LOGGER.debug('Replacing service identifier from %s to %s' % (record.identifier, service_identifier))\n old_identifier = record.identifier\n identifier = record.identifier = service_identifier\n if (record.type != 'service' and service_identifier is not None\n and old_identifier is not None): # service resource\n if record.identifier.find(old_identifier) != -1:\n new_identifier = record.identifier.replace(old_identifier, service_identifier)\n LOGGER.debug('Replacing service resource identifier from %s to %s' % (record.identifier, new_identifier))\n identifier = record.identifier = new_identifier\n\n ir.append({'identifier': identifier, 'title': title})\n\n # query repository to see if record already exists\n LOGGER.debug('checking if record exists (%s)' % identifier)\n results = self.parent.repository.query_ids(ids=[identifier])\n\n if len(results) == 0: # check for service identifier\n LOGGER.debug('checking if service id exists (%s)' % service_identifier)\n results = self.parent.repository.query_ids(ids=[service_identifier])\n\n LOGGER.debug(str(results))\n\n if len(results) == 0: # new record, it's a new insert\n inserted += 1\n try:\n self.parent.repository.insert(record, source, insert_date)\n except Exception as err:\n return self.exceptionreport('NoApplicableCode',\n 'source', 'Harvest (insert) failed: %s.' % str(err))\n else: # existing record, it's an update\n if source != results[0].source:\n # same identifier, but different source\n return self.exceptionreport('NoApplicableCode',\n 'source', 'Insert failed: identifier %s in repository\\\n has source %s.' % (identifier, source))\n\n try:\n self.parent.repository.update(record)\n except Exception as err:\n return self.exceptionreport('NoApplicableCode',\n 'source', 'Harvest (update) failed: %s.' % str(err))\n updated += 1\n\n node = etree.Element(util.nspath_eval('csw30:HarvestResponse',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces)\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/csw/3.0/cswHarvest.xsd' % (self.parent.context.namespaces['csw30'],\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n node2 = etree.SubElement(node,\n util.nspath_eval('csw30:TransactionResponse',\n self.parent.context.namespaces), version='3.0.0')\n\n if service_identifier is not None:\n fresh_records = [str(i['identifier']) for i in ir]\n existing_records = [str(i.identifier) for i in service_results]\n\n deleted = set(existing_records) - set(fresh_records)\n LOGGER.debug('Records to delete: %s' % str(deleted))\n\n for to_delete in deleted:\n delete_constraint = {\n 'type': 'filter',\n 'values': [to_delete],\n 'where': 'identifier = :pvalue0'\n }\n self.parent.repository.delete(delete_constraint)\n\n node2.append(\n self._write_transactionsummary(inserted=inserted, updated=updated,\n deleted=len(deleted)))\n\n if inserted > 0:\n # show insert result identifiers\n node2.append(self._write_verboseresponse(ir))\n\n if 'responsehandler' in self.parent.kvp: # process the handler\n self.parent._process_responsehandler(etree.tostring(node,\n pretty_print=self.parent.pretty_print))\n else:\n return node", "metadata": "root.Csw3.harvest", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1279 }, { "content": " def _write_record(self, recobj, queryables):\n ''' Generate csw30:Record '''\n if self.parent.kvp['elementsetname'] == 'brief':\n elname = 'BriefRecord'\n elif self.parent.kvp['elementsetname'] == 'summary':\n elname = 'SummaryRecord'\n else:\n elname = 'Record'\n\n record = etree.Element(util.nspath_eval('csw30:%s' % elname,\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces)\n\n if ('elementname' in self.parent.kvp and\n len(self.parent.kvp['elementname']) > 0):\n for req_term in ['dc:identifier', 'dc:title']:\n if req_term not in self.parent.kvp['elementname']:\n value = util.getqattr(recobj, queryables[req_term]['dbcol'])\n etree.SubElement(record,\n util.nspath_eval(req_term,\n self.parent.context.namespaces)).text = value\n for elemname in self.parent.kvp['elementname']:\n if (elemname.find('BoundingBox') != -1 or\n elemname.find('Envelope') != -1):\n bboxel = write_boundingbox(util.getqattr(recobj,\n self.parent.context.md_core_model['mappings']['pycsw:BoundingBox']),\n self.parent.context.namespaces)\n if bboxel is not None:\n record.append(bboxel)\n else:\n value = util.getqattr(recobj, queryables[elemname]['dbcol'])\n elem = etree.SubElement(record,\n util.nspath_eval(elemname,\n self.parent.context.namespaces))\n if value:\n elem.text = value\n elif 'elementsetname' in self.parent.kvp:\n if (self.parent.kvp['elementsetname'] == 'full' and\n util.getqattr(recobj, self.parent.context.md_core_model['mappings']\\\n ['pycsw:Typename']) == 'csw:Record' and\n util.getqattr(recobj, self.parent.context.md_core_model['mappings']\\\n ['pycsw:Schema']) == 'http://www.opengis.net/cat/csw/3.0' and\n util.getqattr(recobj, self.parent.context.md_core_model['mappings']\\\n ['pycsw:Type']) != 'service'):\n # dump record as is and exit\n return etree.fromstring(util.getqattr(recobj,\n self.parent.context.md_core_model['mappings']['pycsw:XML']), self.parent.context.parser)\n\n etree.SubElement(record,\n util.nspath_eval('dc:identifier', self.parent.context.namespaces)).text = \\\n util.getqattr(recobj,\n self.parent.context.md_core_model['mappings']['pycsw:Identifier'])\n\n for i in ['dc:title', 'dc:type']:\n val = util.getqattr(recobj, queryables[i]['dbcol'])\n if not val:\n val = ''\n etree.SubElement(record, util.nspath_eval(i,\n self.parent.context.namespaces)).text = val\n\n if self.parent.kvp['elementsetname'] in ['summary', 'full']:\n # add summary elements\n keywords = util.getqattr(recobj, queryables['dc:subject']['dbcol'])\n if keywords is not None:\n for keyword in keywords.split(','):\n etree.SubElement(record,\n util.nspath_eval('dc:subject',\n self.parent.context.namespaces)).text = keyword\n\n val = util.getqattr(recobj, queryables['dc:format']['dbcol'])\n if val:\n etree.SubElement(record,\n util.nspath_eval('dc:format',\n self.parent.context.namespaces)).text = val\n\n # links\n rlinks = util.getqattr(recobj,\n self.parent.context.md_core_model['mappings']['pycsw:Links'])\n\n if rlinks:\n links = rlinks.split('^')\n for link in links:\n linkset = link.split(',')\n etree.SubElement(record,\n util.nspath_eval('dct:references',\n self.parent.context.namespaces),\n scheme=linkset[2]).text = linkset[-1]\n\n for i in ['dc:relation', 'dct:modified', 'dct:abstract']:\n val = util.getqattr(recobj, queryables[i]['dbcol'])\n if val is not None:\n etree.SubElement(record,\n util.nspath_eval(i, self.parent.context.namespaces)).text = val\n\n if self.parent.kvp['elementsetname'] == 'full': # add full elements\n for i in ['dc:date', 'dc:creator', \\\n 'dc:publisher', 'dc:contributor', 'dc:source', \\\n 'dc:language', 'dc:rights']:\n val = util.getqattr(recobj, queryables[i]['dbcol'])\n if val:\n etree.SubElement(record,\n util.nspath_eval(i, self.parent.context.namespaces)).text = val\n\n # always write out ows:BoundingBox\n bboxel = write_boundingbox(getattr(recobj,\n self.parent.context.md_core_model['mappings']['pycsw:BoundingBox']),\n self.parent.context.namespaces)\n\n if bboxel is not None:\n record.append(bboxel)\n\n if self.parent.kvp['elementsetname'] != 'brief': # add temporal extent\n begin = util.getqattr(record, self.parent.context.md_core_model['mappings']['pycsw:TempExtent_begin'])\n end = util.getqattr(record, self.parent.context.md_core_model['mappings']['pycsw:TempExtent_end'])\n\n if begin or end:\n tempext = etree.SubElement(record, util.nspath_eval('csw30:TemporalExtent', self.parent.context.namespaces))\n if begin:\n etree.SubElement(record, util.nspath_eval('csw30:begin', self.parent.context.namespaces)).text = begin\n if end:\n etree.SubElement(record, util.nspath_eval('csw30:end', self.parent.context.namespaces)).text = end\n\n return record", "metadata": "root.Csw3._write_record", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1456 }, { "content": " def _parse_constraint(self, element):\n ''' Parse csw:Constraint '''\n\n query = {}\n\n tmp = element.find(util.nspath_eval('fes20:Filter', self.parent.context.namespaces))\n if tmp is not None:\n LOGGER.debug('Filter constraint specified.')\n try:\n query['type'] = 'filter'\n query['where'], query['values'] = fes2.parse(tmp,\n self.parent.repository.queryables['_all'], self.parent.repository.dbtype,\n self.parent.context.namespaces, self.parent.orm, self.parent.language['text'], self.parent.repository.fts)\n except Exception as err:\n return 'Invalid Filter request: %s' % err\n tmp = element.find(util.nspath_eval('csw30:CqlText', self.parent.context.namespaces))\n if tmp is not None:\n LOGGER.debug('CQL specified: %s.' % tmp.text)\n query['type'] = 'cql'\n query['where'] = self.parent._cql_update_queryables_mappings(tmp.text,\n self.parent.repository.queryables['_all'])\n query['values'] = {}\n return query", "metadata": "root.Csw3._parse_constraint", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1579 }, { "content": " def parse_postdata(self, postdata):\n ''' Parse POST XML '''\n\n request = {}\n try:\n LOGGER.debug('Parsing %s.' % postdata)\n doc = etree.fromstring(postdata, self.parent.context.parser)\n except Exception as err:\n errortext = \\\n 'Exception: document not well-formed.\\nError: %s.' % str(err)\n\n LOGGER.debug(errortext)\n return errortext\n\n # if this is a SOAP request, get to SOAP-ENV:Body/csw:*\n if (doc.tag == util.nspath_eval('soapenv:Envelope',\n self.parent.context.namespaces)):\n\n LOGGER.debug('SOAP request specified.')\n self.parent.soap = True\n\n doc = doc.find(\n util.nspath_eval('soapenv:Body',\n self.parent.context.namespaces)).xpath('child::*')[0]\n\n xsd_filename = 'csw%s.xsd' % util.xmltag_split(doc.tag)\n schema = os.path.join(self.parent.config.get('server', 'home'),\n 'core', 'schemas', 'ogc', 'csw', '3.0', xsd_filename)\n\n try:\n # it is virtually impossible to validate a csw:Transaction\n # csw:Insert|csw:Update (with single child) XML document.\n # Only validate non csw:Transaction XML\n\n if doc.find('.//%s' % util.nspath_eval('csw30:Insert',\n self.parent.context.namespaces)) is None and \\\n len(doc.xpath('//csw30:Update/child::*',\n namespaces=self.parent.context.namespaces)) == 0:\n\n LOGGER.debug('Validating %s.' % postdata)\n schema = etree.XMLSchema(file=schema)\n parser = etree.XMLParser(schema=schema, resolve_entities=False)\n if hasattr(self.parent, 'soap') and self.parent.soap:\n # validate the body of the SOAP request\n doc = etree.fromstring(etree.tostring(doc), parser)\n else: # validate the request normally\n doc = etree.fromstring(postdata, parser)\n LOGGER.debug('Request is valid XML.')\n else: # parse Transaction without validation\n doc = etree.fromstring(postdata, self.parent.context.parser)\n except Exception as err:\n errortext = \\\n 'Exception: the document is not valid.\\nError: %s' % str(err)\n LOGGER.debug(errortext)\n return errortext\n\n request['request'] = util.xmltag_split(doc.tag)\n LOGGER.debug('Request operation %s specified.' % request['request'])\n tmp = doc.find('.').attrib.get('service')\n if tmp is not None:\n request['service'] = tmp\n\n tmp = doc.find('.').attrib.get('version')\n if tmp is not None:\n request['version'] = tmp\n\n tmp = doc.find('.//%s' % util.nspath_eval('ows20:Version',\n self.parent.context.namespaces))\n\n if tmp is not None:\n request['version'] = tmp.text\n\n tmp = doc.find('.').attrib.get('updateSequence')\n if tmp is not None:\n request['updatesequence'] = tmp\n\n # GetCapabilities\n if request['request'] == 'GetCapabilities':\n tmp = doc.find(util.nspath_eval('ows20:Sections',\n self.parent.context.namespaces))\n if tmp is not None:\n request['sections'] = ','.join([section.text for section in \\\n doc.findall(util.nspath_eval('ows20:Sections/ows20:Section',\n self.parent.context.namespaces))])\n\n tmp = doc.find(util.nspath_eval('ows20:AcceptFormats',\n self.parent.context.namespaces))\n if tmp is not None:\n request['acceptformats'] = ','.join([aformat.text for aformat in \\\n doc.findall(util.nspath_eval('ows20:AcceptFormats/ows20:OutputFormat',\n self.parent.context.namespaces))])\n\n tmp = doc.find(util.nspath_eval('ows20:AcceptVersions',\n self.parent.context.namespaces))\n if tmp is not None:\n request['acceptversions'] = ','.join([version.text for version in \\\n doc.findall(util.nspath_eval('ows20:AcceptVersions/ows20:Version',\n self.parent.context.namespaces))])\n\n # GetDomain\n if request['request'] == 'GetDomain':\n tmp = doc.find(util.nspath_eval('csw30:ParameterName',\n self.parent.context.namespaces))\n if tmp is not None:\n request['parametername'] = tmp.text\n\n tmp = doc.find(util.nspath_eval('csw30:ValueReference',\n self.parent.context.namespaces))\n if tmp is not None:\n request['valuereference'] = tmp.text\n\n # GetRecords\n if request['request'] == 'GetRecords':\n tmp = doc.find('.').attrib.get('outputSchema')\n request['outputschema'] = tmp if tmp is not None \\\n else self.parent.context.namespaces['csw30']\n\n tmp = doc.find('.').attrib.get('outputFormat')\n request['outputformat'] = tmp if tmp is not None \\\n else 'application/xml'\n\n tmp = doc.find('.').attrib.get('startPosition')\n request['startposition'] = tmp if tmp is not None else 1\n\n tmp = doc.find('.').attrib.get('requestId')\n request['requestid'] = tmp if tmp is not None else None\n\n tmp = doc.find('.').attrib.get('maxRecords')\n if tmp is not None:\n request['maxrecords'] = tmp\n\n tmp = doc.find(util.nspath_eval('csw30:DistributedSearch',\n self.parent.context.namespaces))\n if tmp is not None:\n request['distributedsearch'] = True\n hopcount = tmp.attrib.get('hopCount')\n request['hopcount'] = int(hopcount)-1 if hopcount is not None \\\n else 1\n else:\n request['distributedsearch'] = False\n\n tmp = doc.find(util.nspath_eval('csw30:ResponseHandler',\n self.parent.context.namespaces))\n if tmp is not None:\n request['responsehandler'] = tmp.text\n\n tmp = doc.find(util.nspath_eval('csw30:Query/csw30:ElementSetName',\n self.parent.context.namespaces))\n request['elementsetname'] = tmp.text if tmp is not None else None\n\n tmp = doc.find(util.nspath_eval(\n 'csw30:Query', self.parent.context.namespaces)).attrib.get('typeNames')\n request['typenames'] = tmp.split() if tmp is not None \\\n else 'csw:Record'\n\n request['elementname'] = [elname.text for elname in \\\n doc.findall(util.nspath_eval('csw30:Query/csw30:ElementName',\n self.parent.context.namespaces))]\n\n request['constraint'] = {}\n tmp = doc.find(util.nspath_eval('csw30:Query/csw30:Constraint',\n self.parent.context.namespaces))\n\n if tmp is not None:\n request['constraint'] = self._parse_constraint(tmp)\n if isinstance(request['constraint'], str): # parse error\n return 'Invalid Constraint: %s' % request['constraint']\n else:\n LOGGER.debug('No csw30:Constraint (fes20:Filter or csw30:CqlText) \\\n specified.')\n\n tmp = doc.find(util.nspath_eval('csw30:Query/fes20:SortBy',\n self.parent.context.namespaces))\n if tmp is not None:\n LOGGER.debug('Sorted query specified.')\n request['sortby'] = {}\n\n\n try:\n elname = tmp.find(util.nspath_eval(\n 'fes20:SortProperty/fes20:ValueReference',\n self.parent.context.namespaces)).text\n\n request['sortby']['propertyname'] = \\\n self.parent.repository.queryables['_all'][elname]['dbcol']\n\n if (elname.find('BoundingBox') != -1 or\n elname.find('Envelope') != -1):\n # it's a spatial sort\n request['sortby']['spatial'] = True\n except Exception as err:\n errortext = \\\n 'Invalid fes20:SortProperty/fes20:ValueReference: %s' % str(err)\n LOGGER.debug(errortext)\n return errortext\n\n tmp2 = tmp.find(util.nspath_eval(\n 'fes20:SortProperty/fes20:SortOrder', self.parent.context.namespaces))\n request['sortby']['order'] = tmp2.text if tmp2 is not None \\\n else 'ASC'\n else:\n request['sortby'] = None\n\n # GetRecordById\n if request['request'] == 'GetRecordById':\n request['id'] = None\n tmp = doc.find(util.nspath_eval('csw30:Id', self.parent.context.namespaces))\n if tmp is not None:\n request['id'] = tmp.text\n\n tmp = doc.find(util.nspath_eval('csw30:ElementSetName',\n self.parent.context.namespaces))\n request['elementsetname'] = tmp.text if tmp is not None \\\n else 'summary'\n\n tmp = doc.find('.').attrib.get('outputSchema')\n request['outputschema'] = tmp if tmp is not None \\\n else self.parent.context.namespaces['csw30']\n\n tmp = doc.find('.').attrib.get('outputFormat')\n if tmp is not None:\n request['outputformat'] = tmp\n\n # Transaction\n if request['request'] == 'Transaction':\n request['verboseresponse'] = True\n tmp = doc.find('.').attrib.get('verboseResponse')\n if tmp is not None:\n if tmp in ['false', '0']:\n request['verboseresponse'] = False\n\n tmp = doc.find('.').attrib.get('requestId')\n request['requestid'] = tmp if tmp is not None else None\n\n request['transactions'] = []\n\n for ttype in \\\n doc.xpath('//csw30:Insert', namespaces=self.parent.context.namespaces):\n tname = ttype.attrib.get('typeName')\n\n for mdrec in ttype.xpath('child::*'):\n xml = mdrec\n request['transactions'].append(\n {'type': 'insert', 'typename': tname, 'xml': xml})\n\n for ttype in \\\n doc.xpath('//csw30:Update', namespaces=self.parent.context.namespaces):\n child = ttype.xpath('child::*')\n update = {'type': 'update'}\n\n if len(child) == 1: # it's a wholesale update\n update['xml'] = child[0]\n else: # it's a RecordProperty with Constraint Update\n update['recordproperty'] = []\n\n for recprop in ttype.findall(\n util.nspath_eval('csw:RecordProperty',\n self.parent.context.namespaces)):\n rpname = recprop.find(util.nspath_eval('csw30:Name',\n self.parent.context.namespaces)).text\n rpvalue = recprop.find(\n util.nspath_eval('csw30:Value',\n self.parent.context.namespaces)).text\n\n update['recordproperty'].append(\n {'name': rpname, 'value': rpvalue})\n\n update['constraint'] = self._parse_constraint(\n ttype.find(util.nspath_eval('csw30:Constraint',\n self.parent.context.namespaces)))\n\n request['transactions'].append(update)\n\n for ttype in \\\n doc.xpath('//csw30:Delete', namespaces=self.parent.context.namespaces):\n tname = ttype.attrib.get('typeName')\n constraint = self._parse_constraint(\n ttype.find(util.nspath_eval('csw30:Constraint',\n self.parent.context.namespaces)))\n\n if isinstance(constraint, str): # parse error\n return 'Invalid Constraint: %s' % constraint\n\n request['transactions'].append(\n {'type': 'delete', 'typename': tname, 'constraint': constraint})\n\n # Harvest\n if request['request'] == 'Harvest':\n request['source'] = doc.find(util.nspath_eval('csw30:Source',\n self.parent.context.namespaces)).text\n\n request['resourcetype'] = \\\n doc.find(util.nspath_eval('csw30:ResourceType',\n self.parent.context.namespaces)).text\n\n tmp = doc.find(util.nspath_eval('csw30:ResourceFormat',\n self.parent.context.namespaces))\n if tmp is not None:\n request['resourceformat'] = tmp.text\n else:\n request['resourceformat'] = 'application/xml'\n\n tmp = doc.find(util.nspath_eval('csw30:HarvestInterval',\n self.parent.context.namespaces))\n if tmp is not None:\n request['harvestinterval'] = tmp.text\n\n tmp = doc.find(util.nspath_eval('csw30:ResponseHandler',\n self.parent.context.namespaces))\n if tmp is not None:\n request['responsehandler'] = tmp.text\n return request", "metadata": "root.Csw3.parse_postdata", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1603 }, { "content": " def _write_transactionsummary(self, inserted=0, updated=0, deleted=0):\n ''' Write csw:TransactionSummary construct '''\n node = etree.Element(util.nspath_eval('csw30:TransactionSummary',\n self.parent.context.namespaces))\n\n if 'requestid' in self.parent.kvp and self.parent.kvp['requestid'] is not None:\n node.attrib['requestId'] = self.parent.kvp['requestid']\n\n etree.SubElement(node, util.nspath_eval('csw30:totalInserted',\n self.parent.context.namespaces)).text = str(inserted)\n\n etree.SubElement(node, util.nspath_eval('csw30:totalUpdated',\n self.parent.context.namespaces)).text = str(updated)\n\n etree.SubElement(node, util.nspath_eval('csw30:totalDeleted',\n self.parent.context.namespaces)).text = str(deleted)\n\n return node", "metadata": "root.Csw3._write_transactionsummary", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1916 }, { "content": " def _write_acknowledgement(self, root=True):\n ''' Generate csw:Acknowledgement '''\n node = etree.Element(util.nspath_eval('csw30:Acknowledgement',\n self.parent.context.namespaces),\n nsmap = self.parent.context.namespaces, timeStamp=util.get_today_and_now())\n\n if root:\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/csw/3.0/cswAll.xsd' % (self.parent.context.namespaces['csw30'], \\\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n node1 = etree.SubElement(node, util.nspath_eval('csw30:EchoedRequest',\n self.parent.context.namespaces))\n if self.parent.requesttype == 'POST':\n node1.append(etree.fromstring(self.parent.request, self.parent.context.parser))\n else: # GET\n node2 = etree.SubElement(node1, util.nspath_eval('ows:Get',\n self.parent.context.namespaces))\n\n node2.text = self.parent.request\n\n if self.parent.async:\n etree.SubElement(node, util.nspath_eval('csw30:RequestId',\n self.parent.context.namespaces)).text = self.parent.kvp['requestid']\n\n return node", "metadata": "root.Csw3._write_acknowledgement", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1935 }, { "content": " def _write_verboseresponse(self, insertresults):\n ''' show insert result identifiers '''\n insertresult = etree.Element(util.nspath_eval('csw30:InsertResult',\n self.parent.context.namespaces))\n for ir in insertresults:\n briefrec = etree.SubElement(insertresult,\n util.nspath_eval('csw30:BriefRecord',\n self.parent.context.namespaces))\n\n etree.SubElement(briefrec,\n util.nspath_eval('dc:identifier',\n self.parent.context.namespaces)).text = ir['identifier']\n\n etree.SubElement(briefrec,\n util.nspath_eval('dc:title',\n self.parent.context.namespaces)).text = ir['title']\n\n return insertresult", "metadata": "root.Csw3._write_verboseresponse", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1963 }, { "content": " def _write_allowed_values(self, values):\n ''' design pattern to write ows20:AllowedValues '''\n\n allowed_values = etree.Element(util.nspath_eval('ows20:AllowedValues',\n self.parent.context.namespaces))\n\n for value in sorted(values):\n etree.SubElement(allowed_values,\n util.nspath_eval('ows20:Value',\n self.parent.context.namespaces)).text = value\n return allowed_values", "metadata": "root.Csw3._write_allowed_values", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1982 }, { "content": " def exceptionreport(self, code, locator, text):\n ''' Generate ExceptionReport '''\n self.parent.exception = True\n self.parent.status = code\n\n try:\n language = self.parent.config.get('server', 'language')\n ogc_schemas_base = self.parent.config.get('server', 'ogc_schemas_base')\n except:\n language = 'en-US'\n ogc_schemas_base = self.parent.context.ogc_schemas_base\n\n node = etree.Element(util.nspath_eval('ows20:ExceptionReport',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces,\n version='3.0.0')\n\n node.attrib['{http://www.w3.org/XML/1998/namespace}lang'] = language\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/ows/2.0/owsExceptionReport.xsd' % \\\n (self.parent.context.namespaces['ows20'], ogc_schemas_base)\n\n exception = etree.SubElement(node, util.nspath_eval('ows20:Exception',\n self.parent.context.namespaces),\n exceptionCode=code, locator=locator)\n\n etree.SubElement(exception,\n util.nspath_eval('ows20:ExceptionText',\n self.parent.context.namespaces)).text = text\n\n return node", "metadata": "root.Csw3.exceptionreport", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1994 }, { "content": " def resolve_nsmap(self, list_):\n '''' Resolve typename bindings based on default and KVP namespaces '''\n\n nsmap = {}\n\n tns = []\n\n LOGGER.debug('Namespace list pairs: %s', list_)\n\n # bind KVP namespaces into typenames\n for ns in self.parent.kvp['namespace'].split(','):\n nspair = ns.split('(')[1].split(')')[0].split('=')\n if len(nspair) == 1: # default namespace\n nsmap['csw'] = nspair[1]\n else:\n nsmap[nspair[0]] = nspair[1]\n\n LOGGER.debug('Namespace pairs: %s', nsmap)\n\n for tn in list_:\n LOGGER.debug(tn)\n if tn.find(':') != -1: # resolve prefix\n prefix = tn.split(':')[0]\n if prefix in nsmap.keys(): # get uri\n uri = nsmap[prefix]\n newprefix = next(k for k, v in self.parent.context.namespaces.items() if v == uri)\n LOGGER.debug(uri)\n LOGGER.debug(prefix)\n LOGGER.debug(newprefix)\n #if prefix == 'csw30': newprefix = 'csw'\n newvalue = tn.replace(prefix, newprefix).replace('csw30', 'csw')\n else:\n newvalue = tn\n else: # default namespace\n newvalue = tn\n\n tns.append(newvalue)\n\n\n LOGGER.debug(tns)\n return tns", "metadata": "root.Csw3.resolve_nsmap", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 2027 }, { "content": "def write_boundingbox(bbox, nsmap):\n ''' Generate ows20:BoundingBox '''\n\n if bbox is not None:\n try:\n bbox2 = util.wkt2geom(bbox)\n except:\n return None\n\n if len(bbox2) == 4:\n boundingbox = etree.Element(util.nspath_eval('ows20:BoundingBox',\n nsmap), crs='http://www.opengis.net/def/crs/EPSG/0/4326',\n dimensions='2')\n\n etree.SubElement(boundingbox, util.nspath_eval('ows20:LowerCorner',\n nsmap)).text = '%s %s' % (bbox2[1], bbox2[0])\n\n etree.SubElement(boundingbox, util.nspath_eval('ows20:UpperCorner',\n nsmap)).text = '%s %s' % (bbox2[3], bbox2[2])\n\n return boundingbox\n else:\n return None\n else:\n return None\n if nextrecord == 0:\n searchresult_status = 'complete'\n elif nextrecord > 0:\n searchresult_status = 'subset'\n elif matched == 0:\n searchresult_status = 'none'", "metadata": "root.write_boundingbox", "header": "['module', '___EOS___']", "index": 2069 }, { "content": "def get_resultset_status(matched, nextrecord):\n ''' Helper function to assess status of a result set '''\n\n status = 'subset' # default\n\n if nextrecord == 0:\n status = 'complete'\n elif matched == 0:\n status = 'none'\n\n return status", "metadata": "root.get_resultset_status", "header": "['module', '___EOS___']", "index": 2101 }, { "content": "def get_elapsed_time(begin, end):\n ''' Helper function to calculate elapsed time '''\n\n return str(int((end - begin) * 1000))", "metadata": "root.get_elapsed_time", "header": "['module', '___EOS___']", "index": 2113 } ]
[ { "span": "import sys", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 10 }, { "span": "import cgi", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 10 }, { "span": "from six.moves.urllib.parse import quote, unquote", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 49 }, { "span": "from six import StringIO", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 24 }, { "span": "from six.moves.configparser import SafeConfigParser", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 51 }, { "span": "from pycsw import oaipmh, opensearch, sru", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 41 }, { "span": "from pycsw.plugins.profiles import profile as pprofile", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 54 }, { "span": "import pycsw.plugins.outputschemas", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 34 }, { "span": "from pycsw.core import config, log, metadata, util", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Tom", " ", "Kra", "lid", "is", " ", "<", "tom", "kra", "lid", "is", "@", "gma", "il", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", " ", "Tom", " ", "Kra", "lid", "is_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", "d", " ", "in", " ", "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", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "urllib_", "._", "parse_", "import_", "quote_", ",_", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "configparser_", "import_", "Safe", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "sw_", "._", "core_", "._", "etree_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "sw_", "import_", "oai", "pm", "h_", ",_", "opens", "earch_", ",_", "sr", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "sw_", "._", "plugins_", "._", "profiles_", "import_", "profile_", "as_", "ppro", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "sw_", "._", "plugins_", "._", "output", "schemas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "sw_", "._", "core_", "import_", "config_", ",_", "log_", ",_", "metadata_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "sw_", "._", "og", "c_", "._", "fes", "_", "import_", "fes", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "CS", "W", " ", "3", ".", "x", " ", "server", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server", "\\u", "cs", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Initializ", "e", " ", "CS", "W3", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "=_", "server", "\\u", "cs", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "'", "3.0", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getc", "apa", "bilit", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Capabilities", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "caps_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validat", "e", " ", "accept", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Validat", "ing", " ", "ow", "s2", "0", ":", "Accept", "Format", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Capabilities", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "accept", "Format", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "accept", "formats", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bf", "ound_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fmt_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "accept", "formats", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fmt_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Capabilities", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "accept", "Format", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "mimetype_", "=_", "fmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "ound_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bf", "ound_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accept", "formats", "'_", ",_", "'", "Inva", "lid", " ", "accept", "Format", "s", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "accept", "formats", "'_", "]_", ")_", "\\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_", "'", "section", "s", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "section", "s", "'_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "identifica", "tion_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "section", "s", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "section_", "==_", "'", "Service", "Identif", "ication", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "Service", "Provider", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "Opera", "tion", "s", "Meta", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "All", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "caps_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "caps_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "extra", " ", "parameter", "s", " ", "tha", "t", " ", "may", " ", "be", " ", "def", "'", "d", " ", "by", " ", "profiles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "check", "\\u", "parameters_", "(_", "self_", "._", "parent_", "._", "kv", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "result_", "[_", "'", "code", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "locator", "'_", "]_", ",_", "result_", "[_", "'", "text", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "update", "Sequ", "ence", ":", " ", "get", " ", "late", "st", " ", "update", " ", "to", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "sequence_", "=_", "util_", "._", "get", "\\u", "time", "\\u", "iso", "2u", "nix", "_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "insert_", "(_", ")_", ")_", "\\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 ", " _", "update", "sequence_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Capabilities", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Sequence_", "=_", "str_", "(_", "update", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "update", "sequence", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ")_", "==_", "update", "sequence_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ")_", ">_", "update", "sequence_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Update", "Sequ", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "sequence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "sequence", " ", "specified", " ", "(%", "s", ")", " ", "is", " ", "higher", " ", "than", " ", "server", "\\\\'", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "update", "sequence", " ", "(%", "s", ")'_", "%_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Capabilities", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "main_", "=_", "dict_", "(_", "self_", "._", "parent_", "._", "config_", "._", "items_", "(_", "'", "metadata", ":", "main", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "service", "identifica", "tion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Service", "Identif", "ication", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "identifica", "tion_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Identif", "ication", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Tit", "le", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "title", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Abstract", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "abstract", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Key", "words", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "keywords", "'_", ")_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Key", "word", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "keywords_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "ISO", "TC", "211", "/", "191", "15", "'_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "keywords", "\\u", "type", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "OG", "C", "'_", ")_", "._", "text_", "=_", "'", "CS", "W", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "st", "v_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "version", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Type", "Version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "st", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prof", "\\u", "name_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prof", "\\u", "val_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "namespaces_", "[_", "prof", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Profil", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "prof", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Fee", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "fees", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Access", "Constr", "aint", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "access", "constraint", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "service", "provider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Service", "Provider", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Provider", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Provider", "Name", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "provide", "r", "\\u", "name", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Provider", "Site", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "provide", "r", "\\u", "url", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "contact_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Conta", "ct", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Individual", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "name", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Position", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "position", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "info_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Conta", "ct", "Info", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phone_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Phone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "phone_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Voic", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "phone", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "phone_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Fac", "simi", "le", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "fax", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Address", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Deliver", "y", "Point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "address", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Cit", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "city", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Administrati", "ve", "Area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "state", "orp", "rov", "inc", "e", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Post", "al", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "postal", "code", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Count", "ry", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "countr", "y", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Electronic", "Mail", "Address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "email", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "On", "line", "Reso", "urc", "e", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "url", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Hour", "s", "Of", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "hour", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Conta", "ct", "Instructions", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "instruct", "ion", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Ro", "le", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "ISO", "TC", "211", "/", "191", "15", "'_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "role", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "operati", "ons", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Opera", "tion", "s", "Meta", "data", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Opera", "tion", "s", "Meta", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "operation_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "\\u", "order", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oper_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Opera", "tion", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dc", "p_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "DC", "P", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "=_", "etree_", "._", "Sub", "Element_", "(_", "dc", "p_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "HTTP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "method", "s", "'_", "]_", "[_", "'", "get", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "get_", "=_", "etree_", "._", "Sub", "Element_", "(_", "http_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "method", "s", "'_", "]_", "[_", "'", "post", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "post_", "=_", "etree_", "._", "Sub", "Element_", "(_", "http_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "parameter_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Parameter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "operation_", "==_", "'", "Get", "Record", "s", "'_", ":_", "#", " ", "advertise", " ", "query", "able", "s", ",", " ", "Max", "Record", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "qb", "l_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "qb", "l_", "not_", "in_", "[_", "'\\u", "all", "'_", ",_", "'", "Supp", "orte", "d", "Du", "blin", "Core", "Query", "able", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "qb", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "qb", "l_", "]_", ")_", ")_", "\\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_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "con_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "constraint", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "con_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "constraints_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Open", "Sear", "ch", "Descripti", "on", "Document", "'_", ":_", "[_", "'%", "s", "?", "mode", "=", "opens", "ear", "ch", "&", "service", "=", "CS", "W", "&", "version", "=", "3.0", ".0", "&", "request", "=", "Get", "Capabilities", "'_", "%_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", "Record", "Default", "'_", ":_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "'", "Max", "Record", "Default", "'_", "]_", "[_", "'", "values", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "extra", "\\u", "constraints_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "extra", "\\u", "constraints_", "[_", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "Federa", "ted", "Catalog", "ues", "'_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "'", "Federa", "ted", "Catalog", "ues", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "'", "Federa", "ted", "Catalog", "ues", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "parameter_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Parameter", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "qb", "l_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "qb", "l_", "==_", "'", "Supp", "orte", "d", "Du", "blin", "Core", "Query", "able", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "'", "Core", "Query", "able", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "qb", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "constraint_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "constraint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "constraint_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ec", "node_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "get", "\\u", "extend", "edc", "apa", "bilit", "ies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ec", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "operati", "ons", "metadata_", "._", "append_", "(_", "ec", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "languages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "ow", "s", ":", "Languages", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "langs_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Languages", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "langs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Lang", "ua", "ge", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "self_", "._", "parent_", "._", "language_", "[_", "'", "639", "\\u", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filter", "caps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "write", " ", "out", " ", "Filter", "\\u", "Capabilities", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Filter", "\\u", "Capabilities", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flt", "caps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Filter", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conforma", "nce_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Confo", "rman", "ce", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Confo", "rman", "ce", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraint_", "=_", "etree_", "._", "Sub", "Element_", "(_", "conforma", "nce_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Constr", "aint", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "constraint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s1", "1", ":", "No", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "constraint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s1", "1", ":", "Default", "Value", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "'", "TRU", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idc", "aps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Id", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idc", "ap_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Id", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "idc", "aps_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Reso", "urc", "e", "Identifie", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "idc", "ap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scala", "rca", "ps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Scala", "r", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "scala", "rca", "ps_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Logi", "cal", "Operators", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmp", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "scala", "rca", "ps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Compari", "son", "Operators", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cmp", "op_", "in_", "sorted_", "(_", "fes", "2_", "._", "MODEL_", "[_", "'", "Compari", "son", "Operators", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "cmp", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Compari", "son", "Opera", "tor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "fes", "2_", "._", "MODEL_", "[_", "'", "Compari", "son", "Operators", "'_", "]_", "[_", "cmp", "op_", "]_", "[_", "'", "opname", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spat", "ial", "caps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Geometr", "y", "Opera", "nd", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "geom", "type_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Geometr", "y", "Opera", "nd", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "geom", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Geometr", "y", "Opera", "nd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "geom", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spat", "ial", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "Operators", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "spat", "ial", "\\u", "comparison_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Spa", "tial", "Operators", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "Opera", "tor", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "spat", "ial", "\\u", "comparison_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "functions_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Function", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fno", "p_", "in_", "sorted_", "(_", "fes", "2_", "._", "MODEL_", "[_", "'", "Function", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "etree_", "._", "Sub", "Element_", "(_", "functions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Function", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "fno", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "fn_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Return", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "fes", "2_", "._", "MODEL_", "[_", "'", "Function", "s", "'_", "]_", "[_", "fno", "p_", "]_", "[_", "'", "return", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getd", "omain", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Doma", "in", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "parameter", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "reference", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parameter", "name", "'_", ",_", "'", "Missing", " ", "value", ".", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "of", " ", "value", "reference", " ", "or", " ", "parameter", "name", " ", "must", " ", "be", " ", "specified", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Get", "Doma", "in", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Doma", "in", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "parameter", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "parameter", "name", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Pars", "ing", " ", "parameter", "name", " ", "%", "s", ".'_", "%_", "pname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "value_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Doma", "in", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "cs", "w3", "0", ":", "Record", "'_", ",_", "result", "Type_", "=_", "'", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Parameter", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "operation_", ",_", "parameter_", "=_", "pname_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "operation_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "parameter_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "listo", "fval", "ues_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "List", "Of", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "listo", "fval", "ues_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "value", "reference", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "value", "reference", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Pars", "ing", " ", "value", "reference", " ", "%", "s", ".'_", "%_", "pname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pname_", "._", "find_", "(_", "'/'_", ")_", "==_", "0_", ":_", "#", " ", "it", "'", "s", " ", "an", " ", "XP", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pn", "ame", "2_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "core", " ", "query", "able", ",", " ", "map", " ", "to", " ", "internal", " ", "type", "name", " ", "model_", "\\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 ", " ", " _", "pn", "ame", "2_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "pname_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "\\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 ", " ", " _", "pn", "ame", "2_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deci", "pher", " ", "typename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dv", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "prefix_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "prefixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "pn", "ame", "2_", "._", "find_", "(_", "prefix_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dv", "type_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "\\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_", "if_", "not_", "dv", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dv", "type_", "=_", "'", "cs", "w3", "0", ":", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain", "value_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Doma", "in", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "dv", "type_", ",_", "result", "Type_", "=_", "'", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "Reference", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "pname_", "\\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 ", " ", "_", "LOGGER_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "property", " ", "%", "s", ",", " ", "type", "name", " ", "%", "s", ",", " ", "\\\\", "\\", "10", ";", " ", " ", "domain", "query", "type", " ", "%", "s", ".'_", "%_", "(_", "pn", "ame", "2_", ",_", "dv", "type_", ",_", "self_", "._", "parent_", "._", "domain", "query", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pn", "ame", "2_", ",_", "dv", "type_", ",_", "self_", "._", "parent_", "._", "domain", "query", "type_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Result", "s", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "len_", "(_", "results_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "domain", "query", "type_", "==_", "'", "range", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "range", "of", "values_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Range", "Of", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "range", "of", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Min", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "results_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "range", "of", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Max", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "results_", "[_", "0_", "]_", "[_", "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 ", " ", " _", "listo", "fval", "ues_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "List", "Of", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "result_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "0_", "]_", "is_", "not_", "None_", ")_", ":_", "#", " ", "drop", " ", "null", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "listo", "fval", "ues_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "str_", "(_", "result_", "[_", "1_", "]_", ")_", ")_", "._", "text_", "=_", "result_", "[_", "0_", "]_", "\\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_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "'", "No", " ", "results", " ", "for", " ", "property", "name", " ", "%", "s", ":", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "pn", "ame", "2_", ",_", "str_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getre", "cord", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Record", "s", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "util_", "._", "get", "\\u", "toda", "y", "\\u", "and", "\\u", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "element", "setn", "ame", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "request", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mutual", "ly", " ", "exclu", "sive", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Missing", " ", "one", " ", "of", " ", "Element", "Set", "Name", " ", "or", " ", "Element", "Name", " ", "parameter", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "setn", "ame", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mutual", "ly", " ", "exclu", "sive", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", "ly", " ", "ONE", " ", "of", " ", "Element", "Set", "Name", " ", "or", " ", "Element", "Name", " ", "parameter", "(", "s", ")", " ", "is", " ", "permit", "ted", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "setn", "ame", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "schema", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Schema", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Schema", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "schema", "'_", ",_", "'", "Inva", "lid", " ", "output", "Schema", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "format", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "HTTP", "\\u", "ACCEPT", "'_", "in_", "self_", "._", "parent_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Detect", "ed", " ", "HTTP", " ", "Accept", " ", "header", ":", " ", "%", "s", "'_", ",_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "'", "Compari", "ng", " ", "%", "s", " ", "and", " ", "%", "s", "'_", ",_", "of", "mt_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "of", "mt_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "'", "FO", "UND", " ", "OUTPU", "T", " ", "MATCH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "formats", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "HTTP", " ", "Accept", " ", "header", " ", "(%", "s", ")", " ", "and", " ", "output", "format", " ", "(%", "s", ")", " ", "must", " ", "agree", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", ")_", "\\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_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "=_", "of", "mt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "Inva", "lid", " ", "output", "Format", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Sett", "ing", " ", "content", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "contenttype", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "==_", "'", "applica", "tion", "/", "atom", "+", "xml", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "atom", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "mode_", "=_", "'", "opens", "ear", "ch", "'_", "\\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_", "(_", "(_", "'", "element", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ")_", "==_", "0_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Element", "Set", "Name", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "'", "Inva", "lid", " ", "Element", "Set", "Name", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "type", "names", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "names", "'_", ",_", "'", "Missing", " ", "type", "names", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'", "type", "names", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ")_", ":_", "#", " ", "pass", "ed", " ", "via", " ", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "parent", ".", "kv", "p", "['", "type", "names", "']", " ", "=", " ", "self", ".", "parent", ".", "kv", "p", "['", "type", "names", "']", ".", "split", "('", ",'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "=_", "[_", "'", "cs", "w", ":", "Record", "'_", "if_", "x_", "==_", "'", "Record", "'_", "else_", "x_", "for_", "x_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "namespace", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "resolv", "ing", " ", "KV", "P", " ", "namespace", " ", "bindi", "ngs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "=_", "self_", "._", "resolve", "\\u", "nsma", "p_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", "=_", "self_", "._", "resolve", "\\u", "nsma", "p_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "type", "names", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "tname", " ", "==", " ", "'", "Record", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tname", " ", "=", " ", "'", "cs", "w", ":", "Record", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "tname_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "type", "Names", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "names", "'_", ",_", "'", "Inva", "lid", " ", "type", "Names", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "tname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "element", "name", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ename_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ename_", "not_", "in_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "name", "'_", ",_", "'", "Inva", "lid", " ", "Element", "Name", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "ename_", ")_", "\\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_", "maxr", "ecor", "ds", "\\u", "cfg_", "=_", "-_", "1_", "#", " ", "not", " ", "set", " ", "in", " ", "config", " ", "server", ".", "maxr", "ecor", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "config_", "._", "has", "\\u", "option_", "(_", "'", "server", "'_", ",_", "'", "maxr", "ecor", "ds", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxr", "ecor", "ds", "\\u", "cfg_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "maxr", "ecor", "ds", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "maxr", "ecor", "ds", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "==_", "'", "unlimited", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Detect", "ed", " ", "maxr", "ecor", "ds", "=", "unlimited", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "._", "pop_", "(_", "'", "maxr", "ecor", "ds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "maxr", "ecor", "ds", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "#", " ", "not", " ", "specified", " ", "by", " ", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "maxr", "ecor", "ds", "\\u", "cfg_", ">_", "-_", "1_", ":_", "#", " ", "specified", " ", "in", " ", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "maxr", "ecor", "ds", "\\u", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "spec", " ", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "specified", " ", "by", " ", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "maxr", "ecor", "ds", "\\u", "cfg_", ">_", "-_", "1_", ":_", "#", " ", "set", " ", "in", " ", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ">_", "maxr", "ecor", "ds", "\\u", "cfg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "maxr", "ecor", "ds", "\\u", "cfg_", "\\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_", "any_", "(_", "x_", "in_", "[_", "'", "bbox", "'_", ",_", "'", "q", "'_", ",_", "'", "time", "'_", "]_", "for_", "x_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Open", "Sear", "ch", " ", "Geo", "/", "Time", " ", "parameter", "s", " ", "detect", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "=_", "'", "FILTER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "filter_", "=_", "opens", "earch_", "._", "kv", "p2", "filter", "xml_", "(_", "self_", "._", "parent_", "._", "kv", "p_", ",_", "self_", "._", "parent_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "bbox", "'_", ",_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tmp", "\\u", "filter_", "is_", "not_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "tmp", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Open", "Sear", "ch", " ", "Geo", "/", "Time", " ", "parameter", "s", " ", "to", " ", "Filter", ":", " ", "%", "s", ".'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ")_", "\\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_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "constraint", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "GET", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "cs", "w", ":", "Constr", "aint", " ", "pass", "ed", " ", "over", " ", "HTTP", " ", "GET", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "constraint", "language", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", " ", "require", "d", " ", "whe", "n", " ", "constraint", " ", "specified", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "CONSTR", "AIN", "TL", "ANG", "UA", "GE", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", "'_", ",_", "'", "Inva", "lid", " ", "constraint", "language", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "==_", "'", "CQ", "L", "\\u", "TEXT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tmp_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "type", "'_", "]_", "=_", "'", "cql", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "where", "'_", "]_", "=_", "self_", "._", "parent_", "._", "\\u", "cql", "\\u", "update", "\\u", "query", "able", "s", "\\u", "mappings_", "(_", "tmp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "values", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "==_", "'", "FILTER", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "filter", " ", "XML_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "schema_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "home", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", "'_", ",_", "'", "schema", "s", "'_", ",_", "'", "og", "c", "'_", ",_", "'", "filter", "'_", ",_", "'", "1.1", ".0", "'_", ",_", "'", "filter", ".", "xsd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Validat", "ing", " ", "Filter", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "etree_", "._", "XML", "Schema_", "(_", "file_", "=_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "etree_", "._", "XML", "Parser_", "(_", "schema_", "=_", "schema_", ",_", "resolve", "\\u", "entities_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Filter", " ", "is", " ", "valid", " ", "XML", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "type", "'_", "]_", "=_", "'", "filter", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "where", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "values", "'_", "]_", "=_", "fes", "2_", "._", "parse_", "(_", "doc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "dbt", "ype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "self_", "._", "parent_", "._", "orm_", ",_", "self_", "._", "parent_", "._", "language_", "[_", "'", "text", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "fts", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error", "text_", "=_", "'", "Except", "ion", ":", " ", "document", " ", "not", " ", "valid", ".\\\\", "n", "Error", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bbox", "'_", ",_", "'", "Inva", "lid", " ", "Filter", " ", "query", ":", " ", "%", "s", "'_", "%_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\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_", "'", "sortby", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "sortby", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Sorte", "d", " ", "query", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "=_", "{_", "}_", "\\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 ", " _", "name_", ",_", "order_", "=_", "tmp_", "._", "rsplit_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "value", ":", " ", "must", " ", "be", " ", "in", " ", "the", " ", "format", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "property", "name", ":", "A", " ", "or", " ", "property", "name", ":", "D", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "property", "name", "'_", "]_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "name_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "find_", "(_", "'", "Bound", "ing", "Box", "'_", ")_", "!=_", "-_", "1_", "or_", "name_", "._", "find_", "(_", "'", "Env", "elope", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "spat", "ial", " ", "sort_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "spat", "ial", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "property", "name", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "not_", "in_", "[_", "'", "A", "'_", ",_", "'", "D", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "value", ":", " ", "sort", " ", "order", " ", "must", " ", "be", " ", "\"", "A", "\"", " ", "or", " ", "\"", "D", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "'", "D", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "order", "'_", "]_", "=_", "'", "DESC", "'_", "\\u\\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_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "order", "'_", "]_", "=_", "'", "ASC", "'_", "\\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_", "'", "startpo", "sition", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "record", "ids", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "query", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "with", " ", "RECORD", " ", "ids", ":", " ", "%", "s", ".'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matched_", "=_", "str_", "(_", "len_", "(_", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Not", "Foun", "d", "'_", ",_", "'", "record", "ids", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "record", "s", " ", "found", " ", "for", " ", "\\\\'", "%", "s", "\\\\''_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", ")_", "\\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_", "#", " ", "query", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "with", " ", "constraint", ":", " ", "%", "s", ",\\\\", "\\", "10", ";", " ", " ", " ", " ", "sortby", ":", " ", "%", "s", ",", " ", "type", "names", ":", " ", "%", "s", ",", " ", "maxr", "ecor", "ds", ":", " ", "%", "s", ",", " ", "startpo", "sition", ":", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", ")_", "\\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 ", " _", "matched_", ",_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "constraint_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sortby", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", ",_", "type", "names_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maxr", "ecor", "ds_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "startpo", "sition", "_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "constraint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "query", ":", " ", "%", "s", "'_", "%_", "err_", ")_", "\\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_", "int_", "(_", "matched_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returned_", "=_", "next", "record_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "matched_", ")_", "<_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returned_", "=_", "matched_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "record_", "=_", "'", "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 ", " _", "returned_", "=_", "str_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ">=_", "int_", "(_", "matched_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "record_", "=_", "'", "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 ", " ", "_", "next", "record_", "=_", "str_", "(_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ")_", "\\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_", "LOGGER_", "._", "debug_", "(_", "'", "Result", "s", ":", " ", "matche", "d", ":", " ", "%", "s", ",", " ", "return", "ed", ":", " ", "%", "s", ",", " ", "next", ":", " ", "%", "s", ".'_", "%_", "(_", "matched_", ",_", "returned_", ",_", "next", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Get", "Record", "s", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Record", "s", "Respons", "e", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "request", "id", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w", ":", "Request", "Id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Sear", "ch", "Status", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "where", "'", " ", "not", " ", "in", " ", "self", ".", "parent", ".", "kv", "p", "['", "constraint", "']", " ", "and", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "parent", ".", "kv", "p", "['", "result", "type", "']", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", "ed", " ", "=", " ", "'", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "results_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Sear", "ch", "Result", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Matched", "_", "=_", "matched_", ",_", "number", "Of", "Record", "s", "Return", "ed_", "=_", "returned_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "Record_", "=_", "next", "record_", ",_", "record", "Schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expires_", "=_", "timestamp_", ",_", "status_", "=_", "get", "\\u", "results", "et", "\\u", "status_", "(_", "matched_", ",_", "next", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "results_", "._", "attrib_", "[_", "'", "element", "Set", "'_", "]_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "where", "'", " ", "not", " ", "in", " ", "self", ".", "parent", ".", "kv", "p", "['", "constraint", "']", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "self", ".", "parent", ".", "kv", "p", "['", "result", "type", "']", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "LOGGE", "R", ".", "debug", "('", "Emp", "ty", " ", "result", " ", "set", " ", "return", "ed", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "results_", ")_", "<_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "1_", "=_", "len_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "1_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "(_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Present", "ing", " ", "record", "s", " ", "%", "s", " ", "-", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ",_", "max", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "res_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w", ":", "Record", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "cs", "w", ":", "Record", " ", "inline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "res_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w", ":", "Record", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "int", "o", " ", "cs", "w", ":", "Record", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "source", " ", "typename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "typename_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "\\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_", "util_", "._", "transform", "\\u", "mappings_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "type", "names", "'_", "]_", "[_", "typename_", "]_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "cs", "w", ":", "Record", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "res_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "in_", "self_", "._", "parent_", "._", "output", "schemas_", ":_", "#", " ", "use", " ", "output", "schema", " ", "serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "self_", "._", "parent_", "._", "output", "schemas_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "res_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "self_", "._", "parent_", "._", "context_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "use", " ", "profile", " ", "serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "res_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "response_", "=_", "self_", "._", "exception", "report_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Record", " ", "serializ", "ation", " ", "fail", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "parent_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "config_", "._", "has", "\\u", "option_", "(_", "'", "server", "'_", ",_", "'", "federated", "catalogue", "s", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "distributed", "search", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "distributed", "search", "'_", "]_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "hop", "count", "'_", "]_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "distributed", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Distribut", "ed", "Sear", "ch", " ", "specified", " ", "(", "hop", "Count", ":", " ", "%", "s", ").'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "hop", "count", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ow", "sli", "b_", "._", "cs", "w_", "import_", "Catalog", "ue", "Service", "Web", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ow", "sli", "b_", "._", "ows_", "import_", "Except", "ion", "Report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fed", "cat_", "in_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "federated", "catalogue", "s", "'_", ")_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Perform", "ing", " ", "distributed", " ", "search", " ", "on", " ", "federated", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "catalogue", ":", " ", "%", "s", ".'_", "%_", "fed", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "start", "\\u", "time_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "cs", "w_", "=_", "Catalog", "ue", "Service", "Web", "_", "(_", "fed", "cat_", ",_", "skip", "\\u", "caps_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "cs", "w_", "._", "getre", "cord", "s2_", "(_", "xml_", "=_", "self_", "._", "parent_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "esn", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fs", "r_", "=_", "etree_", "._", "Sub", "Element_", "(_", "search", "results_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w3", "0", ":", "Federa", "ted", "Sear", "ch", "Result", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "catalogue", "URL_", "=_", "fed", "cat_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "'", "Distribut", "ed", " ", "search", " ", "results", " ", "from", " ", "catalogue", " ", "%", "s", ":", " ", "%", "s", ".'_", "%_", "(_", "fed", "cat_", ",_", "remote", "cs", "w_", "._", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fs", "r_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "result_", "=_", "etree_", "._", "Sub", "Element_", "(_", "fs", "r_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w3", "0", ":", "search", "Result", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "element", "Set", "Name_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Matched", "_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "matche", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Return", "ed_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "return", "ed", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "Record_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "next", "record", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ela", "pse", "d", "Time_", "=_", "get", "\\u", "ela", "pse", "d\\u", "time_", "(_", "start", "\\u", "time_", ",_", "time_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "get", "\\u", "results", "et", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fed", "cat_", "._", "results_", "[_", "'", "matche", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fed", "cat_", "._", "results_", "[_", "'", "next", "record", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "result_", "._", "append_", "(_", "remote", "cs", "w_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Except", "ion", "Report_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error", "\\u", "string_", "=_", "'", "remote", " ", "CS", "W", " ", "%", "s", " ", "return", "ed", " ", "exception", ":", " ", "'_", "%_", "fed", "cat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "%", "s", "\\\\", "n", "\\\\", "n", "%", "s", " ", "'_", "%_", "(_", "error", "\\u", "string_", ",_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error", "\\u", "string_", "=_", "'", "remote", " ", "CS", "W", " ", "%", "s", " ", "return", "ed", " ", "error", ":", " ", "'_", "%_", "fed", "cat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "%", "s", "\\\\", "n", "\\\\", "n", "%", "s", " ", "'_", "%_", "(_", "error", "\\u", "string_", ",_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "len", "(", "dsr", "esult", "s", ")", " ", ">", " ", "0", ":", " ", " ", "#", " ", "return", " ", "Distribut", "ed", "Sear", "ch", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "results", "et", " ", "in", " ", "dsr", "esult", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "isin", "stance", "(", "results", "et", ",", " ", "etree", ".\\u", "Comme", "nt", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "search", "results", ".", "append", "(", "results", "et", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "rec", " ", "in", " ", "results", "et", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "search", "results", ".", "append", "(", "etree", ".", "froms", "tring", "(", "results", "et", "[", "rec", "].", "xml", ",", " ", "self", ".", "parent", ".", "context", ".", "parser", "))", "_", "\\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_", "search", "results_", "._", "attrib_", "[_", "'", "ela", "pse", "d", "Time", "'_", "]_", "=_", "get", "\\u", "ela", "pse", "d\\u", "time_", "(_", "self_", "._", "parent_", "._", "process", "\\u", "time", "\\u", "start_", ",_", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "response", "handler", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "#", " ", "process", " ", "the", " ", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "process", "\\u", "response", "handler_", "(_", "etree_", "._", "tostring_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pretty", "\\u", "print_", "=_", "self_", "._", "parent_", "._", "pretty", "\\u", "print_", ")_", ")_", "\\u\\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_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "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_", "getre", "cord", "by", "id_", "(_", "self_", ",_", "raw_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Record", "By", "Id", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "id", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Missing", " ", "id", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "id", "'_", "]_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "id", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "schema", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "HTTP", "\\u", "ACCEPT", "'_", "in_", "self_", "._", "parent_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Detect", "ed", " ", "HTTP", " ", "Accept", " ", "header", ":", " ", "%", "s", "'_", ",_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "'", "Compari", "ng", " ", "%", "s", " ", "and", " ", "%", "s", "'_", ",_", "of", "mt_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "of", "mt_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "'", "FO", "UND", " ", "OUTPU", "T", " ", "MATCH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "formats", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "HTTP", " ", "Accept", " ", "header", " ", "(%", "s", ")", " ", "and", " ", "output", "format", " ", "(%", "s", ")", " ", "must", " ", "agree", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", ")_", "\\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_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "=_", "of", "mt_", "\\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_", "if_", "(_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "By", "Id", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "Inva", "lid", " ", "output", "format", " ", "parameter", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'", "output", "schema", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "By", "Id", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "output", "Schema", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "schema", "'_", ",_", "'", "Inva", "lid", " ", "output", "schema", " ", "parameter", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "contenttype", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "==_", "'", "applica", "tion", "/", "atom", "+", "xml", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "atom", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "mode_", "=_", "'", "opens", "ear", "ch", "'_", "\\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_", "'", "element", "setn", "ame", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "By", "Id", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Element", "Set", "Name", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "'", "Inva", "lid", " ", "element", "setn", "ame", " ", "parameter", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "query", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "with", " ", "ids", ":", " ", "%", "s", ".'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "id", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "raw_", ":_", "#", " ", "Get", "Repos", "itor", "y", "Item", " ", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Get", "Repos", "itor", "y", "Item", " ", "request", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "etree_", "._", "fromstring_", "(_", "util_", "._", "get", "qa", "ttr", "_", "(_", "results_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "XML", "'_", "]_", ")_", ",_", "self_", "._", "parent_", "._", "context_", "._", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "util_", "._", "get", "qa", "ttr", "_", "(_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Type", "name", "'_", "]_", ")_", "==_", "'", "cs", "w", ":", "Record", "'_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "record", " ", "inline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "int", "o", " ", "cs", "w", ":", "Record", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", ":_", "#", " ", "find", " ", "source", " ", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "in_", "[_", "util_", "._", "get", "qa", "ttr", "_", "(_", "result_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Type", "name", "'_", "]_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "typename_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typename_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "util_", "._", "transform", "\\u", "mappings_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "type", "names", "'_", "]_", "[_", "typename_", "]_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "cs", "w", ":", "Record", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "result_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "in_", "self_", "._", "parent_", "._", "output", "schemas_", ":_", "#", " ", "use", " ", "output", "schema", " ", "serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "parent_", "._", "output", "schemas_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "result_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "self_", "._", "parent_", "._", "context_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "profile", " ", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\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_", "raw_", "and_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Not", "Foun", "d", "'_", ",_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "repos", "itor", "y", " ", "item", " ", "found", " ", "for", " ", "\\\\'", "%", "s", "\\\\''_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getre", "posit", "ory", "item_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Repos", "itor", "y", "Item", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "similar", " ", "to", " ", "Get", "Record", "By", "Id", " ", "with", "out", " ", "cs", "w", ":*", " ", "wrapp", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "self_", "._", "parent_", "._", "getre", "cord", "by", "id_", "(_", "raw_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Not", "Foun", "d", "'_", ",_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "repos", "itor", "y", " ", "item", " ", "found", " ", "for", " ", "\\\\'", "%", "s", "\\\\''_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "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_", "transaction_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Transa", "ction", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "test\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "transaction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inserted", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Transa", "ction", " ", "list", ":", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "transaction", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ttype_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "transaction", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ttype_", "[_", "'", "type", "'_", "]_", "==_", "'", "insert", "'_", ":_", "\\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 ", " ", "_", "record_", "=_", "metadata_", "._", "parse", "\\u", "record_", "(_", "self_", "._", "parent_", "._", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "[_", "'", "xml", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "insert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "(", "insert", ")", " ", "fail", "ed", ":", " ", "record", " ", "pars", "ing", " ", "fail", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Transa", "ction", " ", "operati", "on", ":", " ", "%", "s", "'_", "%_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Identifie", "r", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insert", "'_", ",_", "'", "Record", " ", "require", "s", " ", "an", " ", "identifi", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "new", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "repository_", "._", "insert_", "(_", "record_", ",_", "'", "local", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "get", "\\u", "toda", "y", "\\u", "and", "\\u", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inserted", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "results_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "identifi", "er", "'_", ":_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Identifie", "r", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Tit", "le", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insert", "'_", ",_", "'", "Transa", "ction", " ", "(", "insert", ")", " ", "fail", "ed", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\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_", "ttype_", "[_", "'", "type", "'_", "]_", "==_", "'", "update", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "constraint", "'_", "not_", "in_", "ttype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "full", " ", "exist", "ing", " ", "resource", " ", "in", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "=_", "metadata_", "._", "parse", "\\u", "record_", "(_", "self_", "._", "parent_", "._", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "[_", "'", "xml", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identifier_", "=_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Identifie", "r", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "insert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "(", "update", ")", " ", "fail", "ed", ":", " ", "record", " ", "pars", "ing", " ", "fail", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "query", " ", "repos", "itor", "y", " ", "to", " ", "see", " ", "if", " ", "record", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "checking", " ", "if", " ", "record", " ", "exist", "s", " ", "(%", "s", ")'_", "%_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "ids_", "=_", "[_", "identifier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "'", "id", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "repos", "itor", "y", "'_", "%_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "exist", "ing", " ", "record", ",", " ", "it", "'", "s", " ", "an", " ", "update_", "\\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_", "._", "parent_", "._", "repository_", "._", "update_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "(", "update", ")", " ", "fail", "ed", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\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_", ":_", "#", " ", "update", " ", "by", " ", "record", " ", "property", " ", "and", " ", "constraint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "/", " ", "set", " ", "XP", "ath", " ", "for", " ", "property", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "rp_", "in_", "ttype_", "[_", "'", "record", "property", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "rp_", "[_", "'", "name", "'_", "]_", "not_", "in_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", " ", "it", " ", "an", " ", "XP", "ath", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "rp_", "[_", "'", "name", "'_", "]_", "._", "find_", "(_", "'/'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "output", "schema", "s", ";", " ", "if", " ", "match", ",", " ", "bind_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "osc", "h_", "in_", "self_", "._", "parent_", "._", "output", "schemas_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "key_", ",_", "value_", "in_", "osc", "h_", "._", "XP", "ATH", "\\u", "MAPPING", "S_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "if_", "value_", "==_", "rp_", "[_", "'", "name", "'_", "]_", ":_", "#", " ", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "rp_", "[_", "'", "rp", "'_", "]_", "=_", "{_", "'", "xpa", "th", "'_", ":_", "value_", ",_", "'", "name", "'_", ":_", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rp_", "[_", "'", "rp", "'_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "'_", ",_", "'", "Transa", "ction", " ", "(", "update", ")", " ", "fail", "ed", ":", " ", "invalid", " ", "property", "2", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "rp_", "[_", "'", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rp_", "[_", "'", "rp", "'_", "]_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "rp_", "[_", "'", "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_", "LOGGER_", "._", "debug_", "(_", "'", "Record", " ", "Proper", "ties", ":", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "[_", "'", "record", "property", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "updated_", "+=_", "self_", "._", "parent_", "._", "repository_", "._", "update_", "(_", "record_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "props_", "=_", "ttype_", "[_", "'", "record", "property", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constraint_", "=_", "ttype_", "[_", "'", "constraint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "(", "update", ")", " ", "fail", "ed", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\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_", "elif_", "ttype_", "[_", "'", "type", "'_", "]_", "==_", "'", "delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deleted_", "+=_", "self_", "._", "parent_", "._", "repository_", "._", "delete_", "(_", "ttype_", "[_", "'", "constraint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Transa", "ction", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Transa", "ction", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "transaction", "summary_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inserted", "_", "=_", "inserted", "_", ",_", "updated_", "=_", "updated_", ",_", "deleted_", "=_", "deleted_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "len_", "(_", "insert", "results_", ")_", ">_", "0_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "verbo", "ser", "esp", "ons", "e", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "show", " ", "insert", " ", "result", " ", "identifiers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "verbo", "ser", "esp", "ons", "e_", "(_", "insert", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "harvest", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Harvest", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "identifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "identifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "test\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "harvest", "'_", ",_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "resource", "type", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "type", "'_", ",_", "'", "Missing", " ", "resource", "type", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "source", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ",_", "'", "Missing", " ", "source", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validat", "e", " ", "resource", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Harvest", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "Reso", "urc", "e", "Type", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "type", "'_", ",_", "'", "Inva", "lid", " ", "resource", " ", "type", " ", "parameter", ":", " ", "%", "s", ".\\\\", "\\", "10", ";", " ", " ", " ", " ", "All", "owa", "ble", " ", "resource", "type", " ", "values", ":", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "','_", "._", "join_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Harvest", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Reso", "urc", "e", "Type", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", "._", "find_", "(_", "'", "opengis", ".", "net", "'_", ")_", "==_", "-_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", "._", "find_", "(_", "'", "urn", ":", "geos", "s", ":", "waf", "'_", ")_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fetch", " ", "content", "-", "based", " ", "resource_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Fe", "tch", "ing", " ", "resource", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "util_", "._", "http", "\\u", "request_", "(_", "'", "GET", "'_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "text_", "=_", "'", "Error", " ", "fetch", "ing", " ", "resource", " ", "%", "s", ".\\\\", "n", "Error", ":", " ", "%", "s", ".'_", "%_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "source", "'_", "]_", ",_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "source", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "service", " ", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "query", " ", "repos", "itor", "y", " ", "to", " ", "see", " ", "if", " ", "service", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "checking", " ", "if", " ", "service", " ", "exist", "s", " ", "(%", "s", ")'_", "%_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "source_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "0_", ":_", "#", " ", "exist", "s", ",", " ", "keep", " ", "identifi", "er", " ", "for", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Service", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "keep", "ing", " ", "identifi", "er", " ", "and", " ", "results", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "identifier_", "=_", "results_", "[_", "0_", "]_", "._", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "results_", "=_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Identifie", "r", " ", "is", " ", "%", "s", "'_", "%_", "service", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "self", ".", "exception", "report", "('", "No", "Applica", "ble", "Code", "',", " ", "'", "source", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "Insert", " ", "fail", "ed", ":", " ", "service", " ", "%", "s", " ", "alr", "ead", "y", " ", "in", " ", "repos", "itor", "y", "'", " ", "%", " ", "content", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "resource", " ", "int", "o", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "s", "\\u", "parsed_", "=_", "metadata_", "._", "parse", "\\u", "record_", "(_", "self_", "._", "parent_", "._", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", ",_", "self_", "._", "parent_", "._", "repository_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pagesize", "_", "=_", "self_", "._", "parent_", "._", "cs", "w", "\\u", "harvest", "\\u", "pagesize", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "exception_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "source", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Harvest", " ", "fail", "ed", ":", " ", "record", " ", "pars", "ing", " ", "fail", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inserted", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ir_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Total", " ", "Record", "s", " ", "parsed", ":", " ", "%", "d", "'_", "%_", "len_", "(_", "record", "s", "\\u", "parsed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "record", "s", "\\u", "parsed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "resource", "type", "'_", "]_", "==_", "'", "urn", ":", "geos", "s", ":", "waf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "record_", "._", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "record_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Sou", "rce", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setattr_", "(_", "record_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Insert", "Date", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "get", "\\u", "toda", "y", "\\u", "and", "\\u", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identifier_", "=_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Identifie", "r", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Sou", "rce", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "\\u", "date_", "=_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Insert", "Date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "getattr_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Tit", "le", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "record_", "._", "type_", "==_", "'", "service", "'_", "and_", "service", "\\u", "identifier_", "is_", "not_", "None_", ":_", "#", " ", "service", " ", "endpoint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Repl", "acing", " ", "service", " ", "identifi", "er", " ", "from", " ", "%", "s", " ", "to", " ", "%", "s", "'_", "%_", "(_", "record_", "._", "identifier_", ",_", "service", "\\u", "identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "identifier_", "=_", "record_", "._", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identifier_", "=_", "record_", "._", "identifier_", "=_", "service", "\\u", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "record_", "._", "type_", "!=_", "'", "service", "'_", "and_", "service", "\\u", "identifier_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "old", "\\u", "identifier_", "is_", "not_", "None_", ")_", ":_", "#", " ", "service", " ", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "record_", "._", "identifier_", "._", "find_", "(_", "old", "\\u", "identifier_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "identifier_", "=_", "record_", "._", "identifier_", "._", "replace_", "(_", "old", "\\u", "identifier_", ",_", "service", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Repl", "acing", " ", "service", " ", "resource", " ", "identifi", "er", " ", "from", " ", "%", "s", " ", "to", " ", "%", "s", "'_", "%_", "(_", "record_", "._", "identifier_", ",_", "new", "\\u", "identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identifier_", "=_", "record_", "._", "identifier_", "=_", "new", "\\u", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ir_", "._", "append_", "(_", "{_", "'", "identifi", "er", "'_", ":_", "identifier_", ",_", "'", "title", "'_", ":_", "title_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "query", " ", "repos", "itor", "y", " ", "to", " ", "see", " ", "if", " ", "record", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "checking", " ", "if", " ", "record", " ", "exist", "s", " ", "(%", "s", ")'_", "%_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "ids_", "=_", "[_", "identifier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "#", " ", "check", " ", "for", " ", "service", " ", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "checking", " ", "if", " ", "service", " ", "id", " ", "exist", "s", " ", "(%", "s", ")'_", "%_", "service", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "ids_", "=_", "[_", "service", "\\u", "identifier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "#", " ", "new", " ", "record", ",", " ", "it", "'", "s", " ", "a", " ", "new", " ", "insert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inserted", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "repository_", "._", "insert_", "(_", "record_", ",_", "source_", ",_", "insert", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ",_", "'", "Harvest", " ", "(", "insert", ")", " ", "fail", "ed", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "exist", "ing", " ", "record", ",", " ", "it", "'", "s", " ", "an", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "source_", "!=_", "results_", "[_", "0_", "]_", "._", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "same", " ", "identifi", "er", ",", " ", "but", " ", "different", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ",_", "'", "Insert", " ", "fail", "ed", ":", " ", "identifi", "er", " ", "%", "s", " ", "in", " ", "repos", "itor", "y", "\\\\", "\\", "10", ";", " ", " ", "has", " ", "source", " ", "%", "s", ".'_", "%_", "(_", "identifier_", ",_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "repository_", "._", "update_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ",_", "'", "Harvest", " ", "(", "update", ")", " ", "fail", "ed", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "updated_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Harvest", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Harvest", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node2_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Transa", "ction", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "service", "\\u", "identifier_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fresh", "\\u", "records_", "=_", "[_", "str_", "(_", "i_", "[_", "'", "identifi", "er", "'_", "]_", ")_", "for_", "i_", "in_", "ir_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "records_", "=_", "[_", "str_", "(_", "i_", "._", "identifier_", ")_", "for_", "i_", "in_", "service", "\\u", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "set_", "(_", "exist", "ing", "\\u", "records_", ")_", "-_", "set_", "(_", "fresh", "\\u", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Record", "s", " ", "to", " ", "delete", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "deleted_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "to", "\\u", "delete_", "in_", "deleted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "constraint_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "filter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ":_", "[_", "to", "\\u", "delete_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "where", "'_", ":_", "'", "identifi", "er", " ", "=", " ", ":", "pvalue", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "delete_", "(_", "delete", "\\u", "constraint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node2_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "transaction", "summary_", "(_", "inserted", "_", "=_", "inserted", "_", ",_", "updated_", "=_", "updated_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "len_", "(_", "deleted_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "inserted", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "show", " ", "insert", " ", "result", " ", "identifiers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node2_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "verbo", "ser", "esp", "ons", "e_", "(_", "ir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "response", "handler", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "#", " ", "process", " ", "the", " ", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "process", "\\u", "response", "handler_", "(_", "etree_", "._", "tostring_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pretty", "\\u", "print_", "=_", "self_", "._", "parent_", "._", "pretty", "\\u", "print_", ")_", ")_", "\\u\\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_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "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", "write", "\\u", "record_", "(_", "self_", ",_", "reco", "bj_", ",_", "query", "ables_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "cs", "w3", "0", ":", "Record", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "==_", "'", "brief", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "name_", "=_", "'", "Brie", "f", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "==_", "'", "summar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "name_", "=_", "'", "Summ", "ary", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "name_", "=_", "'", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "%", "s", "'_", "%_", "el", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "req", "\\u", "term_", "in_", "[_", "'", "dc", ":", "identifi", "er", "'_", ",_", "'", "dc", ":", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "req", "\\u", "term_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "req", "\\u", "term_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "req", "\\u", "term_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem", "name_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "elem", "name_", "._", "find_", "(_", "'", "Bound", "ing", "Box", "'_", ")_", "!=_", "-_", "1_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "elem", "name_", "._", "find_", "(_", "'", "Env", "elope", "'_", ")_", "!=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bbox", "el_", "=_", "write", "\\u", "bound", "ing", "box_", "(_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Bound", "ing", "Box", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bbox", "el_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "._", "append_", "(_", "bbox", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "elem", "name_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elem_", "=_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "elem", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "elem_", "._", "text_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "element", "setn", "ame", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "==_", "'", "full", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Type", "name", "'_", "]_", ")_", "==_", "'", "cs", "w", ":", "Record", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Schema", "'_", "]_", ")_", "==_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Type", "'_", "]_", ")_", "!=_", "'", "service", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dump", " ", "record", " ", "as", " ", "is", " ", "and", " ", "exit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "etree_", "._", "fromstring_", "(_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "XML", "'_", "]_", ")_", ",_", "self_", "._", "parent_", "._", "context_", "._", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dc", ":", "identifi", "er", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Identifie", "r", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "[_", "'", "dc", ":", "title", "'_", ",_", "'", "dc", ":", "type", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "i_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "in_", "[_", "'", "summar", "y", "'_", ",_", "'", "full", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "summar", "y", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keywords_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "'", "dc", ":", "subject", "'_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keywords_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "keyword_", "in_", "keywords_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dc", ":", "subject", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "'", "dc", ":", "format", "'_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dc", ":", "format", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "links_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rli", "nks", "_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Link", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rli", "nks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "links_", "=_", "rli", "nks", "_", "._", "split_", "(_", "'", "^", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "link_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "link", "set_", "=_", "link_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dct", ":", "reference", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "link", "set_", "[_", "2_", "]_", ")_", "._", "text_", "=_", "link", "set_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "[_", "'", "dc", ":", "relation", "'_", ",_", "'", "dct", ":", "modifi", "ed", "'_", ",_", "'", "dct", ":", "abstract", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "i_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "i_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "==_", "'", "full", "'_", ":_", "#", " ", "add", " ", "full", " ", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "[_", "'", "dc", ":", "date", "'_", ",_", "'", "dc", ":", "creat", "or", "'_", ",_", "'", "dc", ":", "publi", "sher", "'_", ",_", "'", "dc", ":", "contributor", "'_", ",_", "'", "dc", ":", "source", "'_", ",_", "'", "dc", ":", "language", "'_", ",_", "'", "dc", ":", "rights", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "reco", "bj_", ",_", "query", "ables_", "[_", "i_", "]_", "[_", "'", "dbco", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "i_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "write", " ", "out", " ", "ow", "s", ":", "Bound", "ing", "Box_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bbox", "el_", "=_", "write", "\\u", "bound", "ing", "box_", "(_", "getattr_", "(_", "reco", "bj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Bound", "ing", "Box", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bbox", "el_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record_", "._", "append_", "(_", "bbox", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "!=_", "'", "brief", "'_", ":_", "#", " ", "add", " ", "tempora", "l", " ", "extent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "begin_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "record_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Temp", "Extent", "\\u", "begin", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "util_", "._", "get", "qa", "ttr", "_", "(_", "record_", ",_", "self_", "._", "parent_", "._", "context_", "._", "md", "\\u", "core", "\\u", "model_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "pyc", "sw", ":", "Temp", "Extent", "\\u", "end", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "begin_", "or_", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tempe", "xt_", "=_", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Tempora", "l", "Extent", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "begin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "begin", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "begin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "record_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "end", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "end_", "\\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_", "return_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "constraint_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pars", "e", " ", "cs", "w", ":", "Constr", "aint", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "element_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Filter", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Filter", " ", "constraint", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "[_", "'", "type", "'_", "]_", "=_", "'", "filter", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "where", "'_", "]_", ",_", "query_", "[_", "'", "values", "'_", "]_", "=_", "fes", "2_", "._", "parse_", "(_", "tmp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "dbt", "ype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "self_", "._", "parent_", "._", "orm_", ",_", "self_", "._", "parent_", "._", "language_", "[_", "'", "text", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "fts", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Inva", "lid", " ", "Filter", " ", "request", ":", " ", "%", "s", "'_", "%_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "element_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Cq", "l", "Text", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "CQ", "L", " ", "specified", ":", " ", "%", "s", ".'_", "%_", "tmp_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "type", "'_", "]_", "=_", "'", "cql", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "where", "'_", "]_", "=_", "self_", "._", "parent_", "._", "\\u", "cql", "\\u", "update", "\\u", "query", "able", "s", "\\u", "mappings_", "(_", "tmp_", "._", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "values", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "postdata_", "(_", "self_", ",_", "postdata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pars", "e", " ", "POST", " ", "XML", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Pars", "ing", " ", "%", "s", ".'_", "%_", "postdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "postdata_", ",_", "self_", "._", "parent_", "._", "context_", "._", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "text_", "=_", "'", "Except", "ion", ":", " ", "document", " ", "not", " ", "well", "-", "formed", ".\\\\", "n", "Error", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "error", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "this", " ", "is", " ", "a", " ", "SOA", "P", " ", "request", ",", " ", "get", " ", "to", " ", "SOA", "P", "-", "ENV", ":", "Bod", "y", "/", "cs", "w", ":*", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "doc_", "._", "tag_", "==_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "soap", "env", ":", "Env", "elope", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "SOA", "P", " ", "request", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "soap", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "doc_", "._", "find_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "soap", "env", ":", "Bod", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "xpath_", "(_", "'", "child", "::", "*'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xsd", "\\u", "filename_", "=_", "'", "cs", "w", "%", "s", ".", "xsd", "'_", "%_", "util_", "._", "xmlt", "ag", "\\u", "split_", "(_", "doc_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "home", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", "'_", ",_", "'", "schema", "s", "'_", ",_", "'", "og", "c", "'_", ",_", "'", "cs", "w", "'_", ",_", "'", "3.0", "'_", ",_", "xsd", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "is", " ", "virtual", "ly", " ", "impossible", " ", "to", " ", "validat", "e", " ", "a", " ", "cs", "w", ":", "Transaction_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cs", "w", ":", "Insert", "|", "cs", "w", ":", "Update", " ", "(", "with", " ", "single", " ", "child", ")", " ", "XML", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "validat", "e", " ", "non", " ", "cs", "w", ":", "Transa", "ction", " ", "XML_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "doc_", "._", "find_", "(_", "'./", "/", "%", "s", "'_", "%_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Insert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "is_", "None_", "and_", "len_", "(_", "doc_", "._", "xpath_", "(_", "'//", "cs", "w3", "0", ":", "Update", "/", "child", "::", "*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespaces_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Validat", "ing", " ", "%", "s", ".'_", "%_", "postdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "etree_", "._", "XML", "Schema_", "(_", "file_", "=_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "etree_", "._", "XML", "Parser_", "(_", "schema_", "=_", "schema_", ",_", "resolve", "\\u", "entities_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "parent_", ",_", "'", "soap", "'_", ")_", "and_", "self_", "._", "parent_", "._", "soap", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "the", " ", "body", " ", "of", " ", "the", " ", "SOA", "P", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "etree_", "._", "tostring_", "(_", "doc_", ")_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "validat", "e", " ", "the", " ", "request", " ", "normal", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "postdata_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Request", " ", "is", " ", "valid", " ", "XML", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "parse", " ", "Transa", "ction", " ", "with", "out", " ", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "postdata_", ",_", "self_", "._", "parent_", "._", "context_", "._", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "text_", "=_", "'", "Except", "ion", ":", " ", "the", " ", "document", " ", "is", " ", "not", " ", "valid", ".\\\\", "n", "Error", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "error", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "request", "'_", "]_", "=_", "util_", "._", "xmlt", "ag", "\\u", "split_", "(_", "doc_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Request", " ", "operati", "on", " ", "%", "s", " ", "specified", ".'_", "%_", "request_", "[_", "'", "request", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "service", "'_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "version", "'_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'./", "/", "%", "s", "'_", "%_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "version", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "update", "Sequ", "ence", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "update", "sequence", "'_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "Capabilities", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Get", "Capabilities", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Sections", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "section", "s", "'_", "]_", "=_", "','_", "._", "join_", "(_", "[_", "section_", "._", "text_", "for_", "section_", "in_", "doc_", "._", "findall_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Sections", "/", "ow", "s2", "0", ":", "Sect", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Accept", "Format", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "accept", "formats", "'_", "]_", "=_", "','_", "._", "join_", "(_", "[_", "af", "ormat_", "._", "text_", "for_", "af", "ormat_", "in_", "doc_", "._", "findall_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Accept", "Format", "s", "/", "ow", "s2", "0", ":", "Output", "Format", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Accept", "Version", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "accept", "version", "s", "'_", "]_", "=_", "','_", "._", "join_", "(_", "[_", "version_", "._", "text_", "for_", "version_", "in_", "doc_", "._", "findall_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Accept", "Version", "s", "/", "ow", "s2", "0", ":", "Version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "Domain_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Get", "Doma", "in", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Parameter", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "parameter", "name", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "Reference", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "value", "reference", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "Records_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Get", "Record", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "output", "Schema", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "output", "schema", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "output", "Format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "output", "format", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "start", "Position", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "startpo", "sition", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "request", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "request", "id", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "max", "Record", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Distribut", "ed", "Sear", "ch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "distributed", "search", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop", "count_", "=_", "tmp_", "._", "attrib_", "._", "get_", "(_", "'", "hop", "Count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "hop", "count", "'_", "]_", "=_", "int_", "(_", "hop", "count_", ")_", "-_", "1_", "if_", "hop", "count_", "is_", "not_", "None_", "else_", "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 ", " _", "request_", "[_", "'", "distributed", "search", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Respons", "e", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "response", "handler", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Query", "/", "cs", "w3", "0", ":", "Element", "Set", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "tmp_", "._", "text_", "if_", "tmp_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w3", "0", ":", "Query", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "type", "Names", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "type", "names", "'_", "]_", "=_", "tmp_", "._", "split_", "(_", ")_", "if_", "tmp_", "is_", "not_", "None_", "else_", "'", "cs", "w", ":", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "element", "name", "'_", "]_", "=_", "[_", "el", "name_", "._", "text_", "for_", "el", "name_", "in_", "doc_", "._", "findall_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Query", "/", "cs", "w3", "0", ":", "Element", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Query", "/", "cs", "w3", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "constraint", "'_", "]_", "=_", "self_", "._", "\\u", "parse", "\\u", "constraint_", "(_", "tmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "request_", "[_", "'", "constraint", "'_", "]_", ",_", "str_", ")_", ":_", "#", " ", "parse", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'", "Inva", "lid", " ", "Constr", "aint", ":", " ", "%", "s", "'_", "%_", "request_", "[_", "'", "constraint", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "No", " ", "cs", "w3", "0", ":", "Constr", "aint", " ", "(", "fes", "20", ":", "Filter", " ", "or", " ", "cs", "w3", "0", ":", "Cq", "l", "Text", ")", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Query", "/", "fes", "20", ":", "Sort", "By", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Sorte", "d", " ", "query", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "sortby", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "el", "name_", "=_", "tmp_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fes", "20", ":", "Sort", "Proper", "ty", "/", "fes", "20", ":", "Value", "Reference", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "property", "name", "'_", "]_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "el", "name_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "el", "name_", "._", "find_", "(_", "'", "Bound", "ing", "Box", "'_", ")_", "!=_", "-_", "1_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "el", "name_", "._", "find_", "(_", "'", "Env", "elope", "'_", ")_", "!=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "spat", "ial", " ", "sort_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "request_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "spat", "ial", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error", "text_", "=_", "'", "Inva", "lid", " ", "fes", "20", ":", "Sort", "Proper", "ty", "/", "fes", "20", ":", "Value", "Reference", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "error", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp2_", "=_", "tmp_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fes", "20", ":", "Sort", "Proper", "ty", "/", "fes", "20", ":", "Sort", "Order", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "order", "'_", "]_", "=_", "tmp2_", "._", "text_", "if_", "tmp2_", "is_", "not_", "None_", "else_", "'", "ASC", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "sortby", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "Record", "By", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Get", "Record", "By", "Id", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "id", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Id", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "id", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Element", "Set", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "tmp_", "._", "text_", "if_", "tmp_", "is_", "not_", "None_", "else_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "output", "Schema", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "output", "schema", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "output", "Format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "output", "format", "'_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Transa", "ction", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "verbo", "ser", "esp", "ons", "e", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "verbo", "se", "Respons", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tmp_", "in_", "[_", "'", "fal", "se", "'_", ",_", "'", "0", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "request_", "[_", "'", "verbo", "ser", "esp", "ons", "e", "'_", "]_", "=_", "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_", "tmp_", "=_", "doc_", "._", "find_", "(_", "'.'_", ")_", "._", "attrib_", "._", "get_", "(_", "'", "request", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "request", "id", "'_", "]_", "=_", "tmp_", "if_", "tmp_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "transaction", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ttype_", "in_", "doc_", "._", "xpath_", "(_", "'//", "cs", "w3", "0", ":", "Insert", "'_", ",_", "namespaces_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tname_", "=_", "ttype_", "._", "attrib_", "._", "get_", "(_", "'", "type", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "md", "rec_", "in_", "ttype_", "._", "xpath_", "(_", "'", "child", "::", "*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "xml_", "=_", "md", "rec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "[_", "'", "transaction", "s", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "type", "'_", ":_", "'", "insert", "'_", ",_", "'", "type", "name", "'_", ":_", "tname_", ",_", "'", "xml", "'_", ":_", "xml_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ttype_", "in_", "doc_", "._", "xpath_", "(_", "'//", "cs", "w3", "0", ":", "Update", "'_", ",_", "namespaces_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "ttype_", "._", "xpath_", "(_", "'", "child", "::", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update_", "=_", "{_", "'", "type", "'_", ":_", "'", "update", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "child_", ")_", "==_", "1_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "whole", "sal", "e", " ", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "update_", "[_", "'", "xml", "'_", "]_", "=_", "child_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "Record", "Proper", "ty", " ", "with", " ", "Constr", "aint", " ", "Update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "update_", "[_", "'", "record", "property", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rec", "prop_", "in_", "ttype_", "._", "findall_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w", ":", "Record", "Proper", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rpn", "ame_", "=_", "rec", "prop_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rp", "value_", "=_", "rec", "prop_", "._", "find_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update_", "[_", "'", "record", "property", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "rpn", "ame_", ",_", "'", "value", "'_", ":_", "rp", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update_", "[_", "'", "constraint", "'_", "]_", "=_", "self_", "._", "\\u", "parse", "\\u", "constraint_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "transaction", "s", "'_", "]_", "._", "append_", "(_", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ttype_", "in_", "doc_", "._", "xpath_", "(_", "'//", "cs", "w3", "0", ":", "Delete", "'_", ",_", "namespaces_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tname_", "=_", "ttype_", "._", "attrib_", "._", "get_", "(_", "'", "type", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraint_", "=_", "self_", "._", "\\u", "parse", "\\u", "constraint_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "constraint_", ",_", "str_", ")_", ":_", "#", " ", "parse", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'", "Inva", "lid", " ", "Constr", "aint", ":", " ", "%", "s", "'_", "%_", "constraint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "[_", "'", "transaction", "s", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "type", "'_", ":_", "'", "delete", "'_", ",_", "'", "type", "name", "'_", ":_", "tname_", ",_", "'", "constraint", "'_", ":_", "constraint_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Harvest", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "[_", "'", "request", "'_", "]_", "==_", "'", "Harvest", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "source", "'_", "]_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Sou", "rce", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "resource", "type", "'_", "]_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Reso", "urc", "e", "Type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Reso", "urc", "e", "Format", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "resource", "format", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "resource", "format", "'_", "]_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Harvest", "Interv", "al", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "harvest", "interval", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "doc_", "._", "find_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Respons", "e", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "[_", "'", "response", "handler", "'_", "]_", "=_", "tmp_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "transaction", "summary_", "(_", "self_", ",_", "inserted", "_", "=_", "0_", ",_", "updated_", "=_", "0_", ",_", "deleted_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Write", " ", "cs", "w", ":", "Transa", "ction", "Summ", "ary", " ", "construct", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Transa", "ction", "Summ", "ary", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "request", "id", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "attrib_", "[_", "'", "request", "Id", "'_", "]_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "total", "Insert", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "str_", "(_", "inserted", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "total", "Update", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "str_", "(_", "updated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "total", "Delete", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "str_", "(_", "deleted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "acknowledge", "ment_", "(_", "self_", ",_", "root_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "cs", "w", ":", "Ack", "nowl", "edge", "ment", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Ack", "nowl", "edge", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "time", "Stamp_", "=_", "util_", "._", "get", "\\u", "toda", "y", "\\u", "and", "\\u", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "All", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node1_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Ech", "oe", "d", "Request", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node1_", "._", "append_", "(_", "etree_", "._", "fromstring_", "(_", "self_", "._", "parent_", "._", "request_", ",_", "self_", "._", "parent_", "._", "context_", "._", "parser_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node2_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node1_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s", ":", "Get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node2_", "._", "text_", "=_", "self_", "._", "parent_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "async_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Request", "Id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "verbo", "ser", "esp", "ons", "e_", "(_", "self_", ",_", "insert", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "show", " ", "insert", " ", "result", " ", "identifi", "ers", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "result_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Insert", "Result", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ir_", "in_", "insert", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "brief", "rec_", "=_", "etree_", "._", "Sub", "Element_", "(_", "insert", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Brie", "f", "Record", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "brief", "rec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dc", ":", "identifi", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "ir_", "[_", "'", "identifi", "er", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "brief", "rec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "dc", ":", "title", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "ir_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "insert", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "design", " ", "pattern", " ", "to", " ", "write", " ", "ow", "s2", "0", ":", "All", "owe", "d", "Value", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "ed", "\\u", "values_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "All", "owe", "d", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "sorted_", "(_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "allow", "ed", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "allow", "ed", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exception", "report_", "(_", "self_", ",_", "code_", ",_", "locator_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "Except", "ion", "Report", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "exception_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "status_", "=_", "code_", "\\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 ", " _", "language_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "language", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "c\\u", "schema", "s", "\\u", "base_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", "\\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 ", " _", "language_", "=_", "'", "en", "-", "US", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "c\\u", "schema", "s", "\\u", "base_", "=_", "self_", "._", "parent_", "._", "context_", "._", "og", "c\\u", "schema", "s", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "Report", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "'{", "http", "://", "www", ".", "w3", ".", "org", "/", "XML", "/", "199", "8", "/", "namespace", "}", "lang", "'_", "]_", "=_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "ow", "s", "/", "2.0", "/", "ow", "s", "Except", "ion", "Report", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "ow", "s2", "0", "'_", "]_", ",_", "og", "c\\u", "schema", "s", "\\u", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exception", "Code_", "=_", "code_", ",_", "locator_", "=_", "locator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "Text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "nsma", "p_", "(_", "self_", ",_", "list\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "'", " ", "Resolv", "e", " ", "type", "name", " ", "bindi", "ngs", " ", "based", " ", "on", " ", "default", " ", "and", " ", "KV", "P", " ", "namespace", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tns", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Names", "pace", " ", "list", " ", "pair", "s", ":", " ", "%", "s", "'_", ",_", "list\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bind", " ", "KV", "P", " ", "namespace", "s", " ", "int", "o", " ", "type", "names_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ns_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "namespace", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsp", "air_", "=_", "ns_", "._", "split_", "(_", "'('_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "')'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "nsp", "air_", ")_", "==_", "1_", ":_", "#", " ", "default", " ", "namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsma", "p_", "[_", "'", "cs", "w", "'_", "]_", "=_", "nsp", "air_", "[_", "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 ", " _", "nsma", "p_", "[_", "nsp", "air_", "[_", "0_", "]_", "]_", "=_", "nsp", "air_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Names", "pace", " ", "pair", "s", ":", " ", "%", "s", "'_", ",_", "nsma", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tn_", "in_", "list\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "tn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tn_", "._", "find_", "(_", "':'_", ")_", "!=_", "-_", "1_", ":_", "#", " ", "resolve", " ", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "tn_", "._", "split_", "(_", "':'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", "in_", "nsma", "p_", "._", "keys_", "(_", ")_", ":_", "#", " ", "get", " ", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "uri_", "=_", "nsma", "p_", "[_", "prefix_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newp", "refix", "_", "=_", "next_", "(_", "k_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "._", "items_", "(_", ")_", "if_", "v_", "==_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "newp", "refix", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "prefix", " ", "==", " ", "'", "cs", "w3", "0", "':", " ", "newp", "refix", " ", "=", " ", "'", "cs", "w", "'_", "\\u\\u\\uNL\\u\\u\\u_", "newval", "ue_", "=_", "tn_", "._", "replace_", "(_", "prefix_", ",_", "newp", "refix", "_", ")_", "._", "replace_", "(_", "'", "cs", "w3", "0", "'_", ",_", "'", "cs", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "newval", "ue_", "=_", "tn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "default", " ", "namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newval", "ue_", "=_", "tn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tns", "_", "._", "append_", "(_", "newval", "ue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "tns", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tns", "_", "\\u\\u\\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_", "write", "\\u", "bound", "ing", "box_", "(_", "bbox_", ",_", "nsma", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "ow", "s2", "0", ":", "Bound", "ing", "Box", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bbox_", "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 ", " _", "bbox", "2_", "=_", "util_", "._", "wk", "t2", "geom_", "(_", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "bbox", "2_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bound", "ing", "box_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Bound", "ing", "Box", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ",_", "crs_", "=_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "def", "/", "cr", "s", "/", "EPS", "G", "/", "0", "/", "432", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dimensions_", "=_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "bound", "ing", "box_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Lower", "Corner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ")_", "._", "text_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "bbox", "2_", "[_", "1_", "]_", ",_", "bbox", "2_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "bound", "ing", "box_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Upp", "er", "Corner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ")_", "._", "text_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "bbox", "2_", "[_", "3_", "]_", ",_", "bbox", "2_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bound", "ing", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "record_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "complete", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "next", "record_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "subse", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "matched_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "none", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "results", "et", "\\u", "status_", "(_", "matched_", ",_", "next", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Help", "er", " ", "function", " ", "to", " ", "assess", " ", "status", " ", "of", " ", "a", " ", "result", " ", "set", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "'", "subse", "t", "'_", "#", " ", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "next", "record_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "'", "complete", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "matched_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "'", "none", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "status_", "\\u\\u\\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", "ela", "pse", "d\\u", "time_", "(_", "begin_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Help", "er", " ", "function", " ", "to", " ", "calcul", "ate", " ", "ela", "pse", "d", " ", "time", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "str_", "(_", "int_", "(_", "(_", "end_", "-_", "begin_", ")_", "*_", "1000_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
openstack/group-based-policy-ui/gbpui/panels/application_policy/forms.py
[ { "content": " def __init__(self, request, *args, **kwargs):\n super(UpdatePolicyRuleForm, self).__init__(request, *args, **kwargs)\n try:\n policyrule_id = self.initial['policyrule_id']\n rule = client.policyrule_get(request, policyrule_id)\n for item in ['name', 'description',\n 'policy_classifier_id', 'policy_actions', 'shared']:\n self.fields[item].initial = getattr(rule, item)\n actions = client.policyaction_list(request,\n tenant_id=request.user.tenant_id)\n action_list = [a.id for a in actions]\n for action in actions:\n action.set_id_as_name_if_empty()\n actions = sorted(actions, key=lambda action: action.name)\n action_list = [(a.id, a.name) for a in actions]\n self.fields['policy_actions'].choices = action_list\n classifiers = client.policyclassifier_list(request,\n tenant_id=request.user.tenant_id)\n classifier_list = [(c.id, c.name) for c in classifiers]\n self.fields['policy_classifier_id'].choices = classifier_list\n except Exception:\n exceptions.handle(\n request, _(\"Unable to retrive policy rule details.\"))", "metadata": "root.UpdatePolicyRuleForm.__init__", "header": "['class', 'UpdatePolicyRuleForm', '(', 'BaseUpdateForm', ')', ':', '___EOS___']", "index": 301 } ]
[ { "span": "action_list ", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 23 } ]
[ { "span": "action_list ", "start_line": 315, "start_column": 12, "end_line": 315, "end_column": 23 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Update", "Polic", "y", "Rule", "Form_", "(_", "Base", "Update", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Update", "Polic", "y", "Rule", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "rule", "\\u", "id_", "=_", "self_", "._", "initial_", "[_", "'", "policy", "rule", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule_", "=_", "client_", "._", "policy", "rule", "\\u", "get_", "(_", "request_", ",_", "policy", "rule", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "[_", "'", "name", "'_", ",_", "'", "description", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "\\u", "classif", "ier", "\\u", "id", "'_", ",_", "'", "policy", "\\u", "action", "s", "'_", ",_", "'", "shared", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "item_", "]_", "._", "initial_", "=_", "getattr_", "(_", "rule_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actions_", "=_", "client_", "._", "policy", "action", "\\u", "list_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "request_", "._", "user_", "._", "tenan", "t", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "list_", "=_", "[_", "a_", "._", "id_", "for_", "a_", "in_", "actions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "._", "set\\u", "id", "\\u", "as", "\\u", "name", "\\u", "if", "\\u", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actions_", "=_", "sorted_", "(_", "actions_", ",_", "key_", "=_", "lambda_", "action_", ":_", "action_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "list_", "=_", "[_", "(_", "a_", "._", "id_", ",_", "a_", "._", "name_", ")_", "for_", "a_", "in_", "actions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "policy", "\\u", "action", "s", "'_", "]_", "._", "choices_", "=_", "action", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classifiers_", "=_", "client_", "._", "policy", "classif", "ier", "\\u", "list_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "request_", "._", "user_", "._", "tenan", "t", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classif", "ier", "\\u", "list_", "=_", "[_", "(_", "c_", "._", "id_", ",_", "c_", "._", "name_", ")_", "for_", "c_", "in_", "classifiers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "policy", "\\u", "classif", "ier", "\\u", "id", "'_", "]_", "._", "choices_", "=_", "classif", "ier", "\\u", "list_", "\\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 ", " _", "exceptions_", "._", "handle_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u_", "(_", "\"", "Una", "ble", " ", "to", " ", "retr", "ive", " ", "policy", " ", "rule", " ", "deta", "il", "s", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
tempodb/tempodb-python/tempodb/protocol/objects.py
[ { "content": " def __init__(self, json_text, response):\n self.from_json(json_text)\n self.response = response", "metadata": "root.JSONSerializable.__init__", "header": "['class', 'JSONSerializable', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": "class Series(JSONSerializable):\n \"\"\"Represents a Series object from the TempoDB API. Series objects\n are serialized to and from JSON using the :meth:`to_json` and\n :meth:`from_json` methods.\n\n Domain object attributes:\n\n * key: string\n * name: string\n * tags: list\n * attributes: dictionary\"\"\"\n\n properties = ['key', 'name', 'tags', 'attributes']\n", "metadata": "root.Series", "header": "['module', '___EOS___']", "index": 102 }, { "content": " def __init__(self, json_text, response):\n #the formatting of the series object returned from the series by key\n #endpoint is slightly different\n if isinstance(json_text, basestring):\n j = json.loads(json_text)\n else:\n j = json_text\n if 'series' in j:\n self.from_json(j['series'])\n else:\n self.from_json(json_text)\n self.response = response", "metadata": "root.Series.__init__", "header": "['class', 'Series', '(', 'JSONSerializable', ')', ':', '___EOS___']", "index": 116 } ]
[ { "span": "class Series(JSONSerializable):", "start_line": 102, "start_column": 0, "end_line": 102, "end_column": 31 } ]
[ { "span": "def __init__(self, json_text, response):", "start_line": 28, "start_column": 4, "end_line": 28, "end_column": 44 }, { "span": "def __init__(self, json_text, response):", "start_line": 116, "start_column": 4, "end_line": 116, "end_column": 44 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "JSO", "NS", "eria", "liza", "ble_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "json", "\\u", "text_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "from", "\\u", "json_", "(_", "json", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Series_", "(_", "JSO", "NS", "eria", "liza", "ble_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "a", " ", "Serie", "s", " ", "object", " ", "from", " ", "the", " ", "Temp", "o", "DB", " ", "API", ".", " ", " ", "Serie", "s", " ", "object", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "serialize", "d", " ", "to", " ", "and", " ", "from", " ", "JSO", "N", " ", "usi", "ng", " ", "the", " ", ":", "meth", ":`", "to", "\\u", "json", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "from", "\\u", "json", "`", " ", "method", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Doma", "in", " ", "object", " ", "attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "key", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "tags", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "attribute", "s", ":", " ", "dictionar", "y", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "properties_", "=_", "[_", "'", "key", "'_", ",_", "'", "name", "'_", ",_", "'", "tags", "'_", ",_", "'", "attribute", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Series_", "(_", "JSO", "NS", "eria", "liza", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "json", "\\u", "text_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "the", " ", "format", "ting", " ", "of", " ", "the", " ", "series", " ", "object", " ", "return", "ed", " ", "from", " ", "the", " ", "series", " ", "by", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "#", "endpoint", " ", "is", " ", "slight", "ly", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "json", "\\u", "text_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "json", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "series", "'_", "in_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "from", "\\u", "json_", "(_", "j_", "[_", "'", "series", "'_", "]_", ")_", "\\u\\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_", "._", "from", "\\u", "json_", "(_", "json", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
JeremyOT/Toto/tests/test_secret.py
[ { "content": " def test_password_hash(self):\n pw = uuid4().hex\n self.assertTrue(pw != password_hash(pw))\n self.assertTrue(password_hash(pw) != password_hash(pw + uuid4().hex))\n self.assertTrue(password_hash(pw) != password_hash(uuid4().hex))\n self.assertTrue(password_hash(pw) != password_hash(pw)) #check salt", "metadata": "root.TestSecret.test_password_hash", "header": "['class', 'TestSecret', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 7 } ]
[ { "span": "self.assertTrue(pw != password_hash(pw))", "start_line": 9, "start_column": 4, "end_line": 9, "end_column": 44 }, { "span": "self.assertTrue(password_hash(pw) != password_hash(pw + uuid4().hex))", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 73 }, { "span": "self.assertTrue(password_hash(pw) != password_hash(uuid4().hex))", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 68 }, { "span": "self.assertTrue(password_hash(pw) != password_hash(pw)) ", "start_line": 12, "start_column": 4, "end_line": 12, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Secret_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "password", "\\u", "hash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pw_", "=_", "uuid4_", "(_", ")_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "pw_", "!=_", "password", "\\u", "hash_", "(_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "password", "\\u", "hash_", "(_", "pw_", ")_", "!=_", "password", "\\u", "hash_", "(_", "pw_", "+_", "uuid4_", "(_", ")_", "._", "hex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "password", "\\u", "hash_", "(_", "pw_", ")_", "!=_", "password", "\\u", "hash_", "(_", "uuid4_", "(_", ")_", "._", "hex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "password", "\\u", "hash_", "(_", "pw_", ")_", "!=_", "password", "\\u", "hash_", "(_", "pw_", ")_", ")_", "#", "check", " ", "salt_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
remakeelectric/mqtt-malaria/version.py
[ { "content": "def call_git_describe(abbrev):\n try:\n p = Popen(['git', 'describe', '--abbrev=%d' % abbrev, \"--dirty\"],\n stdout=PIPE, stderr=PIPE)\n p.stderr.close()\n line = p.stdout.readlines()[0]\n return line.strip()\n\n except:\n return None", "metadata": "root.call_git_describe", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def read_release_version():\n try:\n f = open(\"RELEASE-VERSION\", \"r\")\n\n try:\n version = f.readlines()[0]\n return version.strip()\n\n finally:\n f.close()\n\n except:\n return None", "metadata": "root.read_release_version", "header": "['module', '___EOS___']", "index": 50 } ]
[ { "span": "except:", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 11 }, { "span": "except:", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "call", "\\u", "git", "\\u", "describe_", "(_", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Popen_", "(_", "[_", "'", "git", "'_", ",_", "'", "descri", "be", "'_", ",_", "'--", "abbrev", "=", "%", "d", "'_", "%_", "abbrev", "_", ",_", "\"--", "dir", "ty", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "stderr_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "p_", "._", "stdout_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "release", "\\u", "version_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "\"", "RELEASE", "-", "VERSI", "ON", "\"_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "f_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "version_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
xraypy/xraylarch/plugins/wx/xrfdisplay_utils.py
[ { "content": "class XRFDisplayConfig:\n emph_elinecolor = '#444444'\n major_elinecolor = '#DAD8CA'\n minor_elinecolor = '#F4DAC0'\n hold_elinecolor = '#CAC8DA'\n marker_color = '#77BB99'\n roi_fillcolor = '#F8F0BA'\n roi_color = '#AA0000'\n spectra_color = '#0000AA'\n spectra2_color = '#00DD00'\n bgr_color = '#000000'\n\n K_major = ['Ka1', 'Ka2', 'Kb1']\n K_minor = ['Kb3', 'Kb2']\n K_minor = []\n L_major = ['La1', 'Lb1', 'Lb3', 'Lb4']\n L_minor = ['Ln', 'Ll', 'Lb2,15', 'Lg2', 'Lg3', 'Lg1', 'La2']\n L_minor = []\n M_major = ['Ma', 'Mb', 'Mg', 'Mz']\n e_min = 1.00\n e_max = 30.0", "metadata": "root.XRFDisplayConfig", "header": "['module', '___EOS___']", "index": 363 } ]
[ { "span": "K_minor ", "start_line": 376, "start_column": 4, "end_line": 376, "end_column": 11 }, { "span": "L_minor ", "start_line": 379, "start_column": 4, "end_line": 379, "end_column": 11 } ]
[ { "span": "K_minor ", "start_line": 377, "start_column": 4, "end_line": 377, "end_column": 11 }, { "span": "L_minor ", "start_line": 380, "start_column": 4, "end_line": 380, "end_column": 11 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "XR", "FD", "isp", "lay", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "emp", "h", "\\u", "elin", "ecol", "or_", "=_", "'#", "444444", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major", "\\u", "elin", "ecol", "or_", "=_", "'#", "DA", "D8", "CA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mino", "r", "\\u", "elin", "ecol", "or_", "=_", "'#", "F4", "DAC", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hold", "\\u", "elin", "ecol", "or_", "=_", "'#", "CAC", "8", "DA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "marker", "\\u", "color_", "=_", "'#", "7", "7", "BB", "9", "9", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roi", "\\u", "fillc", "olor_", "=_", "'#", "F8", "F0", "BA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roi", "\\u", "color_", "=_", "'#", "AA", "0000", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spectr", "a", "\\u", "color_", "=_", "'#", "0000", "AA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spectr", "a2", "\\u", "color_", "=_", "'#", "00", "DD", "00", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bgr", "\\u", "color_", "=_", "'#", "000000", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "K", "\\u", "major_", "=_", "[_", "'", "Ka", "1", "'_", ",_", "'", "Ka", "2", "'_", ",_", "'", "Kb", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K", "\\u", "minor_", "=_", "[_", "'", "Kb", "3", "'_", ",_", "'", "Kb", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K", "\\u", "minor_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L", "\\u", "major_", "=_", "[_", "'", "La", "1", "'_", ",_", "'", "Lb", "1", "'_", ",_", "'", "Lb", "3", "'_", ",_", "'", "Lb", "4", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L", "\\u", "minor_", "=_", "[_", "'", "Ln", "'_", ",_", "'", "Ll", "'_", ",_", "'", "Lb", "2", ",", "15", "'_", ",_", "'", "Lg", "2", "'_", ",_", "'", "Lg", "3", "'_", ",_", "'", "Lg", "1", "'_", ",_", "'", "La", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L", "\\u", "minor_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M", "\\u", "major_", "=_", "[_", "'", "Ma", "'_", ",_", "'", "Mb", "'_", ",_", "'", "Mg", "'_", ",_", "'", "Mz", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "min_", "=_", "1.00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "max_", "=_", "30.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
scrapinghub/python-hubstorage/tests/test_jobq.py
[ { "content": " def test_summary_jobmeta(self):\n jobq = self.project.jobq\n jobq.push(self.spidername, foo='bar', caz='fuu')\n pendings = jobq.summary('pending', jobmeta='foo')['summary']\n p1 = pendings[0]\n self.assertEqual(p1.get('foo'), 'bar')\n self.assertFalse('caz' in p1)\n\n pendings = jobq.summary('pending', jobmeta=['foo', 'caz'])['summary']\n p1 = pendings[0]\n self.assertEqual(p1.get('foo'), 'bar')\n self.assertEqual(p1.get('caz'), 'fuu')", "metadata": "root.JobqTest.test_summary_jobmeta", "header": "['class', 'JobqTest', '(', 'HSTestCase', ')', ':', '___EOS___']", "index": 129 }, { "content": " def test_spider_updates(self):\n jobq = self.project.jobq\n spiderkey = '%s/%s' % (self.projectid, self.spiderid)\n\n def finish_and_delete_jobs():\n for job in jobq.finish(spiderkey):\n yield job\n jobq.delete(spiderkey)\n\n q1 = jobq.push(self.spidername)\n q2 = jobq.push(self.spidername, state='running')\n q3 = jobq.push(self.spidername, state='finished')\n q4 = jobq.push(self.spidername, state='deleted')\n\n r = dict((x['key'], x['prevstate']) for x in finish_and_delete_jobs())\n self.assertEqual(r.get(q1['key']), 'pending', r)\n self.assertEqual(r.get(q2['key']), 'running', r)\n self.assertEqual(r.get(q3['key']), 'finished', r)\n self.assertTrue(q4['key'] not in r)\n\n # Empty result set\n self.assertFalse(list(jobq.delete(spiderkey)))", "metadata": "root.JobqTest.test_spider_updates", "header": "['class', 'JobqTest', '(', 'HSTestCase', ')', ':', '___EOS___']", "index": 294 } ]
[ { "span": "self.assertFalse('caz' in p1)", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 37 }, { "span": "self.assertTrue(q4['key'] not in r)", "start_line": 312, "start_column": 8, "end_line": 312, "end_column": 43 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Jo", "bq", "Test_", "(_", "HS", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "summar", "y", "\\u", "job", "meta_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "q_", "=_", "self_", "._", "project_", "._", "job", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "q_", "._", "push_", "(_", "self_", "._", "spider", "name_", ",_", "foo_", "=_", "'", "bar", "'_", ",_", "ca", "z_", "=_", "'", "fu", "u", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ings_", "=_", "job", "q_", "._", "summary_", "(_", "'", "pend", "ing", "'_", ",_", "job", "meta_", "=_", "'", "foo", "'_", ")_", "[_", "'", "summar", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "pend", "ings_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "get_", "(_", "'", "foo", "'_", ")_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "ca", "z", "'_", "in_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pend", "ings_", "=_", "job", "q_", "._", "summary_", "(_", "'", "pend", "ing", "'_", ",_", "job", "meta_", "=_", "[_", "'", "foo", "'_", ",_", "'", "ca", "z", "'_", "]_", ")_", "[_", "'", "summar", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "pend", "ings_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "get_", "(_", "'", "foo", "'_", ")_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "get_", "(_", "'", "ca", "z", "'_", ")_", ",_", "'", "fu", "u", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Jo", "bq", "Test_", "(_", "HS", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "spider", "\\u", "updates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "q_", "=_", "self_", "._", "project_", "._", "job", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spider", "key_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "projecti", "d_", ",_", "self_", "._", "spider", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "finish", "\\u", "and", "\\u", "delete", "\\u", "jobs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "job_", "in_", "job", "q_", "._", "finish_", "(_", "spider", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "q_", "._", "delete_", "(_", "spider", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q1_", "=_", "job", "q_", "._", "push_", "(_", "self_", "._", "spider", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "job", "q_", "._", "push_", "(_", "self_", "._", "spider", "name_", ",_", "state_", "=_", "'", "runn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q3_", "=_", "job", "q_", "._", "push_", "(_", "self_", "._", "spider", "name_", ",_", "state_", "=_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "4_", "=_", "job", "q_", "._", "push_", "(_", "self_", "._", "spider", "name_", ",_", "state_", "=_", "'", "delete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "dict_", "(_", "(_", "x_", "[_", "'", "key", "'_", "]_", ",_", "x_", "[_", "'", "prev", "state", "'_", "]_", ")_", "for_", "x_", "in_", "finish", "\\u", "and", "\\u", "delete", "\\u", "jobs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "get_", "(_", "q1_", "[_", "'", "key", "'_", "]_", ")_", ",_", "'", "pend", "ing", "'_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "get_", "(_", "q2_", "[_", "'", "key", "'_", "]_", ")_", ",_", "'", "runn", "ing", "'_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "._", "get_", "(_", "q3_", "[_", "'", "key", "'_", "]_", ")_", ",_", "'", "finish", "ed", "'_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q", "4_", "[_", "'", "key", "'_", "]_", "not_", "in_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emp", "ty", " ", "result", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "list_", "(_", "job", "q_", "._", "delete_", "(_", "spider", "key_", ")_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 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
GoodCloud/django-zebra/zebra_sample_project/marty/views.py
[ { "content": "\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response, redirect\nfrom django.template import RequestContext\nfrom django.http import HttpResponse\nfrom django.utils import simplejson\nfrom zebra.conf import options\n\nimport stripe\nstripe.api_key = options.STRIPE_SECRET\n\nfrom zebra.forms import StripePaymentForm\n\n\n# In a real implementation, do login required, etc.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def update(request):\n user = request.user\n success_updating = False\n\n if request.method == 'POST':\n zebra_form = StripePaymentForm(request.POST)\n if zebra_form.is_valid():\n\n customer = stripe.Customer.retrieve(user.stripe_id)\n customer.card = zebra_form.cleaned_data['stripe_token']\n customer.save()\n\n profile = user.get_profile()\n profile.last_4_digits = zebra_form.cleaned_data['last_4_digits']\n profile.stripe_customer_id = customer.id\n profile.save()\n\n success_updating = True\n\n else:\n zebra_form = StripePaymentForm()\n\n return render_to_response('marty/basic_update.html',\n {\n 'zebra_form': zebra_form,\n 'publishable': options.STRIPE_PUBLISHABLE,\n 'success_updating': success_updating,\n },\n context_instance=RequestContext(request)\n )", "metadata": "root.update", "header": "['module', '___EOS___']", "index": 15 } ]
[ { "span": "from django.http import HttpResponseRedirect", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 44 }, { "span": "from django.shortcuts import render_to_response, redirect", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 57 }, { "span": "from django.http import HttpResponse", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 36 }, { "span": "from django.utils import simplejson", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zeb", "ra_", "._", "conf_", "import_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "stripe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stripe_", "._", "api", "\\u", "key_", "=_", "options_", "._", "STRIP", "E", "\\u", "SECRET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zeb", "ra_", "._", "forms_", "import_", "Strip", "e", "Payment", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "a", " ", "real", " ", "implementation", ",", " ", "do", " ", "login", " ", "require", "d", ",", " ", "etc", "._", "\\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_", "update_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success", "\\u", "updat", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zeb", "ra", "\\u", "form_", "=_", "Strip", "e", "Payment", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "zeb", "ra", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customer_", "=_", "stripe_", "._", "Customer_", "._", "retrieve_", "(_", "user_", "._", "strip", "e\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer_", "._", "card_", "=_", "zeb", "ra", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "strip", "e\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "profile_", "=_", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "last", "\\u", "4", "\\u", "digits_", "=_", "zeb", "ra", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "last", "\\u", "4", "\\u", "digit", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "strip", "e\\u", "customer", "\\u", "id_", "=_", "customer_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "success", "\\u", "updat", "ing_", "=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zeb", "ra", "\\u", "form_", "=_", "Strip", "e", "Payment", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "mart", "y", "/", "basic", "\\u", "update", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zeb", "ra", "\\u", "form", "'_", ":_", "zeb", "ra", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sha", "ble", "'_", ":_", "options_", "._", "STRIP", "E", "\\u", "PUBLISH", "ABLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "\\u", "updat", "ing", "'_", ":_", "success", "\\u", "updat", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
muatik/flask-profiler/tests/test_measure_endpoint.py
[ { "content": "# -*- coding: utf8 -*-\nimport unittest\nfrom .basetest import BasetTest, measure, flask_profiler, CONF\nimport time\nfrom pprint import pprint as pp\nfrom flask import Flask\nfrom flask.ext.testing import TestCase as FlaskTestCase\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EndpointMeasurementTest(BasetTest, FlaskTestCase):\n\n\n\n\n", "metadata": "root.EndpointMeasurementTest", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def create_app(self):\n app = Flask(__name__)\n app.config[\"flask_profiler\"] = CONF\n app.config['TESTING'] = True\n\n @app.route(\"/api/people/<firstname>\")\n def sayHello(firstname):\n return firstname\n\n flask_profiler.init_app(app)\n\n @app.route(\"/api/without/profiler\")\n def withoutProfiler():\n return \"without profiler\"\n\n @app.route(\"/api/with/profiler/<message>\")\n @flask_profiler.profile()\n def customProfilerEP(message):\n return \"with profiler\"\n\n return app", "metadata": "root.EndpointMeasurementTest.create_app", "header": "['class', 'EndpointMeasurementTest', '(', 'BasetTest', ',', 'FlaskTestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def tearDown(self):\n pass", "metadata": "root.EndpointMeasurementTest.tearDown", "header": "['class', 'EndpointMeasurementTest', '(', 'BasetTest', ',', 'FlaskTestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_01_return_value(self):\n name = \"john\"\n response = self.client.get(\"/api/people/{}\".format(name))\n # converting because in python 3, reponse data becomes binary not utf-8\n r = response.data.decode(\"utf-8\", \"strict\")\n self.assertEquals(r, name)", "metadata": "root.EndpointMeasurementTest.test_01_return_value", "header": "['class', 'EndpointMeasurementTest', '(', 'BasetTest', ',', 'FlaskTestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test_02_without_profiler(self):\n response = self.client.get(\"/api/without/profiler\")\n # converting because in python 3, reponse data becomes binary not utf-8\n r = response.data.decode(\"utf-8\", \"strict\")\n\n self.assertEquals(r, \"without profiler\")\n measurements = list(flask_profiler.collection.filter())\n self.assertEquals(len(measurements), 0)", "metadata": "root.EndpointMeasurementTest.test_02_without_profiler", "header": "['class', 'EndpointMeasurementTest', '(', 'BasetTest', ',', 'FlaskTestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_02_with_profiler(self):\n response = self.client.get(\"/api/with/profiler/hello?q=1\")\n # converting because in python 3, reponse data becomes binary not utf-8\n r = response.data.decode(\"utf-8\", \"strict\")\n self.assertEquals(r, \"with profiler\")\n\n measurements = list(flask_profiler.collection.filter())\n self.assertEquals(len(measurements), 1)\n m = measurements[0]\n self.assertEqual(m[\"name\"], \"/api/with/profiler/<message>\")\n self.assertEqual(m[\"method\"], \"GET\")\n self.assertEqual(m[\"kwargs\"], {\"message\": \"hello\"})\n self.assertEqual(m[\"context\"][\"args\"], {\"q\": \"1\"})", "metadata": "root.EndpointMeasurementTest.test_02_with_profiler", "header": "['class', 'EndpointMeasurementTest', '(', 'BasetTest', ',', 'FlaskTestCase', ')', ':', '___EOS___']", "index": 52 } ]
[ { "span": "import time", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "from pprint import pprint as pp", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base", "test_", "import_", "Base", "t", "Test_", ",_", "measure_", ",_", "fla", "sk", "\\u", "profiler_", ",_", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "as_", "pp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "testing_", "import_", "Test", "Case_", "as_", "Fla", "sk", "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\\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_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "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_", "[SEP]_", "class_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create", "\\u", "app_", "(_", "self_", ")_", ":_", "\\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_", "app_", "._", "config_", "[_", "\"", "fla", "sk", "\\u", "profiler", "\"_", "]_", "=_", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "TESTING", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "api", "/", "people", "/", "<", "first", "name", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "say", "Hell", "o_", "(_", "firstname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "firstname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fla", "sk", "\\u", "profiler_", "._", "init", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "api", "/", "with", "out", "/", "profiler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "with", "out", "Profiler", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "with", "out", " ", "profiler", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "api", "/", "with", "/", "profiler", "/", "<", "message", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "fla", "sk", "\\u", "profiler_", "._", "profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "custom", "Profiler", "EP", "_", "(_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "with", " ", "profiler", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "01", "\\u", "return", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "john", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\"/", "api", "/", "people", "/{}\"_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "ing", " ", "bec", "aus", "e", " ", "in", " ", "python", " ", "3", ",", " ", "repon", "se", " ", "data", " ", "bec", "ome", "s", " ", "binar", "y", " ", "not", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "response_", "._", "data_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ",_", "\"", "strict", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "r_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "02", "\\u", "with", "out", "\\u", "profiler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\"/", "api", "/", "with", "out", "/", "profiler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "ing", " ", "bec", "aus", "e", " ", "in", " ", "python", " ", "3", ",", " ", "repon", "se", " ", "data", " ", "bec", "ome", "s", " ", "binar", "y", " ", "not", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "response_", "._", "data_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ",_", "\"", "strict", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "r_", ",_", "\"", "with", "out", " ", "profiler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "list_", "(_", "fla", "sk", "\\u", "profiler_", "._", "collection_", "._", "filter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "measurements_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Measurement", "Test_", "(_", "Base", "t", "Test_", ",_", "Fla", "sk", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "02", "\\u", "with", "\\u", "profiler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\"/", "api", "/", "with", "/", "profiler", "/", "hell", "o", "?", "q", "=", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "ing", " ", "bec", "aus", "e", " ", "in", " ", "python", " ", "3", ",", " ", "repon", "se", " ", "data", " ", "bec", "ome", "s", " ", "binar", "y", " ", "not", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "response_", "._", "data_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ",_", "\"", "strict", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "r_", ",_", "\"", "with", " ", "profiler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "measurements_", "=_", "list_", "(_", "fla", "sk", "\\u", "profiler_", "._", "collection_", "._", "filter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "measurements_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "measurements_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "name", "\"_", "]_", ",_", "\"/", "api", "/", "with", "/", "profiler", "/", "<", "message", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "method", "\"_", "]_", ",_", "\"", "GET", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "kwarg", "s", "\"_", "]_", ",_", "{_", "\"", "message", "\"_", ":_", "\"", "hell", "o", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "context", "\"_", "]_", "[_", "\"", "args", "\"_", "]_", ",_", "{_", "\"", "q", "\"_", ":_", "\"", "1", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unreachable code
mozilla/django-badger/badger/printing.py
[ { "content": "def render_label(request, c, metrics, da, badge_img, debug):\n \"\"\"Render a single label\"\"\"\n badge = da.badge\n\n badge_image_width = (1.0 + (1.0 / 64.0)) * inch\n badge_image_height = (1.0 + (1.0 / 64.0)) * inch\n\n qr_left = badge_image_width - metrics['qr_overlap']\n qr_bottom = badge_image_height - metrics['qr_overlap']\n qr_width = metrics['width'] - qr_left\n qr_height = metrics['height'] - qr_bottom\n\n if False and debug:\n # Draw some layout lines on debug.\n c.setLineWidth(0.3)\n c.rect(0, 0, metrics['width'], metrics['height'])\n c.rect(qr_left, qr_bottom, qr_width, qr_height)\n c.rect(0, 0, badge_image_width, badge_image_height)\n\n fit_text(c, da.badge.title,\n 0.0, badge_image_height,\n badge_image_width, qr_height)\n\n c.saveState()\n c.rotate(-90)\n\n code_height = qr_height * (0.45)\n claim_height = qr_height - code_height\n\n c.setFont(\"Courier\", code_height)\n c.drawCentredString(0 - (badge_image_width / 2.0),\n metrics['height'] - code_height,\n da.claim_code)\n\n text = \"\"\"\n <font name=\"Helvetica\">Claim at</font> <font name=\"Courier\">%s</font>\n \"\"\" % (settings.SITE_TITLE)\n fit_text(c, text,\n 0 - badge_image_height, badge_image_width,\n badge_image_width, claim_height)\n\n c.restoreState()\n\n # Attempt to build a QR code image for the claim URL\n claim_url = request.build_absolute_uri(da.get_claim_url())\n qr_img = None\n try:\n # Try using PyQRNative: http://code.google.com/p/pyqrnative/\n # badg.us should have this in vendor-local\n from PyQRNative import QRCode, QRErrorCorrectLevel\n # TODO: Good-enough settings?\n if len(claim_url) < 20:\n qr = QRCode(3, QRErrorCorrectLevel.L)\n elif len(claim_url) < 50:\n qr = QRCode(4, QRErrorCorrectLevel.L)\n else:\n qr = QRCode(10, QRErrorCorrectLevel.L)\n qr.addData(claim_url)\n qr.make()\n qr_img = ImageReader(qr.makeImage())\n\n except ImportError:\n try:\n # Hmm, if we don't have PyQRNative, then try abusing this web\n # service. Should be fine for low volumes.\n qr_url = (\"http://api.qrserver.com/v1/create-qr-code/?%s\" %\n urllib.urlencode({'size': '%sx%s' % (500, 500),\n 'data': claim_url}))\n\n qr_img = ImageReader(StringIO(urllib2.urlopen(qr_url).read()))\n\n except Exception:\n # Ignore issues in drawing the QR code - maybe show an error?\n pass\n\n if qr_img:\n c.drawImage(qr_img, qr_left, qr_bottom, qr_width, qr_height)\n\n c.drawImage(badge_img,\n 0.0 * inch, 0.0 * inch,\n badge_image_width, badge_image_height)", "metadata": "root.render_label", "header": "['module', '___EOS___']", "index": 118 } ]
[ { "span": "c.setLineWidth(0.3)", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 27 } ]
[]
1
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_", "render", "\\u", "label_", "(_", "request_", ",_", "c_", ",_", "metrics_", ",_", "da_", ",_", "badge", "\\u", "img_", ",_", "debug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "a", " ", "single", " ", "label", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "badge", "_", "=_", "da_", "._", "badge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", "=_", "(_", "1.0_", "+_", "(_", "1.0_", "/_", "64.", "0_", ")_", ")_", "*_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "badge", "\\u", "image", "\\u", "height_", "=_", "(_", "1.0_", "+_", "(_", "1.0_", "/_", "64.", "0_", ")_", ")_", "*_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "left_", "=_", "badge", "\\u", "image", "\\u", "width_", "-_", "metrics_", "[_", "'", "qr", "\\u", "overl", "ap", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "bottom_", "=_", "badge", "\\u", "image", "\\u", "height_", "-_", "metrics_", "[_", "'", "qr", "\\u", "overl", "ap", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "width_", "=_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", "-_", "qr", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "height_", "=_", "metrics_", "[_", "'", "height", "'_", "]_", "-_", "qr", "\\u", "bottom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "False_", "and_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Draw", " ", "some", " ", "layout", " ", "lines", " ", "on", " ", "debug", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "set", "Line", "Width_", "(_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "0_", ",_", "0_", ",_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", ",_", "metrics_", "[_", "'", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "qr", "\\u", "left_", ",_", "qr", "\\u", "bottom_", ",_", "qr", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "0_", ",_", "0_", ",_", "badge", "\\u", "image", "\\u", "width_", ",_", "badge", "\\u", "image", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fit", "\\u", "text_", "(_", "c_", ",_", "da_", "._", "badge", "_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", ",_", "badge", "\\u", "image", "\\u", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "save", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rotate_", "(_", "-_", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "height_", "=_", "qr", "\\u", "height_", "*_", "(_", "0.45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "claim", "\\u", "height_", "=_", "qr", "\\u", "height_", "-_", "code", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Font_", "(_", "\"", "Cour", "ier", "\"_", ",_", "code", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "draw", "Centre", "d", "String_", "(_", "0_", "-_", "(_", "badge", "\\u", "image", "\\u", "width_", "/_", "2.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metrics_", "[_", "'", "height", "'_", "]_", "-_", "code", "\\u", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "da_", "._", "claim", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "font", " ", "name", "=\"", "Hel", "vet", "ica", "\">", "Cla", "im", " ", "at", "</", "font", ">", " ", "<", "font", " ", "name", "=\"", "Cour", "ier", "\">", "%", "s", "</", "font", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "settings_", "._", "SITE", "\\u", "TITLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "\\u", "text_", "(_", "c_", ",_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "-_", "badge", "\\u", "image", "\\u", "height_", ",_", "badge", "\\u", "image", "\\u", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "claim", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "restore", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "build", " ", "a", " ", "QR", " ", "code", " ", "image", " ", "for", " ", "the", " ", "claim", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "claim", "\\u", "url_", "=_", "request_", "._", "build", "\\u", "abs", "olute", "\\u", "uri_", "(_", "da_", "._", "get", "\\u", "claim", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "usi", "ng", " ", "Py", "QR", "Nat", "ive", ":", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "pyq", "rna", "tiv", "e", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bad", "g", ".", "us", " ", "shou", "ld", " ", "have", " ", "this", " ", "in", " ", "vendor", "-", "local_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "QR", "Nat", "ive_", "import_", "QR", "Code_", ",_", "QR", "Error", "Correct", "Level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Good", "-", "eno", "ugh", " ", "settings", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "claim", "\\u", "url_", ")_", "<_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "3_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "claim", "\\u", "url_", ")_", "<_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "4_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "10_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qr_", "._", "add", "Data_", "(_", "claim", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "make_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "=_", "Image", "Reader_", "(_", "qr_", "._", "make", "Image_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "#", " ", "Hm", "m", ",", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "Py", "QR", "Nat", "ive", ",", " ", "then", " ", "try", " ", "abu", "sing", " ", "this", " ", "web_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "service", ".", " ", "Sho", "ul", "d", " ", "be", " ", "fine", " ", "for", " ", "low", " ", "volume", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr", "\\u", "url_", "=_", "(_", "\"", "http", "://", "api", ".", "qr", "server", ".", "com", "/", "v1", "/", "create", "-", "qr", "-", "code", "/?", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "size", "'_", ":_", "'%", "sx", "%", "s", "'_", "%_", "(_", "500_", ",_", "500_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "claim", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "img_", "=_", "Image", "Reader_", "(_", "String", "IO_", "(_", "urllib2_", "._", "urlopen_", "(_", "qr", "\\u", "url_", ")_", "._", "read_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "issue", "s", " ", "in", " ", "drawing", " ", "the", " ", "QR", " ", "code", " ", "-", " ", "may", "be", " ", "show", " ", "an", " ", "error", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "qr", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "draw", "Image_", "(_", "qr", "\\u", "img_", ",_", "qr", "\\u", "left_", ",_", "qr", "\\u", "bottom_", ",_", "qr", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "draw", "Image_", "(_", "badge", "\\u", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "*_", "inch_", ",_", "0.0_", "*_", "inch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "badge", "\\u", "image", "\\u", "height_", ")_", "\\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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ui/django-post_office/post_office/south_migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'post_office.email': {\n 'Meta': {'ordering': \"('-created',)\", 'object_name': 'Email'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 2, 17, 0, 0)', 'db_index': 'True'}),\n 'from_email': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n 'html_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'priority': ('django.db.models.fields.PositiveSmallIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),\n 'subject': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'to': ('django.db.models.fields.EmailField', [], {'max_length': '254'})\n },\n 'post_office.emailtemplate': {\n 'Meta': {'ordering': \"('name',)\", 'object_name': 'EmailTemplate'},\n 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 2, 17, 0, 0)'}),\n 'html_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 2, 17, 0, 0)'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'subject': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})\n },\n 'post_office.log': {\n 'Meta': {'ordering': \"('-date',)\", 'object_name': 'Log'},\n 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 2, 17, 0, 0)', 'db_index': 'True'}),\n 'email': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'logs'\", 'to': \"orm['post_office.Email']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'message': ('django.db.models.fields.TextField', [], {}),\n 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'db_index': 'True'})\n }\n }\n\n complete_apps = ['post_office']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'Email'\n db.create_table('post_office_email', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('from_email', self.gf('django.db.models.fields.CharField')(max_length=254)),\n ('to', self.gf('django.db.models.fields.EmailField')(max_length=254)),\n ('subject', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),\n ('message', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('html_message', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('status', self.gf('django.db.models.fields.PositiveSmallIntegerField')(db_index=True, null=True, blank=True)),\n ('priority', self.gf('django.db.models.fields.PositiveSmallIntegerField')(db_index=True, null=True, blank=True)),\n ('created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 2, 17, 0, 0), db_index=True)),\n ('last_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, db_index=True, blank=True)),\n ))\n db.send_create_signal('post_office', ['Email'])\n\n # Adding model 'Log'\n db.create_table('post_office_log', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('email', self.gf('django.db.models.fields.related.ForeignKey')(related_name='logs', to=orm['post_office.Email'])),\n ('date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 2, 17, 0, 0), db_index=True)),\n ('status', self.gf('django.db.models.fields.PositiveSmallIntegerField')(db_index=True)),\n ('message', self.gf('django.db.models.fields.TextField')()),\n ))\n db.send_create_signal('post_office', ['Log'])\n\n # Adding model 'EmailTemplate'\n db.create_table('post_office_emailtemplate', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('subject', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),\n ('content', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('html_content', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 2, 17, 0, 0))),\n ('last_updated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 2, 17, 0, 0))),\n ))\n db.send_create_signal('post_office', ['EmailTemplate'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting model 'Email'\n db.delete_table('post_office_email')\n\n # Deleting model 'Log'\n db.delete_table('post_office_log')\n\n # Deleting model 'EmailTemplate'\n db.delete_table('post_office_emailtemplate')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "office", ".", "email", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'-", "created", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ema", "il", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", "(", "2013", ",", " ", "2", ",", " ", "1", "7", ",", " ", "0", ",", " ", "0", ")'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "\\u", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "\\u", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "office", ".", "email", "template", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ema", "il", "Templa", "te", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", "(", "2013", ",", " ", "2", ",", " ", "1", "7", ",", " ", "0", ",", " ", "0", ")'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "\\u", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", "(", "2013", ",", " ", "2", ",", " ", "1", "7", ",", " ", "0", ",", " ", "0", ")'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "office", ".", "log", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'-", "date", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Log", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", "(", "2013", ",", " ", "2", ",", " ", "1", "7", ",", " ", "0", ",", " ", "0", ")'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "logs", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "post", "\\u", "office", ".", "Ema", "il", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "post", "\\u", "office", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Ema", "il", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "email", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "from", "\\u", "email", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "254_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "to", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "254_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "subject", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "message", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "html", "\\u", "message", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "status", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "priorit", "y", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "(_", "2013_", ",_", "2_", ",_", "17_", ",_", "0_", ",_", "0_", ")_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "last", "\\u", "update", "d", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "post", "\\u", "office", "'_", ",_", "[_", "'", "Ema", "il", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Log", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "log", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "email", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "logs", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "post", "\\u", "office", ".", "Ema", "il", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "(_", "2013_", ",_", "2_", ",_", "17_", ",_", "0_", ",_", "0_", ")_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "status", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "message", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "post", "\\u", "office", "'_", ",_", "[_", "'", "Log", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Ema", "il", "Templa", "te", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "email", "template", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "subject", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "html", "\\u", "content", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "(_", "2013_", ",_", "2_", ",_", "17_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "last", "\\u", "update", "d", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "(_", "2013_", ",_", "2_", ",_", "17_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "post", "\\u", "office", "'_", ",_", "[_", "'", "Ema", "il", "Templa", "te", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Ema", "il", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "email", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Log", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Ema", "il", "Templa", "te", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "post", "\\u", "office", "\\u", "email", "template", "'_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
agiliq/merchant/billing/forms/braintree_payments_forms.py
[ { "content": "from django import forms\nfrom django.conf import settings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BraintreePaymentsForm(forms.Form):\n transaction__customer__first_name = forms.CharField(max_length=50, required=False)\n transaction__customer__last_name = forms.CharField(max_length=50, required=False)\n transaction__customer__company = forms.CharField(max_length=100, required=False)\n transaction__customer__email = forms.EmailField(required=False)\n transaction__customer__phone = forms.CharField(max_length=15, required=False)\n transaction__customer__fax = forms.CharField(max_length=15, required=False)\n transaction__customer__website = forms.URLField(required=False)\n transaction__credit_card__cardholder_name = forms.CharField(max_length=100)\n transaction__credit_card__number = forms.CharField()\n transaction__credit_card__cvv = forms.CharField(max_length=4)\n transaction__credit_card__expiration_date = forms.CharField(max_length=7)\n\n transaction__billing__first_name = forms.CharField(max_length=50, required=False)\n transaction__billing__last_name = forms.CharField(max_length=50, required=False)\n transaction__billing__company = forms.CharField(max_length=100, required=False)\n transaction__billing__street_address = forms.CharField(widget=forms.Textarea(), required=False)\n transaction__billing__extended_address = forms.CharField(widget=forms.Textarea(), required=False)\n transaction__billing__locality = forms.CharField(max_length=50, required=False)\n transaction__billing__region = forms.CharField(max_length=50, required=False)\n transaction__billing__postal_code = forms.CharField(max_length=10, required=False)\n transaction__billing__country_code_alpha2 = forms.CharField(max_length=2, required=False)\n transaction__billing__country_code_alpha3 = forms.CharField(max_length=3, required=False)\n transaction__billing__country_code_numeric = forms.IntegerField(required=False, min_value=0)\n transaction__billing__country_name = forms.CharField(max_length=50, required=False)\n\n transaction__shipping__first_name = forms.CharField(max_length=50, required=False)\n transaction__shipping__last_name = forms.CharField(max_length=50, required=False)\n transaction__shipping__company = forms.CharField(max_length=100, required=False)\n transaction__shipping__street_address = forms.CharField(widget=forms.Textarea(), required=False)\n transaction__shipping__extended_address = forms.CharField(widget=forms.Textarea(), required=False)\n transaction__shipping__locality = forms.CharField(max_length=50, required=False)\n transaction__shipping__region = forms.CharField(max_length=50, required=False)\n transaction__shipping__postal_code = forms.CharField(max_length=10, required=False)\n transaction__shipping__country_code_alpha2 = forms.CharField(max_length=2, required=False)\n transaction__shipping__country_code_alpha3 = forms.CharField(max_length=3, required=False)\n transaction__shipping__country_code_numeric = forms.IntegerField(required=False, min_value=0)\n transaction__shipping__country_name = forms.CharField(max_length=50, required=False)\n\n transaction__options__add_billing_address_to_payment_method = forms.BooleanField(required=False)\n transaction__options__store_shipping_address_in_vault = forms.BooleanField(required=False)\n transaction__options__store_in_vault_on_success = forms.BooleanField(required=False)\n transaction__options__submit_for_settlement = forms.BooleanField(required=False)\n\n transaction__type = forms.CharField(max_length=10)\n transaction__amount = forms.DecimalField(required=False)\n transaction__order_id = forms.CharField(max_length=50)\n transaction__customer__id = forms.CharField(max_length=50, required=False)\n transaction__credit_card__token = forms.CharField(max_length=50, required=False)\n transaction__payment_method_token = forms.CharField(max_length=50, required=False)\n\n tr_data = forms.CharField(widget=forms.HiddenInput())", "metadata": "root.BraintreePaymentsForm", "header": "['module', '___EOS___']", "index": 4 } ]
[ { "span": "from django.conf import settings", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Brain", "tree", "Payment", "s", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transaction", "\\u\\u", "customer", "\\u\\u", "first", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "last", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "company_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "email_", "=_", "forms_", "._", "Ema", "il", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "phone_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "15_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "fax", "_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "15_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "website_", "=_", "forms_", "._", "URL", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "credit", "\\u", "card", "\\u\\u", "card", "holder", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "credit", "\\u", "card", "\\u\\u", "number_", "=_", "forms_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "credit", "\\u", "card", "\\u\\u", "cv", "v_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "credit", "\\u", "card", "\\u\\u", "expir", "ation", "\\u", "date_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "first", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "last", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "company_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "street", "\\u", "address_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", "(_", ")_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "extend", "ed", "\\u", "address_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", "(_", ")_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "locality", "_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "region_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "postal", "\\u", "code_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "10_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "alpha", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "2_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "alpha", "3_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "numeric_", "=_", "forms_", "._", "Integer", "Field_", "(_", "required_", "=_", "False_", ",_", "min", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "bill", "ing", "\\u\\u", "countr", "y", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "first", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "last", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "company_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "street", "\\u", "address_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", "(_", ")_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "extend", "ed", "\\u", "address_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", "(_", ")_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "locality", "_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "region_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "postal", "\\u", "code_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "10_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "alpha", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "2_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "alpha", "3_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "countr", "y", "\\u", "code", "\\u", "numeric_", "=_", "forms_", "._", "Integer", "Field_", "(_", "required_", "=_", "False_", ",_", "min", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "shipping", "\\u\\u", "countr", "y", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transaction", "\\u\\u", "options", "\\u\\u", "add", "\\u", "bill", "ing", "\\u", "address", "\\u", "to", "\\u", "pay", "ment", "\\u", "method_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "options", "\\u\\u", "store", "\\u", "shipping", "\\u", "address", "\\u", "in", "\\u", "vault_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "options", "\\u\\u", "store", "\\u", "in", "\\u", "vau", "lt", "\\u", "on", "\\u", "success_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "options", "\\u\\u", "submit", "\\u", "for", "\\u", "settlement", "_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transaction", "\\u\\u", "type_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "amount_", "=_", "forms_", "._", "Deci", "mal", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "order", "\\u", "id_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "customer", "\\u\\u", "id_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "credit", "\\u", "card", "\\u\\u", "token_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u\\u", "pay", "ment", "\\u", "method", "\\u", "token_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tr", "\\u", "data_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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 ]
Variable defined multiple times
enthought/comtypes/comtypes/automation.py
[ { "content": " def __getitem__(self, index):\n if index != 0:\n raise IndexError(index)\n if self.vt == VT_BYREF|VT_VARIANT:\n v = VARIANT()\n # apparently VariantCopyInd doesn't work always with\n # VT_BYREF|VT_VARIANT, so do it manually.\n v = cast(self._.c_void_p, POINTER(VARIANT))[0]\n return v.value\n else:\n v = VARIANT()\n _VariantCopyInd(v, self)\n return v.value", "metadata": "root.tagVARIANT.__getitem__", "header": "['class', 'tagVARIANT', '(', 'Structure', ')', ':', '___EOS___']", "index": 461 } ]
[ { "span": "v ", "start_line": 465, "start_column": 12, "end_line": 465, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "tag", "VARIAN", "T_", "(_", "Structure_", ")_", ":_", "\\u\\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", "getitem\\u\\u_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt_", "==_", "VT", "\\u", "BY", "REF_", "|_", "VT", "\\u", "VARIAN", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "VARIAN", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "appare", "ntl", "y", " ", "Varia", "nt", "Copy", "Ind", " ", "doe", "sn", "'", "t", " ", "work", " ", "alw", "ay", "s", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "VT", "\\u", "BY", "REF", "|", "VT", "\\u", "VARIAN", "T", ",", " ", "so", " ", "do", " ", "it", " ", "manu", "ally", "._", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "cast_", "(_", "self_", "._", "\\u_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "POINTER_", "(_", "VARIAN", "T_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v_", "._", "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 ", " _", "v_", "=_", "VARIAN", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Varia", "nt", "Copy", "Ind_", "(_", "v_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v_", "._", "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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
osrg/ryu/ryu/cmd/of_config_cli.py
[ { "content": " def _request(self, line, f):\n args = line.split()\n try:\n peer = args[0]\n except:\n print(\"argument error\")\n return\n try:\n p = peers[peer]\n except KeyError:\n print(\"unknown peer %s\" % peer)\n return\n try:\n f(p, args[1:])\n except RPCError as e:\n print(\"RPC Error %s\" % e)\n except EOFError:\n print(\"disconnected\")", "metadata": "root.Cmd._request", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 82 }, { "content": " def do_raw_get_config(self, line):\n \"\"\"raw_get_config <peer> <source>\n \"\"\"\n\n def f(p, args):\n try:\n source = args[0]\n except:\n print(\"argument error\")\n return\n result = p.raw_get_config(source)\n tree = ET.fromstring(result)\n validate(tree)\n print(et_tostring_pp(tree))\n\n self._request(line, f)", "metadata": "root.Cmd.do_raw_get_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 128 }, { "content": " def do_get_config(self, line):\n \"\"\"get_config <peer> <source>\n eg. get_config sw1 startup\n \"\"\"\n\n def f(p, args):\n try:\n source = args[0]\n except:\n print(\"argument error\")\n return\n print(p.get_config(source))\n\n self._request(line, f)", "metadata": "root.Cmd.do_get_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 175 }, { "content": " def do_delete_config(self, line):\n \"\"\"delete_config <peer> <source>\n eg. delete_config sw1 startup\n \"\"\"\n\n def f(p, args):\n try:\n source = args[0]\n except:\n print(\"argument error\")\n return\n print(p.delete_config(source))\n\n self._request(line, f)", "metadata": "root.Cmd.do_delete_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 190 }, { "content": " def do_copy_config(self, line):\n \"\"\"copy_config <peer> <source> <target>\n eg. copy_config sw1 running startup\n \"\"\"\n\n def f(p, args):\n try:\n source, target = args\n except:\n print(\"argument error\")\n return\n print(p.copy_config(source, target))\n\n self._request(line, f)", "metadata": "root.Cmd.do_copy_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 205 }, { "content": " def do_get_port_config(self, line):\n \"\"\"get_config_port <peer> <source> <port>\n eg. get_port_config sw1 running LogicalSwitch7-Port2\n \"\"\"\n\n def f(p, args):\n try:\n source, port = args\n except:\n print(\"argument error\")\n return\n o = p.get_config(source)\n for p in o.resources.port:\n if p.resource_id != port:\n continue\n print(p.resource_id)\n conf = p.configuration\n for k in self._port_settings:\n try:\n v = getattr(conf, k)\n except AttributeError:\n continue\n print('%s %s' % (k, v))\n\n self._request(line, f)", "metadata": "root.Cmd.do_get_port_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 238 }, { "content": " def do_set_port_config(self, line):\n \"\"\"set_port_config <peer> <target> <port> <key> <value>\n eg. set_port_config sw1 running LogicalSwitch7-Port2 admin-state down\n eg. set_port_config sw1 running LogicalSwitch7-Port2 no-forward false\n \"\"\"\n\n def f(p, args):\n try:\n target, port, key, value = args\n except:\n print(\"argument error\")\n print(args)\n return\n\n # get switch id\n o = p.get()\n capable_switch_id = o.id\n\n try:\n capable_switch = ofc.OFCapableSwitchType(\n id=capable_switch_id,\n resources=ofc.OFCapableSwitchResourcesType(\n port=[\n ofc.OFPortType(\n resource_id=port,\n configuration=ofc.OFPortConfigurationType(\n **{key: value}))\n ]\n )\n )\n except TypeError:\n print(\"argument error\")\n return\n try:\n p.edit_config(target, capable_switch)\n except Exception as e:\n print(e)\n\n self._request(line, f)", "metadata": "root.Cmd.do_set_port_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 264 }, { "content": " def do_get_queue_config(self, line):\n \"\"\"get_queue_port <peer> <source> <queue>\n eg. get_queue_config sw1 running LogicalSwitch7-Port1-Queue922\n \"\"\"\n\n def f(p, args):\n try:\n source, queue = args\n except:\n print(\"argument error\")\n return\n o = p.get_config(source)\n for q in o.resources.queue:\n if q.resource_id != queue:\n continue\n print(q.resource_id)\n conf = q.properties\n for k in self._queue_settings:\n try:\n v = getattr(conf, k)\n except AttributeError:\n continue\n print('%s %s' % (k, v))\n\n self._request(line, f)", "metadata": "root.Cmd.do_get_queue_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 322 }, { "content": " def do_set_queue_config(self, line):\n \"\"\"set_queue_config <peer> <target> <queue> <key> <value>\n eg. set_queue_config sw1 running LogicalSwitch7-Port1-Queue922 \\\nmax-rate 100\n \"\"\"\n\n def f(p, args):\n try:\n target, queue, key, value = args\n except:\n print(\"argument error\")\n print(args)\n return\n\n # get switch id\n o = p.get()\n capable_switch_id = o.id\n\n try:\n capable_switch = ofc.OFCapableSwitchType(\n id=capable_switch_id,\n resources=ofc.OFCapableSwitchResourcesType(\n queue=[\n ofc.OFQueueType(\n resource_id=queue,\n properties=ofc.OFQueuePropertiesType(\n **{key: value})),\n ]\n )\n )\n except TypeError:\n print(\"argument error\")\n return\n try:\n p.edit_config(target, capable_switch)\n except Exception as e:\n print(e)\n\n self._request(line, f)", "metadata": "root.Cmd.do_set_queue_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 348 }, { "content": " def do_add_queue(self, line):\n \"\"\"add_queue <peer> <target> <logical-switch> <queue>\n eg. add_queue sw1 running LogicalSwitch7 NameOfNewQueue\n \"\"\"\n\n def f(p, args):\n try:\n target, lsw, queue = args\n except:\n print(\"argument error\")\n print(args)\n return\n\n # get switch id\n o = p.get()\n capable_switch_id = o.id\n\n try:\n capable_switch = ofc.OFCapableSwitchType(\n id=capable_switch_id,\n resources=ofc.OFCapableSwitchResourcesType(\n queue=[\n ofc.OFQueueType(resource_id=queue)\n ]\n ),\n logical_switches=ofc.OFCapableSwitchLogicalSwitchesType(\n switch=[ofc.OFLogicalSwitchType(\n id=lsw,\n resources=ofc.OFLogicalSwitchResourcesType(\n queue=[queue])\n )]\n )\n )\n except TypeError:\n print(\"argument error\")\n return\n try:\n p.edit_config(target, capable_switch)\n except Exception as e:\n print(e)\n\n self._request(line, f)", "metadata": "root.Cmd.do_add_queue", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 388 }, { "content": " def do_show_logical_switch(self, line):\n \"\"\"show_logical_switch <peer> <logical switch>\n \"\"\"\n\n def f(p, args):\n try:\n (lsw,) = args\n except:\n print(\"argument error\")\n return\n o = p.get()\n for s in o.logical_switches.switch:\n if s.id != lsw:\n continue\n print(s.id)\n print('datapath-id %s' % s.datapath_id)\n if s.resources.queue:\n print('queues:')\n for q in s.resources.queue:\n print('\\t %s' % q)\n if s.resources.port:\n print('ports:')\n for p in s.resources.port:\n print('\\t %s' % p)\n\n self._request(line, f)", "metadata": "root.Cmd.do_show_logical_switch", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 442 }, { "content": " def do_get_logical_switch_config(self, line):\n \"\"\"get_logical_switch_config <peer> <source> <logical switch>\n \"\"\"\n\n def f(p, args):\n try:\n source, lsw = args\n except:\n print(\"argument error\")\n return\n o = p.get_config(source)\n for l in o.logical_switches.switch:\n if l.id != lsw:\n continue\n print(l.id)\n for k in self._lsw_settings:\n try:\n v = getattr(l, k)\n except AttributeError:\n continue\n print('%s %s' % (k, v))\n\n self._request(line, f)", "metadata": "root.Cmd.do_get_logical_switch_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 473 }, { "content": " def do_set_logical_switch_config(self, line):\n \"\"\"set_logical_switch_config <peer> <logical switch> <key> <value>\n eg. set_logical_switch_config sw1 running LogicalSwitch7 \\\nlost-connection-behavior failStandaloneMode\n \"\"\"\n\n def f(p, args):\n try:\n target, lsw, key, value = args\n except:\n print(\"argument error\")\n return\n\n # get switch id\n o = p.get_config(target)\n capable_switch_id = o.id\n\n try:\n capable_switch = ofc.OFCapableSwitchType(\n id=capable_switch_id,\n logical_switches=ofc.OFCapableSwitchLogicalSwitchesType(\n switch=[ofc.OFLogicalSwitchType(\n id=lsw,\n **{key: value}\n )]\n )\n )\n except TypeError:\n print(\"argument error\")\n return\n try:\n p.edit_config(target, capable_switch)\n except Exception as e:\n print(e)\n\n self._request(line, f)", "metadata": "root.Cmd.do_set_logical_switch_config", "header": "['class', 'Cmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 497 } ]
[ { "span": "except:", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 15 }, { "span": "except:", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 19 }, { "span": "except:", "start_line": 183, "start_column": 12, "end_line": 183, "end_column": 19 }, { "span": "except:", "start_line": 198, "start_column": 12, "end_line": 198, "end_column": 19 }, { "span": "except:", "start_line": 213, "start_column": 12, "end_line": 213, "end_column": 19 }, { "span": "except:", "start_line": 246, "start_column": 12, "end_line": 246, "end_column": 19 }, { "span": "except:", "start_line": 273, "start_column": 12, "end_line": 273, "end_column": 19 }, { "span": "except:", "start_line": 330, "start_column": 12, "end_line": 330, "end_column": 19 }, { "span": "except:", "start_line": 357, "start_column": 12, "end_line": 357, "end_column": 19 }, { "span": "except:", "start_line": 396, "start_column": 12, "end_line": 396, "end_column": 19 }, { "span": "except:", "start_line": 449, "start_column": 12, "end_line": 449, "end_column": 19 }, { "span": "except:", "start_line": 480, "start_column": 12, "end_line": 480, "end_column": 19 }, { "span": "except:", "start_line": 506, "start_column": 12, "end_line": 506, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "request_", "(_", "self_", ",_", "line_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "p_", "=_", "peers_", "[_", "peer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "unknown", " ", "peer", " ", "%", "s", "\"_", "%_", "peer_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "f_", "(_", "p_", ",_", "args_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "RP", "CE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "RP", "C", " ", "Error", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\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 ", " _", "print_", "(_", "\"", "disconnected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "raw", "\\u", "get", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "raw", "\\u", "get", "\\u", "config", " ", "<", "peer", ">", " ", "<", "source", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "p_", "._", "raw", "\\u", "get", "\\u", "config_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "ET_", "._", "fromstring_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validate_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "et", "\\u", "tost", "ring", "\\u", "pp_", "(_", "tree_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "\\u", "config", " ", "<", "peer", ">", " ", "<", "source", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "get", "\\u", "config", " ", "sw", "1", " ", "start", "up", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "p_", "._", "get", "\\u", "config_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "delete", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "delete", "\\u", "config", " ", "<", "peer", ">", " ", "<", "source", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "delete", "\\u", "config", " ", "sw", "1", " ", "start", "up", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "p_", "._", "delete", "\\u", "config_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "copy", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "copy", "\\u", "config", " ", "<", "peer", ">", " ", "<", "source", ">", " ", "<", "target", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "copy", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "start", "up", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", ",_", "target_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "p_", "._", "copy", "\\u", "config_", "(_", "source_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "port", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "\\u", "config", "\\u", "port", " ", "<", "peer", ">", " ", "<", "source", ">", " ", "<", "port", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "get", "\\u", "port", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", "-", "Port", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", ",_", "port_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get", "\\u", "config_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "o_", "._", "resources_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "._", "resource", "\\u", "id_", "!=_", "port_", ":_", "\\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_", "print_", "(_", "p_", "._", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "p_", "._", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "self_", "._", "\\u", "port", "\\u", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "getattr_", "(_", "conf_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "k_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "set\\u", "port", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set\\u", "port", "\\u", "config", " ", "<", "peer", ">", " ", "<", "target", ">", " ", "<", "port", ">", " ", "<", "key", ">", " ", "<", "value", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "set\\u", "port", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", "-", "Port", "2", " ", "admin", "-", "state", " ", "down", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "set\\u", "port", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", "-", "Port", "2", " ", "no", "-", "forward", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "target_", ",_", "port_", ",_", "key_", ",_", "value_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "switch", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capable", "\\u", "switch", "\\u", "id_", "=_", "o_", "._", "id_", "\\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 ", " _", "capable", "\\u", "switch_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "capable", "\\u", "switch", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Reso", "urc", "es", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "ofc", "_", "._", "OFP", "ort", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "id_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "configuration_", "=_", "ofc", "_", "._", "OFP", "ort", "Configura", "tion", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "{_", "key_", ":_", "value_", "}_", ")_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "p_", "._", "edit", "\\u", "config_", "(_", "target_", ",_", "capable", "\\u", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "queue", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "\\u", "queue", "\\u", "port", " ", "<", "peer", ">", " ", "<", "source", ">", " ", "<", "queue", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "get", "\\u", "queue", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", "-", "Port", "1", "-", "Queue", "922", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", ",_", "queue_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get", "\\u", "config_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q_", "in_", "o_", "._", "resources_", "._", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "q_", "._", "resource", "\\u", "id_", "!=_", "queue_", ":_", "\\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_", "print_", "(_", "q_", "._", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "q_", "._", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "self_", "._", "\\u", "queue", "\\u", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "getattr_", "(_", "conf_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "k_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "set\\u", "queue", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set\\u", "queue", "\\u", "config", " ", "<", "peer", ">", " ", "<", "target", ">", " ", "<", "queue", ">", " ", "<", "key", ">", " ", "<", "value", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "set\\u", "queue", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", "-", "Port", "1", "-", "Queue", "922", " ", "\\\\", "\\", "10", ";", "max", "-", "rate", " ", "100", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "target_", ",_", "queue_", ",_", "key_", ",_", "value_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "switch", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capable", "\\u", "switch", "\\u", "id_", "=_", "o_", "._", "id_", "\\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 ", " _", "capable", "\\u", "switch_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "capable", "\\u", "switch", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Reso", "urc", "es", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "ofc", "_", "._", "OF", "Queue", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "id_", "=_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "properties_", "=_", "ofc", "_", "._", "OF", "Queue", "Proper", "ties", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "{_", "key_", ":_", "value_", "}_", ")_", ")_", ",_", "\\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\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "p_", "._", "edit", "\\u", "config_", "(_", "target_", ",_", "capable", "\\u", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "add", "\\u", "queue_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "add", "\\u", "queue", " ", "<", "peer", ">", " ", "<", "target", ">", " ", "<", "logical", "-", "switch", ">", " ", "<", "queue", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "add", "\\u", "queue", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", " ", "Name", "Of", "New", "Queue", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "target_", ",_", "ls", "w_", ",_", "queue_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "switch", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capable", "\\u", "switch", "\\u", "id_", "=_", "o_", "._", "id_", "\\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 ", " _", "capable", "\\u", "switch_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "capable", "\\u", "switch", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Reso", "urc", "es", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "ofc", "_", "._", "OF", "Queue", "Type_", "(_", "resource", "\\u", "id_", "=_", "queue_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logical", "\\u", "switches_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Logi", "cal", "Switche", "s", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "switch_", "=_", "[_", "ofc", "_", "._", "OF", "Logi", "cal", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "ls", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "ofc", "_", "._", "OF", "Logi", "cal", "Switch", "Reso", "urc", "es", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "[_", "queue_", "]_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "p_", "._", "edit", "\\u", "config_", "(_", "target_", ",_", "capable", "\\u", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "show", "\\u", "logical", "\\u", "switch_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "show", "\\u", "logical", "\\u", "switch", " ", "<", "peer", ">", " ", "<", "logical", " ", "switch", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "(_", "ls", "w_", ",_", ")_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "o_", "._", "logical", "\\u", "switches_", "._", "switch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "id_", "!=_", "ls", "w_", ":_", "\\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_", "print_", "(_", "s_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "datapath", "-", "id", " ", "%", "s", "'_", "%_", "s_", "._", "datapath", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "resources_", "._", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "queue", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q_", "in_", "s_", "._", "resources_", "._", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'\\\\", "t", " ", "%", "s", "'_", "%_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "resources_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "port", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "s_", "._", "resources_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'\\\\", "t", " ", "%", "s", "'_", "%_", "p_", ")_", "\\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_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "logical", "\\u", "switch", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "\\u", "logical", "\\u", "switch", "\\u", "config", " ", "<", "peer", ">", " ", "<", "source", ">", " ", "<", "logical", " ", "switch", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "source_", ",_", "ls", "w_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get", "\\u", "config_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "o_", "._", "logical", "\\u", "switches_", "._", "switch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "id_", "!=_", "ls", "w_", ":_", "\\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_", "print_", "(_", "l_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "self_", "._", "\\u", "ls", "w", "\\u", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "getattr_", "(_", "l_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "k_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request_", "(_", "line_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "set\\u", "logical", "\\u", "switch", "\\u", "config_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set\\u", "logical", "\\u", "switch", "\\u", "config", " ", "<", "peer", ">", " ", "<", "logical", " ", "switch", ">", " ", "<", "key", ">", " ", "<", "value", ">", "\\", "10", ";", " ", " ", " ", " ", "eg", ".", " ", "set\\u", "logical", "\\u", "switch", "\\u", "config", " ", "sw", "1", " ", "runn", "ing", " ", "Logi", "cal", "Switch", "7", " ", "\\\\", "\\", "10", ";", "lost", "-", "connecti", "on", "-", "behavior", " ", "fail", "Stand", "alo", "ne", "Mode", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "f_", "(_", "p_", ",_", "args_", ")_", ":_", "\\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 ", " _", "target_", ",_", "ls", "w_", ",_", "key_", ",_", "value_", "=_", "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 ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "switch", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "p_", "._", "get", "\\u", "config_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capable", "\\u", "switch", "\\u", "id_", "=_", "o_", "._", "id_", "\\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 ", " _", "capable", "\\u", "switch_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "capable", "\\u", "switch", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logical", "\\u", "switches_", "=_", "ofc", "_", "._", "OF", "Capa", "ble", "Switch", "Logi", "cal", "Switche", "s", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "switch_", "=_", "[_", "ofc", "_", "._", "OF", "Logi", "cal", "Switch", "Type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "ls", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "{_", "key_", ":_", "value_", "}_", "\\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\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "argu", "ment", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "p_", "._", "edit", "\\u", "config_", "(_", "target_", ",_", "capable", "\\u", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
weblabdeusto/weblabdeusto/server/src/test/unit/weblab/core/test_server.py
[ { "content": " def test_list_experiments(self):\n # student1\n db_sess_id1 = ValidDatabaseSessionId('student1', \"student\")\n sess_id1, _ = self.ups._reserve_session(db_sess_id1)\n\n with wlcontext(self.ups, session_id = sess_id1):\n experiments = core_api.list_experiments()\n\n self.assertLessEqual(5, len(experiments) )\n\n experiment_names = list(( experiment.experiment.name for experiment in experiments ))\n self.assertTrue( 'ud-dummy' in experiment_names )\n self.assertTrue( 'ud-logic' in experiment_names )\n self.assertTrue( 'ud-fpga' in experiment_names )\n self.assertTrue( 'flashdummy' in experiment_names )\n self.assertTrue( 'javadummy' in experiment_names )\n\n core_api.logout()\n\n # student2\n db_sess_id2 = ValidDatabaseSessionId('student2', \"student\")\n sess_id2, _ = self.ups._reserve_session(db_sess_id2)\n\n with wlcontext(self.ups, session_id = sess_id2):\n experiments = core_api.list_experiments()\n self.assertEquals(7, len(experiments) )\n\n experiment_names = list(( experiment.experiment.name for experiment in experiments ))\n self.assertTrue( 'ud-dummy' in experiment_names )\n self.assertTrue( 'ud-fpga' in experiment_names )\n self.assertTrue( 'ud-pld' in experiment_names )\n self.assertTrue( 'ud-gpib' in experiment_names )\n self.assertTrue( 'ud-logic' in experiment_names )\n self.assertTrue( 'javadummy' in experiment_names )\n self.assertTrue( 'flashdummy' in experiment_names )\n\n core_api.logout()", "metadata": "root.UserProcessingServerTestCase.test_list_experiments", "header": "['class', 'UserProcessingServerTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 107 } ]
[ { "span": "self.assertTrue( 'ud-dummy' in experiment_names )", "start_line": 118, "start_column": 12, "end_line": 118, "end_column": 61 }, { "span": "self.assertTrue( 'ud-logic' in experiment_names )", "start_line": 119, "start_column": 12, "end_line": 119, "end_column": 61 }, { "span": "self.assertTrue( 'ud-fpga' in experiment_names )", "start_line": 120, "start_column": 12, "end_line": 120, "end_column": 60 }, { "span": "self.assertTrue( 'flashdummy' in experiment_names )", "start_line": 121, "start_column": 12, "end_line": 121, "end_column": 63 }, { "span": "self.assertTrue( 'javadummy' in experiment_names )", "start_line": 122, "start_column": 12, "end_line": 122, "end_column": 62 }, { "span": "self.assertTrue( 'ud-dummy' in experiment_names )", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 61 }, { "span": "self.assertTrue( 'ud-fpga' in experiment_names )", "start_line": 136, "start_column": 12, "end_line": 136, "end_column": 60 }, { "span": "self.assertTrue( 'ud-pld' in experiment_names )", "start_line": 137, "start_column": 12, "end_line": 137, "end_column": 59 }, { "span": "self.assertTrue( 'ud-gpib' in experiment_names )", "start_line": 138, "start_column": 12, "end_line": 138, "end_column": 60 }, { "span": "self.assertTrue( 'ud-logic' in experiment_names )", "start_line": 139, "start_column": 12, "end_line": 139, "end_column": 61 }, { "span": "self.assertTrue( 'javadummy' in experiment_names )", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 62 }, { "span": "self.assertTrue( 'flashdummy' in experiment_names )", "start_line": 141, "start_column": 12, "end_line": 141, "end_column": 63 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "User", "Process", "ing", "Server", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "experiments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "student", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "sess", "\\u", "id1_", "=_", "Valid", "Databa", "se", "Sess", "ion", "Id_", "(_", "'", "student", "1", "'_", ",_", "\"", "student", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess", "\\u", "id1_", ",_", "\\u_", "=_", "self_", "._", "ups_", "._", "\\u", "reserve", "\\u", "session_", "(_", "db", "\\u", "sess", "\\u", "id1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "wl", "context_", "(_", "self_", "._", "ups_", ",_", "session", "\\u", "id_", "=_", "sess", "\\u", "id1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "experiments_", "=_", "core", "\\u", "api_", "._", "list", "\\u", "experiments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Less", "Equal_", "(_", "5_", ",_", "len_", "(_", "experiments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment", "\\u", "names_", "=_", "list_", "(_", "(_", "experiment_", "._", "experiment_", "._", "name_", "for_", "experiment_", "in_", "experiments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "logic", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "fpg", "a", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "flash", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "java", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "core", "\\u", "api_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "student", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db", "\\u", "sess", "\\u", "id2_", "=_", "Valid", "Databa", "se", "Sess", "ion", "Id_", "(_", "'", "student", "2", "'_", ",_", "\"", "student", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess", "\\u", "id2_", ",_", "\\u_", "=_", "self_", "._", "ups_", "._", "\\u", "reserve", "\\u", "session_", "(_", "db", "\\u", "sess", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "wl", "context_", "(_", "self_", "._", "ups_", ",_", "session", "\\u", "id_", "=_", "sess", "\\u", "id2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "experiments_", "=_", "core", "\\u", "api_", "._", "list", "\\u", "experiments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "7_", ",_", "len_", "(_", "experiments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment", "\\u", "names_", "=_", "list_", "(_", "(_", "experiment_", "._", "experiment_", "._", "name_", "for_", "experiment_", "in_", "experiments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "fpg", "a", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "pl", "d", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "gpi", "b", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ud", "-", "logic", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "java", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "flash", "dummy", "'_", "in_", "experiment", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "core", "\\u", "api_", "._", "logout_", "(_", ")_", "\\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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 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mcedit/pymclevel/run_regression_test.py
[ { "content": "#!/usr/bin/env python\n\nimport tempfile\nimport sys\nimport subprocess\nimport shutil\nimport os\nimport hashlib\nimport contextlib\nimport gzip\nimport fnmatch\nimport tarfile\nimport zipfile\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nalpha_tests = [\n (do_test, 'baseline', '2bf250ec4e5dd8bfd73b3ccd0a5ff749569763cf', []),\n (do_test, 'degrief', '2b7eecd5e660f20415413707b4576b1234debfcb', ['degrief']),\n (do_test_match_output, 'analyze', '9cb4aec2ed7a895c3a5d20d6e29e26459e00bd53', ['analyze']),\n (do_test, 'relight', 'f3b3445b0abca1fe2b183bc48b24fb734dfca781', ['relight']),\n (do_test, 'replace', '4e816038f9851817b0d75df948d058143708d2ec', ['replace', 'Water (active)', 'with', 'Lava (active)']),\n (do_test, 'fill', '94566d069edece4ff0cc52ef2d8f877fbe9720ab', ['fill', 'Water (active)']),\n (do_test, 'heightmap', '71c20e7d7e335cb64b3eb0e9f6f4c9abaa09b070', ['heightmap', 'regression_test/mars.png']),\n]\n\nimport optparse\n\nparser = optparse.OptionParser()\nparser.add_option(\"--profile\", help=\"Perform profiling on regression tests\", action=\"store_true\")\n\n\n\n\nif __name__ == '__main__':\n sys.exit(main(sys.argv))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def generate_file_list(directory):\n for dirpath, dirnames, filenames in os.walk(directory):\n for filename in filenames:\n yield os.path.join(dirpath, filename)", "metadata": "root.generate_file_list", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def sha1_file(name, checksum=None):\n CHUNKSIZE = 1024\n if checksum is None:\n checksum = hashlib.sha1()\n if fnmatch.fnmatch(name, \"*.dat\"):\n opener = gzip.open\n else:\n opener = open\n\n with contextlib.closing(opener(name, 'rb')) as data:\n chunk = data.read(CHUNKSIZE)\n while len(chunk) == CHUNKSIZE:\n checksum.update(chunk)\n chunk = data.read(CHUNKSIZE)\n else:\n checksum.update(chunk)\n return checksum", "metadata": "root.sha1_file", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def calculate_result(directory):\n checksum = hashlib.sha1()\n for filename in sorted(generate_file_list(directory)):\n if filename.endswith(\"session.lock\"):\n continue\n sha1_file(filename, checksum)\n return checksum.hexdigest()", "metadata": "root.calculate_result", "header": "['module', '___EOS___']", "index": 40 }, { "content": "@contextlib.contextmanager\ndef temporary_directory(prefix='regr'):\n name = tempfile.mkdtemp(prefix)\n try:\n yield name\n finally:\n shutil.rmtree(name)", "metadata": "root.temporary_directory", "header": "['module', '___EOS___']", "index": 49 }, { "content": "@contextlib.contextmanager\ndef directory_clone(src):\n with temporary_directory('regr') as name:\n subdir = os.path.join(name, \"subdir\")\n shutil.copytree(src, subdir)\n yield subdir", "metadata": "root.directory_clone", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def launch_subprocess(directory, arguments, env=None):\n #my python breaks with an empty environ, i think it wants PATH\n #if sys.platform == \"win32\":\n if env is None:\n env = {}\n\n newenv = {}\n newenv.update(os.environ)\n newenv.update(env)\n\n proc = subprocess.Popen(([\"python.exe\"] if sys.platform == \"win32\" else []) + [\n \"./mce.py\",\n directory] + arguments, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=newenv)\n\n return proc", "metadata": "root.launch_subprocess", "header": "['module', '___EOS___']", "index": 66 }, { "content": "class RegressionError(Exception):\n pass", "metadata": "root.RegressionError", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def do_test(test_data, result_check, arguments=()):\n \"\"\"Run a regression test on the given world.\n\n result_check - sha1 of the recursive tree generated\n arguments - arguments to give to mce.py on execution\n \"\"\"\n result_check = result_check.lower()\n\n env = {\n 'MCE_RANDOM_SEED': '42',\n 'MCE_LAST_PLAYED': '42',\n }\n\n if 'MCE_PROFILE' in os.environ:\n env['MCE_PROFILE'] = os.environ['MCE_PROFILE']\n\n with directory_clone(test_data) as directory:\n proc = launch_subprocess(directory, arguments, env)\n proc.stdin.close()\n proc.wait()\n\n if proc.returncode:\n raise RegressionError(\"Program execution failed!\")\n\n checksum = calculate_result(directory).lower()\n if checksum != result_check.lower():\n raise RegressionError(\"Checksum mismatch: {0!r} != {1!r}\".format(checksum, result_check))\n print \"[OK] (sha1sum of result is {0!r}, as expected)\".format(result_check)", "metadata": "root.do_test", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def do_test_match_output(test_data, result_check, arguments=()):\n result_check = result_check.lower()\n\n env = {\n 'MCE_RANDOM_SEED': '42',\n 'MCE_LAST_PLAYED': '42'\n }\n\n with directory_clone(test_data) as directory:\n proc = launch_subprocess(directory, arguments, env)\n proc.stdin.close()\n output = proc.stdout.read()\n proc.wait()\n\n if proc.returncode:\n raise RegressionError(\"Program execution failed!\")\n\n print \"Output\\n{0}\".format(output)\n\n checksum = hashlib.sha1()\n checksum.update(output)\n checksum = checksum.hexdigest()\n\n if checksum != result_check.lower():\n raise RegressionError(\"Checksum mismatch: {0!r} != {1!r}\".format(checksum, result_check))\n\n print \"[OK] (sha1sum of result is {0!r}, as expected)\".format(result_check)", "metadata": "root.do_test_match_output", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def main(argv):\n options, args = parser.parse_args(argv)\n\n if len(args) <= 1:\n do_these_regressions = ['*']\n else:\n do_these_regressions = args[1:]\n\n with directory_clone(\"testfiles/AnvilWorld\") as directory:\n test_data = directory\n passes = []\n fails = []\n\n for func, name, sha, args in alpha_tests:\n print \"Starting regression {0} ({1})\".format(name, args)\n\n if any(fnmatch.fnmatch(name, x) for x in do_these_regressions):\n if options.profile:\n print >> sys.stderr, \"Starting to profile to %s.profile\" % name\n os.environ['MCE_PROFILE'] = '%s.profile' % name\n try:\n func(test_data, sha, args)\n except RegressionError, e:\n fails.append(\"Regression {0} failed: {1}\".format(name, e))\n print fails[-1]\n else:\n passes.append(\"Regression {0!r} complete.\".format(name))\n print passes[-1]\n\n print \"{0} tests passed.\".format(len(passes))\n for line in fails:\n print line", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 162 } ]
[ { "span": "import tarfile", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 14 }, { "span": "import zipfile", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "alpha", "\\u", "tests_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "baseline", "'_", ",_", "'", "2b", "f2", "50", "ec", "4e", "5d", "d8", "bf", "d7", "3b", "3c", "cd", "0a", "5f", "f7", "495", "697", "6", "3c", "f", "'_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "degr", "ie", "f", "'_", ",_", "'", "2b", "7e", "ecd", "5e", "660", "f2", "041", "541", "370", "7b", "457", "6b", "1234", "deb", "fc", "b", "'_", ",_", "[_", "'", "degr", "ie", "f", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test\\u", "match", "\\u", "output_", ",_", "'", "analyze", "'_", ",_", "'", "9c", "b4", "ae", "c2", "ed", "7a", "895", "c3", "a5", "d2", "0d", "6e", "2", "9e", "264", "5", "9e", "00", "bd", "5", "3", "'_", ",_", "[_", "'", "analyze", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "reli", "ght", "'_", ",_", "'", "f3", "b3", "445", "b0", "abc", "a1", "fe", "2b", "183", "bc", "4", "8b", "24", "fb", "734", "df", "ca", "781", "'_", ",_", "[_", "'", "reli", "ght", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "replace", "'_", ",_", "'", "4e", "816", "038", "f9", "851", "817", "b0", "d7", "5d", "f9", "4", "8d", "058", "143", "708", "d2", "ec", "'_", ",_", "[_", "'", "replace", "'_", ",_", "'", "Water", " ", "(", "active", ")'_", ",_", "'", "with", "'_", ",_", "'", "La", "va", " ", "(", "active", ")'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "fill", "'_", ",_", "'", "945", "6", "6d", "069", "ede", "ce", "4f", "f0", "cc", "5", "2e", "f2", "d8", "f8", "7", "7f", "be", "972", "0a", "b", "'_", ",_", "[_", "'", "fill", "'_", ",_", "'", "Water", " ", "(", "active", ")'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "do", "\\u", "test_", ",_", "'", "height", "map", "'_", ",_", "'", "7", "1c", "20", "e7", "d7", "e3", "3", "5c", "b64", "b3", "eb", "0e", "9", "f6", "f4", "c9", "aba", "a0", "9", "b0", "7", "0", "'_", ",_", "[_", "'", "height", "map", "'_", ",_", "'", "regress", "ion", "\\u", "test", "/", "mars", ".", "png", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "optparse_", "._", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "profile", "\"_", ",_", "help_", "=_", "\"", "Perform", " ", "profiling", " ", "on", " ", "regress", "ion", " ", "tests", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generat", "e\\u", "file", "\\u", "list_", "(_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dirpath_", ",_", "dirnames_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "os_", "._", "path_", "._", "join_", "(_", "dirpath_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sha1", "\\u", "file_", "(_", "name_", ",_", "checksum_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CHUNK", "SIZE_", "=_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "checksum_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checksum_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fnmatch_", "._", "fnmatch_", "(_", "name_", ",_", "\"*", ".", "dat", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opener_", "=_", "gzip_", "._", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opener_", "=_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "opener_", "(_", "name_", ",_", "'", "rb", "'_", ")_", ")_", "as_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "=_", "data_", "._", "read_", "(_", "CHUNK", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "chunk_", ")_", "==_", "CHUNK", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checksum_", "._", "update_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "data_", "._", "read_", "(_", "CHUNK", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checksum_", "._", "update_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "checksum_", "\\u\\u\\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_", "calcul", "ate", "\\u", "result_", "(_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checksum_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filename_", "in_", "sorted_", "(_", "generat", "e\\u", "file", "\\u", "list_", "(_", "directory_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "endswith_", "(_", "\"", "session", ".", "lock", "\"_", ")_", ":_", "\\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_", "sha1", "\\u", "file_", "(_", "filename_", ",_", "checksum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "checksum_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextlib_", "._", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "temporar", "y", "\\u", "directory_", "(_", "prefix_", "=_", "'", "regr", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextlib_", "._", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "director", "y", "\\u", "clone_", "(_", "src_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "temporar", "y", "\\u", "directory_", "(_", "'", "regr", "'_", ")_", "as_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subdir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "name_", ",_", "\"", "subdir", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copytree_", "(_", "src_", ",_", "subdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "subdir_", "\\u\\u\\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_", "launch", "\\u", "subprocess_", "(_", "directory_", ",_", "arguments_", ",_", "env_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "my", " ", "python", " ", "breaks", " ", "with", " ", "an", " ", "empty", " ", "environ", ",", " ", "i", " ", "think", " ", "it", " ", "want", "s", " ", "PATH_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "sys", ".", "platform", " ", "==", " ", "\"", "win32", "\":", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newe", "nv_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "nv_", "._", "update_", "(_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "nv_", "._", "update_", "(_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "(_", "[_", "\"", "python", ".", "exe", "\"_", "]_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", "else_", "[_", "]_", ")_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"./", "mce", ".", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "directory_", "]_", "+_", "arguments_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "env_", "=_", "newe", "nv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "proc_", "\\u\\u\\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_", "Regr", "ession", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "test_", "(_", "test\\u", "data_", ",_", "result", "\\u", "check_", ",_", "arguments_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "a", " ", "regress", "ion", " ", "test", " ", "on", " ", "the", " ", "give", "n", " ", "world", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", "\\u", "check", " ", "-", " ", "sha1", " ", "of", " ", "the", " ", "recurs", "ive", " ", "tree", " ", "generat", "ed", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", " ", "-", " ", "argu", "ment", "s", " ", "to", " ", "give", " ", "to", " ", "mce", ".", "py", " ", "on", " ", "executi", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "check_", "=_", "result", "\\u", "check_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MC", "E", "\\u", "RANDOM", "\\u", "SEED", "'_", ":_", "'", "4", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MC", "E", "\\u", "LAS", "T", "\\u", "PLAY", "ED", "'_", ":_", "'", "4", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "MC", "E", "\\u", "PROFILE", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "'", "MC", "E", "\\u", "PROFILE", "'_", "]_", "=_", "os_", "._", "environ_", "[_", "'", "MC", "E", "\\u", "PROFILE", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "director", "y", "\\u", "clone_", "(_", "test\\u", "data_", ")_", "as_", "directory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "launch", "\\u", "subprocess_", "(_", "directory_", ",_", "arguments_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "stdin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "returncode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Regr", "ession", "Error_", "(_", "\"", "Program", " ", "executi", "on", " ", "fail", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "checksum_", "=_", "calcul", "ate", "\\u", "result_", "(_", "directory_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "checksum_", "!=_", "result", "\\u", "check_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Regr", "ession", "Error_", "(_", "\"", "Checksum", " ", "mism", "atch", ":", " ", "{", "0", "!", "r", "}", " ", "!=", " ", "{", "1", "!", "r", "}\"_", "._", "format_", "(_", "checksum_", ",_", "result", "\\u", "check_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "OK", "]", " ", "(", "sha1", "sum", " ", "of", " ", "result", " ", "is", " ", "{", "0", "!", "r", "},", " ", "as", " ", "expected", ")\"_", "._", "format_", "(_", "result", "\\u", "check_", ")_", "\\u\\u\\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_", "do", "\\u", "test\\u", "match", "\\u", "output_", "(_", "test\\u", "data_", ",_", "result", "\\u", "check_", ",_", "arguments_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "check_", "=_", "result", "\\u", "check_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MC", "E", "\\u", "RANDOM", "\\u", "SEED", "'_", ":_", "'", "4", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MC", "E", "\\u", "LAS", "T", "\\u", "PLAY", "ED", "'_", ":_", "'", "4", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "director", "y", "\\u", "clone_", "(_", "test\\u", "data_", ")_", "as_", "directory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "launch", "\\u", "subprocess_", "(_", "directory_", ",_", "arguments_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "stdin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "proc_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "returncode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Regr", "ession", "Error_", "(_", "\"", "Program", " ", "executi", "on", " ", "fail", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Output", "\\\\", "n", "{", "0", "}\"_", "._", "format_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "checksum_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checksum_", "._", "update_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checksum_", "=_", "checksum_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "checksum_", "!=_", "result", "\\u", "check_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Regr", "ession", "Error_", "(_", "\"", "Checksum", " ", "mism", "atch", ":", " ", "{", "0", "!", "r", "}", " ", "!=", " ", "{", "1", "!", "r", "}\"_", "._", "format_", "(_", "checksum_", ",_", "result", "\\u", "check_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "OK", "]", " ", "(", "sha1", "sum", " ", "of", " ", "result", " ", "is", " ", "{", "0", "!", "r", "},", " ", "as", " ", "expected", ")\"_", "._", "format_", "(_", "result", "\\u", "check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "<=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "these", "\\u", "regress", "ions_", "=_", "[_", "'*'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "these", "\\u", "regress", "ions_", "=_", "args_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "director", "y", "\\u", "clone_", "(_", "\"", "testfile", "s", "/", "An", "vil", "Wor", "ld", "\"_", ")_", "as_", "directory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "data_", "=_", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fails_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "func_", ",_", "name_", ",_", "sha_", ",_", "args_", "in_", "alpha", "\\u", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Start", "ing", " ", "regress", "ion", " ", "{", "0", "}", " ", "({", "1", "})\"_", "._", "format_", "(_", "name_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "any_", "(_", "fnmatch_", "._", "fnmatch_", "(_", "name_", ",_", "x_", ")_", "for_", "x_", "in_", "do", "\\u", "these", "\\u", "regress", "ions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Start", "ing", " ", "to", " ", "profile", " ", "to", " ", "%", "s", ".", "profile", "\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "MC", "E", "\\u", "PROFILE", "'_", "]_", "=_", "'%", "s", ".", "profile", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "func_", "(_", "test\\u", "data_", ",_", "sha_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Regr", "ession", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fails_", "._", "append_", "(_", "\"", "Regr", "ession", " ", "{", "0", "}", " ", "fail", "ed", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "fails_", "[_", "-_", "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 ", " ", "_", "passes_", "._", "append_", "(_", "\"", "Regr", "ession", " ", "{", "0", "!", "r", "}", " ", "complete", ".\"_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "passes_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"{", "0", "}", " ", "tests", " ", "pass", "ed", ".\"_", "._", "format_", "(_", "len_", "(_", "passes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "fails_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/commands/management/commands/standardize_flowvisor_slices.py
[ { "content": "from django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\nfrom django.contrib.sites.models import Site\n#from django.conf.settings import SITE_DOMAIN as CORRECT_SITE_DOMAIN\nfrom expedient.clearinghouse.defaultsettings.site import SITE_DOMAIN as SITE_DOMAIN_DEFAULT\n#from expedient.clearinghouse.localsettings import SITE_DOMAIN as SITE_DOMAIN_CUSTOM\nfrom expedient.clearinghouse.slice.models import Slice\nfrom expedient.common.utils.mail import send_mail\nimport time\nimport signal\nimport getpass\ntry:\n import cpickle as pickle\nexcept:\n import pickle\nimport os\nimport subprocess\n\n# Temporal path to locate files for this process\npath = \"/opt/ofelia\"\nTIMEOUT = 600 # 10 minutes\n# Time (in seconds) to wait in order to release FlowVisor resources\nFLOWVISOR_SLEEP_TIME = 10\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def handle(self, *args, **options):\n \"\"\"\n Stops and then starts conflictive slices (with non-standard name) at\n Flowvisor.\n Used in conjunction **and before** the script with the same name at opt-in.\n \n Flow:\n 1. Expedient: manage.py standardize_flowvisor_slices stop\n 2. Expedient: manage.py standardize_flowvisor_slices start\n 3. Opt-in: manage.py standardize_flowvisor_slices\n \"\"\"\n try:\n if args[0] == \"stop\":\n self.stdout.write(\"%s\\n\" % self.stop_slices())\n elif args[0] == \"start\":\n self.stdout.write(\"%s\\n\" % self.start_slices())\n else:\n raise Exception\n except:\n self.stdout.write(\"\\n\\033[94m%s\\n> Arguments: %s\\033[0m\\n\" % (self.help, self.args))", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 28 }, { "content": "def filter_own_slices(slice_ids):\n slices = []\n for slice_id in slice_ids:\n try:\n # Check that slice contains the keywords\n # to verify it was CREATED at our island.\n # Otherwise, leave\n filtered_slice = Slice.objects.get(id=slice_id['id'])\n filter_ok = True\n for keyword in slice_id['keywords']:\n if keyword not in filtered_slice.name:\n filter_ok = False\n break\n if filter_ok:\n slices.append(filtered_slice)\n except:\n pass\n return slices", "metadata": "root.filter_own_slices", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def get_conflictive_slices_ids():\n\n def get_id(slice_id):\n i = len(slice_id) - 1 # Counting 0 index\n slice_id\n buffer = []\n while (i) > 0:\n try:\n int(slice_id[i])\n buffer.insert(0,str(slice_id[i]))\n except:\n break\n i -= 1\n return \"\".join(buffer)\n\n def get_keywords(slice_id):\n return str(slice_id).split(\":\")[1].split(\"ID\")[0].strip().split(\"_\")\n\n def write_in_file(ids):\n f = open(\"%s/conflictive_slice_ids\" % path,\"w\")\n pickle.dump(ids,f)\n f.close()\n\n def authenticate_fvctl():\n print \"\\n**IMPORTANT** Calling to 'fvctl' command...\"\n try:\n print \"Please enter password for 'fvadmin' user:\"\n fvctl_pass = getpass.getpass()\n f = open(\"%s/fvadmin_pass\" % path,\"w\")\n f.write(fvctl_pass)\n f.close()\n cmd = ['fvctl', '--passwd-file=%s/fvadmin_pass' % path]\n cmd.append('listSlices')\n p = subprocess.Popen(cmd, shell = False, stdin=subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)\n time.sleep(FLOWVISOR_SLEEP_TIME)\n slices, err = p.communicate()\n if err:\n raise Exception\n except:\n authenticate_fvctl()\n\n authenticate_fvctl()\n f = open(\"%s/fvadmin_pass\" % path, \"r\")\n cmd = ['fvctl', '--passwd-file=%s/fvadmin_pass' % path]\n cmd.append('listSlices')\n p = subprocess.Popen(cmd, shell = False, stdin=subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)\n time.sleep(FLOWVISOR_SLEEP_TIME)\n slices, err = p.communicate()\n\n if not err:\n # Adapt obtained result to a list of flowrules\n slices = slices.split(\"\\n\")\n ids_keywords = list()\n# current_site_domain = Site.objects.get_current().domain\n current_site_domain = SITE_DOMAIN_DEFAULT\n current_site_domain = current_site_domain.replace(\".\", \"_\").replace(\":\", \"_\").replace(\"=\", \"_\").replace(\" \", \"_\").replace(\"'\",\"_\")\n# if not SITE_DOMAIN_DEFAULT == SITE_DOMAIN_CUSTOM:\n if not SITE_DOMAIN_DEFAULT == settings.SITE_DOMAIN:\n for slice in slices:\n# if not str(slice) in str(current_site_domain):\n# if str(current_site_domain) not in str(slice):\n if str(current_site_domain) in str(slice):\n id = get_id(slice)\n keywords = get_keywords(slice)\n if id:\n ids_keywords.append({\"id\":id, \"keywords\":keywords})\n else:\n print \"Error: %s\" % str(err)\n write_in_file(ids_keywords)\n f.close()\n # Remove temporal file for fvadmin's pass only when fvctl command is done\n os.remove(\"%s/fvadmin_pass\" % path)\n return ids_keywords", "metadata": "root.get_conflictive_slices_ids", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "except:", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 7 }, { "span": "except:", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 15 }, { "span": "except:", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 15 }, { "span": "except:", "start_line": 158, "start_column": 12, "end_line": 158, "end_column": 19 }, { "span": "except:", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "django", ".", "conf", ".", "settings", " ", "import", " ", "SITE", "\\u", "DOM", "AIN", " ", "as", " ", "CORREC", "T", "\\u", "SITE", "\\u", "DOMAIN_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "clear", "ing", "house_", "._", "default", "settings_", "._", "site_", "import_", "SITE", "\\u", "DOMAIN_", "as_", "SITE", "\\u", "DOM", "AIN", "\\u", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "expe", "die", "nt", ".", "clear", "ing", "house", ".", "locals", "etti", "ngs", " ", "import", " ", "SITE", "\\u", "DOM", "AIN", " ", "as", " ", "SITE", "\\u", "DOM", "AIN", "\\u", "CUSTOM", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "clear", "ing", "house_", "._", "slice_", "._", "models_", "import_", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "utils_", "._", "mail_", "import_", "send", "\\u", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cpi", "ckl", "e_", "as_", "pickle_", "\\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 ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tempora", "l", " ", "path", " ", "to", " ", "locat", "e", " ", "files", " ", "for", " ", "this", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"/", "opt", "/", "of", "eli", "a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TIMEOUT_", "=_", "600_", "#", " ", "10", " ", "minutes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Time", " ", "(", "in", " ", "second", "s", ")", " ", "to", " ", "wait", " ", "in", " ", "order", " ", "to", " ", "release", " ", "Flow", "Vis", "or", " ", "resources_", "\\u\\u\\uNL\\u\\u\\u_", "FLOW", "VIS", "OR", "\\u", "SLEEP", "\\u", "TIME_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Stops", " ", "and", " ", "then", " ", "starts", " ", "confl", "ict", "ive", " ", "slice", "s", " ", "(", "with", " ", "non", "-", "standard", " ", "name", ")", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "Flow", "visor", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "in", " ", "conjunction", " ", "**", "and", " ", "bef", "ore", "**", " ", "the", " ", "script", " ", "with", " ", "the", " ", "same", " ", "name", " ", "at", " ", "opt", "-", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Flow", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Expe", "die", "nt", ":", " ", "manage", ".", "py", " ", "standardize", "\\u", "flow", "visor", "\\u", "slice", "s", " ", "stop", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Expe", "die", "nt", ":", " ", "manage", ".", "py", " ", "standardize", "\\u", "flow", "visor", "\\u", "slice", "s", " ", "start", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Opt", "-", "in", ":", " ", "manage", ".", "py", " ", "standardize", "\\u", "flow", "visor", "\\u", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "[_", "0_", "]_", "==_", "\"", "stop", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stdout_", "._", "write_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "stop", "\\u", "slices_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "[_", "0_", "]_", "==_", "\"", "start", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stdout_", "._", "write_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "start", "\\u", "slices_", "(_", ")_", ")_", "\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stdout_", "._", "write_", "(_", "\"\\\\", "n", "\\\\", "033", "[", "9", "4", "m", "%", "s", "\\\\", "n", ">", " ", " ", "Arg", "ument", "s", ":", " ", "%", "s", "\\\\", "033", "[", "0", "m", "\\\\", "n", "\"_", "%_", "(_", "self_", "._", "help_", ",_", "self_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter", "\\u", "own", "\\u", "slices_", "(_", "slice", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice", "\\u", "id_", "in_", "slice", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "slice", " ", "contain", "s", " ", "the", " ", "keywords_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "verify", " ", "it", " ", "was", " ", "CREATE", "D", " ", "at", " ", "our", " ", "island", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "leave_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "ed", "\\u", "slice_", "=_", "Slice_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "slice", "\\u", "id_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "ok_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "keyword_", "in_", "slice", "\\u", "id_", "[_", "'", "keywords", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyword_", "not_", "in_", "filter", "ed", "\\u", "slice_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filter", "\\u", "ok_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filter", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slices_", "._", "append_", "(_", "filter", "ed", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slices_", "\\u\\u\\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", "confl", "ict", "ive", "\\u", "slice", "s", "\\u", "ids_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "id_", "(_", "slice", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "len_", "(_", "slice", "\\u", "id_", ")_", "-_", "1_", "#", " ", "Count", "ing", " ", "0", " ", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "i_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "slice", "\\u", "id_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "._", "insert_", "(_", "0_", ",_", "str_", "(_", "slice", "\\u", "id_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "._", "join_", "(_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "keywords_", "(_", "slice", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "slice", "\\u", "id_", ")_", "._", "split_", "(_", "\":\"_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "\"", "ID", "\"_", ")_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "in", "\\u", "file_", "(_", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "\"%", "s", "/", "confl", "ict", "ive", "\\u", "slice", "\\u", "ids", "\"_", "%_", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "ids_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "authenticat", "e\\u", "fv", "ctl_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "**", "IMPORT", "ANT", "**", " ", "Call", "ing", " ", "to", " ", "'", "fv", "ctl", "'", " ", "command", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ple", "ase", " ", "enter", " ", "password", " ", "for", " ", "'", "fv", "admin", "'", " ", "user", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fv", "ctl", "\\u", "pass_", "=_", "getpass_", "._", "getpass_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"%", "s", "/", "fv", "admin", "\\u", "pass", "\"_", "%_", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "fv", "ctl", "\\u", "pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "fv", "ctl", "'_", ",_", "'--", "passw", "d", "-", "file", "=", "%", "s", "/", "fv", "admin", "\\u", "pass", "'_", "%_", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'", "list", "Slice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "shell_", "=_", "False_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "FLOW", "VIS", "OR", "\\u", "SLEEP", "\\u", "TIME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slices_", ",_", "err_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authenticat", "e\\u", "fv", "ctl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "authenticat", "e\\u", "fv", "ctl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"%", "s", "/", "fv", "admin", "\\u", "pass", "\"_", "%_", "path_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "fv", "ctl", "'_", ",_", "'--", "passw", "d", "-", "file", "=", "%", "s", "/", "fv", "admin", "\\u", "pass", "'_", "%_", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'", "list", "Slice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "shell_", "=_", "False_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "FLOW", "VIS", "OR", "\\u", "SLEEP", "\\u", "TIME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slices_", ",_", "err_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Adapt", " ", "obtain", "ed", " ", "result", " ", "to", " ", "a", " ", "list", " ", "of", " ", "flow", "rules_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slices_", "=_", "slices_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids", "\\u", "keywords_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "current", "\\u", "site", "\\u", "domain", " ", "=", " ", "Site", ".", "object", "s", ".", "get", "\\u", "current", "()", ".", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "site", "\\u", "domain_", "=_", "SITE", "\\u", "DOM", "AIN", "\\u", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "site", "\\u", "domain_", "=_", "current", "\\u", "site", "\\u", "domain_", "._", "replace_", "(_", "\".\"_", ",_", "\"\\u\"_", ")_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "._", "replace_", "(_", "\"=\"_", ",_", "\"\\u\"_", ")_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"\\u\"_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "not", " ", "SITE", "\\u", "DOM", "AIN", "\\u", "DEF", "AUL", "T", " ", "==", " ", "SITE", "\\u", "DOM", "AIN", "\\u", "CUSTOM", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "SITE", "\\u", "DOM", "AIN", "\\u", "DEFAULT_", "==_", "settings_", "._", "SITE", "\\u", "DOMAIN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "slice_", "in_", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "not", " ", "str", "(", "slice", ")", " ", "in", " ", "str", "(", "current", "\\u", "site", "\\u", "domain", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "str", "(", "current", "\\u", "site", "\\u", "domain", ")", " ", "not", " ", "in", " ", "str", "(", "slice", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "current", "\\u", "site", "\\u", "domain_", ")_", "in_", "str_", "(_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "id_", "=_", "get", "\\u", "id_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keywords_", "=_", "get", "\\u", "keywords_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ids", "\\u", "keywords_", "._", "append_", "(_", "{_", "\"", "id", "\"_", ":_", "id_", ",_", "\"", "keywords", "\"_", ":_", "keywords_", "}_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "in", "\\u", "file_", "(_", "ids", "\\u", "keywords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "tempora", "l", " ", "file", " ", "for", " ", "fv", "admin", "'", "s", " ", "pass", " ", "only", " ", "whe", "n", " ", "fv", "ctl", " ", "command", " ", "is", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "remove_", "(_", "\"%", "s", "/", "fv", "admin", "\\u", "pass", "\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ids", "\\u", "keywords_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
mtth/hdfs/test/util.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"Test helpers.\"\"\"\n\nfrom hdfs import InsecureClient\nfrom hdfs.config import Config\nfrom hdfs.util import HdfsError\nfrom nose.plugins.skip import SkipTest\nfrom nose.tools import eq_\nfrom requests.exceptions import ConnectionError\nfrom six.moves.configparser import NoOptionError, NoSectionError\nfrom time import sleep\nimport os\nimport posixpath as psp\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def save_config(config, path=None):\n \"\"\"Save configuration to file.\n\n :param config: :class:`~hdfs.config.Config` instance.\n\n \"\"\"\n with open(path or config.path, 'w') as writer:\n config.write(writer)", "metadata": "root.save_config", "header": "['module', '___EOS___']", "index": 17 }, { "content": "class _IntegrationTest(object):\n\n \"\"\"Base class to run tests using remote HDFS.\n\n These tests are run only if a `HDFSCLI_TEST_ALIAS` or `HDFSCLI_TEST_URL`\n environment variable is defined (the former taking precedence). For safety,\n a suffix is appended to any defined root.\n\n .. warning::\n\n The new root directory used is entirely cleaned during tests!\n\n Also contains a few helper functions.\n\n \"\"\"\n\n client = None\n delay = 0.5 # Delay in seconds between tests.\n root_suffix = '.hdfscli' # Also used as default root if none specified.\n\n\n\n\n # Helpers.\n\n", "metadata": "root._IntegrationTest", "header": "['module', '___EOS___']", "index": 27 }, { "content": " @classmethod\n def setup_class(cls):\n alias = os.getenv('HDFSCLI_TEST_ALIAS')\n url = os.getenv('HDFSCLI_TEST_URL')\n if alias:\n cls.client = Config().get_client(alias)\n if cls.client.root:\n cls.client.root = psp.join(cls.client.root, cls.root_suffix)\n else:\n cls.client.root = cls.root_suffix\n elif url:\n cls.client = InsecureClient(url, root=cls.root_suffix)", "metadata": "root._IntegrationTest.setup_class", "header": "['class', '_IntegrationTest', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " @classmethod\n def teardown_class(cls):\n if cls.client:\n cls.client.delete('', recursive=True)", "metadata": "root._IntegrationTest.teardown_class", "header": "['class', '_IntegrationTest', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def setup(self):\n if not self.client:\n raise SkipTest\n else:\n try:\n self.client.delete('', recursive=True)\n # Wrapped inside a `ConnectionError` block because this causes failures\n # when trying to reuse some streamed connections when they aren't fully\n # read (even though it is closed explicitely, it acts differently than\n # when all its content has been read), but only on HttpFS. A test which\n # needs this for example is `test_ext_avro.py:TestMain.test_schema`.\n # This seems related to this issue:\n # https://github.com/kennethreitz/requests/issues/1915 (even on more\n # recent versions of `requests` though).\n #\n # Here is a simple test case that will pass on WebHDFS but fail on\n # HttpFS:\n #\n # .. code:: python\n #\n # client = Config().get_client('test-webhdfs')\n # client.write('foo', 'hello')\n # with client.read('foo') as reader:\n # pass # Will succeed if this is replaced by `reader.read()`.\n # client.delete('foo')\n #\n except ConnectionError:\n self.client.delete('', recursive=True) # Retry.\n finally:\n sleep(self.delay)", "metadata": "root._IntegrationTest.setup", "header": "['class', '_IntegrationTest', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def _read(self, hdfs_path, encoding=None):\n with self.client.read(hdfs_path, encoding=encoding) as reader:\n return reader.read()", "metadata": "root._IntegrationTest._read", "header": "['class', '_IntegrationTest', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _exists(self, hdfs_path):\n return bool(self.client.status(hdfs_path, strict=False))", "metadata": "root._IntegrationTest._exists", "header": "['class', '_IntegrationTest', '(', 'object', ')', ':', '___EOS___']", "index": 102 } ]
[ { "span": "from hdfs.util import HdfsError", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 31 }, { "span": "from nose.tools import eq_", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 26 }, { "span": "from six.moves.configparser import NoOptionError, NoSectionError", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "help", "ers", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hdfs", "_", "import_", "Inse", "cure", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hdfs", "_", "._", "config_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hdfs", "_", "._", "util_", "import_", "Hd", "fs", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "plugins_", "._", "skip_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "eq\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "._", "exceptions_", "import_", "Connect", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "configparser_", "import_", "No", "Optio", "n", "Error_", ",_", "No", "Sect", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "posixpath_", "as_", "psp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "save", "\\u", "config_", "(_", "config_", ",_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "configura", "tion", " ", "to", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", ":", "param", " ", "config", ":", " ", ":", "class", ":`", "~", "hdfs", ".", "config", ".", "Config", "`", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", "or_", "config_", "._", "path_", ",_", "'", "w", "'_", ")_", "as_", "writer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "write_", "(_", "writer_", ")_", "\\u\\u\\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", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "to", " ", "run", " ", "tests", " ", "usi", "ng", " ", "remote", " ", "HDF", "S", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", "se", " ", "tests", " ", "are", " ", "run", " ", "only", " ", "if", " ", "a", " ", "`", "HDF", "SC", "LI", "\\u", "TEST", "\\u", "ALIAS", "`", " ", "or", " ", "`", "HDF", "SC", "LI", "\\u", "TEST", "\\u", "URL", "`", "\\", "10", ";", " ", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "defin", "ed", " ", "(", "the", " ", "former", " ", "tak", "ing", " ", "preceden", "ce", ").", " ", "For", " ", "safety", ",", "\\", "10", ";", " ", " ", "a", " ", "suff", "ix", " ", "is", " ", "append", "ed", " ", "to", " ", "any", " ", "defin", "ed", " ", "root", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "new", " ", "root", " ", "director", "y", " ", "used", " ", "is", " ", "entire", "ly", " ", "clean", "ed", " ", "dur", "ing", " ", "tests", "!", "\\", "10", ";", "\\", "10", ";", " ", " ", "Al", "so", " ", "contain", "s", " ", "a", " ", "few", " ", "help", "er", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "0.5_", "#", " ", "Delay", " ", "in", " ", "second", "s", " ", "bet", "ween", " ", "tests", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "suffix_", "=_", "'.", "hdfs", "cli", "'_", "#", " ", "Al", "so", " ", "used", " ", "as", " ", "default", " ", "root", " ", "if", " ", "none", " ", "specified", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Help", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alias_", "=_", "os_", "._", "getenv_", "(_", "'", "HDF", "SC", "LI", "\\u", "TEST", "\\u", "ALIAS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "os_", "._", "getenv_", "(_", "'", "HDF", "SC", "LI", "\\u", "TEST", "\\u", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alias_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "client_", "=_", "Config_", "(_", ")_", "._", "get", "\\u", "client_", "(_", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls_", "._", "client_", "._", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "client_", "._", "root_", "=_", "psp", "_", "._", "join_", "(_", "cls_", "._", "client_", "._", "root_", ",_", "cls_", "._", "root", "\\u", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "client_", "._", "root_", "=_", "cls_", "._", "root", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "client_", "=_", "Inse", "cure", "Client_", "(_", "url_", ",_", "root_", "=_", "cls_", "._", "root", "\\u", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tear", "down", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "client_", "._", "delete_", "(_", "''_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "\\u\\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 ", " _", "self_", "._", "client_", "._", "delete_", "(_", "''_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wrapp", "ed", " ", "insi", "de", " ", "a", " ", "`", "Connect", "ion", "Error", "`", " ", "block", " ", "bec", "aus", "e", " ", "this", " ", "caus", "es", " ", "failures_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "try", "ing", " ", "to", " ", "reus", "e", " ", "some", " ", "stream", "ed", " ", "connections", " ", "whe", "n", " ", "the", "y", " ", "are", "n", "'", "t", " ", "full", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "(", "even", " ", "tho", "ugh", " ", "it", " ", "is", " ", "close", "d", " ", "explicit", "el", "y", ",", " ", "it", " ", "acts", " ", "different", "ly", " ", "than_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "all", " ", "its", " ", "content", " ", "has", " ", "bee", "n", " ", "read", "),", " ", "but", " ", "only", " ", "on", " ", "Http", "FS", ".", " ", "A", " ", "test", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "s", " ", "this", " ", "for", " ", "example", " ", "is", " ", "`", "test\\u", "ext", "\\u", "avro", ".", "py", ":", "Test", "Main", ".", "test\\u", "schema", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "see", "ms", " ", "relate", "d", " ", "to", " ", "this", " ", "issue", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "ken", "net", "hre", "it", "z", "/", "request", "s", "/", "issue", "s", "/", "191", "5", " ", "(", "even", " ", "on", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recent", " ", "version", "s", " ", "of", " ", "`", "request", "s", "`", " ", "tho", "ugh", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", " ", "is", " ", "a", " ", "simple", " ", "test", " ", "case", " ", "tha", "t", " ", "will", " ", "pass", " ", "on", " ", "Web", "HDF", "S", " ", "but", " ", "fail", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Http", "FS", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "..", " ", "code", "::", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "client", " ", "=", " ", "Config", "()", ".", "get", "\\u", "client", "('", "test", "-", "web", "hdfs", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "client", ".", "write", "('", "foo", "',", " ", "'", "hell", "o", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "client", ".", "read", "('", "foo", "')", " ", "as", " ", "reader", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "#", " ", "Wil", "l", " ", "succe", "ed", " ", "if", " ", "this", " ", "is", " ", "replaced", " ", "by", " ", "`", "reader", ".", "read", "()`", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "client", ".", "delete", "('", "foo", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Connect", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client_", "._", "delete_", "(_", "''_", ",_", "recursive_", "=_", "True_", ")_", "#", " ", "Retr", "y", "._", "\\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 ", " _", "sleep_", "(_", "self_", "._", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "read_", "(_", "self_", ",_", "hdfs", "\\u", "path_", ",_", "encoding_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "client_", "._", "read_", "(_", "hdfs", "\\u", "path_", ",_", "encoding_", "=_", "encoding_", ")_", "as_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reader_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Integrati", "on", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "exists_", "(_", "self_", ",_", "hdfs", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "client_", "._", "status_", "(_", "hdfs", "\\u", "path_", ",_", "strict_", "=_", "False_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
amrdraz/kodr/app/brython/www/src/Lib/test/test_userdict.py
[ { "content": " def test_all(self):\n # Test constructors\n u = collections.UserDict()\n u0 = collections.UserDict(d0)\n u1 = collections.UserDict(d1)\n u2 = collections.UserDict(d2)\n\n uu = collections.UserDict(u)\n uu0 = collections.UserDict(u0)\n uu1 = collections.UserDict(u1)\n uu2 = collections.UserDict(u2)\n\n # keyword arg constructor\n self.assertEqual(collections.UserDict(one=1, two=2), d2)\n # item sequence constructor\n self.assertEqual(collections.UserDict([('one',1), ('two',2)]), d2)\n self.assertEqual(collections.UserDict(dict=[('one',1), ('two',2)]), d2)\n # both together\n self.assertEqual(collections.UserDict([('one',1), ('two',2)], two=3, three=5), d3)\n\n # alternate constructor\n self.assertEqual(collections.UserDict.fromkeys('one two'.split()), d4)\n self.assertEqual(collections.UserDict().fromkeys('one two'.split()), d4)\n self.assertEqual(collections.UserDict.fromkeys('one two'.split(), 1), d5)\n self.assertEqual(collections.UserDict().fromkeys('one two'.split(), 1), d5)\n self.assertTrue(u1.fromkeys('one two'.split()) is not u1)\n self.assertIsInstance(u1.fromkeys('one two'.split()), collections.UserDict)\n self.assertIsInstance(u2.fromkeys('one two'.split()), collections.UserDict)\n\n # Test __repr__\n self.assertEqual(str(u0), str(d0))\n self.assertEqual(repr(u1), repr(d1))\n self.assertEqual(repr(u2), repr(d2))\n\n # Test rich comparison and __len__\n all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2]\n for a in all:\n for b in all:\n self.assertEqual(a == b, len(a) == len(b))\n\n # Test __getitem__\n self.assertEqual(u2[\"one\"], 1)\n self.assertRaises(KeyError, u1.__getitem__, \"two\")\n\n # Test __setitem__\n u3 = collections.UserDict(u2)\n u3[\"two\"] = 2\n u3[\"three\"] = 3\n\n # Test __delitem__\n del u3[\"three\"]\n self.assertRaises(KeyError, u3.__delitem__, \"three\")\n\n # Test clear\n u3.clear()\n self.assertEqual(u3, {})\n\n # Test copy()\n u2a = u2.copy()\n self.assertEqual(u2a, u2)\n u2b = collections.UserDict(x=42, y=23)\n u2c = u2b.copy() # making a copy of a UserDict is special cased\n self.assertEqual(u2b, u2c)\n\n class MyUserDict(collections.UserDict):\n def display(self): print(self)\n\n m2 = MyUserDict(u2)\n m2a = m2.copy()\n self.assertEqual(m2a, m2)\n\n # SF bug #476616 -- copy() of UserDict subclass shared data\n m2['foo'] = 'bar'\n self.assertNotEqual(m2a, m2)\n\n # Test keys, items, values\n self.assertEqual(u2.keys(), d2.keys())\n self.assertEqual(u2.items(), d2.items())\n self.assertEqual(list(u2.values()), list(d2.values()))\n\n # Test \"in\".\n for i in u2.keys():\n self.assertIn(i, u2)\n self.assertEqual(i in u1, i in d1)\n self.assertEqual(i in u0, i in d0)\n\n # Test update\n t = collections.UserDict()\n t.update(u2)\n self.assertEqual(t, u2)\n\n # Test get\n for i in u2.keys():\n self.assertEqual(u2.get(i), u2[i])\n self.assertEqual(u1.get(i), d1.get(i))\n self.assertEqual(u0.get(i), d0.get(i))\n\n # Test \"in\" iteration.\n for i in range(20):\n u2[i] = str(i)\n ikeys = []\n for k in u2:\n ikeys.append(k)\n keys = u2.keys()\n self.assertEqual(set(ikeys), set(keys))\n\n # Test setdefault\n t = collections.UserDict()\n self.assertEqual(t.setdefault(\"x\", 42), 42)\n self.assertIn(\"x\", t)\n self.assertEqual(t.setdefault(\"x\", 23), 42)\n\n # Test pop\n t = collections.UserDict(x=42)\n self.assertEqual(t.pop(\"x\"), 42)\n self.assertRaises(KeyError, t.pop, \"x\")\n self.assertEqual(t.pop(\"x\", 1), 1)\n t[\"x\"] = 42\n self.assertEqual(t.pop(\"x\", 1), 42)\n\n # Test popitem\n t = collections.UserDict(x=42)\n self.assertEqual(t.popitem(), (\"x\", 42))\n self.assertRaises(KeyError, t.popitem)", "metadata": "root.UserDictTest.test_all", "header": "['class', 'UserDictTest', '(', 'mapping_tests', '.', 'TestHashMappingProtocol', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "self.assertTrue(u1.fromkeys('one two'.split()) is not u1)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 65 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "User", "Dict", "Test_", "(_", "mapping", "\\u", "tests_", "._", "Test", "Hash", "Map", "ping", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "construct", "ors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u0", "_", "=_", "collections_", "._", "User", "Dict_", "(_", "d0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u1_", "=_", "collections_", "._", "User", "Dict_", "(_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2_", "=_", "collections_", "._", "User", "Dict_", "(_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uu", "_", "=_", "collections_", "._", "User", "Dict_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "0_", "=_", "collections_", "._", "User", "Dict_", "(_", "u0", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "1_", "=_", "collections_", "._", "User", "Dict_", "(_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "2_", "=_", "collections_", "._", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keyw", "ord", " ", "arg", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "one_", "=_", "1_", ",_", "two_", "=_", "2_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "item", " ", "sequence", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "dict_", "=_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ")_", ",_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bot", "h", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", "[_", "(_", "'", "one", "'_", ",_", "1_", ")_", ",_", "(_", "'", "two", "'_", ",_", "2_", ")_", "]_", ",_", "two_", "=_", "3_", ",_", "three_", "=_", "5_", ")_", ",_", "d3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alternat", "e", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "d4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", ")_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "d4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ",_", "1_", ")_", ",_", "d5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collections_", "._", "User", "Dict_", "(_", ")_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ",_", "1_", ")_", ",_", "d5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "u1_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", "is_", "not_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "u1_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "collections_", "._", "User", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "u2_", "._", "fromkeys_", "(_", "'", "one", " ", "two", "'_", "._", "split_", "(_", ")_", ")_", ",_", "collections_", "._", "User", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "repr\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "u0", "_", ")_", ",_", "str_", "(_", "d0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "u1_", ")_", ",_", "repr_", "(_", "d1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "u2_", ")_", ",_", "repr_", "(_", "d2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "rich", " ", "compa", "ris", "on", " ", "and", " ", "\\u\\u", "len\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all_", "=_", "[_", "d0_", ",_", "d1_", ",_", "d2_", ",_", "u_", ",_", "u0", "_", ",_", "u1_", ",_", "u2_", ",_", "uu", "_", ",_", "uu", "0_", ",_", "uu", "1_", ",_", "uu", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "b_", "in_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "a_", "==_", "b_", ",_", "len_", "(_", "a_", ")_", "==_", "len_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "getitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "[_", "\"", "one", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "u1_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "\"", "two", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "setitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "3_", "=_", "collections_", "._", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u", "3_", "[_", "\"", "two", "\"_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u", "3_", "[_", "\"", "three", "\"_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\\u\\u", "delitem\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "u", "3_", "[_", "\"", "three", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "u", "3_", "._", "\\u\\u", "delitem\\u\\u_", ",_", "\"", "three", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "clear_", "\\u\\u\\uNL\\u\\u\\u_", "u", "3_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u", "3_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "copy", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "u2", "a_", "=_", "u2_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2", "a_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2", "b_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ",_", "y_", "=_", "23_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2", "c_", "=_", "u2", "b_", "._", "copy_", "(_", ")_", "#", " ", "mak", "ing", " ", "a", " ", "copy", " ", "of", " ", "a", " ", "User", "Dict", " ", "is", " ", "special", " ", "case", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2", "b_", ",_", "u2", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "User", "Dict_", "(_", "collections_", "._", "User", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "display_", "(_", "self_", ")_", ":_", "print_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m2_", "=_", "My", "User", "Dict_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "a_", "=_", "m2_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m2", "a_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SF", " ", "bug", " ", "#", "476", "616", " ", "--", " ", "copy", "()", " ", "of", " ", "User", "Dict", " ", "subclass", " ", "shared", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "m2_", "[_", "'", "foo", "'_", "]_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "m2", "a_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "keys", ",", " ", "items", ",", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "keys_", "(_", ")_", ",_", "d2_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "items_", "(_", ")_", ",_", "d2_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "u2_", "._", "values_", "(_", ")_", ")_", ",_", "list_", "(_", "d2_", "._", "values_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\"", "in", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "u2_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "i_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "i_", "in_", "u1_", ",_", "i_", "in_", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "i_", "in_", "u0", "_", ",_", "i_", "in_", "d0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "update_", "(_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "u2_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "get_", "(_", "i_", ")_", ",_", "u2_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u1_", "._", "get_", "(_", "i_", ")_", ",_", "d1_", "._", "get_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u0", "_", "._", "get_", "(_", "i_", ")_", ",_", "d0_", "._", "get_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "\"", "in", "\"", " ", "iterati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u2_", "[_", "i_", "]_", "=_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ike", "ys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "u2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ike", "ys_", "._", "append_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "=_", "u2_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "ike", "ys_", ")_", ",_", "set_", "(_", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "setdefault_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "setdefault_", "(_", "\"", "x", "\"_", ",_", "42_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "x", "\"_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "setdefault_", "(_", "\"", "x", "\"_", ",_", "23_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "pop_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "t_", "._", "pop_", ",_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "[_", "\"", "x", "\"_", "]_", "=_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "pop_", "(_", "\"", "x", "\"_", ",_", "1_", ")_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "popi", "tem_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "collections_", "._", "User", "Dict_", "(_", "x_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "popi", "tem_", "(_", ")_", ",_", "(_", "\"", "x", "\"_", ",_", "42_", ")_", ")_", "\\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 ]
Unused import
kevinburke/hamms/hamms/__init__.py
[ { "content": "import json\nimport logging\nfrom email import message_from_string\nimport random\nfrom StringIO import StringIO\nfrom threading import Thread\nimport time\nimport urlparse\n\nfrom flask import Flask, request, Response, g\nfrom httpbin.helpers import get_dict, status_code\nfrom twisted.internet import protocol, reactor\nfrom twisted.web.server import Site\nfrom twisted.web.wsgi import WSGIResource\nfrom werkzeug.routing import Rule\nfrom werkzeug.http import parse_accept_header\n\nfrom .morse import morsedict\n\nlogger = logging.getLogger(\"hamms\")\nlogger.setLevel(logging.INFO)\n# XXX: also update version in setup.py\n__version__ = '1.3'\nSERVER_HEADER = 'Hamms/{version}'.format(version=__version__)\n\nBASE_PORT = 5500\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\nempty_response = ('HTTP/1.1 204 No Content\\r\\n'\n 'Server: {hdr}\\r\\n\\r\\n'.format(hdr=SERVER_HEADER))\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nINCOMPLETE_JSON = '{\"message\": \"the json body is incomplete.\", \"key\": {\"nested_message\": \"blah blah blah'\nINCOMPLETE_XML = '<?xml version=\"1.0\" ?><response><status type=\"http\">200 foo'\nINCOMPLETE_PLAIN = 'incomplete document respo'\nINCOMPLETE_HTML = '<!doctype html><html><head><title>incomplete'\n\n\n\n\n\nsleep_app = Flask(__name__)\nsleep_app.PORT = 8\nstatus_app = Flask(__name__)\nstatus_app.PORT = 9\nlarge_header_app = Flask(__name__)\nlarge_header_app.PORT = 11\nunparseable_app = Flask(__name__)\nunparseable_app.PORT = 14\ntoolong_content_app = Flask(__name__)\ntoolong_content_app.PORT = 15\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HammsSite(Site):", "metadata": "root.HammsSite", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def getResourceFor(self, request):\n request.setHeader('Server', SERVER_HEADER)\n return Site.getResourceFor(self, request)", "metadata": "root.HammsSite.getResourceFor", "header": "['class', 'HammsSite', '(', 'Site', ')', ':', '___EOS___']", "index": 28 }, { "content": "class HammsServer(object):\n \"\"\" Start the hamms server in a thread.\n\n Usage::\n\n hs = HammsServer()\n hs.start(beginning_port=5500)\n # When you are done working with hamms\n hs.stop()\n\n :param int beginning_port: Hamms will start servers on all ports from\n beginning_port to beginning_port + 14.\n \"\"\"\n\n", "metadata": "root.HammsServer", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def start(self, beginning_port=BASE_PORT):\n self.beginning_port = beginning_port\n self.retry_cache = {}\n\n listen(reactor, base_port=self.beginning_port, retry_cache=self.retry_cache)\n\n if not reactor.running:\n self.t = Thread(target=reactor.run, args=(False,))\n self.t.daemon = True\n self.t.start()", "metadata": "root.HammsServer.start", "header": "['class', 'HammsServer', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": " def stop(self):\n reactor.stop()", "metadata": "root.HammsServer.stop", "header": "['class', 'HammsServer', '(', 'object', ')', ':', '___EOS___']", "index": 57 }, { "content": "def listen(_reactor, base_port=BASE_PORT, retry_cache=None):\n # in likelihood there is no benefit to passing in the reactor as only one of\n # them can ever run at a time.\n retry_cache = retry_cache or {}\n retries_app = create_retries_app(retry_cache)\n\n sleep_resource = WSGIResource(reactor, reactor.getThreadPool(), sleep_app)\n sleep_site = HammsSite(sleep_resource)\n\n status_resource = WSGIResource(reactor, reactor.getThreadPool(), status_app)\n status_site = HammsSite(status_resource)\n\n large_header_resource = WSGIResource(reactor, reactor.getThreadPool(),\n large_header_app)\n large_header_site = HammsSite(large_header_resource)\n\n retries_resource = WSGIResource(reactor, reactor.getThreadPool(), retries_app)\n retries_site = HammsSite(retries_resource)\n\n unparseable_resource = WSGIResource(reactor, reactor.getThreadPool(),\n unparseable_app)\n unparseable_site = HammsSite(unparseable_resource)\n\n toolong_content_resource = WSGIResource(reactor, reactor.getThreadPool(),\n toolong_content_app)\n toolong_content_site = HammsSite(toolong_content_resource)\n\n _reactor.listenTCP(base_port + ListenForeverServer.PORT, ListenForeverFactory())\n _reactor.listenTCP(base_port + EmptyStringTerminateImmediatelyServer.PORT,\n EmptyStringTerminateImmediatelyFactory())\n _reactor.listenTCP(base_port + EmptyStringTerminateOnReceiveServer.PORT,\n EmptyStringTerminateOnReceiveFactory())\n _reactor.listenTCP(base_port + MalformedStringTerminateImmediatelyServer.PORT,\n MalformedStringTerminateImmediatelyFactory())\n _reactor.listenTCP(base_port + MalformedStringTerminateOnReceiveServer.PORT,\n MalformedStringTerminateOnReceiveFactory())\n _reactor.listenTCP(base_port + FiveSecondByteResponseServer.PORT,\n FiveSecondByteResponseFactory())\n _reactor.listenTCP(base_port + ThirtySecondByteResponseServer.PORT,\n ThirtySecondByteResponseFactory())\n _reactor.listenTCP(base_port + sleep_app.PORT, sleep_site)\n _reactor.listenTCP(base_port + status_app.PORT, status_site)\n _reactor.listenTCP(base_port + SendDataPastContentLengthServer.PORT,\n SendDataPastContentLengthFactory())\n _reactor.listenTCP(base_port + large_header_app.PORT, large_header_site)\n _reactor.listenTCP(base_port + retries_app.PORT, retries_site)\n _reactor.listenTCP(base_port + DropRandomRequestsServer.PORT,\n DropRandomRequestsFactory())\n _reactor.listenTCP(base_port + unparseable_app.PORT, unparseable_site)\n _reactor.listenTCP(base_port + IncompleteResponseServer.PORT,\n IncompleteResponseFactory())\n _reactor.listenTCP(base_port + toolong_content_app.PORT, toolong_content_site)", "metadata": "root.listen", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def get_remote_host(transport):\n try:\n peer = transport.getPeer()\n return peer.host\n except Exception:\n return \"<ipaddr>\"", "metadata": "root.get_remote_host", "header": "['module', '___EOS___']", "index": 114 }, { "content": "def get_port(transport):\n try:\n return transport.getHost().port\n except Exception:\n return \"<port>\"", "metadata": "root.get_port", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def get_header(header_name, data):\n try:\n rline, raw_headers = data.split('\\r\\n', 1)\n headers = message_from_string(raw_headers)\n return headers.get(header_name, \"\")\n except Exception:\n return \"\"", "metadata": "root.get_header", "header": "['module', '___EOS___']", "index": 127 }, { "content": "def _log_t(transport, data, status=None):\n ipaddr = get_remote_host(transport)\n port = get_port(transport)\n ua = get_header('user-agent', data)\n return _log(ipaddr, port, data, status=status, ua=ua)", "metadata": "root._log_t", "header": "['module', '___EOS___']", "index": 135 }, { "content": "def _log(ipaddr, port, data, status=None, ua=\"\"):\n try:\n topline = data.split('\\r\\n')[0]\n return \"{ipaddr} {port} \\\"{topline}\\\" {status} \\\"{ua}\\\"\".format(\n ipaddr=ipaddr, port=port, topline=topline, ua=ua, status=status or \"-\")\n except Exception:\n logger.exception(\"caught exception while formatting log\")\n return \"<data received>\"", "metadata": "root._log", "header": "['module', '___EOS___']", "index": 141 }, { "content": "class ListenForeverServer(protocol.Protocol):\n\n PORT = 1\n", "metadata": "root.ListenForeverServer", "header": "['module', '___EOS___']", "index": 150 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data))", "metadata": "root.ListenForeverServer.dataReceived", "header": "['class', 'ListenForeverServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 154 }, { "content": "class ListenForeverFactory(protocol.Factory):", "metadata": "root.ListenForeverFactory", "header": "['module', '___EOS___']", "index": 158 }, { "content": " def buildProtocol(self, addr):\n return ListenForeverServer()", "metadata": "root.ListenForeverFactory.buildProtocol", "header": "['class', 'ListenForeverFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 159 }, { "content": "class EmptyStringTerminateImmediatelyServer(protocol.Protocol):\n PORT = 2\n\n", "metadata": "root.EmptyStringTerminateImmediatelyServer", "header": "['module', '___EOS___']", "index": 163 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data))", "metadata": "root.EmptyStringTerminateImmediatelyServer.dataReceived", "header": "['class', 'EmptyStringTerminateImmediatelyServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 166 }, { "content": " def connectionMade(self):\n self.transport.write('')\n self.transport.loseConnection()", "metadata": "root.EmptyStringTerminateImmediatelyServer.connectionMade", "header": "['class', 'EmptyStringTerminateImmediatelyServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 169 }, { "content": "class EmptyStringTerminateImmediatelyFactory(protocol.Factory):", "metadata": "root.EmptyStringTerminateImmediatelyFactory", "header": "['module', '___EOS___']", "index": 174 }, { "content": " def buildProtocol(self, addr):\n return EmptyStringTerminateImmediatelyServer()", "metadata": "root.EmptyStringTerminateImmediatelyFactory.buildProtocol", "header": "['class', 'EmptyStringTerminateImmediatelyFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 175 }, { "content": "class EmptyStringTerminateOnReceiveServer(protocol.Protocol):\n\n PORT = 3\n", "metadata": "root.EmptyStringTerminateOnReceiveServer", "header": "['module', '___EOS___']", "index": 179 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data))\n self.transport.write('')\n self.transport.loseConnection()", "metadata": "root.EmptyStringTerminateOnReceiveServer.dataReceived", "header": "['class', 'EmptyStringTerminateOnReceiveServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 183 }, { "content": "class EmptyStringTerminateOnReceiveFactory(protocol.Factory):", "metadata": "root.EmptyStringTerminateOnReceiveFactory", "header": "['module', '___EOS___']", "index": 189 }, { "content": " def buildProtocol(self, addr):\n return EmptyStringTerminateOnReceiveServer()", "metadata": "root.EmptyStringTerminateOnReceiveFactory.buildProtocol", "header": "['class', 'EmptyStringTerminateOnReceiveFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 190 }, { "content": "class MalformedStringTerminateImmediatelyServer(protocol.Protocol):\n\n PORT = 4\n\n", "metadata": "root.MalformedStringTerminateImmediatelyServer", "header": "['module', '___EOS___']", "index": 194 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data))", "metadata": "root.MalformedStringTerminateImmediatelyServer.dataReceived", "header": "['class', 'MalformedStringTerminateImmediatelyServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 198 }, { "content": " def connectionMade(self):\n self.transport.write('foo bar')\n self.transport.loseConnection()", "metadata": "root.MalformedStringTerminateImmediatelyServer.connectionMade", "header": "['class', 'MalformedStringTerminateImmediatelyServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 201 }, { "content": "class MalformedStringTerminateImmediatelyFactory(protocol.Factory):", "metadata": "root.MalformedStringTerminateImmediatelyFactory", "header": "['module', '___EOS___']", "index": 206 }, { "content": " def buildProtocol(self, addr):\n return MalformedStringTerminateImmediatelyServer()", "metadata": "root.MalformedStringTerminateImmediatelyFactory.buildProtocol", "header": "['class', 'MalformedStringTerminateImmediatelyFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 207 }, { "content": "class MalformedStringTerminateOnReceiveServer(protocol.Protocol):\n\n PORT = 5\n", "metadata": "root.MalformedStringTerminateOnReceiveServer", "header": "['module', '___EOS___']", "index": 211 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data))\n self.transport.write('foo bar')\n self.transport.loseConnection()", "metadata": "root.MalformedStringTerminateOnReceiveServer.dataReceived", "header": "['class', 'MalformedStringTerminateOnReceiveServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 215 }, { "content": "class MalformedStringTerminateOnReceiveFactory(protocol.Factory):\n", "metadata": "root.MalformedStringTerminateOnReceiveFactory", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def buildProtocol(self, addr):\n return MalformedStringTerminateOnReceiveServer()", "metadata": "root.MalformedStringTerminateOnReceiveFactory.buildProtocol", "header": "['class', 'MalformedStringTerminateOnReceiveFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 223 }, { "content": "class FiveSecondByteResponseServer(protocol.Protocol):\n\n PORT = 6\n\n", "metadata": "root.FiveSecondByteResponseServer", "header": "['module', '___EOS___']", "index": 230 }, { "content": " def _send_byte(self, byte):\n self.transport.write(byte)", "metadata": "root.FiveSecondByteResponseServer._send_byte", "header": "['class', 'FiveSecondByteResponseServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 234 }, { "content": " def dataReceived(self, data):\n try:\n timer = 5\n for byte in empty_response:\n reactor.callLater(timer, self._send_byte, byte)\n timer += 5\n reactor.callLater(timer, self.transport.loseConnection)\n logger.info(_log_t(self.transport, data, status=204))\n except Exception:\n logger.info(_log_t(self.transport, data))", "metadata": "root.FiveSecondByteResponseServer.dataReceived", "header": "['class', 'FiveSecondByteResponseServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 237 }, { "content": "class FiveSecondByteResponseFactory(protocol.Factory):", "metadata": "root.FiveSecondByteResponseFactory", "header": "['module', '___EOS___']", "index": 249 }, { "content": " def buildProtocol(self, addr):\n return FiveSecondByteResponseServer()", "metadata": "root.FiveSecondByteResponseFactory.buildProtocol", "header": "['class', 'FiveSecondByteResponseFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 250 }, { "content": "class ThirtySecondByteResponseServer(protocol.Protocol):\n\n PORT = 7\n\n", "metadata": "root.ThirtySecondByteResponseServer", "header": "['module', '___EOS___']", "index": 254 }, { "content": " def _send_byte(self, byte):\n self.transport.write(byte)", "metadata": "root.ThirtySecondByteResponseServer._send_byte", "header": "['class', 'ThirtySecondByteResponseServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 258 }, { "content": " def dataReceived(self, data):\n try:\n timer = 30\n for byte in empty_response:\n reactor.callLater(timer, self._send_byte, byte)\n timer += 30\n reactor.callLater(timer, self.transport.loseConnection)\n logger.info(_log_t(self.transport, data, status=204))\n except Exception:\n logger.info(_log_t(self.transport, data))", "metadata": "root.ThirtySecondByteResponseServer.dataReceived", "header": "['class', 'ThirtySecondByteResponseServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 261 }, { "content": "class ThirtySecondByteResponseFactory(protocol.Factory):", "metadata": "root.ThirtySecondByteResponseFactory", "header": "['module', '___EOS___']", "index": 273 }, { "content": " def buildProtocol(self, addr):\n return ThirtySecondByteResponseServer()", "metadata": "root.ThirtySecondByteResponseFactory.buildProtocol", "header": "['class', 'ThirtySecondByteResponseFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 274 }, { "content": "class SendDataPastContentLengthServer(protocol.Protocol):\n\n PORT = 10\n\n", "metadata": "root.SendDataPastContentLengthServer", "header": "['module', '___EOS___']", "index": 278 }, { "content": " def dataReceived(self, data):\n logger.info(_log_t(self.transport, data, status=200))", "metadata": "root.SendDataPastContentLengthServer.dataReceived", "header": "['class', 'SendDataPastContentLengthServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 282 }, { "content": " def connectionMade(self):\n self.transport.write('HTTP/1.1 200 OK\\r\\n'\n 'Server: {server}\\r\\n'\n 'Content-Type: text/plain\\r\\n'\n 'Content-Length: 3\\r\\n'\n 'Connection: keep-alive\\r\\n'\n '\\r\\n{body}'.format(server=SERVER_HEADER,\n body='a'*1024*1024))\n self.transport.loseConnection()", "metadata": "root.SendDataPastContentLengthServer.connectionMade", "header": "['class', 'SendDataPastContentLengthServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 285 }, { "content": "class SendDataPastContentLengthFactory(protocol.Factory):", "metadata": "root.SendDataPastContentLengthFactory", "header": "['module', '___EOS___']", "index": 295 }, { "content": " def buildProtocol(self, addr):\n return SendDataPastContentLengthServer()", "metadata": "root.SendDataPastContentLengthFactory.buildProtocol", "header": "['class', 'SendDataPastContentLengthFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 296 }, { "content": "def success_response(content_type, response):\n return ('HTTP/1.1 200 OK\\r\\n'\n 'Server: {server}\\r\\n'\n 'Content-Type: {ctype}\\r\\n\\r\\n'\n '{response}'.format(ctype=content_type, server=SERVER_HEADER,\n response=response))", "metadata": "root.success_response", "header": "['module', '___EOS___']", "index": 299 }, { "content": "class DropRandomRequestsServer(protocol.Protocol):\n\n PORT = 13\n", "metadata": "root.DropRandomRequestsServer", "header": "['module', '___EOS___']", "index": 306 }, { "content": " def dataReceived(self, data):\n body = data.split('\\r\\n')\n try:\n method, url, http_vsn = body[0].split(' ')\n except Exception:\n # we got weird data, just fail\n logger.info(_log_t(self.transport, data))\n self.transport.loseConnection()\n\n o = urlparse.urlparse(url)\n query = urlparse.parse_qs(o.query)\n if 'failrate' in query:\n failrate = query['failrate'].pop()\n else:\n failrate = 0.05\n if random.random() >= float(failrate):\n logger.info(_log_t(self.transport, data, status=200))\n self.transport.write(\n success_response('application/json', '{\"success\": true}'))\n else:\n logger.info(_log_t(self.transport, data))\n self.transport.loseConnection()", "metadata": "root.DropRandomRequestsServer.dataReceived", "header": "['class', 'DropRandomRequestsServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 310 }, { "content": "class DropRandomRequestsFactory(protocol.Factory):", "metadata": "root.DropRandomRequestsFactory", "header": "['module', '___EOS___']", "index": 333 }, { "content": " def buildProtocol(self, addr):\n return DropRandomRequestsServer()", "metadata": "root.DropRandomRequestsFactory.buildProtocol", "header": "['class', 'DropRandomRequestsFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 334 }, { "content": "def write_incomplete_response(transport, content_type, body):\n transport.write('Content-Type: {ctype}\\r\\n'.format(ctype=content_type))\n transport.write('Content-Length: {length}\\r\\n'.format(\n length=len(body)+2000))\n transport.write('\\r\\n{body}'.format(body=body))\n transport.loseConnection()", "metadata": "root.write_incomplete_response", "header": "['module', '___EOS___']", "index": 339 }, { "content": "class IncompleteResponseServer(protocol.Protocol):\n PORT = 16", "metadata": "root.IncompleteResponseServer", "header": "['module', '___EOS___']", "index": 351 }, { "content": " def dataReceived(self, data):\n accept_header_value = get_header('Accept', data)\n accept_cls = parse_accept_header(accept_header_value)\n self.transport.write('HTTP/1.1 200 OK\\r\\n')\n if 'text/html' == accept_cls.best:\n write_incomplete_response(self.transport, 'text/html',\n INCOMPLETE_HTML)\n elif 'text/plain' == accept_cls.best:\n write_incomplete_response(self.transport, 'text/plain',\n INCOMPLETE_PLAIN)\n elif 'text/xml' == accept_cls.best:\n write_incomplete_response(self.transport, 'text/xml',\n INCOMPLETE_XML)\n else:\n write_incomplete_response(self.transport, 'application/json',\n INCOMPLETE_JSON)", "metadata": "root.IncompleteResponseServer.dataReceived", "header": "['class', 'IncompleteResponseServer', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 353 }, { "content": "class IncompleteResponseFactory(protocol.Factory):", "metadata": "root.IncompleteResponseFactory", "header": "['module', '___EOS___']", "index": 371 }, { "content": " def buildProtocol(self, addr):\n return IncompleteResponseServer()", "metadata": "root.IncompleteResponseFactory.buildProtocol", "header": "['class', 'IncompleteResponseFactory', '(', 'protocol', '.', 'Factory', ')', ':', '___EOS___']", "index": 372 }, { "content": "def create_retries_app(cache):\n retries_app = Flask(__name__)\n retries_app.PORT = 12\n retries_app.cache = cache\n\n # we want the retries app to listen on all methods\n retries_app.url_map.add(Rule('/', endpoint='index'))\n @retries_app.endpoint(\"index\")\n def check_retries():\n json_hdr = {'Content-Type': 'application/json'}\n key = request.args.get('key', 'default')\n tries = request.args.get('tries', 3)\n try:\n tries = int(tries)\n except Exception:\n return Response(status=400, headers=json_hdr, response=json.dumps({\n 'error': 'Please pass an integer number of tries',\n 'key': key,\n 'success': False,\n }))\n\n if key in retries_app.cache:\n retries_app.cache[key] -= 1\n else:\n retries_app.cache[key] = int(tries) - 1\n\n if retries_app.cache[key] <= 0:\n data = {\n 'key': key,\n 'tries_remaining': retries_app.cache[key],\n 'success': True\n }\n return Response(response=json.dumps(data), status=200,\n headers=json_hdr)\n else:\n msg = 'The server had an error. Try again {retry_times} more {time_p}'\n time_p = 'time' if retries_app.cache[key] == 1 else 'times'\n content = {\n 'error': msg.format(retry_times=retries_app.cache[key], time_p=time_p),\n 'tries_remaining': retries_app.cache[key],\n 'key': key,\n 'success': False,\n }\n return Response(response=json.dumps(content), status=500,\n headers=json_hdr)\n\n @retries_app.route(\"/counters\", methods=['POST'])\n def reset():\n key = request.values.get('key', 'default')\n tries = request.values.get('tries', 3)\n try:\n tries = int(tries)\n except Exception:\n return Response(status=400, headers=json_hdr, response=json.dumps({\n 'error': 'Please pass an integer number of tries',\n 'key': key,\n 'success': False,\n }))\n\n retries_app.cache[key] = tries\n\n content = {\n 'key': key,\n 'tries_remaining': tries,\n 'success': True,\n }\n return Response(response=json.dumps(content), status=200,\n headers={'Content-Type': 'application/json'})\n\n @retries_app.route(\"/counters\", methods=['GET'])\n def counter():\n content = {'counters': retries_app.cache, 'success': True}\n return Response(response=json.dumps(content), status=200,\n headers={'Content-Type': 'application/json'})\n\n @retries_app.after_request\n def retries_header(resp):\n _log_flask(resp.status_code)\n resp.headers['Server'] = 'hamms'\n return resp\n\n return retries_app", "metadata": "root.create_retries_app", "header": "['module', '___EOS___']", "index": 387 }, { "content": "@sleep_app.route(\"/\")\ndef sleep():\n n = request.values.get('sleep', 5)\n time.sleep(float(n))\n hdrs = get_dict('headers')\n return Response(response=json.dumps(hdrs), status=200,\n headers={'Content-Type': 'application/json'})", "metadata": "root.sleep", "header": "['module', '___EOS___']", "index": 470 }, { "content": "@status_app.route(\"/\")\ndef status():\n n = request.values.get('status', 200)\n return status_code(int(n))", "metadata": "root.status", "header": "['module', '___EOS___']", "index": 478 }, { "content": "@large_header_app.route(\"/\")\ndef large_header():\n n = request.values.get('size', 63*1024)\n req_headers = get_dict('headers')\n resp_headers = {\n 'Content-Type': 'application/json',\n 'Cookie': 'a'*int(n)\n }\n return Response(response=json.dumps(req_headers), status=200,\n headers=resp_headers)", "metadata": "root.large_header", "header": "['module', '___EOS___']", "index": 483 }, { "content": "@unparseable_app.route(\"/\")\ndef unparseable():\n\n def _morse():\n hdr = {'Content-Type': 'text/morse'}\n message = \" STOP \".join([\n \"DEAREST ANN\",\n \"TIMES ARE HARD\",\n \"MY TREADMILL DESK DOESNT RECLINE ALL THE WAY\",\n \"THE KITCHEN HASNT HAD SOYLENT FOR TWO WHOLE DAYS\",\n \"HOW IS ANYONE SUPPOSED TO PROGRAM IN THESE CONDITIONS\",\n \"PLEASE SEND HELP\",\n ]) + \" STOP\"\n morse_message = StringIO()\n for i, letter in enumerate(message):\n morse_message.write(morsedict[letter])\n return Response(response=morse_message.getvalue(), headers=hdr)\n\n if 'text/morse' not in request.accept_mimetypes:\n return _morse()\n\n elif not request.accept_mimetypes.accept_json:\n hdr = {'Content-Type': 'application/json'}\n resp = {\n 'status': 200,\n 'message': 'This is a JSON response. You did not ask for JSON data.',\n }\n return Response(response=json.dumps(resp), headers=hdr)\n\n elif not request.accept_mimetypes.accept_html:\n hdr = {'Content-Type': 'text/html'}\n return Response(response=\"<!doctype html><html><head><title>Your API is Broken</title></head><body>This should be JSON.</body></html>\", headers=hdr)\n\n elif 'text/csv' not in request.accept_mimetypes:\n hdr = {'Content-Type': 'text/csv'}\n return Response(response=\"message,status\\nThis is a CSV response that your code almost certainly can't parse\", headers=hdr)\n\n else:\n # */* or similar, return morse.\n return _morse()", "metadata": "root.unparseable", "header": "['module', '___EOS___']", "index": 494 }, { "content": "@toolong_content_app.route(\"/\")\ndef toolong():\n r = Response()\n r.automatically_set_content_length = False\n r.headers['Content-Length'] = 2300\n if (request.accept_mimetypes.best == 'application/json' or\n request.accept_mimetypes.best == '*/*'):\n r.headers['Content-Type'] = 'application/json'\n r.set_data(INCOMPLETE_JSON)\n elif request.accept_mimetypes.best == 'text/html':\n r.headers['Content-Type'] = 'text/html'\n r.set_data(INCOMPLETE_HTML)\n elif request.accept_mimetypes.best == 'text/plain':\n r.headers['Content-Type'] = 'text/plain'\n r.set_data(INCOMPLETE_PLAIN)\n elif (request.accept_mimetypes.best == 'text/xml' or\n request.accept_mimetypes.best == 'application/xml'):\n r.headers['Content-Type'] = 'text/xml'\n r.set_data(INCOMPLETE_XML)\n else:\n r.headers['Content-Type'] = 'application/json'\n r.set_data(INCOMPLETE_JSON)\n return r", "metadata": "root.toolong", "header": "['module', '___EOS___']", "index": 535 }, { "content": "def _get_port_from_url(url):\n urlo = urlparse.urlparse(url)\n try:\n host, port = urlo.netloc.split(':')\n return port\n except Exception:\n return \"<port>\"", "metadata": "root._get_port_from_url", "header": "['module', '___EOS___']", "index": 559 }, { "content": "def _log_flask(status):\n port = _get_port_from_url(request.url)\n url_line = \"{method} {url} HTTP/1.0\".format(\n method=request.method.upper(), url=request.full_path)\n ua = request.headers.get('user-agent', '')\n logger.info(_log(request.remote_addr, port, url_line, status, ua=ua))", "metadata": "root._log_flask", "header": "['module', '___EOS___']", "index": 567 }, { "content": "@sleep_app.after_request\ndef log_sleep(resp):\n _log_flask(resp.status_code)\n return resp", "metadata": "root.log_sleep", "header": "['module', '___EOS___']", "index": 574 }, { "content": "@status_app.after_request\ndef log_status(resp):\n _log_flask(resp.status_code)\n return resp", "metadata": "root.log_status", "header": "['module', '___EOS___']", "index": 579 }, { "content": "@large_header_app.after_request\ndef log_large_header(resp):\n _log_flask(resp.status_code)\n return resp", "metadata": "root.log_large_header", "header": "['module', '___EOS___']", "index": 584 }, { "content": "def main(port=BASE_PORT):\n logging.basicConfig()\n logger.info(\"Listening...\")\n listen(reactor, port)\n reactor.run()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 589 } ]
[ { "span": "from flask import Flask, request, Response, g", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "import_", "message", "\\u", "from", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "request_", ",_", "Response_", ",_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "http", "bin_", "._", "helpers_", "import_", "get", "\\u", "dict_", ",_", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "protocol_", ",_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "server_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "wsgi_", "import_", "WS", "GI", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "routing_", "import_", "Rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "http_", "import_", "parse", "\\u", "accept", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "mor", "se_", "import_", "mor", "sed", "ict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "ham", "ms", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "als", "o", " ", "update", " ", "version", " ", "in", " ", "setup", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SERVER", "\\u", "HEADER_", "=_", "'", "Ham", "ms", "/{", "version", "}'_", "._", "format_", "(_", "version_", "=_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BASE", "\\u", "PORT_", "=_", "5500", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "empty", "\\u", "response_", "=_", "(_", "'", "HTTP", "/", "1.1", " ", "204", " ", "No", " ", "Conten", "t", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", ":", " ", "{", "hdr", "}\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "._", "format_", "(_", "hdr_", "=_", "SERVER", "\\u", "HEADER_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "JSON_", "=_", "'{", "\"", "message", "\":", " ", "\"", "the", " ", "json", " ", "body", " ", "is", " ", "incomplete", ".\",", " ", "\"", "key", "\":", " ", "{", "\"", "nest", "ed", "\\u", "message", "\":", " ", "\"", "bla", "h", " ", "bla", "h", " ", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "XML_", "=_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "<", "response", "><", "status", " ", "type", "=\"", "http", "\">", "200", " ", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "PLAIN", "_", "=_", "'", "incomplete", " ", "document", " ", "respo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "HTML_", "=_", "'<!", "doct", "ype", " ", "html", "><", "html", "><", "head", "><", "title", ">", "incomplete", "'_", "\\u\\u\\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_", "sleep", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "\\u", "app_", "._", "PORT_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "app_", "._", "PORT_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "\\u", "header", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "\\u", "header", "\\u", "app_", "._", "PORT_", "=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unparse", "able", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unparse", "able", "\\u", "app_", "._", "PORT_", "=_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "ong", "\\u", "content", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "ong", "\\u", "content", "\\u", "app_", "._", "PORT_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\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_", "class_", "Ham", "ms", "Site_", "(_", "Site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ham", "ms", "Site_", "(_", "Site_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "Reso", "urc", "e", "For_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "set", "Header_", "(_", "'", "Server", "'_", ",_", "SERVER", "\\u", "HEADER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Site_", "._", "get", "Reso", "urc", "e", "For_", "(_", "self_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ham", "ms", "Server_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Start", " ", "the", " ", "ham", "ms", " ", "server", " ", "in", " ", "a", " ", "thread", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "hs", " ", "=", " ", "Ham", "ms", "Server", "()", "\\", "10", ";", " ", " ", " ", " ", "hs", ".", "start", "(", "beginn", "ing", "\\u", "port", "=", "5500", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Whe", "n", " ", "you", " ", "are", " ", "don", "e", " ", "working", " ", "with", " ", "ham", "ms", "\\", "10", ";", " ", " ", " ", " ", "hs", ".", "stop", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "beginn", "ing", "\\u", "port", ":", " ", "Ham", "ms", " ", "will", " ", "start", " ", "server", "s", " ", "on", " ", "all", " ", "port", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "beginn", "ing", "\\u", "port", " ", "to", " ", "beginn", "ing", "\\u", "port", " ", "+", " ", "14.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ham", "ms", "Server_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start_", "(_", "self_", ",_", "beginn", "ing", "\\u", "port_", "=_", "BASE", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "beginn", "ing", "\\u", "port_", "=_", "beginn", "ing", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "retr", "y", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "listen_", "(_", "reactor_", ",_", "base", "\\u", "port_", "=_", "self_", "._", "beginn", "ing", "\\u", "port_", ",_", "retr", "y", "\\u", "cache_", "=_", "self_", "._", "retr", "y", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "reactor_", "._", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t_", "=_", "Thread_", "(_", "target_", "=_", "reactor_", "._", "run_", ",_", "args_", "=_", "(_", "False_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ham", "ms", "Server_", "(_", "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_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "listen_", "(_", "\\u", "reactor_", ",_", "base", "\\u", "port_", "=_", "BASE", "\\u", "PORT_", ",_", "retr", "y", "\\u", "cache_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "likelihood", " ", "there", " ", "is", " ", "no", " ", "benefit", " ", "to", " ", "passi", "ng", " ", "in", " ", "the", " ", "react", "or", " ", "as", " ", "only", " ", "one", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "them", " ", "can", " ", "ever", " ", "run", " ", "at", " ", "a", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retr", "y", "\\u", "cache_", "=_", "retr", "y", "\\u", "cache_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retrie", "s", "\\u", "app_", "=_", "create", "\\u", "retrie", "s", "\\u", "app_", "(_", "retr", "y", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "sleep", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "sleep", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "status", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "status", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "large", "\\u", "header", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "large", "\\u", "header", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "\\u", "header", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "large", "\\u", "header", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retrie", "s", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "retrie", "s", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retrie", "s", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "retrie", "s", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unparse", "able", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unparse", "able", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unparse", "able", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "unparse", "able", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tool", "ong", "\\u", "content", "\\u", "resource_", "=_", "WS", "GI", "Resource_", "(_", "reactor_", ",_", "reactor_", "._", "get", "Thread", "Pool_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tool", "ong", "\\u", "content", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "ong", "\\u", "content", "\\u", "site_", "=_", "Ham", "ms", "Site_", "(_", "tool", "ong", "\\u", "content", "\\u", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Listen", "Fore", "ver", "Server_", "._", "PORT_", ",_", "Listen", "Fore", "ver", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "sleep", "\\u", "app_", "._", "PORT_", ",_", "sleep", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "status", "\\u", "app_", "._", "PORT_", ",_", "status", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "large", "\\u", "header", "\\u", "app_", "._", "PORT_", ",_", "large", "\\u", "header", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "retrie", "s", "\\u", "app_", "._", "PORT_", ",_", "retrie", "s", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Drop", "Random", "Request", "s", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Drop", "Random", "Request", "s", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "unparse", "able", "\\u", "app_", "._", "PORT_", ",_", "unparse", "able", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "Incomp", "lete", "Respons", "e", "Server_", "._", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Incomp", "lete", "Respons", "e", "Factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reactor_", "._", "listen", "TCP_", "(_", "base", "\\u", "port_", "+_", "tool", "ong", "\\u", "content", "\\u", "app_", "._", "PORT_", ",_", "tool", "ong", "\\u", "content", "\\u", "site_", ")_", "\\u\\u\\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", "remote", "\\u", "host_", "(_", "transport_", ")_", ":_", "\\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 ", " _", "peer_", "=_", "transport_", "._", "get", "Peer", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "peer_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "ipadd", "r", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "port_", "(_", "transport_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "transport_", "._", "get", "Host_", "(_", ")_", "._", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "port", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "header_", "(_", "header", "\\u", "name_", ",_", "data_", ")_", ":_", "\\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 ", " _", "rli", "ne_", ",_", "raw", "\\u", "headers_", "=_", "data_", "._", "split_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "message", "\\u", "from", "\\u", "string_", "(_", "raw", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "headers_", "._", "get_", "(_", "header", "\\u", "name_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "log", "\\u", "t_", "(_", "transport_", ",_", "data_", ",_", "status_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "get", "\\u", "remote", "\\u", "host_", "(_", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "get", "\\u", "port_", "(_", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ua_", "=_", "get", "\\u", "header_", "(_", "'", "user", "-", "agent", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "log_", "(_", "ipaddr_", ",_", "port_", ",_", "data_", ",_", "status_", "=_", "status_", ",_", "ua_", "=_", "ua_", ")_", "\\u\\u\\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", "log_", "(_", "ipaddr_", ",_", "port_", ",_", "data_", ",_", "status_", "=_", "None_", ",_", "ua_", "=_", "\"\"_", ")_", ":_", "\\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 ", " _", "top", "line_", "=_", "data_", "._", "split_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"{", "ipadd", "r", "}", " ", "{", "port", "}", " ", "\\\\\"{", "top", "line", "}\\\\\"", " ", "{", "status", "}", " ", "\\\\\"{", "ua", "}\\\\\"", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipaddr_", "=_", "ipaddr_", ",_", "port_", "=_", "port_", ",_", "top", "line_", "=_", "top", "line_", ",_", "ua_", "=_", "ua_", ",_", "status_", "=_", "status_", "or_", "\"-\"_", ")_", "\\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 ", " _", "logger_", "._", "exception_", "(_", "\"", "cau", "ght", " ", "exception", " ", "whi", "le", " ", "format", "ting", " ", "log", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"<", "data", " ", "receive", "d", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Listen", "Fore", "ver", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Listen", "Fore", "ver", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Listen", "Fore", "ver", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Listen", "Fore", "ver", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Listen", "Fore", "ver", "Server_", "(_", ")_", "\\u\\u\\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_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "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_", "[SEP]_", "class_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Made", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Emp", "ty", "String", "Terminate", "Immediate", "ly", "Server_", "(_", ")_", "\\u\\u\\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_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "write_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Emp", "ty", "String", "Terminate", "On", "Receive", "Server_", "(_", ")_", "\\u\\u\\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_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "4_", "\\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_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Made", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "'", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Mal", "formed", "String", "Terminate", "Immediate", "ly", "Server_", "(_", ")_", "\\u\\u\\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_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "write_", "(_", "'", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Mal", "formed", "String", "Terminate", "On", "Receive", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "send", "\\u", "byte_", "(_", "self_", ",_", "byte_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\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 ", " _", "timer_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "byte_", "in_", "empty", "\\u", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "call", "Later_", "(_", "timer_", ",_", "self_", "._", "\\u", "send", "\\u", "byte_", ",_", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "+=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "timer_", ",_", "self_", "._", "transport_", "._", "lose", "Connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ",_", "status_", "=_", "204_", ")_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fiv", "e", "Second", "Byte", "Respons", "e", "Server_", "(_", ")_", "\\u\\u\\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_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "7_", "\\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_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "send", "\\u", "byte_", "(_", "self_", ",_", "byte_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\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 ", " _", "timer_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "byte_", "in_", "empty", "\\u", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "call", "Later_", "(_", "timer_", ",_", "self_", "._", "\\u", "send", "\\u", "byte_", ",_", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "+=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "timer_", ",_", "self_", "._", "transport_", "._", "lose", "Connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ",_", "status_", "=_", "204_", ")_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Thi", "rty", "Second", "Byte", "Respons", "e", "Server_", "(_", ")_", "\\u\\u\\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_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ",_", "status_", "=_", "200_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Made", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", ":", " ", "{", "server", "}\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Length", ":", " ", "3", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", ":", " ", "keep", "-", "alive", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "r", "\\\\", "n", "{", "body", "}'_", "._", "format_", "(_", "server_", "=_", "SERVER", "\\u", "HEADER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "'", "a", "'_", "*_", "1024_", "*_", "1024_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Sen", "d", "Data", "Past", "Conten", "t", "Length", "Server_", "(_", ")_", "\\u\\u\\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_", "success", "\\u", "response_", "(_", "content", "\\u", "type_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", ":", " ", "{", "server", "}\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", ":", " ", "{", "ctype", "}\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "response", "}'_", "._", "format_", "(_", "ctype_", "=_", "content", "\\u", "type_", ",_", "server_", "=_", "SERVER", "\\u", "HEADER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "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_", "Drop", "Random", "Request", "s", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "13_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Drop", "Random", "Request", "s", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "data_", "._", "split_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", ",_", "url_", ",_", "http", "\\u", "vs", "n_", "=_", "body_", "[_", "0_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "got", " ", "weird", " ", "data", ",", " ", "just", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "o_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "fail", "rate", "'_", "in_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "rate_", "=_", "query_", "[_", "'", "fail", "rate", "'_", "]_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "rate_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "random_", "._", "random_", "(_", ")_", ">=_", "float_", "(_", "fail", "rate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ",_", "status_", "=_", "200_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "success", "\\u", "response_", "(_", "'", "applica", "tion", "/", "json", "'_", ",_", "'{", "\"", "success", "\":", " ", "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 ", " _", "logger_", "._", "info_", "(_", "\\u", "log", "\\u", "t_", "(_", "self_", "._", "transport_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\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_", "Drop", "Random", "Request", "s", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Drop", "Random", "Request", "s", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Drop", "Random", "Request", "s", "Server_", "(_", ")_", "\\u\\u\\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_", "write", "\\u", "incomplete", "\\u", "response_", "(_", "transport_", ",_", "content", "\\u", "type_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transport_", "._", "write_", "(_", "'", "Conten", "t", "-", "Type", ":", " ", "{", "ctype", "}\\\\", "r", "\\\\", "n", "'_", "._", "format_", "(_", "ctype_", "=_", "content", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "._", "write_", "(_", "'", "Conten", "t", "-", "Length", ":", " ", "{", "length", "}\\\\", "r", "\\\\", "n", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "length_", "=_", "len_", "(_", "body_", ")_", "+_", "2000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "._", "write_", "(_", "'\\\\", "r", "\\\\", "n", "{", "body", "}'_", "._", "format_", "(_", "body_", "=_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Incomp", "lete", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PORT_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Incomp", "lete", "Respons", "e", "Server_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accept", "\\u", "header", "\\u", "value_", "=_", "get", "\\u", "header_", "(_", "'", "Accept", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accept", "\\u", "cls_", "=_", "parse", "\\u", "accept", "\\u", "header_", "(_", "accept", "\\u", "header", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "write_", "(_", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "text", "/", "html", "'_", "==_", "accept", "\\u", "cls_", "._", "best_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "incomplete", "\\u", "response_", "(_", "self_", "._", "transport_", ",_", "'", "text", "/", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "HTML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "text", "/", "plain", "'_", "==_", "accept", "\\u", "cls_", "._", "best_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "incomplete", "\\u", "response_", "(_", "self_", "._", "transport_", ",_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "PLAIN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "text", "/", "xml", "'_", "==_", "accept", "\\u", "cls_", "._", "best_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "incomplete", "\\u", "response_", "(_", "self_", "._", "transport_", ",_", "'", "text", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "XML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "incomplete", "\\u", "response_", "(_", "self_", "._", "transport_", ",_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "INCOM", "PLE", "TE", "\\u", "JSON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Incomp", "lete", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Incomp", "lete", "Respons", "e", "Factory_", "(_", "protocol_", "._", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "Protocol_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Incomp", "lete", "Respons", "e", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "retrie", "s", "\\u", "app_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retrie", "s", "\\u", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retrie", "s", "\\u", "app_", "._", "PORT_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retrie", "s", "\\u", "app_", "._", "cache_", "=_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "want", " ", "the", " ", "retrie", "s", " ", "app", " ", "to", " ", "listen", " ", "on", " ", "all", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "retrie", "s", "\\u", "app_", "._", "url", "\\u", "map_", "._", "add_", "(_", "Rule_", "(_", "'/'_", ",_", "endpoint_", "=_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "retrie", "s", "\\u", "app_", "._", "endpoint_", "(_", "\"", "index", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "retries_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "hdr_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "key", "'_", ",_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tries_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "trie", "s", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tries_", "=_", "int_", "(_", "tries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "status_", "=_", "400_", ",_", "headers_", "=_", "json", "\\u", "hdr_", ",_", "response_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Ple", "ase", " ", "pass", " ", "an", " ", "integ", "er", " ", "number", " ", "of", " ", "trie", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "False_", ",_", "\\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_", "key_", "in_", "retrie", "s", "\\u", "app_", "._", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", "-=_", "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 ", " _", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", "=_", "int_", "(_", "tries_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trie", "s", "\\u", "rema", "inin", "g", "'_", ":_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "data_", ")_", ",_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "json", "\\u", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "The", " ", "server", " ", "had", " ", "an", " ", "error", ".", " ", "Tr", "y", " ", "again", " ", "{", "retr", "y", "\\u", "times", "}", " ", "more", " ", "{", "time", "\\u", "p", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "p_", "=_", "'", "time", "'_", "if_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", "==_", "1_", "else_", "'", "times", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "msg_", "._", "format_", "(_", "retr", "y", "\\u", "times_", "=_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", ",_", "time", "\\u", "p_", "=_", "time", "\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trie", "s", "\\u", "rema", "inin", "g", "'_", ":_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "content_", ")_", ",_", "status_", "=_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "json", "\\u", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "retrie", "s", "\\u", "app_", "._", "route_", "(_", "\"/", "counter", "s", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reset_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "request_", "._", "values_", "._", "get_", "(_", "'", "key", "'_", ",_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tries_", "=_", "request_", "._", "values_", "._", "get_", "(_", "'", "trie", "s", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tries_", "=_", "int_", "(_", "tries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "status_", "=_", "400_", ",_", "headers_", "=_", "json", "\\u", "hdr_", ",_", "response_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Ple", "ase", " ", "pass", " ", "an", " ", "integ", "er", " ", "number", " ", "of", " ", "trie", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retrie", "s", "\\u", "app_", "._", "cache_", "[_", "key_", "]_", "=_", "tries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trie", "s", "\\u", "rema", "inin", "g", "'_", ":_", "tries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "content_", ")_", ",_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "retrie", "s", "\\u", "app_", "._", "route_", "(_", "\"/", "counter", "s", "\"_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "counter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "{_", "'", "counter", "s", "'_", ":_", "retrie", "s", "\\u", "app_", "._", "cache_", ",_", "'", "success", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "content_", ")_", ",_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "retrie", "s", "\\u", "app_", "._", "after", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "retrie", "s", "\\u", "header_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log", "\\u", "flask_", "(_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "headers_", "[_", "'", "Server", "'_", "]_", "=_", "'", "ham", "ms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retrie", "s", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "sleep", "\\u", "app_", "._", "route_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sleep_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "request_", "._", "values_", "._", "get_", "(_", "'", "sleep", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "float_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdrs_", "=_", "get", "\\u", "dict_", "(_", "'", "header", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "hdrs_", ")_", ",_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "status", "\\u", "app_", "._", "route_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "status_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "request_", "._", "values_", "._", "get_", "(_", "'", "status", "'_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "status", "\\u", "code_", "(_", "int_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "large", "\\u", "header", "\\u", "app_", "._", "route_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "large", "\\u", "header_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "request_", "._", "values_", "._", "get_", "(_", "'", "size", "'_", ",_", "63_", "*_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "headers_", "=_", "get", "\\u", "dict_", "(_", "'", "header", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "\\u", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cooki", "e", "'_", ":_", "'", "a", "'_", "*_", "int_", "(_", "n_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "req", "\\u", "headers_", ")_", ",_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "resp", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unparse", "able", "\\u", "app_", "._", "route_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unparse", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "mor", "se_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "text", "/", "mor", "se", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\"", " ", "STOP", " ", "\"_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DEA", "REST", " ", "ANN", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TIMES", " ", "ARE", " ", "HARD", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MY", " ", "TRE", "ADM", "ILL", " ", "DES", "K", " ", "DO", "ES", "NT", " ", "REC", "LINE", " ", "ALL", " ", "THE", " ", "WAY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "THE", " ", "KI", "TCH", "EN", " ", "HAS", "NT", " ", "HA", "D", " ", "SO", "YL", "ENT", " ", "FOR", " ", "TWO", " ", "WH", "OLE", " ", "DAY", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "HO", "W", " ", "IS", " ", "ANY", "ONE", " ", "SUP", "POS", "ED", " ", "TO", " ", "PROGRAM", " ", "IN", " ", "THE", "SE", " ", "CONDITION", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PLE", "AS", "E", " ", "SEND", " ", "HELP", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "+_", "\"", " ", "STOP", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mor", "se", "\\u", "message_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "letter_", "in_", "enumerate_", "(_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mor", "se", "\\u", "message_", "._", "write_", "(_", "mor", "sed", "ict_", "[_", "letter_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "mor", "se", "\\u", "message_", "._", "getvalue_", "(_", ")_", ",_", "headers_", "=_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "text", "/", "mor", "se", "'_", "not_", "in_", "request_", "._", "accept", "\\u", "mimetypes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "mor", "se_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "accept", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "'", "Thi", "s", " ", "is", " ", "a", " ", "JSO", "N", " ", "response", ".", " ", "You", " ", "did", " ", "not", " ", "ask", " ", "for", " ", "JSO", "N", " ", "data", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "json_", "._", "dumps_", "(_", "resp_", ")_", ",_", "headers_", "=_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "accept", "\\u", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "text", "/", "html", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "\"<", "!", "doct", "ype", " ", "html", "><", "html", "><", "head", "><", "title", ">", "You", "r", " ", "API", " ", "is", " ", "Bro", "ken", "</", "title", "><", "/", "head", "><", "body", ">", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "JSO", "N", ".", "</", "body", "><", "/", "html", ">\"_", ",_", "headers_", "=_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "text", "/", "csv", "'_", "not_", "in_", "request_", "._", "accept", "\\u", "mimetypes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "text", "/", "csv", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "\"", "message", ",", "status", "\\\\", "n", "Thi", "s", " ", "is", " ", "a", " ", "CSV", " ", "response", " ", "tha", "t", " ", "your", " ", "code", " ", "alm", "ost", " ", "cert", "ain", "ly", " ", "can", "'", "t", " ", "parse", "\"_", ",_", "headers_", "=_", "hdr_", ")_", "\\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_", "#", " ", "*/", "*", " ", "or", " ", "similar", ",", " ", "return", " ", "mor", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "mor", "se_", "(_", ")_", "\\u\\u\\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_", "@_", "tool", "ong", "\\u", "content", "\\u", "app_", "._", "route_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tool", "ong_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "automati", "call", "y", "\\u", "set\\u", "content", "\\u", "length_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", "=_", "2300", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'", "applica", "tion", "/", "json", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'*/", "*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "set\\u", "data_", "(_", "INCOM", "PLE", "TE", "\\u", "JSON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'", "text", "/", "html", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "set\\u", "data_", "(_", "INCOM", "PLE", "TE", "\\u", "HTML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'", "text", "/", "plain", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "set\\u", "data_", "(_", "INCOM", "PLE", "TE", "\\u", "PLAIN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'", "text", "/", "xml", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best_", "==_", "'", "applica", "tion", "/", "xml", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "set\\u", "data_", "(_", "INCOM", "PLE", "TE", "\\u", "XML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "set\\u", "data_", "(_", "INCOM", "PLE", "TE", "\\u", "JSON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "port", "\\u", "from", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlo", "_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", ",_", "port_", "=_", "urlo", "_", "._", "netloc_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "port", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "log", "\\u", "flask_", "(_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "\\u", "get", "\\u", "port", "\\u", "from", "\\u", "url_", "(_", "request_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "line_", "=_", "\"{", "method", "}", " ", "{", "url", "}", " ", "HTTP", "/", "1.0", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "request_", "._", "method_", "._", "upper_", "(_", ")_", ",_", "url_", "=_", "request_", "._", "full", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ua_", "=_", "request_", "._", "headers_", "._", "get_", "(_", "'", "user", "-", "agent", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u", "log_", "(_", "request_", "._", "remote", "\\u", "addr_", ",_", "port_", ",_", "url", "\\u", "line_", ",_", "status_", ",_", "ua_", "=_", "ua_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "sleep", "\\u", "app_", "._", "after", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log", "\\u", "sleep_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log", "\\u", "flask_", "(_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "status", "\\u", "app_", "._", "after", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log", "\\u", "status_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log", "\\u", "flask_", "(_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "large", "\\u", "header", "\\u", "app_", "._", "after", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log", "\\u", "large", "\\u", "header_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log", "\\u", "flask_", "(_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "port_", "=_", "BASE", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Listen", "ing", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "listen_", "(_", "reactor_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "run_", "(_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
kumar303/jstestnet/jstestnet/system/management/commands/run_gevent.py
[ { "content": " def handle(self, *args, **options):\n \"\"\"Run gevent socketio server.\"\"\"\n logging.basicConfig()\n logging.getLogger().setLevel(logging.INFO)\n try:\n port = int(args[0])\n except:\n port = 8000\n\n # Make blocking calls in socket lib non-blocking:\n monkey.patch_all()\n\n # Start up gevent-socketio stuff\n application = WSGIHandler()\n print 'Listening on http://127.0.0.1:%s and on port 843 (flash policy server)' % port\n SocketIOServer(('', port), application,\n resource='socket.io').serve_forever()", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "except:", "start_line": 20, "start_column": 8, "end_line": 20, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "gev", "ent", " ", "socketio", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "8000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "blockin", "g", " ", "calls", " ", "in", " ", "socket", " ", "lib", " ", "non", "-", "blockin", "g", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "monkey_", "._", "patch", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "up", " ", "gev", "ent", "-", "socketio", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "application_", "=_", "WS", "GI", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Listen", "ing", " ", "on", " ", "http", "://", "127", ".0", ".0", ".1", ":", "%", "s", " ", "and", " ", "on", " ", "port", " ", "843", " ", "(", "flash", " ", "policy", " ", "server", ")'_", "%_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sock", "et", "IO", "Server_", "(_", "(_", "''_", ",_", "port_", ")_", ",_", "application_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "'", "socket", ".", "io", "'_", ")_", "._", "serve", "\\u", "forever_", "(_", ")_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
goldsborough/Writer-Tutorial/Part-3/ext/find.py
[ { "content": "from PyQt4 import QtGui, QtCore\nfrom PyQt4.QtCore import Qt\n\nimport re\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Find(QtGui.QDialog):\n \n\n\n\n", "metadata": "root.Find", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def __init__(self, parent = None):\n \n QtGui.QDialog.__init__(self, parent)\n\n self.parent = parent\n\n self.lastStart = 0\n\n self.initUI()", "metadata": "root.Find.__init__", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 6 }, { "content": " def initUI(self):\n\n # Button to search the document for something\n findButton = QtGui.QPushButton(\"Find\",self)\n findButton.clicked.connect(self.find)\n\n # Button to replace the last finding\n replaceButton = QtGui.QPushButton(\"Replace\",self)\n replaceButton.clicked.connect(self.replace)\n\n # Button to remove all findings\n allButton = QtGui.QPushButton(\"Replace all\",self)\n allButton.clicked.connect(self.replaceAll)\n\n # Normal mode - radio button\n self.normalRadio = QtGui.QRadioButton(\"Normal\",self)\n\n # Regular Expression Mode - radio button\n regexRadio = QtGui.QRadioButton(\"RegEx\",self)\n\n # The field into which to type the query\n self.findField = QtGui.QTextEdit(self)\n self.findField.resize(250,50)\n\n # The field into which to type the text to replace the\n # queried text\n self.replaceField = QtGui.QTextEdit(self)\n self.replaceField.resize(250,50)\n \n layout = QtGui.QGridLayout()\n\n layout.addWidget(self.findField,1,0,1,4)\n layout.addWidget(self.normalRadio,2,2)\n layout.addWidget(regexRadio,2,3)\n layout.addWidget(findButton,2,0,1,2)\n \n layout.addWidget(self.replaceField,3,0,1,4)\n layout.addWidget(replaceButton,4,0,1,2)\n layout.addWidget(allButton,4,2,1,2)\n\n self.setGeometry(300,300,360,250)\n self.setWindowTitle(\"Find and Replace\")\n self.setLayout(layout)\n\n # By default the normal mode is activated\n self.normalRadio.setChecked(True)", "metadata": "root.Find.initUI", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 16 }, { "content": " def find(self):\n\n # Grab the parent's text\n text = self.parent.text.toPlainText()\n\n # And the text to find\n query = self.findField.toPlainText()\n\n if self.normalRadio.isChecked():\n\n # Use normal string search to find the query from the\n # last starting position\n self.lastStart = text.find(query,self.lastStart + 1)\n\n # If the find() method didn't return -1 (not found)\n if self.lastStart >= 0:\n\n end = self.lastStart + len(query)\n \n self.moveCursor(self.lastStart,end)\n\n else:\n\n # Make the next search start from the begining again\n self.lastStart = 0\n \n self.parent.text.moveCursor(QtGui.QTextCursor.End)\n\n else:\n\n # Compile the pattern\n pattern = re.compile(query)\n\n # The actual search\n match = pattern.search(text,self.lastStart + 1)\n\n if match:\n\n self.lastStart = match.start()\n \n self.moveCursor(self.lastStart,match.end())\n\n else:\n\n self.lastStart = 0\n \n # We set the cursor to the end if the search was unsuccessful\n self.parent.text.moveCursor(QtGui.QTextCursor.End)", "metadata": "root.Find.find", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 63 }, { "content": " def replace(self):\n\n # Grab the text cursor\n cursor = self.parent.text.textCursor()\n\n # Security\n if cursor.hasSelection():\n\n # We insert the new text, which will override the selected\n # text\n cursor.insertText(self.replaceField.toPlainText())\n\n # And set the new cursor\n self.parent.text.setTextCursor(cursor)", "metadata": "root.Find.replace", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 112 }, { "content": " def replaceAll(self):\n\n self.lastStart = 0\n\n self.find()\n\n # Replace and find until self.lastStart is 0 again\n while self.lastStart:\n self.replace()\n self.find()", "metadata": "root.Find.replaceAll", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 127 }, { "content": " def moveCursor(self,start,end):\n\n # We retrieve the QTextCursor object from the parent's QTextEdit\n cursor = self.parent.text.textCursor()\n\n # Then we set the position to the beginning of the last match\n cursor.setPosition(start)\n\n # Next we move the Cursor by over the match and pass the KeepAnchor parameter\n # which will make the cursor select the the match's text\n cursor.movePosition(QtGui.QTextCursor.Right,QtGui.QTextCursor.KeepAnchor,end - start)\n\n # And finally we set this new cursor as the parent's \n self.parent.text.setTextCursor(cursor)", "metadata": "root.Find.moveCursor", "header": "['class', 'Find', '(', 'QtGui', '.', 'QDialog', ')', ':', '___EOS___']", "index": 138 } ]
[ { "span": "from PyQt4 import QtGui, QtCore", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 31 }, { "span": "from PyQt4.QtCore import Qt", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Gui_", ",_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Core_", "import_", "Qt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\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_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Qt", "Gui_", "._", "QD", "ial", "og_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "Start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "init", "UI_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "UI_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Butt", "on", " ", "to", " ", "search", " ", "the", " ", "document", " ", "for", " ", "something_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "find", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "\"", "Fin", "d", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "Button_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "find_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Butt", "on", " ", "to", " ", "replace", " ", "the", " ", "last", " ", "finding", "_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "\"", "Replace", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replace", "Button_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Butt", "on", " ", "to", " ", "remove", " ", "all", " ", "finding", "s_", "\\u\\u\\uNL\\u\\u\\u_", "all", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "\"", "Replace", " ", "all", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "Button_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "replace", "All_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normal", " ", "mode", " ", "-", " ", "radio", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "normal", "Radio", "_", "=_", "Qt", "Gui_", "._", "QR", "adio", "Button_", "(_", "\"", "Normal", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Regula", "r", " ", "Expression", " ", "Mode", " ", "-", " ", "radio", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "regex", "Radio", "_", "=_", "Qt", "Gui_", "._", "QR", "adio", "Button_", "(_", "\"", "Reg", "Ex", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "field", " ", "int", "o", " ", "whi", "ch", " ", "to", " ", "type", " ", "the", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "find", "Field_", "=_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "find", "Field_", "._", "resize_", "(_", "250_", ",_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "field", " ", "int", "o", " ", "whi", "ch", " ", "to", " ", "type", " ", "the", " ", "text", " ", "to", " ", "replace", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "queried", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "replace", "Field_", "=_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "replace", "Field_", "._", "resize_", "(_", "250_", ",_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "=_", "Qt", "Gui_", "._", "QG", "rid", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "find", "Field_", ",_", "1_", ",_", "0_", ",_", "1_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "normal", "Radio", "_", ",_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "regex", "Radio", "_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "find", "Button_", ",_", "2_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "replace", "Field_", ",_", "3_", ",_", "0_", ",_", "1_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "replace", "Button_", ",_", "4_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "all", "Button_", ",_", "4_", ",_", "2_", ",_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set", "Geometry_", "(_", "300_", ",_", "300_", ",_", "360_", ",_", "250_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Window", "Title_", "(_", "\"", "Fin", "d", " ", "and", " ", "Replace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "default", " ", "the", " ", "normal", " ", "mode", " ", "is", " ", "activated_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "normal", "Radio", "_", "._", "set", "Checked_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "parent", "'", "s", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "self_", "._", "parent_", "._", "text_", "._", "to", "Plai", "n", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "the", " ", "text", " ", "to", " ", "find_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "self_", "._", "find", "Field_", "._", "to", "Plai", "n", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "normal", "Radio", "_", "._", "is", "Checked_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "normal", " ", "string", " ", "search", " ", "to", " ", "find", " ", "the", " ", "query", " ", "from", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "last", " ", "startin", "g", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Start_", "=_", "text_", "._", "find_", "(_", "query_", ",_", "self_", "._", "last", "Start_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "find", "()", " ", "method", " ", "did", "n", "'", "t", " ", "return", " ", "-1", " ", "(", "not", " ", "found", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "last", "Start_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "self_", "._", "last", "Start_", "+_", "len_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "move", "Cursor_", "(_", "self_", "._", "last", "Start_", ",_", "end_", ")_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "next", " ", "search", " ", "start", " ", "from", " ", "the", " ", "begin", "ing", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "text_", "._", "move", "Cursor_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Cursor_", "._", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compil", "e", " ", "the", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "re_", "._", "compile_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "actual", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "pattern_", "._", "search_", "(_", "text_", ",_", "self_", "._", "last", "Start_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Start_", "=_", "match_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "move", "Cursor_", "(_", "self_", "._", "last", "Start_", ",_", "match_", "._", "end_", "(_", ")_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "set", " ", "the", " ", "cursor", " ", "to", " ", "the", " ", "end", " ", "if", " ", "the", " ", "search", " ", "was", " ", "unsuc", "cess", "ful_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "text_", "._", "move", "Cursor_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Cursor_", "._", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\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_", "replace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "text", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "parent_", "._", "text_", "._", "text", "Cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Secur", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", "._", "has", "Selection_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "insert", " ", "the", " ", "new", " ", "text", ",", " ", "whi", "ch", " ", "will", " ", "override", " ", "the", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "insert", "Text_", "(_", "self_", "._", "replace", "Field_", "._", "to", "Plai", "n", "Text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "set", " ", "the", " ", "new", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "text_", "._", "set", "Text", "Cursor_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "All_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "and", " ", "find", " ", "unti", "l", " ", "self", ".", "last", "Start", " ", "is", " ", "0", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "self_", "._", "last", "Start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "replace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Find_", "(_", "Qt", "Gui_", "._", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "Cursor_", "(_", "self_", ",_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "retrieve", " ", "the", " ", "QT", "ext", "Curs", "or", " ", "object", " ", "from", " ", "the", " ", "parent", "'", "s", " ", "QT", "ext", "Edit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "parent_", "._", "text_", "._", "text", "Cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "we", " ", "set", " ", "the", " ", "position", " ", "to", " ", "the", " ", "beginn", "ing", " ", "of", " ", "the", " ", "last", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "set", "Position_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "we", " ", "move", " ", "the", " ", "Curs", "or", " ", "by", " ", "over", " ", "the", " ", "match", " ", "and", " ", "pass", " ", "the", " ", "Keep", "Anc", "hor", " ", "parameter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "will", " ", "make", " ", "the", " ", "cursor", " ", "select", " ", "the", " ", "the", " ", "match", "'", "s", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "move", "Position_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Cursor_", "._", "Right_", ",_", "Qt", "Gui_", "._", "QT", "ext", "Cursor_", "._", "Keep", "Anchor_", ",_", "end_", "-_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "final", "ly", " ", "we", " ", "set", " ", "this", " ", "new", " ", "cursor", " ", "as", " ", "the", " ", "parent", "'", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "text_", "._", "set", "Text", "Cursor_", "(_", "cursor_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
espeed/bulbs/bulbs/json.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2012 James Thornton (http://jamesthornton.com)\n# BSD License (see LICENSE for details)\n#\n\"\"\"\nThe JSON Type System.\n\n\"\"\"\n# Python 3\nimport six\nimport sys\nif sys.version > '3':\n long = int\n unicode = str\n\nfrom bulbs.base import TypeSystem, Converter\nfrom .utils import to_timestamp, to_datetime, to_datestamp, to_date, json\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DatabaseConverter(Converter):\n \"\"\"\n Converts Python values to database values.\n\n .. note:: Python to JSON conversion is usually just a simple pass through.\n\n \"\"\"\n\n \n\n\n\n\n\n\n\n", "metadata": "root.DatabaseConverter", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def to_string(self, value):\n \"\"\"\n Converts a Python byte string to a unicode string.\n \n :param value: Property value. \n :type value: str or None\n\n :rtype: unicode or None\n\n :raises: ValueError\n\n \"\"\"\n # NOTE: Using unicode instead of str\n if value is not None:\n return unicode(value)", "metadata": "root.DatabaseConverter.to_string", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 27 }, { "content": " def to_integer(self, value):\n \"\"\"\n Passes through a Python integer.\n\n :param value: Property value. \n :type value: int or None\n\n :rtype: int or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_integer", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 43 }, { "content": " def to_long(self, value):\n \"\"\"\n Passes through a Python long.\n\n :param value: Property value. \n :type value: long or None\n\n :rtype: long or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_long", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 55 }, { "content": " def to_bool(self, value):\n \"\"\"\n Passes through a Python bool.\n\n :param value: Property value.\n :type value: bool or None\n\n :rtype: bool or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_bool", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 67 }, { "content": " def to_float(self, value):\n \"\"\"\n Passes through a Python float.\n\n :param value: Property value. \n :type value: float or None\n\n :rtype: float or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_float", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 79 }, { "content": " def to_list(self, value):\n \"\"\"\n Passes through a Python list.\n\n :param value: Property value. \n :type value: list or None\n\n :rtype: list or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_list", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 91 }, { "content": " def to_dictionary(self, value):\n \"\"\"\n Passes through a Python dictionary.\n\n :param value: Property value. \n :type value: dict or None\n\n :rtype: dict or None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_dictionary", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 103 }, { "content": " def to_datetime(self, value):\n \"\"\"\n Converts a Python datetime object to a timestamp integer.\n\n :param value: Property value. \n :type value: datetime or None\n\n :rtype: int or None\n\n \"\"\"\n if value is not None:\n return to_timestamp(value)", "metadata": "root.DatabaseConverter.to_datetime", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 115 }, { "content": " def to_date(self, value):\n \"\"\"\n Converts a Python date object to a timestamp integer.\n\n :param value: Property value. \n :type value: date or None\n\n :rtype: int or None\n\n \"\"\"\n if value is not None:\n return to_datestamp(value)", "metadata": "root.DatabaseConverter.to_date", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 128 }, { "content": " def to_null(self, value):\n \"\"\"\n Passes through a Python None.\n\n :param value: Property value. \n :type value: None\n\n :rtype: None\n\n \"\"\"\n return value", "metadata": "root.DatabaseConverter.to_null", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 141 }, { "content": " def to_document(self, value):\n \"\"\"\n Converts a Python object to a json string\n\n :param value: Property value.\n :type value: dict or list or None\n\n :rtype: unicode or None\n \"\"\"\n if value is not None:\n return unicode(json.dumps(value))", "metadata": "root.DatabaseConverter.to_document", "header": "['class', 'DatabaseConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 153 }, { "content": "class PythonConverter(Converter):\n \"\"\"Converts database values to Python values.\"\"\"\n\n # TODO: Why are we checking if value is not None?\n # This is supposed to be handled elsewhere.\n # Conversion exceptions are now handled in Property.convert_to_python() \n \n\n\n\n\n\n\n\n \n", "metadata": "root.PythonConverter", "header": "['module', '___EOS___']", "index": 166 }, { "content": " def to_string(self, value):\n \"\"\"\n Converts a JSON string to a Python unicode string.\n \n :param value: Property value. \n :type value: str or None\n\n :rtype: unicode or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return unicode(value)", "metadata": "root.PythonConverter.to_string", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 173 }, { "content": " def to_integer(self, value):\n \"\"\"\n Converts a JSON number to a Python integer.\n\n :param value: Property value. \n :type value: int or None\n\n :rtype: int or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return int(value)", "metadata": "root.PythonConverter.to_integer", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 188 }, { "content": " def to_long(self, value):\n \"\"\"\n Converts a JSON number to a Python long.\n\n :param value: Property value. \n :type value: long or None\n\n :rtype: long or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return long(value)", "metadata": "root.PythonConverter.to_long", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 203 }, { "content": " def to_float(self, value):\n \"\"\"\n Converts a JSON number to a Python float.\n\n :param value: Property value. \n :type value: float or None\n\n :rtype: float or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return float(value) ", "metadata": "root.PythonConverter.to_float", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 218 }, { "content": " def to_bool(self, value):\n \"\"\"\n Converts a JSON boolean value to a Python bool.\n\n :param value: Property value.\n :type value: bool or None\n\n :rtype: bool or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return bool(value)", "metadata": "root.PythonConverter.to_bool", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 233 }, { "content": " def to_list(self, value):\n \"\"\"\n Converts a JSON list to a Python list.\n\n :param value: Property value. \n :type value: list or None\n\n :rtype: list or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return list(value)", "metadata": "root.PythonConverter.to_list", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 248 }, { "content": " def to_dictionary(self, value):\n \"\"\"\n Converts a JSON map to a Python dictionary. \n\n :param value: Property value. \n :type value: dict or unicode or None\n\n :rtype: dict or None\n\n :raises: ValueError\n\n \"\"\"\n if value is None:\n return None\n\n if isinstance(value, unicode):\n return json.loads(value)\n\n return dict(value)", "metadata": "root.PythonConverter.to_dictionary", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 263 }, { "content": " def to_datetime(self, value):\n \"\"\"\n Converts a JSON integer timestamp to a Python datetime object.\n\n :param value: Property value. \n :type value: int or None\n\n :rtype: datetime or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return to_datetime(value)", "metadata": "root.PythonConverter.to_datetime", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 283 }, { "content": " def to_date(self, value):\n \"\"\"\n Converts a JSON integer timestamp to a Python date object.\n\n :param value: Property value. \n :type value: int or None\n\n :rtype: date or None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n return to_date(value)", "metadata": "root.PythonConverter.to_date", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 298 }, { "content": " def to_null(self, value):\n \"\"\"\n Converts a JSON null to a Python None.\n\n :param value: Property value. \n :type value: None\n\n :rtype: None\n\n :raises: ValueError\n\n \"\"\"\n if value is not None:\n raise ValueError\n\n return None", "metadata": "root.PythonConverter.to_null", "header": "['class', 'PythonConverter', '(', 'Converter', ')', ':', '___EOS___']", "index": 313 }, { "content": "class JSONTypeSystem(TypeSystem):\n \"\"\"\n Converts database properties to and from their JSON representations.\n\n :cvar content_type: The backend client's content type.\n :cvar database: Converter object. Converts Python values to database values.\n :cvar python: Converter object. Converts database values to Python values.\n\n \"\"\"\n content_type = \"application/json\"\n\n database = DatabaseConverter()\n python = PythonConverter()", "metadata": "root.JSONTypeSystem", "header": "['module', '___EOS___']", "index": 331 } ]
[ { "span": "import six", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "Jam", "es", " ", "Tho", "rn", "ton", " ", "(", "http", "://", "jam", "est", "horn", "ton", ".", "com", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BS", "D", " ", "License", " ", "(", "see", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "JSO", "N", " ", "Type", " ", "System", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "version_", ">_", "'", "3", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "bulb", "s_", "._", "base_", "import_", "Type", "System_", ",_", "Converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "to", "\\u", "timestamp_", ",_", "to", "\\u", "datetime_", ",_", "to", "\\u", "dates", "tamp", "_", ",_", "to", "\\u", "date_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "Pyth", "on", " ", "values", " ", "to", " ", "databa", "se", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", " ", "Pyth", "on", " ", "to", " ", "JSO", "N", " ", "conve", "rsi", "on", " ", "is", " ", "usual", "ly", " ", "just", " ", "a", " ", "simple", " ", "pass", " ", "through", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "to", "\\u", "string_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "Pyth", "on", " ", "byte", " ", "string", " ", "to", " ", "a", " ", "unicode", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "str", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "unicode", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Us", "ing", " ", "unicode", " ", "inst", "ead", " ", "of", " ", "str_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "integer_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "long_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "long", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "long", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "long", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "bool_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "bool", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "bool", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "float_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "float", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "float", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "float", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "list_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "list", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dictionary_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "dictionar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "dict", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "datetime_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "Pyth", "on", " ", "datetime", " ", "object", " ", "to", " ", "a", " ", "timestamp", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "datetime", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "timestamp_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "date_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "Pyth", "on", " ", "date", " ", "object", " ", "to", " ", "a", " ", "timestamp", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "date", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "dates", "tamp", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "null_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "through", " ", "a", " ", "Pyth", "on", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "document_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "Pyth", "on", " ", "object", " ", "to", " ", "a", " ", "json", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "dict", " ", "or", " ", "list", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "unicode", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "json_", "._", "dumps_", "(_", "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_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "databa", "se", " ", "values", " ", "to", " ", "Pyth", "on", " ", "values", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Wh", "y", " ", "are", " ", "we", " ", "checking", " ", "if", " ", "value", " ", "is", " ", "not", " ", "Non", "e", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "be", " ", "handle", "d", " ", "else", "where", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Conversion", " ", "exception", "s", " ", "are", " ", "now", " ", "handle", "d", " ", "in", " ", "Proper", "ty", ".", "convert", "\\u", "to", "\\u", "python", "()", " _", "\\u\\u\\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_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "string_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "string", " ", "to", " ", "a", " ", "Pyth", "on", " ", "unicode", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "str", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "unicode", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "integer_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "number", " ", "to", " ", "a", " ", "Pyth", "on", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "long_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "number", " ", "to", " ", "a", " ", "Pyth", "on", " ", "long", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "long", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "long", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "long_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "float_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "number", " ", "to", " ", "a", " ", "Pyth", "on", " ", "float", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "float", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "float", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "bool_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "boolean", " ", "value", " ", "to", " ", "a", " ", "Pyth", "on", " ", "bool", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "bool", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "list_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "list", " ", "to", " ", "a", " ", "Pyth", "on", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "list", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dictionary_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "map", " ", "to", " ", "a", " ", "Pyth", "on", " ", "dictionar", "y", ".", " ", " ", " ", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "dict", " ", "or", " ", "unicode", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "loads_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dict_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "datetime_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "integ", "er", " ", "timestamp", " ", "to", " ", "a", " ", "Pyth", "on", " ", "datetime", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "datetime", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "datetime_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "date_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "integ", "er", " ", "timestamp", " ", "to", " ", "a", " ", "Pyth", "on", " ", "date", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "int", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "date", " ", "or", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "date_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Converter_", "(_", "Converter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "null_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "JSO", "N", " ", "null", " ", "to", " ", "a", " ", "Pyth", "on", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "Proper", "ty", " ", "value", ".", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "value", ":", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Value", "Error", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "JSO", "NT", "ype", "System_", "(_", "Type", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "databa", "se", " ", "proper", "ties", " ", "to", " ", "and", " ", "from", " ", "thei", "r", " ", "JSO", "N", " ", "representations", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "cvar", " ", "content", "\\u", "type", ":", " ", "The", " ", "back", "end", " ", "client", "'", "s", " ", "content", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "cvar", " ", "databa", "se", ":", " ", "Converte", "r", " ", "object", ".", " ", "Convert", "s", " ", "Pyth", "on", " ", "values", " ", "to", " ", "databa", "se", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "cvar", " ", "python", ":", " ", "Converte", "r", " ", "object", ".", " ", "Convert", "s", " ", "databa", "se", " ", "values", " ", "to", " ", "Pyth", "on", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "database_", "=_", "Databa", "se", "Converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python_", "=_", "Pyth", "on", "Converter_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/tlslite/BaseDB.py
[ { "content": " def __getitem__(self, username):\n if self.db == None:\n raise AssertionError(\"DB not open\")\n\n self.lock.acquire()\n try:\n valueStr = self.db[username]\n finally:\n self.lock.release()\n\n return self._getItem(username, valueStr)", "metadata": "root.BaseDB.__getitem__", "header": "['class', 'BaseDB', ':', '___EOS___']", "index": 42 }, { "content": " def __setitem__(self, username, value):\n if self.db == None:\n raise AssertionError(\"DB not open\")\n\n valueStr = self._setItem(username, value)\n\n self.lock.acquire()\n try:\n self.db[username] = valueStr\n if self.filename:\n self.db.sync()\n finally:\n self.lock.release()", "metadata": "root.BaseDB.__setitem__", "header": "['class', 'BaseDB', ':', '___EOS___']", "index": 54 }, { "content": " def __delitem__(self, username):\n if self.db == None:\n raise AssertionError(\"DB not open\")\n\n self.lock.acquire()\n try:\n del(self.db[username])\n if self.filename:\n self.db.sync()\n finally:\n self.lock.release()", "metadata": "root.BaseDB.__delitem__", "header": "['class', 'BaseDB', ':', '___EOS___']", "index": 68 }, { "content": " def __contains__(self, username):\n \"\"\"Check if the database contains the specified username.\n\n @type username: str\n @param username: The username to check for.\n\n @rtype: bool\n @return: True if the database contains the username, False\n otherwise.\n\n \"\"\"\n if self.db == None:\n raise AssertionError(\"DB not open\")\n\n self.lock.acquire()\n try:\n return self.db.has_key(username)\n finally:\n self.lock.release()", "metadata": "root.BaseDB.__contains__", "header": "['class', 'BaseDB', ':', '___EOS___']", "index": 80 }, { "content": " def keys(self):\n \"\"\"Return a list of usernames in the database.\n\n @rtype: list\n @return: The usernames in the database.\n \"\"\"\n if self.db == None:\n raise AssertionError(\"DB not open\")\n\n self.lock.acquire()\n try:\n usernames = self.db.keys()\n finally:\n self.lock.release()\n usernames = [u for u in usernames if not u.startswith(\"--Reserved--\")]\n return usernames", "metadata": "root.BaseDB.keys", "header": "['class', 'BaseDB', ':', '___EOS___']", "index": 104 } ]
[ { "span": "self.db == None:", "start_line": 43, "start_column": 11, "end_line": 43, "end_column": 26 }, { "span": "self.db == None:", "start_line": 55, "start_column": 11, "end_line": 55, "end_column": 26 }, { "span": "self.db == None:", "start_line": 69, "start_column": 11, "end_line": 69, "end_column": 26 }, { "span": "self.db == None:", "start_line": 91, "start_column": 11, "end_line": 91, "end_column": 26 }, { "span": "self.db == None:", "start_line": 110, "start_column": 11, "end_line": 110, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Base", "DB_", ":_", "\\u\\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", "getitem\\u\\u_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "db_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "DB", " ", "not", " ", "open", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "Str_", "=_", "self_", "._", "db_", "[_", "username_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "get", "Item_", "(_", "username_", ",_", "value", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "DB_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "username_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "db_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "DB", " ", "not", " ", "open", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value", "Str_", "=_", "self_", "._", "\\u", "set", "Item_", "(_", "username_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "[_", "username_", "]_", "=_", "value", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "DB_", ":_", "\\u\\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", "delitem\\u\\u_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "db_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "DB", " ", "not", " ", "open", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "(_", "self_", "._", "db_", "[_", "username_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "DB_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "if", " ", "the", " ", "databa", "se", " ", "contain", "s", " ", "the", " ", "specified", " ", "user", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "user", "name", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "user", "name", ":", " ", "The", " ", "user", "name", " ", "to", " ", "check", " ", "for", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "databa", "se", " ", "contain", "s", " ", "the", " ", "user", "name", ",", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "db_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "DB", " ", "not", " ", "open", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "db_", "._", "has", "\\u", "key_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "DB_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "usernames", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "The", " ", "usernames", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "db_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "DB", " ", "not", " ", "open", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usernames", "_", "=_", "self_", "._", "db_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "usernames", "_", "=_", "[_", "u_", "for_", "u_", "in_", "usernames", "_", "if_", "not_", "u_", "._", "startswith_", "(_", "\"--", "Reserve", "d", "--\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "usernames", "_" ]
[ 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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kashefy/nideep/nideep/datasets/pascal_context.py
[ { "content": "'''\nCreated on Jul 21, 2015\n\n@author: kashefy\n'''\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom PIL import Image\nimport caffe\nfrom nideep.iow.read_img import read_img_cv2, read_img_PIL\n\nif __name__ == '__main__':\n \n caffe.set_mode_cpu()\n \n # load image, switch to BGR, subtract mean, and make dims C x H x W for Caffe\n path_img = '/home/kashefy/data/VOCdevkit/VOC2012/JPEGImagesX/2008_000015.jpg'\n \n bgr_mean = np.array((104.00698793,116.66876762,122.67891434))\n im = Image.open(path_img)\n in_ = np.array(im, dtype=np.float32)\n in_ = in_[:,:,::-1]\n print in_.shape\n print in_\n in_ -= bgr_mean\n print in_\n in_ = in_.transpose((2,0,1))\n \n in_ = read_img_PIL(path_img, mean=bgr_mean)\n \n print 'in_'\n print in_[0, 0, 0:6]\n print in_[1, 0, 0:6]\n print in_[2, 0, 0:6]\n \n in2 = read_img_cv2(path_img, mean=bgr_mean)\n print in2.shape\n #in2[0, :, :] -= 104.00698793\n #in2[1, :, :] -= 116.66876762\n #in2[2, :, :] -= 122.67891434\n \n print in2[0, 0, 0:6]\n print in2[1, 0, 0:6]\n print in2[2, 0, 0:6]\n \n print np.all(in_ == in2)\n print in_[in_ != in2]\n print in2[in_ != in2]\n return 0\n \n # load net\n path_model = '/home/kashefy/data/models/fcn_segm/fcn-32s-Pascal-context/deploy.prototxt'\n path_weights = '/home/kashefy/data/models/fcn_segm/fcn-32s-Pascal-context/fcn-32s-pascalcontext.caffemodel'\n net = caffe.Net(path_model, path_weights, caffe.TEST)\n # shape for input (data blob is N x C x H x W), set data\n net.blobs['data'].reshape(1, *in_.shape)\n net.blobs['data'].data[...] = in_ \n \n\n \n \n # run net and take argmax for prediction\n# net.forward()\n# out = net.blobs['score'].data[0].argmax(axis=0)\n# \n# \n# print 'data after fwd'\n# print net.blobs['data'].data[net.blobs['data'].data.shape[0]/2-3:net.blobs['data'].data.shape[0]/2+3,\n# net.blobs['data'].data.shape[1]/2-3:net.blobs['data'].data.shape[1]/2+3]\n# \n# print 'out'\n# print out[out.shape[0]/2-3:out.shape[0]/2+3,\n# out.shape[1]/2-3:out.shape[1]/2+3]\n# plt.imshow(out)\n# plt.show()\n \n pass", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import matplotlib.pyplot as plt", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Ju", "l", " ", "21", ",", " ", "201", "5", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "kas", "hef", "y", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "caffe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nid", "eep", "_", "._", "io", "w_", "._", "read", "\\u", "img_", "import_", "read", "\\u", "img", "\\u", "cv2_", ",_", "read", "\\u", "img", "\\u", "PIL_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caffe", "_", "._", "set\\u", "mode", "\\u", "cpu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "image", ",", " ", "switch", " ", "to", " ", "BG", "R", ",", " ", "subtract", " ", "mean", ",", " ", "and", " ", "make", " ", "dims", " ", "C", " ", "x", " ", "H", " ", "x", " ", "W", " ", "for", " ", "Ca", "ffe", "_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "img_", "=_", "'/", "home", "/", "kas", "hef", "y", "/", "data", "/", "VOC", "dev", "kit", "/", "VOC", "2012", "/", "JP", "EG", "Image", "s", "X", "/", "2008", "\\u", "00001", "5", ".", "jp", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bgr", "\\u", "mean_", "=_", "np_", "._", "array_", "(_", "(_", "104", ".00", "698", "793", "_", ",_", "116", ".6", "687", "676", "2_", ",_", "122.", "678", "914", "34_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "Image_", "._", "open_", "(_", "path", "\\u", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in\\u_", "=_", "np_", "._", "array_", "(_", "im_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in\\u_", "=_", "in\\u_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in\\u_", "-=_", "bgr", "\\u", "mean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in\\u_", "=_", "in\\u_", "._", "transpose_", "(_", "(_", "2_", ",_", "0_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in\\u_", "=_", "read", "\\u", "img", "\\u", "PIL_", "(_", "path", "\\u", "img_", ",_", "mean_", "=_", "bgr", "\\u", "mean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "in", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "[_", "0_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "[_", "1_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "[_", "2_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "2_", "=_", "read", "\\u", "img", "\\u", "cv2_", "(_", "path", "\\u", "img_", ",_", "mean_", "=_", "bgr", "\\u", "mean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in", "2_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "in", "2", "[", "0", ",", " ", ":,", " ", ":]", " ", "-=", " ", "104", ".00", "698", "793", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "in", "2", "[", "1", ",", " ", ":,", " ", ":]", " ", "-=", " ", "116", ".6", "687", "676", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", "in", "2", "[", "2", ",", " ", ":,", " ", ":]", " ", "-=", " ", "122.", "678", "914", "34_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "in", "2_", "[_", "0_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in", "2_", "[_", "1_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in", "2_", "[_", "2_", ",_", "0_", ",_", "0_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "np_", "._", "all_", "(_", "in\\u_", "==_", "in", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in\\u_", "[_", "in\\u_", "!=_", "in", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "in", "2_", "[_", "in\\u_", "!=_", "in", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "net_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "model_", "=_", "'/", "home", "/", "kas", "hef", "y", "/", "data", "/", "model", "s", "/", "fcn", "\\u", "segm", "/", "fcn", "-", "32", "s", "-", "Pas", "cal", "-", "context", "/", "deploy", ".", "protot", "xt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "weights_", "=_", "'/", "home", "/", "kas", "hef", "y", "/", "data", "/", "model", "s", "/", "fcn", "\\u", "segm", "/", "fcn", "-", "32", "s", "-", "Pas", "cal", "-", "context", "/", "fcn", "-", "32", "s", "-", "pasc", "alc", "onte", "xt", ".", "caffe", "model", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net_", "=_", "caffe", "_", "._", "Net_", "(_", "path", "\\u", "model_", ",_", "path", "\\u", "weights_", ",_", "caffe", "_", "._", "TEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shape", " ", "for", " ", "input", " ", "(", "data", " ", "blob", " ", "is", " ", "N", " ", "x", " ", "C", " ", "x", " ", "H", " ", "x", " ", "W", "),", " ", "set", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "net_", "._", "blobs_", "[_", "'", "data", "'_", "]_", "._", "reshape_", "(_", "1_", ",_", "*_", "in\\u_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net_", "._", "blobs_", "[_", "'", "data", "'_", "]_", "._", "data_", "[_", "..._", "]_", "=_", "in\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "net", " ", "and", " ", "take", " ", "argm", "ax", " ", "for", " ", "prediction_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "net", ".", "forward", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "=", " ", "net", ".", "blobs", "['", "score", "']", ".", "data", "[", "0", "].", "argm", "ax", "(", "axis", "=", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "data", " ", "after", " ", "fw", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "net", ".", "blobs", "['", "data", "']", ".", "data", "[", "net", ".", "blobs", "['", "data", "']", ".", "data", ".", "shape", "[", "0", "]/", "2", "-", "3", ":", "net", ".", "blobs", "['", "data", "']", ".", "data", ".", "shape", "[", "0", "]/", "2", "+", "3", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "net", ".", "blobs", "['", "data", "']", ".", "data", ".", "shape", "[", "1", "]/", "2", "-", "3", ":", "net", ".", "blobs", "['", "data", "']", ".", "data", ".", "shape", "[", "1", "]/", "2", "+", "3", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "out", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "out", "[", "out", ".", "shape", "[", "0", "]/", "2", "-", "3", ":", "out", ".", "shape", "[", "0", "]/", "2", "+", "3", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "out", ".", "shape", "[", "1", "]/", "2", "-", "3", ":", "out", ".", "shape", "[", "1", "]/", "2", "+", "3", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "ims", "how", "(", "out", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "show", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
ngageoint/cocreate/ccl-cookbook/files/default/cocreatelite/cocreate/models.py
[ { "content": " def fingerprint(self):\n try:\n pubkey = sshpubkeys.SSHKey(self.key)\n return pubkey.hash()\n #except sshpubkeys.InvalidKeyException:\n # return \"Invalid Key\"\n except:\n \"\"\"There are a small parcel of exceptions that can be throw to indicate invalid keys\"\"\"\n return \"\"", "metadata": "root.SshKey.fingerprint", "header": "['class', 'SshKey', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 43 }, { "content": " def keytype(self):\n try:\n pubkey = sshpubkeys.SSHKey(self.key)\n return \"%s (%d bit)\" % (pubkey.key_type.decode('ascii'), pubkey.bits)\n #except sshpubkeys.InvalidKeyException:\n # return \"Invalid Key\"\n except:\n \"\"\"There are a small parcel of exceptions that can be throw to indicate invalid keys\"\"\"\n return \"\"", "metadata": "root.SshKey.keytype", "header": "['class', 'SshKey', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 53 }, { "content": " def isValid(self):\n try:\n pubkey = sshpubkeys.SSHKey(self.key)\n return True\n except:\n return False", "metadata": "root.SshKey.isValid", "header": "['class', 'SshKey', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 63 }, { "content": " def _getJsonMeta(self, key):\n try:\n meta = json.loads(self.metadata)\n return meta[key]\n except:\n return None", "metadata": "root.VMSandbox._getJsonMeta", "header": "['class', 'VMSandbox', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 247 } ]
[ { "span": "except:", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 15 }, { "span": "except:", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 15 }, { "span": "except:", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 15 }, { "span": "except:", "start_line": 251, "start_column": 8, "end_line": 251, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Ss", "h", "Key_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fingerprint_", "(_", "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 ", " _", "pubkey_", "=_", "ssh", "pubkey", "s_", "._", "SSH", "Key_", "(_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pubkey_", "._", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "except", " ", "ssh", "pubkey", "s", ".", "Inva", "lid", "Key", "Except", "ion", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "\"", "Inva", "lid", " ", "Key", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "There", " ", "are", " ", "a", " ", "small", " ", "parcel", " ", "of", " ", "exception", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "throw", " ", "to", " ", "indicat", "e", " ", "invalid", " ", "keys", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ss", "h", "Key_", "(_", "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_", "def_", "keyt", "ype_", "(_", "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 ", " _", "pubkey_", "=_", "ssh", "pubkey", "s_", "._", "SSH", "Key_", "(_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", " ", "(%", "d", " ", "bit", ")\"_", "%_", "(_", "pubkey_", "._", "key", "\\u", "type_", "._", "decode_", "(_", "'", "ascii", "'_", ")_", ",_", "pubkey_", "._", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "except", " ", "ssh", "pubkey", "s", ".", "Inva", "lid", "Key", "Except", "ion", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "\"", "Inva", "lid", " ", "Key", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "There", " ", "are", " ", "a", " ", "small", " ", "parcel", " ", "of", " ", "exception", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "throw", " ", "to", " ", "indicat", "e", " ", "invalid", " ", "keys", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ss", "h", "Key_", "(_", "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_", "def_", "is", "Valid_", "(_", "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 ", " _", "pubkey_", "=_", "ssh", "pubkey", "s_", "._", "SSH", "Key_", "(_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VM", "Sandbox", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Js", "on", "Meta_", "(_", "self_", ",_", "key_", ")_", ":_", "\\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 ", " _", "meta_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "metadata_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
saltstack/salt/salt/modules/ipset.py
[ { "content": "def flush(set=None, family='ipv4'):\n '''\n Flush entries in the specified set,\n Flush all sets if set is not specified.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' ipset.flush\n\n salt '*' ipset.flush set\n\n IPv6:\n salt '*' ipset.flush\n\n salt '*' ipset.flush set\n '''\n\n settype = _find_set_type(set)\n if not settype:\n return 'Error: Set {0} does not exist'.format(set)\n\n ipset_family = _IPSET_FAMILIES[family]\n if set:\n #cmd = '{0} flush {1} family {2}'.format(_ipset_cmd(), set, ipset_family)\n cmd = '{0} flush {1}'.format(_ipset_cmd(), set)\n else:\n #cmd = '{0} flush family {1}'.format(_ipset_cmd(), ipset_family)\n cmd = '{0} flush'.format(_ipset_cmd())\n out = __salt__['cmd.run'](cmd, python_shell=False)\n\n if len(out) == 0:\n return True\n else:\n return False", "metadata": "root.flush", "header": "['module', '___EOS___']", "index": 529 } ]
[ { "span": "ipset_family ", "start_line": 552, "start_column": 4, "end_line": 552, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flush_", "(_", "set_", "=_", "None_", ",_", "family_", "=_", "'", "ipv", "4", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Flu", "sh", " ", "entri", "es", " ", "in", " ", "the", " ", "specified", " ", "set", ",", "\\", "10", ";", " ", " ", " ", " ", "Flu", "sh", " ", "all", " ", "sets", " ", "if", " ", "set", " ", "is", " ", "not", " ", "specified", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "ipse", "t", ".", "flush", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "ipse", "t", ".", "flush", " ", "set", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "IP", "v6", ":", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "ipse", "t", ".", "flush", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "ipse", "t", ".", "flush", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sett", "ype_", "=_", "\\u", "find", "\\u", "set\\u", "type_", "(_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sett", "ype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Error", ":", " ", "Set", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "'_", "._", "format_", "(_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ipse", "t", "\\u", "family_", "=_", "\\u", "IPS", "ET", "\\u", "FA", "MIL", "IES_", "[_", "family_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cmd", " ", "=", " ", "'{", "0", "}", " ", "flush", " ", "{", "1", "}", " ", "famil", "y", " ", "{", "2", "}'", ".", "format", "(\\u", "ipse", "t", "\\u", "cmd", "()", ",", " ", "set", ",", " ", "ipse", "t", "\\u", "famil", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'{", "0", "}", " ", "flush", " ", "{", "1", "}'_", "._", "format_", "(_", "\\u", "ipse", "t", "\\u", "cmd_", "(_", ")_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cmd", " ", "=", " ", "'{", "0", "}", " ", "flush", " ", "famil", "y", " ", "{", "1", "}'", ".", "format", "(\\u", "ipse", "t", "\\u", "cmd", "()", ",", " ", "ipse", "t", "\\u", "famil", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'{", "0", "}", " ", "flush", "'_", "._", "format_", "(_", "\\u", "ipse", "t", "\\u", "cmd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "cmd", ".", "run", "'_", "]_", "(_", "cmd_", ",_", "python", "\\u", "shell_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "out_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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 ]
Except block handles 'BaseException'
agrover/targetcli-fb/targetcli/ui_target.py
[ { "content": " def summary(self):\n try:\n self.rtsnode.fabric_module.to_normalized_wwn(self.rtsnode.wwn)\n except:\n return (\"INVALID WWN\", False)\n\n return (\"TPGs: %d\" % len(self._children), None)", "metadata": "root.UIMultiTPGTarget.summary", "header": "['class', 'UIMultiTPGTarget', '(', 'UIRTSLibNode', ')', ':', '___EOS___']", "index": 299 }, { "content": " def summary(self):\n try:\n self.target.fabric_module.to_normalized_wwn(self.target.wwn)\n except:\n return (\"INVALID WWN\", False)\n\n return super(UITarget, self).summary()", "metadata": "root.UITarget.summary", "header": "['class', 'UITarget', '(', 'UITPG', ')', ':', '___EOS___']", "index": 556 } ]
[ { "span": "except:", "start_line": 302, "start_column": 8, "end_line": 302, "end_column": 15 }, { "span": "except:", "start_line": 559, "start_column": 8, "end_line": 559, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "UI", "Multi", "TP", "GT", "arget", "_", "(_", "UI", "RTS", "Lib", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "summary_", "(_", "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_", "._", "rts", "node_", "._", "fab", "ric", "\\u", "module_", "._", "to", "\\u", "normali", "zed", "\\u", "wwn", "_", "(_", "self_", "._", "rts", "node_", "._", "wwn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"", "INVALID", " ", "WW", "N", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\"", "TP", "Gs", ":", " ", "%", "d", "\"_", "%_", "len_", "(_", "self_", "._", "\\u", "children_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UI", "Target_", "(_", "UI", "TP", "G_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "summary_", "(_", "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_", "._", "target_", "._", "fab", "ric", "\\u", "module_", "._", "to", "\\u", "normali", "zed", "\\u", "wwn", "_", "(_", "self_", "._", "target_", "._", "wwn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"", "INVALID", " ", "WW", "N", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "UI", "Target_", ",_", "self_", ")_", "._", "summary_", "(_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
scipy/scipy/scipy/stats/_continuous_distns.py
[ { "content": "class burr_gen(rv_continuous):\n \"\"\"A Burr (Type III) continuous random variable.\n\n %(before_notes)s\n\n See Also\n --------\n fisk : a special case of either `burr` or ``burr12`` with ``d = 1``\n burr12 : Burr Type XII distribution\n\n Notes\n -----\n The probability density function for `burr` is::\n\n burr.pdf(x, c, d) = c * d * x**(-c-1) * (1+x**(-c))**(-d-1)\n\n for ``x > 0``.\n\n `burr` takes ``c`` and ``d`` as shape parameters.\n\n This is the PDF corresponding to the third CDF given in Burr's list;\n specifically, it is equation (11) in Burr's paper [1]_.\n\n %(after_notes)s\n\n References\n ----------\n .. [1] Burr, I. W. \"Cumulative frequency functions\", Annals of\n Mathematical Statistics, 13(2), pp 215-232 (1942).\n\n %(example)s\n\n \"\"\"\n\n\n", "metadata": "root.burr_gen", "header": "['module', '___EOS___']", "index": 612 }, { "content": " def _pdf(self, x, c, d):\n return c * d * (x**(-c - 1.0)) * ((1 + x**(-c))**(-d - 1.0))", "metadata": "root.burr_gen._pdf", "header": "['class', 'burr_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 645 }, { "content": " def _cdf(self, x, c, d):\n return (1 + x**(-c))**(-d)", "metadata": "root.burr_gen._cdf", "header": "['class', 'burr_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 648 }, { "content": " def _ppf(self, q, c, d):\n return (q**(-1.0/d) - 1)**(-1.0/c)", "metadata": "root.burr_gen._ppf", "header": "['class', 'burr_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 651 }, { "content": " def _munp(self, n, c, d):\n nc = 1. * n / c\n return d * special.beta(1.0 - nc, d + nc)", "metadata": "root.burr_gen._munp", "header": "['class', 'burr_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 654 }, { "content": "class fisk_gen(burr_gen):\n \"\"\"A Fisk continuous random variable.\n\n The Fisk distribution is also known as the log-logistic distribution, and\n equals the Burr distribution with ``d == 1``.\n\n `fisk` takes ``c`` as a shape parameter.\n\n %(before_notes)s\n\n Notes\n -----\n The probability density function for `fisk` is::\n\n fisk.pdf(x, c) = c * x**(-c-1) * (1 + x**(-c))**(-2)\n\n for ``x > 0``.\n\n `fisk` takes ``c`` as a shape parameters.\n\n %(after_notes)s\n\n See Also\n --------\n burr\n\n %(example)s\n\n \"\"\"\n\n\n\n", "metadata": "root.fisk_gen", "header": "['module', '___EOS___']", "index": 725 }, { "content": " def _pdf(self, x, c):\n return burr_gen._pdf(self, x, c, 1.0)", "metadata": "root.fisk_gen._pdf", "header": "['class', 'fisk_gen', '(', 'burr_gen', ')', ':', '___EOS___']", "index": 754 }, { "content": " def _cdf(self, x, c):\n return burr_gen._cdf(self, x, c, 1.0)", "metadata": "root.fisk_gen._cdf", "header": "['class', 'fisk_gen', '(', 'burr_gen', ')', ':', '___EOS___']", "index": 757 }, { "content": " def _ppf(self, x, c):\n return burr_gen._ppf(self, x, c, 1.0)", "metadata": "root.fisk_gen._ppf", "header": "['class', 'fisk_gen', '(', 'burr_gen', ')', ':', '___EOS___']", "index": 760 }, { "content": " def _munp(self, n, c):\n return burr_gen._munp(self, n, c, 1.0)", "metadata": "root.fisk_gen._munp", "header": "['class', 'fisk_gen', '(', 'burr_gen', ')', ':', '___EOS___']", "index": 763 }, { "content": " def _entropy(self, c):\n return 2 - log(c)", "metadata": "root.fisk_gen._entropy", "header": "['class', 'fisk_gen', '(', 'burr_gen', ')', ':', '___EOS___']", "index": 766 }, { "content": "class invgauss_gen(rv_continuous):\n \"\"\"An inverse Gaussian continuous random variable.\n\n %(before_notes)s\n\n Notes\n -----\n The probability density function for `invgauss` is::\n\n invgauss.pdf(x, mu) = 1 / sqrt(2*pi*x**3) * exp(-(x-mu)**2/(2*x*mu**2))\n\n for ``x > 0``.\n\n `invgauss` takes ``mu`` as a shape parameter.\n\n %(after_notes)s\n\n When `mu` is too small, evaluating the cumulative distribution function will be\n inaccurate due to ``cdf(mu -> 0) = inf * 0``.\n NaNs are returned for ``mu <= 0.0028``.\n\n %(example)s\n\n \"\"\"\n\n\n\n", "metadata": "root.invgauss_gen", "header": "['module', '___EOS___']", "index": 2586 }, { "content": " def _rvs(self, mu):\n return self._random_state.wald(mu, 1.0, size=self._size)", "metadata": "root.invgauss_gen._rvs", "header": "['class', 'invgauss_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 2610 }, { "content": " def _pdf(self, x, mu):\n return 1.0/sqrt(2*pi*x**3.0)*exp(-1.0/(2*x)*((x-mu)/mu)**2)", "metadata": "root.invgauss_gen._pdf", "header": "['class', 'invgauss_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 2613 }, { "content": " def _logpdf(self, x, mu):\n return -0.5*log(2*pi) - 1.5*log(x) - ((x-mu)/mu)**2/(2*x)", "metadata": "root.invgauss_gen._logpdf", "header": "['class', 'invgauss_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 2616 }, { "content": " def _cdf(self, x, mu):\n fac = sqrt(1.0/x)\n # Numerical accuracy for small `mu` is bad. See #869.\n C1 = _norm_cdf(fac*(x-mu)/mu)\n C1 += exp(1.0/mu) * _norm_cdf(-fac*(x+mu)/mu) * exp(1.0/mu)\n return C1", "metadata": "root.invgauss_gen._cdf", "header": "['class', 'invgauss_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 2619 }, { "content": " def _stats(self, mu):\n return mu, mu**3.0, 3*sqrt(mu), 15*mu", "metadata": "root.invgauss_gen._stats", "header": "['class', 'invgauss_gen', '(', 'rv_continuous', ')', ':', '___EOS___']", "index": 2626 }, { "content": "class wald_gen(invgauss_gen):\n \"\"\"A Wald continuous random variable.\n\n %(before_notes)s\n\n Notes\n -----\n The probability density function for `wald` is::\n\n wald.pdf(x) = 1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x))\n\n for ``x > 0``.\n\n `wald` is a special case of `invgauss` with ``mu == 1``.\n\n %(after_notes)s\n\n %(example)s\n \"\"\"\n\n\n\n", "metadata": "root.wald_gen", "header": "['module', '___EOS___']", "index": 4556 }, { "content": " def _rvs(self):\n return self._random_state.wald(1.0, 1.0, size=self._size)", "metadata": "root.wald_gen._rvs", "header": "['class', 'wald_gen', '(', 'invgauss_gen', ')', ':', '___EOS___']", "index": 4575 }, { "content": " def _pdf(self, x):\n return invgauss._pdf(x, 1.0)", "metadata": "root.wald_gen._pdf", "header": "['class', 'wald_gen', '(', 'invgauss_gen', ')', ':', '___EOS___']", "index": 4578 }, { "content": " def _logpdf(self, x):\n return invgauss._logpdf(x, 1.0)", "metadata": "root.wald_gen._logpdf", "header": "['class', 'wald_gen', '(', 'invgauss_gen', ')', ':', '___EOS___']", "index": 4581 }, { "content": " def _cdf(self, x):\n return invgauss._cdf(x, 1.0)", "metadata": "root.wald_gen._cdf", "header": "['class', 'wald_gen', '(', 'invgauss_gen', ')', ':', '___EOS___']", "index": 4584 }, { "content": " def _stats(self):\n return 1.0, 1.0, 3.0, 15.0", "metadata": "root.wald_gen._stats", "header": "['class', 'wald_gen', '(', 'invgauss_gen', ')', ':', '___EOS___']", "index": 4587 } ]
[ { "span": "def _pdf(self, x, c):", "start_line": 754, "start_column": 4, "end_line": 754, "end_column": 25 }, { "span": "def _cdf(self, x, c):", "start_line": 757, "start_column": 4, "end_line": 757, "end_column": 25 }, { "span": "def _ppf(self, x, c):", "start_line": 760, "start_column": 4, "end_line": 760, "end_column": 25 }, { "span": "def _munp(self, n, c):", "start_line": 763, "start_column": 4, "end_line": 763, "end_column": 26 }, { "span": "def _rvs(self):", "start_line": 4575, "start_column": 4, "end_line": 4575, "end_column": 19 }, { "span": "def _pdf(self, x):", "start_line": 4578, "start_column": 4, "end_line": 4578, "end_column": 22 }, { "span": "def _logpdf(self, x):", "start_line": 4581, "start_column": 4, "end_line": 4581, "end_column": 25 }, { "span": "def _cdf(self, x):", "start_line": 4584, "start_column": 4, "end_line": 4584, "end_column": 22 }, { "span": "def _stats(self):", "start_line": 4587, "start_column": 4, "end_line": 4587, "end_column": 21 } ]
[ { "span": "def _pdf(self, x, c, d):", "start_line": 645, "start_column": 4, "end_line": 645, "end_column": 28 }, { "span": "def _cdf(self, x, c, d):", "start_line": 648, "start_column": 4, "end_line": 648, "end_column": 28 }, { "span": "def _ppf(self, q, c, d):", "start_line": 651, "start_column": 4, "end_line": 651, "end_column": 28 }, { "span": "def _munp(self, n, c, d):", "start_line": 654, "start_column": 4, "end_line": 654, "end_column": 29 }, { "span": "def _rvs(self, mu):", "start_line": 2610, "start_column": 4, "end_line": 2610, "end_column": 23 }, { "span": "def _pdf(self, x, mu):", "start_line": 2613, "start_column": 4, "end_line": 2613, "end_column": 26 }, { "span": "def _logpdf(self, x, mu):", "start_line": 2616, "start_column": 4, "end_line": 2616, "end_column": 29 }, { "span": "def _cdf(self, x, mu):", "start_line": 2619, "start_column": 4, "end_line": 2619, "end_column": 26 }, { "span": "def _stats(self, mu):", "start_line": 2626, "start_column": 4, "end_line": 2626, "end_column": 25 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "bur", "r", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Bur", "r", " ", "(", "Type", " ", "III", ")", " ", "continuous", " ", "random", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "bef", "ore", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "fis", "k", " ", ":", " ", "a", " ", "special", " ", "case", " ", "of", " ", "eit", "her", " ", "`", "bur", "r", "`", " ", "or", " ", "``", "bur", "r1", "2", "``", " ", "with", " ", "``", "d", " ", "=", " ", "1", "``", "\\", "10", ";", " ", " ", " ", " ", "bur", "r1", "2", " ", ":", " ", "Bur", "r", " ", "Type", " ", "XI", "I", " ", "distribu", "tion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "probabilit", "y", " ", "densit", "y", " ", "function", " ", "for", " ", "`", "bur", "r", "`", " ", "is", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "bur", "r", ".", "pdf", "(", "x", ",", " ", "c", ",", " ", "d", ")", " ", "=", " ", "c", " ", "*", " ", "d", " ", "*", " ", "x", "**", "(-", "c", "-1", ")", " ", "*", " ", "(", "1", "+", "x", "**", "(-", "c", "))", "**", "(-", "d", "-1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "``", "x", " ", ">", " ", "0", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "bur", "r", "`", " ", "take", "s", " ", "``", "c", "``", " ", "and", " ", "``", "d", "``", " ", "as", " ", "shape", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "PD", "F", " ", "correspond", "ing", " ", "to", " ", "the", " ", "third", " ", "CD", "F", " ", "give", "n", " ", "in", " ", "Bur", "r", "'", "s", " ", "list", ";", "\\", "10", ";", " ", " ", " ", " ", "specifica", "ll", "y", ",", " ", "it", " ", "is", " ", "equation", " ", "(", "11", ")", " ", "in", " ", "Bur", "r", "'", "s", " ", "pape", "r", " ", "[", "1", "]\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "after", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "Bur", "r", ",", " ", "I", ".", " ", "W", ".", " ", "\"", "Cum", "ulati", "ve", " ", "freque", "nc", "y", " ", "function", "s", "\",", " ", "Ann", "als", " ", "of", "\\", "10", ";", " ", " ", " ", "Math", "ema", "tica", "l", " ", "Statistic", "s", ",", " ", "13", "(", "2", "),", " ", "pp", " ", "215", "-", "232", " ", "(", "194", "2", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "example", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "bur", "r", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "pdf_", "(_", "self_", ",_", "x_", ",_", "c_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "c_", "*_", "d_", "*_", "(_", "x_", "**_", "(_", "-_", "c_", "-_", "1.0_", ")_", ")_", "*_", "(_", "(_", "1_", "+_", "x_", "**_", "(_", "-_", "c_", ")_", ")_", "**_", "(_", "-_", "d_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bur", "r", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cdf_", "(_", "self_", ",_", "x_", ",_", "c_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "1_", "+_", "x_", "**_", "(_", "-_", "c_", ")_", ")_", "**_", "(_", "-_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bur", "r", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pp", "f_", "(_", "self_", ",_", "q_", ",_", "c_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "q_", "**_", "(_", "-_", "1.0_", "/_", "d_", ")_", "-_", "1_", ")_", "**_", "(_", "-_", "1.0_", "/_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bur", "r", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mun", "p_", "(_", "self_", ",_", "n_", ",_", "c_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nc_", "=_", "1._", "*_", "n_", "/_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "*_", "special_", "._", "beta_", "(_", "1.0_", "-_", "nc_", ",_", "d_", "+_", "nc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Fis", "k", " ", "continuous", " ", "random", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Fis", "k", " ", "distribu", "tion", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", " ", "the", " ", "log", "-", "logistic", " ", "distribu", "tion", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "equals", " ", "the", " ", "Bur", "r", " ", "distribu", "tion", " ", "with", " ", "``", "d", " ", "==", " ", "1", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "fis", "k", "`", " ", "take", "s", " ", "``", "c", "``", " ", "as", " ", "a", " ", "shape", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "bef", "ore", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "probabilit", "y", " ", "densit", "y", " ", "function", " ", "for", " ", "`", "fis", "k", "`", " ", "is", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fis", "k", ".", "pdf", "(", "x", ",", " ", "c", ")", " ", "=", " ", "c", " ", "*", " ", "x", "**", "(-", "c", "-1", ")", " ", "*", " ", "(", "1", " ", "+", " ", "x", "**", "(-", "c", "))", "**", "(-", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "``", "x", " ", ">", " ", "0", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "fis", "k", "`", " ", "take", "s", " ", "``", "c", "``", " ", "as", " ", "a", " ", "shape", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "after", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "bur", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "example", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "pdf_", "(_", "self_", ",_", "x_", ",_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bur", "r", "\\u", "gen_", "._", "\\u", "pdf_", "(_", "self_", ",_", "x_", ",_", "c_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cdf_", "(_", "self_", ",_", "x_", ",_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bur", "r", "\\u", "gen_", "._", "\\u", "cdf_", "(_", "self_", ",_", "x_", ",_", "c_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pp", "f_", "(_", "self_", ",_", "x_", ",_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bur", "r", "\\u", "gen_", "._", "\\u", "pp", "f_", "(_", "self_", ",_", "x_", ",_", "c_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mun", "p_", "(_", "self_", ",_", "n_", ",_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bur", "r", "\\u", "gen_", "._", "\\u", "mun", "p_", "(_", "self_", ",_", "n_", ",_", "c_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "fis", "k", "\\u", "gen_", "(_", "bur", "r", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "entropy_", "(_", "self_", ",_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "2_", "-_", "log_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "inv", "erse", " ", "Gaussian", " ", "continuous", " ", "random", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "bef", "ore", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "probabilit", "y", " ", "densit", "y", " ", "function", " ", "for", " ", "`", "inv", "gauss", "`", " ", "is", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "inv", "gauss", ".", "pdf", "(", "x", ",", " ", "mu", ")", " ", "=", " ", "1", " ", "/", " ", "sqrt", "(", "2", "*", "pi", "*", "x", "**", "3", ")", " ", "*", " ", "exp", "(-", "(", "x", "-", "mu", ")**", "2", "/(", "2", "*", "x", "*", "mu", "**", "2", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "``", "x", " ", ">", " ", "0", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "inv", "gauss", "`", " ", "take", "s", " ", "``", "mu", "``", " ", "as", " ", "a", " ", "shape", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "after", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "`", "mu", "`", " ", "is", " ", "too", " ", "small", ",", " ", "evaluat", "ing", " ", "the", " ", "cumul", "ative", " ", "distribu", "tion", " ", "function", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "ina", "ccu", "rate", " ", "due", " ", "to", " ", "``", "cdf", "(", "mu", " ", "->", " ", "0", ")", " ", "=", " ", "inf", " ", "*", " ", "0", "``.", "\\", "10", ";", " ", " ", " ", " ", "Na", "Ns", " ", "are", " ", "return", "ed", " ", "for", " ", "``", "mu", " ", "<=", " ", "0.002", "8", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "example", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "rvs_", "(_", "self_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "random", "\\u", "state_", "._", "wal", "d_", "(_", "mu_", ",_", "1.0_", ",_", "size_", "=_", "self_", "._", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pdf_", "(_", "self_", ",_", "x_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1.0_", "/_", "sqrt_", "(_", "2_", "*_", "pi_", "*_", "x_", "**_", "3.0_", ")_", "*_", "exp_", "(_", "-_", "1.0_", "/_", "(_", "2_", "*_", "x_", ")_", "*_", "(_", "(_", "x_", "-_", "mu_", ")_", "/_", "mu_", ")_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "logp", "df_", "(_", "self_", ",_", "x_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "0.5_", "*_", "log_", "(_", "2_", "*_", "pi_", ")_", "-_", "1.5_", "*_", "log_", "(_", "x_", ")_", "-_", "(_", "(_", "x_", "-_", "mu_", ")_", "/_", "mu_", ")_", "**_", "2_", "/_", "(_", "2_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cdf_", "(_", "self_", ",_", "x_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fac_", "=_", "sqrt_", "(_", "1.0_", "/_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Numerical", " ", "accu", "rac", "y", " ", "for", " ", "small", " ", "`", "mu", "`", " ", "is", " ", "bad", ".", " ", " ", "See", " ", "#", "869", "._", "\\u\\u\\uNL\\u\\u\\u_", "C1_", "=_", "\\u", "norm", "\\u", "cdf_", "(_", "fac_", "*_", "(_", "x_", "-_", "mu_", ")_", "/_", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C1_", "+=_", "exp_", "(_", "1.0_", "/_", "mu_", ")_", "*_", "\\u", "norm", "\\u", "cdf_", "(_", "-_", "fac_", "*_", "(_", "x_", "+_", "mu_", ")_", "/_", "mu_", ")_", "*_", "exp_", "(_", "1.0_", "/_", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "C1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "inv", "gauss", "\\u", "gen_", "(_", "rv", "\\u", "continuous", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stats_", "(_", "self_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mu_", ",_", "mu_", "**_", "3.0_", ",_", "3_", "*_", "sqrt_", "(_", "mu_", ")_", ",_", "15_", "*_", "mu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Wal", "d", " ", "continuous", " ", "random", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "bef", "ore", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "probabilit", "y", " ", "densit", "y", " ", "function", " ", "for", " ", "`", "wal", "d", "`", " ", "is", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "wal", "d", ".", "pdf", "(", "x", ")", " ", "=", " ", "1", "/", "sqrt", "(", "2", "*", "pi", "*", "x", "**", "3", ")", " ", "*", " ", "exp", "(-", "(", "x", "-1", ")**", "2", "/(", "2", "*", "x", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "``", "x", " ", ">", " ", "0", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "wal", "d", "`", " ", "is", " ", "a", " ", "special", " ", "case", " ", "of", " ", "`", "inv", "gauss", "`", " ", "with", " ", "``", "mu", " ", "==", " ", "1", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "after", "\\u", "note", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "example", ")", "s", "\\", "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_", "[SEP]_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "rvs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "random", "\\u", "state_", "._", "wal", "d_", "(_", "1.0_", ",_", "1.0_", ",_", "size_", "=_", "self_", "._", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pdf_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "inv", "gauss_", "._", "\\u", "pdf_", "(_", "x_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "logp", "df_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "inv", "gauss_", "._", "\\u", "logp", "df_", "(_", "x_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cdf_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "inv", "gauss_", "._", "\\u", "cdf_", "(_", "x_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "wal", "d\\u", "gen_", "(_", "inv", "gauss", "\\u", "gen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stats_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
apache/libcloud/libcloud/test/test_types.py
[ { "content": " def test_empty_list(self):\n ll = LazyList(get_more=self._get_more_empty)\n\n self.assertEqual(list(ll), [])\n self.assertEqual(len(ll), 0)\n self.assertTrue(10 not in ll)", "metadata": "root.TestLazyList.test_empty_list", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_contains(self):\n ll = LazyList(get_more=self._get_more_not_exhausted)\n\n self.assertTrue(40 not in ll)\n self.assertTrue(1 in ll)\n self.assertTrue(5 in ll)\n self.assertTrue(10 in ll)", "metadata": "root.TestLazyList.test_contains", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 } ]
[ { "span": "self.assertTrue(10 not in ll)", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 37 }, { "span": "self.assertTrue(40 not in ll)", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 37 }, { "span": "self.assertTrue(1 in ll)", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 32 }, { "span": "self.assertTrue(5 in ll)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 32 }, { "span": "self.assertTrue(10 in ll)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "empty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "ll_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ll_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "10_", "not_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "40_", "not_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "5_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "10_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Redundant assignment
coronalabs/CoronaSDK-SublimeText/debugger.py
[ { "content": " def doDump(self, cmd):\n cmdtype, variable_name = self.getParameters(cmd)\n debug(\"doDump: \"+cmdtype+\" \"+variable_name)\n if variable_name:\n # Note the space after \"return\" matters\n # self.writeToPUT(\"EXEC return (\" + variable_name + \")\\n\")\n self.writeToPUT(\"DUMP return (\" + variable_name + \")\\n\")\n dmpResponse = self.readFromPUT().strip()\n debug(\"dmpResponse: \" + dmpResponse)\n dataMatches = re.search(r'^(\\d+)[^0-9]*(\\d+)$', dmpResponse)\n if dataMatches is not None:\n status = dataMatches.group(1)\n length = int(dataMatches.group(2))\n if status == \"200\":\n if length == 0:\n debugger_status(\"No \"+cmd)\n else:\n dataStr = \"\"\n while len(dataStr) < length:\n dataStr += self.readFromPUT(int(length - len(dataStr)))\n\n dataStr = dataStr\n debug('dmpData: ' + dataStr)\n sublime.message_dialog(dataStr)\n else:\n debugger_status(\"Error getting variable value: \" + dmpResponse)\n else:\n debugger_status(\"Usage: DUMP variable\")", "metadata": "root.CoronaDebuggerThread.doDump", "header": "['class', 'CoronaDebuggerThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 329 } ]
[ { "span": "dataStr = dataStr", "start_line": 350, "start_column": 12, "end_line": 350, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "Cor", "ona", "Debugger", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "do", "Dump_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "type_", ",_", "variab", "le", "\\u", "name_", "=_", "self_", "._", "get", "Parameters_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "\"", "do", "Dump", ":", " ", "\"_", "+_", "cmd", "type_", "+_", "\"", " ", "\"_", "+_", "variab", "le", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variab", "le", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "the", " ", "space", " ", "after", " ", "\"", "return", "\"", " ", "matte", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "write", "To", "PU", "T", "(\"", "EXEC", " ", "return", " ", "(\"", " ", "+", " ", "variab", "le", "\\u", "name", " ", "+", " ", "\")\\\\", "n", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "To", "PUT_", "(_", "\"", "DUMP", " ", "return", " ", "(\"_", "+_", "variab", "le", "\\u", "name_", "+_", "\")\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dmp", "Response_", "=_", "self_", "._", "read", "Fro", "m", "PUT_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "\"", "dmp", "Respons", "e", ":", " ", "\"_", "+_", "dmp", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Matches_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "(\\\\", "d", "+)", "[", "^", "0", "-", "9", "]*(", "\\\\", "d", "+)$'_", ",_", "dmp", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data", "Matches_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "data", "Matches_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "int_", "(_", "data", "Matches_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "\"", "200", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "length_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debugg", "er", "\\u", "status_", "(_", "\"", "No", " ", "\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "data", "Str_", ")_", "<_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Str_", "+=_", "self_", "._", "read", "Fro", "m", "PUT_", "(_", "int_", "(_", "length_", "-_", "len_", "(_", "data", "Str_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Str_", "=_", "data", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "'", "dmp", "Data", ":", " ", "'_", "+_", "data", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sublime_", "._", "message", "\\u", "dialog_", "(_", "data", "Str_", ")_", "\\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 ", " _", "debugg", "er", "\\u", "status_", "(_", "\"", "Error", " ", "getti", "ng", " ", "variab", "le", " ", "value", ":", " ", "\"_", "+_", "dmp", "Response_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
callowayproject/django-kamasutra/positions/templatetags/position_tags.py
[ { "content": "from django.db.models import get_model\nfrom django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist\nfrom django.utils.translation import ugettext as _\nfrom django.template.defaultfilters import slugify\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom positions.models import Position, PositionContent\nfrom positions import settings as position_settings\n\nregister = Library()\n\n\n\n \n\n \n\n \n \n \n\n \n \n \n \n\n \n \n \n \n \nregister.tag(\"get_position_content\", do_get_position_content)\nregister.tag(\"get_content_positions\", do_get_content_positions)\nregister.tag(\"get_applicable_positions\", do_get_applicable_positions)\nregister.tag(\"get_position\", do_get_position)\nregister.tag(\"render_position_content\", do_render_position_content)\nregister.tag(\"can_be_positioned\", do_can_be_positioned)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _parse_arguments(value):\n if not isinstance(value, unicode):\n return {}\n \n ret = {}\n for item in value.split(','):\n if len(item.split('=')) == 2:\n name, val = item.split('=')\n ret[name] = val\n \n return ret", "metadata": "root._parse_arguments", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def resolve_variable(value, context, none_on_fail=False):\n \"\"\"\n A wrapper function to resolve template variables. \n Will return None if [none_on_fail] is [True], otherwise\n it will return [value]\n \"\"\"\n try:\n return Variable(value).resolve(context)\n except Exception:\n if none_on_fail: return None\n return value", "metadata": "root.resolve_variable", "header": "['module', '___EOS___']", "index": 23 }, { "content": "class PositionContentNode(Node):\n ", "metadata": "root.PositionContentNode", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def __init__(self, position, varname, **kwargs):\n self.position = position\n self.varname = varname\n self.limit = int(kwargs.get('limit', '0'))\n self.as_contenttype = True\n if str(kwargs.get('as_contenttype', 'True')).lower() == 'false':\n self.as_contenttype = False", "metadata": "root.PositionContentNode.__init__", "header": "['class', 'PositionContentNode', '(', 'Node', ')', ':', '___EOS___']", "index": 36 }, { "content": " def render(self, context):\n pos = resolve_variable(self.position, context)\n context[self.varname] = Position.objects.get_content(\n position=pos, \n count=self.limit, \n as_contenttype=self.as_contenttype)\n return \"\"", "metadata": "root.PositionContentNode.render", "header": "['class', 'PositionContentNode', '(', 'Node', ')', ':', '___EOS___']", "index": 44 }, { "content": "class ApplicablePositionsNode(Node):\n ", "metadata": "root.ApplicablePositionsNode", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def __init__(self, obj=None, content_type_id=None, object_id=None, varname=None, return_all=False):\n (self.obj, self.varname, self.return_all) = (obj, varname, return_all)\n (self.content_type_id, self.object_id) = (content_type_id, object_id)", "metadata": "root.ApplicablePositionsNode.__init__", "header": "['class', 'ApplicablePositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 54 }, { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n\n context[self.varname] = Position.objects.get_applicable(obj, self.return_all)\n \n return \"\" ", "metadata": "root.ApplicablePositionsNode.render", "header": "['class', 'ApplicablePositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 58 }, { "content": "class ContentPositionsNode(Node):\n ", "metadata": "root.ContentPositionsNode", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def __init__(self, obj=None, content_type_id=None, object_id=None, varname=None):\n (self.obj, self.varname) = (obj, varname)\n (self.content_type_id, self.object_id) = (content_type_id, object_id)", "metadata": "root.ContentPositionsNode.__init__", "header": "['class', 'ContentPositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 77 }, { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n \n context[self.varname] = Position.objects.positions_for_object(obj)\n \n return \"\" ", "metadata": "root.ContentPositionsNode.render", "header": "['class', 'ContentPositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 81 }, { "content": "class PositionNode(Node):\n ", "metadata": "root.PositionNode", "header": "['module', '___EOS___']", "index": 99 }, { "content": " def __init__(self, prefix, name, varname, **kwargs):\n self.name = name\n self.prefix = prefix\n self.varname = varname\n self.slugify = False\n if str(kwargs.get('slugify', 'True')).lower() == 'true':\n self.slugify = True", "metadata": "root.PositionNode.__init__", "header": "['class', 'PositionNode', '(', 'Node', ')', ':', '___EOS___']", "index": 100 }, { "content": " def render(self, context):\n \n name = resolve_variable(self.name, context)\n if self.slugify:\n name = slugify(name)\n \n prefix = resolve_variable(self.prefix, context)\n if self.slugify:\n prefix = slugify(prefix)\n \n s_name = name\n if prefix:\n s_name = '%s%s%s' % (prefix, position_settings.CONBINE_STRING, name)\n \n context[self.varname] = None\n try:\n position = Position.objects.get(name__iexact=s_name)\n context[self.varname] = position\n except Position.DoesNotExist:\n pass\n \n return \"\"", "metadata": "root.PositionNode.render", "header": "['class', 'PositionNode', '(', 'Node', ')', ':', '___EOS___']", "index": 108 }, { "content": "class RenderPositionContentNode(Node):\n ", "metadata": "root.RenderPositionContentNode", "header": "['module', '___EOS___']", "index": 132 }, { "content": " def __init__(self, pc, template=None, suffix=None):\n self.pc = pc\n self.template = template\n self.suffix = suffix", "metadata": "root.RenderPositionContentNode.__init__", "header": "['class', 'RenderPositionContentNode', '(', 'Node', ')', ':', '___EOS___']", "index": 133 }, { "content": " def render(self, context):\n suffix, template = self.suffix, self.template\n \n pc = resolve_variable(self.pc, context)\n if not isinstance(pc, PositionContent):\n return None\n \n tpl = pc.render(template=template, suffix=suffix, \n context_instance=context)\n \n return tpl", "metadata": "root.RenderPositionContentNode.render", "header": "['class', 'RenderPositionContentNode', '(', 'Node', ')', ':', '___EOS___']", "index": 138 }, { "content": "class CanBePositionedNode(Node):\n ", "metadata": "root.CanBePositionedNode", "header": "['module', '___EOS___']", "index": 151 }, { "content": " def __init__(self, obj=None, content_type_id=None, object_id=None, varname=None):\n self.obj, self.content_type_id = obj, content_type_id\n self.object_id, self.varname = object_id, varname", "metadata": "root.CanBePositionedNode.__init__", "header": "['class', 'CanBePositionedNode', '(', 'Node', ')', ':', '___EOS___']", "index": 152 }, { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n \n if obj:\n context[self.varname] = Position.objects.can_be_positioned(obj)\n else:\n context[self.varname] = False\n \n return \"\"", "metadata": "root.CanBePositionedNode.render", "header": "['class', 'CanBePositionedNode', '(', 'Node', ')', ':', '___EOS___']", "index": 156 }, { "content": "def do_get_position_content(parser, token):\n \"\"\"\n {% get_position_content position as content %}\n {% get_position_content position as content [limit=N] [as_contenttype=True|False] %}\n \n Where position is either a Position instance (e.g. position), or Position name (e.g. home__headlines).\n \"\"\"\n argv = token.contents.split()\n argc = len(argv)\n \n if argc < 4:\n raise TemplateSyntaxError, \"Tag %s takes at least 3 arguments.\" % argv[0]\n \n if argv[2] != 'as':\n raise TemplateSyntaxError, \"Tag %s must have 'as' as the second argument.\" % argv[0]\n \n (position, varname) = (argv[1], argv[3])\n \n kwargs = {}\n for argument in argv[4:]:\n if len(argument.split('=')) == 2:\n kwargs[str(argument.split('=')[0])] = argument.split('=')[1]\n \n return PositionContentNode(position, varname, **kwargs)", "metadata": "root.do_get_position_content", "header": "['module', '___EOS___']", "index": 177 }, { "content": "def do_get_applicable_positions(parser, token):\n \"\"\"\n {% get_applicable_positions object as positions [all] %}\n \n or for the admin..\n \n {% get_applicable_positions content_type_id object_id as positions [all] %}\n \n all is optional and will return all, if it is not speficied only positions\n that the current object is not contained in will be returned\n \"\"\"\n argv = token.contents.split()\n argc = len(argv)\n\n if argc > 6:\n raise TemplateSyntaxError, \"Tag %s takes three, four or five arguments.\" % argv[0]\n\n return_all = False\n if argv[2] == \"as\":\n if argc == 5 and argv[4] == 'all':\n return_all = True\n return ApplicablePositionsNode(obj=argv[1], varname=argv[3], \n return_all=return_all)\n elif argv[3] == \"as\":\n if argc == 6 and argv[5] == 'all':\n return_all = True\n return ApplicablePositionsNode(content_type_id=argv[1], \n object_id=argv[2], varname=argv[4], return_all=return_all)\n else:\n raise TemplateSyntaxError, 'Second or Third argument must be \"as\"'", "metadata": "root.do_get_applicable_positions", "header": "['module', '___EOS___']", "index": 202 }, { "content": "def do_get_content_positions(parser, token):\n \"\"\"\n {% get_content_positions object as positions %}\n \n or for the admin..\n \n {% get_content_positions content_type_id object_id as positions %}\n \"\"\"\n argv = token.contents.split()\n argc = len(argv)\n \n if argc != 4 and argc != 5:\n raise TemplateSyntaxError, \"Tag %s takes three or four arguments.\" % ar\n \n if argv[2] == \"as\":\n return ContentPositionsNode(obj=argv[1], varname=argv[3])\n elif argv[3] == \"as\":\n return ContentPositionsNode(content_type_id=argv[1], \n object_id=argv[2], varname=argv[4])\n else:\n raise TemplateSyntaxError, 'Second or Third argument must be \"as\"'", "metadata": "root.do_get_content_positions", "header": "['module', '___EOS___']", "index": 233 }, { "content": "def do_get_position(parser, token):\n \"\"\"\n {% get_position name as varname %}\n {% get_position prefix name as varname [slugify=True|False] %}\n \"\"\" \n argv = token.contents.split()\n argc = len(argv)\n\n if argc < 4:\n raise TemplateSyntaxError, \"Tag %s takes at least 3 argument.\" % argv[0]\n \n if argv[2] != 'as' and argv[3] != 'as':\n raise TemplateSyntaxError, \"Tag %s must have 'as' as the second or third argument.\" % argv[0]\n \n name, prefix, varname, startpos = '', '', '', 0\n if argv[2] == 'as':\n name = argv[1]\n varname = argv[3]\n startpos = 4\n elif argv[3] == 'as':\n prefix = argv[1]\n name = argv[2]\n varname = argv[4]\n startpos = 5\n \n kwargs = {}\n for argument in argv[startpos:]:\n if len(argument.split('=')) == 2:\n kwargs[str(argument.split('=')[0])] = argument.split('=')[1]\n \n return PositionNode(prefix, name, varname, **kwargs)", "metadata": "root.do_get_position", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def do_render_position_content(parser, token):\n \"\"\"\n {% render_position_content [PositionContent] [with] [suffix=S] [template=T] %}\n {% render_position_content pc %}\n {% render_position_content pc with suffix=custom %}\n {% render_position_content pc with template=mycustomtemplates/positions/custom.html %}\n \n Only suffix OR template can be specified, but not both.\n \"\"\"\n argv = token.contents.split()\n argc = len(argv)\n \n if argc < 2 or argc > 4:\n raise TemplateSyntaxError, \"Tag %s takes either two or four arguments.\" % argv[0]\n \n if argc == 2:\n return RenderPositionContentNode(argv[1])\n else:\n if argv[2] != 'with':\n raise TemplateSyntaxError, 'Second argument must be \"with\" for tag %s.' % argv[0]\n extra = argv[3].split('=')\n if len(extra) != 2:\n raise TemplateSyntaxError, \"Last argument must be formated correctly for tag %s.\" % argv[0]\n if not extra[0] in ['suffix', 'template']:\n raise TemplateSyntaxError, \"Last argment must of either suffix or template for tag %s.\" % argv[0]\n \n kwargs = {str(extra[0]): extra[1],}\n return RenderPositionContentNode(argv[1], **kwargs)", "metadata": "root.do_render_position_content", "header": "['module', '___EOS___']", "index": 287 }, { "content": "def do_can_be_positioned(parser, token):\n \"\"\"\n {% can_be_positioned [object] as [varname] %}\n {% can_be_positioned [content_type_id] [object_id] as [varname] %}\n {% can_be_positioned story as story_can_be_positioned %}\n {% can_be_positioned 23 1232 as object_can_be_positioned %}\n \"\"\"\n argv = token.contents.split()\n argc = len(argv)\n \n if argc < 4 or argc > 5:\n raise TemplateSyntaxError, \"Tag %s takes either 3 or 4 arguments,\" % argv[0]\n \n if argc == 4:\n if argv[2] != \"as\":\n raise TemplateSyntaxError, 'Second argument must be \"as\" for tag %s.' % argv[0]\n return CanBePositionedNode(obj=argv[1], varname=argv[3])\n elif argc == 5:\n if argv[3] != \"as\":\n raise TemplateSyntaxError, 'Third argument must be \"as\" for tag %s.' % argv[0]\n return CanBePositionedNode(content_type_id=argv[1], object_id=argv[2], varname=argv[4])", "metadata": "root.do_can_be_positioned", "header": "['module', '___EOS___']", "index": 316 } ]
[ { "span": "from django.db.models import get_model", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 38 }, { "span": "from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 94 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "get", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Library_", ",_", "Node_", ",_", "Templa", "te", "Syntax", "Error_", ",_", "Variable_", ",_", "Varia", "ble", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "default", "filters_", "import_", "slugify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "positions_", "._", "models_", "import_", "Position_", ",_", "Position", "Content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "positions_", "import_", "settings_", "as_", "position", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "get", "\\u", "position", "\\u", "content", "\"_", ",_", "do", "\\u", "get", "\\u", "position", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "get", "\\u", "content", "\\u", "position", "s", "\"_", ",_", "do", "\\u", "get", "\\u", "content", "\\u", "positions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "get", "\\u", "applica", "ble", "\\u", "position", "s", "\"_", ",_", "do", "\\u", "get", "\\u", "applica", "ble", "\\u", "positions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "get", "\\u", "position", "\"_", ",_", "do", "\\u", "get", "\\u", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "render", "\\u", "position", "\\u", "content", "\"_", ",_", "do", "\\u", "render", "\\u", "position", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "tag_", "(_", "\"", "can", "\\u", "be", "\\u", "position", "ed", "\"_", ",_", "do", "\\u", "can", "\\u", "be", "\\u", "position", "ed_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "arguments_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "unicode_", ")_", ":_", "\\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_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "value_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "item_", "._", "split_", "(_", "'='_", ")_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "val_", "=_", "item_", "._", "split_", "(_", "'='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "name_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "variable_", "(_", "value_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "wrapp", "er", " ", "function", " ", "to", " ", "resolve", " ", "template", " ", "variab", "les", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "return", " ", "Non", "e", " ", "if", " ", "[", "none", "\\u", "on", "\\u", "fail", "]", " ", "is", " ", "[", "Tru", "e", "],", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "will", " ", "return", " ", "[", "value", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Variable_", "(_", "value_", ")_", "._", "resolve_", "(_", "context_", ")_", "\\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 ", " _", "if_", "none", "\\u", "on", "\\u", "fail_", ":_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "position_", ",_", "varname_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "position_", "=_", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "varname_", "=_", "varname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "limit_", "=_", "int_", "(_", "kwargs_", "._", "get_", "(_", "'", "limit", "'_", ",_", "'", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "as", "\\u", "contenttype", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "(_", "kwargs_", "._", "get_", "(_", "'", "as", "\\u", "contenttype", "'_", ",_", "'", "Tru", "e", "'_", ")_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "fal", "se", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "as", "\\u", "contenttype", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "position_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "get", "\\u", "content_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "pos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "self_", "._", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "contenttype", "_", "=_", "self_", "._", "as", "\\u", "contenttype", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Applica", "ble", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Applica", "ble", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj_", "=_", "None_", ",_", "content", "\\u", "type", "\\u", "id_", "=_", "None_", ",_", "object\\u", "id_", "=_", "None_", ",_", "varname_", "=_", "None_", ",_", "return", "\\u", "all_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "obj_", ",_", "self_", "._", "varname_", ",_", "self_", "._", "return", "\\u", "all_", ")_", "=_", "(_", "obj_", ",_", "varname_", ",_", "return", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "self_", "._", "object\\u", "id_", ")_", "=_", "(_", "content", "\\u", "type", "\\u", "id_", ",_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "ble", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "get", "\\u", "applica", "ble_", "(_", "obj_", ",_", "self_", "._", "return", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Conten", "t", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Conten", "t", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj_", "=_", "None_", ",_", "content", "\\u", "type", "\\u", "id_", "=_", "None_", ",_", "object\\u", "id_", "=_", "None_", ",_", "varname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "obj_", ",_", "self_", "._", "varname_", ")_", "=_", "(_", "obj_", ",_", "varname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "self_", "._", "object\\u", "id_", ")_", "=_", "(_", "content", "\\u", "type", "\\u", "id_", ",_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conten", "t", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "position", "s", "\\u", "for", "\\u", "object_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Position", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Position", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "prefix_", ",_", "name_", ",_", "varname_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prefix_", "=_", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "varname_", "=_", "varname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slugify_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "(_", "kwargs_", "._", "get_", "(_", "'", "slug", "if", "y", "'_", ",_", "'", "Tru", "e", "'_", ")_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "slugify_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Position", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "name_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "slugify_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "slugify_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "prefix_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "slugify_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "slugify_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "name_", "=_", "'%", "s", "%", "s", "%", "s", "'_", "%_", "(_", "prefix_", ",_", "position", "\\u", "settings_", "._", "CON", "BIN", "E", "\\u", "STRING_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "position_", "=_", "Position_", "._", "objects_", "._", "get_", "(_", "name", "\\u\\u", "iex", "act_", "=_", "s", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Position_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Render", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Render", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pc_", ",_", "template_", "=_", "None_", ",_", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pc_", "=_", "pc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "template_", "=_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "suffix_", "=_", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Position", "Conten", "t", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", ",_", "template_", "=_", "self_", "._", "suffix_", ",_", "self_", "._", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pc_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "pc_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "pc_", ",_", "Position", "Content_", ")_", ":_", "\\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_", "tpl_", "=_", "pc_", "._", "render_", "(_", "template_", "=_", "template_", ",_", "suffix_", "=_", "suffix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tpl_", "\\u\\u\\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_", "Can", "Be", "Position", "ed", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Can", "Be", "Position", "ed", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj_", "=_", "None_", ",_", "content", "\\u", "type", "\\u", "id_", "=_", "None_", ",_", "object\\u", "id_", "=_", "None_", ",_", "varname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "obj_", ",_", "self_", "._", "content", "\\u", "type", "\\u", "id_", "=_", "obj_", ",_", "content", "\\u", "type", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object\\u", "id_", ",_", "self_", "._", "varname_", "=_", "object\\u", "id_", ",_", "varname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "Be", "Position", "ed", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "can", "\\u", "be", "\\u", "position", "ed_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "position", "\\u", "content_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "position", "\\u", "content", " ", "position", " ", "as", " ", "content", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "position", "\\u", "content", " ", "position", " ", "as", " ", "content", " ", "[", "limit", "=", "N", "]", " ", "[", "as", "\\u", "contenttype", "=", "Tru", "e", "|", "Fal", "se", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Whe", "re", " ", "position", " ", "is", " ", "eit", "her", " ", "a", " ", "Position", " ", "instance", " ", "(", "e", ".", "g", ".", " ", "position", "),", " ", "or", " ", "Position", " ", "name", " ", "(", "e", ".", "g", ".", " ", "home", "\\u\\u", "headline", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "at", " ", "leas", "t", " ", "3", " ", "argu", "ment", "s", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argv_", "[_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "must", " ", "have", " ", "'", "as", "'", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "position_", ",_", "varname_", ")_", "=_", "(_", "argv_", "[_", "1_", "]_", ",_", "argv_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "argument_", "in_", "argv_", "[_", "4_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "argument_", "._", "split_", "(_", "'='_", ")_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "str_", "(_", "argument_", "._", "split_", "(_", "'='_", ")_", "[_", "0_", "]_", ")_", "]_", "=_", "argument_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Position", "Conten", "t", "Node_", "(_", "position_", ",_", "varname_", ",_", "**_", "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_", "do", "\\u", "get", "\\u", "applica", "ble", "\\u", "positions_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "applica", "ble", "\\u", "position", "s", " ", "object", " ", "as", " ", "position", "s", " ", "[", "all", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "for", " ", "the", " ", "admin", "..", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "applica", "ble", "\\u", "position", "s", " ", "content", "\\u", "type", "\\u", "id", " ", "object\\u", "id", " ", "as", " ", "position", "s", " ", "[", "all", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "is", " ", "option", "al", " ", "and", " ", "will", " ", "return", " ", "all", ",", " ", "if", " ", "it", " ", "is", " ", "not", " ", "spe", "fic", "ied", " ", "only", " ", "position", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "current", " ", "object", " ", "is", " ", "not", " ", "contain", "ed", " ", "in", " ", "will", " ", "be", " ", "return", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", ">_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "three", ",", " ", "four", " ", "or", " ", "five", " ", "argu", "ment", "s", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "all_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv_", "[_", "2_", "]_", "==_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argc", "_", "==_", "5_", "and_", "argv_", "[_", "4_", "]_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "all_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Applica", "ble", "Position", "s", "Node_", "(_", "obj_", "=_", "argv_", "[_", "1_", "]_", ",_", "varname_", "=_", "argv_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "all_", "=_", "return", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "argv_", "[_", "3_", "]_", "==_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argc", "_", "==_", "6_", "and_", "argv_", "[_", "5_", "]_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "all_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Applica", "ble", "Position", "s", "Node_", "(_", "content", "\\u", "type", "\\u", "id_", "=_", "argv_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "id_", "=_", "argv_", "[_", "2_", "]_", ",_", "varname_", "=_", "argv_", "[_", "4_", "]_", ",_", "return", "\\u", "all_", "=_", "return", "\\u", "all_", ")_", "\\u\\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_", "Templa", "te", "Syntax", "Error_", ",_", "'", "Second", " ", "or", " ", "Thi", "rd", " ", "argu", "ment", " ", "must", " ", "be", " ", "\"", "as", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "content", "\\u", "positions_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "content", "\\u", "position", "s", " ", "object", " ", "as", " ", "position", "s", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "for", " ", "the", " ", "admin", "..", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "content", "\\u", "position", "s", " ", "content", "\\u", "type", "\\u", "id", " ", "object\\u", "id", " ", "as", " ", "position", "s", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", "!=_", "4_", "and_", "argc", "_", "!=_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "three", " ", "or", " ", "four", " ", "argu", "ment", "s", ".\"_", "%_", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argv_", "[_", "2_", "]_", "==_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Conten", "t", "Position", "s", "Node_", "(_", "obj_", "=_", "argv_", "[_", "1_", "]_", ",_", "varname_", "=_", "argv_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "argv_", "[_", "3_", "]_", "==_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Conten", "t", "Position", "s", "Node_", "(_", "content", "\\u", "type", "\\u", "id_", "=_", "argv_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "id_", "=_", "argv_", "[_", "2_", "]_", ",_", "varname_", "=_", "argv_", "[_", "4_", "]_", ")_", "\\u\\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_", "Templa", "te", "Syntax", "Error_", ",_", "'", "Second", " ", "or", " ", "Thi", "rd", " ", "argu", "ment", " ", "must", " ", "be", " ", "\"", "as", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "get", "\\u", "position_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "position", " ", "name", " ", "as", " ", "varname", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "position", " ", "prefix", " ", "name", " ", "as", " ", "varname", " ", "[", "slug", "if", "y", "=", "Tru", "e", "|", "Fal", "se", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "at", " ", "leas", "t", " ", "3", " ", "argu", "ment", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argv_", "[_", "2_", "]_", "!=_", "'", "as", "'_", "and_", "argv_", "[_", "3_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "must", " ", "have", " ", "'", "as", "'", " ", "as", " ", "the", " ", "second", " ", "or", " ", "third", " ", "argu", "ment", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", ",_", "prefix_", ",_", "varname_", ",_", "startpo", "s_", "=_", "''_", ",_", "''_", ",_", "''_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv_", "[_", "2_", "]_", "==_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startpo", "s_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "argv_", "[_", "3_", "]_", "==_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "argv_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startpo", "s_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "argument_", "in_", "argv_", "[_", "startpo", "s_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "argument_", "._", "split_", "(_", "'='_", ")_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "str_", "(_", "argument_", "._", "split_", "(_", "'='_", ")_", "[_", "0_", "]_", ")_", "]_", "=_", "argument_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Position", "Node_", "(_", "prefix_", ",_", "name_", ",_", "varname_", ",_", "**_", "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_", "do", "\\u", "render", "\\u", "position", "\\u", "content_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "render", "\\u", "position", "\\u", "content", " ", "[", "Position", "Conten", "t", "]", " ", "[", "with", "]", " ", "[", "suff", "ix", "=", "S", "]", " ", "[", "template", "=", "T", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "render", "\\u", "position", "\\u", "content", " ", "pc", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "render", "\\u", "position", "\\u", "content", " ", "pc", " ", "with", " ", "suff", "ix", "=", "custom", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "render", "\\u", "position", "\\u", "content", " ", "pc", " ", "with", " ", "template", "=", "myc", "ust", "om", "template", "s", "/", "position", "s", "/", "custom", ".", "html", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "suff", "ix", " ", "OR", " ", "template", " ", "can", " ", "be", " ", "specified", ",", " ", "but", " ", "not", " ", "bot", "h", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", "<_", "2_", "or_", "argc", "_", ">_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "eit", "her", " ", "two", " ", "or", " ", "four", " ", "argu", "ment", "s", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argc", "_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Render", "Position", "Conten", "t", "Node_", "(_", "argv_", "[_", "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 ", " _", "if_", "argv_", "[_", "2_", "]_", "!=_", "'", "with", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "'", "Second", " ", "argu", "ment", " ", "must", " ", "be", " ", "\"", "with", "\"", " ", "for", " ", "tag", " ", "%", "s", ".'_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra_", "=_", "argv_", "[_", "3_", "]_", "._", "split_", "(_", "'='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "extra_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Las", "t", " ", "argu", "ment", " ", "must", " ", "be", " ", "formate", "d", " ", "correct", "ly", " ", "for", " ", "tag", " ", "%", "s", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "extra_", "[_", "0_", "]_", "in_", "[_", "'", "suff", "ix", "'_", ",_", "'", "template", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Las", "t", " ", "argm", "ent", " ", "must", " ", "of", " ", "eit", "her", " ", "suff", "ix", " ", "or", " ", "template", " ", "for", " ", "tag", " ", "%", "s", ".\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "str_", "(_", "extra_", "[_", "0_", "]_", ")_", ":_", "extra_", "[_", "1_", "]_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Render", "Position", "Conten", "t", "Node_", "(_", "argv_", "[_", "1_", "]_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "can", "\\u", "be", "\\u", "position", "ed_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "can", "\\u", "be", "\\u", "position", "ed", " ", "[", "object", "]", " ", "as", " ", "[", "varname", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "can", "\\u", "be", "\\u", "position", "ed", " ", "[", "content", "\\u", "type", "\\u", "id", "]", " ", "[", "object\\u", "id", "]", " ", "as", " ", "[", "varname", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "can", "\\u", "be", "\\u", "position", "ed", " ", "stor", "y", " ", "as", " ", "stor", "y", "\\u", "can", "\\u", "be", "\\u", "position", "ed", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "can", "\\u", "be", "\\u", "position", "ed", " ", "23", " ", "123", "2", " ", "as", " ", "object\\u", "can", "\\u", "be", "\\u", "position", "ed", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "_", "=_", "len_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "_", "<_", "4_", "or_", "argc", "_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "\"", "Ta", "g", " ", "%", "s", " ", "take", "s", " ", "eit", "her", " ", "3", " ", "or", " ", "4", " ", "argu", "ment", "s", ",\"_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argc", "_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "[_", "2_", "]_", "!=_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "'", "Second", " ", "argu", "ment", " ", "must", " ", "be", " ", "\"", "as", "\"", " ", "for", " ", "tag", " ", "%", "s", ".'_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Can", "Be", "Position", "ed", "Node_", "(_", "obj_", "=_", "argv_", "[_", "1_", "]_", ",_", "varname_", "=_", "argv_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "argc", "_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "[_", "3_", "]_", "!=_", "\"", "as", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", ",_", "'", "Thi", "rd", " ", "argu", "ment", " ", "must", " ", "be", " ", "\"", "as", "\"", " ", "for", " ", "tag", " ", "%", "s", ".'_", "%_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Can", "Be", "Position", "ed", "Node_", "(_", "content", "\\u", "type", "\\u", "id_", "=_", "argv_", "[_", "1_", "]_", ",_", "object\\u", "id_", "=_", "argv_", "[_", "2_", "]_", ",_", "varname_", "=_", "argv_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Use of the return value of a procedure
CGATOxford/cgat/obsolete/calculate_histogram.py
[ { "content": "################################################################################\n#\n# MRC FGU Computational Genomics Group\n#\n# $Id$\n#\n# Copyright (C) 2009 Andreas Heger\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\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program 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\n# GNU 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, USA.\n#################################################################################\n'''\ncalculate_histogram.py - calculate histogram from data\n======================================================\n\n:Author: Andreas Heger\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nPurpose\n-------\n\nThis script calculates histograms from data in a\ntab-separated table.\n\nUsage\n-----\n\nExample::\n\n python calculate_histogram.py < in.data > out.tsv\n\nType::\n\n python calculate_histogram.py --help\n\nfor command line help.\n\nCommand line options\n--------------------\n\n'''\nimport sys\nimport re\nimport string\nimport os\nimport getopt\nimport time\n\nimport CGAT.Experiment as E\nimport CGAT.Histogram as Histogram\n\n##--------------------------------------------------------------------------------------------------------- \n\nif __name__ == '__main__':\n sys.exit(main(sys.argv))\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main( argv = None ):\n \n if argv == None: argv = sys.argv\n\n # setup command line parser\n parser = E.OptionParser( version = \"%prog version: $Id$\", \n usage = globals()[\"__doc__\"] )\n\n parser.add_option(\"-n\", \"--nonull\", dest=\"nonull\", action = \"store_true\",\n help=\"no null [default=%default]\" )\n\n parser.add_option(\"-e\", \"--show-empty\", dest=\"empty_bins\", action = \"store_true\",\n help=\"show empty bins [default=%default]\" )\n\n parser.add_option(\"-o\", \"--normalize\", dest=\"normalize\", action = \"store_true\",\n help=\"normalize histogram [default=%default]\" )\n\n parser.add_option(\"-i\", \"--titles\", dest=\"titles\", action = \"store_true\",\n help=\"use titles supplied in ... [default=%default]\" )\n\n parser.add_option( \"--cumulative\", dest=\"cumulative\", action = \"store_true\",\n help=\"compute cumulative histogram [default=%default]\" )\n\n parser.add_option( \"--reverse-cumulative\", dest=\"reverse_cumulative\", action = \"store_true\",\n help=\"compute reverse cumulative histogram [default=%default]\" )\n\n parser.add_option( \"-c\", \"--column\", dest=\"column\", type = \"int\",\n help=\"columns to take [default=%default]\" )\n \n parser.add_option( \"-b\", \"--bin-size\", dest=\"bin_size\", type = \"float\",\n help=\"bin size to use [default=%default]\" )\n\n parser.add_option( \"-u\", \"--upper\", dest=\"upper_limit\", type = \"float\",\n help=\"upper limit to use [default=%default]\" )\n\n parser.add_option( \"-l\", \"--lower\", dest=\"lower_limit\", type = \"float\",\n help=\"lower limit to use [default=%default]\" )\n\n parser.add_option( \"-s\", \"--scale\", dest=\"scale\", type = \"float\",\n help=\"scale to use [default=%default]\" )\n\n parser.add_option( \"-a\", \"--append\", dest=\"append\", type = \"choice\", action=\"append\",\n choices = (\"normalize\", ),\n help=\"append columns [default=%default]\" )\n\n parser.set_defaults(\n nonull = None,\n columns = [0,],\n empty_bins = True,\n titles = False,\n lower_limit = None,\n upper_limit = None,\n bin_size = None,\n scale = None,\n normalize = None,\n append = [],\n cumulative = False,\n reverse_cumulative = False )\n\n ## add common options (-h/--help, ...) and parse command line \n (options, args) = E.Start( parser, argv = argv )\n\n if options.columns:\n if options.columns != \"all\":\n options.columns = [ int(x) - 1 for x in options.columns.split( \",\") ]\n else:\n options.columns.append( 0 )\n\n histograms = []\n \n vals = []\n \n for x in options.columns: vals.append( [] )\n \n # retrieve histogram\n lines = filter( lambda x: x[0] <> \"#\", sys.stdin.readlines())\n\n ncols = len(string.split(lines[0][:-1], \"\\t\"))\n if options.columns == \"all\":\n options.columns = range(ncols)\n for x in options.columns: vals.append( [] )\n\n if options.titles:\n data = lines[0][:-1].split(\"\\t\")\n del lines[0]\n options.titles = map( lambda x: data[x], options.columns)\n \n for l in lines:\n data = string.split(l[:-1], \"\\t\")\n \n for x in range(len(options.columns)):\n try:\n v = string.atof(data[options.columns[x]])\n except IndexError:\n print \"# IndexError in line:\", l[:-1]\n continue\n except ValueError:\n continue\n\n if options.scale:\n v *= options.scale\n\n if options.upper_limit != None and v > options.upper_limit:\n v = options.upper_limit\n\n if options.lower_limit != None and v < options.lower_limit:\n v = options.lower_limit\n\n vals[x].append( v )\n\n lines = None\n\n hists = []\n titles = []\n \n for x in range(len(options.columns)):\n E.info( \"column=%i, num_values=%i\" % (options.columns[x], len(vals[x])) )\n\n if len(vals[x]) == 0: continue\n \n h = Histogram.Calculate( vals[x], no_empty_bins = options.empty_bins, increment = options.bin_size)\n if options.scale: h = Histogram.Scale( h, 1.0 / options.scale )\n\n if options.normalize: h = Histogram.Normalize( h )\n if options.cumulative: h = Histogram.Cumulate( h )\n if options.reverse_cumulative: h = Histogram.Cumulate( h, direction = 0 )\n \n hists.append(h)\n\n for m in options.append:\n if m == \"normalize\":\n hists.append( Histogram.Normalize( h ) )\n\n if options.titles:\n titles.append( options.titles[x] )\n\n if titles:\n options.stdout.write( \"bin\\t\" + \"\\t\".join(titles) + \"\\n\" )\n\n if len(hists) == 1:\n Histogram.Print( hists[0], nonull = options.nonull )\n else:\n combined_histogram = Histogram.Combine( hists )\n Histogram.Print( combined_histogram, nonull = options.nonull ) \n\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 65 } ]
[ { "span": "main(sys.argv))", "start_line": 213, "start_column": 13, "end_line": 213, "end_column": 27 } ]
[ { "span": "def main( argv = None ):", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 24 } ]
1
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\\uNL\\u\\u\\u_", "#", " ", " ", " ", "MR", "C", " ", "FG", "U", " ", "Computation", "al", " ", "Geno", "mic", "s", " ", "Group_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "$", "Id", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Andre", "as", " ", "He", "ger_", "\\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", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "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", " ", "program", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "GN", "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", ",", " ", "USA", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "calcul", "ate", "\\u", "histo", "gram", ".", "py", " ", "-", " ", "calcul", "ate", " ", "histo", "gram", " ", "from", " ", "data", "\\", "10", ";", "==============", "==============", "==============", "============", "\\", "10", ";", "\\", "10", ";", ":", "Author", ":", " ", "Andre", "as", " ", "He", "ger", "\\", "10", ";", ":", "Release", ":", " ", "$", "Id", "$", "\\", "10", ";", ":", "Date", ":", " ", "|", "toda", "y", "|", "\\", "10", ";", ":", "Ta", "gs", ":", " ", "Pyth", "on", "\\", "10", ";", "\\", "10", ";", "Pur", "pose", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "calcul", "ates", " ", "histograms", " ", "from", " ", "data", " ", "in", " ", "a", "\\", "10", ";", "tab", "-", "separate", "d", " ", "table", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", "\\", "10", ";", "-----", "\\", "10", ";", "\\", "10", ";", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "calcul", "ate", "\\u", "histo", "gram", ".", "py", " ", "<", " ", "in", ".", "data", " ", ">", " ", "out", ".", "tsv", "\\", "10", ";", "\\", "10", ";", "Type", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "calcul", "ate", "\\u", "histo", "gram", ".", "py", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", "for", " ", "command", " ", "line", " ", "help", ".", "\\", "10", ";", "\\", "10", ";", "Command", " ", "line", " ", "options", "\\", "10", ";", "--------------", "------", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "CGA", "T_", "._", "Experiment_", "as_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Histogram", "_", "as_", "Histogram", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "==_", "None_", ":_", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "command", " ", "line", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "n", "\"_", ",_", "\"--", "non", "ull", "\"_", ",_", "dest_", "=_", "\"", "non", "ull", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "no", " ", "null", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "e", "\"_", ",_", "\"--", "show", "-", "empty", "\"_", ",_", "dest_", "=_", "\"", "empty", "\\u", "bins", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "show", " ", "empty", " ", "bins", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "o", "\"_", ",_", "\"--", "normali", "ze", "\"_", ",_", "dest_", "=_", "\"", "normali", "ze", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "normali", "ze", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "i", "\"_", ",_", "\"--", "titles", "\"_", ",_", "dest_", "=_", "\"", "titles", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "use", " ", "titles", " ", "supplie", "d", " ", "in", " ", "...", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "cumul", "ative", "\"_", ",_", "dest_", "=_", "\"", "cumul", "ative", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "compute", " ", "cumul", "ative", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "reverse", "-", "cumul", "ative", "\"_", ",_", "dest_", "=_", "\"", "reverse", "\\u", "cumul", "ative", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "compute", " ", "reverse", " ", "cumul", "ative", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "c", "\"_", ",_", "\"--", "column", "\"_", ",_", "dest_", "=_", "\"", "column", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "column", "s", " ", "to", " ", "take", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "b", "\"_", ",_", "\"--", "bin", "-", "size", "\"_", ",_", "dest_", "=_", "\"", "bin", "\\u", "size", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "bin", " ", "size", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "u", "\"_", ",_", "\"--", "upper", "\"_", ",_", "dest_", "=_", "\"", "upper", "\\u", "limit", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "upper", " ", "limit", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "l", "\"_", ",_", "\"--", "lower", "\"_", ",_", "dest_", "=_", "\"", "lower", "\\u", "limit", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "lower", " ", "limit", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "s", "\"_", ",_", "\"--", "scale", "\"_", ",_", "dest_", "=_", "\"", "scale", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "scale", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "a", "\"_", ",_", "\"--", "append", "\"_", ",_", "dest_", "=_", "\"", "append", "\"_", ",_", "type_", "=_", "\"", "choice", "\"_", ",_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "normali", "ze", "\"_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "append", " ", "column", "s", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "non", "ull", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "0_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "bins_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "titles_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lower", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upper", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bin", "\\u", "size_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "append_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cumul", "ative_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse", "\\u", "cumul", "ative_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "add", " ", "common", " ", "options", " ", "(-", "h", "/--", "help", ",", " ", "...)", " ", "and", " ", "parse", " ", "command", " ", "line", " _", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ",_", "argv_", "=_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "columns_", "!=_", "\"", "all", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "columns_", "=_", "[_", "int_", "(_", "x_", ")_", "-_", "1_", "for_", "x_", "in_", "options_", "._", "columns_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "columns_", "._", "append_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "histograms", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "columns_", ":_", "vals_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retrieve", " ", "histogram_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", "<_", ">_", "\"#\"_", ",_", "sys_", "._", "stdin_", "._", "readlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ncols_", "=_", "len_", "(_", "string_", "._", "split_", "(_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", ",_", "\"\\\\", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "columns_", "==_", "\"", "all", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "columns_", "=_", "range_", "(_", "ncols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "columns_", ":_", "vals_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "lines_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "titles_", "=_", "map_", "(_", "lambda_", "x_", ":_", "data_", "[_", "x_", "]_", ",_", "options_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "string_", "._", "split_", "(_", "l_", "[_", ":_", "-_", "1_", "]_", ",_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "len_", "(_", "options_", "._", "columns_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "string_", "._", "ato", "f_", "(_", "data_", "[_", "options_", "._", "columns_", "[_", "x_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "Index", "Error", " ", "in", " ", "line", ":\"_", ",_", "l_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "*=_", "options_", "._", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "upper", "\\u", "limit_", "!=_", "None_", "and_", "v_", ">_", "options_", "._", "upper", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "options_", "._", "upper", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "lower", "\\u", "limit_", "!=_", "None_", "and_", "v_", "<_", "options_", "._", "lower", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "options_", "._", "lower", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vals_", "[_", "x_", "]_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "titles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "len_", "(_", "options_", "._", "columns_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "info_", "(_", "\"", "column", "=", "%", "i", ",", " ", "num", "\\u", "values", "=", "%", "i", "\"_", "%_", "(_", "options_", "._", "columns_", "[_", "x_", "]_", ",_", "len_", "(_", "vals_", "[_", "x_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "vals_", "[_", "x_", "]_", ")_", "==_", "0_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h_", "=_", "Histogram", "_", "._", "Calculat", "e_", "(_", "vals_", "[_", "x_", "]_", ",_", "no", "\\u", "empty", "\\u", "bins_", "=_", "options_", "._", "empty", "\\u", "bins_", ",_", "increment_", "=_", "options_", "._", "bin", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "scale_", ":_", "h_", "=_", "Histogram", "_", "._", "Scale_", "(_", "h_", ",_", "1.0_", "/_", "options_", "._", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "normalize_", ":_", "h_", "=_", "Histogram", "_", "._", "Normalize", "_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "cumul", "ative_", ":_", "h_", "=_", "Histogram", "_", "._", "Cum", "ulate", "_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "reverse", "\\u", "cumul", "ative_", ":_", "h_", "=_", "Histogram", "_", "._", "Cum", "ulate", "_", "(_", "h_", ",_", "direction_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "s_", "._", "append_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m_", "in_", "options_", "._", "append_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "==_", "\"", "normali", "ze", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hist", "s_", "._", "append_", "(_", "Histogram", "_", "._", "Normalize", "_", "(_", "h_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "titles_", "._", "append_", "(_", "options_", "._", "titles_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "stdout_", "._", "write_", "(_", "\"", "bin", "\\\\", "t", "\"_", "+_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "titles_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "hist", "s_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Histogram", "_", "._", "Print_", "(_", "hist", "s_", "[_", "0_", "]_", ",_", "non", "ull", "_", "=_", "options_", "._", "non", "ull", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combin", "ed", "\\u", "histogram_", "=_", "Histogram", "_", "._", "Combine", "_", "(_", "hist", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Histogram", "_", "._", "Print_", "(_", "combin", "ed", "\\u", "histogram_", ",_", "non", "ull", "_", "=_", "options_", "._", "non", "ull", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
serverdensity/sd-agent/util.py
[ { "content": "# stdlib\nfrom hashlib import md5\nimport logging\nimport math\nimport os\nimport platform\nimport re\nimport signal\nimport socket\nimport sys\nimport time\nimport types\nimport urllib2\nimport uuid\n\n# 3p\nimport simplejson as json\nimport yaml # noqa, let's guess, probably imported somewhere\nfrom tornado import ioloop\ntry:\n from yaml import CLoader as yLoader\n from yaml import CDumper as yDumper\nexcept ImportError:\n # On source install C Extensions might have not been built\n from yaml import Loader as yLoader # noqa, imported from here elsewhere\n from yaml import Dumper as yDumper # noqa, imported from here elsewhere\n\n# These classes are now in utils/, they are just here for compatibility reasons,\n# if a user actually uses them in a custom check\n# If you're this user, please use utils.pidfile or utils.platform instead\n# FIXME: remove them at a point (6.x)\nfrom utils.pidfile import PidFile # noqa, see ^^^\nfrom utils.platform import Platform\nfrom utils.subprocess_output import subprocess\n\n\nVALID_HOSTNAME_RFC_1123_PATTERN = re.compile(r\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$\")\nMAX_HOSTNAME_LEN = 255\nCOLON_NON_WIN_PATH = re.compile(':(?!\\\\\\\\)')\n\nlog = logging.getLogger(__name__)\n\nNumericTypes = (float, int, long)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_IDS = {}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"\nIterable Recipes\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def plural(count):\n if count == 1:\n return \"\"\n return \"s\"", "metadata": "root.plural", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def get_tornado_ioloop():\n return ioloop.IOLoop.current()", "metadata": "root.get_tornado_ioloop", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def get_uuid():\n # Generate a unique name that will stay constant between\n # invocations, such as platform.node() + uuid.getnode()\n # Use uuid5, which does not depend on the clock and is\n # recommended over uuid3.\n # This is important to be able to identify a server even if\n # its drives have been wiped clean.\n # Note that this is not foolproof but we can reconcile servers\n # on the back-end if need be, based on mac addresses.\n return uuid.uuid5(uuid.NAMESPACE_DNS, platform.node() + str(uuid.getnode())).hex", "metadata": "root.get_uuid", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def get_os():\n \"Human-friendly OS name\"\n if sys.platform == 'darwin':\n return 'mac'\n elif sys.platform.find('freebsd') != -1:\n return 'freebsd'\n elif sys.platform.find('linux') != -1:\n return 'linux'\n elif sys.platform.find('win32') != -1:\n return 'windows'\n elif sys.platform.find('sunos') != -1:\n return 'solaris'\n else:\n return sys.platform", "metadata": "root.get_os", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def headers(agentConfig):\n # Build the request headers\n return {\n 'User-Agent': 'Serverdensity Agent/%s' % agentConfig['version'],\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Accept': 'text/html, */*',\n }", "metadata": "root.headers", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def windows_friendly_colon_split(config_string):\n '''\n Perform a split by ':' on the config_string\n without splitting on the start of windows path\n '''\n if Platform.is_win32():\n # will split on path/to/module.py:blabla but not on C:\\\\path\n return COLON_NON_WIN_PATH.split(config_string)\n else:\n return config_string.split(':')", "metadata": "root.windows_friendly_colon_split", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def getTopIndex():\n macV = None\n if sys.platform == 'darwin':\n macV = platform.mac_ver()\n\n # Output from top is slightly modified on OS X 10.6 (case #28239)\n if macV and macV[0].startswith('10.6.'):\n return 6\n else:\n return 5", "metadata": "root.getTopIndex", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def isnan(val):\n if hasattr(math, 'isnan'):\n return math.isnan(val)\n\n # for py < 2.6, use a different check\n # http://stackoverflow.com/questions/944700/how-to-check-for-nan-in-python\n return str(val) == str(1e400*0)", "metadata": "root.isnan", "header": "['module', '___EOS___']", "index": 114 }, { "content": "def cast_metric_val(val):\n # ensure that the metric value is a numeric type\n if not isinstance(val, NumericTypes):\n # Try the int conversion first because want to preserve\n # whether the value is an int or a float. If neither work,\n # raise a ValueError to be handled elsewhere\n for cast in [int, float]:\n try:\n val = cast(val)\n return val\n except ValueError:\n continue\n raise ValueError\n return val", "metadata": "root.cast_metric_val", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def get_next_id(name):\n global _IDS\n current_id = _IDS.get(name, 0)\n current_id += 1\n _IDS[name] = current_id\n return current_id", "metadata": "root.get_next_id", "header": "['module', '___EOS___']", "index": 139 }, { "content": "def is_valid_hostname(hostname):\n if hostname.lower() in set([\n 'localhost',\n 'localhost.localdomain',\n 'localhost6.localdomain6',\n 'ip6-localhost',\n ]):\n log.warning(\"Hostname: %s is local\" % hostname)\n return False\n if len(hostname) > MAX_HOSTNAME_LEN:\n log.warning(\"Hostname: %s is too long (max length is %s characters)\" % (hostname, MAX_HOSTNAME_LEN))\n return False\n if VALID_HOSTNAME_RFC_1123_PATTERN.match(hostname) is None:\n log.warning(\"Hostname: %s is not complying with RFC 1123\" % hostname)\n return False\n return True", "metadata": "root.is_valid_hostname", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def get_hostname(config=None):\n \"\"\"\n Get the canonical host name this agent should identify as. This is\n the authoritative source of the host name for the agent.\n\n Tries, in order:\n\n * agent config (config.cfg, \"hostname:\")\n * 'hostname -f' (on unix)\n * socket.gethostname()\n \"\"\"\n hostname = None\n\n # first, try the config\n if config is None:\n from config import get_config\n config = get_config(parse_args=True)\n config_hostname = config.get('hostname')\n if config_hostname and is_valid_hostname(config_hostname):\n return config_hostname\n\n #Try to get GCE instance name\n if hostname is None:\n gce_hostname = GCE.get_hostname(config)\n if gce_hostname is not None:\n if is_valid_hostname(gce_hostname):\n return gce_hostname\n # then move on to os-specific detection\n if hostname is None:\n def _get_hostname_unix():\n try:\n # try fqdn\n p = subprocess.Popen(['/bin/hostname', '-f'], stdout=subprocess.PIPE)\n out, err = p.communicate()\n if p.returncode == 0:\n return out.strip()\n except Exception:\n return None\n\n os_name = get_os()\n if os_name in ['mac', 'freebsd', 'linux', 'solaris']:\n unix_hostname = _get_hostname_unix()\n if unix_hostname and is_valid_hostname(unix_hostname):\n hostname = unix_hostname\n\n # if we have an ec2 default hostname, see if there's an instance-id available\n if hostname is not None and True in [hostname.lower().startswith(p) for p in [u'ip-', u'domu']]:\n instanceid = EC2.get_instance_id(config)\n if instanceid:\n hostname = instanceid\n\n # fall back on socket.gethostname(), socket.getfqdn() is too unreliable\n if hostname is None:\n try:\n socket_hostname = socket.gethostname()\n except socket.error, e:\n socket_hostname = None\n if socket_hostname and is_valid_hostname(socket_hostname):\n hostname = socket_hostname\n\n if hostname is None:\n log.critical('Unable to reliably determine host name. You can define one in config.cfg or in your hosts file')\n raise Exception('Unable to reliably determine host name. You can define one in config.cfg or in your hosts file')\n else:\n return hostname", "metadata": "root.get_hostname", "header": "['module', '___EOS___']", "index": 164 }, { "content": "class GCE(object):\n URL = \"http://169.254.169.254/computeMetadata/v1/?recursive=true\"\n TIMEOUT = 0.1 # second\n SOURCE_TYPE_NAME = 'google cloud platform'\n metadata = None\n EXCLUDED_ATTRIBUTES = [\"sshKeys\", \"user-data\", \"cli-cert\", \"ipsec-cert\", \"ssl-cert\"]\n\n\n\n\n\n\n", "metadata": "root.GCE", "header": "['module', '___EOS___']", "index": 230 }, { "content": " @staticmethod\n def _get_metadata(agentConfig):\n if GCE.metadata is not None:\n return GCE.metadata\n\n if not agentConfig['collect_instance_metadata']:\n log.info(\"Instance metadata collection is disabled. Not collecting it.\")\n GCE.metadata = {}\n return GCE.metadata\n\n socket_to = None\n try:\n socket_to = socket.getdefaulttimeout()\n socket.setdefaulttimeout(GCE.TIMEOUT)\n except Exception:\n pass\n\n try:\n opener = urllib2.build_opener()\n opener.addheaders = [('X-Google-Metadata-Request','True')]\n GCE.metadata = json.loads(opener.open(GCE.URL).read().strip())\n\n except Exception:\n GCE.metadata = {}\n\n try:\n if socket_to is None:\n socket_to = 3\n socket.setdefaulttimeout(socket_to)\n except Exception:\n pass\n return GCE.metadata", "metadata": "root.GCE._get_metadata", "header": "['class', 'GCE', '(', 'object', ')', ':', '___EOS___']", "index": 238 }, { "content": " @staticmethod\n def get_tags(agentConfig):\n if not agentConfig['collect_instance_metadata']:\n return None\n\n try:\n host_metadata = GCE._get_metadata(agentConfig)\n tags = []\n\n for key, value in host_metadata['instance'].get('attributes', {}).iteritems():\n if key in GCE.EXCLUDED_ATTRIBUTES:\n continue\n tags.append(\"%s:%s\" % (key, value))\n\n tags.extend(host_metadata['instance'].get('tags', []))\n tags.append('zone:%s' % host_metadata['instance']['zone'].split('/')[-1])\n tags.append('instance-type:%s' % host_metadata['instance']['machineType'].split('/')[-1])\n tags.append('internal-hostname:%s' % host_metadata['instance']['hostname'])\n tags.append('instance-id:%s' % host_metadata['instance']['id'])\n tags.append('project:%s' % host_metadata['project']['projectId'])\n tags.append('numeric_project_id:%s' % host_metadata['project']['numericProjectId'])\n\n GCE.metadata['hostname'] = host_metadata['instance']['hostname'].split('.')[0]\n\n return tags\n except Exception:\n return None", "metadata": "root.GCE.get_tags", "header": "['class', 'GCE', '(', 'object', ')', ':', '___EOS___']", "index": 273 }, { "content": " @staticmethod\n def get_hostname(agentConfig):\n try:\n host_metadata = GCE._get_metadata(agentConfig)\n hostname = host_metadata['instance']['hostname']\n if agentConfig.get('gce_updated_hostname'):\n return hostname\n else:\n return hostname.split('.')[0]\n except Exception:\n return None", "metadata": "root.GCE.get_hostname", "header": "['class', 'GCE', '(', 'object', ')', ':', '___EOS___']", "index": 301 }, { "content": " @staticmethod\n def get_host_aliases(agentConfig):\n try:\n host_metadata = GCE._get_metadata(agentConfig)\n project_id = host_metadata['project']['projectId']\n instance_name = host_metadata['instance']['hostname'].split('.')[0]\n return ['%s.%s' % (instance_name, project_id)]\n except Exception:\n return None", "metadata": "root.GCE.get_host_aliases", "header": "['class', 'GCE', '(', 'object', ')', ':', '___EOS___']", "index": 313 }, { "content": "class EC2(object):\n \"\"\"Retrieve EC2 metadata\n \"\"\"\n EC2_METADATA_HOST = \"http://169.254.169.254\"\n METADATA_URL_BASE = EC2_METADATA_HOST + \"/latest/meta-data\"\n INSTANCE_IDENTITY_URL = EC2_METADATA_HOST + \"/latest/dynamic/instance-identity/document\"\n TIMEOUT = 0.1 # second\n metadata = {}\n\n\n\n", "metadata": "root.EC2", "header": "['module', '___EOS___']", "index": 325 }, { "content": " @staticmethod\n def get_tags(agentConfig):\n if not agentConfig['collect_instance_metadata']:\n log.info(\"Instance metadata collection is disabled. Not collecting it.\")\n return []\n\n socket_to = None\n try:\n socket_to = socket.getdefaulttimeout()\n socket.setdefaulttimeout(EC2.TIMEOUT)\n except Exception:\n pass\n\n try:\n iam_role = urllib2.urlopen(EC2.METADATA_URL_BASE + \"/iam/security-credentials/\").read().strip()\n iam_params = json.loads(urllib2.urlopen(EC2.METADATA_URL_BASE + \"/iam/security-credentials/\" + unicode(iam_role)).read().strip())\n instance_identity = json.loads(urllib2.urlopen(EC2.INSTANCE_IDENTITY_URL).read().strip())\n region = instance_identity['region']\n\n import boto.ec2\n connection = boto.ec2.connect_to_region(region, aws_access_key_id=iam_params['AccessKeyId'], aws_secret_access_key=iam_params['SecretAccessKey'], security_token=iam_params['Token'])\n tag_object = connection.get_all_tags({'resource-id': EC2.metadata['instance-id']})\n\n EC2_tags = [u\"%s:%s\" % (tag.name, tag.value) for tag in tag_object]\n\n except Exception:\n log.exception(\"Problem retrieving custom EC2 tags\")\n EC2_tags = []\n\n try:\n if socket_to is None:\n socket_to = 3\n socket.setdefaulttimeout(socket_to)\n except Exception:\n pass\n\n return EC2_tags", "metadata": "root.EC2.get_tags", "header": "['class', 'EC2', '(', 'object', ')', ':', '___EOS___']", "index": 334 }, { "content": " @staticmethod\n def get_metadata(agentConfig):\n \"\"\"Use the ec2 http service to introspect the instance. This adds latency if not running on EC2\n \"\"\"\n # >>> import urllib2\n # >>> urllib2.urlopen('http://169.254.169.254/latest/', timeout=1).read()\n # 'meta-data\\nuser-data'\n # >>> urllib2.urlopen('http://169.254.169.254/latest/meta-data', timeout=1).read()\n # 'ami-id\\nami-launch-index\\nami-manifest-path\\nhostname\\ninstance-id\\nlocal-ipv4\\npublic-keys/\\nreservation-id\\nsecurity-groups'\n # >>> urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id', timeout=1).read()\n # 'i-deadbeef'\n\n # Every call may add TIMEOUT seconds in latency so don't abuse this call\n # python 2.4 does not support an explicit timeout argument so force it here\n # Rather than monkey-patching urllib2, just lower the timeout globally for these calls\n\n if not agentConfig['collect_instance_metadata']:\n log.info(\"Instance metadata collection is disabled. Not collecting it.\")\n return {}\n\n socket_to = None\n try:\n socket_to = socket.getdefaulttimeout()\n socket.setdefaulttimeout(EC2.TIMEOUT)\n except Exception:\n pass\n\n for k in ('instance-id', 'hostname', 'local-hostname', 'public-hostname', 'ami-id', 'local-ipv4', 'public-keys/', 'public-ipv4', 'reservation-id', 'security-groups'):\n try:\n v = urllib2.urlopen(EC2.METADATA_URL_BASE + \"/\" + unicode(k)).read().strip()\n assert type(v) in (types.StringType, types.UnicodeType) and len(v) > 0, \"%s is not a string\" % v\n EC2.metadata[k.rstrip('/')] = v\n except Exception:\n pass\n\n try:\n if socket_to is None:\n socket_to = 3\n socket.setdefaulttimeout(socket_to)\n except Exception:\n pass\n\n return EC2.metadata", "metadata": "root.EC2.get_metadata", "header": "['class', 'EC2', '(', 'object', ')', ':', '___EOS___']", "index": 373 }, { "content": " @staticmethod\n def get_instance_id(agentConfig):\n try:\n return EC2.get_metadata(agentConfig).get(\"instance-id\", None)\n except Exception:\n return None", "metadata": "root.EC2.get_instance_id", "header": "['class', 'EC2', '(', 'object', ')', ':', '___EOS___']", "index": 417 }, { "content": "class Watchdog(object):\n \"\"\"Simple signal-based watchdog that will scuttle the current process\n if it has not been reset every N seconds, or if the processes exceeds\n a specified memory threshold.\n Can only be invoked once per process, so don't use with multiple threads.\n If you instantiate more than one, you're also asking for trouble.\n \"\"\"\n\n\n", "metadata": "root.Watchdog", "header": "['module', '___EOS___']", "index": 425 }, { "content": " def __init__(self, duration, max_mem_mb = None):\n import resource\n\n #Set the duration\n self._duration = int(duration)\n signal.signal(signal.SIGALRM, Watchdog.self_destruct)\n\n # cap memory usage\n if max_mem_mb is not None:\n self._max_mem_kb = 1024 * max_mem_mb\n max_mem_bytes = 1024 * self._max_mem_kb\n resource.setrlimit(resource.RLIMIT_AS, (max_mem_bytes, max_mem_bytes))\n self.memory_limit_enabled = True\n else:\n self.memory_limit_enabled = False", "metadata": "root.Watchdog.__init__", "header": "['class', 'Watchdog', '(', 'object', ')', ':', '___EOS___']", "index": 432 }, { "content": " @staticmethod\n def self_destruct(signum, frame):\n try:\n import traceback\n log.error(\"Self-destructing...\")\n log.error(traceback.format_exc())\n finally:\n os.kill(os.getpid(), signal.SIGKILL)", "metadata": "root.Watchdog.self_destruct", "header": "['class', 'Watchdog', '(', 'object', ')', ':', '___EOS___']", "index": 448 }, { "content": " def reset(self):\n # self destruct if using too much memory, as tornado will swallow MemoryErrors\n if self.memory_limit_enabled:\n mem_usage_kb = int(os.popen('ps -p %d -o %s | tail -1' % (os.getpid(), 'rss')).read())\n if mem_usage_kb > (0.95 * self._max_mem_kb):\n Watchdog.self_destruct(signal.SIGKILL, sys._getframe(0))\n\n log.debug(\"Resetting watchdog for %d\" % self._duration)\n signal.alarm(self._duration)", "metadata": "root.Watchdog.reset", "header": "['class', 'Watchdog', '(', 'object', ')', ':', '___EOS___']", "index": 458 }, { "content": "class LaconicFilter(logging.Filter):\n \"\"\"\n Filters messages, only print them once while keeping memory under control\n \"\"\"\n LACONIC_MEM_LIMIT = 1024\n\n\n", "metadata": "root.LaconicFilter", "header": "['module', '___EOS___']", "index": 469 }, { "content": " def __init__(self, name=\"\"):\n logging.Filter.__init__(self, name)\n self.hashed_messages = {}", "metadata": "root.LaconicFilter.__init__", "header": "['class', 'LaconicFilter', '(', 'logging', '.', 'Filter', ')', ':', '___EOS___']", "index": 475 }, { "content": " def hash(self, msg):\n return md5(msg).hexdigest()", "metadata": "root.LaconicFilter.hash", "header": "['class', 'LaconicFilter', '(', 'logging', '.', 'Filter', ')', ':', '___EOS___']", "index": 479 }, { "content": " def filter(self, record):\n try:\n h = self.hash(record.getMessage())\n if h in self.hashed_messages:\n return 0\n else:\n # Don't blow up our memory\n if len(self.hashed_messages) >= LaconicFilter.LACONIC_MEM_LIMIT:\n self.hashed_messages.clear()\n self.hashed_messages[h] = True\n return 1\n except Exception:\n return 1", "metadata": "root.LaconicFilter.filter", "header": "['class', 'LaconicFilter', '(', 'logging', '.', 'Filter', ')', ':', '___EOS___']", "index": 482 }, { "content": "class Timer(object):\n \"\"\" Helper class \"\"\"\n\n\n\n\n", "metadata": "root.Timer", "header": "['module', '___EOS___']", "index": 496 }, { "content": " def __init__(self):\n self.start()", "metadata": "root.Timer.__init__", "header": "['class', 'Timer', '(', 'object', ')', ':', '___EOS___']", "index": 499 }, { "content": " def _now(self):\n return time.time()", "metadata": "root.Timer._now", "header": "['class', 'Timer', '(', 'object', ')', ':', '___EOS___']", "index": 502 }, { "content": " def start(self):\n self.started = self._now()\n self.last = self.started\n return self", "metadata": "root.Timer.start", "header": "['class', 'Timer', '(', 'object', ')', ':', '___EOS___']", "index": 505 }, { "content": " def step(self):\n now = self._now()\n step = now - self.last\n self.last = now\n return step", "metadata": "root.Timer.step", "header": "['class', 'Timer', '(', 'object', ')', ':', '___EOS___']", "index": 510 }, { "content": " def total(self, as_sec=True):\n return self._now() - self.started", "metadata": "root.Timer.total", "header": "['class', 'Timer', '(', 'object', ')', ':', '___EOS___']", "index": 516 }, { "content": "def chunks(iterable, chunk_size):\n \"\"\"Generate sequences of `chunk_size` elements from `iterable`.\"\"\"\n iterable = iter(iterable)\n while True:\n chunk = [None] * chunk_size\n count = 0\n try:\n for _ in range(chunk_size):\n chunk[count] = iterable.next()\n count += 1\n yield chunk[:count]\n except StopIteration:\n if count:\n yield chunk[:count]\n break", "metadata": "root.chunks", "header": "['module', '___EOS___']", "index": 523 } ]
[ { "span": "import yaml ", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 }, { "span": "from yaml import CLoader as yLoader", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 39 }, { "span": "from yaml import CDumper as yDumper", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 39 }, { "span": "from yaml import Loader as yLoader ", "start_line": 24, "start_column": 4, "end_line": 24, "end_column": 38 }, { "span": "from yaml import Dumper as yDumper ", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 38 }, { "span": "from utils.pidfile import PidFile ", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "stdlib", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hashlib_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3p", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", "#", " ", "no", "qa", ",", " ", "let", "'", "s", " ", "guess", ",", " ", "probab", "ly", " ", "import", "ed", " ", "some", "where_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "ioloop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "yaml_", "import_", "CL", "oad", "er_", "as_", "y", "Loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "yaml_", "import_", "CD", "ump", "er_", "as_", "y", "Dumper", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "source", " ", "install", " ", "C", " ", "Ext", "ensi", "ons", " ", "mig", "ht", " ", "have", " ", "not", " ", "bee", "n", " ", "built_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "yaml_", "import_", "Loader_", "as_", "y", "Loader_", "#", " ", "no", "qa", ",", " ", "import", "ed", " ", "from", " ", "here", " ", "else", "where_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "yaml_", "import_", "Dumper", "_", "as_", "y", "Dumper", "_", "#", " ", "no", "qa", ",", " ", "import", "ed", " ", "from", " ", "here", " ", "else", "where_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "classe", "s", " ", "are", " ", "now", " ", "in", " ", "util", "s", "/", ",", " ", "the", "y", " ", "are", " ", "just", " ", "here", " ", "for", " ", "compatibility", " ", "reasons", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "a", " ", "user", " ", "actual", "ly", " ", "use", "s", " ", "them", " ", "in", " ", "a", " ", "custom", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", "'", "re", " ", "this", " ", "user", ",", " ", "plea", "se", " ", "use", " ", "util", "s", ".", "pid", "file", " ", "or", " ", "util", "s", ".", "platform", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "remove", " ", "them", " ", "at", " ", "a", " ", "point", " ", "(", "6", ".", "x", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "utils_", "._", "pidfile_", "import_", "Pid", "File_", "#", " ", "no", "qa", ",", " ", "see", " ", "^", "^", "^_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "._", "platform_", "import_", "Platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "._", "subproc", "ess", "\\u", "output_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VALID", "\\u", "HOSTNAME", "\\u", "RF", "C", "\\u", "1123", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "\"", "^", "(([", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "]|", "[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "][", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\-]", "*[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "])\\\\", ".)", "*([", "A", "-", "Za", "-", "z", "0", "-", "9", "]|", "[", "A", "-", "Za", "-", "z", "0", "-", "9", "][", "A", "-", "Za", "-", "z", "0", "-", "9", "\\\\-]", "*[", "A", "-", "Za", "-", "z", "0", "-", "9", "])", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "HOSTNAME", "\\u", "LEN_", "=_", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COLON", "\\u", "NON", "\\u", "WIN", "\\u", "PATH_", "=_", "re_", "._", "compile_", "(_", "':", "(?!", "\\\\\\\\\\\\\\\\", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Numer", "ic", "Types_", "=_", "(_", "float_", ",_", "int_", ",_", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "IDS_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "It", "era", "ble", " ", "Recip", "es", "\\", "10", ";\"\"\"_", "\\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_", "def_", "plural_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"", "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_", "get", "\\u", "torn", "ado", "\\u", "ioloop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ioloop_", "._", "IO", "Loop_", "._", "current_", "(_", ")_", "\\u\\u\\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", "uuid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "a", " ", "unique", " ", "name", " ", "tha", "t", " ", "will", " ", "stay", " ", "constant", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invocation", "s", ",", " ", "suc", "h", " ", "as", " ", "platform", ".", "node", "()", " ", "+", " ", "uuid", ".", "getn", "ode", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "uuid", "5", ",", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "depend", " ", "on", " ", "the", " ", "clock", " ", "and", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recommende", "d", " ", "over", " ", "uuid", "3._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "importa", "nt", " ", "to", " ", "be", " ", "able", " ", "to", " ", "identify", " ", "a", " ", "server", " ", "even", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "drives", " ", "have", " ", "bee", "n", " ", "wipe", "d", " ", "clean", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "is", " ", "not", " ", "foo", "lpr", "oo", "f", " ", "but", " ", "we", " ", "can", " ", "reconcile", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "back", "-", "end", " ", "if", " ", "need", " ", "be", ",", " ", "based", " ", "on", " ", "mac", " ", "addresse", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "uuid_", "._", "uuid", "5_", "(_", "uuid_", "._", "NAMESPACE", "\\u", "DNS", "_", ",_", "platform_", "._", "node_", "(_", ")_", "+_", "str_", "(_", "uuid_", "._", "getn", "ode_", "(_", ")_", ")_", ")_", "._", "hex_", "\\u\\u\\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", "os_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Huma", "n", "-", "frie", "ndl", "y", " ", "OS", " ", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "mac", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "find_", "(_", "'", "freeb", "sd", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "freeb", "sd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "find_", "(_", "'", "linux", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "linux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "find_", "(_", "'", "win32", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "windows", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "find_", "(_", "'", "sun", "os", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "solar", "is", "'_", "\\u\\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_", "sys_", "._", "platform_", "\\u\\u\\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_", "headers_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "request", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "Server", "densit", "y", " ", "Agent", "/", "%", "s", "'_", "%_", "agent", "Config_", "[_", "'", "version", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Accept", "'_", ":_", "'", "text", "/", "html", ",", " ", "*/", "*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "windows", "\\u", "frie", "ndl", "y", "\\u", "colon", "\\u", "split_", "(_", "config", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "a", " ", "split", " ", "by", " ", "':", "'", " ", "on", " ", "the", " ", "config", "\\u", "string", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "splitting", " ", "on", " ", "the", " ", "start", " ", "of", " ", "windows", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Platform_", "._", "is", "\\u", "win32", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "will", " ", "split", " ", "on", " ", "path", "/", "to", "/", "module", ".", "py", ":", "bla", "bla", " ", "but", " ", "not", " ", "on", " ", "C", ":\\\\", "\\\\", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "COLON", "\\u", "NON", "\\u", "WIN", "\\u", "PATH_", "._", "split_", "(_", "config", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "config", "\\u", "string_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Top", "Index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mac", "V_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mac", "V_", "=_", "platform_", "._", "mac", "\\u", "ver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "from", " ", "top", " ", "is", " ", "slight", "ly", " ", "modifi", "ed", " ", "on", " ", "OS", " ", "X", " ", "10.", "6", " ", "(", "case", " ", "#", "282", "3", "9", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mac", "V_", "and_", "mac", "V_", "[_", "0_", "]_", "._", "startswith_", "(_", "'", "10.", "6", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "6_", "\\u\\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_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "isnan_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "math_", ",_", "'", "isn", "an", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "math_", "._", "isnan_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "py", " ", "<", " ", "2.6", ",", " ", "use", " ", "a", " ", "different", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "944", "700", "/", "how", "-", "to", "-", "check", "-", "for", "-", "nan", "-", "in", "-", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "val_", ")_", "==_", "str_", "(_", "1e", "400_", "*_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cast", "\\u", "metric", "\\u", "val_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "tha", "t", " ", "the", " ", "metric", " ", "value", " ", "is", " ", "a", " ", "numeri", "c", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "val_", ",_", "Numer", "ic", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "int", " ", "conve", "rsi", "on", " ", "first", " ", "bec", "aus", "e", " ", "want", " ", "to", " ", "preserve", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "ther", " ", "the", " ", "value", " ", "is", " ", "an", " ", "int", " ", "or", " ", "a", " ", "float", ".", " ", "If", " ", "nei", "ther", " ", "work", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "a", " ", "Value", "Error", " ", "to", " ", "be", " ", "handle", "d", " ", "else", "where_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cast_", "in_", "[_", "int_", ",_", "float_", "]_", ":_", "\\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 ", " _", "val_", "=_", "cast_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "next", "\\u", "id_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "IDS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "id_", "=_", "\\u", "IDS_", "._", "get_", "(_", "name_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IDS_", "[_", "name_", "]_", "=_", "current", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "current", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "valid", "\\u", "hostname_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hostname_", "._", "lower_", "(_", ")_", "in_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "host", ".", "locald", "omain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "host", "6", ".", "locald", "omain", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ip6", "-", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "\"", "Host", "name", ":", " ", "%", "s", " ", "is", " ", "local", "\"_", "%_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "hostname_", ")_", ">_", "MAX", "\\u", "HOSTNAME", "\\u", "LEN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "\"", "Host", "name", ":", " ", "%", "s", " ", "is", " ", "too", " ", "long", " ", "(", "max", " ", "length", " ", "is", " ", " ", "%", "s", " ", "character", "s", ")\"_", "%_", "(_", "hostname_", ",_", "MAX", "\\u", "HOSTNAME", "\\u", "LEN_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "VALID", "\\u", "HOSTNAME", "\\u", "RF", "C", "\\u", "1123", "\\u", "PATTERN_", "._", "match_", "(_", "hostname_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "\"", "Host", "name", ":", " ", "%", "s", " ", "is", " ", "not", " ", "compl", "ying", " ", "with", " ", "RF", "C", " ", "1123", "\"_", "%_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "hostname_", "(_", "config_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "canonical", " ", "host", " ", "name", " ", "this", " ", "agent", " ", "shou", "ld", " ", "identify", " ", "as", ".", " ", "Thi", "s", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "authori", "tative", " ", "source", " ", "of", " ", "the", " ", "host", " ", "name", " ", "for", " ", "the", " ", "agent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Trie", "s", ",", " ", "in", " ", "order", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", "agent", " ", "config", " ", "(", "config", ".", "cfg", ",", " ", "\"", "host", "name", ":\"", ")", "\\", "10", ";", " ", " ", "*", " ", "'", "host", "name", " ", "-", "f", "'", " ", "(", "on", " ", "unix", ")", "\\", "10", ";", " ", " ", "*", " ", "socket", ".", "geth", "ost", "name", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", ",", " ", "try", " ", "the", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "config_", "import_", "get", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "get", "\\u", "config_", "(_", "parse", "\\u", "args_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config", "\\u", "hostname_", "=_", "config_", "._", "get_", "(_", "'", "host", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config", "\\u", "hostname_", "and_", "is", "\\u", "valid", "\\u", "hostname_", "(_", "config", "\\u", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "config", "\\u", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Tr", "y", " ", "to", " ", "get", " ", "GC", "E", " ", "instance", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hostname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gce", "\\u", "hostname_", "=_", "GC", "E_", "._", "get", "\\u", "hostname_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gce", "\\u", "hostname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "valid", "\\u", "hostname_", "(_", "gce", "\\u", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gce", "\\u", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "then", " ", "move", " ", "on", " ", "to", " ", "os", "-", "specific", " ", "detection_", "\\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_", "hostname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "get", "\\u", "host", "name", "\\u", "unix", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "fqdn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'/", "bin", "/", "host", "name", "'_", ",_", "'-", "f", "'_", "]_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "err_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "out_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os", "\\u", "name_", "=_", "get", "\\u", "os_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os", "\\u", "name_", "in_", "[_", "'", "mac", "'_", ",_", "'", "freeb", "sd", "'_", ",_", "'", "linux", "'_", ",_", "'", "solar", "is", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unix", "\\u", "hostname_", "=_", "\\u", "get", "\\u", "host", "name", "\\u", "unix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unix", "\\u", "hostname_", "and_", "is", "\\u", "valid", "\\u", "hostname_", "(_", "unix", "\\u", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostname_", "=_", "unix", "\\u", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "have", " ", "an", " ", "ec", "2", " ", "default", " ", "host", "name", ",", " ", "see", " ", "if", " ", "there", "'", "s", " ", "an", " ", "instance", "-", "id", " ", "available_", "\\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_", "hostname_", "is_", "not_", "None_", "and_", "True_", "in_", "[_", "hostname_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "p_", ")_", "for_", "p_", "in_", "[_", "u", "'", "ip", "-'_", ",_", "u", "'", "dom", "u", "'_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "id_", "=_", "EC", "2_", "._", "get", "\\u", "instance", "\\u", "id_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostname_", "=_", "instance", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fall", " ", "back", " ", "on", " ", "socket", ".", "geth", "ost", "name", "()", ",", " ", "socket", ".", "getf", "qd", "n", "()", " ", "is", " ", "too", " ", "unre", "lia", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hostname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "hostname_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "hostname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "socket", "\\u", "hostname_", "and_", "is", "\\u", "valid", "\\u", "hostname_", "(_", "socket", "\\u", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostname_", "=_", "socket", "\\u", "hostname_", "\\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_", "hostname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "critical_", "(_", "'", "Una", "ble", " ", "to", " ", "reliab", "ly", " ", "dete", "rmin", "e", " ", "host", " ", "name", ".", " ", "You", " ", "can", " ", "defin", "e", " ", "one", " ", "in", " ", "config", ".", "cfg", " ", "or", " ", "in", " ", "your", " ", "host", "s", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "Una", "ble", " ", "to", " ", "reliab", "ly", " ", "dete", "rmin", "e", " ", "host", " ", "name", ".", " ", "You", " ", "can", " ", "defin", "e", " ", "one", " ", "in", " ", "config", ".", "cfg", " ", "or", " ", "in", " ", "your", " ", "host", "s", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hostname_", "\\u\\u\\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_", "GC", "E_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "URL_", "=_", "\"", "http", "://", "169", ".2", "54.", "169", ".2", "5", "4", "/", "compute", "Meta", "data", "/", "v1", "/?", "recurs", "ive", "=", "true", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TIMEOUT_", "=_", "0.1_", "#", " ", "second_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "TYPE", "\\u", "NAME_", "=_", "'", "google", " ", "cloud", " ", "platform", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXCLUDE", "D", "\\u", "ATTRIBUTES_", "=_", "[_", "\"", "ssh", "Keys", "\"_", ",_", "\"", "user", "-", "data", "\"_", ",_", "\"", "cli", "-", "cert", "\"_", ",_", "\"", "ipsec", "-", "cert", "\"_", ",_", "\"", "ssl", "-", "cert", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "GC", "E_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "GC", "E_", "._", "metadata_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "GC", "E_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "agent", "Config_", "[_", "'", "collect", "\\u", "instance", "\\u", "metadata", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Insta", "nce", " ", "metadata", " ", "collection", " ", "is", " ", "disable", "d", ".", " ", "Not", " ", "collecti", "ng", " ", "it", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GC", "E_", "._", "metadata_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "GC", "E_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket", "\\u", "to_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "socket_", "._", "getde", "fault", "timeout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "GC", "E_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opener_", "._", "add", "headers_", "=_", "[_", "(_", "'", "X", "-", "Goo", "gle", "-", "Meta", "data", "-", "Request", "'_", ",_", "'", "Tru", "e", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GC", "E_", "._", "metadata_", "=_", "json_", "._", "loads_", "(_", "opener_", "._", "open_", "(_", "GC", "E_", "._", "URL_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GC", "E_", "._", "metadata_", "=_", "{_", "}_", "\\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_", "socket", "\\u", "to_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "socket", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "GC", "E_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "E_", "(_", "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_", "get", "\\u", "tags_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "agent", "Config_", "[_", "'", "collect", "\\u", "instance", "\\u", "metadata", "'_", "]_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "metadata_", "=_", "GC", "E_", "._", "\\u", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "._", "get_", "(_", "'", "attribute", "s", "'_", ",_", "{_", "}_", ")_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "GC", "E_", "._", "EXCLUDE", "D", "\\u", "ATTRIBUTES_", ":_", "\\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_", "tags_", "._", "append_", "(_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tags_", "._", "extend_", "(_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "._", "get_", "(_", "'", "tags", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "zone", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "zone", "'_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "instance", "-", "type", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "machine", "Type", "'_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "internal", "-", "host", "name", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "host", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "instance", "-", "id", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "project", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "project", "'_", "]_", "[_", "'", "project", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "append_", "(_", "'", "numeri", "c\\u", "project", "\\u", "id", ":", "%", "s", "'_", "%_", "host", "\\u", "metadata_", "[_", "'", "project", "'_", "]_", "[_", "'", "numeri", "c", "Project", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GC", "E_", "._", "metadata_", "[_", "'", "host", "name", "'_", "]_", "=_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "host", "name", "'_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "E_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "hostname_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "metadata_", "=_", "GC", "E_", "._", "\\u", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "agent", "Config_", "._", "get_", "(_", "'", "gce", "\\u", "update", "d\\u", "host", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hostname_", "\\u\\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_", "hostname_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "E_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "host", "\\u", "aliases_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "metadata_", "=_", "GC", "E_", "._", "\\u", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "id_", "=_", "host", "\\u", "metadata_", "[_", "'", "project", "'_", "]_", "[_", "'", "project", "Id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "name_", "=_", "host", "\\u", "metadata_", "[_", "'", "instance", "'_", "]_", "[_", "'", "host", "name", "'_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "instance", "\\u", "name_", ",_", "project", "\\u", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EC", "2_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "EC", "2", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EC", "2", "\\u", "METAD", "ATA", "\\u", "HOST_", "=_", "\"", "http", "://", "169", ".2", "54.", "169", ".2", "5", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "METAD", "ATA", "\\u", "URL", "\\u", "BASE_", "=_", "EC", "2", "\\u", "METAD", "ATA", "\\u", "HOST_", "+_", "\"/", "late", "st", "/", "meta", "-", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "IDENTITY", "\\u", "URL_", "=_", "EC", "2", "\\u", "METAD", "ATA", "\\u", "HOST_", "+_", "\"/", "late", "st", "/", "dynami", "c", "/", "instance", "-", "identi", "ty", "/", "document", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TIMEOUT_", "=_", "0.1_", "#", " ", "second_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EC", "2_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "tags_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "agent", "Config_", "[_", "'", "collect", "\\u", "instance", "\\u", "metadata", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Insta", "nce", " ", "metadata", " ", "collection", " ", "is", " ", "disable", "d", ".", " ", "Not", " ", "collecti", "ng", " ", "it", ".\"_", ")_", "\\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_", "socket", "\\u", "to_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "socket_", "._", "getde", "fault", "timeout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "EC", "2_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iam", "\\u", "role_", "=_", "urllib2_", "._", "urlopen_", "(_", "EC", "2_", "._", "METAD", "ATA", "\\u", "URL", "\\u", "BASE_", "+_", "\"/", "iam", "/", "security", "-", "cred", "ential", "s", "/\"_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iam", "\\u", "params_", "=_", "json_", "._", "loads_", "(_", "urllib2_", "._", "urlopen_", "(_", "EC", "2_", "._", "METAD", "ATA", "\\u", "URL", "\\u", "BASE_", "+_", "\"/", "iam", "/", "security", "-", "cred", "ential", "s", "/\"_", "+_", "unicode_", "(_", "iam", "\\u", "role_", ")_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "identity_", "=_", "json_", "._", "loads_", "(_", "urllib2_", "._", "urlopen_", "(_", "EC", "2_", "._", "INSTANCE", "\\u", "IDENTITY", "\\u", "URL_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region_", "=_", "instance", "\\u", "identity_", "[_", "'", "region", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "._", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "boto_", "._", "ec2_", "._", "connect", "\\u", "to", "\\u", "region_", "(_", "region_", ",_", "aws", "\\u", "access", "\\u", "key", "\\u", "id_", "=_", "iam", "\\u", "params_", "[_", "'", "Access", "Key", "Id", "'_", "]_", ",_", "aws", "\\u", "secret", "\\u", "access", "\\u", "key_", "=_", "iam", "\\u", "params_", "[_", "'", "Sec", "ret", "Access", "Key", "'_", "]_", ",_", "security", "\\u", "token_", "=_", "iam", "\\u", "params_", "[_", "'", "Token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "object_", "=_", "connection_", "._", "get", "\\u", "all", "\\u", "tags_", "(_", "{_", "'", "resource", "-", "id", "'_", ":_", "EC", "2_", "._", "metadata_", "[_", "'", "instance", "-", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EC", "2", "\\u", "tags_", "=_", "[_", "u", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "tag_", "._", "name_", ",_", "tag_", "._", "value_", ")_", "for_", "tag_", "in_", "tag", "\\u", "object_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "\"", "Prob", "lem", " ", "retrie", "ving", " ", "custom", " ", "EC", "2", " ", "tags", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EC", "2", "\\u", "tags_", "=_", "[_", "]_", "\\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_", "socket", "\\u", "to_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "socket", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "EC", "2", "\\u", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EC", "2_", "(_", "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_", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "the", " ", "ec", "2", " ", "http", " ", "service", " ", "to", " ", "introspect", " ", "the", " ", "instance", ".", " ", "Thi", "s", " ", "adds", " ", "latenc", "y", " ", "if", " ", "not", " ", "runn", "ing", " ", "on", " ", "EC", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", ">>>", " ", "import", " ", "urllib2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ">>>", " ", "url", "lib", "2", ".", "urlo", "pen", "('", "http", "://", "169", ".2", "54.", "169", ".2", "5", "4", "/", "late", "st", "/'", ",", " ", "timeo", "ut", "=", "1", ").", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "meta", "-", "data", "\\\\", "nus", "er", "-", "data", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ">>>", " ", "url", "lib", "2", ".", "urlo", "pen", "('", "http", "://", "169", ".2", "54.", "169", ".2", "5", "4", "/", "late", "st", "/", "meta", "-", "data", "',", " ", "timeo", "ut", "=", "1", ").", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "ami", "-", "id", "\\\\", "nami", "-", "launch", "-", "index", "\\\\", "nami", "-", "manifest", "-", "path", "\\\\", "nho", "stn", "ame", "\\\\", "nin", "stance", "-", "id", "\\\\", "nlo", "cal", "-", "ipv", "4", "\\\\", "np", "ubli", "c", "-", "keys", "/\\\\", "nre", "serv", "ation", "-", "id", "\\\\", "nsec", "uri", "ty", "-", "group", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ">>>", " ", "url", "lib", "2", ".", "urlo", "pen", "('", "http", "://", "169", ".2", "54.", "169", ".2", "5", "4", "/", "late", "st", "/", "meta", "-", "data", "/", "instance", "-", "id", "',", " ", "timeo", "ut", "=", "1", ").", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "i", "-", "dead", "beef", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Every", " ", "call", " ", "may", " ", "add", " ", "TIME", "OUT", " ", "second", "s", " ", "in", " ", "latenc", "y", " ", "so", " ", "don", "'", "t", " ", "abu", "se", " ", "this", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "2.4", " ", "doe", "s", " ", "not", " ", "support", " ", "an", " ", "explicit", " ", "timeo", "ut", " ", "argu", "ment", " ", "so", " ", "force", " ", "it", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rat", "her", " ", "than", " ", "monkey", "-", "patch", "ing", " ", "url", "lib", "2", ",", " ", "just", " ", "lower", " ", "the", " ", "timeo", "ut", " ", "global", "ly", " ", "for", " ", "these", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "agent", "Config_", "[_", "'", "collect", "\\u", "instance", "\\u", "metadata", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Insta", "nce", " ", "metadata", " ", "collection", " ", "is", " ", "disable", "d", ".", " ", "Not", " ", "collecti", "ng", " ", "it", ".\"_", ")_", "\\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_", "socket", "\\u", "to_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "socket_", "._", "getde", "fault", "timeout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "EC", "2_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", "in_", "(_", "'", "instance", "-", "id", "'_", ",_", "'", "host", "name", "'_", ",_", "'", "local", "-", "host", "name", "'_", ",_", "'", "public", "-", "host", "name", "'_", ",_", "'", "ami", "-", "id", "'_", ",_", "'", "local", "-", "ipv", "4", "'_", ",_", "'", "public", "-", "keys", "/'_", ",_", "'", "public", "-", "ipv", "4", "'_", ",_", "'", "reserva", "tion", "-", "id", "'_", ",_", "'", "security", "-", "group", "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 ", " _", "v_", "=_", "urllib2_", "._", "urlopen_", "(_", "EC", "2_", "._", "METAD", "ATA", "\\u", "URL", "\\u", "BASE_", "+_", "\"/\"_", "+_", "unicode_", "(_", "k_", ")_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "type_", "(_", "v_", ")_", "in_", "(_", "types_", "._", "String", "Type_", ",_", "types_", "._", "Unic", "ode", "Type_", ")_", "and_", "len_", "(_", "v_", ")_", ">_", "0_", ",_", "\"%", "s", " ", "is", " ", "not", " ", "a", " ", "string", "\"_", "%_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EC", "2_", "._", "metadata_", "[_", "k_", "._", "rstrip_", "(_", "'/'_", ")_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "socket", "\\u", "to_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket", "\\u", "to_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket_", "._", "setdefault", "timeout_", "(_", "socket", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "EC", "2_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EC", "2_", "(_", "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_", "get", "\\u", "instance", "\\u", "id_", "(_", "agent", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "EC", "2_", "._", "get", "\\u", "metadata_", "(_", "agent", "Config_", ")_", "._", "get_", "(_", "\"", "instance", "-", "id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Watch", "dog", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Simple", " ", "signal", "-", "based", " ", "watchdog", " ", "tha", "t", " ", "will", " ", "scu", "ttl", "e", " ", "the", " ", "current", " ", "process", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "it", " ", "has", " ", "not", " ", "bee", "n", " ", "reset", " ", "every", " ", "N", " ", "second", "s", ",", " ", "or", " ", "if", " ", "the", " ", "process", "es", " ", "exceed", "s", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "specified", " ", "memory", " ", "threshol", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "only", " ", "be", " ", "invoke", "d", " ", "onc", "e", " ", "per", " ", "process", ",", " ", "so", " ", "don", "'", "t", " ", "use", " ", "with", " ", "multiple", " ", "thread", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "instantiate", " ", "more", " ", "than", " ", "one", ",", " ", "you", "'", "re", " ", "als", "o", " ", "ask", "ing", " ", "for", " ", "trouble", ".", "\\", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Watch", "dog", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "duration_", ",_", "max", "\\u", "mem", "\\u", "mb_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Set", " ", "the", " ", "duration_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "duration_", "=_", "int_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIG", "AL", "RM", "_", ",_", "Watch", "dog", "_", "._", "self", "\\u", "destruct", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cap", " ", "memory", " ", "usage_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max", "\\u", "mem", "\\u", "mb_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "max", "\\u", "mem", "\\u", "kb_", "=_", "1024_", "*_", "max", "\\u", "mem", "\\u", "mb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "mem", "\\u", "bytes_", "=_", "1024_", "*_", "self_", "._", "\\u", "max", "\\u", "mem", "\\u", "kb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "._", "set", "rli", "mit_", "(_", "resource_", "._", "RL", "IM", "IT", "\\u", "AS_", ",_", "(_", "max", "\\u", "mem", "\\u", "bytes_", ",_", "max", "\\u", "mem", "\\u", "bytes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "memory", "\\u", "limit", "\\u", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "memory", "\\u", "limit", "\\u", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Watch", "dog", "_", "(_", "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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "self", "\\u", "destruct", "_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\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_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "error_", "(_", "\"", "Self", "-", "destruct", "ing", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "kill_", "(_", "os_", "._", "getpid_", "(_", ")_", ",_", "signal_", "._", "SIG", "KILL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Watch", "dog", "_", "(_", "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_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", " ", "destruct", " ", "if", " ", "usi", "ng", " ", "too", " ", "muc", "h", " ", "memory", ",", " ", "as", " ", "torn", "ado", " ", "will", " ", "swa", "llow", " ", "Memo", "ry", "Errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "memory", "\\u", "limit", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mem", "\\u", "usage", "\\u", "kb_", "=_", "int_", "(_", "os_", "._", "popen_", "(_", "'", "ps", " ", "-", "p", " ", "%", "d", " ", "-", "o", " ", "%", "s", " ", "|", " ", "tail", " ", "-1", "'_", "%_", "(_", "os_", "._", "getpid_", "(_", ")_", ",_", "'", "rs", "s", "'_", ")_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mem", "\\u", "usage", "\\u", "kb_", ">_", "(_", "0.95_", "*_", "self_", "._", "\\u", "max", "\\u", "mem", "\\u", "kb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Watch", "dog", "_", "._", "self", "\\u", "destruct", "_", "(_", "signal_", "._", "SIG", "KILL", "_", ",_", "sys_", "._", "\\u", "getframe_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Reset", "ting", " ", "watchdog", " ", "for", " ", "%", "d", "\"_", "%_", "self_", "._", "\\u", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "alarm_", "(_", "self_", "._", "\\u", "duration_", ")_", "\\u\\u\\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_", "Lac", "onic", "Filter_", "(_", "logging_", "._", "Filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Filter", "s", " ", "message", "s", ",", " ", "only", " ", "print", " ", "them", " ", "onc", "e", " ", "whi", "le", " ", "keep", "ing", " ", "memory", " ", "under", " ", "control", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LAC", "ONI", "C", "\\u", "MEM", "\\u", "LIMIT_", "=_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Lac", "onic", "Filter_", "(_", "logging_", "._", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "Filter_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hashed", "\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lac", "onic", "Filter_", "(_", "logging_", "._", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hash_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "md5_", "(_", "msg_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lac", "onic", "Filter_", "(_", "logging_", "._", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter_", "(_", "self_", ",_", "record_", ")_", ":_", "\\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 ", " _", "h_", "=_", "self_", "._", "hash_", "(_", "record_", "._", "get", "Message_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "h_", "in_", "self_", "._", "hashed", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "blow", " ", "up", " ", "our", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "hashed", "\\u", "messages_", ")_", ">=_", "Lac", "onic", "Filter_", "._", "LAC", "ONI", "C", "\\u", "MEM", "\\u", "LIMIT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "hashed", "\\u", "messages_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "hashed", "\\u", "messages_", "[_", "h_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Help", "er", " ", "class", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "now_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "started_", "=_", "self_", "._", "\\u", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last_", "=_", "self_", "._", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "step_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "self_", "._", "\\u", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "now_", "-_", "self_", "._", "last_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Timer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "total_", "(_", "self_", ",_", "as", "\\u", "sec_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "now_", "(_", ")_", "-_", "self_", "._", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "chunks_", "(_", "iterable_", ",_", "chunk", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "sequence", "s", " ", "of", " ", "`", "chunk", "\\u", "size", "`", " ", "element", "s", " ", "from", " ", "`", "iterable", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iterable_", "=_", "iter_", "(_", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "=_", "[_", "None_", "]_", "*_", "chunk", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u_", "in_", "range_", "(_", "chunk", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "[_", "count_", "]_", "=_", "iterable_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "chunk_", "[_", ":_", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "chunk_", "[_", ":_", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
dokterbob/satchmo/satchmo/apps/payment/tests.py
[ { "content": " def testLookupURL(self):\n try:\n t = lookup_url(self.dummy, 'test_doesnt_exist')\n self.fail('Should have failed with NoReverseMatch')\n except urlresolvers.NoReverseMatch:\n pass", "metadata": "root.TestModulesSettings.testLookupURL", "header": "['class', 'TestModulesSettings', '(', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_authorize_multiple(self):\n \"\"\"Test making multiple authorization using DUMMY.\"\"\"\n order = make_test_order(self.US, '')\n self.assertEqual(order.balance, order.total)\n self.assertEqual(order.total, Decimal('125.00'))\n\n processor = utils.get_processor_by_key('PAYMENT_DUMMY')\n processor.create_pending_payment(order=order, amount=Decimal('25.00'))\n\n self.assertEqual(order.pendingpayments.count(), 1)\n self.assertEqual(order.payments.count(), 1)\n\n pending = order.pendingpayments.all()[0]\n\n self.assertEqual(pending.amount, Decimal('25.00'))\n processor.prepare_data(order)\n result = processor.authorize_payment()\n self.assertEqual(result.success, True)\n #self.assertEqual(order.authorized_remaining, Decimal('25.00'))\n #self.assertEqual(order.balance, Decimal('100.00'))\n\n processor.create_pending_payment(order=order, amount=Decimal('100.00'))\n result = processor.authorize_payment()\n\n results = processor.capture_authorized_payments()\n self.assertEqual(len(results), 2)\n\n r1 = results[0]\n r2 = results[1]\n self.assertEqual(r1.success, True)\n self.assertEqual(r2.success, True)\n self.assertEqual(order.orderstatus_set.latest().status, 'New')\n self.assertEqual(order.balance, Decimal('0'))", "metadata": "root.TestPaymentHandling.test_authorize_multiple", "header": "['class', 'TestPaymentHandling', '(', 'TestCase', ')', ':', '___EOS___']", "index": 257 }, { "content": " def test_multiple_pending(self):\n \"\"\"Test that creating a second pending payment deletes the first one.\"\"\"\n order = make_test_order(self.US, '')\n self.assertEqual(order.balance, order.total)\n self.assertEqual(order.total, Decimal('125.00'))\n\n processor = utils.get_processor_by_key('PAYMENT_DUMMY')\n pend1 = processor.create_pending_payment(order=order, amount=order.total)\n pend2 = processor.create_pending_payment(order=order, amount=order.total)\n\n self.assertEqual(order.pendingpayments.count(), 1)\n self.assertEqual(order.payments.count(), 1)", "metadata": "root.TestPaymentHandling.test_multiple_pending", "header": "['class', 'TestPaymentHandling', '(', 'TestCase', ')', ':', '___EOS___']", "index": 316 } ]
[ { "span": "t ", "start_line": 72, "start_column": 12, "end_line": 72, "end_column": 13 }, { "span": "result ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 14 }, { "span": "pend1 ", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 13 }, { "span": "pend2 ", "start_line": 324, "start_column": 8, "end_line": 324, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Modul", "es", "Settings_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Look", "up", "URL_", "(_", "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 ", " _", "t_", "=_", "look", "up", "\\u", "url_", "(_", "self_", "._", "dummy_", ",_", "'", "test\\u", "doesnt", "\\u", "exist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "'", "Sho", "ul", "d", " ", "have", " ", "fail", "ed", " ", "with", " ", "No", "Revers", "e", "Match", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urlresolvers_", "._", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Payment", "Hand", "ling_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "authoriz", "e\\u", "multiple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "mak", "ing", " ", "multiple", " ", "authoriz", "ation", " ", "usi", "ng", " ", "DUMMY", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "make", "\\u", "test\\u", "order_", "(_", "self_", "._", "US_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "balance_", ",_", "order_", "._", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "total_", ",_", "Decimal_", "(_", "'", "125", ".00", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "=_", "utils_", "._", "get", "\\u", "process", "or", "\\u", "by", "\\u", "key_", "(_", "'", "PAY", "MENT", "\\u", "DUMMY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "create", "\\u", "pend", "ing", "\\u", "payment_", "(_", "order_", "=_", "order_", ",_", "amount_", "=_", "Decimal_", "(_", "'", "25.0", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "pend", "ing", "payments", "_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "payments", "_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pending_", "=_", "order_", "._", "pend", "ing", "payments", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pending_", "._", "amount_", ",_", "Decimal_", "(_", "'", "25.0", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "prepar", "e\\u", "data_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "processor_", "._", "authoriz", "e\\u", "payment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "success_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "order", ".", "authoriz", "ed", "\\u", "rema", "inin", "g", ",", " ", "Deci", "mal", "('", "25.0", "0", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "order", ".", "balance", ",", " ", "Deci", "mal", "('", "100", ".00", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "._", "create", "\\u", "pend", "ing", "\\u", "payment_", "(_", "order_", "=_", "order_", ",_", "amount_", "=_", "Decimal_", "(_", "'", "100", ".00", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "processor_", "._", "authoriz", "e\\u", "payment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "processor_", "._", "captur", "e\\u", "authoriz", "ed", "\\u", "payments", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "results_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r1_", "=_", "results_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "results_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r1_", "._", "success_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r2_", "._", "success_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "order", "status", "\\u", "set_", "._", "latest_", "(_", ")_", "._", "status_", ",_", "'", "New", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "balance_", ",_", "Decimal_", "(_", "'", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Payment", "Hand", "ling_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "pending_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "creati", "ng", " ", "a", " ", "second", " ", "pend", "ing", " ", "pay", "ment", " ", "delete", "s", " ", "the", " ", "first", " ", "one", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "make", "\\u", "test\\u", "order_", "(_", "self_", "._", "US_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "balance_", ",_", "order_", "._", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "total_", ",_", "Decimal_", "(_", "'", "125", ".00", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "=_", "utils_", "._", "get", "\\u", "process", "or", "\\u", "by", "\\u", "key_", "(_", "'", "PAY", "MENT", "\\u", "DUMMY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "1_", "=_", "processor_", "._", "create", "\\u", "pend", "ing", "\\u", "payment_", "(_", "order_", "=_", "order_", ",_", "amount_", "=_", "order_", "._", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "2_", "=_", "processor_", "._", "create", "\\u", "pend", "ing", "\\u", "payment_", "(_", "order_", "=_", "order_", ",_", "amount_", "=_", "order_", "._", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "pend", "ing", "payments", "_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "order_", "._", "payments", "_", "._", "count_", "(_", ")_", ",_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
HenryHu/pybbs/xmppserver.py
[ { "content": " def __init__(self, rosters, host):\n self.probed = False\n self._closed = False\n self.rosters = rosters\n self._session = None\n\n self.rosters.set_resources(self.get_resources())\n\n self._fixedjid = UCache.UCache.formalize_jid(unicode(self.authJID))\n self._userid = self._fixedjid.partition('@')[0].encode(\"gbk\")\n\n if (not self.rosters.allow_login(self.authJID.bare)):\n Log.warn(\"user %s login denied\" % self._userid)\n# self.unbind_res()\n self.stream_error('policy-violation', 'Login denied. Too many logins?')\n return\n Log.info(\"%s: session start\" % unicode(self.authJID))\n\n if self.authJID.resource[:-8] != \"Resource\" and len(self.authJID.resource) > 8:\n try:\n routes = self.routes(self.authJID.bare)\n for route in routes:\n jid = route[0]\n if jid.resource[:-8] == self.authJID.resource[:-8]:\n if jid.resource != self.authJID.resource:\n # old resource!\n Log.info(\"old jid: %s %r\" % (jid.full, route[1]))\n route[1].stream_error('conflict', 'A new client with the same resource connected')\n else:\n Log.info(\"another me: %s %r\" % (jid.full, route[1]))\n except NoRoute:\n pass\n Log.debug(\"%s: checked for old sessions\" % self.authJID.full)\n\n # Login the user\n self._user = UserManager.UserManager.LoadUser(self._userid)\n if (self._user == None):\n raise Exception(\"How can that be!\")\n self._peer_addr = self.getpeername()\n self._session = Session(self._user, self._peer_addr[0])\n self._session.RecordLogin()\n # insert into global session list!\n self._userinfo = self._session.Register()\n self._loginid = self._session.utmpent\n self._hostname = host\n self.bind(xmpp.ReceivedCloseStream, self.recv_close)\n self.bind(xmpp.StreamClosed, self.stream_closed)\n self.bind(xmpp.SentCloseStream, self.sent_close)\n\n self.rosters.register_conn(self)\n\n msgbox = MsgBox.MsgBox(self._userid)\n if self.rosters.get_xmpp_read(self._user.GetUID()) is None:\n self.rosters.set_xmpp_read(self._user.GetUID(), msgbox.GetMsgCount(all = False) - msgbox.GetUnreadCount())\n self.check_msg()", "metadata": "root.XMPPServer.__init__", "header": "['class', 'XMPPServer', '(', 'xmpp', '.', 'Plugin', ')', ':', '___EOS___']", "index": 28 }, { "content": " @xmpp.stanza('message')\n def message(self, elem):\n \"\"\"Proxy message from one user to another\"\"\"\n\n # so, possible:\n # XMPP user -> Old user\n # XMPP user -> XMPP user => make it like XMPP->old\n\n # Old user -> XMPP user (emulated) => handled elsewhere\n\n to_jid = elem.get('to')\n from_jid = elem.get('from')\n if (from_jid == None):\n return\n\n# self.recv(to_jid, elem)\n\n text_body = None\n for child in elem:\n if (child.tag.endswith('}body')):\n text_body = child.text\n if (text_body == None):\n return\n\n ret = self.rosters.send_msg(from_jid, to_jid, text_body)\n if (ret <= 0):\n Log.warn(\"sendmsg() failed to %s from %s error %d\" % (to_jid, from_jid, ret))\n errors = { \n -1 : \"That user has locked screen, please send later.\",\n -11: \"That user denied your message.\",\n -12: \"That user has too many unread messages. Please send later.\",\n -13: \"User has gone after message sent.\",\n -14: \"User has gone before message sent.\",\n -2 : \"User has gone before message sent.\",\n -21: \"Error when sending message!\"}\n if (ret in errors):\n elem = self.E.message({'from': to_jid,\n 'to': from_jid,\n 'type': 'error'},\n self.E.body(errors[ret]))\n self.recv(from_jid, elem)\n # -2: no perm to see cloak\n # 0: error\n # -1: lockscreen\n # -11: blocked\n # -12: too many messages\n # -13: user gone when notifying\n # -14: user gone before saving\n # -21: error when saving message", "metadata": "root.XMPPServer.message", "header": "['class', 'XMPPServer', '(', 'xmpp', '.', 'Plugin', ')', ':', '___EOS___']", "index": 117 }, { "content": " @xmpp.stanza('presence')\n def presence(self, elem):\n \"\"\"Presence information may be sent out from the client or\n received from another account.\"\"\"\n\n Log.warn(\"handle presence. me: %r elem: %r\" % (self.authJID, elem_to_str(elem)))\n if self.authJID == elem.get('from'):\n if (elem.get('to') == None or (not self.authJID.match_bare(elem.get('to')))):\n return self.send_presence(elem)\n self.recv_presence(elem)", "metadata": "root.XMPPServer.presence", "header": "['class', 'XMPPServer', '(', 'xmpp', '.', 'Plugin', ')', ':', '___EOS___']", "index": 315 }, { "content": " @xmpp.iq('{vcard-temp}vCard')\n def vcard(self, iq):\n \"\"\"vCard support: the client requests its vCard after\n establishing a session.\"\"\"\n\n if iq.get('type') == 'get':\n if (iq.get('to') == None):\n target = iq.get('from')\n else:\n target = iq.get('to')\n\n form_target = UCache.UCache.formalize_jid(target)\n name = form_target.partition('@')[0]\n user = UserManager.UserManager.LoadUser(name)\n info = user.GetInfo()\n desc = '''\\r\nLogins: %d\\r\nPosts: %d\\r\nLast login: %s from %s\\r\nExperience: %d\\r\nPerformance: %d\\r\nLife: %d\\r\n''' % (info['numlogins'], info['numposts'], info['lastlogintime'], \n info['lasthost'], info['exp'], info['perf'], info['life'])\n if ('plan' in info):\n desc += \"Plan:\\r%s\" % (info['plan'].replace('\\n', '\\r\\n'))\n\n vcard = self.E.vCard({'xmlns': 'vcard-temp'},\n self.E('FN', name),\n self.E('NICKNAME', Util.Util.RemoveTags(info['nick'])),\n self.E('DESC', Util.Util.RemoveTags(desc)))\n\n if (iq.get('to') == None):\n return self.iq('result', iq, vcard)\n else:\n return self.iq('result', iq, vcard, {'from': iq.get('to')})", "metadata": "root.XMPPServer.vcard", "header": "['class', 'XMPPServer', '(', 'xmpp', '.', 'Plugin', ')', ':', '___EOS___']", "index": 391 } ]
[ { "span": "self._user == None)", "start_line": 64, "start_column": 12, "end_line": 64, "end_column": 30 }, { "span": "from_jid == None)", "start_line": 129, "start_column": 12, "end_line": 129, "end_column": 28 }, { "span": "text_body == None)", "start_line": 138, "start_column": 12, "end_line": 138, "end_column": 29 }, { "span": "elem.get('to') == None ", "start_line": 322, "start_column": 16, "end_line": 322, "end_column": 38 }, { "span": "iq.get('to') == None)", "start_line": 397, "start_column": 16, "end_line": 397, "end_column": 36 }, { "span": "iq.get('to') == None)", "start_line": 423, "start_column": 16, "end_line": 423, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "XMPP", "Server_", "(_", "xmpp_", "._", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "roster", "s_", ",_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prob", "ed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roster", "s_", "=_", "roster", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "session_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "roster", "s_", "._", "set\\u", "resources_", "(_", "self_", "._", "get", "\\u", "resources_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fixed", "jid_", "=_", "UC", "ache_", "._", "UC", "ache_", "._", "formal", "ize", "\\u", "jid_", "(_", "unicode_", "(_", "self_", "._", "auth", "JID", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "userid_", "=_", "self_", "._", "\\u", "fixed", "jid_", "._", "partition_", "(_", "'@'_", ")_", "[_", "0_", "]_", "._", "encode_", "(_", "\"", "gb", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "roster", "s_", "._", "allow", "\\u", "login_", "(_", "self_", "._", "auth", "JID", "_", "._", "bare", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "warn_", "(_", "\"", "user", " ", "%", "s", " ", "login", " ", "deni", "ed", "\"_", "%_", "self_", "._", "\\u", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "unbind", "\\u", "res", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stream", "\\u", "error_", "(_", "'", "policy", "-", "violation", "'_", ",_", "'", "Logi", "n", " ", "deni", "ed", ".", " ", "Too", " ", "many", " ", "login", "s", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "\"%", "s", ":", " ", "session", " ", "start", "\"_", "%_", "unicode_", "(_", "self_", "._", "auth", "JID", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "auth", "JID", "_", "._", "resource_", "[_", ":_", "-_", "8_", "]_", "!=_", "\"", "Reso", "urc", "e", "\"_", "and_", "len_", "(_", "self_", "._", "auth", "JID", "_", "._", "resource_", ")_", ">_", "8_", ":_", "\\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 ", " _", "routes_", "=_", "self_", "._", "routes_", "(_", "self_", "._", "auth", "JID", "_", "._", "bare", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "route_", "in_", "routes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "jid_", "=_", "route_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "jid_", "._", "resource_", "[_", ":_", "-_", "8_", "]_", "==_", "self_", "._", "auth", "JID", "_", "._", "resource_", "[_", ":_", "-_", "8_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "jid_", "._", "resource_", "!=_", "self_", "._", "auth", "JID", "_", "._", "resource_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "old", " ", "resource", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "\"", "old", " ", "ji", "d", ":", " ", "%", "s", " ", "%", "r", "\"_", "%_", "(_", "jid_", "._", "full_", ",_", "route_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "[_", "1_", "]_", "._", "stream", "\\u", "error_", "(_", "'", "confl", "ict", "'_", ",_", "'", "A", " ", "new", " ", "client", " ", "with", " ", "the", " ", "same", " ", "resource", " ", "connect", "ed", "'_", ")_", "\\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 ", " ", " _", "Log_", "._", "info_", "(_", "\"", "anot", "her", " ", "me", ":", " ", "%", "s", " ", "%", "r", "\"_", "%_", "(_", "jid_", "._", "full_", ",_", "route_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Route_", ":_", "\\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_", "Log_", "._", "debug_", "(_", "\"%", "s", ":", " ", "checke", "d", " ", "for", " ", "old", " ", "session", "s", "\"_", "%_", "self_", "._", "auth", "JID", "_", "._", "full_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Logi", "n", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "user_", "=_", "User", "Manager_", "._", "User", "Manager_", "._", "Load", "User_", "(_", "self_", "._", "\\u", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "user_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Ho", "w", " ", "can", " ", "tha", "t", " ", "be", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "peer", "\\u", "addr_", "=_", "self_", "._", "getp", "eer", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "session_", "=_", "Session_", "(_", "self_", "._", "\\u", "user_", ",_", "self_", "._", "\\u", "peer", "\\u", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "session_", "._", "Record", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "int", "o", " ", "global", " ", "session", " ", "list", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "userinfo_", "=_", "self_", "._", "\\u", "session_", "._", "Register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "login", "id_", "=_", "self_", "._", "\\u", "session_", "._", "utm", "pent", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hostname_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "xmpp_", "._", "Receive", "d", "Clos", "e", "Stream_", ",_", "self_", "._", "recv", "\\u", "close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "xmpp_", "._", "Stream", "Closed_", ",_", "self_", "._", "stream", "\\u", "closed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "xmpp_", "._", "Sent", "Clos", "e", "Stream_", ",_", "self_", "._", "sent", "\\u", "close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "roster", "s_", "._", "register", "\\u", "conn_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msgb", "ox_", "=_", "Msg", "Box_", "._", "Msg", "Box_", "(_", "self_", "._", "\\u", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "roster", "s_", "._", "get", "\\u", "xmpp", "\\u", "read_", "(_", "self_", "._", "\\u", "user_", "._", "Get", "UID_", "(_", ")_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "roster", "s_", "._", "set\\u", "xmpp", "\\u", "read_", "(_", "self_", "._", "\\u", "user_", "._", "Get", "UID_", "(_", ")_", ",_", "msgb", "ox_", "._", "Get", "Msg", "Count_", "(_", "all_", "=_", "False_", ")_", "-_", "msgb", "ox_", "._", "Get", "Unrea", "d", "Count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "check", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XMPP", "Server_", "(_", "xmpp_", "._", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "xmpp_", "._", "stanza_", "(_", "'", "message", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "message_", "(_", "self_", ",_", "elem_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pro", "xy", " ", "message", " ", "from", " ", "one", " ", "user", " ", "to", " ", "anot", "her", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", ",", " ", "possib", "le", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XMPP", " ", "user", " ", "->", " ", "Old", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XMPP", " ", "user", " ", "->", " ", "XMPP", " ", "user", " ", "=>", " ", "make", " ", "it", " ", "like", " ", "XMPP", "->", "old_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Old", " ", "user", " ", "->", " ", "XMPP", " ", "user", " ", "(", "emulate", "d", ")", " ", "=>", " ", "handle", "d", " ", "else", "where_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "jid_", "=_", "elem_", "._", "get_", "(_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "jid_", "=_", "elem_", "._", "get_", "(_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "from", "\\u", "jid_", "==_", "None_", ")_", ":_", "\\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_", "#", " ", " ", " ", "self", ".", "recv", "(", "to", "\\u", "ji", "d", ",", " ", "elem", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text", "\\u", "body_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "elem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "child_", "._", "tag_", "._", "endswith_", "(_", "'}", "body", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "body_", "=_", "child_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "text", "\\u", "body_", "==_", "None_", ")_", ":_", "\\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_", "ret_", "=_", "self_", "._", "roster", "s_", "._", "send", "\\u", "msg_", "(_", "from", "\\u", "jid_", ",_", "to", "\\u", "jid_", ",_", "text", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "ret_", "<=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "warn_", "(_", "\"", "sendm", "sg", "()", " ", "fail", "ed", " ", "to", " ", "%", "s", " ", "from", " ", "%", "s", " ", "error", " ", "%", "d", "\"_", "%_", "(_", "to", "\\u", "jid_", ",_", "from", "\\u", "jid_", ",_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ":_", "\"", "Tha", "t", " ", "user", " ", "has", " ", "lock", "ed", " ", "screen", ",", " ", "plea", "se", " ", "send", " ", "late", "r", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "11_", ":_", "\"", "Tha", "t", " ", "user", " ", "deni", "ed", " ", "your", " ", "message", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "12_", ":_", "\"", "Tha", "t", " ", "user", " ", "has", " ", "too", " ", "many", " ", "unread", " ", "message", "s", ".", " ", "Ple", "ase", " ", "send", " ", "late", "r", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "13_", ":_", "\"", "User", " ", "has", " ", "gone", " ", "after", " ", "message", " ", "sent", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "14_", ":_", "\"", "User", " ", "has", " ", "gone", " ", "bef", "ore", " ", "message", " ", "sent", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "2_", ":_", "\"", "User", " ", "has", " ", "gone", " ", "bef", "ore", " ", "message", " ", "sent", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "21_", ":_", "\"", "Error", " ", "whe", "n", " ", "sendin", "g", " ", "message", "!\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "ret_", "in_", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elem_", "=_", "self_", "._", "E_", "._", "message_", "(_", "{_", "'", "from", "'_", ":_", "to", "\\u", "jid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "'_", ":_", "from", "\\u", "jid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "error", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "E_", "._", "body_", "(_", "errors_", "[_", "ret_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "recv_", "(_", "from", "\\u", "jid_", ",_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-", "2", ":", " ", "no", " ", "perm", " ", "to", " ", "see", " ", "clo", "ak_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0", ":", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-1", ":", " ", "lock", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-1", "1", ":", " ", "blocked_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-1", "2", ":", " ", "too", " ", "many", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-1", "3", ":", " ", "user", " ", "gone", " ", "whe", "n", " ", "notif", "ying", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-1", "4", ":", " ", "user", " ", "gone", " ", "bef", "ore", " ", "saving", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "21", ":", " ", "error", " ", "whe", "n", " ", "saving", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "XMPP", "Server_", "(_", "xmpp_", "._", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "xmpp_", "._", "stanza_", "(_", "'", "presen", "ce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "presence_", "(_", "self_", ",_", "elem_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Presence", " ", "informati", "on", " ", "may", " ", "be", " ", "sent", " ", "out", " ", "from", " ", "the", " ", "client", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "receive", "d", " ", "from", " ", "anot", "her", " ", "account", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Log_", "._", "warn_", "(_", "\"", "handle", " ", "presen", "ce", ".", " ", "me", ":", " ", "%", "r", " ", "elem", ":", " ", "%", "r", "\"_", "%_", "(_", "self_", "._", "auth", "JID", "_", ",_", "elem", "\\u", "to", "\\u", "str_", "(_", "elem_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "auth", "JID", "_", "==_", "elem_", "._", "get_", "(_", "'", "from", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "elem_", "._", "get_", "(_", "'", "to", "'_", ")_", "==_", "None_", "or_", "(_", "not_", "self_", "._", "auth", "JID", "_", "._", "match", "\\u", "bare", "_", "(_", "elem_", "._", "get_", "(_", "'", "to", "'_", ")_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "send", "\\u", "presence_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "recv", "\\u", "presence_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XMPP", "Server_", "(_", "xmpp_", "._", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "xmpp_", "._", "iq_", "(_", "'{", "vcard", "-", "temp", "}", "v", "Card", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "vcard", "_", "(_", "self_", ",_", "iq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "v", "Card", " ", "support", ":", " ", "the", " ", "client", " ", "request", "s", " ", "its", " ", "v", "Card", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "establish", "ing", " ", "a", " ", "session", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "iq_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "get", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "iq_", "._", "get_", "(_", "'", "to", "'_", ")_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "iq_", "._", "get_", "(_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "iq_", "._", "get_", "(_", "'", "to", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "\\u", "target_", "=_", "UC", "ache_", "._", "UC", "ache_", "._", "formal", "ize", "\\u", "jid_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "form", "\\u", "target_", "._", "partition_", "(_", "'@'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User", "Manager_", "._", "User", "Manager_", "._", "Load", "User_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "user_", "._", "Get", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "'''", "\\\\", "r", "\\", "10", ";", "Logi", "ns", ":", " ", "%", "d", "\\\\", "r", "\\", "10", ";", "Posts", ":", " ", "%", "d", "\\\\", "r", "\\", "10", ";", "Las", "t", " ", "login", ":", " ", "%", "s", " ", "from", " ", "%", "s", "\\\\", "r", "\\", "10", ";", "Experience", ":", " ", "%", "d", "\\\\", "r", "\\", "10", ";", "Perform", "anc", "e", ":", " ", "%", "d", "\\\\", "r", "\\", "10", ";", "Life", ":", " ", "%", "d", "\\\\", "r", "\\", "10", ";'", "''_", "%_", "(_", "info_", "[_", "'", "num", "login", "s", "'_", "]_", ",_", "info_", "[_", "'", "nump", "ost", "s", "'_", "]_", ",_", "info_", "[_", "'", "last", "login", "time", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "[_", "'", "last", "host", "'_", "]_", ",_", "info_", "[_", "'", "exp", "'_", "]_", ",_", "info_", "[_", "'", "perf", "'_", "]_", ",_", "info_", "[_", "'", "life", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "plan", "'_", "in_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc_", "+=_", "\"", "Plan", ":\\\\", "r", "%", "s", "\"_", "%_", "(_", "info_", "[_", "'", "plan", "'_", "]_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'\\\\", "r", "\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vcard", "_", "=_", "self_", "._", "E_", "._", "v", "Card_", "(_", "{_", "'", "xml", "ns", "'_", ":_", "'", "vcard", "-", "temp", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "E_", "(_", "'", "FN", "'_", ",_", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "E_", "(_", "'", "NIC", "KN", "AME", "'_", ",_", "Util_", "._", "Util_", "._", "Remove", "Tags_", "(_", "info_", "[_", "'", "nick", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "E_", "(_", "'", "DESC", "'_", ",_", "Util_", "._", "Util_", "._", "Remove", "Tags_", "(_", "desc_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "iq_", "._", "get_", "(_", "'", "to", "'_", ")_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "iq_", "(_", "'", "result", "'_", ",_", "iq_", ",_", "vcard", "_", ")_", "\\u\\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_", "._", "iq_", "(_", "'", "result", "'_", ",_", "iq_", ",_", "vcard", "_", ",_", "{_", "'", "from", "'_", ":_", "iq_", "._", "get_", "(_", "'", "to", "'_", ")_", "}_", ")_", "\\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, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
amrdraz/kodr/app/brython/www/src/Lib/uuid.py
[ { "content": "r\"\"\"UUID objects (universally unique identifiers) according to RFC 4122.\n\nThis module provides immutable UUID objects (class UUID) and the functions\nuuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5\nUUIDs as specified in RFC 4122.\n\nIf all you want is a unique ID, you should probably call uuid1() or uuid4().\nNote that uuid1() may compromise privacy since it creates a UUID containing\nthe computer's network address. uuid4() creates a random UUID.\n\nTypical usage:\n\n >>> import uuid\n\n # make a UUID based on the host ID and current time\n >>> uuid.uuid1() # doctest: +SKIP\n UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n\n # make a UUID using an MD5 hash of a namespace UUID and a name\n >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n\n # make a random UUID\n >>> uuid.uuid4() # doctest: +SKIP\n UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n\n # make a UUID using a SHA-1 hash of a namespace UUID and a name\n >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n\n # make a UUID from a string of hex digits (braces and hyphens ignored)\n >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n\n # convert a UUID to a string of hex digits in standard form\n >>> str(x)\n '00010203-0405-0607-0809-0a0b0c0d0e0f'\n\n # get the raw 16 bytes of the UUID\n >>> x.bytes\n b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n\n # make a UUID from a 16-byte string\n >>> uuid.UUID(bytes=x.bytes)\n UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')\n\"\"\"\n\n__author__ = 'Ka-Ping Yee <ping@zesty.ca>'\n\nRESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE = [\n 'reserved for NCS compatibility', 'specified in RFC 4122',\n 'reserved for Microsoft compatibility', 'reserved for future definition']\n\nint_ = int # The built-in int type\nbytes_ = bytes # The built-in bytes type\n\n\n\n\n\n\n# Thanks to Thomas Heller for ctypes and for his help with its use here.\n\n# If ctypes is available, use it to find system routines for UUID generation.\n# XXX This makes the module non-thread-safe!\n_uuid_generate_random = _uuid_generate_time = _UuidCreate = None\ntry:\n import ctypes, ctypes.util\n\n # The uuid_generate_* routines are provided by libuuid on at least\n # Linux and FreeBSD, and provided by libc on Mac OS X.\n for libname in ['uuid', 'c']:\n try:\n lib = ctypes.CDLL(ctypes.util.find_library(libname))\n except:\n continue\n if hasattr(lib, 'uuid_generate_random'):\n _uuid_generate_random = lib.uuid_generate_random\n if hasattr(lib, 'uuid_generate_time'):\n _uuid_generate_time = lib.uuid_generate_time\n if _uuid_generate_random is not None:\n break # found everything we were looking for\n\n # The uuid_generate_* functions are broken on MacOS X 10.5, as noted\n # in issue #8621 the function generates the same sequence of values\n # in the parent process and all children created using fork (unless\n # those children use exec as well).\n #\n # Assume that the uuid_generate functions are broken from 10.5 onward,\n # the test can be adjusted when a later version is fixed.\n import sys\n if sys.platform == 'darwin':\n import os\n if int(os.uname().release.split('.')[0]) >= 9:\n _uuid_generate_random = _uuid_generate_time = None\n\n # On Windows prior to 2000, UuidCreate gives a UUID containing the\n # hardware address. On Windows 2000 and later, UuidCreate makes a\n # random UUID and UuidCreateSequential gives a UUID containing the\n # hardware address. These routines are provided by the RPC runtime.\n # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last\n # 6 bytes returned by UuidCreateSequential are fixed, they don't appear\n # to bear any relationship to the MAC address of any network device\n # on the box.\n try:\n lib = ctypes.windll.rpcrt4\n except:\n lib = None\n _UuidCreate = getattr(lib, 'UuidCreateSequential',\n getattr(lib, 'UuidCreate', None))\nexcept:\n pass\n\n\n\n\n_node = None\n\n\n_last_timestamp = None\n\n\n\n\n\n# The following standard UUIDs are for use with uuid3() or uuid5().\n\nNAMESPACE_DNS = UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_URL = UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_OID = UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_X500 = UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _ipconfig_getnode():\n \"\"\"Get the hardware address on Windows by running ipconfig.exe.\"\"\"\n import os, re\n dirs = ['', r'c:\\windows\\system32', r'c:\\winnt\\system32']\n try:\n import ctypes\n buffer = ctypes.create_string_buffer(300)\n ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300)\n dirs.insert(0, buffer.value.decode('mbcs'))\n except:\n pass\n #for dir in dirs:\n #try:\n # pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all')\n #except OSError:\n # continue\n #else:\n # for line in pipe:\n # value = line.split(':')[-1].strip().lower()\n # if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):\n # return int(value.replace('-', ''), 16)\n #finally:\n # pipe.close()", "metadata": "root._ipconfig_getnode", "header": "['module', '___EOS___']", "index": 369 }, { "content": "def getnode():\n \"\"\"Get the hardware address as a 48-bit positive integer.\n\n The first time this runs, it may launch a separate program, which could\n be quite slow. If all attempts to obtain the hardware address fail, we\n choose a random 48-bit number with its eighth bit set to 1 as recommended\n in RFC 4122.\n \"\"\"\n\n global _node\n if _node is not None:\n return _node\n\n import sys\n if sys.platform == 'win32':\n getters = [_windll_getnode, _netbios_getnode, _ipconfig_getnode]\n else:\n getters = [_unixdll_getnode, _ifconfig_getnode]\n\n for getter in getters + [_random_getnode]:\n try:\n _node = getter()\n except:\n continue\n if _node is not None:\n return _node", "metadata": "root.getnode", "header": "['module', '___EOS___']", "index": 493 }, { "content": "def uuid4():\n \"\"\"Generate a random UUID.\"\"\"\n\n # When the system provides a version-4 UUID generator, use it.\n if _uuid_generate_random:\n _buffer = ctypes.create_string_buffer(16)\n _uuid_generate_random(_buffer)\n return UUID(bytes=bytes_(_buffer.raw))\n\n # Otherwise, get randomness from urandom or the 'random' module.\n try:\n import os\n return UUID(bytes=os.urandom(16), version=4)\n except:\n import random\n bytes = bytes_(random.randrange(256) for i in range(16))\n return UUID(bytes=bytes, version=4)", "metadata": "root.uuid4", "header": "['module', '___EOS___']", "index": 563 } ]
[ { "span": "except:", "start_line": 435, "start_column": 8, "end_line": 435, "end_column": 15 }, { "span": "except:", "start_line": 467, "start_column": 4, "end_line": 467, "end_column": 11 }, { "span": "except:", "start_line": 471, "start_column": 0, "end_line": 471, "end_column": 7 }, { "span": "except:", "start_line": 378, "start_column": 4, "end_line": 378, "end_column": 11 }, { "span": "except:", "start_line": 515, "start_column": 8, "end_line": 515, "end_column": 15 }, { "span": "except:", "start_line": 576, "start_column": 4, "end_line": 576, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "r", "\"\"\"", "UU", "ID", " ", "object", "s", " ", "(", "universal", "ly", " ", "unique", " ", "identifi", "ers", ")", " ", "according", " ", "to", " ", "RF", "C", " ", "412", "2", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "immutable", " ", "UU", "ID", " ", "object", "s", " ", "(", "class", " ", "UU", "ID", ")", " ", "and", " ", "the", " ", "function", "s", "\\", "10", ";", "uuid", "1", "()", ",", " ", "uuid", "3", "()", ",", " ", "uuid", "4", "()", ",", " ", "uuid", "5", "()", " ", "for", " ", "generat", "ing", " ", "version", " ", "1", ",", " ", "3", ",", " ", "4", ",", " ", "and", " ", "5", "\\", "10", ";", "UU", "ID", "s", " ", "as", " ", "specified", " ", "in", " ", "RF", "C", " ", "412", "2", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "all", " ", "you", " ", "want", " ", "is", " ", "a", " ", "unique", " ", "ID", ",", " ", "you", " ", "shou", "ld", " ", "probab", "ly", " ", "call", " ", "uuid", "1", "()", " ", "or", " ", "uuid", "4", "()", ".", "\\", "10", ";", "Not", "e", " ", "tha", "t", " ", "uuid", "1", "()", " ", "may", " ", "compr", "omi", "se", " ", "privacy", " ", "sinc", "e", " ", "it", " ", "create", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", "\\", "10", ";", "the", " ", "computer", "'", "s", " ", "network", " ", "address", ".", " ", " ", "uuid", "4", "()", " ", "create", "s", " ", "a", " ", "random", " ", "UU", "ID", ".", "\\", "10", ";", "\\", "10", ";", "Typical", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "uuid", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "based", " ", "on", " ", "the", " ", "host", " ", "ID", " ", "and", " ", "current", " ", "time", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "1", "()", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "a8", "098", "c1", "a", "-", "f8", "6e", "-1", "1d", "a", "-", "bd", "1a", "-0", "011", "244", "4b", "e1", "e", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "usi", "ng", " ", "an", " ", "MD", "5", " ", "hash", " ", "of", " ", "a", " ", "namespace", " ", "UU", "ID", " ", "and", " ", "a", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "3", "(", "uuid", ".", "NAMESPACE", "\\u", "DNS", ",", " ", "'", "python", ".", "org", "')", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "6f", "a4", "5", "9e", "a", "-", "ee", "8a", "-", "3c", "a4", "-", "894", "e-", "db", "7", "7e", "160", "355", "e", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "random", " ", "UU", "ID", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "4", "()", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "16", "fd", "270", "6", "-", "8b", "af", "-", "433", "b", "-", "8", "2e", "b", "-", "8c", "7f", "ada", "847", "da", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "usi", "ng", " ", "a", " ", "SHA", "-1", " ", "hash", " ", "of", " ", "a", " ", "namespace", " ", "UU", "ID", " ", "and", " ", "a", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "5", "(", "uuid", ".", "NAMESPACE", "\\u", "DNS", ",", " ", "'", "python", ".", "org", "')", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "886", "313", "e1", "-", "3b", "8a", "-", "537", "2", "-", "9", "b9", "0", "-0", "c9", "ae", "e1", "9", "9e", "5d", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "from", " ", "a", " ", "string", " ", "of", " ", "hex", " ", "digit", "s", " ", "(", "braces", " ", "and", " ", "hyphen", "s", " ", "ignore", "d", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "uuid", ".", "UU", "ID", "('{", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "}')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "convert", " ", "a", " ", "UU", "ID", " ", "to", " ", "a", " ", "string", " ", "of", " ", "hex", " ", "digit", "s", " ", "in", " ", "standard", " ", "form", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "str", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "get", " ", "the", " ", "raw", " ", "16", " ", "bytes", " ", "of", " ", "the", " ", "UU", "ID", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ".", "bytes", "\\", "10", ";", " ", " ", " ", " ", "b", "'\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "\\\\", "x0", "8", "\\\\", "t", "\\\\", "n", "\\\\", "x0", "b", "\\\\", "x0", "c", "\\\\", "r", "\\\\", "x0", "e", "\\\\", "x0", "f", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "from", " ", "a", " ", "16", "-", "byte", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "UU", "ID", "(", "bytes", "=", "x", ".", "bytes", ")", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "')", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Ka", "-", "Ping", " ", "Ye", "e", " ", "<", "ping", "@", "zes", "ty", ".", "ca", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RESERVED", "\\u", "NC", "S_", ",_", "RF", "C", "\\u", "412", "2_", ",_", "RESERVED", "\\u", "MICRO", "SOFT", "_", ",_", "RESERVED", "\\u", "FUT", "URE_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d", " ", "for", " ", "NC", "S", " ", "compatibility", "'_", ",_", "'", "specified", " ", "in", " ", "RF", "C", " ", "412", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d", " ", "for", " ", "Micro", "soft", " ", "compatibility", "'_", ",_", "'", "reserve", "d", " ", "for", " ", "future", " ", "definit", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "int\\u", "_", "=_", "int_", "#", " ", "The", " ", "bui", "lt", "-", "in", " ", "int", " ", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "\\u_", "=_", "bytes_", "#", " ", "The", " ", "bui", "lt", "-", "in", " ", "bytes", " ", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", " ", "to", " ", "Tho", "mas", " ", "Hell", "er", " ", "for", " ", "ctype", "s", " ", "and", " ", "for", " ", "his", " ", "help", " ", "with", " ", "its", " ", "use", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "ctype", "s", " ", "is", " ", "avail", "able", ",", " ", "use", " ", "it", " ", "to", " ", "find", " ", "system", " ", "routin", "es", " ", "for", " ", "UU", "ID", " ", "generat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "Thi", "s", " ", "make", "s", " ", "the", " ", "module", " ", "non", "-", "thread", "-", "safe", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "\\u", "Uu", "id", "Create_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", ",_", "ctypes_", "._", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "uuid", "\\u", "generat", "e\\u", "*", " ", "routin", "es", " ", "are", " ", "provided", " ", "by", " ", "lib", "uuid", " ", "on", " ", "at", " ", "leas", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lin", "ux", " ", "and", " ", "Free", "BS", "D", ",", " ", "and", " ", "provided", " ", "by", " ", "libc", " ", "on", " ", "Mac", " ", "OS", " ", "X", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "libname", "_", "in_", "[_", "'", "uuid", "'_", ",_", "'", "c", "'_", "]_", ":_", "\\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 ", " _", "lib_", "=_", "ctypes_", "._", "CD", "LL_", "(_", "ctypes_", "._", "util_", "._", "find", "\\u", "library_", "(_", "libname", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "lib_", ",_", "'", "uuid", "\\u", "generat", "e\\u", "random", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "lib_", "._", "uuid", "\\u", "generat", "e\\u", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "lib_", ",_", "'", "uuid", "\\u", "generat", "e\\u", "time", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "lib_", "._", "uuid", "\\u", "generat", "e\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "#", " ", "found", " ", "every", "thing", " ", "we", " ", "wer", "e", " ", "look", "ing", " ", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "uuid", "\\u", "generat", "e\\u", "*", " ", "function", "s", " ", "are", " ", "broken", " ", "on", " ", "Mac", "OS", " ", "X", " ", "10.5", ",", " ", "as", " ", "note", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "issue", " ", "#", "862", "1", " ", "the", " ", "function", " ", "generat", "es", " ", "the", " ", "same", " ", "sequence", " ", "of", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "parent", " ", "process", " ", "and", " ", "all", " ", "child", "ren", " ", "created", " ", "usi", "ng", " ", "fork", " ", "(", "unl", "ess_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tho", "se", " ", "child", "ren", " ", "use", " ", "exec", " ", "as", " ", "well", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assume", " ", "tha", "t", " ", "the", " ", "uuid", "\\u", "generat", "e", " ", "function", "s", " ", "are", " ", "broken", " ", "from", " ", "10.5", " ", "on", "ward", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "test", " ", "can", " ", "be", " ", "adjusted", " ", "whe", "n", " ", "a", " ", "late", "r", " ", "version", " ", "is", " ", "fixed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "os_", "._", "uname_", "(_", ")_", "._", "release_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", ")_", ">=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "Window", "s", " ", "prior", " ", "to", " ", "2000", ",", " ", "Uu", "id", "Creat", "e", " ", "give", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", "ware", " ", "address", ".", " ", " ", "On", " ", "Window", "s", " ", "2000", " ", "and", " ", "late", "r", ",", " ", "Uu", "id", "Creat", "e", " ", "make", "s", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "random", " ", "UU", "ID", " ", "and", " ", "Uu", "id", "Creat", "e", "Sequ", "ential", " ", "give", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", "ware", " ", "address", ".", " ", " ", "The", "se", " ", "routin", "es", " ", "are", " ", "provided", " ", "by", " ", "the", " ", "RP", "C", " ", "runt", "ime", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", " ", "at", " ", "leas", "t", " ", "on", " ", "Tim", "'", "s", " ", "Win", "XP", " ", "Pro", " ", "SP", "2", " ", "desk", "top", " ", "box", ",", " ", "whi", "le", " ", "the", " ", "last_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "6", " ", "bytes", " ", "return", "ed", " ", "by", " ", "Uu", "id", "Creat", "e", "Sequ", "ential", " ", "are", " ", "fixed", ",", " ", "the", "y", " ", "don", "'", "t", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "bear", " ", "any", " ", "relation", "ship", " ", "to", " ", "the", " ", "MAC", " ", "address", " ", "of", " ", "any", " ", "network", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "box", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib_", "=_", "ctypes_", "._", "windll_", "._", "rpc", "rt", "4_", "\\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 ", " _", "lib_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Uu", "id", "Create_", "=_", "getattr_", "(_", "lib_", ",_", "'", "Uu", "id", "Creat", "e", "Sequ", "ential", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "lib_", ",_", "'", "Uu", "id", "Creat", "e", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "node_", "=_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "last", "\\u", "timestamp_", "=_", "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_", "#", " ", "The", " ", "follow", "ing", " ", "standard", " ", "UU", "ID", "s", " ", "are", " ", "for", " ", "use", " ", "with", " ", "uuid", "3", "()", " ", "or", " ", "uuid", "5", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NAMESPACE", "\\u", "DNS", "_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "10", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "URL_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "11", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "OID_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "1", "2", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "X", "500_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "14", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ipc", "onfi", "g", "\\u", "getn", "ode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "hard", "ware", " ", "address", " ", "on", " ", "Window", "s", " ", "by", " ", "runn", "ing", " ", "ipc", "onfi", "g", ".", "exe", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "=_", "[_", "''_", ",_", "r", "'", "c", ":\\\\", "windows", "\\\\", "system", "32", "'_", ",_", "r", "'", "c", ":\\\\", "win", "nt", "\\\\", "system", "32", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "=_", "ctypes_", "._", "create", "\\u", "string", "\\u", "buffer_", "(_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctypes_", "._", "windll_", "._", "kernel32_", "._", "Get", "System", "Director", "y", "A_", "(_", "buffer_", ",_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "insert_", "(_", "0_", ",_", "buffer_", "._", "value_", "._", "decode_", "(_", "'", "mb", "cs", "'_", ")_", ")_", "\\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_", "#", "for", " ", "dir", " ", "in", " ", "dirs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pipe", " ", "=", " ", "os", ".", "popen", "(", "os", ".", "path", ".", "join", "(", "dir", ",", " ", "'", "ipc", "onfi", "g", "')", " ", "+", " ", "'", " ", "/", "all", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "OSE", "rror", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "line", " ", "in", " ", "pipe", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "value", " ", "=", " ", "line", ".", "split", "('", ":'", ")[", "-1", "].", "strip", "()", ".", "lower", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "re", ".", "match", "('", "([", "0", "-", "9", "a", "-", "f", "][", "0", "-", "9", "a", "-", "f", "]-", "){", "5", "}[", "0", "-", "9", "a", "-", "f", "][", "0", "-", "9", "a", "-", "f", "]'", ",", " ", "value", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "int", "(", "value", ".", "replace", "('", "-'", ",", " ", "''", "),", " ", "16", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "final", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pipe", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "getn", "ode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "hard", "ware", " ", "address", " ", "as", " ", "a", " ", "4", "8", "-", "bit", " ", "posit", "ive", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "time", " ", "this", " ", "runs", ",", " ", "it", " ", "may", " ", "launch", " ", "a", " ", "separate", " ", "program", ",", " ", "whi", "ch", " ", "coul", "d", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "quite", " ", "slow", ".", " ", " ", "If", " ", "all", " ", "atte", "mpt", "s", " ", "to", " ", "obtain", " ", "the", " ", "hard", "ware", " ", "address", " ", "fail", ",", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "choose", " ", "a", " ", "random", " ", "4", "8", "-", "bit", " ", "number", " ", "with", " ", "its", " ", "eight", "h", " ", "bit", " ", "set", " ", "to", " ", "1", " ", "as", " ", "recommende", "d", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "RF", "C", " ", "412", "2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "s_", "=_", "[_", "\\u", "wind", "ll", "\\u", "getn", "ode_", ",_", "\\u", "netb", "ios", "\\u", "getn", "ode_", ",_", "\\u", "ipc", "onfi", "g", "\\u", "getn", "ode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "s_", "=_", "[_", "\\u", "unix", "dll", "\\u", "getn", "ode_", ",_", "\\u", "ifconfig", "\\u", "getn", "ode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "getter_", "in_", "getter", "s_", "+_", "[_", "\\u", "random", "\\u", "getn", "ode_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "node_", "=_", "getter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uuid4_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "random", " ", "UU", "ID", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "system", " ", "provide", "s", " ", "a", " ", "version", "-", "4", " ", "UU", "ID", " ", "generat", "or", ",", " ", "use", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "buffer_", "=_", "ctypes_", "._", "create", "\\u", "string", "\\u", "buffer_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "(_", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "UUID_", "(_", "bytes_", "=_", "bytes", "\\u_", "(_", "\\u", "buffer_", "._", "raw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "get", " ", "random", "ness", " ", "from", " ", "uran", "dom", " ", "or", " ", "the", " ", "'", "random", "'", " ", "module", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "UUID_", "(_", "bytes_", "=_", "os_", "._", "urandom_", "(_", "16_", ")_", ",_", "version_", "=_", "4_", ")_", "\\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 ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "byt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precise assert
OpenMDAO/OpenMDAO-Framework/openmdao.util/src/openmdao/util/test/test_fileutil.py
[ { "content": " def test_find_in_path(self):\n if sys.platform == 'win32':\n path = r'C:\\a\\b\\c;d1;d1\\d1d1;d1\\d1d2'\n else:\n path = '/a/b/c:d1:d1/d1d1:d1/d1d2'\n fname = find_in_path('bar', path)\n self.assertEqual(fname, None)\n # search for a file with an extension\n fname = find_in_path('d1d1f1', path, exts=('.exe',))\n self.assertTrue(fname is not None)\n self.assertEqual(os.path.basename(fname), 'd1d1f1.exe')\n # search for a file without an extension\n fname = find_in_path('d1d2f2', path)\n self.assertTrue(fname is not None)\n self.assertEqual(os.path.basename(fname), 'd1d2f2')\n # make sure we don't find directories\n fname = find_in_path('d1d2', path)\n self.assertEqual(fname, None)", "metadata": "root.FileUtilTestCase.test_find_in_path", "header": "['class', 'FileUtilTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 } ]
[ { "span": "self.assertTrue(fname is not None)", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 42 }, { "span": "self.assertTrue(fname is not None)", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "File", "Ut", "il", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "in", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "r", "'", "C", ":\\\\", "a", "\\\\", "b", "\\\\", "c", ";", "d1", ";", "d1", "\\\\", "d1", "d1", ";", "d1", "\\\\", "d1", "d2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "'/", "a", "/", "b", "/", "c", ":", "d1", ":", "d1", "/", "d1", "d1", ":", "d1", "/", "d1", "d2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname_", "=_", "find", "\\u", "in", "\\u", "path_", "(_", "'", "bar", "'_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fname_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "search", " ", "for", " ", "a", " ", "file", " ", "with", " ", "an", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", "=_", "find", "\\u", "in", "\\u", "path_", "(_", "'", "d1", "d1", "f1", "'_", ",_", "path_", ",_", "exts_", "=_", "(_", "'.", "exe", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fname_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "fname_", ")_", ",_", "'", "d1", "d1", "f1", ".", "exe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "search", " ", "for", " ", "a", " ", "file", " ", "with", "out", " ", "an", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", "=_", "find", "\\u", "in", "\\u", "path_", "(_", "'", "d1", "d2", "f2", "'_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fname_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "fname_", ")_", ",_", "'", "d1", "d2", "f2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "don", "'", "t", " ", "find", " ", "directories_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", "=_", "find", "\\u", "in", "\\u", "path_", "(_", "'", "d1", "d2", "'_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fname_", ",_", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
'import *' may pollute namespace
ardekantur/pyglet/pyglet/media/drivers/openal/lib_openal.py
[ { "content": "# ----------------------------------------------------------------------------\n# pyglet\n# Copyright (c) 2006-2008 Alex Holkner\n# All rights reserved.\n# \n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions \n# are met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of pyglet nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 OWNER 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.\n# ----------------------------------------------------------------------------\n'''Wrapper for openal\n\nGenerated with:\n../tools/wraptypes/wrap.py /usr/include/AL/al.h -lopenal -olib_openal.py\n\n.. Hacked to remove non-existent library functions.\n\nTODO add alGetError check.\n\n.. alListener3i and alListeneriv are present in my OS X 10.4 but not another\n10.4 user's installation. They've also been removed for compatibility.\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nimport ctypes\nfrom ctypes import *\nimport sys\n\nimport pyglet.lib\n\n_lib = pyglet.lib.load_library('openal', win32='openal32',\n framework='/System/Library/Frameworks/OpenAL.framework')\n\n_int_types = (c_int16, c_int32)\nif hasattr(ctypes, 'c_int64'):\n # Some builds of ctypes apparently do not have c_int64\n # defined; it's a pretty good bet that these builds do not\n # have 64-bit pointers.\n _int_types += (ctypes.c_int64,)\nfor t in _int_types:\n if sizeof(t) == sizeof(c_size_t):\n c_ptrdiff_t = t\n\n\n\n\nAL_API = 0 \t# /usr/include/AL/al.h:39\nALAPI = 0 \t# /usr/include/AL/al.h:59\nAL_INVALID = -1 \t# /usr/include/AL/al.h:61\nAL_ILLEGAL_ENUM = 0 \t# /usr/include/AL/al.h:62\nAL_ILLEGAL_COMMAND = 0 \t# /usr/include/AL/al.h:63\nALboolean = c_int \t# Better return type than c_char, as generated\nALchar = c_char \t# /usr/include/AL/al.h:73\nALbyte = c_char \t# /usr/include/AL/al.h:76\nALubyte = c_ubyte \t# /usr/include/AL/al.h:79\nALshort = c_short \t# /usr/include/AL/al.h:82\nALushort = c_ushort \t# /usr/include/AL/al.h:85\nALint = c_int \t# /usr/include/AL/al.h:88\nALuint = c_uint \t# /usr/include/AL/al.h:91\nALsizei = c_int \t# /usr/include/AL/al.h:94\nALenum = c_int \t# /usr/include/AL/al.h:97\nALfloat = c_float \t# /usr/include/AL/al.h:100\nALdouble = c_double \t# /usr/include/AL/al.h:103\nALvoid = None \t# /usr/include/AL/al.h:106\nAL_NONE = 0 \t# /usr/include/AL/al.h:112\nAL_FALSE = 0 \t# /usr/include/AL/al.h:115\nAL_TRUE = 1 \t# /usr/include/AL/al.h:118\nAL_SOURCE_RELATIVE = 514 \t# /usr/include/AL/al.h:121\nAL_CONE_INNER_ANGLE = 4097 \t# /usr/include/AL/al.h:130\nAL_CONE_OUTER_ANGLE = 4098 \t# /usr/include/AL/al.h:137\nAL_PITCH = 4099 \t# /usr/include/AL/al.h:145\nAL_POSITION = 4100 \t# /usr/include/AL/al.h:157\nAL_DIRECTION = 4101 \t# /usr/include/AL/al.h:160\nAL_VELOCITY = 4102 \t# /usr/include/AL/al.h:163\nAL_LOOPING = 4103 \t# /usr/include/AL/al.h:171\nAL_BUFFER = 4105 \t# /usr/include/AL/al.h:178\nAL_GAIN = 4106 \t# /usr/include/AL/al.h:191\nAL_MIN_GAIN = 4109 \t# /usr/include/AL/al.h:200\nAL_MAX_GAIN = 4110 \t# /usr/include/AL/al.h:209\nAL_ORIENTATION = 4111 \t# /usr/include/AL/al.h:216\nAL_SOURCE_STATE = 4112 \t# /usr/include/AL/al.h:221\nAL_INITIAL = 4113 \t# /usr/include/AL/al.h:222\nAL_PLAYING = 4114 \t# /usr/include/AL/al.h:223\nAL_PAUSED = 4115 \t# /usr/include/AL/al.h:224\nAL_STOPPED = 4116 \t# /usr/include/AL/al.h:225\nAL_BUFFERS_QUEUED = 4117 \t# /usr/include/AL/al.h:230\nAL_BUFFERS_PROCESSED = 4118 \t# /usr/include/AL/al.h:231\nAL_SEC_OFFSET = 4132 \t# /usr/include/AL/al.h:236\nAL_SAMPLE_OFFSET = 4133 \t# /usr/include/AL/al.h:237\nAL_BYTE_OFFSET = 4134 \t# /usr/include/AL/al.h:238\nAL_SOURCE_TYPE = 4135 \t# /usr/include/AL/al.h:246\nAL_STATIC = 4136 \t# /usr/include/AL/al.h:247\nAL_STREAMING = 4137 \t# /usr/include/AL/al.h:248\nAL_UNDETERMINED = 4144 \t# /usr/include/AL/al.h:249\nAL_FORMAT_MONO8 = 4352 \t# /usr/include/AL/al.h:252\nAL_FORMAT_MONO16 = 4353 \t# /usr/include/AL/al.h:253\nAL_FORMAT_STEREO8 = 4354 \t# /usr/include/AL/al.h:254\nAL_FORMAT_STEREO16 = 4355 \t# /usr/include/AL/al.h:255\nAL_REFERENCE_DISTANCE = 4128 \t# /usr/include/AL/al.h:265\nAL_ROLLOFF_FACTOR = 4129 \t# /usr/include/AL/al.h:273\nAL_CONE_OUTER_GAIN = 4130 \t# /usr/include/AL/al.h:282\nAL_MAX_DISTANCE = 4131 \t# /usr/include/AL/al.h:292\nAL_FREQUENCY = 8193 \t# /usr/include/AL/al.h:300\nAL_BITS = 8194 \t# /usr/include/AL/al.h:301\nAL_CHANNELS = 8195 \t# /usr/include/AL/al.h:302\nAL_SIZE = 8196 \t# /usr/include/AL/al.h:303\nAL_UNUSED = 8208 \t# /usr/include/AL/al.h:310\nAL_PENDING = 8209 \t# /usr/include/AL/al.h:311\nAL_PROCESSED = 8210 \t# /usr/include/AL/al.h:312\nAL_NO_ERROR = 0 \t# /usr/include/AL/al.h:316\nAL_INVALID_NAME = 40961 \t# /usr/include/AL/al.h:321\nAL_INVALID_ENUM = 40962 \t# /usr/include/AL/al.h:326\nAL_INVALID_VALUE = 40963 \t# /usr/include/AL/al.h:331\nAL_INVALID_OPERATION = 40964 \t# /usr/include/AL/al.h:336\nAL_OUT_OF_MEMORY = 40965 \t# /usr/include/AL/al.h:342\nAL_VENDOR = 45057 \t# /usr/include/AL/al.h:346\nAL_VERSION = 45058 \t# /usr/include/AL/al.h:347\nAL_RENDERER = 45059 \t# /usr/include/AL/al.h:348\nAL_EXTENSIONS = 45060 \t# /usr/include/AL/al.h:349\nAL_DOPPLER_FACTOR = 49152 \t# /usr/include/AL/al.h:356\nAL_DOPPLER_VELOCITY = 49153 \t# /usr/include/AL/al.h:361\nAL_SPEED_OF_SOUND = 49155 \t# /usr/include/AL/al.h:366\nAL_DISTANCE_MODEL = 53248 \t# /usr/include/AL/al.h:375\nAL_INVERSE_DISTANCE = 53249 \t# /usr/include/AL/al.h:376\nAL_INVERSE_DISTANCE_CLAMPED = 53250 \t# /usr/include/AL/al.h:377\nAL_LINEAR_DISTANCE = 53251 \t# /usr/include/AL/al.h:378\nAL_LINEAR_DISTANCE_CLAMPED = 53252 \t# /usr/include/AL/al.h:379\nAL_EXPONENT_DISTANCE = 53253 \t# /usr/include/AL/al.h:380\nAL_EXPONENT_DISTANCE_CLAMPED = 53254 \t# /usr/include/AL/al.h:381\n# /usr/include/AL/al.h:386\nalEnable = _lib.alEnable\nalEnable.restype = None\nalEnable.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:388\nalDisable = _lib.alDisable\nalDisable.restype = None\nalDisable.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:390\nalIsEnabled = _lib.alIsEnabled\nalIsEnabled.restype = ALboolean\nalIsEnabled.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:396\nalGetString = _lib.alGetString\nalGetString.restype = POINTER(ALchar)\nalGetString.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:398\nalGetBooleanv = _lib.alGetBooleanv\nalGetBooleanv.restype = None\nalGetBooleanv.argtypes = [ALenum, POINTER(ALboolean)]\n\n# /usr/include/AL/al.h:400\nalGetIntegerv = _lib.alGetIntegerv\nalGetIntegerv.restype = None\nalGetIntegerv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:402\nalGetFloatv = _lib.alGetFloatv\nalGetFloatv.restype = None\nalGetFloatv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:404\nalGetDoublev = _lib.alGetDoublev\nalGetDoublev.restype = None\nalGetDoublev.argtypes = [ALenum, POINTER(ALdouble)]\n\n# /usr/include/AL/al.h:406\nalGetBoolean = _lib.alGetBoolean\nalGetBoolean.restype = ALboolean\nalGetBoolean.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:408\nalGetInteger = _lib.alGetInteger\nalGetInteger.restype = ALint\nalGetInteger.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:410\nalGetFloat = _lib.alGetFloat\nalGetFloat.restype = ALfloat\nalGetFloat.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:412\nalGetDouble = _lib.alGetDouble\nalGetDouble.restype = ALdouble\nalGetDouble.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:419\nalGetError = _lib.alGetError\nalGetError.restype = ALenum\nalGetError.argtypes = []\n\n# /usr/include/AL/al.h:427\nalIsExtensionPresent = _lib.alIsExtensionPresent\nalIsExtensionPresent.restype = ALboolean\nalIsExtensionPresent.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:429\nalGetProcAddress = _lib.alGetProcAddress\nalGetProcAddress.restype = POINTER(c_void)\nalGetProcAddress.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:431\nalGetEnumValue = _lib.alGetEnumValue\nalGetEnumValue.restype = ALenum\nalGetEnumValue.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:450\nalListenerf = _lib.alListenerf\nalListenerf.restype = None\nalListenerf.argtypes = [ALenum, ALfloat]\n\n# /usr/include/AL/al.h:452\nalListener3f = _lib.alListener3f\nalListener3f.restype = None\nalListener3f.argtypes = [ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:454\nalListenerfv = _lib.alListenerfv\nalListenerfv.restype = None\nalListenerfv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:456\nalListeneri = _lib.alListeneri\nalListeneri.restype = None\nalListeneri.argtypes = [ALenum, ALint]\n\n# /usr/include/AL/al.h:458\n#alListener3i = _lib.alListener3i\n#alListener3i.restype = None\n#alListener3i.argtypes = [ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:460\n#alListeneriv = _lib.alListeneriv\n#alListeneriv.restype = None\n#alListeneriv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:465\nalGetListenerf = _lib.alGetListenerf\nalGetListenerf.restype = None\nalGetListenerf.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:467\nalGetListener3f = _lib.alGetListener3f\nalGetListener3f.restype = None\nalGetListener3f.argtypes = [ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:469\nalGetListenerfv = _lib.alGetListenerfv\nalGetListenerfv.restype = None\nalGetListenerfv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:471\nalGetListeneri = _lib.alGetListeneri\nalGetListeneri.restype = None\nalGetListeneri.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:473\nalGetListener3i = _lib.alGetListener3i\nalGetListener3i.restype = None\nalGetListener3i.argtypes = [ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:475\nalGetListeneriv = _lib.alGetListeneriv\nalGetListeneriv.restype = None\nalGetListeneriv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:512\nalGenSources = _lib.alGenSources\nalGenSources.restype = None\nalGenSources.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:515\nalDeleteSources = _lib.alDeleteSources\nalDeleteSources.restype = None\nalDeleteSources.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:518\nalIsSource = _lib.alIsSource\nalIsSource.restype = ALboolean\nalIsSource.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:523\nalSourcef = _lib.alSourcef\nalSourcef.restype = None\nalSourcef.argtypes = [ALuint, ALenum, ALfloat]\n\n# /usr/include/AL/al.h:525\nalSource3f = _lib.alSource3f\nalSource3f.restype = None\nalSource3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:527\nalSourcefv = _lib.alSourcefv\nalSourcefv.restype = None\nalSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:529\nalSourcei = _lib.alSourcei\nalSourcei.restype = None\nalSourcei.argtypes = [ALuint, ALenum, ALint]\n\n# /usr/include/AL/al.h:531\n#alSource3i = _lib.alSource3i\n#alSource3i.restype = None\n#alSource3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:533\n#alSourceiv = _lib.alSourceiv\n#alSourceiv.restype = None\n#alSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:538\nalGetSourcef = _lib.alGetSourcef\nalGetSourcef.restype = None\nalGetSourcef.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:540\nalGetSource3f = _lib.alGetSource3f\nalGetSource3f.restype = None\nalGetSource3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:542\nalGetSourcefv = _lib.alGetSourcefv\nalGetSourcefv.restype = None\nalGetSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:544\nalGetSourcei = _lib.alGetSourcei\nalGetSourcei.restype = None\nalGetSourcei.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:546\n#alGetSource3i = _lib.alGetSource3i\n#alGetSource3i.restype = None\n#alGetSource3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:548\nalGetSourceiv = _lib.alGetSourceiv\nalGetSourceiv.restype = None\nalGetSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:556\nalSourcePlayv = _lib.alSourcePlayv\nalSourcePlayv.restype = None\nalSourcePlayv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:559\nalSourceStopv = _lib.alSourceStopv\nalSourceStopv.restype = None\nalSourceStopv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:562\nalSourceRewindv = _lib.alSourceRewindv\nalSourceRewindv.restype = None\nalSourceRewindv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:565\nalSourcePausev = _lib.alSourcePausev\nalSourcePausev.restype = None\nalSourcePausev.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:572\nalSourcePlay = _lib.alSourcePlay\nalSourcePlay.restype = None\nalSourcePlay.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:575\nalSourceStop = _lib.alSourceStop\nalSourceStop.restype = None\nalSourceStop.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:578\nalSourceRewind = _lib.alSourceRewind\nalSourceRewind.restype = None\nalSourceRewind.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:581\nalSourcePause = _lib.alSourcePause\nalSourcePause.restype = None\nalSourcePause.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:586\nalSourceQueueBuffers = _lib.alSourceQueueBuffers\nalSourceQueueBuffers.restype = None\nalSourceQueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:588\nalSourceUnqueueBuffers = _lib.alSourceUnqueueBuffers\nalSourceUnqueueBuffers.restype = None\nalSourceUnqueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:606\nalGenBuffers = _lib.alGenBuffers\nalGenBuffers.restype = None\nalGenBuffers.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:609\nalDeleteBuffers = _lib.alDeleteBuffers\nalDeleteBuffers.restype = None\nalDeleteBuffers.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:612\nalIsBuffer = _lib.alIsBuffer\nalIsBuffer.restype = ALboolean\nalIsBuffer.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:615\nalBufferData = _lib.alBufferData\nalBufferData.restype = None\nalBufferData.argtypes = [ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei]\n\n# /usr/include/AL/al.h:620\nalBufferf = _lib.alBufferf\nalBufferf.restype = None\nalBufferf.argtypes = [ALuint, ALenum, ALfloat]\n\n# /usr/include/AL/al.h:622\nalBuffer3f = _lib.alBuffer3f\nalBuffer3f.restype = None\nalBuffer3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:624\nalBufferfv = _lib.alBufferfv\nalBufferfv.restype = None\nalBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:626\nalBufferi = _lib.alBufferi\nalBufferi.restype = None\nalBufferi.argtypes = [ALuint, ALenum, ALint]\n\n# /usr/include/AL/al.h:628\nalBuffer3i = _lib.alBuffer3i\nalBuffer3i.restype = None\nalBuffer3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:630\nalBufferiv = _lib.alBufferiv\nalBufferiv.restype = None\nalBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:635\nalGetBufferf = _lib.alGetBufferf\nalGetBufferf.restype = None\nalGetBufferf.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:637\nalGetBuffer3f = _lib.alGetBuffer3f\nalGetBuffer3f.restype = None\nalGetBuffer3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:639\nalGetBufferfv = _lib.alGetBufferfv\nalGetBufferfv.restype = None\nalGetBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:641\nalGetBufferi = _lib.alGetBufferi\nalGetBufferi.restype = None\nalGetBufferi.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:643\nalGetBuffer3i = _lib.alGetBuffer3i\nalGetBuffer3i.restype = None\nalGetBuffer3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:645\nalGetBufferiv = _lib.alGetBufferiv\nalGetBufferiv.restype = None\nalGetBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:651\nalDopplerFactor = _lib.alDopplerFactor\nalDopplerFactor.restype = None\nalDopplerFactor.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:653\nalDopplerVelocity = _lib.alDopplerVelocity\nalDopplerVelocity.restype = None\nalDopplerVelocity.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:655\nalSpeedOfSound = _lib.alSpeedOfSound\nalSpeedOfSound.restype = None\nalSpeedOfSound.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:657\nalDistanceModel = _lib.alDistanceModel\nalDistanceModel.restype = None\nalDistanceModel.argtypes = [ALenum]\n\nLPALENABLE = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:662\nLPALDISABLE = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:663\nLPALISENABLED = CFUNCTYPE(ALboolean, ALenum) \t# /usr/include/AL/al.h:664\nLPALGETSTRING = CFUNCTYPE(POINTER(ALchar), ALenum) \t# /usr/include/AL/al.h:665\nLPALGETBOOLEANV = CFUNCTYPE(None, ALenum, POINTER(ALboolean)) \t# /usr/include/AL/al.h:666\nLPALGETINTEGERV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:667\nLPALGETFLOATV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:668\nLPALGETDOUBLEV = CFUNCTYPE(None, ALenum, POINTER(ALdouble)) \t# /usr/include/AL/al.h:669\nLPALGETBOOLEAN = CFUNCTYPE(ALboolean, ALenum) \t# /usr/include/AL/al.h:670\nLPALGETINTEGER = CFUNCTYPE(ALint, ALenum) \t# /usr/include/AL/al.h:671\nLPALGETFLOAT = CFUNCTYPE(ALfloat, ALenum) \t# /usr/include/AL/al.h:672\nLPALGETDOUBLE = CFUNCTYPE(ALdouble, ALenum) \t# /usr/include/AL/al.h:673\nLPALGETERROR = CFUNCTYPE(ALenum) \t# /usr/include/AL/al.h:674\nLPALISEXTENSIONPRESENT = CFUNCTYPE(ALboolean, POINTER(ALchar)) \t# /usr/include/AL/al.h:675\nLPALGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALchar)) \t# /usr/include/AL/al.h:676\nLPALGETENUMVALUE = CFUNCTYPE(ALenum, POINTER(ALchar)) \t# /usr/include/AL/al.h:677\nLPALLISTENERF = CFUNCTYPE(None, ALenum, ALfloat) \t# /usr/include/AL/al.h:678\nLPALLISTENER3F = CFUNCTYPE(None, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:679\nLPALLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:680\nLPALLISTENERI = CFUNCTYPE(None, ALenum, ALint) \t# /usr/include/AL/al.h:681\nLPALLISTENER3I = CFUNCTYPE(None, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:682\nLPALLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:683\nLPALGETLISTENERF = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:684\nLPALGETLISTENER3F = CFUNCTYPE(None, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:685\nLPALGETLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:686\nLPALGETLISTENERI = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:687\nLPALGETLISTENER3I = CFUNCTYPE(None, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:688\nLPALGETLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:689\nLPALGENSOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:690\nLPALDELETESOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:691\nLPALISSOURCE = CFUNCTYPE(ALboolean, ALuint) \t# /usr/include/AL/al.h:692\nLPALSOURCEF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) \t# /usr/include/AL/al.h:693\nLPALSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:694\nLPALSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:695\nLPALSOURCEI = CFUNCTYPE(None, ALuint, ALenum, ALint) \t# /usr/include/AL/al.h:696\nLPALSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:697\nLPALSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:698\nLPALGETSOURCEF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:699\nLPALGETSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:700\nLPALGETSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:701\nLPALGETSOURCEI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:702\nLPALGETSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:703\nLPALGETSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:704\nLPALSOURCEPLAYV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:705\nLPALSOURCESTOPV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:706\nLPALSOURCEREWINDV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:707\nLPALSOURCEPAUSEV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:708\nLPALSOURCEPLAY = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:709\nLPALSOURCESTOP = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:710\nLPALSOURCEREWIND = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:711\nLPALSOURCEPAUSE = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:712\nLPALSOURCEQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:713\nLPALSOURCEUNQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:714\nLPALGENBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:715\nLPALDELETEBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:716\nLPALISBUFFER = CFUNCTYPE(ALboolean, ALuint) \t# /usr/include/AL/al.h:717\nLPALBUFFERDATA = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei) \t# /usr/include/AL/al.h:718\nLPALBUFFERF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) \t# /usr/include/AL/al.h:719\nLPALBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:720\nLPALBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:721\nLPALBUFFERI = CFUNCTYPE(None, ALuint, ALenum, ALint) \t# /usr/include/AL/al.h:722\nLPALBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:723\nLPALBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:724\nLPALGETBUFFERF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:725\nLPALGETBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:726\nLPALGETBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:727\nLPALGETBUFFERI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:728\nLPALGETBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:729\nLPALGETBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:730\nLPALDOPPLERFACTOR = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:731\nLPALDOPPLERVELOCITY = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:732\nLPALSPEEDOFSOUND = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:733\nLPALDISTANCEMODEL = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:734\n\n__all__ = ['AL_API', 'ALAPI', 'AL_INVALID', 'AL_ILLEGAL_ENUM',\n'AL_ILLEGAL_COMMAND', 'ALboolean', 'ALchar', 'ALbyte', 'ALubyte', 'ALshort',\n'ALushort', 'ALint', 'ALuint', 'ALsizei', 'ALenum', 'ALfloat', 'ALdouble',\n'ALvoid', 'AL_NONE', 'AL_FALSE', 'AL_TRUE', 'AL_SOURCE_RELATIVE',\n'AL_CONE_INNER_ANGLE', 'AL_CONE_OUTER_ANGLE', 'AL_PITCH', 'AL_POSITION',\n'AL_DIRECTION', 'AL_VELOCITY', 'AL_LOOPING', 'AL_BUFFER', 'AL_GAIN',\n'AL_MIN_GAIN', 'AL_MAX_GAIN', 'AL_ORIENTATION', 'AL_SOURCE_STATE',\n'AL_INITIAL', 'AL_PLAYING', 'AL_PAUSED', 'AL_STOPPED', 'AL_BUFFERS_QUEUED',\n'AL_BUFFERS_PROCESSED', 'AL_SEC_OFFSET', 'AL_SAMPLE_OFFSET', 'AL_BYTE_OFFSET',\n'AL_SOURCE_TYPE', 'AL_STATIC', 'AL_STREAMING', 'AL_UNDETERMINED',\n'AL_FORMAT_MONO8', 'AL_FORMAT_MONO16', 'AL_FORMAT_STEREO8',\n'AL_FORMAT_STEREO16', 'AL_REFERENCE_DISTANCE', 'AL_ROLLOFF_FACTOR',\n'AL_CONE_OUTER_GAIN', 'AL_MAX_DISTANCE', 'AL_FREQUENCY', 'AL_BITS',\n'AL_CHANNELS', 'AL_SIZE', 'AL_UNUSED', 'AL_PENDING', 'AL_PROCESSED',\n'AL_NO_ERROR', 'AL_INVALID_NAME', 'AL_INVALID_ENUM', 'AL_INVALID_VALUE',\n'AL_INVALID_OPERATION', 'AL_OUT_OF_MEMORY', 'AL_VENDOR', 'AL_VERSION',\n'AL_RENDERER', 'AL_EXTENSIONS', 'AL_DOPPLER_FACTOR', 'AL_DOPPLER_VELOCITY',\n'AL_SPEED_OF_SOUND', 'AL_DISTANCE_MODEL', 'AL_INVERSE_DISTANCE',\n'AL_INVERSE_DISTANCE_CLAMPED', 'AL_LINEAR_DISTANCE',\n'AL_LINEAR_DISTANCE_CLAMPED', 'AL_EXPONENT_DISTANCE',\n'AL_EXPONENT_DISTANCE_CLAMPED', 'alEnable', 'alDisable', 'alIsEnabled',\n'alGetString', 'alGetBooleanv', 'alGetIntegerv', 'alGetFloatv',\n'alGetDoublev', 'alGetBoolean', 'alGetInteger', 'alGetFloat', 'alGetDouble',\n'alGetError', 'alIsExtensionPresent', 'alGetProcAddress', 'alGetEnumValue',\n'alListenerf', 'alListener3f', 'alListenerfv', 'alListeneri', 'alListener3i',\n'alListeneriv', 'alGetListenerf', 'alGetListener3f', 'alGetListenerfv',\n'alGetListeneri', 'alGetListener3i', 'alGetListeneriv', 'alGenSources',\n'alDeleteSources', 'alIsSource', 'alSourcef', 'alSource3f', 'alSourcefv',\n'alSourcei', 'alSource3i', 'alSourceiv', 'alGetSourcef', 'alGetSource3f',\n'alGetSourcefv', 'alGetSourcei', 'alGetSource3i', 'alGetSourceiv',\n'alSourcePlayv', 'alSourceStopv', 'alSourceRewindv', 'alSourcePausev',\n'alSourcePlay', 'alSourceStop', 'alSourceRewind', 'alSourcePause',\n'alSourceQueueBuffers', 'alSourceUnqueueBuffers', 'alGenBuffers',\n'alDeleteBuffers', 'alIsBuffer', 'alBufferData', 'alBufferf', 'alBuffer3f',\n'alBufferfv', 'alBufferi', 'alBuffer3i', 'alBufferiv', 'alGetBufferf',\n'alGetBuffer3f', 'alGetBufferfv', 'alGetBufferi', 'alGetBuffer3i',\n'alGetBufferiv', 'alDopplerFactor', 'alDopplerVelocity', 'alSpeedOfSound',\n'alDistanceModel', 'LPALENABLE', 'LPALDISABLE', 'LPALISENABLED',\n'LPALGETSTRING', 'LPALGETBOOLEANV', 'LPALGETINTEGERV', 'LPALGETFLOATV',\n'LPALGETDOUBLEV', 'LPALGETBOOLEAN', 'LPALGETINTEGER', 'LPALGETFLOAT',\n'LPALGETDOUBLE', 'LPALGETERROR', 'LPALISEXTENSIONPRESENT',\n'LPALGETPROCADDRESS', 'LPALGETENUMVALUE', 'LPALLISTENERF', 'LPALLISTENER3F',\n'LPALLISTENERFV', 'LPALLISTENERI', 'LPALLISTENER3I', 'LPALLISTENERIV',\n'LPALGETLISTENERF', 'LPALGETLISTENER3F', 'LPALGETLISTENERFV',\n'LPALGETLISTENERI', 'LPALGETLISTENER3I', 'LPALGETLISTENERIV',\n'LPALGENSOURCES', 'LPALDELETESOURCES', 'LPALISSOURCE', 'LPALSOURCEF',\n'LPALSOURCE3F', 'LPALSOURCEFV', 'LPALSOURCEI', 'LPALSOURCE3I', 'LPALSOURCEIV',\n'LPALGETSOURCEF', 'LPALGETSOURCE3F', 'LPALGETSOURCEFV', 'LPALGETSOURCEI',\n'LPALGETSOURCE3I', 'LPALGETSOURCEIV', 'LPALSOURCEPLAYV', 'LPALSOURCESTOPV',\n'LPALSOURCEREWINDV', 'LPALSOURCEPAUSEV', 'LPALSOURCEPLAY', 'LPALSOURCESTOP',\n'LPALSOURCEREWIND', 'LPALSOURCEPAUSE', 'LPALSOURCEQUEUEBUFFERS',\n'LPALSOURCEUNQUEUEBUFFERS', 'LPALGENBUFFERS', 'LPALDELETEBUFFERS',\n'LPALISBUFFER', 'LPALBUFFERDATA', 'LPALBUFFERF', 'LPALBUFFER3F',\n'LPALBUFFERFV', 'LPALBUFFERI', 'LPALBUFFER3I', 'LPALBUFFERIV',\n'LPALGETBUFFERF', 'LPALGETBUFFER3F', 'LPALGETBUFFERFV', 'LPALGETBUFFERI',\n'LPALGETBUFFER3I', 'LPALGETBUFFERIV', 'LPALDOPPLERFACTOR',\n'LPALDOPPLERVELOCITY', 'LPALSPEEDOFSOUND', 'LPALDISTANCEMODEL']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from ctypes import *", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyglet_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2008", " ", "Alex", " ", "Hol", "kne", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "pyg", "let", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "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", " ", "OWNER", " ", "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_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Wrapper", " ", "for", " ", "opena", "l", "\\", "10", ";", "\\", "10", ";", "Generate", "d", " ", "with", ":", "\\", "10", ";", "..", "/", "tool", "s", "/", "wrap", "types", "/", "wrap", ".", "py", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", " ", "-", "lop", "ena", "l", " ", "-", "oli", "b", "\\u", "opena", "l", ".", "py", "\\", "10", ";", "\\", "10", ";", "..", " ", "Hack", "ed", " ", "to", " ", "remove", " ", "non", "-", "existen", "t", " ", "librar", "y", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "TOD", "O", " ", "add", " ", "al", "Get", "Error", " ", "check", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "al", "Listen", "er", "3", "i", " ", "and", " ", "al", "Listen", "eri", "v", " ", "are", " ", "presen", "t", " ", "in", " ", "my", " ", "OS", " ", "X", " ", "10.", "4", " ", "but", " ", "not", " ", "anot", "her", "\\", "10", ";", "10.", "4", " ", "user", "'", "s", " ", "installation", ".", " ", " ", "The", "y", "'", "ve", " ", "als", "o", " ", "bee", "n", " ", "remove", "d", " ", "for", " ", "compatibility", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "._", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "lib_", "=_", "pyglet_", "._", "lib_", "._", "load", "\\u", "library_", "(_", "'", "opena", "l", "'_", ",_", "win32", "_", "=_", "'", "opena", "l3", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "framework_", "=_", "'/", "System", "/", "Libr", "ary", "/", "Frame", "works", "/", "Open", "AL", ".", "frame", "work", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "int\\u", "types_", "=_", "(_", "c\\u", "int16_", ",_", "c\\u", "int32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "ctypes_", ",_", "'", "c\\u", "int", "64", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "builds", " ", "of", " ", "ctype", "s", " ", "appare", "ntl", "y", " ", "do", " ", "not", " ", "have", " ", "c\\u", "int64_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", ";", " ", "it", "'", "s", " ", "a", " ", "pretty", " ", "good", " ", "bet", " ", "tha", "t", " ", "these", " ", "builds", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "64", "-", "bit", " ", "pointers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "int\\u", "types_", "+=_", "(_", "ctypes_", "._", "c\\u", "int64_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "\\u", "int\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sizeof_", "(_", "t_", ")_", "==_", "sizeof_", "(_", "c\\u", "size", "\\u", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c\\u", "ptr", "diff", "\\u", "t_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "AL", "\\u", "API_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "39_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "API_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "59_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "_", "=_", "-_", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ILL", "EGA", "L", "\\u", "ENUM", "_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "62_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ILL", "EGA", "L", "\\u", "COMMAND_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "63_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "boolean_", "=_", "c\\u", "int_", "#", " ", "Bet", "ter", " ", "return", " ", "type", " ", "than", " ", "c\\u", "char", ",", " ", "as", " ", "generated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "char_", "=_", "c\\u", "char_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "73_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "byte_", "=_", "c\\u", "char_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "76_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "ubyte_", "=_", "c\\u", "ubyte_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "79_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "short_", "=_", "c\\u", "short_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "82_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "ushort", "_", "=_", "c\\u", "ushort", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "85_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "int_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "88_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "uint_", "=_", "c\\u", "uint_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "size", "i_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "94_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "enum_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "97_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "float_", "=_", "c\\u", "float_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "double_", "=_", "c\\u", "double_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "103_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "void_", "=_", "None_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "106_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "NONE_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "112_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FALSE_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "115_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "TRUE_", "=_", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "118_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "RELAT", "IVE_", "=_", "514", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "121_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "INN", "ER", "\\u", "ANGLE", "_", "=_", "409", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "130_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "ANGLE", "_", "=_", "409", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "137_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PI", "TCH", "_", "=_", "409", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "145_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "POSITION", "_", "=_", "4100", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "157_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DIRECTION", "_", "=_", "410", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "160_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VEL", "OCI", "TY_", "=_", "410", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "163_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LOOP", "ING_", "=_", "410", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "171_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFFER_", "=_", "410", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "178_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "GAIN", "_", "=_", "410", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "191_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MIN", "\\u", "GAIN", "_", "=_", "410", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MAX", "\\u", "GAIN", "_", "=_", "411", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "209_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ORIE", "NTA", "TION_", "=_", "411", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "216_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "STATE_", "=_", "4112", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "221_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INITIAL", "_", "=_", "411", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "222_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PLAY", "ING_", "=_", "411", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "223_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PAUSE", "D_", "=_", "411", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "224_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STOPPED", "_", "=_", "411", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "225_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFF", "ERS", "\\u", "QUEUE", "D_", "=_", "411", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "230_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFF", "ERS", "\\u", "PROCESS", "ED_", "=_", "411", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "231_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SEC", "\\u", "OFFSET_", "=_", "413", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "236_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SAMPLE", "\\u", "OFFSET_", "=_", "413", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "237_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BYTE", "\\u", "OFFSET_", "=_", "413", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "238_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "TYPE_", "=_", "413", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "246_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STATI", "C_", "=_", "413", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "247_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STRE", "AMI", "NG_", "=_", "413", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "248_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "UND", "ET", "ERM", "INE", "D_", "=_", "414", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "249_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "MON", "O", "8_", "=_", "435", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "252_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "MON", "O1", "6_", "=_", "435", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "253_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O", "8_", "=_", "435", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "254_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O1", "6_", "=_", "435", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "REFERENCE", "\\u", "DISTANCE", "_", "=_", "412", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "265_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ROLL", "OFF", "\\u", "FACTOR", "_", "=_", "412", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "273", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "GAIN", "_", "=_", "413", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "282", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MAX", "\\u", "DISTANCE", "_", "=_", "413", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "292", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FREQUENCY", "_", "=_", "819", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BITS_", "=_", "819", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "301_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CHANNELS", "_", "=_", "819", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SIZE_", "=_", "819", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "303_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "UN", "USED", "_", "=_", "820", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "310_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PENDING_", "=_", "820", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "311_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PROCESS", "ED_", "=_", "821", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "312_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "NO", "\\u", "ERROR_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "316", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "NAME_", "=_", "409", "61_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "321_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "ENUM", "_", "=_", "409", "62_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "326", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "VALUE_", "=_", "409", "63_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "331", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "OPERATION", "_", "=_", "409", "64_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "336", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "OUT", "\\u", "OF", "\\u", "MEM", "ORY", "_", "=_", "409", "65_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "342", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VENDOR", "_", "=_", "450", "57_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "346", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VERSION_", "=_", "450", "58_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "347", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "RENDER", "ER_", "=_", "450", "59_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "348", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXTENSIONS_", "=_", "450", "60_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "349", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DO", "PP", "LER", "\\u", "FACTOR", "_", "=_", "491", "52_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "356", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DO", "PP", "LER", "\\u", "VEL", "OCI", "TY_", "=_", "491", "53_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "361", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SPEED", "\\u", "OF", "\\u", "SOUND", "_", "=_", "491", "55_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "366", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DISTANCE", "\\u", "MODEL_", "=_", "532", "48_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "375_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "_", "=_", "532", "49_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "376", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "50_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "377", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "_", "=_", "532", "51_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "378", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "52_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "379", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "_", "=_", "532", "53_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "380", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "54_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "381", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "386", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Enable_", "=_", "\\u", "lib_", "._", "al", "Enable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Enable_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Enable_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "388", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Disable_", "=_", "\\u", "lib_", "._", "al", "Disable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Disable_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Disable_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "390", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Enabled_", "=_", "\\u", "lib_", "._", "al", "Is", "Enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Enabled_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Enabled_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "396", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "String_", "=_", "\\u", "lib_", "._", "al", "Get", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "String_", "._", "restype_", "=_", "POINTER_", "(_", "AL", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "String_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "398", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Boo", "lean", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "boolean_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "400_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Integer", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Integer", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "402", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Float", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Float", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "404_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Doub", "lev_", "=_", "\\u", "lib_", "._", "al", "Get", "Doub", "lev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Doub", "lev_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Doub", "lev_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "double_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "406", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Boolean_", "=_", "\\u", "lib_", "._", "al", "Get", "Boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boolean_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boolean_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "408", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Integer_", "=_", "\\u", "lib_", "._", "al", "Get", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer_", "._", "restype_", "=_", "AL", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "410", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Float_", "=_", "\\u", "lib_", "._", "al", "Get", "Float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float_", "._", "restype_", "=_", "AL", "float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "412", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Double_", "=_", "\\u", "lib_", "._", "al", "Get", "Double_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Double_", "._", "restype_", "=_", "AL", "double_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Double_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "419", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Error_", "=_", "\\u", "lib_", "._", "al", "Get", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Error_", "._", "restype_", "=_", "AL", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Error_", "._", "argtypes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "427", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "=_", "\\u", "lib_", "._", "al", "Is", "Ext", "ensi", "on", "Present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "429", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Proc", "Address_", "=_", "\\u", "lib_", "._", "al", "Get", "Proc", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Proc", "Address_", "._", "restype_", "=_", "POINTER_", "(_", "c\\u", "void_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Proc", "Address_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "431", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Enum", "Value_", "=_", "\\u", "lib_", "._", "al", "Get", "Enum", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Enum", "Value_", "._", "restype_", "=_", "AL", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Enum", "Value_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "450_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "erf", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "erf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "452", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "er", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "454", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "erf", "v_", "=_", "\\u", "lib_", "._", "al", "Listen", "erf", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "456_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "eri", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "eri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "eri", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "eri", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "458", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Listen", "er", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "enum", ",", " ", "AL", "int", ",", " ", "AL", "int", ",", " ", "AL", "int", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "460", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", " ", "=", " ", "\\u", "lib", ".", "al", "Listen", "eri", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", ".", "arg", "types", " ", "=", " ", "[", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "465", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "erf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "467", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "er", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "469", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "erf", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "471", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "eri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "473", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "er", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "475", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "eri", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "512_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Gen", "Sources_", "=_", "\\u", "lib_", "._", "al", "Gen", "Sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Sources_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Sources_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "515", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Delete", "Sources_", "=_", "\\u", "lib_", "._", "al", "Delete", "Sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Sources_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Sources_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "518", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Source_", "=_", "\\u", "lib_", "._", "al", "Is", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Source_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Source_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "523", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "f_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "525", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "527", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "fv_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "529", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "i_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "531", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Sou", "rce", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "AL", "int", ",", " ", "AL", "int", ",", " ", "AL", "int", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "533", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", " ", "=", " ", "\\u", "lib", ".", "al", "Sou", "rce", "iv_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "538", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "540", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "542", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "544", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "546", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Get", "Sou", "rce", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", "),", " ", "POINTER", "(", "AL", "int", "),", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "548", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "556_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Play", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "559", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Sto", "pv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "562", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Re", "wind", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "565", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Pause", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "572", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Play_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Play_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "575", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "578", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Re", "wind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "581", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Pause", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "586", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Queue", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "588", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "606", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Gen", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Gen", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "609", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Delete", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Delete", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "612", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Buffer_", "=_", "\\u", "lib_", "._", "al", "Is", "Buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Buffer_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Buffer_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "615", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "Data_", "=_", "\\u", "lib_", "._", "al", "Buffer", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "Data_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "Data_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "void_", ")_", ",_", "AL", "size", "i_", ",_", "AL", "size", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "620", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "f_", "=_", "\\u", "lib_", "._", "al", "Buffer", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "622", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Buffer", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "624", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "fv_", "=_", "\\u", "lib_", "._", "al", "Buffer", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "626", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "i_", "=_", "\\u", "lib_", "._", "al", "Buffer", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "628", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Buffer", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "630", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "iv_", "=_", "\\u", "lib_", "._", "al", "Buffer", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "635", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "f_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "637", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "639", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "641", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "643", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "645", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "651", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "=_", "\\u", "lib_", "._", "al", "Do", "ppl", "er", "Factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "653", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "=_", "\\u", "lib_", "._", "al", "Do", "ppl", "er", "Velocity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "655", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "=_", "\\u", "lib_", "._", "al", "Spee", "d", "Of", "Sound_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "657", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Distan", "ce", "Model_", "=_", "\\u", "lib_", "._", "al", "Distan", "ce", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Distan", "ce", "Model_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Distan", "ce", "Model_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "ALE", "NA", "BLE_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "662", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DISABLE", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "663", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SE", "NA", "BL", "ED_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "664", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "STRING_", "=_", "CFUNCTYPE_", "(_", "POINTER_", "(_", "AL", "char_", ")_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "665", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BOOLEAN", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "boolean_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "666_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "INTEG", "ERV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "667_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "FLOAT", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "668", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "DOUBLE", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "double_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "669", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BOOLEAN", "_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "670", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "INTEGER_", "=_", "CFUNCTYPE_", "(_", "AL", "int_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "671", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "FLOAT_", "=_", "CFUNCTYPE_", "(_", "AL", "float_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "672", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "DOUBLE_", "=_", "CFUNCTYPE_", "(_", "AL", "double_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "673", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "ERROR_", "=_", "CFUNCTYPE_", "(_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "674", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SE", "XT", "ENS", "ION", "PRESENT", "_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "675", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "PROC", "ADDRESS_", "=_", "CFUNCTYPE_", "(_", "POINTER_", "(_", "c\\u", "void_", ")_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "676", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "ENUM", "VALUE_", "=_", "CFUNCTYPE_", "(_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "677", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "678", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "679", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "680", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "681", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "682", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "IV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "683", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "684", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "685", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "686", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "687", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "688", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "689", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GEN", "SOURCES", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "690", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DELET", "ES", "OUR", "CES", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "691", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SSO", "UR", "CE_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "692", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "693", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "694", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "695", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "696", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "697", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "IV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "698", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EF", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "699", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "E3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "700_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EF", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "701", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "702", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "E3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "703", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "704", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PLAY", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "705", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CES", "TOP", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "706", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "RE", "WIND", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "707", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PAUSE", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "708", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PLAY", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "709", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CES", "TOP_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "710", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "RE", "WIND", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "711", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PAUSE", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "712", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "QUEUE", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "713", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "UN", "QUEUE", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "714", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GEN", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "715", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DELET", "EB", "UFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "716", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SB", "UFF", "ER_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "717", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "DATA_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "void_", ")_", ",_", "AL", "size", "i_", ",_", "AL", "size", "i_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "718", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "719", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "720_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "721", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "722_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "723", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "724", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "725", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "726", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "727", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "728", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "729", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "730", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DO", "PP", "LER", "FACTOR", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "731", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DO", "PP", "LER", "VEL", "OCI", "TY_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "732", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "PE", "ED", "OF", "SOUND", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "733", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DISTANCE", "MODEL_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "734", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "AL", "\\u", "API", "'_", ",_", "'", "AL", "API", "'_", ",_", "'", "AL", "\\u", "INVALID", "'_", ",_", "'", "AL", "\\u", "ILL", "EGA", "L", "\\u", "ENUM", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "ILL", "EGA", "L", "\\u", "COMMA", "ND", "'_", ",_", "'", "AL", "boolean", "'_", ",_", "'", "AL", "char", "'_", ",_", "'", "AL", "byte", "'_", ",_", "'", "AL", "ub", "yte", "'_", ",_", "'", "AL", "short", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "ushort", "'_", ",_", "'", "AL", "int", "'_", ",_", "'", "AL", "uint", "'_", ",_", "'", "AL", "size", "i", "'_", ",_", "'", "AL", "enum", "'_", ",_", "'", "AL", "float", "'_", ",_", "'", "AL", "double", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "voi", "d", "'_", ",_", "'", "AL", "\\u", "NON", "E", "'_", ",_", "'", "AL", "\\u", "FAL", "SE", "'_", ",_", "'", "AL", "\\u", "TRU", "E", "'_", ",_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "RELAT", "IV", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CON", "E", "\\u", "INN", "ER", "\\u", "ANGLE", "'_", ",_", "'", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "ANGLE", "'_", ",_", "'", "AL", "\\u", "PI", "TCH", "'_", ",_", "'", "AL", "\\u", "POSITION", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "DIRECTION", "'_", ",_", "'", "AL", "\\u", "VEL", "OCI", "TY", "'_", ",_", "'", "AL", "\\u", "LOOP", "ING", "'_", ",_", "'", "AL", "\\u", "BUFF", "ER", "'_", ",_", "'", "AL", "\\u", "GAIN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "MIN", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "MAX", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "ORIE", "NTA", "TIO", "N", "'_", ",_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "STATE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INITIAL", "'_", ",_", "'", "AL", "\\u", "PLAY", "ING", "'_", ",_", "'", "AL", "\\u", "PAUSE", "D", "'_", ",_", "'", "AL", "\\u", "STOPPED", "'_", ",_", "'", "AL", "\\u", "BUFF", "ERS", "\\u", "QUEUE", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "BUFF", "ERS", "\\u", "PROCESS", "ED", "'_", ",_", "'", "AL", "\\u", "SEC", "\\u", "OFFSET", "'_", ",_", "'", "AL", "\\u", "SAMPLE", "\\u", "OFFSET", "'_", ",_", "'", "AL", "\\u", "BYTE", "\\u", "OFFSET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "TYPE", "'_", ",_", "'", "AL", "\\u", "STATI", "C", "'_", ",_", "'", "AL", "\\u", "STRE", "AMI", "NG", "'_", ",_", "'", "AL", "\\u", "UND", "ET", "ERM", "INE", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "FORMAT", "\\u", "MON", "O", "8", "'_", ",_", "'", "AL", "\\u", "FORMAT", "\\u", "MON", "O1", "6", "'_", ",_", "'", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O1", "6", "'_", ",_", "'", "AL", "\\u", "REFERENCE", "\\u", "DISTANCE", "'_", ",_", "'", "AL", "\\u", "ROLL", "OFF", "\\u", "FACTOR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "MAX", "\\u", "DISTANCE", "'_", ",_", "'", "AL", "\\u", "FREQUENCY", "'_", ",_", "'", "AL", "\\u", "BITS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CHANNELS", "'_", ",_", "'", "AL", "\\u", "SIZE", "'_", ",_", "'", "AL", "\\u", "UN", "USED", "'_", ",_", "'", "AL", "\\u", "PEND", "ING", "'_", ",_", "'", "AL", "\\u", "PROCESS", "ED", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "NO", "\\u", "ERROR", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "NAME", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "ENUM", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "VALU", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INVALID", "\\u", "OPERATION", "'_", ",_", "'", "AL", "\\u", "OUT", "\\u", "OF", "\\u", "MEM", "ORY", "'_", ",_", "'", "AL", "\\u", "VENDOR", "'_", ",_", "'", "AL", "\\u", "VERSI", "ON", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "RENDER", "ER", "'_", ",_", "'", "AL", "\\u", "EXTENSION", "S", "'_", ",_", "'", "AL", "\\u", "DO", "PP", "LER", "\\u", "FACTOR", "'_", ",_", "'", "AL", "\\u", "DO", "PP", "LER", "\\u", "VEL", "OCI", "TY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "SPEED", "\\u", "OF", "\\u", "SOUND", "'_", ",_", "'", "AL", "\\u", "DISTANCE", "\\u", "MODEL", "'_", ",_", "'", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "al", "Enable", "'_", ",_", "'", "al", "Disa", "ble", "'_", ",_", "'", "al", "Is", "Enable", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "String", "'_", ",_", "'", "al", "Get", "Boo", "lean", "v", "'_", ",_", "'", "al", "Get", "Integer", "v", "'_", ",_", "'", "al", "Get", "Float", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Doub", "lev", "'_", ",_", "'", "al", "Get", "Boo", "lean", "'_", ",_", "'", "al", "Get", "Integer", "'_", ",_", "'", "al", "Get", "Float", "'_", ",_", "'", "al", "Get", "Doub", "le", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Error", "'_", ",_", "'", "al", "Is", "Ext", "ensi", "on", "Present", "'_", ",_", "'", "al", "Get", "Proc", "Address", "'_", ",_", "'", "al", "Get", "Enum", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Listen", "erf", "'_", ",_", "'", "al", "Listen", "er", "3f", "'_", ",_", "'", "al", "Listen", "erf", "v", "'_", ",_", "'", "al", "Listen", "eri", "'_", ",_", "'", "al", "Listen", "er", "3", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Listen", "eri", "v", "'_", ",_", "'", "al", "Get", "Listen", "erf", "'_", ",_", "'", "al", "Get", "Listen", "er", "3f", "'_", ",_", "'", "al", "Get", "Listen", "erf", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Listen", "eri", "'_", ",_", "'", "al", "Get", "Listen", "er", "3", "i", "'_", ",_", "'", "al", "Get", "Listen", "eri", "v", "'_", ",_", "'", "al", "Gen", "Sou", "rce", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Delete", "Sou", "rce", "s", "'_", ",_", "'", "al", "Is", "Sou", "rce", "'_", ",_", "'", "al", "Sou", "rce", "f", "'_", ",_", "'", "al", "Sou", "rce", "3f", "'_", ",_", "'", "al", "Sou", "rce", "fv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "i", "'_", ",_", "'", "al", "Sou", "rce", "3", "i", "'_", ",_", "'", "al", "Sou", "rce", "iv", "'_", ",_", "'", "al", "Get", "Sou", "rce", "f", "'_", ",_", "'", "al", "Get", "Sou", "rce", "3f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Sou", "rce", "fv", "'_", ",_", "'", "al", "Get", "Sou", "rce", "i", "'_", ",_", "'", "al", "Get", "Sou", "rce", "3", "i", "'_", ",_", "'", "al", "Get", "Sou", "rce", "iv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Play", "v", "'_", ",_", "'", "al", "Sou", "rce", "Sto", "pv", "'_", ",_", "'", "al", "Sou", "rce", "Re", "wind", "v", "'_", ",_", "'", "al", "Sou", "rce", "Pause", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Play", "'_", ",_", "'", "al", "Sou", "rce", "Sto", "p", "'_", ",_", "'", "al", "Sou", "rce", "Re", "wind", "'_", ",_", "'", "al", "Sou", "rce", "Pause", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Queue", "Buffers", "'_", ",_", "'", "al", "Sou", "rce", "Un", "queue", "Buffers", "'_", ",_", "'", "al", "Gen", "Buffers", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Delete", "Buffers", "'_", ",_", "'", "al", "Is", "Buffer", "'_", ",_", "'", "al", "Buffer", "Data", "'_", ",_", "'", "al", "Buffer", "f", "'_", ",_", "'", "al", "Buffer", "3f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Buffer", "fv", "'_", ",_", "'", "al", "Buffer", "i", "'_", ",_", "'", "al", "Buffer", "3", "i", "'_", ",_", "'", "al", "Buffer", "iv", "'_", ",_", "'", "al", "Get", "Buffer", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Buffer", "3f", "'_", ",_", "'", "al", "Get", "Buffer", "fv", "'_", ",_", "'", "al", "Get", "Buffer", "i", "'_", ",_", "'", "al", "Get", "Buffer", "3", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Buffer", "iv", "'_", ",_", "'", "al", "Do", "ppl", "er", "Factor", "'_", ",_", "'", "al", "Do", "ppl", "er", "Velocity", "'_", ",_", "'", "al", "Spee", "d", "Of", "Sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Distan", "ce", "Model", "'_", ",_", "'", "LP", "ALE", "NA", "BL", "E", "'_", ",_", "'", "LP", "AL", "DISABLE", "'_", ",_", "'", "LP", "ALI", "SE", "NA", "BL", "ED", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "STRING", "'_", ",_", "'", "LP", "AL", "GET", "BOOLEAN", "V", "'_", ",_", "'", "LP", "AL", "GET", "INTEG", "ERV", "'_", ",_", "'", "LP", "AL", "GET", "FLOAT", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "DOUBLE", "V", "'_", ",_", "'", "LP", "AL", "GET", "BOOLEAN", "'_", ",_", "'", "LP", "AL", "GET", "INTEG", "ER", "'_", ",_", "'", "LP", "AL", "GET", "FLOAT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "DOUBLE", "'_", ",_", "'", "LP", "AL", "GET", "ERROR", "'_", ",_", "'", "LP", "ALI", "SE", "XT", "ENS", "ION", "PRESENT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "PROC", "ADDR", "ESS", "'_", ",_", "'", "LP", "AL", "GET", "ENUM", "VALU", "E", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "F", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "3", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALL", "ISTE", "NER", "FV", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "I", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "3", "I", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "IV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "LISTEN", "ER", "F", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "3", "F", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "FV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "LISTEN", "ERI", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "3", "I", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ERI", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GEN", "SOURCES", "'_", ",_", "'", "LP", "AL", "DELET", "ES", "OUR", "CES", "'_", ",_", "'", "LP", "ALI", "SSO", "UR", "CE", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "3", "F", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "FV", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "I", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "3", "I", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "IV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "SOU", "RC", "EF", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "E3", "F", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EF", "V", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EI", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "SOU", "RC", "E3", "I", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EI", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PLAY", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CES", "TOP", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "RE", "WIND", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PAUSE", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PLAY", "'_", ",_", "'", "LP", "ALS", "OUR", "CES", "TOP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "RE", "WIND", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PAUSE", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "QUEUE", "BUFF", "ERS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "UN", "QUEUE", "BUFF", "ERS", "'_", ",_", "'", "LP", "AL", "GEN", "BUFF", "ERS", "'_", ",_", "'", "LP", "AL", "DELET", "EB", "UFF", "ERS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALI", "SB", "UFF", "ER", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "DATA", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "F", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "3", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALB", "UFF", "ER", "FV", "'_", ",_", "'", "LP", "ALB", "UFF", "ERI", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "3", "I", "'_", ",_", "'", "LP", "ALB", "UFF", "ERI", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "BUFF", "ER", "F", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ER", "3", "F", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ER", "FV", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ERI", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "BUFF", "ER", "3", "I", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ERI", "V", "'_", ",_", "'", "LP", "AL", "DO", "PP", "LER", "FACTOR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "DO", "PP", "LER", "VEL", "OCI", "TY", "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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 ]
Unused import
anandology/pyjamas/library/pyjamas/ui/TextArea.py
[ { "content": "from gwt.ui.TextArea import (\n DOM,\n Factory,\n TextArea,\n TextBoxBase,\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from gwt.ui.TextArea import (\n DOM,\n Factory,\n TextArea,\n TextBoxBase,\n)", "start_line": 0, "start_column": 0, "end_line": 5, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "gw", "t_", "._", "ui_", "._", "Text", "Area_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "DOM_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Text", "Area_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Text", "Box", "Base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Testing equality to None
AppScale/appscale/AppServer/google/appengine/api/SOAPpy/Client.py
[ { "content": " def call(self, addr, data, namespace, soapaction = None, encoding = None,\n http_proxy = None, config = Config):\n\n import httplib\n\n if not isinstance(addr, SOAPAddress):\n addr = SOAPAddress(addr, config)\n\n # Build a request\n if http_proxy:\n real_addr = http_proxy\n real_path = addr.proto + \"://\" + addr.host + addr.path\n else:\n real_addr = addr.host\n real_path = addr.path\n\n if addr.proto == 'httpg':\n from pyGlobus.io import GSIHTTP\n r = GSIHTTP(real_addr, tcpAttr = config.tcpAttr)\n elif addr.proto == 'https':\n r = httplib.HTTPS(real_addr)\n else:\n r = httplib.HTTP(real_addr)\n\n r.putrequest(\"POST\", real_path)\n\n r.putheader(\"Host\", addr.host)\n r.putheader(\"User-agent\", SOAPUserAgent())\n t = 'text/xml';\n if encoding != None:\n t += '; charset=\"%s\"' % encoding\n r.putheader(\"Content-type\", t)\n r.putheader(\"Content-length\", str(len(data)))\n\n # if user is not a user:passwd format\n # we'll receive a failure from the server. . .I guess (??)\n if addr.user != None:\n val = base64.encodestring(addr.user) \n r.putheader('Authorization','Basic ' + val.replace('\\012',''))\n\n # This fixes sending either \"\" or \"None\"\n if soapaction == None or len(soapaction) == 0:\n r.putheader(\"SOAPAction\", \"\")\n else:\n r.putheader(\"SOAPAction\", '\"%s\"' % soapaction)\n\n if config.dumpHeadersOut:\n s = 'Outgoing HTTP headers'\n debugHeader(s)\n print \"POST %s %s\" % (real_path, r._http_vsn_str)\n print \"Host:\", addr.host\n print \"User-agent: SOAPpy \" + __version__ + \" (http://pywebsvcs.sf.net)\"\n print \"Content-type:\", t\n print \"Content-length:\", len(data)\n print 'SOAPAction: \"%s\"' % soapaction\n debugFooter(s)\n\n r.endheaders()\n\n if config.dumpSOAPOut:\n s = 'Outgoing SOAP'\n debugHeader(s)\n print data,\n if data[-1] != '\\n':\n print\n debugFooter(s)\n\n # send the payload\n r.send(data)\n\n # read response line\n code, msg, headers = r.getreply()\n\n if headers:\n content_type = headers.get(\"content-type\",\"text/xml\")\n content_length = headers.get(\"Content-length\")\n else:\n content_type=None\n content_length=None\n\n # work around OC4J bug which does '<len>, <len>' for some reaason\n if content_length:\n comma=content_length.find(',')\n if comma>0:\n content_length = content_length[:comma]\n\n # attempt to extract integer message size\n try:\n message_len = int(content_length)\n except:\n message_len = -1\n \n if message_len < 0:\n # Content-Length missing or invalid; just read the whole socket\n # This won't work with HTTP/1.1 chunked encoding\n data = r.getfile().read()\n message_len = len(data)\n else:\n data = r.getfile().read(message_len)\n\n if(config.debug):\n print \"code=\",code\n print \"msg=\", msg\n print \"headers=\", headers\n print \"content-type=\", content_type\n print \"data=\", data\n \n if config.dumpHeadersIn:\n s = 'Incoming HTTP headers'\n debugHeader(s)\n if headers.headers:\n print \"HTTP/1.? %d %s\" % (code, msg)\n print \"\\n\".join(map (lambda x: x.strip(), headers.headers))\n else:\n print \"HTTP/0.9 %d %s\" % (code, msg)\n debugFooter(s)\n\n def startswith(string, val):\n return string[0:len(val)] == val\n \n if code == 500 and not \\\n ( startswith(content_type, \"text/xml\") and message_len > 0 ):\n raise HTTPError(code, msg)\n\n if config.dumpSOAPIn:\n s = 'Incoming SOAP'\n debugHeader(s)\n print data,\n if (len(data)>0) and (data[-1] != '\\n'):\n print\n debugFooter(s)\n\n if code not in (200, 500):\n raise HTTPError(code, msg)\n\n\n # get the new namespace\n if namespace is None:\n new_ns = None\n else:\n new_ns = self.getNS(namespace, data)\n \n # return response payload\n return data, new_ns", "metadata": "root.HTTPTransport.call", "header": "['class', 'HTTPTransport', ':', '___EOS___']", "index": 129 } ]
[ { "span": "soapaction == None ", "start_line": 170, "start_column": 11, "end_line": 170, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "HTTP", "Transport_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call_", "(_", "self_", ",_", "addr_", ",_", "data_", ",_", "namespace_", ",_", "soap", "action_", "=_", "None_", ",_", "encoding_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "proxy_", "=_", "None_", ",_", "config_", "=_", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "addr_", ",_", "SOA", "PA", "ddress", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "SOA", "PA", "ddress", "_", "(_", "addr_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "a", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "http", "\\u", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "real", "\\u", "addr_", "=_", "http", "\\u", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real", "\\u", "path_", "=_", "addr_", "._", "proto_", "+_", "\":", "//", "\"_", "+_", "addr_", "._", "host_", "+_", "addr_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "real", "\\u", "addr_", "=_", "addr_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real", "\\u", "path_", "=_", "addr_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "addr_", "._", "proto_", "==_", "'", "http", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "py", "Glob", "us_", "._", "io_", "import_", "GS", "IH", "TT", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "GS", "IH", "TT", "P_", "(_", "real", "\\u", "addr_", ",_", "tcp", "Attr_", "=_", "config_", "._", "tcp", "Attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "addr_", "._", "proto_", "==_", "'", "https", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "httplib_", "._", "HTTP", "S_", "(_", "real", "\\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 ", " _", "r_", "=_", "httplib_", "._", "HTTP_", "(_", "real", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "put", "request_", "(_", "\"", "POST", "\"_", ",_", "real", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "._", "put", "header_", "(_", "\"", "Host", "\"_", ",_", "addr_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "put", "header_", "(_", "\"", "User", "-", "agent", "\"_", ",_", "SOA", "PU", "ser", "Agent_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "'", "text", "/", "xml", "'_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "+=_", "';", " ", "charset", "=\"", "%", "s", "\"'_", "%_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "put", "header_", "(_", "\"", "Conten", "t", "-", "type", "\"_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "put", "header_", "(_", "\"", "Conten", "t", "-", "length", "\"_", ",_", "str_", "(_", "len_", "(_", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "user", " ", "is", " ", "not", " ", "a", " ", "user", ":", "passw", "d", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "we", "'", "ll", " ", "receive", " ", "a", " ", "fail", "ure", " ", "from", " ", "the", " ", "server", ".", " ", ".", " ", ".", "I", " ", "guess", " ", "(?", "?)", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "addr_", "._", "user_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "base64_", "._", "encodes", "tring_", "(_", "addr_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "put", "header_", "(_", "'", "Authoriz", "ation", "'_", ",_", "'", "Basic", " ", "'_", "+_", "val_", "._", "replace_", "(_", "'\\\\", "012", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "fixes", " ", "sendin", "g", " ", "eit", "her", " ", "\"\"", " ", "or", " ", "\"", "Non", "e", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "soap", "action_", "==_", "None_", "or_", "len_", "(_", "soap", "action_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "put", "header_", "(_", "\"", "SOA", "PA", "ction", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "put", "header_", "(_", "\"", "SOA", "PA", "ction", "\"_", ",_", "'\"", "%", "s", "\"'_", "%_", "soap", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "dump", "Head", "ers", "Out_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "Out", "goi", "ng", " ", "HTTP", " ", "header", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Header_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "POST", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "real", "\\u", "path_", ",_", "r_", "._", "\\u", "http", "\\u", "vs", "n", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Host", ":\"_", ",_", "addr_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "User", "-", "agent", ":", " ", "SOA", "Pp", "y", " ", "\"_", "+_", "\\u\\u", "version\\u\\u_", "+_", "\"", " ", "(", "http", "://", "pyw", "ebs", "vcs", ".", "sf", ".", "net", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Conten", "t", "-", "type", ":\"_", ",_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Conten", "t", "-", "length", ":\"_", ",_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "SOA", "PA", "ction", ":", " ", "\"%", "s", "\"'_", "%_", "soap", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Footer", "_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "end", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "._", "dump", "SOA", "PO", "ut_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "Out", "goi", "ng", " ", "SOA", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Header_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "data_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "-_", "1_", "]_", "!=_", "'\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug", "Footer", "_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "send", " ", "the", " ", "payload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "response", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "code_", ",_", "msg_", ",_", "headers_", "=_", "r_", "._", "getre", "ply_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "type_", "=_", "headers_", "._", "get_", "(_", "\"", "content", "-", "type", "\"_", ",_", "\"", "text", "/", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "length_", "=_", "headers_", "._", "get_", "(_", "\"", "Conten", "t", "-", "length", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "length_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "work", " ", "aro", "und", " ", "OC", "4", "J", " ", "bug", " ", "whi", "ch", " ", "doe", "s", " ", "'<", "len", ">", ",", " ", "<", "len", ">'", " ", "for", " ", "some", " ", "rea", "aso", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "content", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comma_", "=_", "content", "\\u", "length_", "._", "find_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comma_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "length_", "=_", "content", "\\u", "length_", "[_", ":_", "comma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "extract", " ", "integ", "er", " ", "message", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "len_", "=_", "int_", "(_", "content", "\\u", "length_", ")_", "\\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 ", " _", "message", "\\u", "len_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message", "\\u", "len_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Conten", "t", "-", "Length", " ", "missi", "ng", " ", "or", " ", "invalid", ";", " ", "just", " ", "read", " ", "the", " ", "whole", " ", "socket_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "won", "'", "t", " ", "work", " ", "with", " ", "HTTP", "/", "1.1", " ", "chunked", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "r_", "._", "getfile", "_", "(_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "len_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "r_", "._", "getfile", "_", "(_", ")_", "._", "read_", "(_", "message", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "config_", "._", "debug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "code", "=\"_", ",_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "msg", "=\"_", ",_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "header", "s", "=\"_", ",_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "content", "-", "type", "=\"_", ",_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "data", "=\"_", ",_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "dump", "Head", "ers", "In_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "Inco", "ming", " ", "HTTP", " ", "header", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Header_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "headers_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "HTTP", "/", "1", ".", "?", " ", "%", "d", " ", "%", "s", "\"_", "%_", "(_", "code_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "map_", "(_", "lambda_", "x_", ":_", "x_", "._", "strip_", "(_", ")_", ",_", "headers_", "._", "headers_", ")_", ")_", "\\u\\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_", "\"", "HTTP", "/", "0.", "9", " ", "%", "d", " ", "%", "s", "\"_", "%_", "(_", "code_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug", "Footer", "_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startswith_", "(_", "string_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "string_", "[_", "0_", ":_", "len_", "(_", "val_", ")_", "]_", "==_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "code_", "==_", "500_", "and_", "not_", "(_", "startswith_", "(_", "content", "\\u", "type_", ",_", "\"", "text", "/", "xml", "\"_", ")_", "and_", "message", "\\u", "len_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "HTTP", "Error_", "(_", "code_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "dump", "SOA", "PI", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "Inco", "ming", " ", "SOA", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "Header_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "data_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "data_", ")_", ">_", "0_", ")_", "and_", "(_", "data_", "[_", "-_", "1_", "]_", "!=_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug", "Footer", "_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "code_", "not_", "in_", "(_", "200_", ",_", "500_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "HTTP", "Error_", "(_", "code_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "new", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "namespace_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "ns_", "=_", "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 ", " _", "new", "\\u", "ns_", "=_", "self_", "._", "get", "NS_", "(_", "namespace_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "response", " ", "payload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", ",_", "new", "\\u", "ns_", "\\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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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 ]
Unused import
pbinkley/twarc-report/reportprofile.py
[ { "content": "#!/usr/bin/env python \n\nimport json\nimport optparse\nfrom profiler import Profiler # local module\nimport dateutil.parser # $ pip install python-dateutil\nimport sparkline\n\nopt_parser = optparse.OptionParser()\nopt_parser.add_option(\"-o\", \"--output\", dest=\"output\", type=\"str\", \n help=\"text | json (default: text)\", default=\"text\")\nopts, args = opt_parser.parse_args()\n\nprofiler = Profiler({\"extended\": True, \"blocks\": [\"all\"]})\n\nprofiler.gettweets(opts, args)\n\ndata = profiler.report()\n\nif (opts.output == \"json\"):\n print data\nelse:\n print \"Count: \" + \"{:>9}\".format(str(data[\"count\"]))\n print \"Users: \" + \"{:>9}\".format(str(data[\"usercount\"]))\n print \"User percentiles: \" + sparkline.sparkify(data[\"userspercentiles\"])\n print \" \" + str(data[\"userspercentiles\"])\n print \"Has hashtag: \" + \"{:>9}\".format(str(data[\"hashtagcount\"])) + \" (\" + str(\"%.2f\" % (float(data[\"hashtagcount\"]) / float(data[\"count\"]) * 100.0)) + \"%)\"\n print \"Hashtags: \" + \"{:>9}\".format(str(data[\"hashtags\"]))\n print \"Hashtags percentiles: \" + sparkline.sparkify(data[\"hashtagspercentiles\"])\n print \" \" + str(data[\"hashtagspercentiles\"])\n print \"Has URL: \" + \"{:>9}\".format(str(data[\"urlcount\"])) + \" (\" + str(\"%.2f\" % (float(data[\"urlcount\"]) / float(data[\"count\"]) * 100.0)) + \"%)\"\n print \"URLs: \" + \"{:>9}\".format(str(data[\"urls\"]))\n print \"URLs percentiles: \" + sparkline.sparkify(data[\"urlspercentiles\"])\n print \" \" + str(data[\"urlspercentiles\"])\n print \"Has Image URL: \" + \"{:>9}\".format(str(data[\"imageurlcount\"])) + \" (\" + str(\"%.2f\" % (float(data[\"imageurlcount\"]) / float(data[\"count\"]) * 100.0)) + \"%)\"\n print \"Image URLs: \" + \"{:>9}\".format(str(data[\"imageurls\"]))\n print \"Image URLs percentiles: \" + sparkline.sparkify(data[\"imageurlspercentiles\"])\n print \" \" + str(data[\"imageurlspercentiles\"])\n print \"Retweets: \" + \"{:>9}\".format(str(data[\"retweetcount\"])) + \" (\" + str(\"%.2f\" % (float(data[\"retweetcount\"]) / float(data[\"count\"]) * 100.0)) + \"%)\"\n print \"Geo: \" + \"{:>9}\".format(str(data[\"geocount\"])) + \" (\" + str(\"%.2f\" % (float(data[\"geocount\"]) / float(data[\"count\"]) * 100.0)) + \"%)\"\n print \"Earliest: \" + str(data[\"earliest\"])\n print \"Latest: \" + str(data[\"latest\"])\n print \"Duration: \" + str(dateutil.parser.parse(data[\"latest\"]) - dateutil.parser.parse(data[\"earliest\"]))\n\n print \"Top users: \" + sparkline.sparkify([u[\"value\"] for u in data[\"topusers\"]]).encode(\"utf-8\")\n for user in data[\"topusers\"]:\n print \"{:>7}\".format(str(user[\"value\"])) + \" \" + user[\"name\"]\n print \"Top hashtags: \" + sparkline.sparkify([u[\"value\"] for u in data[\"tophashtags\"]]).encode(\"utf-8\")\n for hashtag in data[\"tophashtags\"]:\n print \"{:>7}\".format(str(hashtag[\"value\"])) + \" \" + hashtag[\"name\"]\n print \"Top URLs: \" + sparkline.sparkify([u[\"value\"] for u in data[\"topurls\"]]).encode(\"utf-8\")\n for url in data[\"topurls\"]:\n print \"{:>7}\".format(str(url[\"value\"])) + \" \" + url[\"name\"]\n print \"Top Image URLs: \" + sparkline.sparkify([u[\"value\"] for u in data[\"topimageurls\"]]).encode(\"utf-8\")\n for imageurl in data[\"topimageurls\"]:\n print \"{:>7}\".format(str(imageurl[\"value\"])) + \" \" + imageurl[\"name\"]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import json", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "profiler_", "import_", "Profiler", "_", "#", " ", "local", " ", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dateutil_", "._", "parser_", "#", " ", "$", " ", "pip", " ", "install", " ", "python", "-", "dateutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "spark", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "\\u", "parser_", "=_", "optparse_", "._", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "o", "\"_", ",_", "\"--", "output", "\"_", ",_", "dest_", "=_", "\"", "output", "\"_", ",_", "type_", "=_", "\"", "str", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "text", " ", "|", " ", "json", " ", "(", "default", ":", " ", "text", ")\"_", ",_", "default_", "=_", "\"", "text", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "args_", "=_", "opt", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "profiler_", "=_", "Profiler", "_", "(_", "{_", "\"", "extend", "ed", "\"_", ":_", "True_", ",_", "\"", "blocks", "\"_", ":_", "[_", "\"", "all", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "profiler_", "._", "gett", "wee", "ts_", "(_", "opts_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "profiler_", "._", "report_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "opts_", "._", "output_", "==_", "\"", "json", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "data_", "\\u\\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_", "\"", "Count", ":", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "User", "s", ":", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "userco", "unt", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "User", " ", "percentile", "s", ":", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "data_", "[_", "\"", "users", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "users", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Has", " ", "hashtag", ":", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "hashtag", "count", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "\"%", ".2", "f", "\"_", "%_", "(_", "float_", "(_", "data_", "[_", "\"", "hashtag", "count", "\"_", "]_", ")_", "/_", "float_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", "*_", "100.0_", ")_", ")_", "+_", "\"%", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Hash", "tags", ":", " ", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "hashtag", "s", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Hash", "tags", " ", "percentile", "s", ":", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "data_", "[_", "\"", "hashtag", "sper", "cent", "iles", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "hashtag", "sper", "cent", "iles", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Has", " ", "URL", ":", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "url", "count", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "\"%", ".2", "f", "\"_", "%_", "(_", "float_", "(_", "data_", "[_", "\"", "url", "count", "\"_", "]_", ")_", "/_", "float_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", "*_", "100.0_", ")_", ")_", "+_", "\"%", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "URL", "s", ":", " ", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "urls", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "URL", "s", " ", "percentile", "s", ":", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "data_", "[_", "\"", "urls", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "urls", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Has", " ", "Image", " ", "URL", ":", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "image", "url", "count", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "\"%", ".2", "f", "\"_", "%_", "(_", "float_", "(_", "data_", "[_", "\"", "image", "url", "count", "\"_", "]_", ")_", "/_", "float_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", "*_", "100.0_", ")_", ")_", "+_", "\"%", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Image", " ", "URL", "s", ":", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "image", "urls", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Image", " ", "URL", "s", " ", "percentile", "s", ":", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "data_", "[_", "\"", "image", "urls", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "image", "urls", "percentile", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Ret", "wee", "ts", ":", " ", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "retweet", "count", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "\"%", ".2", "f", "\"_", "%_", "(_", "float_", "(_", "data_", "[_", "\"", "retweet", "count", "\"_", "]_", ")_", "/_", "float_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", "*_", "100.0_", ")_", ")_", "+_", "\"%", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Geo", ":", " ", " ", " ", " ", " ", " ", "\"_", "+_", "\"{:", ">", "9", "}\"_", "._", "format_", "(_", "str_", "(_", "data_", "[_", "\"", "geoc", "ount", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "\"%", ".2", "f", "\"_", "%_", "(_", "float_", "(_", "data_", "[_", "\"", "geoc", "ount", "\"_", "]_", ")_", "/_", "float_", "(_", "data_", "[_", "\"", "count", "\"_", "]_", ")_", "*_", "100.0_", ")_", ")_", "+_", "\"%", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Earl", "ies", "t", ":", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "earliest", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Late", "st", ":", " ", " ", " ", "\"_", "+_", "str_", "(_", "data_", "[_", "\"", "late", "st", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Dur", "ation", ":", " ", " ", " ", " ", " ", "\"_", "+_", "str_", "(_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "data_", "[_", "\"", "late", "st", "\"_", "]_", ")_", "-_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "data_", "[_", "\"", "earliest", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Top", " ", "users", ":", " ", " ", " ", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "[_", "u_", "[_", "\"", "value", "\"_", "]_", "for_", "u_", "in_", "data_", "[_", "\"", "top", "users", "\"_", "]_", "]_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "data_", "[_", "\"", "top", "users", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"{:", ">", "7", "}\"_", "._", "format_", "(_", "str_", "(_", "user_", "[_", "\"", "value", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "\"_", "+_", "user_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Top", " ", "hashtag", "s", ":", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "[_", "u_", "[_", "\"", "value", "\"_", "]_", "for_", "u_", "in_", "data_", "[_", "\"", "top", "hashtag", "s", "\"_", "]_", "]_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hashtag", "_", "in_", "data_", "[_", "\"", "top", "hashtag", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"{:", ">", "7", "}\"_", "._", "format_", "(_", "str_", "(_", "hashtag", "_", "[_", "\"", "value", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "\"_", "+_", "hashtag", "_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Top", " ", "URL", "s", ":", " ", " ", " ", " ", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "[_", "u_", "[_", "\"", "value", "\"_", "]_", "for_", "u_", "in_", "data_", "[_", "\"", "top", "urls", "\"_", "]_", "]_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "data_", "[_", "\"", "top", "urls", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"{:", ">", "7", "}\"_", "._", "format_", "(_", "str_", "(_", "url_", "[_", "\"", "value", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "\"_", "+_", "url_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Top", " ", "Image", " ", "URL", "s", ":", " ", " ", " ", "\"_", "+_", "spark", "line_", "._", "spark", "ify_", "(_", "[_", "u_", "[_", "\"", "value", "\"_", "]_", "for_", "u_", "in_", "data_", "[_", "\"", "top", "image", "urls", "\"_", "]_", "]_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "image", "url_", "in_", "data_", "[_", "\"", "top", "image", "urls", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"{:", ">", "7", "}\"_", "._", "format_", "(_", "str_", "(_", "image", "url_", "[_", "\"", "value", "\"_", "]_", ")_", ")_", "+_", "\"", " ", "\"_", "+_", "image", "url_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
amrdraz/kodr/app/brython/www/src/Lib/test/test_platform.py
[ { "content": " def test_architecture(self):\n res = platform.architecture()", "metadata": "root.PlatformTest.test_architecture", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 10 }, { "content": " def test_platform(self):\n for aliased in (False, True):\n for terse in (False, True):\n res = platform.platform(aliased, terse)", "metadata": "root.PlatformTest.test_platform", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_system(self):\n res = platform.system()", "metadata": "root.PlatformTest.test_system", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_node(self):\n res = platform.node()", "metadata": "root.PlatformTest.test_node", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_release(self):\n res = platform.release()", "metadata": "root.PlatformTest.test_release", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_version(self):\n res = platform.version()", "metadata": "root.PlatformTest.test_version", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_machine(self):\n res = platform.machine()", "metadata": "root.PlatformTest.test_machine", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_processor(self):\n res = platform.processor()", "metadata": "root.PlatformTest.test_processor", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_system_alias(self):\n res = platform.system_alias(\n platform.system(),\n platform.release(),\n platform.version(),\n )", "metadata": "root.PlatformTest.test_system_alias", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_win32_ver(self):\n res = platform.win32_ver()", "metadata": "root.PlatformTest.test_win32_ver", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 181 }, { "content": " @unittest.skipUnless(sys.platform == 'darwin', \"OSX only test\")\n def test_mac_ver_with_fork(self):\n # Issue7895: platform.mac_ver() crashes when using fork without exec\n #\n # This test checks that the fix for that issue works.\n #\n pid = os.fork()\n if pid == 0:\n # child\n info = platform.mac_ver()\n os._exit(0)\n\n else:\n # parent\n cpid, sts = os.waitpid(pid, 0)\n self.assertEqual(cpid, pid)\n self.assertEqual(sts, 0)", "metadata": "root.PlatformTest.test_mac_ver_with_fork", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 217 }, { "content": " def test_dist(self):\n res = platform.dist()", "metadata": "root.PlatformTest.test_dist", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 235 }, { "content": " def test_libc_ver(self):\n import os\n if os.path.isdir(sys.executable) and \\\n os.path.exists(sys.executable+'.exe'):\n # Cygwin horror\n executable = sys.executable + '.exe'\n else:\n executable = sys.executable\n res = platform.libc_ver(executable)", "metadata": "root.PlatformTest.test_libc_ver", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_popen(self):\n mswindows = (sys.platform == \"win32\")\n\n if mswindows:\n command = '\"{}\" -c \"print(\\'Hello\\')\"'.format(sys.executable)\n else:\n command = \"'{}' -c 'print(\\\"Hello\\\")'\".format(sys.executable)\n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\", DeprecationWarning)\n with platform.popen(command) as stdout:\n hello = stdout.read().strip()\n stdout.close()\n self.assertEqual(hello, \"Hello\")\n\n data = 'plop'\n if mswindows:\n command = '\"{}\" -c \"import sys; data=sys.stdin.read(); exit(len(data))\"'\n else:\n command = \"'{}' -c 'import sys; data=sys.stdin.read(); exit(len(data))'\"\n command = command.format(sys.executable)\n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\", DeprecationWarning)\n with platform.popen(command, 'w') as stdin:\n stdout = stdin.write(data)\n ret = stdin.close()\n self.assertIsNotNone(ret)\n if os.name == 'nt':\n returncode = ret\n else:\n returncode = ret >> 8\n self.assertEqual(returncode, len(data))", "metadata": "root.PlatformTest.test_popen", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 } ]
[ { "span": "res ", "start_line": 11, "start_column": 8, "end_line": 11, "end_column": 11 }, { "span": "res ", "start_line": 37, "start_column": 16, "end_line": 37, "end_column": 19 }, { "span": "res ", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 11 }, { "span": "res ", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 11 }, { "span": "res ", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 11 }, { "span": "res ", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 11 }, { "span": "res ", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 11 }, { "span": "res ", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 11 }, { "span": "res ", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 11 }, { "span": "res ", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 11 }, { "span": "info ", "start_line": 226, "start_column": 12, "end_line": 226, "end_column": 16 }, { "span": "res ", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 11 }, { "span": "res ", "start_line": 246, "start_column": 8, "end_line": 246, "end_column": 11 }, { "span": "stdout ", "start_line": 288, "start_column": 16, "end_line": 288, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "architecture_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "architecture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "platform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "aliased", "_", "in_", "(_", "False_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ters", "e_", "in_", "(_", "False_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "platform_", "(_", "aliased", "_", ",_", "ters", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "system_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "system_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "release_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "machine_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "processor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "processor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "system", "\\u", "alias_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "system", "\\u", "alias_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "system_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "release_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "win32", "\\u", "ver_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "win32", "\\u", "ver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ",_", "\"", "OSX", " ", "only", " ", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "mac", "\\u", "ver", "\\u", "with", "\\u", "fork_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Issue", "789", "5", ":", " ", "platform", ".", "mac", "\\u", "ver", "()", " ", "crashes", " ", "whe", "n", " ", "usi", "ng", " ", "fork", " ", "with", "out", " ", "exec_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "checks", " ", "tha", "t", " ", "the", " ", "fix", " ", "for", " ", "tha", "t", " ", "issue", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pid_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "platform_", "._", "mac", "\\u", "ver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\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_", "#", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpi", "d_", ",_", "sts_", "=_", "os_", "._", "wait", "pid_", "(_", "pid_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cpi", "d_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sts_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "platform_", "._", "dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "libc", "\\u", "ver_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "sys_", "._", "executable_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "sys_", "._", "executable_", "+_", "'.", "exe", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cy", "gw", "in", " ", "hor", "ror_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executable_", "=_", "sys_", "._", "executable_", "+_", "'.", "exe", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executable_", "=_", "sys_", "._", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "platform_", "._", "libc", "\\u", "ver_", "(_", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "popen_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms", "windows_", "=_", "(_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ms", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'\"{", "}\"", " ", "-", "c", " ", "\"", "print", "(\\\\'", "Hell", "o", "\\\\')", "\"'_", "._", "format_", "(_", "sys_", "._", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"'{", "}'", " ", "-", "c", " ", "'", "print", "(\\\\\"", "Hell", "o", "\\\\\")", "'\"_", "._", "format_", "(_", "sys_", "._", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "\"", "ignore", "\"_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "platform_", "._", "popen_", "(_", "command_", ")_", "as_", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hello_", "=_", "stdout_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hello_", ",_", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "'", "plo", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ms", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'\"{", "}\"", " ", "-", "c", " ", "\"", "import", " ", "sys", ";", " ", "data", "=", "sys", ".", "std", "in", ".", "read", "();", " ", "exit", "(", "len", "(", "data", "))", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"'{", "}'", " ", "-", "c", " ", "'", "import", " ", "sys", ";", " ", "data", "=", "sys", ".", "std", "in", ".", "read", "();", " ", "exit", "(", "len", "(", "data", "))", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "command_", "._", "format_", "(_", "sys_", "._", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "\"", "ignore", "\"_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "platform_", "._", "popen_", "(_", "command_", ",_", "'", "w", "'_", ")_", "as_", "stdin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", "=_", "stdin_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "stdin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "returncode_", "=_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "returncode_", "=_", "ret_", ">>_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "returncode_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
saga-project/BigJob/pilot/coordination/nocoord_adaptor.py
[ { "content": "import logging\nimport json\nimport pdb\n\nfrom pilot import *\nfrom bigjob import logger\nfrom saga import Url as SAGAUrl\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NoCoordinationAdaptor:\n \"\"\"\n \tDummy Adaptor - No distributed coordination done \n \"\"\"\n BASE_URL=\"nocoord://localhost/\"\n BASE_URL_QUERY_STRING=\"?dbtype=sqlite3\"\n \n PILOT_PATH=\"pilot\"\n PILOT_DATA_PATH=PILOT_PATH\n PILOT_DATA_SERVICE_PATH=PILOT_DATA_PATH+\"/pds\"\n DATA_UNIT_SERVICE_PATH=PILOT_DATA_PATH+\"/dus\"\n COMPUTE_DATA_SERVICE_PATH = PILOT_DATA_PATH + \"/cds\"\n\n \n ###########################################################################\n # Construct a base url for an application\n \n \n ###########################################################################\n # Pilot Store Service related methods\n \n \n \n \n ###########################################################################\n # Pilot Data related methods\n \n \n \n \n \n \n \n \n \n ###########################################################################\n # Compute Data Service related methods\n \n \n \n \n \n \n \n ###########################################################################\n # Data Unit related methods\n\n \n \n \n \n \n \n \n \n \n \n ###########################################################################\n # URL Tweaking\n \n \n \n ###########################################################################\n # internal methods\n \n \n \n ", "metadata": "root.NoCoordinationAdaptor", "header": "['module', '___EOS___']", "index": 8 }, { "content": " @classmethod\n def get_base_url(cls, application_id):\n surl = SAGAUrl(cls.BASE_URL)\n base_url = surl.scheme + \"://\" + surl.host + \"/\" + application_id + \"/\"\n logger.debug(base_url)\n return base_url", "metadata": "root.NoCoordinationAdaptor.get_base_url", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 25 }, { "content": " @classmethod \n def add_pds(cls, application_url, pds):\n pds_url_no_dbtype = cls.get_pds_url(application_url, pds.id)\n pds_url = cls.__get_url(pds_url_no_dbtype)\n logger.debug(\"Create PDS directory at %s\"%pds_url)\n #saga.advert.directory(pds_url, saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n return pds_url_no_dbtype", "metadata": "root.NoCoordinationAdaptor.add_pds", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 35 }, { "content": " @classmethod\n def delete_pds(cls, pds_url):\n pds_url = cls.__get_url(pds_url)\n #pds_dir = saga.advert.directory(saga.url(pds_url), \n # saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n #pds_dir.remove(pds_url, saga.name_space.Recursive) ", "metadata": "root.NoCoordinationAdaptor.delete_pds", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 46 }, { "content": " @classmethod\n def add_pd(cls, pds_url, pd):\n pds_url = cls.__remove_dbtype(pds_url) \n pd_url =pds_url+\"/\" + pd.id\n pd_description_url = cls.__get_url(pd_url + \"/description\")\n logger.debug(\"PDS URL: %s, PD Description URL: %s\"%(pds_url, pd_description_url))\n # directory is recursively created\n #pd_desc_entry = saga.advert.entry(saga.url(pd_description_url),\n # saga.advert.Create | saga.advert.CreateParents | saga.advert.ReadWrite)\n #logger.debug(\"initialized advert entry for pds: \" + pd_description_url)\n #pd_desc_entry.store_string(json.dumps(pd.data_unit_description))\n return pd_url", "metadata": "root.NoCoordinationAdaptor.add_pd", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 58 }, { "content": " @classmethod\n def update_pd(cls, pd):\n if len(pd.data_units) > 0:\n du_urls = [i.url for i in pd.data_units.values()]\n #cls.__store_entry(cls.__remove_dbtype(pd.url)+\"/data-units\", du_urls)\n #cls.__store_entry(cls.__remove_dbtype(pd.url)+\"/pilot-data\", pd.to_dict())", "metadata": "root.NoCoordinationAdaptor.update_pd", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 71 }, { "content": " @classmethod\n def get_pd(cls, pds_url):\n logger.debug(\"GET PD: \" + pds_url) \n pd_dict={} \n #pd_dict[\"pilot_data\" ]= cls.__retrieve_entry(cls.__remove_dbtype(pds_url)+\"/pilot-data\")\n #pd_dict[\"pilot_data\"] = cls.__retrieve_entry(cls.__remove_dbtype(pds_url)+\"/pilot-data\") \n #return pd_dict", "metadata": "root.NoCoordinationAdaptor.get_pd", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 79 }, { "content": " @classmethod\n def list_pd(cls, pds_url):\n \"\"\" return a list of urls to pd managed by the PDS \"\"\"\n pds_url = cls.__get_url(pds_url)\n logger.debug(\"List PD at %s\"%pds_url)\n #pds_dir = saga.advert.directory(pds_url, saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n \n #pd_list = pds_dir.list()\n #pd_full_urls = []\n #for i in pd_list:\n # pd_full_urls.append(pds_url + \"/\" + i) \n #return pd_full_urls", "metadata": "root.NoCoordinationAdaptor.list_pd", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 88 }, { "content": " @classmethod\n def delete_pd(cls, pds_url):\n pds_url = cls.__get_url(pds_url)\n #pd_dir = saga.advert.directory(saga.url(pds_url), \n # saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n #pd_dir.remove(pds_url, saga.name_space.Recursive) ", "metadata": "root.NoCoordinationAdaptor.delete_pd", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 103 }, { "content": " @classmethod \n def add_cds(cls, application_url, cds):\n cds_url_no_dbtype = cls.get_cds_url(application_url, cds.id)\n cds_url = cls.__get_url(cds_url_no_dbtype)\n logger.debug(\"Create CDS directory at %s\"%cds_url)\n #saga.advert.directory(cds_url, saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n return cds_url_no_dbtype", "metadata": "root.NoCoordinationAdaptor.add_cds", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 115 }, { "content": " @classmethod \n def update_cds(cls, cds_url, cds):\n \n # Storage and Compute Resources\n pds_urls = [cls.__remove_dbtype(i.url) for i in cds.pilot_data_services]\n #cls.__store_entry(cls.__remove_dbtype(cds_url)+\"/pds/\", pds_urls)\n \n pjs_urls = [i.url for i in cds.pilot_job_services]\n #cls.__store_entry(cls.__remove_dbtype(cds_url)+\"/cds/\", pjs_urls)\n \n # currently managed PDs and WUs\n pd_urls = [i.url for i in cds.data_units.values()]\n #cls.__store_entry(cls.__remove_dbtype(cds_url)+\"/du/\", pd_urls)\n \n wu_urls = [i.url for i in cds.compute_units.values()]\n #cls.__store_entry(cls.__remove_dbtype(cds_url)+\"/cu/\", wu_urls)", "metadata": "root.NoCoordinationAdaptor.update_cds", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 125 }, { "content": " @classmethod\n def delete_cds(cls, cds_url):\n cds_url = cls.__get_url(cls.__remove_dbtype(cds_url))\n #cds_dir = saga.advert.directory(saga.url(cds_url), \n # saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n # cds_dir.remove(cds_url, saga.name_space.Recursive)", "metadata": "root.NoCoordinationAdaptor.delete_cds", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 143 }, { "content": " @classmethod\n def add_du(cls, dus_url, du):\n du_url = cls.__remove_dbtype(dus_url) + \"/\" + du.id \n du_url = cls.__get_url(du_url)\n # directory is recursively created\n #saga.advert.directory(saga.url(du_url),\n # saga.advert.Create | saga.advert.CreateParents | saga.advert.ReadWrite)\n #logger.debug(\"initialized advert entry for dus: \" + du_url)\n return du_url", "metadata": "root.NoCoordinationAdaptor.add_du", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 157 }, { "content": " @classmethod\n def get_du(cls, du_url):\n logger.debug(\"**** GET PD: \" + du_url)\n du_dict={} \n #du_dict[\"data_unit_description\" ]= cls.__retrieve_entry(cls.__remove_dbtype(du_url)+\"/description\")\n #du_dict[\"state\"] = cls.__retrieve_entry(cls.__remove_dbtype(du_url)+\"/state\") \n #du_dict[\"data_units\"] = cls.__retrieve_entry(cls.__remove_dbtype(du_url)+\"/data-units\")\n #du_dict[\"pilot_data\"] = cls.__retrieve_entry(cls.__remove_dbtype(du_url)+\"/pilot-data\") \n #logger.debug(\"Open pilot data at: \" + du_url + \" State: \" + str(du_dict)) \n return du_dict", "metadata": "root.NoCoordinationAdaptor.get_du", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 168 }, { "content": " @classmethod \n def update_du(cls, du):\n logger.debug(\"**** Update pilot data at: \" + du.url)\n #cls.__store_entry(cls.__remove_dbtype(du.url)+\"/description\", du.data_unit_description)\n #cls.__store_entry(cls.__remove_dbtype(du.url)+\"/state\", du.state)\n \n du_urls = [i.url for i in du.pilot_data]\n #cls.__store_entry(cls.__remove_dbtype(du.url)+\"/pilot-data\", du_urls)\n \n du_dict_list = [i.to_dict() for i in du.data_unit_items]\n #cls.__store_entry(cls.__remove_dbtype(du.url)+\"/data-units\", du_dict_list)", "metadata": "root.NoCoordinationAdaptor.update_du", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 180 }, { "content": " @classmethod\n def list_du(cls, dus_url):\n \"\"\" return a list of urls to du managed by the PDS \"\"\"\n dus_url = cls.__get_url(dus_url)\n logger.debug(\"List PDS at %s\"%dus_url)\n #dus_dir = saga.advert.directory(dus_url, saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n \n #du_list = dus_dir.list()\n #du_full_urls = []\n #for i in du_list:\n # du_full_urls.append(dus_url + \"/\" + i) \n return du_full_urls", "metadata": "root.NoCoordinationAdaptor.list_du", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 193 }, { "content": " @classmethod\n def delete_du(cls, du_url):\n du_url = cls.__get_url(du_url)\n #du_dir = saga.advert.directory(saga.url(du_url), \n # saga.advert.Create | \n # saga.advert.CreateParents | \n # saga.advert.ReadWrite)\n #du_dir.remove(du_url, saga.name_space.Recursive) ", "metadata": "root.NoCoordinationAdaptor.delete_du", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 209 }, { "content": " @classmethod\n def get_pds_url(cls, application_url, pds_id):\n pds_url = application_url+NoCoordinationAdaptor.PILOT_DATA_SERVICE_PATH+\"/\"+pds_id \n logger.debug(\"PDS URL: %s\"%(pds_url))\n return pds_url", "metadata": "root.NoCoordinationAdaptor.get_pds_url", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 223 }, { "content": " @classmethod\n def get_cds_url(cls, application_url, cds_id):\n cds_url = application_url+NoCoordinationAdaptor.COMPUTE_DATA_SERVICE_PATH+\"/\"+cds_id \n logger.debug(\"CDS URL: %s\"%(cds_url))\n return cds_url", "metadata": "root.NoCoordinationAdaptor.get_cds_url", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 229 }, { "content": " @classmethod\n def __get_url(cls, url):\n \"\"\" appends advert querystring for dbtype to url \"\"\"\n url = url + NoCoordinationAdaptor.BASE_URL_QUERY_STRING\n return url", "metadata": "root.NoCoordinationAdaptor.__get_url", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 238 }, { "content": " @classmethod\n def __remove_dbtype(cls, url):\n surl = SAGAUrl(url)\n return str(surl)", "metadata": "root.NoCoordinationAdaptor.__remove_dbtype", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 244 }, { "content": " @classmethod\n def __store_entry(cls, entry_url, content):\n entry_url = cls.__get_url(entry_url)\n \n # directory is recursively created\n #entry = saga.advert.entry(saga.url(entry_url),\n # saga.advert.Create | \n # saga.advert.CreateParents | saga.advert.ReadWrite)\n #entry.store_string(json.dumps(content))\n #logger.debug(\"Store Advert entry at: \" + entry_url \n # + \" Content: \" + str(json.dumps(content)))", "metadata": "root.NoCoordinationAdaptor.__store_entry", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 249 }, { "content": " @classmethod\n def __retrieve_entry(cls, entry_url):\n entry_url = cls.__get_url(entry_url)\n #logger.debug(\"Retrieve Advert entry at: \" + entry_url)\n # directory is recursively created\n #entry = saga.advert.entry(saga.url(entry_url),\n # saga.advert.Create | \n # saga.advert.CreateParents | saga.advert.ReadWrite)\n #content = json.loads(entry.retrieve_string())\n #logger.debug(\"Retrieve Advert entry at: \" + entry_url \n # + \" Content: \" + str(json.dumps(content)))\n return content", "metadata": "root.NoCoordinationAdaptor.__retrieve_entry", "header": "['class', 'NoCoordinationAdaptor', ':', '___EOS___']", "index": 261 } ]
[ { "span": "import logging", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 }, { "span": "import json", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 }, { "span": "import pdb", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pilot", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "big", "job_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sag", "a_", "import_", "Url_", "as_", "SA", "GAU", "rl_", "\\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_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " \t", "Du", "mm", "y", " ", "Adapt", "or", " ", "-", " ", "No", " ", "distributed", " ", "coordin", "ation", " ", "don", "e", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "URL_", "=_", "\"", "noco", "ord", "://", "local", "host", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "URL", "\\u", "QUE", "RY", "\\u", "STRING_", "=_", "\"?", "dbt", "ype", "=", "sql", "ite", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PI", "LOT", "\\u", "PATH_", "=_", "\"", "pilot", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PI", "LOT", "\\u", "DATA", "\\u", "PATH_", "=_", "PI", "LOT", "\\u", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PI", "LOT", "\\u", "DATA", "\\u", "SERV", "ICE", "\\u", "PATH_", "=_", "PI", "LOT", "\\u", "DATA", "\\u", "PATH_", "+_", "\"/", "pd", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "\\u", "UNIT", "\\u", "SERV", "ICE", "\\u", "PATH_", "=_", "PI", "LOT", "\\u", "DATA", "\\u", "PATH_", "+_", "\"/", "dus", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMPUTE", "\\u", "DATA", "\\u", "SERV", "ICE", "\\u", "PATH_", "=_", "PI", "LOT", "\\u", "DATA", "\\u", "PATH_", "+_", "\"/", "cds", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "a", " ", "base", " ", "url", " ", "for", " ", "an", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pilo", "t", " ", "Stor", "e", " ", "Service", " ", "relate", "d", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pilo", "t", " ", "Data", " ", "relate", "d", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "Data", " ", "Service", " ", "relate", "d", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Data", " ", "Unit", " ", "relate", "d", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "Twe", "aki", "ng_", "\\u\\u\\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_", "#", " ", "internal", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "url_", "(_", "cls_", ",_", "applica", "tion", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sur", "l_", "=_", "SA", "GAU", "rl_", "(_", "cls_", "._", "BASE", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "url_", "=_", "sur", "l_", "._", "scheme_", "+_", "\":", "//", "\"_", "+_", "sur", "l_", "._", "host_", "+_", "\"/\"_", "+_", "applica", "tion", "\\u", "id_", "+_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "base", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "base", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "add", "\\u", "pd", "s_", "(_", "cls_", ",_", "applica", "tion", "\\u", "url_", ",_", "pd", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", "=_", "cls_", "._", "get", "\\u", "pd", "s", "\\u", "url_", "(_", "applica", "tion", "\\u", "url_", ",_", "pd", "s_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "s", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "pd", "s", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Creat", "e", " ", "PD", "S", " ", "director", "y", " ", "at", " ", "%", "s", "\"_", "%_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "pd", "s", "\\u", "url", ",", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "pd", "s", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "pd", "s_", "(_", "cls_", ",_", "pd", "s", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pd", "s", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "sag", "a", ".", "url", "(", "pd", "s", "\\u", "url", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "s", "\\u", "dir", ".", "remove", "(", "pd", "s", "\\u", "url", ",", " ", "sag", "a", ".", "name", "\\u", "space", ".", "Recursive", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "add", "\\u", "pd_", "(_", "cls_", ",_", "pd", "s", "\\u", "url_", ",_", "pd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "remove", "\\u", "dbt", "ype_", "(_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "\\u", "url_", "=_", "pd", "s", "\\u", "url_", "+_", "\"/\"_", "+_", "pd_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "\\u", "description", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "pd", "\\u", "url_", "+_", "\"/", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "PD", "S", " ", "URL", ":", " ", "%", "s", ",", " ", "PD", " ", "Descripti", "on", " ", "URL", ":", " ", "%", "s", "\"_", "%_", "(_", "pd", "s", "\\u", "url_", ",_", "pd", "\\u", "description", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "director", "y", " ", "is", " ", "recurs", "ively", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "desc", "\\u", "entry", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "entry", "(", "sag", "a", ".", "url", "(", "pd", "\\u", "description", "\\u", "url", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "initialize", "d", " ", "adver", "t", " ", "entry", " ", "for", " ", "pd", "s", ":", " ", "\"", " ", "+", " ", "pd", "\\u", "description", "\\u", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "desc", "\\u", "entry", ".", "store", "\\u", "string", "(", "json", ".", "dump", "s", "(", "pd", ".", "data\\u", "unit", "\\u", "description", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "pd", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "update", "\\u", "pd_", "(_", "cls_", ",_", "pd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "pd_", "._", "data\\u", "units_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "du", "\\u", "urls_", "=_", "[_", "i_", "._", "url_", "for_", "i_", "in_", "pd_", "._", "data\\u", "units_", "._", "values_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "pd", ".", "url", ")+", "\"/", "data", "-", "unit", "s", "\",", " ", "du", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "pd", ".", "url", ")+", "\"/", "pilot", "-", "data", "\",", " ", "pd", ".", "to", "\\u", "dict", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "get", "\\u", "pd_", "(_", "cls_", ",_", "pd", "s", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "GET", " ", "PD", ":", " ", "\"_", "+_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pd", "\\u", "dict", "[\"", "pilot", "\\u", "data", "\"", " ", "]=", " ", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "pd", "s", "\\u", "url", ")+", "\"/", "pilot", "-", "data", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "dict", "[\"", "pilot", "\\u", "data", "\"]", " ", "=", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "pd", "s", "\\u", "url", ")+", "\"/", "pilot", "-", "data", "\")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "pd", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "list", "\\u", "pd_", "(_", "cls_", ",_", "pd", "s", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "return", " ", "a", " ", "list", " ", "of", " ", "urls", " ", "to", " ", "pd", " ", "manage", "d", " ", "by", " ", "the", " ", "PD", "S", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd", "s", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "List", " ", "PD", " ", "at", " ", "%", "s", "\"_", "%_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pd", "s", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "pd", "s", "\\u", "url", ",", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "list", " ", "=", " ", "pd", "s", "\\u", "dir", ".", "list", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "full", "\\u", "urls", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "i", " ", "in", " ", "pd", "\\u", "list", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pd", "\\u", "full", "\\u", "urls", ".", "append", "(", "pd", "s", "\\u", "url", " ", "+", " ", "\"/", "\"", " ", "+", " ", "i", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "pd", "\\u", "full", "\\u", "urls_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "pd_", "(_", "cls_", ",_", "pd", "s", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "pd", "s", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pd", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "sag", "a", ".", "url", "(", "pd", "s", "\\u", "url", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pd", "\\u", "dir", ".", "remove", "(", "pd", "s", "\\u", "url", ",", " ", "sag", "a", ".", "name", "\\u", "space", ".", "Recursive", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "add", "\\u", "cds", "_", "(_", "cls_", ",_", "applica", "tion", "\\u", "url_", ",_", "cds", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cds", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", "=_", "cls_", "._", "get", "\\u", "cds", "\\u", "url_", "(_", "applica", "tion", "\\u", "url_", ",_", "cds", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cds", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "cds", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Creat", "e", " ", "CD", "S", " ", "director", "y", " ", "at", " ", "%", "s", "\"_", "%_", "cds", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "cds", "\\u", "url", ",", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cds", "\\u", "url", "\\u", "no", "\\u", "dbt", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "update", "\\u", "cds", "_", "(_", "cls_", ",_", "cds", "\\u", "url_", ",_", "cds", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "age", " ", "and", " ", "Compute", " ", "Resources_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "urls_", "=_", "[_", "cls_", "._", "\\u\\u", "remove", "\\u", "dbt", "ype_", "(_", "i_", "._", "url_", ")_", "for_", "i_", "in_", "cds", "_", "._", "pilot", "\\u", "data\\u", "services_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "cds", "\\u", "url", ")+", "\"/", "pd", "s", "/\"", ",", " ", "pd", "s", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pj", "s", "\\u", "urls_", "=_", "[_", "i_", "._", "url_", "for_", "i_", "in_", "cds", "_", "._", "pilot", "\\u", "job", "\\u", "services_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "cds", "\\u", "url", ")+", "\"/", "cds", "/\"", ",", " ", "pj", "s", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "manage", "d", " ", "PD", "s", " ", "and", " ", "WU", "s_", "\\u\\u\\uNL\\u\\u\\u_", "pd", "\\u", "urls_", "=_", "[_", "i_", "._", "url_", "for_", "i_", "in_", "cds", "_", "._", "data\\u", "units_", "._", "values_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "cds", "\\u", "url", ")+", "\"/", "du", "/\"", ",", " ", "pd", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wu", "\\u", "urls_", "=_", "[_", "i_", "._", "url_", "for_", "i_", "in_", "cds", "_", "._", "compute", "\\u", "units_", "._", "values_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "cds", "\\u", "url", ")+", "\"/", "cu", "/\"", ",", " ", "wu", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "cds", "_", "(_", "cls_", ",_", "cds", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cds", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "cls_", "._", "\\u\\u", "remove", "\\u", "dbt", "ype_", "(_", "cds", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cds", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "sag", "a", ".", "url", "(", "cds", "\\u", "url", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cds", "\\u", "dir", ".", "remove", "(", "cds", "\\u", "url", ",", " ", "sag", "a", ".", "name", "\\u", "space", ".", "Recursive", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "add", "\\u", "du_", "(_", "cls_", ",_", "dus", "\\u", "url_", ",_", "du_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "du", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "remove", "\\u", "dbt", "ype_", "(_", "dus", "\\u", "url_", ")_", "+_", "\"/\"_", "+_", "du_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "du", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "du", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "director", "y", " ", "is", " ", "recurs", "ively", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "sag", "a", ".", "url", "(", "du", "\\u", "url", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "initialize", "d", " ", "adver", "t", " ", "entry", " ", "for", " ", "dus", ":", " ", "\"", " ", "+", " ", "du", "\\u", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "du", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "get", "\\u", "du_", "(_", "cls_", ",_", "du", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"****", " ", "GET", " ", "PD", ":", " ", "\"_", "+_", "du", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "du", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "du", "\\u", "dict", "[\"", "data\\u", "unit", "\\u", "description", "\"", " ", "]=", " ", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", "\\u", "url", ")+", "\"/", "description", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "dict", "[\"", "state", "\"]", " ", "=", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", "\\u", "url", ")+", "\"/", "state", "\")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "dict", "[\"", "data\\u", "unit", "s", "\"]", " ", "=", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", "\\u", "url", ")+", "\"/", "data", "-", "unit", "s", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "dict", "[\"", "pilot", "\\u", "data", "\"]", " ", "=", " ", " ", "cls", ".\\u", "\\u", "retrieve", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", "\\u", "url", ")+", "\"/", "pilot", "-", "data", "\")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "Open", " ", "pilot", " ", "data", " ", "at", ":", " ", "\"", " ", "+", " ", "du", "\\u", "url", " ", "+", " ", "\"", " ", "State", ":", " ", "\"", " ", "+", " ", "str", "(", "du", "\\u", "dict", "))", " _", "\\u\\u\\uNL\\u\\u\\u_", "return_", "du", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "update", "\\u", "du_", "(_", "cls_", ",_", "du_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"****", " ", "Update", " ", "pilot", " ", "data", " ", "at", ":", " ", "\"_", "+_", "du_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", ".", "url", ")+", "\"/", "description", "\",", " ", "du", ".", "data\\u", "unit", "\\u", "description", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", ".", "url", ")+", "\"/", "state", "\",", " ", "du", ".", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "du", "\\u", "urls_", "=_", "[_", "i_", "._", "url_", "for_", "i_", "in_", "du_", "._", "pilot", "\\u", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", ".", "url", ")+", "\"/", "pilot", "-", "data", "\",", " ", "du", "\\u", "urls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "du", "\\u", "dict", "\\u", "list_", "=_", "[_", "i_", "._", "to", "\\u", "dict_", "(_", ")_", "for_", "i_", "in_", "du_", "._", "data\\u", "unit", "\\u", "items_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cls", ".\\u", "\\u", "store", "\\u", "entry", "(", "cls", ".\\u", "\\u", "remove", "\\u", "dbt", "ype", "(", "du", ".", "url", ")+", "\"/", "data", "-", "unit", "s", "\",", " ", "du", "\\u", "dict", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "list", "\\u", "du_", "(_", "cls_", ",_", "dus", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "return", " ", "a", " ", "list", " ", "of", " ", "urls", " ", "to", " ", "du", " ", "manage", "d", " ", "by", " ", "the", " ", "PD", "S", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dus", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "dus", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "List", " ", "PD", "S", " ", "at", " ", "%", "s", "\"_", "%_", "dus", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dus", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "dus", "\\u", "url", ",", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "list", " ", "=", " ", "dus", "\\u", "dir", ".", "list", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "full", "\\u", "urls", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "i", " ", "in", " ", "du", "\\u", "list", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "du", "\\u", "full", "\\u", "urls", ".", "append", "(", "dus", "\\u", "url", " ", "+", " ", "\"/", "\"", " ", "+", " ", "i", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "return_", "du", "\\u", "full", "\\u", "urls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "du_", "(_", "cls_", ",_", "du", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "du", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "du", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "du", "\\u", "dir", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "director", "y", "(", "sag", "a", ".", "url", "(", "du", "\\u", "url", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "du", "\\u", "dir", ".", "remove", "(", "du", "\\u", "url", ",", " ", "sag", "a", ".", "name", "\\u", "space", ".", "Recursive", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "get", "\\u", "pd", "s", "\\u", "url_", "(_", "cls_", ",_", "applica", "tion", "\\u", "url_", ",_", "pd", "s", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pd", "s", "\\u", "url_", "=_", "applica", "tion", "\\u", "url_", "+_", "No", "Coordinat", "ion", "Adapt", "or_", "._", "PI", "LOT", "\\u", "DATA", "\\u", "SERV", "ICE", "\\u", "PATH_", "+_", "\"/\"_", "+_", "pd", "s", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "PD", "S", " ", "URL", ":", " ", "%", "s", "\"_", "%_", "(_", "pd", "s", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pd", "s", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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_", "get", "\\u", "cds", "\\u", "url_", "(_", "cls_", ",_", "applica", "tion", "\\u", "url_", ",_", "cds", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cds", "\\u", "url_", "=_", "applica", "tion", "\\u", "url_", "+_", "No", "Coordinat", "ion", "Adapt", "or_", "._", "COMPUTE", "\\u", "DATA", "\\u", "SERV", "ICE", "\\u", "PATH_", "+_", "\"/\"_", "+_", "cds", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "CD", "S", " ", "URL", ":", " ", "%", "s", "\"_", "%_", "(_", "cds", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cds", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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\\u", "get", "\\u", "url_", "(_", "cls_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "append", "s", " ", "adver", "t", " ", "querystring", " ", "for", " ", "dbt", "ype", " ", "to", " ", "url", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "url_", "+_", "No", "Coordinat", "ion", "Adapt", "or_", "._", "BASE", "\\u", "URL", "\\u", "QUE", "RY", "\\u", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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\\u", "remove", "\\u", "dbt", "ype_", "(_", "cls_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sur", "l_", "=_", "SA", "GAU", "rl_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "(_", "sur", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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\\u", "store", "\\u", "entry_", "(_", "cls_", ",_", "entry", "\\u", "url_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "entry", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "is", " ", "recurs", "ively", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", "entry", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "entry", "(", "sag", "a", ".", "url", "(", "entry", "\\u", "url", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "entry", ".", "store", "\\u", "string", "(", "json", ".", "dump", "s", "(", "content", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "Stor", "e", " ", "Advert", " ", "entry", " ", "at", ":", " ", "\"", " ", "+", " ", "entry", "\\u", "url", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "+", " ", "\"", " ", "Conten", "t", ":", " ", "\"", " ", "+", " ", "str", "(", "json", ".", "dump", "s", "(", "content", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Coordinat", "ion", "Adapt", "or_", ":_", "\\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\\u", "retrieve", "\\u", "entry_", "(_", "cls_", ",_", "entry", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry", "\\u", "url_", "=_", "cls_", "._", "\\u\\u", "get", "\\u", "url_", "(_", "entry", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "Retrieve", " ", "Advert", " ", "entry", " ", "at", ":", " ", "\"", " ", "+", " ", "entry", "\\u", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "is", " ", "recurs", "ively", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", "entry", " ", "=", " ", "sag", "a", ".", "adver", "t", ".", "entry", "(", "sag", "a", ".", "url", "(", "entry", "\\u", "url", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", " ", "|", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sag", "a", ".", "adver", "t", ".", "Creat", "e", "Parent", "s", " ", "|", " ", "sag", "a", ".", "adver", "t", ".", "Read", "Write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "content", " ", "=", " ", "json", ".", "load", "s", "(", "entry", ".", "retrieve", "\\u", "string", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "Retrieve", " ", "Advert", " ", "entry", " ", "at", ":", " ", "\"", " ", "+", " ", "entry", "\\u", "url", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "+", " ", "\"", " ", "Conten", "t", ":", " ", "\"", " ", "+", " ", "str", "(", "json", ".", "dump", "s", "(", "content", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "content_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/gadget/guestimport.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport os.path\nimport re\nimport glob\nimport time\n\nimport web\nimport simplejson as json\n\nimport karesansui\nfrom karesansui.gadget.guest import regist_guest\nfrom karesansui.lib.rest import Rest, auth\n\nfrom karesansui.lib.utils import chk_create_disk, json_dumps, is_param, \\\n base64_encode, base64_decode, get_dom_list, get_dom_type, \\\n string_from_uuid, generate_uuid, comma_split, uniq_sort, get_partition_info\n\nfrom karesansui.lib.const import \\\n VIRT_COMMAND_IMPORT_GUEST\n\nfrom karesansui.lib.virt.virt import KaresansuiVirtConnection\nfrom karesansui.lib.virt.config import ConfigParam\nfrom karesansui.lib.virt.config_export import ExportConfigParam\n\nfrom karesansui.db.access.machine import findbyhost1\nfrom karesansui.db.access.machine2jobgroup import new as m2j_new\nfrom karesansui.db.access._2pysilhouette import save_job_collaboration\n\nfrom pysilhouette.command import dict2command\nfrom karesansui.db.model._2pysilhouette import Job, JobGroup\n\nfrom karesansui.db.access.machine import new as m_new, findby1uniquekey as m_findby1uniquekey\nfrom karesansui.db.access.notebook import new as n_new\nfrom karesansui.db.access.tag import new as t_new\nfrom karesansui.db.access.machine import findby1 as m_findby1\nfrom karesansui.db.access.notebook import findby1 as n_findby1\nfrom karesansui.db.access.tag import findby1 as t_findby1\nfrom karesansui.db.access.tag import samecount as t_count\nfrom karesansui.db.access.tag import findby1name as t_name\n\nfrom karesansui.lib.checker import Checker, \\\n CHECK_EMPTY, CHECK_VALID, CHECK_ISDIR, CHECK_STARTROOT, CHECK_EXIST\n\nfrom karesansui.lib.utils import get_xml_parse as XMLParse\nfrom karesansui.lib.utils import get_xml_xpath as XMLXpath\nfrom karesansui.lib.utils import get_nums_xml_xpath as XMLXpathNum\nfrom karesansui.lib.file.configfile import ConfigFile\n\n\n\n\nurls = (\n '/host/(\\d+)/guestimport/?(\\.part)$', GuestImport,\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def validates_guest_import(obj):\n checker = Checker()\n check = True\n\n _ = obj._\n checker.errors = []\n # TODO UUID check\n\n obj.view.alert = checker.errors\n return check", "metadata": "root.validates_guest_import", "header": "['module', '___EOS___']", "index": 72 }, { "content": "class GuestImport(Rest):\n\n #@auth\n #def _GET(self, *param, **params):\n # return web.seeother()\n", "metadata": "root.GuestImport", "header": "['module', '___EOS___']", "index": 84 }, { "content": " @auth\n def _POST(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n model = findbyhost1(self.orm, host_id)\n\n if not validates_guest_import(self):\n return web.badrequest(self.view.alert)\n\n uuid = self.input.uuid\n kvc = KaresansuiVirtConnection()\n try:\n # Storage Pool\n #inactive_pool = kvc.list_inactive_storage_pool()\n inactive_pool = []\n active_pool = kvc.list_active_storage_pool()\n pools = inactive_pool + active_pool\n pools.sort()\n\n export = []\n for pool_name in pools:\n pool = kvc.search_kvn_storage_pools(pool_name)\n path = pool[0].get_info()[\"target\"][\"path\"]\n if os.path.exists(path):\n for _afile in glob.glob(\"%s/*/info.dat\" % (path,)):\n e_param = ExportConfigParam()\n e_param.load_xml_config(_afile)\n\n if e_param.get_uuid() != uuid:\n continue\n\n e_name = e_param.get_domain()\n _dir = os.path.dirname(_afile)\n\n param = ConfigParam(e_name)\n\n path = \"%s/%s.xml\" % (_dir, e_name)\n if os.path.isfile(path) is False:\n self.logger.error('Export corrupt data.(file not found) - path=%s' % path)\n return web.internalerror()\n\n param.load_xml_config(path)\n\n if e_name != param.get_domain_name():\n self.logger.error('Export corrupt data.(The name does not match) - info=%s, xml=%s' \\\n % (e_name, param.get_name()))\n return web.internalerror()\n\n _dir = os.path.dirname(_afile)\n\n title = e_param.get_title()\n if title != \"\":\n title = re.sub(\"[\\r\\n]\",\"\",title)\n if title == \"\":\n title = _('untitled')\n\n created = e_param.get_created()\n if created != \"\":\n created_str = time.strftime(\"%Y/%m/%d %H:%M:%S\", \\\n time.localtime(float(created)))\n else:\n created_str = _(\"N/A\")\n\n export.append({\"info\" : {\"dir\" : _dir,\n \"pool\" : pool_name,\n \"uuid\" : e_param.get_uuid(),\n \"name\" : e_param.get_domain(),\n \"created\" : int(created),\n \"created_str\" : created_str,\n \"title\" : title,\n \"database\" : {\"name\" : e_param.database[\"name\"],\n \"tags\" : e_param.database[\"tags\"],\n \"attribute\" : e_param.database[\"attribute\"],\n \"notebook\" : {\"title\" : e_param.database[\"notebook\"][\"title\"],\n \"value\" : e_param.database[\"notebook\"][\"value\"],\n },\n \"uniq_key\" : e_param.database[\"uniq_key\"],\n \"hypervisor\" : e_param.database[\"hypervisor\"],\n \"icon\" : e_param.database[\"icon\"],\n },\n },\n \"xml\" : {\"on_reboot\" : param.get_behavior('on_reboot'),\n \"on_poweroff\" : param.get_behavior('on_poweroff'),\n \"on_crash\" : param.get_behavior('on_crash'),\n \"boot_dev\" : param.get_boot_dev(),\n #\"bootloader\" : param.get_bootloader(),\n #\"commandline\" : param.get_commandline(),\n #\"current_snapshot\" : param.get_current_snapshot(),\n 'disk' : param.get_disk(),\n \"domain_name\" : param.get_domain_name(),\n \"domain_type\" : param.get_domain_type(),\n \"features_acpi\" : param.get_features_acpi(),\n \"features_apic\" : param.get_features_apic(),\n \"features_pae\" : param.get_features_pae(),\n #\"initrd\" : param.get_initrd(),\n \"interface\" : param.get_interface(),\n #\"kernel\" : param.get_kernel(),\n \"max_memory\" : param.get_max_memory(),\n 'max_vcpus' : param.get_max_vcpus(),\n \"max_vcpus_limit\" : param.get_max_vcpus_limit(),\n \"memory\" : param.get_memory(),\n \"uuid\" : param.get_uuid(),\n \"vcpus\" : param.get_vcpus(),\n \"vcpus_limit\" : param.get_vcpus_limit(),\n \"graphics_autoport\" : param.get_graphics_autoport(),\n \"keymap\" : param.get_graphics_keymap(),\n \"graphics_listen\" : param.get_graphics_listen(),\n \"graphics_passwd\" : param.get_graphics_passwd(),\n \"graphics_port\" : param.get_graphics_port(),\n },\n \"pool\" : pool[0].get_info(),\n })\n if len(export) != 1:\n self.logger.info(\"Export does not exist. - uuid=%s\" % self.view.uuid)\n return web.badrequest()\n else:\n export = export[0]\n finally:\n kvc.close()\n\n # Pool running?\n if export['pool']['is_active'] is False:\n return web.badrequest(\"The destination, the storage pool is not running.\")\n\n dest_domname = export['xml']['domain_name']\n dest_uniqkey = export['info']['database']['uniq_key']\n # Same guest OS is already running.\n if m_findby1uniquekey(self.orm, dest_uniqkey) is not None:\n self.logger.info(_(\"guest '%s' already exists. (DB) - %s\") % (dest_domname, dest_uniqkey))\n return web.badrequest(_(\"guest '%s' already exists.\") % dest_domname)\n\n dest_dir = \"%s/%s\" % (export['pool']['target']['path'], export['xml']['domain_name'])\n if os.path.exists(dest_dir) is True:\n self.logger.info(_(\"guest '%s' already exists. (FS) - %s\") % (dest_domname, dest_dir))\n return web.badrequest(_(\"guest '%s' already exists.\") % dest_domname)\n\n # disk check\n try:\n src_disk = \"%s/%s/images/%s.img\" \\\n % (export[\"info\"][\"dir\"], export[\"info\"][\"name\"], export[\"info\"][\"name\"])\n\n if os.path.exists(src_disk):\n s_size = os.path.getsize(src_disk) / (1024 * 1024) # a unit 'MB'\n if chk_create_disk(export[\"info\"][\"dir\"], s_size) is False:\n partition = get_partition_info(export[\"info\"][\"dir\"], header=False)\n return web.badrequest(\n _(\"No space available to create disk image in '%s' partition.\") \\\n % partition[5][0])\n except:\n pass\n\n extra_uniq_key = string_from_uuid(generate_uuid())\n options = {}\n options[\"exportuuid\"] = export[\"info\"][\"uuid\"]\n options[\"destuuid\"] = extra_uniq_key\n options[\"quiet\"] = None\n\n # Database Notebook\n try:\n _notebook = n_new(\n export[\"info\"][\"database\"][\"notebook\"][\"title\"],\n export[\"info\"][\"database\"][\"notebook\"][\"value\"],\n )\n except:\n _notebook = None\n\n # Database Tag\n _tags = []\n try:\n tag_array = comma_split(export[\"info\"][\"database\"][\"tags\"])\n tag_array = uniq_sort(tag_array)\n for x in tag_array:\n if t_count(self.orm, x) == 0:\n _tags.append(t_new(x))\n else:\n _tags.append(t_name(self.orm, x))\n except:\n _tags.append(t_new(\"\"))\n\n parent = m_findby1(self.orm, host_id)\n dest_guest = m_new(created_user=self.me,\n modified_user=self.me,\n uniq_key=extra_uniq_key,\n name=export[\"info\"][\"database\"][\"name\"],\n attribute=int(export[\"info\"][\"database\"][\"attribute\"]),\n hypervisor=int(export[\"info\"][\"database\"][\"hypervisor\"]),\n notebook=_notebook,\n tags=_tags,\n icon=export[\"info\"][\"database\"][\"icon\"],\n is_deleted=False,\n parent=parent,\n )\n\n ret = regist_guest(self,\n _guest=dest_guest,\n icon_filename=export[\"info\"][\"database\"][\"icon\"],\n cmd=VIRT_COMMAND_IMPORT_GUEST,\n options=options,\n cmdname=['Import Guest', 'Import Guest'],\n rollback_options={\"name\" : export[\"xml\"][\"domain_name\"]},\n is_create=False\n )\n\n if ret is True:\n return web.accepted()\n else:\n return False", "metadata": "root.GuestImport._POST", "header": "['class', 'GuestImport', '(', 'Rest', ')', ':', '___NEWLINE___', '___NL___', '#@auth', '___NL___', '#def _GET(self, *param, **params):', '___NL___', '# return web.seeother()', '___NL___', '___EOS___']", "index": 90 } ]
[ { "span": "import simplejson as json", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 25 }, { "span": "import karesansui", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 17 }, { "span": "from karesansui.lib.utils import chk_create_disk, json_dumps, is_param, \\\n base64_encode, base64_decode, get_dom_list, get_dom_type, \\\n string_from_uuid, generate_uuid, comma_split, uniq_sort, get_partition_info", "start_line": 37, "start_column": 0, "end_line": 39, "end_column": 77 }, { "span": "from karesansui.db.access.machine2jobgroup import new as m2j_new", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 64 }, { "span": "from karesansui.db.access._2pysilhouette import save_job_collaboration", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 70 }, { "span": "from pysilhouette.command import dict2command", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 45 }, { "span": "from karesansui.db.model._2pysilhouette import Job, JobGroup", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 60 }, { "span": "from karesansui.db.access.notebook import findby1 as n_findby1", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 62 }, { "span": "from karesansui.db.access.tag import findby1 as t_findby1", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 62 }, { "span": "from karesansui.lib.checker import Checker, \\\n CHECK_EMPTY, CHECK_VALID, CHECK_ISDIR, CHECK_STARTROOT, CHECK_EXIST", "start_line": 64, "start_column": 0, "end_line": 65, "end_column": 71 }, { "span": "from karesansui.lib.utils import get_xml_parse as XMLParse", "start_line": 67, "start_column": 0, "end_line": 67, "end_column": 65 }, { "span": "from karesansui.lib.utils import get_xml_xpath as XMLXpath", "start_line": 68, "start_column": 0, "end_line": 68, "end_column": 65 }, { "span": "from karesansui.lib.utils import get_nums_xml_xpath as XMLXpathNum", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 68 }, { "span": "from karesansui.lib.file.configfile import ConfigFile", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "gadget", "_", "._", "guest_", "import_", "regi", "st", "\\u", "guest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "rest_", "import_", "Rest", "_", ",_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "chk", "\\u", "create", "\\u", "disk_", ",_", "json", "\\u", "dumps_", ",_", "is", "\\u", "param_", ",_", "base64", "\\u", "encode_", ",_", "base64", "\\u", "decode_", ",_", "get", "\\u", "dom", "\\u", "list_", ",_", "get", "\\u", "dom", "\\u", "type_", ",_", "string", "\\u", "from", "\\u", "uuid_", ",_", "generat", "e\\u", "uuid_", ",_", "comma", "\\u", "split_", ",_", "uniq", "\\u", "sort_", ",_", "get", "\\u", "partit", "ion", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "IMPORT", "\\u", "GUE", "ST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "virt_", "import_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "config_", "import_", "Config", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "config", "\\u", "export_", "import_", "Export", "Config", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "find", "by", "host", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine", "2j", "ob", "group_", "import_", "new_", "as_", "m2", "j", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "\\u", "2py", "sil", "hou", "ette", "_", "import_", "save", "\\u", "job", "\\u", "collaborat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pys", "il", "hou", "ette", "_", "._", "command_", "import_", "dict2", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "model_", "._", "\\u", "2py", "sil", "hou", "ette", "_", "import_", "Job_", ",_", "Jo", "b", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "new_", "as_", "m", "\\u", "new_", ",_", "find", "by", "1", "unique", "key_", "as_", "m", "\\u", "find", "by", "1", "unique", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "notebook_", "import_", "new_", "as_", "n", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "tag_", "import_", "new_", "as_", "t", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "find", "by", "1_", "as_", "m", "\\u", "find", "by", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "notebook_", "import_", "find", "by", "1_", "as_", "n", "\\u", "find", "by", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "tag_", "import_", "find", "by", "1_", "as_", "t", "\\u", "find", "by", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "tag_", "import_", "same", "count_", "as_", "t", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "tag_", "import_", "find", "by", "1", "name_", "as_", "t", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "checker_", "import_", "Checker_", ",_", "CHECK", "\\u", "EMPTY_", ",_", "CHECK", "\\u", "VALID", "_", ",_", "CHECK", "\\u", "IS", "DIR_", ",_", "CHECK", "\\u", "START", "ROOT_", ",_", "CHECK", "\\u", "EXIST", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "xml", "\\u", "parse_", "as_", "XML", "Parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "nums", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "file_", "._", "configfile_", "import_", "Config", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "urls_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "host", "/(", "\\\\", "d", "+)", "/", "guest", "import", "/?", "(\\\\", ".", "part", ")$'_", ",_", "Gue", "st", "Import_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validates", "\\u", "guest", "\\u", "import_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checker_", "=_", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "obj_", "._", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "UU", "ID", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "view_", "._", "alert_", "=_", "checker_", "._", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "check_", "\\u\\u\\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_", "Gue", "st", "Import_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#@", "auth_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "\\u", "GET", "(", "self", ",", " ", "*", "param", ",", " ", "**", "params", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "web", ".", "see", "other", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gue", "st", "Import_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#@", "auth_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "\\u", "GET", "(", "self", ",", " ", "*", "param", ",", " ", "**", "params", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "web", ".", "see", "other", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "POST_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "validates", "\\u", "guest", "\\u", "import_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "self_", "._", "view_", "._", "alert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uuid_", "=_", "self_", "._", "input_", "._", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "age", " ", "Pool_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inact", "ive", "\\u", "pool", " ", "=", " ", "kv", "c", ".", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inact", "ive", "\\u", "pool_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "pool_", "=_", "kv", "c_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "=_", "inact", "ive", "\\u", "pool_", "+_", "active", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "export_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pool", "\\u", "name_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pool_", "=_", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "pool_", "[_", "0_", "]_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "target", "\"_", "]_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "afile", "_", "in_", "glob_", "._", "glob_", "(_", "\"%", "s", "/*", "/", "info", ".", "dat", "\"_", "%_", "(_", "path_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "e\\u", "param_", "=_", "Export", "Config", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e\\u", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", "!=_", "uuid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e\\u", "name_", "=_", "e\\u", "param_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "=_", "Config", "Param_", "(_", "e\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"%", "s", "/", "%", "s", ".", "xml", "\"_", "%_", "(_", "\\u", "dir_", ",_", "e\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Export", " ", "corrupt", " ", "data", ".(", "file", " ", "not", " ", "found", ")", " ", "-", " ", "path", "=", "%", "s", "'_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "internal", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e\\u", "name_", "!=_", "param_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Export", " ", "corrupt", " ", "data", ".(", "The", " ", "name", " ", "doe", "s", " ", "not", " ", "match", ")", " ", "-", " ", "info", "=", "%", "s", ",", " ", "xml", "=", "%", "s", "'_", "%_", "(_", "e\\u", "name_", ",_", "param_", "._", "get", "\\u", "name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "internal", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "e\\u", "param_", "._", "get", "\\u", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "title_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "re_", "._", "sub_", "(_", "\"[\\\\", "r", "\\\\", "n", "]\"_", ",_", "\"\"_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "title_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "\\u_", "(_", "'", "unti", "tle", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "created_", "=_", "e\\u", "param_", "._", "get", "\\u", "created_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "created_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "/", "%", "m", "/", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", "float_", "(_", "created_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "\\u_", "(_", "\"", "N", "/", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "export_", "._", "append_", "(_", "{_", "\"", "info", "\"_", ":_", "{_", "\"", "dir", "\"_", ":_", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "pool", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "e\\u", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "e\\u", "param_", "._", "get", "\\u", "domain_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\"_", ":_", "int_", "(_", "created_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\\u", "str", "\"_", ":_", "created", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "databa", "se", "\"_", ":_", "{_", "\"", "name", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tags", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "tags", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "attribute", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "attribute", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "notebook", "\"_", ":_", "{_", "\"", "title", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "notebook", "\"_", "]_", "[_", "\"", "title", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "notebook", "\"_", "]_", "[_", "\"", "value", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uniq", "\\u", "key", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "uniq", "\\u", "key", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "hypervisor", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "e\\u", "param_", "._", "database_", "[_", "\"", "icon", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xml", "\"_", ":_", "{_", "\"", "on", "\\u", "rebo", "ot", "\"_", ":_", "param_", "._", "get", "\\u", "behavior_", "(_", "'", "on", "\\u", "rebo", "ot", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "on", "\\u", "power", "off", "\"_", ":_", "param_", "._", "get", "\\u", "behavior_", "(_", "'", "on", "\\u", "power", "off", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "on", "\\u", "crash", "\"_", ":_", "param_", "._", "get", "\\u", "behavior_", "(_", "'", "on", "\\u", "crash", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "boot", "\\u", "dev", "\"_", ":_", "param_", "._", "get", "\\u", "boot", "\\u", "dev_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "bootloader", "\"", " ", ":", " ", "param", ".", "get", "\\u", "bootloader", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "commandline", "\"", " ", ":", " ", "param", ".", "get", "\\u", "commandline", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "current", "\\u", "snapshot", "\"", " ", ":", " ", "param", ".", "get", "\\u", "current", "\\u", "snapshot", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "'_", ":_", "param_", "._", "get", "\\u", "disk_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", "\\u", "name", "\"_", ":_", "param_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", "\\u", "type", "\"_", ":_", "param_", "._", "get", "\\u", "domain", "\\u", "type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "features", "\\u", "ac", "pi", "\"_", ":_", "param_", "._", "get", "\\u", "features", "\\u", "ac", "pi_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "features", "\\u", "apic", "\"_", ":_", "param_", "._", "get", "\\u", "features", "\\u", "apic", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "features", "\\u", "pa", "e", "\"_", ":_", "param_", "._", "get", "\\u", "features", "\\u", "pa", "e_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "initrd", "\"", " ", ":", " ", "param", ".", "get", "\\u", "initrd", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interface", "\"_", ":_", "param_", "._", "get", "\\u", "interface_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "kernel", "\"", " ", ":", " ", "param", ".", "get", "\\u", "kernel", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "\\u", "memory", "\"_", ":_", "param_", "._", "get", "\\u", "max", "\\u", "memory_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "vcpu", "s", "'_", ":_", "param_", "._", "get", "\\u", "max", "\\u", "vcpu", "s_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "\\u", "vcpu", "s", "\\u", "limit", "\"_", ":_", "param_", "._", "get", "\\u", "max", "\\u", "vcpu", "s", "\\u", "limit_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "param_", "._", "get", "\\u", "memory_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "param_", "._", "get", "\\u", "vcpu", "s_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\\u", "limit", "\"_", ":_", "param_", "._", "get", "\\u", "vcpu", "s", "\\u", "limit_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "graphic", "s", "\\u", "autop", "ort", "\"_", ":_", "param_", "._", "get", "\\u", "graphic", "s", "\\u", "autop", "ort_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "keymap", "\"_", ":_", "param_", "._", "get", "\\u", "graphic", "s", "\\u", "keymap_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "graphic", "s", "\\u", "listen", "\"_", ":_", "param_", "._", "get", "\\u", "graphic", "s", "\\u", "listen_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "graphic", "s", "\\u", "passw", "d", "\"_", ":_", "param_", "._", "get", "\\u", "graphic", "s", "\\u", "passwd_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "graphic", "s", "\\u", "port", "\"_", ":_", "param_", "._", "get", "\\u", "graphic", "s", "\\u", "port_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "pool_", "[_", "0_", "]_", "._", "get", "\\u", "info_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "export_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\"", "Export", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "-", " ", "uuid", "=", "%", "s", "\"_", "%_", "self_", "._", "view_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "bad", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "export_", "=_", "export_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kv", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Poo", "l", " ", "runn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "export_", "[_", "'", "pool", "'_", "]_", "[_", "'", "is", "\\u", "active", "'_", "]_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "\"", "The", " ", "destinat", "ion", ",", " ", "the", " ", "storage", " ", "pool", " ", "is", " ", "not", " ", "runn", "ing", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "\\u", "dom", "name_", "=_", "export_", "[_", "'", "xml", "'_", "]_", "[_", "'", "domain", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "\\u", "uniq", "key_", "=_", "export_", "[_", "'", "info", "'_", "]_", "[_", "'", "databa", "se", "'_", "]_", "[_", "'", "uniq", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sam", "e", " ", "guest", " ", "OS", " ", "is", " ", "alr", "ead", "y", " ", "runn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m", "\\u", "find", "by", "1", "unique", "key_", "(_", "self_", "._", "orm_", ",_", "dest", "\\u", "uniq", "key_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\\u_", "(_", "\"", "guest", " ", "'%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "(", "DB", ")", " ", "-", " ", "%", "s", "\"_", ")_", "%_", "(_", "dest", "\\u", "dom", "name_", ",_", "dest", "\\u", "uniq", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "bad", "request_", "(_", "\\u_", "(_", "\"", "guest", " ", "'%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", ")_", "%_", "dest", "\\u", "dom", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "\\u", "dir_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "export_", "[_", "'", "pool", "'_", "]_", "[_", "'", "target", "'_", "]_", "[_", "'", "path", "'_", "]_", ",_", "export_", "[_", "'", "xml", "'_", "]_", "[_", "'", "domain", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "dest", "\\u", "dir_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\\u_", "(_", "\"", "guest", " ", "'%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "(", "FS", ")", " ", "-", " ", "%", "s", "\"_", ")_", "%_", "(_", "dest", "\\u", "dom", "name_", ",_", "dest", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "bad", "request_", "(_", "\\u_", "(_", "\"", "guest", " ", "'%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", ")_", "%_", "dest", "\\u", "dom", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disk", " ", "check_", "\\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 ", " _", "src", "\\u", "disk_", "=_", "\"%", "s", "/", "%", "s", "/", "images", "/", "%", "s", ".", "img", "\"_", "%_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "dir", "\"_", "]_", ",_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", ",_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "src", "\\u", "disk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "size_", "=_", "os_", "._", "path_", "._", "getsize_", "(_", "src", "\\u", "disk_", ")_", "/_", "(_", "1024_", "*_", "1024_", ")_", "#", " ", "a", " ", "unit", " ", "'", "MB", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chk", "\\u", "create", "\\u", "disk_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "dir", "\"_", "]_", ",_", "s", "\\u", "size_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "partition_", "=_", "get", "\\u", "partit", "ion", "\\u", "info_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "dir", "\"_", "]_", ",_", "header_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "bad", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "No", " ", "space", " ", "avail", "able", " ", "to", " ", "create", " ", "disk", " ", "image", " ", "in", " ", "'%", "s", "'", " ", "partit", "ion", ".\"_", ")_", "%_", "partition_", "[_", "5_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "uniq", "\\u", "key_", "=_", "string", "\\u", "from", "\\u", "uuid_", "(_", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "export", "uuid", "\"_", "]_", "=_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "uuid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "dest", "uuid", "\"_", "]_", "=_", "extra", "\\u", "uniq", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "quie", "t", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Databa", "se", " ", "Notebook", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "notebook_", "=_", "n", "\\u", "new_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "notebook", "\"_", "]_", "[_", "\"", "title", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "notebook", "\"_", "]_", "[_", "\"", "value", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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 ", " _", "\\u", "notebook_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Databa", "se", " ", "Tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag", "\\u", "array_", "=_", "comma", "\\u", "split_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "tags", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "array_", "=_", "uniq", "\\u", "sort_", "(_", "tag", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "tag", "\\u", "array_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t", "\\u", "count_", "(_", "self_", "._", "orm_", ",_", "x_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "tags_", "._", "append_", "(_", "t", "\\u", "new_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "tags_", "._", "append_", "(_", "t", "\\u", "name_", "(_", "self_", "._", "orm_", ",_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "tags_", "._", "append_", "(_", "t", "\\u", "new_", "(_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent_", "=_", "m", "\\u", "find", "by", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "\\u", "guest_", "=_", "m", "\\u", "new_", "(_", "created", "\\u", "user_", "=_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "user_", "=_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uniq", "\\u", "key_", "=_", "extra", "\\u", "uniq", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", "=_", "int_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "attribute", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "_", "=_", "int_", "(_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "hypervisor", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notebook_", "=_", "\\u", "notebook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "\\u", "tags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon_", "=_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "icon", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "deleted_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "regi", "st", "\\u", "guest_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "guest_", "=_", "dest", "\\u", "guest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon", "\\u", "filename_", "=_", "export_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "databa", "se", "\"_", "]_", "[_", "\"", "icon", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "IMPORT", "\\u", "GUE", "ST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "name_", "=_", "[_", "'", "Import", " ", "Gue", "st", "'_", ",_", "'", "Import", " ", "Gue", "st", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "options_", "=_", "{_", "\"", "name", "\"_", ":_", "export_", "[_", "\"", "xml", "\"_", "]_", "[_", "\"", "domain", "\\u", "name", "\"_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "create_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ret_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "accepted_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Stiivi/brewery/brewery/tests/test_sql_streams.py
[ { "content": " def test_target_replace_table(self):\n table = Table('test', self.metadata,\n Column('id', Integer, primary_key=True),\n Column('login', String(32)),\n Column('full_name', String(255)),\n Column('profile', Text)\n )\n \n self.metadata.create_all(self.engine)\n\n stream = ds.SQLDataTarget(connection=self.engine, table=\"test\", \n create=True, replace = False)\n \n stream.fields = self.fields\n self.assertRaises(Exception, stream.initialize)\n\n stream = ds.SQLDataTarget(connection=self.engine, table=\"test\", \n create=True, replace = True)\n stream.fields = self.fields\n stream.initialize()\n cnames = [str(c) for c in stream.table.columns]\n fnames = [\"test.\"+f.name for f in self.fields]\n self.assertEqual(fnames, cnames)\n stream.finalize()", "metadata": "root.SQLStreamsTestCase.test_target_replace_table", "header": "['class', 'SQLStreamsTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 } ]
[ { "span": "table ", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "SQL", "Stream", "s", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "target", "\\u", "replace", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "Table_", "(_", "'", "test", "'_", ",_", "self_", "._", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "login", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "full", "\\u", "name", "'_", ",_", "String_", "(_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "profile", "'_", ",_", "Text_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", "self_", "._", "engine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "ds_", "._", "SQL", "Data", "Target_", "(_", "connection_", "=_", "self_", "._", "engine_", ",_", "table_", "=_", "\"", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "True_", ",_", "replace_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "._", "fields_", "=_", "self_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Exception_", ",_", "stream_", "._", "initialize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "ds_", "._", "SQL", "Data", "Target_", "(_", "connection_", "=_", "self_", "._", "engine_", ",_", "table_", "=_", "\"", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "True_", ",_", "replace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "fields_", "=_", "self_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cname", "s_", "=_", "[_", "str_", "(_", "c_", ")_", "for_", "c_", "in_", "stream_", "._", "table_", "._", "columns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fnames_", "=_", "[_", "\"", "test", ".\"_", "+_", "f_", "._", "name_", "for_", "f_", "in_", "self_", "._", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fnames_", ",_", "cname", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
azoft-dev-team/imagrium/env/Lib/mimetypes.py
[ { "content": "def _default_mime_types():\n global suffix_map\n global encodings_map\n global types_map\n global common_types\n\n suffix_map = {\n '.tgz': '.tar.gz',\n '.taz': '.tar.gz',\n '.tz': '.tar.gz',\n '.tbz2': '.tar.bz2',\n }\n\n encodings_map = {\n '.gz': 'gzip',\n '.Z': 'compress',\n '.bz2': 'bzip2',\n }\n\n # Before adding new types, make sure they are either registered with IANA,\n # at http://www.isi.edu/in-notes/iana/assignments/media-types\n # or extensions, i.e. using the x- prefix\n\n # If you add to these, please keep them sorted!\n types_map = {\n '.a' : 'application/octet-stream',\n '.ai' : 'application/postscript',\n '.aif' : 'audio/x-aiff',\n '.aifc' : 'audio/x-aiff',\n '.aiff' : 'audio/x-aiff',\n '.au' : 'audio/basic',\n '.avi' : 'video/x-msvideo',\n '.bat' : 'text/plain',\n '.bcpio' : 'application/x-bcpio',\n '.bin' : 'application/octet-stream',\n '.bmp' : 'image/x-ms-bmp',\n '.c' : 'text/plain',\n # Duplicates :(\n '.cdf' : 'application/x-cdf',\n '.cdf' : 'application/x-netcdf',\n '.cpio' : 'application/x-cpio',\n '.csh' : 'application/x-csh',\n '.css' : 'text/css',\n '.dll' : 'application/octet-stream',\n '.doc' : 'application/msword',\n '.dot' : 'application/msword',\n '.dvi' : 'application/x-dvi',\n '.eml' : 'message/rfc822',\n '.eps' : 'application/postscript',\n '.etx' : 'text/x-setext',\n '.exe' : 'application/octet-stream',\n '.gif' : 'image/gif',\n '.gtar' : 'application/x-gtar',\n '.h' : 'text/plain',\n '.hdf' : 'application/x-hdf',\n '.htm' : 'text/html',\n '.html' : 'text/html',\n '.ief' : 'image/ief',\n '.jpe' : 'image/jpeg',\n '.jpeg' : 'image/jpeg',\n '.jpg' : 'image/jpeg',\n '.js' : 'application/x-javascript',\n '.ksh' : 'text/plain',\n '.latex' : 'application/x-latex',\n '.m1v' : 'video/mpeg',\n '.man' : 'application/x-troff-man',\n '.me' : 'application/x-troff-me',\n '.mht' : 'message/rfc822',\n '.mhtml' : 'message/rfc822',\n '.mif' : 'application/x-mif',\n '.mov' : 'video/quicktime',\n '.movie' : 'video/x-sgi-movie',\n '.mp2' : 'audio/mpeg',\n '.mp3' : 'audio/mpeg',\n '.mp4' : 'video/mp4',\n '.mpa' : 'video/mpeg',\n '.mpe' : 'video/mpeg',\n '.mpeg' : 'video/mpeg',\n '.mpg' : 'video/mpeg',\n '.ms' : 'application/x-troff-ms',\n '.nc' : 'application/x-netcdf',\n '.nws' : 'message/rfc822',\n '.o' : 'application/octet-stream',\n '.obj' : 'application/octet-stream',\n '.oda' : 'application/oda',\n '.p12' : 'application/x-pkcs12',\n '.p7c' : 'application/pkcs7-mime',\n '.pbm' : 'image/x-portable-bitmap',\n '.pdf' : 'application/pdf',\n '.pfx' : 'application/x-pkcs12',\n '.pgm' : 'image/x-portable-graymap',\n '.pl' : 'text/plain',\n '.png' : 'image/png',\n '.pnm' : 'image/x-portable-anymap',\n '.pot' : 'application/vnd.ms-powerpoint',\n '.ppa' : 'application/vnd.ms-powerpoint',\n '.ppm' : 'image/x-portable-pixmap',\n '.pps' : 'application/vnd.ms-powerpoint',\n '.ppt' : 'application/vnd.ms-powerpoint',\n '.ps' : 'application/postscript',\n '.pwz' : 'application/vnd.ms-powerpoint',\n '.py' : 'text/x-python',\n '.pyc' : 'application/x-python-code',\n '.pyo' : 'application/x-python-code',\n '.qt' : 'video/quicktime',\n '.ra' : 'audio/x-pn-realaudio',\n '.ram' : 'application/x-pn-realaudio',\n '.ras' : 'image/x-cmu-raster',\n '.rdf' : 'application/xml',\n '.rgb' : 'image/x-rgb',\n '.roff' : 'application/x-troff',\n '.rtx' : 'text/richtext',\n '.sgm' : 'text/x-sgml',\n '.sgml' : 'text/x-sgml',\n '.sh' : 'application/x-sh',\n '.shar' : 'application/x-shar',\n '.snd' : 'audio/basic',\n '.so' : 'application/octet-stream',\n '.src' : 'application/x-wais-source',\n '.sv4cpio': 'application/x-sv4cpio',\n '.sv4crc' : 'application/x-sv4crc',\n '.swf' : 'application/x-shockwave-flash',\n '.t' : 'application/x-troff',\n '.tar' : 'application/x-tar',\n '.tcl' : 'application/x-tcl',\n '.tex' : 'application/x-tex',\n '.texi' : 'application/x-texinfo',\n '.texinfo': 'application/x-texinfo',\n '.tif' : 'image/tiff',\n '.tiff' : 'image/tiff',\n '.tr' : 'application/x-troff',\n '.tsv' : 'text/tab-separated-values',\n '.txt' : 'text/plain',\n '.ustar' : 'application/x-ustar',\n '.vcf' : 'text/x-vcard',\n '.wav' : 'audio/x-wav',\n '.wiz' : 'application/msword',\n '.wsdl' : 'application/xml',\n '.xbm' : 'image/x-xbitmap',\n '.xlb' : 'application/vnd.ms-excel',\n # Duplicates :(\n '.xls' : 'application/excel',\n '.xls' : 'application/vnd.ms-excel',\n '.xml' : 'text/xml',\n '.xpdl' : 'application/xml',\n '.xpm' : 'image/x-xpixmap',\n '.xsl' : 'application/xml',\n '.xwd' : 'image/x-xwindowdump',\n '.zip' : 'application/zip',\n }\n\n # These are non-standard types, commonly found in the wild. They will\n # only match if strict=0 flag is given to the API methods.\n\n # Please sort these too\n common_types = {\n '.jpg' : 'image/jpg',\n '.mid' : 'audio/midi',\n '.midi': 'audio/midi',\n '.pct' : 'image/pict',\n '.pic' : 'image/pict',\n '.pict': 'image/pict',\n '.rtf' : 'application/rtf',\n '.xul' : 'text/xul'\n }", "metadata": "root._default_mime_types", "header": "['module', '___EOS___']", "index": 377 } ]
[ { "span": "'.cdf' ", "start_line": 415, "start_column": 8, "end_line": 415, "end_column": 14 }, { "span": "'.xls' ", "start_line": 518, "start_column": 8, "end_line": 518, "end_column": 14 } ]
[ { "span": "'.cdf' ", "start_line": 416, "start_column": 8, "end_line": 416, "end_column": 14 }, { "span": "'.xls' ", "start_line": 519, "start_column": 8, "end_line": 519, "end_column": 14 } ]
1
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_", "def_", "\\u", "default", "\\u", "mime", "\\u", "types_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "suff", "ix", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "encoding", "s", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "types", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "common", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suff", "ix", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tg", "z", "'_", ":_", "'.", "tar", ".", "gz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ta", "z", "'_", ":_", "'.", "tar", ".", "gz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tz", "'_", ":_", "'.", "tar", ".", "gz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tb", "z", "2", "'_", ":_", "'.", "tar", ".", "bz2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "encoding", "s", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "gz", "'_", ":_", "'", "gzip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "Z", "'_", ":_", "'", "compress", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "bz2", "'_", ":_", "'", "bz", "ip", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "fore", " ", "addin", "g", " ", "new", " ", "types", ",", " ", "make", " ", "sure", " ", "the", "y", " ", "are", " ", "eit", "her", " ", "register", "ed", " ", "with", " ", "IAN", "A", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "http", "://", "www", ".", "isi", ".", "edu", "/", "in", "-", "note", "s", "/", "iana", "/", "assign", "ment", "s", "/", "media", "-", "types_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "extensi", "ons", ",", " ", "i", ".", "e", ".", " ", "usi", "ng", " ", "the", " ", "x", "-", " ", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "add", " ", "to", " ", "these", ",", " ", "plea", "se", " ", "keep", " ", "them", " ", "sorte", "d", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "types", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "a", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ai", "'_", ":_", "'", "applica", "tion", "/", "posts", "cript", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "aif", "'_", ":_", "'", "audio", "/", "x", "-", "aif", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "aif", "c", "'_", ":_", "'", "audio", "/", "x", "-", "aif", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "aif", "f", "'_", ":_", "'", "audio", "/", "x", "-", "aif", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "au", "'_", ":_", "'", "audio", "/", "basic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "avi", "'_", ":_", "'", "video", "/", "x", "-", "msv", "ideo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "bat", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "bc", "pio", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "bc", "pio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "bin", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "bm", "p", "'_", ":_", "'", "image", "/", "x", "-", "ms", "-", "bm", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "c", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Duplicate", "s", " ", ":(", "_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "cdf", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "cdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "cdf", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "netcdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "cpi", "o", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "cpi", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "csh", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "csh", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "css", "'_", ":_", "'", "text", "/", "css", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "dll", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "doc", "'_", ":_", "'", "applica", "tion", "/", "ms", "word", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "dot", "'_", ":_", "'", "applica", "tion", "/", "ms", "word", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "dvi", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "dvi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "em", "l", "'_", ":_", "'", "message", "/", "rfc", "822", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "eps", "'_", ":_", "'", "applica", "tion", "/", "posts", "cript", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "et", "x", "'_", ":_", "'", "text", "/", "x", "-", "sete", "xt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "exe", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "gif", "'_", ":_", "'", "image", "/", "gif", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "gta", "r", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "gta", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "h", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "hd", "f", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "hd", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ht", "m", "'_", ":_", "'", "text", "/", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "html", "'_", ":_", "'", "text", "/", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ie", "f", "'_", ":_", "'", "image", "/", "ie", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "jp", "e", "'_", ":_", "'", "image", "/", "jpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "jpeg", "'_", ":_", "'", "image", "/", "jpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "jp", "g", "'_", ":_", "'", "image", "/", "jpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "js", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "javascript", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ksh", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "late", "x", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "late", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "m1", "v", "'_", ":_", "'", "video", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "man", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "-", "man", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "me", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "-", "me", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mh", "t", "'_", ":_", "'", "message", "/", "rfc", "822", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mh", "tml", "'_", ":_", "'", "message", "/", "rfc", "822", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mi", "f", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "mi", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mov", "'_", ":_", "'", "video", "/", "quick", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "movie", "'_", ":_", "'", "video", "/", "x", "-", "sg", "i", "-", "movie", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mp", "2", "'_", ":_", "'", "audio", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mp3", "'_", ":_", "'", "audio", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mp", "4", "'_", ":_", "'", "video", "/", "mp", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mpa", "'_", ":_", "'", "video", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mpe", "'_", ":_", "'", "video", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mpeg", "'_", ":_", "'", "video", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mpg", "'_", ":_", "'", "video", "/", "mpeg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ms", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "-", "ms", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "nc", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "netcdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "nw", "s", "'_", ":_", "'", "message", "/", "rfc", "822", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "o", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "obj", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "oda", "'_", ":_", "'", "applica", "tion", "/", "oda", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "p1", "2", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "pkcs", "1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "p", "7c", "'_", ":_", "'", "applica", "tion", "/", "pkcs", "7", "-", "mime", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pbm", "'_", ":_", "'", "image", "/", "x", "-", "portab", "le", "-", "bitmap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pdf", "'_", ":_", "'", "applica", "tion", "/", "pdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pfx", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "pkcs", "1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pgm", "'_", ":_", "'", "image", "/", "x", "-", "portab", "le", "-", "gray", "map", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pl", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "png", "'_", ":_", "'", "image", "/", "png", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pn", "m", "'_", ":_", "'", "image", "/", "x", "-", "portab", "le", "-", "any", "map", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pot", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "power", "point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ppa", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "power", "point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ppm", "'_", ":_", "'", "image", "/", "x", "-", "portab", "le", "-", "pixmap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pps", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "power", "point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ppt", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "power", "point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ps", "'_", ":_", "'", "applica", "tion", "/", "posts", "cript", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pw", "z", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "power", "point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "py", "'_", ":_", "'", "text", "/", "x", "-", "python", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pyc", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "python", "-", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pyo", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "python", "-", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "qt", "'_", ":_", "'", "video", "/", "quick", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ra", "'_", ":_", "'", "audio", "/", "x", "-", "pn", "-", "real", "audio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ram", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "pn", "-", "real", "audio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ras", "'_", ":_", "'", "image", "/", "x", "-", "cm", "u", "-", "rast", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "rdf", "'_", ":_", "'", "applica", "tion", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "rgb", "'_", ":_", "'", "image", "/", "x", "-", "rgb", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "rof", "f", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "rt", "x", "'_", ":_", "'", "text", "/", "rich", "text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "sg", "m", "'_", ":_", "'", "text", "/", "x", "-", "sg", "ml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "sg", "ml", "'_", ":_", "'", "text", "/", "x", "-", "sg", "ml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "sh", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "sh", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "shar", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "shar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "snd", "'_", ":_", "'", "audio", "/", "basic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "so", "'_", ":_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "src", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "wai", "s", "-", "source", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "sv", "4c", "pio", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "sv", "4c", "pio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "sv", "4c", "rc", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "sv", "4c", "rc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "swf", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "shock", "wave", "-", "flash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "t", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tar", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tcl", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tcl", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tex", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tex", "i", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tex", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tex", "info", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tex", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tif", "'_", ":_", "'", "image", "/", "tiff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tiff", "'_", ":_", "'", "image", "/", "tiff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tr", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "tro", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "tsv", "'_", ":_", "'", "text", "/", "tab", "-", "separate", "d", "-", "values", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "txt", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ust", "ar", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "ust", "ar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "vcf", "'_", ":_", "'", "text", "/", "x", "-", "vcard", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "wav", "'_", ":_", "'", "audio", "/", "x", "-", "wav", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "wiz", "'_", ":_", "'", "applica", "tion", "/", "ms", "word", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ws", "dl", "'_", ":_", "'", "applica", "tion", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xb", "m", "'_", ":_", "'", "image", "/", "x", "-", "xb", "itm", "ap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xl", "b", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "exce", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Duplicate", "s", " ", ":(", "_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xls", "'_", ":_", "'", "applica", "tion", "/", "exce", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xls", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "ms", "-", "exce", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xml", "'_", ":_", "'", "text", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xp", "dl", "'_", ":_", "'", "applica", "tion", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xp", "m", "'_", ":_", "'", "image", "/", "x", "-", "xp", "ix", "map", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xsl", "'_", ":_", "'", "applica", "tion", "/", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xw", "d", "'_", ":_", "'", "image", "/", "x", "-", "xw", "indo", "wd", "ump", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "zip", "'_", ":_", "'", "applica", "tion", "/", "zip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "non", "-", "standard", " ", "types", ",", " ", "common", "ly", " ", "found", " ", "in", " ", "the", " ", "wild", ".", " ", " ", "The", "y", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "match", " ", "if", " ", "strict", "=", "0", " ", "flag", " ", "is", " ", "give", "n", " ", "to", " ", "the", " ", "API", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "sort", " ", "these", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "common", "\\u", "types_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "jp", "g", "'_", ":_", "'", "image", "/", "jp", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mid", "'_", ":_", "'", "audio", "/", "mid", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "mid", "i", "'_", ":_", "'", "audio", "/", "mid", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pct", "'_", ":_", "'", "image", "/", "pic", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pic", "'_", ":_", "'", "image", "/", "pic", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "pic", "t", "'_", ":_", "'", "image", "/", "pic", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "rt", "f", "'_", ":_", "'", "applica", "tion", "/", "rt", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "xu", "l", "'_", ":_", "'", "text", "/", "xu", "l", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
cloudera/hue/desktop/core/ext-py/Paste-2.0.1/tests/test_exceptions/test_formatter.py
[ { "content": "def test_excersize():\n for f in formats:\n try:\n raise_error()\n except:\n format(f)", "metadata": "root.test_excersize", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def test_content():\n for f in formats:\n try:\n raise_error()\n except:\n result = format(f)\n print(result)\n assert 'test_object' in result\n assert 'http://whatever.com' in result\n assert 'This is some supplemental information' in result\n assert 'raise_error' in result\n assert 'call_error' in result\n assert '5' in result\n assert 'test_content' in result\n else:\n assert 0", "metadata": "root.test_content", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def test_trim():\n current = os.path.abspath(os.getcwd())\n for f in formats:\n try:\n raise_error()\n except:\n result = format(f, trim_source_paths=[(current, '.')])\n assert current not in result\n assert ('%stest_formatter.py' % os.sep) in result, ValueError(repr(result))\n else:\n assert 0", "metadata": "root.test_trim", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def test_hide():\n for f in formats:\n try:\n hide(True, raise_error)\n except:\n result = format(f)\n print(result)\n assert 'in hide_inner' not in result\n assert 'inner(*args, **kw)' not in result\n else:\n assert 0", "metadata": "root.test_hide", "header": "['module', '___EOS___']", "index": 97 }, { "content": "def test_hide_supppressed():\n \"\"\"\n When an error occurs and __traceback_stop__ is true for the\n erroneous frame, then that setting should be ignored.\n \"\"\"\n for f in ['html']: #formats:\n results = []\n for hide_value in (False, 'after'):\n try:\n pass_through(\n 'a',\n hide,\n hide_value,\n pass_through,\n 'b',\n raise_error)\n except:\n results.append(format(f))\n else:\n assert 0\n if results[0] != results[1]:\n print_diff(results[0], results[1])\n assert 0", "metadata": "root.test_hide_supppressed", "header": "['module', '___EOS___']", "index": 114 }, { "content": "def test_hide_after():\n for f in formats:\n try:\n pass_through(\n 'AABB',\n hide, 'after',\n pass_through, 'CCDD',\n # A little whitespace to keep this line out of the\n # content part of the report\n\n\n hide, 'reset',\n raise_error)\n except:\n result = format(f)\n assert 'AABB' in result\n assert 'CCDD' not in result\n assert 'raise_error' in result\n else:\n assert 0", "metadata": "root.test_hide_after", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def test_hide_before():\n for f in formats:\n try:\n pass_through(\n 'AABB',\n hide, 'before',\n raise_error)\n except:\n result = format(f)\n print(result)\n assert 'AABB' not in result\n assert 'raise_error' in result\n else:\n assert 0", "metadata": "root.test_hide_before", "header": "['module', '___EOS___']", "index": 159 } ]
[ { "span": "except:", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 15 }, { "span": "except:", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 15 }, { "span": "except:", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 15 }, { "span": "except:", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 15 }, { "span": "except:", "start_line": 130, "start_column": 12, "end_line": 130, "end_column": 19 }, { "span": "except:", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 15 }, { "span": "except:", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "exce", "rsi", "ze_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "raise", "\\u", "error_", "(_", ")_", "\\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 ", " _", "format_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "content_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "raise", "\\u", "error_", "(_", ")_", "\\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 ", " _", "result_", "=_", "format_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "test\\u", "object", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "http", "://", "what", "ever", ".", "com", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "Thi", "s", " ", "is", " ", "some", " ", "supplement", "al", " ", "informati", "on", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "raise", "\\u", "error", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "call", "\\u", "error", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "5", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "test\\u", "content", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "trim_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "raise", "\\u", "error_", "(_", ")_", "\\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 ", " _", "result_", "=_", "format_", "(_", "f_", ",_", "trim", "\\u", "source", "\\u", "paths_", "=_", "[_", "(_", "current_", ",_", "'.'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "current_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "'%", "ste", "st", "\\u", "formatter", ".", "py", "'_", "%_", "os_", "._", "sep_", ")_", "in_", "result_", ",_", "Value", "Error_", "(_", "repr_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hide_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "hide_", "(_", "True_", ",_", "raise", "\\u", "error_", ")_", "\\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 ", " _", "result_", "=_", "format_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "in", " ", "hide", "\\u", "inner", "'_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "inner", "(*", "args", ",", " ", "**", "kw", ")'_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hide", "\\u", "supp", "pressed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "an", " ", "error", " ", "occur", "s", " ", "and", " ", "\\u\\u", "traceback", "\\u", "stop", "\\u\\u", " ", "is", " ", "true", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "erro", "neous", " ", "frame", ",", " ", "then", " ", "tha", "t", " ", "setti", "ng", " ", "shou", "ld", " ", "be", " ", "ignore", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "[_", "'", "html", "'_", "]_", ":_", "#", "formats", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hide", "\\u", "value_", "in_", "(_", "False_", ",_", "'", "after", "'_", ")_", ":_", "\\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 ", " _", "pass", "\\u", "through_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hide_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hide", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pass", "\\u", "through_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "raise", "\\u", "error_", ")_", "\\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 ", " _", "results_", "._", "append_", "(_", "format_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "[_", "0_", "]_", "!=_", "results_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "diff_", "(_", "results_", "[_", "0_", "]_", ",_", "results_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hide", "\\u", "after_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "pass", "\\u", "through_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AAB", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hide_", ",_", "'", "after", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pass", "\\u", "through_", ",_", "'", "CCD", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "litt", "le", " ", "whitespace", " ", "to", " ", "keep", " ", "this", " ", "line", " ", "out", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", " ", "part", " ", "of", " ", "the", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hide_", ",_", "'", "reset", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "raise", "\\u", "error_", ")_", "\\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 ", " _", "result_", "=_", "format_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "AAB", "B", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "CCD", "D", "'_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "raise", "\\u", "error", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hide", "\\u", "before_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "formats_", ":_", "\\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 ", " _", "pass", "\\u", "through_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AAB", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hide_", ",_", "'", "bef", "ore", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "raise", "\\u", "error_", ")_", "\\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 ", " _", "result_", "=_", "format_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "AAB", "B", "'_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "raise", "\\u", "error", "'_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", "\\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, 0, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
AppScale/appscale/AppServer/lib/grizzled/grizzled/test/config/TestConfiguration.py
[ { "content": " def testInclude(self):\n fd, tempPath = tempfile.mkstemp(suffix='.cfg')\n\n def unlinkTemp(path):\n try:\n os.unlink(path)\n except:\n pass\n\n atexit.register(unlinkTemp, tempPath)\n fp = os.fdopen(fd, \"w\")\n print >> fp, '[section3]\\nbaz = somevalue\\n'\n fp.close()\n\n s = '%s\\n\\n%%include \"%s\"\\n' % (CONFIG2, tempPath)\n\n os.environ['SOME_ENV_VAR'] = 'test_test_test'\n config = Configuration()\n config.readfp(StringIO(s))\n unlinkTemp(tempPath)\n assert config.has_section('section1')\n assert config.has_section('section2')\n assert config.has_section('section3')\n assert not config.has_section('foo')\n assert not config.has_section('bar')\n assert not config.has_section('bar2')\n assert config.has_option('section1', 'foo')\n assert config.has_option('section1', 'bar')\n assert not config.has_option('section1', 'bar2')\n assert config.has_option('section2', 'foo')\n assert config.has_option('section2', 'bar')\n assert config.has_option('section3', 'baz')\n assert config.get('section1', 'foo') == 'bar'\n assert config.get('section1', 'bar') == 'bar'\n assert config.get('section2', 'foo') == 'bar'\n assert config.get('section2', 'bar') == os.environ['SOME_ENV_VAR']\n assert config.get('section3', 'baz') == 'somevalue'", "metadata": "root.TestParser.testInclude", "header": "['class', 'TestParser', '(', 'object', ')', ':', '___EOS___']", "index": 102 } ]
[ { "span": "except:", "start_line": 108, "start_column": 12, "end_line": 108, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Include", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", ",_", "temp", "Path_", "=_", "tempfile_", "._", "mkstemp_", "(_", "suffix_", "=_", "'.", "cfg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unlink", "Temp_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "unlink_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "atexit_", "._", "register_", "(_", "unlink", "Temp_", ",_", "temp", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "os_", "._", "fdo", "pen_", "(_", "fd_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "fp_", ",_", "'[", "section", "3", "]\\\\", "nba", "z", " ", "=", " ", "some", "value", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'%", "s", "\\\\", "n", "\\\\", "n", "%%", "include", " ", "\"%", "s", "\"\\\\", "n", "'_", "%_", "(_", "CONFIG", "2_", ",_", "temp", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "SOME", "\\u", "ENV", "\\u", "VAR", "'_", "]_", "=_", "'", "test\\u", "test\\u", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "readf", "p_", "(_", "String", "IO_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unlink", "Temp_", "(_", "temp", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "section_", "(_", "'", "section", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "section_", "(_", "'", "section", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "section_", "(_", "'", "section", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "config_", "._", "has", "\\u", "section_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "config_", "._", "has", "\\u", "section_", "(_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "config_", "._", "has", "\\u", "section_", "(_", "'", "bar", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "1", "'_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "1", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "1", "'_", ",_", "'", "bar", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "2", "'_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "2", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "has", "\\u", "option_", "(_", "'", "section", "3", "'_", ",_", "'", "ba", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "get_", "(_", "'", "section", "1", "'_", ",_", "'", "foo", "'_", ")_", "==_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "get_", "(_", "'", "section", "1", "'_", ",_", "'", "bar", "'_", ")_", "==_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "get_", "(_", "'", "section", "2", "'_", ",_", "'", "foo", "'_", ")_", "==_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "get_", "(_", "'", "section", "2", "'_", ",_", "'", "bar", "'_", ")_", "==_", "os_", "._", "environ_", "[_", "'", "SOME", "\\u", "ENV", "\\u", "VAR", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "config_", "._", "get_", "(_", "'", "section", "3", "'_", ",_", "'", "ba", "z", "'_", ")_", "==_", "'", "some", "value", "'_", "\\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, 0, 1, 1, 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 ]
Module is imported with 'import' and 'import from'
Mimino666/langdetect/langdetect/detector_factory.py
[ { "content": "import os\nfrom os import path\nimport sys\n\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom .detector import Detector\nfrom .lang_detect_exception import ErrorCode, LangDetectException\nfrom .utils.lang_profile import LangProfile\n\n\n\n\nPROFILES_DIRECTORY = path.join(path.dirname(__file__), 'profiles')\n_factory = None\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\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_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "detector_", "import_", "Detector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "lang", "\\u", "detect", "\\u", "exception_", "import_", "Error", "Code_", ",_", "Lang", "Detect", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "._", "lang", "\\u", "profile_", "import_", "Lang", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "PROFILE", "S", "\\u", "DIRECTORY_", "=_", "path_", "._", "join_", "(_", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "profile", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "factory_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
home-assistant/home-assistant/tests/components/test_influx.py
[ { "content": "\"\"\"The tests for the InfluxDB component.\"\"\"\nimport copy\nimport unittest\nfrom unittest import mock\n\nimport influxdb as influx_client\n\nimport homeassistant.components.influxdb as influxdb\nfrom homeassistant.const import EVENT_STATE_CHANGED, STATE_OFF, STATE_ON\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "The", " ", "tests", " ", "for", " ", "the", " ", "Influ", "x", "DB", " ", "component", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "influx", "db_", "as_", "influx", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "homeassistant_", "._", "components_", "._", "influx", "db_", "as_", "influx", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "homeassistant_", "._", "const_", "import_", "EVENT", "\\u", "STATE", "\\u", "CHANGED", "_", ",_", "STATE", "\\u", "OFF_", ",_", "STATE", "\\u", "ON_", "\\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_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
GoogleCloudPlatform/gcloud-python/gcloud/bigtable/test_client.py
[ { "content": " def _constructor_test_helper(self, expected_scopes, creds,\n read_only=False, admin=False,\n user_agent=None, timeout_seconds=None,\n expected_creds=None):\n from gcloud.bigtable import client as MUT\n\n user_agent = user_agent or MUT.DEFAULT_USER_AGENT\n timeout_seconds = timeout_seconds or MUT.DEFAULT_TIMEOUT_SECONDS\n PROJECT = 'PROJECT'\n client = self._makeOne(project=PROJECT, credentials=creds,\n read_only=read_only, admin=admin,\n user_agent=user_agent,\n timeout_seconds=timeout_seconds)\n\n expected_creds = expected_creds or creds\n self.assertTrue(client._credentials is expected_creds)\n if expected_scopes is not None:\n self.assertEqual(client._credentials.scopes, expected_scopes)\n\n self.assertEqual(client.project, PROJECT)\n self.assertEqual(client.timeout_seconds, timeout_seconds)\n self.assertEqual(client.user_agent, user_agent)\n # Check stubs are set (but null)\n self.assertEqual(client._data_stub_internal, None)\n self.assertEqual(client._cluster_stub_internal, None)\n self.assertEqual(client._operations_stub_internal, None)\n self.assertEqual(client._table_stub_internal, None)", "metadata": "root.TestClient._constructor_test_helper", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_credentials_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n self.assertTrue(client.credentials is credentials)", "metadata": "root.TestClient.test_credentials_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_data_stub_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n client._data_stub_internal = object()\n self.assertTrue(client._data_stub is client._data_stub_internal)", "metadata": "root.TestClient.test_data_stub_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_cluster_stub_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials,\n admin=True)\n client._cluster_stub_internal = object()\n self.assertTrue(client._cluster_stub is client._cluster_stub_internal)", "metadata": "root.TestClient.test_cluster_stub_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": " def test_operations_stub_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials,\n admin=True)\n client._operations_stub_internal = object()\n self.assertTrue(client._operations_stub is\n client._operations_stub_internal)", "metadata": "root.TestClient.test_operations_stub_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test_table_stub_getter(self):\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials,\n admin=True)\n client._table_stub_internal = object()\n self.assertTrue(client._table_stub is client._table_stub_internal)", "metadata": "root.TestClient.test_table_stub_getter", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 225 }, { "content": " def test__make_data_stub(self):\n from gcloud._testing import _Monkey\n from gcloud.bigtable import client as MUT\n from gcloud.bigtable.client import DATA_API_HOST\n from gcloud.bigtable.client import DATA_API_PORT\n from gcloud.bigtable.client import DATA_STUB_FACTORY\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n\n fake_stub = object()\n make_stub_args = []\n\n def mock_make_stub(*args):\n make_stub_args.append(args)\n return fake_stub\n\n with _Monkey(MUT, _make_stub=mock_make_stub):\n result = client._make_data_stub()\n\n self.assertTrue(result is fake_stub)\n self.assertEqual(make_stub_args, [\n (\n client,\n DATA_STUB_FACTORY,\n DATA_API_HOST,\n DATA_API_PORT,\n ),\n ])", "metadata": "root.TestClient.test__make_data_stub", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def test__make_cluster_stub(self):\n from gcloud._testing import _Monkey\n from gcloud.bigtable import client as MUT\n from gcloud.bigtable.client import CLUSTER_ADMIN_HOST\n from gcloud.bigtable.client import CLUSTER_ADMIN_PORT\n from gcloud.bigtable.client import CLUSTER_STUB_FACTORY\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n\n fake_stub = object()\n make_stub_args = []\n\n def mock_make_stub(*args):\n make_stub_args.append(args)\n return fake_stub\n\n with _Monkey(MUT, _make_stub=mock_make_stub):\n result = client._make_cluster_stub()\n\n self.assertTrue(result is fake_stub)\n self.assertEqual(make_stub_args, [\n (\n client,\n CLUSTER_STUB_FACTORY,\n CLUSTER_ADMIN_HOST,\n CLUSTER_ADMIN_PORT,\n ),\n ])", "metadata": "root.TestClient.test__make_cluster_stub", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 280 }, { "content": " def test__make_operations_stub(self):\n from gcloud._testing import _Monkey\n from gcloud.bigtable import client as MUT\n from gcloud.bigtable.client import CLUSTER_ADMIN_HOST\n from gcloud.bigtable.client import CLUSTER_ADMIN_PORT\n from gcloud.bigtable.client import OPERATIONS_STUB_FACTORY\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n\n fake_stub = object()\n make_stub_args = []\n\n def mock_make_stub(*args):\n make_stub_args.append(args)\n return fake_stub\n\n with _Monkey(MUT, _make_stub=mock_make_stub):\n result = client._make_operations_stub()\n\n self.assertTrue(result is fake_stub)\n self.assertEqual(make_stub_args, [\n (\n client,\n OPERATIONS_STUB_FACTORY,\n CLUSTER_ADMIN_HOST,\n CLUSTER_ADMIN_PORT,\n ),\n ])", "metadata": "root.TestClient.test__make_operations_stub", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 311 }, { "content": " def test__make_table_stub(self):\n from gcloud._testing import _Monkey\n from gcloud.bigtable import client as MUT\n from gcloud.bigtable.client import TABLE_ADMIN_HOST\n from gcloud.bigtable.client import TABLE_ADMIN_PORT\n from gcloud.bigtable.client import TABLE_STUB_FACTORY\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n\n fake_stub = object()\n make_stub_args = []\n\n def mock_make_stub(*args):\n make_stub_args.append(args)\n return fake_stub\n\n with _Monkey(MUT, _make_stub=mock_make_stub):\n result = client._make_table_stub()\n\n self.assertTrue(result is fake_stub)\n self.assertEqual(make_stub_args, [\n (\n client,\n TABLE_STUB_FACTORY,\n TABLE_ADMIN_HOST,\n TABLE_ADMIN_PORT,\n ),\n ])", "metadata": "root.TestClient.test__make_table_stub", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 342 }, { "content": " def _start_method_helper(self, admin):\n from gcloud._testing import _Monkey\n from gcloud.bigtable._testing import _FakeStub\n from gcloud.bigtable import client as MUT\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials,\n admin=admin)\n\n stub = _FakeStub()\n make_stub_args = []\n\n def mock_make_stub(*args):\n make_stub_args.append(args)\n return stub\n\n with _Monkey(MUT, _make_stub=mock_make_stub):\n client.start()\n\n self.assertTrue(client._data_stub_internal is stub)\n if admin:\n self.assertTrue(client._cluster_stub_internal is stub)\n self.assertTrue(client._operations_stub_internal is stub)\n self.assertTrue(client._table_stub_internal is stub)\n self.assertEqual(stub._entered, 4)\n self.assertEqual(len(make_stub_args), 4)\n else:\n self.assertTrue(client._cluster_stub_internal is None)\n self.assertTrue(client._operations_stub_internal is None)\n self.assertTrue(client._table_stub_internal is None)\n self.assertEqual(stub._entered, 1)\n self.assertEqual(len(make_stub_args), 1)\n self.assertEqual(stub._exited, [])", "metadata": "root.TestClient._start_method_helper", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 384 }, { "content": " def _stop_method_helper(self, admin):\n from gcloud.bigtable._testing import _FakeStub\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials,\n admin=admin)\n\n stub1 = _FakeStub()\n stub2 = _FakeStub()\n client._data_stub_internal = stub1\n client._cluster_stub_internal = stub2\n client._operations_stub_internal = stub2\n client._table_stub_internal = stub2\n client.stop()\n self.assertTrue(client._data_stub_internal is None)\n self.assertTrue(client._cluster_stub_internal is None)\n self.assertTrue(client._operations_stub_internal is None)\n self.assertTrue(client._table_stub_internal is None)\n self.assertEqual(stub1._entered, 0)\n self.assertEqual(stub2._entered, 0)\n exc_none_triple = (None, None, None)\n self.assertEqual(stub1._exited, [exc_none_triple])\n if admin:\n self.assertEqual(stub2._exited, [exc_none_triple] * 3)\n else:\n self.assertEqual(stub2._exited, [])", "metadata": "root.TestClient._stop_method_helper", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 436 }, { "content": " def test_cluster_factory(self):\n from gcloud.bigtable.cluster import Cluster\n\n credentials = _Credentials()\n project = 'PROJECT'\n client = self._makeOne(project=project, credentials=credentials)\n\n zone = 'zone'\n cluster_id = 'cluster-id'\n display_name = 'display-name'\n serve_nodes = 42\n cluster = client.cluster(zone, cluster_id, display_name=display_name,\n serve_nodes=serve_nodes)\n self.assertTrue(isinstance(cluster, Cluster))\n self.assertEqual(cluster.zone, zone)\n self.assertEqual(cluster.cluster_id, cluster_id)\n self.assertEqual(cluster.display_name, display_name)\n self.assertEqual(cluster.serve_nodes, serve_nodes)\n self.assertTrue(cluster._client is client)", "metadata": "root.TestClient.test_cluster_factory", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 484 }, { "content": " def test_constructor(self):\n from gcloud.bigtable.client import Client\n from gcloud.bigtable.client import DATA_SCOPE\n\n credentials = _Credentials()\n project = 'PROJECT'\n user_agent = 'USER_AGENT'\n client = Client(project=project, credentials=credentials,\n user_agent=user_agent)\n transformer = self._makeOne(client)\n self.assertTrue(transformer._credentials is credentials)\n self.assertEqual(transformer._user_agent, user_agent)\n self.assertEqual(credentials.scopes, [DATA_SCOPE])", "metadata": "root.Test_MetadataPlugin.test_constructor", "header": "['class', 'Test_MetadataPlugin', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 633 }, { "content": " def test_it(self):\n from gcloud._testing import _Monkey\n from gcloud.bigtable import client as MUT\n\n mock_result = object()\n stub_inputs = []\n\n SSL_CREDS = object()\n METADATA_CREDS = object()\n COMPOSITE_CREDS = object()\n CHANNEL = object()\n\n class _ImplementationsModule(object):\n\n def __init__(self):\n self.ssl_channel_credentials_args = None\n self.metadata_call_credentials_args = None\n self.composite_channel_credentials_args = None\n self.secure_channel_args = None\n\n def ssl_channel_credentials(self, *args):\n self.ssl_channel_credentials_args = args\n return SSL_CREDS\n\n def metadata_call_credentials(self, *args, **kwargs):\n self.metadata_call_credentials_args = (args, kwargs)\n return METADATA_CREDS\n\n def composite_channel_credentials(self, *args):\n self.composite_channel_credentials_args = args\n return COMPOSITE_CREDS\n\n def secure_channel(self, *args):\n self.secure_channel_args = args\n return CHANNEL\n\n implementations_mod = _ImplementationsModule()\n\n def mock_stub_factory(channel):\n stub_inputs.append(channel)\n return mock_result\n\n metadata_plugin = object()\n clients = []\n\n def mock_plugin(client):\n clients.append(client)\n return metadata_plugin\n\n host = 'HOST'\n port = 1025\n client = object()\n with _Monkey(MUT, implementations=implementations_mod,\n _MetadataPlugin=mock_plugin):\n result = self._callFUT(client, mock_stub_factory, host, port)\n\n self.assertTrue(result is mock_result)\n self.assertEqual(stub_inputs, [CHANNEL])\n self.assertEqual(clients, [client])\n self.assertEqual(implementations_mod.ssl_channel_credentials_args,\n (None, None, None))\n self.assertEqual(implementations_mod.metadata_call_credentials_args,\n ((metadata_plugin,), {'name': 'google_creds'}))\n self.assertEqual(\n implementations_mod.composite_channel_credentials_args,\n (SSL_CREDS, METADATA_CREDS))\n self.assertEqual(implementations_mod.secure_channel_args,\n (host, port, COMPOSITE_CREDS))", "metadata": "root.Test__make_stub.test_it", "header": "['class', 'Test__make_stub', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 679 } ]
[ { "span": "self.assertTrue(client._credentials is expected_creds)", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 62 }, { "span": "self.assertTrue(client.credentials is credentials)", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 58 }, { "span": "self.assertTrue(client._data_stub is client._data_stub_internal)", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 72 }, { "span": "self.assertTrue(client._cluster_stub is client._cluster_stub_internal)", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 78 }, { "span": "self.assertTrue(client._operations_stub is\n client._operations_stub_internal)", "start_line": 206, "start_column": 8, "end_line": 207, "end_column": 57 }, { "span": "self.assertTrue(client._table_stub is client._table_stub_internal)", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 74 }, { "span": "self.assertTrue(result is fake_stub)", "start_line": 270, "start_column": 8, "end_line": 270, "end_column": 44 }, { "span": "self.assertTrue(result is fake_stub)", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 44 }, { "span": "self.assertTrue(result is fake_stub)", "start_line": 332, "start_column": 8, "end_line": 332, "end_column": 44 }, { "span": "self.assertTrue(result is fake_stub)", "start_line": 363, "start_column": 8, "end_line": 363, "end_column": 44 }, { "span": "self.assertTrue(client._data_stub_internal is stub)", "start_line": 404, "start_column": 8, "end_line": 404, "end_column": 59 }, { "span": "self.assertTrue(client._cluster_stub_internal is stub)", "start_line": 406, "start_column": 12, "end_line": 406, "end_column": 66 }, { "span": "self.assertTrue(client._operations_stub_internal is stub)", "start_line": 407, "start_column": 12, "end_line": 407, "end_column": 69 }, { "span": "self.assertTrue(client._table_stub_internal is stub)", "start_line": 408, "start_column": 12, "end_line": 408, "end_column": 64 }, { "span": "self.assertTrue(client._cluster_stub_internal is None)", "start_line": 412, "start_column": 12, "end_line": 412, "end_column": 66 }, { "span": "self.assertTrue(client._operations_stub_internal is None)", "start_line": 413, "start_column": 12, "end_line": 413, "end_column": 69 }, { "span": "self.assertTrue(client._table_stub_internal is None)", "start_line": 414, "start_column": 12, "end_line": 414, "end_column": 64 }, { "span": "self.assertTrue(client._data_stub_internal is None)", "start_line": 451, "start_column": 8, "end_line": 451, "end_column": 59 }, { "span": "self.assertTrue(client._cluster_stub_internal is None)", "start_line": 452, "start_column": 8, "end_line": 452, "end_column": 62 }, { "span": "self.assertTrue(client._operations_stub_internal is None)", "start_line": 453, "start_column": 8, "end_line": 453, "end_column": 65 }, { "span": "self.assertTrue(client._table_stub_internal is None)", "start_line": 454, "start_column": 8, "end_line": 454, "end_column": 60 }, { "span": "self.assertTrue(cluster._client is client)", "start_line": 502, "start_column": 8, "end_line": 502, "end_column": 50 }, { "span": "self.assertTrue(transformer._credentials is credentials)", "start_line": 643, "start_column": 8, "end_line": 643, "end_column": 64 }, { "span": "self.assertTrue(result is mock_result)", "start_line": 735, "start_column": 8, "end_line": 735, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "construct", "or", "\\u", "test\\u", "helper_", "(_", "self_", ",_", "expected", "\\u", "scopes_", ",_", "creds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "only_", "=_", "False_", ",_", "admin_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "None_", ",_", "timeo", "ut", "\\u", "seconds_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "creds_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "user", "\\u", "agent_", "or_", "MUT", "_", "._", "DEF", "AUL", "T", "\\u", "USER", "\\u", "AGENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeo", "ut", "\\u", "seconds_", "=_", "timeo", "ut", "\\u", "seconds_", "or_", "MUT", "_", "._", "DEF", "AUL", "T", "\\u", "TIME", "OUT", "\\u", "SECONDS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "PROJECT_", ",_", "credentials_", "=_", "creds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "only_", "=_", "read", "\\u", "only_", ",_", "admin_", "=_", "admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "user", "\\u", "agent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeo", "ut", "\\u", "seconds_", "=_", "timeo", "ut", "\\u", "seconds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "creds_", "=_", "expected", "\\u", "creds_", "or_", "creds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "credentials_", "is_", "expected", "\\u", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expected", "\\u", "scopes_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "\\u", "credentials_", "._", "scopes_", ",_", "expected", "\\u", "scopes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "project_", ",_", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "timeo", "ut", "\\u", "seconds_", ",_", "timeo", "ut", "\\u", "seconds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "user", "\\u", "agent_", ",_", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "stub", "s", " ", "are", " ", "set", " ", "(", "but", " ", "null", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cred", "ential", "s", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "credentials_", "is_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "data\\u", "stub", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "data\\u", "stub_", "is_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "cluster", "\\u", "stub", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "cluster", "\\u", "stub_", "is_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "operati", "ons", "\\u", "stub", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub_", "is_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "table", "\\u", "stub", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "table", "\\u", "stub_", "is_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "\\u", "make", "\\u", "data\\u", "stub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "DATA", "\\u", "API", "\\u", "HOST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "DATA", "\\u", "API", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "DATA", "\\u", "STU", "B", "\\u", "FACTORY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "stub_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "stub", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "make", "\\u", "stub_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "stub", "\\u", "args_", "._", "append_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fake", "\\u", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "\\u", "make", "\\u", "stub_", "=_", "mock", "\\u", "make", "\\u", "stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "\\u", "make", "\\u", "data\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "fake", "\\u", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "make", "\\u", "stub", "\\u", "args_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DATA", "\\u", "STU", "B", "\\u", "FACTORY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DATA", "\\u", "API", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DATA", "\\u", "API", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "make", "\\u", "cluster", "\\u", "stub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "HOST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "CLUSTER", "\\u", "STU", "B", "\\u", "FACTORY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "stub_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "stub", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "make", "\\u", "stub_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "stub", "\\u", "args_", "._", "append_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fake", "\\u", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "\\u", "make", "\\u", "stub_", "=_", "mock", "\\u", "make", "\\u", "stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "\\u", "make", "\\u", "cluster", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "fake", "\\u", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "make", "\\u", "stub", "\\u", "args_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CLUSTER", "\\u", "STU", "B", "\\u", "FACTORY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "make", "\\u", "operati", "ons", "\\u", "stub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "HOST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "OPERATION", "S", "\\u", "STU", "B", "\\u", "FACTORY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "stub_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "stub", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "make", "\\u", "stub_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "stub", "\\u", "args_", "._", "append_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fake", "\\u", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "\\u", "make", "\\u", "stub_", "=_", "mock", "\\u", "make", "\\u", "stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "\\u", "make", "\\u", "operati", "ons", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "fake", "\\u", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "make", "\\u", "stub", "\\u", "args_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OPERATION", "S", "\\u", "STU", "B", "\\u", "FACTORY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CLUSTER", "\\u", "ADM", "IN", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "make", "\\u", "table", "\\u", "stub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "TAB", "LE", "\\u", "ADM", "IN", "\\u", "HOST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "TAB", "LE", "\\u", "ADM", "IN", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "TAB", "LE", "\\u", "STU", "B", "\\u", "FACTORY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "stub_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "stub", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "make", "\\u", "stub_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "stub", "\\u", "args_", "._", "append_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fake", "\\u", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "\\u", "make", "\\u", "stub_", "=_", "mock", "\\u", "make", "\\u", "stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "\\u", "make", "\\u", "table", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "fake", "\\u", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "make", "\\u", "stub", "\\u", "args_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TAB", "LE", "\\u", "STU", "B", "\\u", "FACTORY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TAB", "LE", "\\u", "ADM", "IN", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TAB", "LE", "\\u", "ADM", "IN", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "start", "\\u", "method", "\\u", "helper_", "(_", "self_", ",_", "admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "\\u", "testing_", "import_", "\\u", "Fake", "Stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stub_", "=_", "\\u", "Fake", "Stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "stub", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "make", "\\u", "stub_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "stub", "\\u", "args_", "._", "append_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "\\u", "make", "\\u", "stub_", "=_", "mock", "\\u", "make", "\\u", "stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", "is_", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", "is_", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", "is_", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", "is_", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub_", "._", "\\u", "enter", "ed_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "make", "\\u", "stub", "\\u", "args_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub_", "._", "\\u", "enter", "ed_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "make", "\\u", "stub", "\\u", "args_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub_", "._", "\\u", "exit", "ed_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stop", "\\u", "method", "\\u", "helper_", "(_", "self_", ",_", "admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "\\u", "testing_", "import_", "\\u", "Fake", "Stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stub", "1_", "=_", "\\u", "Fake", "Stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "2_", "=_", "\\u", "Fake", "Stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", "=_", "stub", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", "=_", "stub", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", "=_", "stub", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", "=_", "stub", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "data\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "cluster", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "operati", "ons", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "table", "\\u", "stub", "\\u", "internal_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub", "1_", "._", "\\u", "enter", "ed_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub", "2_", "._", "\\u", "enter", "ed_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "none", "\\u", "triple_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub", "1_", "._", "\\u", "exit", "ed_", ",_", "[_", "exc", "\\u", "none", "\\u", "triple_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "stub", "2_", "._", "\\u", "exit", "ed_", ",_", "[_", "exc", "\\u", "none", "\\u", "triple_", "]_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "stub", "2_", "._", "\\u", "exit", "ed_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cluster", "\\u", "factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "cluster_", "import_", "Cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", "=_", "'", "zone", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "'", "cluster", "-", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "name_", "=_", "'", "display", "-", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serve", "\\u", "nodes_", "=_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "=_", "client_", "._", "cluster_", "(_", "zone_", ",_", "cluster", "\\u", "id_", ",_", "display", "\\u", "name_", "=_", "display", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serve", "\\u", "nodes_", "=_", "serve", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "cluster_", ",_", "Cluster_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cluster_", "._", "zone_", ",_", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cluster_", "._", "cluster", "\\u", "id_", ",_", "cluster", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cluster_", "._", "display", "\\u", "name_", ",_", "display", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cluster_", "._", "serve", "\\u", "nodes_", ",_", "serve", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cluster_", "._", "\\u", "client_", "is_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Meta", "data", "Plugin_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "constructor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "._", "client_", "import_", "DATA", "\\u", "SCOPE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "\\u", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "agent_", "=_", "'", "USER", "\\u", "AGE", "NT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "(_", "project_", "=_", "project_", ",_", "credentials_", "=_", "credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transformer_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "transformer_", "._", "\\u", "credentials_", "is_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "transformer_", "._", "\\u", "user", "\\u", "agent_", ",_", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "credentials_", "._", "scopes_", ",_", "[_", "DATA", "\\u", "SCOPE", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u\\u", "make", "\\u", "stub_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "it_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "bigtable", "_", "import_", "client_", "as_", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "result_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "\\u", "inputs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SS", "L", "\\u", "CRED", "S_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "METAD", "ATA", "\\u", "CRED", "S_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMPO", "SITE", "\\u", "CRED", "S_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHANNEL_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Implementation", "s", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ssl", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metadata", "\\u", "call", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "composi", "te", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "secure", "\\u", "channel", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssl", "\\u", "channel", "\\u", "credentials_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ssl", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "SS", "L", "\\u", "CRED", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "metadata", "\\u", "call", "\\u", "credentials_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metadata", "\\u", "call", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "(_", "args_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "METAD", "ATA", "\\u", "CRED", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "composi", "te", "\\u", "channel", "\\u", "credentials_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "composi", "te", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "COMPO", "SITE", "\\u", "CRED", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "secure", "\\u", "channel_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "secure", "\\u", "channel", "\\u", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "CHANNEL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "implementation", "s", "\\u", "mod_", "=_", "\\u", "Implementation", "s", "Module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "stub", "\\u", "factory_", "(_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stub", "\\u", "inputs_", "._", "append_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mock", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata", "\\u", "plugin_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clients_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "plugin_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clients_", "._", "append_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "metadata", "\\u", "plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "'", "HOST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "1025", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "MUT", "_", ",_", "implementation", "s_", "=_", "implementation", "s", "\\u", "mod_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Meta", "data", "Plugin_", "=_", "mock", "\\u", "plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "call", "FUT", "_", "(_", "client_", ",_", "mock", "\\u", "stub", "\\u", "factory_", ",_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "mock", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stub", "\\u", "inputs_", ",_", "[_", "CHANNEL_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "clients_", ",_", "[_", "client_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "implementation", "s", "\\u", "mod_", "._", "ssl", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "implementation", "s", "\\u", "mod_", "._", "metadata", "\\u", "call", "\\u", "cred", "ential", "s", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "metadata", "\\u", "plugin_", ",_", ")_", ",_", "{_", "'", "name", "'_", ":_", "'", "google", "\\u", "creds", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "implementation", "s", "\\u", "mod_", "._", "composi", "te", "\\u", "channel", "\\u", "cred", "ential", "s", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SS", "L", "\\u", "CRED", "S_", ",_", "METAD", "ATA", "\\u", "CRED", "S_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "implementation", "s", "\\u", "mod_", "._", "secure", "\\u", "channel", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "host_", ",_", "port_", ",_", "COMPO", "SITE", "\\u", "CRED", "S_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\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in/env python3\n\n# Version 2.1\n# Apple has again changed the warranty lookup method and now redirects to\n# a CAPTCHA protected page at https://checkcoverage.apple.com/\n# As such, no \"online\" warranty status is now possible. All warranty\n# information is now estimated.\n#\n# API changes:\n# .online_warranty and .offline_warranty are deprecated and both\n# now point to the replacement .warranty (which is offline only)\n\n# To use as a python module:\n# import getwarranty\n# results = getwarranty.warranty( ... one or more serials ... )\n\n\"\"\"Usage: getwarranty [OPTION ...] [SERIAL1 SERIAL2 ...]\n\nList warranty information for one or more Apple devices.\n\nIf no serial number is provided on the command-line, the script will\nassume it's running on an OS X machine and attempt to query the local\nserial number and provide information regarding it.\n\nDefault output is \"ATTRIBUTE: value\", per line. Use the options below\nfor alternate format output.\n\nOptions:\n-h, --help Display this message\n-f, --file FILE Read serial numbers from FILE (one per line)\n-o, --output Save output to specified file instead of stdout\n-c, --csv Output in comma-separated format\n-t, --tsv Output in tab-separated format\n\nExample usage:\nRead from file, save to csv: getwarranty -f serials.txt -o output.csv\nPrint local serial to stdout: getwarranty\nSeveral serials to stdout: getwarranty SERIAL1 SERIAL2 SERIAL3\n\"\"\"\n\nimport sys, subprocess, datetime, os.path, dateutil.parser\nimport re, types, time, getopt, csv, codecs\nfrom io import StringIO\nimport xml.etree.ElementTree as ET \n# import pickle --- no longer doing pickles, switch to json\ntry:\n import json\nexcept:\n import simplejson as json\n\ntry:\n import requests\nexcept:\n # My strange hack to use standard libs, if requests module isn't available\n # http://docs.python-requests.org/en/latest/index.html\n # Really, check it out - it's great\n import urllib, types\n import urllib2 as requests\n setattr(requests,'content','')\n requests.get = types.MethodType(get,requests)\n\nasd_db = {}\nmodel_db = {}\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Deprecated, see notes above\nonline_warranty_generator = warranty_generator\n\n# Deprecated, see notes above\nonline_warranty = warranty\n\n# Deprecated, see notes above\noffline_warranty_generator = warranty_generator\n\n# Deprecated, see notes above\noffline_warranty = warranty\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def init_asd_db():\n global asd_db\n if (not asd_db):\n try:\n response = requests.get('https://raw.github.com/stefanschmidt/warranty/master/asdcheck')\n for model,val in [model_str.strip().split(':') for model_str in response.content.split('\\n') if model_str.strip()]:\n asd_db[model] = val\n except:\n asd_db = {}", "metadata": "root.init_asd_db", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def init_model_db():\n global model_db\n if (not model_db):\n try:\n # model_file = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'model_snippets.pickle'), 'rb')\n model_file = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'model_snippets.json'), 'r')\n # model_db = pickle.load(model_file)\n model_db = json.load(model_file)\n model_file.close()\n except:\n model_db = {}", "metadata": "root.init_model_db", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def online_snippet_lookup(serial):\n if len(serial) == 11:\n snippet = serial[-3:]\n elif len(serial) == 12:\n snippet = serial[-4:]\n elif 2 < len(serial) < 5:\n snippet = serial\n else:\n return None\n try:\n prod_xml = requests.get('http://support-sp.apple.com/sp/product', params={'cc': snippet, 'lang': 'en_US'}).content\n prod_descr = ET.fromstring(prod_xml).find('configCode').text\n except:\n return none\n return prod_descr", "metadata": "root.online_snippet_lookup", "header": "['module', '___EOS___']", "index": 130 }, { "content": "def online_asd_version(prod_descr):\n global asd_db\n init_asd_db()\n try:\n return asd_db.get(prod_descr, u'')\n except:\n return u''", "metadata": "root.online_asd_version", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def warranty_generator(serials):\n # One or more arguments can be passed.\n # The arguments can be a single string or a sequence of strings\n for serial in serials:\n if not isinstance(serial, str):\n # if (not hasattr(serial, \"strip\") and hasattr(serial, \"__getitem__\") or hasattr(serial, \"__iter__\")):\n # Iterable, but not a string - recurse using items of the sequence as individual arguments\n for result in warranty_generator(*serial):\n yield result\n else:\n # Assume string and continue\n prod_dict = blank_machine_dict()\n prod_dict['SERIAL_ID'] = serial\n try:\n prod_descr = offline_snippet_lookup(prod_dict['SERIAL_ID'])\n except:\n prod_descr = None\n if (not prod_descr):\n # It's not in the snippet database, look it up\n try:\n prod_descr = online_snippet_lookup(prod_dict['SERIAL_ID'])\n except:\n prod_descr = None\n if (not prod_descr):\n prod_dict[u'ERROR_CODE'] = 'Unknown model snippet'\n try:\n prod_dict[u'PROD_DESCR'] = '' + prod_descr\n except:\n prod_dict[u'PROD_DESCR'] = ''\n # Fill in some details with estimations\n try:\n prod_dict[u'EST_MANUFACTURE_DATE'] = offline_estimated_manufacture(serial)\n except:\n prod_dict[u'EST_MANUFACTURE_DATE'] = u''\n if (prod_dict[u'EST_MANUFACTURE_DATE']):\n # Try to estimate when coverages expire\n prod_dict[u'EST_PURCHASE_DATE'] = u'' + prod_dict[u'EST_MANUFACTURE_DATE']\n prod_dict[u'EST_WARRANTY_END_DATE'] = offline_estimated_warranty_end_date(prod_dict)\n prod_dict[u'EST_APPLECARE_END_DATE'] = offline_estimated_applecare_end_date(prod_dict)\n if (datetime.datetime.now() > dateutil.parser.parse(prod_dict[u'EST_APPLECARE_END_DATE'])):\n prod_dict[u'EST_WARRANTY_STATUS'] = u'EXPIRED'\n elif (datetime.datetime.now() > dateutil.parser.parse(prod_dict[u'EST_WARRANTY_END_DATE'])):\n prod_dict[u'EST_WARRANTY_STATUS'] = u'APPLECARE'\n else:\n prod_dict[u'EST_WARRANTY_STATUS'] = u'LIMITED'\n yield prod_dict", "metadata": "root.warranty_generator", "header": "['module', '___EOS___']", "index": 200 }, { "content": "def main():\n try:\n opts, args = getopt.getopt(sys.argv[1:], \"hf:o:ct\", [\"help\", \"file=\", \"output=\",\"csv\",\"tsv\"])\n except getopt.GetoptError as err:\n print (str(err))\n usage()\n outfile,format = None,None\n for o, a in opts:\n if o in (\"-h\", \"--help\"):\n usage()\n elif o in (\"-f\", \"--file\"):\n try:\n f = open(a, \"rb\")\n except:\n print (\"Unable to read file:\", a)\n usage()\n args = [line for line in f.read().splitlines() if line.strip()]\n f.close()\n elif o in (\"-o\", \"--output\"):\n outfile = a\n elif o in (\"-c\", \"--csv\"):\n format = \"csv\"\n elif o in (\"-t\", \"--tsv\"):\n format = \"tsv\"\n # Whatever args remain are considered serials\n serials = args\n warranty_dicts = []\n\n print(offline_estimated_manufacture(\"C02PQB5VG8WP\"))\n\n for serial in (serials or my_serial()):\n results = warranty(serial)\n # print(results)\n if type(results) == dict:\n results = [results]\n warranty_dicts.extend(results)\n csv.register_dialect('exceltab', delimiter='\\t')\n csv.register_dialect('excel', delimiter=',')\n # writer = UnicodeWriter(outfile, dialect='exceltab')\n if (not format):\n plain_format = \"\"\n for result in warranty_dicts:\n plain_format += \"%s: %s\\n\" % (u'SERIAL_ID', result[u'SERIAL_ID'])\n plain_format += \"%s: %s\\n\" % (u'PROD_DESCR', result[u'PROD_DESCR'])\n for key,val in sorted(result.items(), key=lambda x: x[0]):\n if (key not in (u'SERIAL_ID', u'PROD_DESCR', u'ERROR_CODE')):\n plain_format += \"%s: %s\\n\" % (key, val)\n plain_format += \"%s: %s\\n\\n\" % (u'ERROR_CODE', result[u'ERROR_CODE'])\n if (not outfile):\n sys.stdout.write(plain_format)\n else:\n open(outfile,\"wb\").write(plain_format)\n elif (format in ['csv','tsv']):\n if (not outfile):\n outfile = sys.stdout\n else:\n outfile = open(outfile, \"wb\")\n dialect = {'csv': 'excel', 'tsv': 'exceltab'}[format]\n writer = UnicodeWriter(outfile, dialect=dialect)\n # write out headers\n sample_machine = blank_machine_dict()\n header_row = [u'SERIAL_ID', u'PROD_DESCR']\n for key,val in sorted(sample_machine.items(), key=lambda x: x[0]):\n if (key not in (u'SERIAL_ID', u'PROD_DESCR', u'ERROR_CODE')):\n header_row.append(key)\n header_row.append(u'ERROR_CODE')\n writer.writerow(header_row)\n for result in warranty_dicts:\n row_data = [result[u'SERIAL_ID']]\n row_data.append(result[u'PROD_DESCR'])\n for key,val in sorted(result.items(), key=lambda x: x[0]):\n if (key not in (u'SERIAL_ID', u'PROD_DESCR', u'ERROR_CODE')):\n row_data.append(val)\n row_data.append(result[u'ERROR_CODE'])\n writer.writerow(row_data)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 298 } ]
[ { "span": "except:", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 7 }, { "span": "except:", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 7 }, { "span": "except:", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 15 }, { "span": "except:", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 15 }, { "span": "except:", "start_line": 142, "start_column": 4, "end_line": 142, "end_column": 11 }, { "span": "except:", "start_line": 151, "start_column": 4, "end_line": 151, "end_column": 11 }, { "span": "except:", "start_line": 215, "start_column": 12, "end_line": 215, "end_column": 19 }, { "span": "except:", "start_line": 221, "start_column": 16, "end_line": 221, "end_column": 23 }, { "span": "except:", "start_line": 227, "start_column": 12, "end_line": 227, "end_column": 19 }, { "span": "except:", "start_line": 232, "start_column": 12, "end_line": 232, "end_column": 19 }, { "span": "except:", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "2.1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apple", " ", "has", " ", "again", " ", "change", "d", " ", "the", " ", "warr", "ant", "y", " ", "look", "up", " ", "method", " ", "and", " ", "now", " ", "redirec", "ts", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "CAPT", "CHA", " ", "protect", "ed", " ", "page", " ", "at", " ", "https", "://", "check", "covera", "ge", ".", "apple", ".", "com", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "suc", "h", ",", " ", "no", " ", "\"", "onli", "ne", "\"", " ", "warr", "ant", "y", " ", "status", " ", "is", " ", "now", " ", "possib", "le", ".", " ", "All", " ", "warr", "ant", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "on", " ", "is", " ", "now", " ", "estimate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", " ", "change", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "onli", "ne", "\\u", "warr", "ant", "y", " ", "and", " ", ".", "offline", "\\u", "warr", "ant", "y", " ", "are", " ", "depre", "cated", " ", "and", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "point", " ", "to", " ", "the", " ", "replace", "ment", " ", ".", "warr", "ant", "y", " ", "(", "whi", "ch", " ", "is", " ", "offline", " ", "only", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "use", " ", "as", " ", "a", " ", "python", " ", "module", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "getw", "arr", "ant", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", " ", "getw", "arr", "ant", "y", ".", "warr", "ant", "y", "(", " ", "...", " ", "one", " ", "or", " ", "more", " ", "serial", "s", " ", "...", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Us", "age", ":", " ", "getw", "arr", "ant", "y", " ", "[", "OPTION", " ", "...]", " ", "[", "SERIAL", "1", " ", "SERIAL", "2", " ", "...]", "\\", "10", ";", "\\", "10", ";", "List", " ", "warr", "ant", "y", " ", "informati", "on", " ", "for", " ", "one", " ", "or", " ", "more", " ", "Apple", " ", "device", "s", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "no", " ", "serial", " ", "number", " ", "is", " ", "provided", " ", "on", " ", "the", " ", "command", "-", "line", ",", " ", "the", " ", "script", " ", "will", "\\", "10", ";", "assume", " ", "it", "'", "s", " ", "runn", "ing", " ", "on", " ", "an", " ", "OS", " ", "X", " ", "machine", " ", "and", " ", "atte", "mpt", " ", "to", " ", "query", " ", "the", " ", "local", "\\", "10", ";", "serial", " ", "number", " ", "and", " ", "provide", " ", "informati", "on", " ", "regarding", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", "Default", " ", "output", " ", "is", " ", "\"", "ATTRIBUTE", ":", " ", "value", "\",", " ", "per", " ", "line", ".", " ", "Us", "e", " ", "the", " ", "options", " ", "belo", "w", "\\", "10", ";", "for", " ", "alternat", "e", " ", "format", " ", "output", ".", "\\", "10", ";", "\\", "10", ";", "Optio", "ns", ":", "\\", "10", ";", "-", "h", ",", " ", "--", "help", " ", " ", "Display", " ", "this", " ", "message", "\\", "10", ";", "-", "f", ",", " ", "--", "file", " ", "FILE", " ", "Read", " ", "serial", " ", "numbers", " ", "from", " ", "FILE", " ", "(", "one", " ", "per", " ", "line", ")", "\\", "10", ";", "-", "o", ",", " ", "--", "output", " ", " ", " ", " ", "Save", " ", "output", " ", "to", " ", "specified", " ", "file", " ", "inst", "ead", " ", "of", " ", "stdout", "\\", "10", ";", "-", "c", ",", " ", "--", "csv", " ", " ", " ", "Output", " ", "in", " ", "comma", "-", "separate", "d", " ", "format", "\\", "10", ";", "-", "t", ",", " ", "--", "tsv", " ", " ", " ", "Output", " ", "in", " ", "tab", "-", "separate", "d", " ", "format", "\\", "10", ";", "\\", "10", ";", "Exam", "ple", " ", "usage", ":", "\\", "10", ";", "Read", " ", "from", " ", "file", ",", " ", "save", " ", "to", " ", "csv", ":", " ", " ", " ", " ", "getw", "arr", "ant", "y", " ", "-", "f", " ", "serial", "s", ".", "txt", " ", "-", "o", " ", "output", ".", "csv", "\\", "10", ";", "Print", " ", "local", " ", "serial", " ", "to", " ", "stdout", ":", " ", " ", " ", "getw", "arr", "ant", "y", "\\", "10", ";", "Seve", "ral", " ", "serial", "s", " ", "to", " ", "stdout", ":", " ", " ", "getw", "arr", "ant", "y", " ", "SERIAL", "1", " ", "SERIAL", "2", " ", "SERIAL", "3", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "subprocess_", ",_", "datetime_", ",_", "os_", "._", "path_", ",_", "dateutil_", "._", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", ",_", "types_", ",_", "time_", ",_", "getopt_", ",_", "csv_", ",_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "import", " ", "pickle", " ", " ", " ", "---", " ", "no", " ", "long", "er", " ", "doi", "ng", " ", "pickle", "s", ",", " ", "switch", " ", "to", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\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 ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "My", " ", "stran", "ge", " ", "hack", " ", "to", " ", "use", " ", "standard", " ", "libs", ",", " ", "if", " ", "request", "s", " ", "module", " ", "isn", "'", "t", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "docs", ".", "python", "-", "request", "s", ".", "org", "/", "en", "/", "late", "st", "/", "index", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Real", "ly", ",", " ", "check", " ", "it", " ", "out", " ", "-", " ", "it", "'", "s", " ", "great", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "urllib_", ",_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "as_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "requests_", ",_", "'", "content", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requests_", "._", "get_", "=_", "types_", "._", "Meth", "od", "Type_", "(_", "get_", ",_", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asd", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "onli", "ne", "\\u", "warr", "ant", "y", "\\u", "generator_", "=_", "warr", "ant", "y", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "onli", "ne", "\\u", "warr", "ant", "y_", "=_", "warr", "ant", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "offline", "\\u", "warr", "ant", "y", "\\u", "generator_", "=_", "warr", "ant", "y", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "offline", "\\u", "warr", "ant", "y_", "=_", "warr", "ant", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init", "\\u", "asd", "\\u", "db_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "asd", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "asd", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "requests_", "._", "get_", "(_", "'", "https", "://", "raw", ".", "git", "hub", ".", "com", "/", "ste", "fan", "sch", "mid", "t", "/", "warr", "ant", "y", "/", "master", "/", "asd", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", ",_", "val_", "in_", "[_", "model", "\\u", "str_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "':'_", ")_", "for_", "model", "\\u", "str_", "in_", "response_", "._", "content_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "if_", "model", "\\u", "str_", "._", "strip_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asd", "\\u", "db_", "[_", "model_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asd", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\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_", "init", "\\u", "model", "\\u", "db_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "model", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "model", "\\u", "file", " ", "=", " ", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dir", "name", "(", "os", ".", "path", ".", "abs", "path", "(\\u", "\\u", "file", "\\u\\u)", "),", " ", "'", "model", "\\u", "snippet", "s", ".", "pickle", "')", ",", " ", "'", "rb", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "file_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "model", "\\u", "snippet", "s", ".", "json", "'_", ")_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "model", "\\u", "db", " ", "=", " ", "pickle", ".", "load", "(", "model", "\\u", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "db_", "=_", "json_", "._", "load_", "(_", "model", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "file_", "._", "close_", "(_", ")_", "\\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 ", " _", "model", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\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_", "onli", "ne", "\\u", "snippet", "\\u", "lookup_", "(_", "serial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "serial_", ")_", "==_", "11_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "snippet_", "=_", "serial_", "[_", "-_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "serial_", ")_", "==_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "snippet_", "=_", "serial_", "[_", "-_", "4_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "2_", "<_", "len_", "(_", "serial_", ")_", "<_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "snippet_", "=_", "serial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "xml_", "=_", "requests_", "._", "get_", "(_", "'", "http", "://", "support", "-", "sp", ".", "apple", ".", "com", "/", "sp", "/", "product", "'_", ",_", "params_", "=_", "{_", "'", "cc", "'_", ":_", "snippet_", ",_", "'", "lang", "'_", ":_", "'", "en", "\\u", "US", "'_", "}_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod", "\\u", "descr_", "=_", "ET_", "._", "fromstring_", "(_", "prod", "\\u", "xml_", ")_", "._", "find_", "(_", "'", "config", "Code", "'_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "none_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prod", "\\u", "descr_", "\\u\\u\\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_", "onli", "ne", "\\u", "asd", "\\u", "version_", "(_", "prod", "\\u", "descr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "asd", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "asd", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asd", "\\u", "db_", "._", "get_", "(_", "prod", "\\u", "descr_", ",_", "u", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "''_", "\\u\\u\\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_", "warr", "ant", "y", "\\u", "generator_", "(_", "serial", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "One", " ", "or", " ", "more", " ", "argu", "ment", "s", " ", "can", " ", "be", " ", "pass", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "argu", "ment", "s", " ", "can", " ", "be", " ", "a", " ", "single", " ", "string", " ", "or", " ", "a", " ", "sequence", " ", "of", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "serial_", "in_", "serial", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "serial_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "(", "not", " ", "has", "attr", "(", "serial", ",", " ", "\"", "strip", "\")", " ", "and", " ", "has", "attr", "(", "serial", ",", " ", "\"\\u\\u", "getitem", "\\u\\u\"", ")", " ", "or", " ", "has", "attr", "(", "serial", ",", " ", "\"\\u\\u", "iter", "\\u\\u\"", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "era", "ble", ",", " ", "but", " ", "not", " ", "a", " ", "string", " ", "-", " ", "recurse", " ", "usi", "ng", " ", "items", " ", "of", " ", "the", " ", "sequence", " ", "as", " ", "individual", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "result_", "in_", "warr", "ant", "y", "\\u", "generator_", "(_", "*_", "serial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "result_", "\\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_", "#", " ", "Assume", " ", "string", " ", "and", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "dict_", "=_", "blank", "\\u", "machine", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod", "\\u", "dict_", "[_", "'", "SERIAL", "\\u", "ID", "'_", "]_", "=_", "serial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "descr_", "=_", "offline", "\\u", "snippet", "\\u", "lookup_", "(_", "prod", "\\u", "dict_", "[_", "'", "SERIAL", "\\u", "ID", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "descr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "prod", "\\u", "descr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "not", " ", "in", " ", "the", " ", "snippet", " ", "databa", "se", ",", " ", "look", " ", "it", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prod", "\\u", "descr_", "=_", "onli", "ne", "\\u", "snippet", "\\u", "lookup_", "(_", "prod", "\\u", "dict_", "[_", "'", "SERIAL", "\\u", "ID", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prod", "\\u", "descr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "prod", "\\u", "descr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "ERROR", "\\u", "CODE", "'_", "]_", "=_", "'", "Un", "know", "n", " ", "model", " ", "snippet", "'_", "\\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 ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", "]_", "=_", "''_", "+_", "prod", "\\u", "descr_", "\\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 ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fil", "l", " ", "in", " ", "some", " ", "deta", "il", "s", " ", "with", " ", "estimati", "ons_", "\\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 ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "MANU", "FACT", "URE", "\\u", "DAT", "E", "'_", "]_", "=_", "offline", "\\u", "estimate", "d\\u", "manufactur", "e_", "(_", "serial_", ")_", "\\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 ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "MANU", "FACT", "URE", "\\u", "DAT", "E", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "MANU", "FACT", "URE", "\\u", "DAT", "E", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "estimate", " ", "whe", "n", " ", "covera", "ges", " ", "expire_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "PUR", "CHA", "SE", "\\u", "DAT", "E", "'_", "]_", "=_", "u", "''_", "+_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "MANU", "FACT", "URE", "\\u", "DAT", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "WAR", "RAN", "TY", "\\u", "END", "\\u", "DAT", "E", "'_", "]_", "=_", "offline", "\\u", "estimate", "d\\u", "warr", "ant", "y", "\\u", "end", "\\u", "date_", "(_", "prod", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "APPL", "EC", "ARE", "\\u", "END", "\\u", "DAT", "E", "'_", "]_", "=_", "offline", "\\u", "estimate", "d\\u", "apple", "care", "\\u", "end", "\\u", "date_", "(_", "prod", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ">_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "APPL", "EC", "ARE", "\\u", "END", "\\u", "DAT", "E", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "WAR", "RAN", "TY", "\\u", "STATUS", "'_", "]_", "=_", "u", "'", "EXPIRE", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ">_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "WAR", "RAN", "TY", "\\u", "END", "\\u", "DAT", "E", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "WAR", "RAN", "TY", "\\u", "STATUS", "'_", "]_", "=_", "u", "'", "APPL", "EC", "ARE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prod", "\\u", "dict_", "[_", "u", "'", "EST", "\\u", "WAR", "RAN", "TY", "\\u", "STATUS", "'_", "]_", "=_", "u", "'", "LIMIT", "ED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "prod", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\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 ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "\"", "hf", ":", "o", ":", "ct", "\"_", ",_", "[_", "\"", "help", "\"_", ",_", "\"", "file", "=\"_", ",_", "\"", "output", "=\"_", ",_", "\"", "csv", "\"_", ",_", "\"", "tsv", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", ",_", "format_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "in_", "(_", "\"-", "h", "\"_", ",_", "\"--", "help", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "f", "\"_", ",_", "\"--", "file", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "a_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Una", "ble", " ", "to", " ", "read", " ", "file", ":\"_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "line_", "for_", "line_", "in_", "f_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", "if_", "line_", "._", "strip_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "o", "\"_", ",_", "\"--", "output", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "c", "\"_", ",_", "\"--", "csv", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "=_", "\"", "csv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "\"-", "t", "\"_", ",_", "\"--", "tsv", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "=_", "\"", "tsv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "What", "ever", " ", "args", " ", "rema", "in", " ", "are", " ", "consider", "ed", " ", "serial", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "serial", "s_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warr", "ant", "y", "\\u", "dicts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "offline", "\\u", "estimate", "d\\u", "manufactur", "e_", "(_", "\"", "C0", "2", "PQ", "B5", "VG", "8", "WP", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "serial_", "in_", "(_", "serial", "s_", "or_", "my", "\\u", "serial_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "warr", "ant", "y_", "(_", "serial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(", "results", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "results_", ")_", "==_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "warr", "ant", "y", "\\u", "dicts_", "._", "extend_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csv_", "._", "register", "\\u", "dialect_", "(_", "'", "exce", "lta", "b", "'_", ",_", "delimiter_", "=_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv_", "._", "register", "\\u", "dialect_", "(_", "'", "exce", "l", "'_", ",_", "delimiter_", "=_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "writer", " ", "=", " ", "Unic", "ode", "Write", "r", "(", "outfile", ",", " ", "dialect", "='", "exce", "lta", "b", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plain", "\\u", "format_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "warr", "ant", "y", "\\u", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plain", "\\u", "format_", "+=_", "\"%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "u", "'", "SERIAL", "\\u", "ID", "'_", ",_", "result_", "[_", "u", "'", "SERIAL", "\\u", "ID", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain", "\\u", "format_", "+=_", "\"%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", ",_", "result_", "[_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "sorted_", "(_", "result_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "(_", "u", "'", "SERIAL", "\\u", "ID", "'_", ",_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", ",_", "u", "'", "ERROR", "\\u", "CODE", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "plain", "\\u", "format_", "+=_", "\"%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "key_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plain", "\\u", "format_", "+=_", "\"%", "s", ":", " ", "%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "(_", "u", "'", "ERROR", "\\u", "CODE", "'_", ",_", "result_", "[_", "u", "'", "ERROR", "\\u", "CODE", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "plain", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", "outfile_", ",_", "\"", "wb", "\"_", ")_", "._", "write_", "(_", "plain", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "format_", "in_", "[_", "'", "csv", "'_", ",_", "'", "tsv", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "open_", "(_", "outfile_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dialect_", "=_", "{_", "'", "csv", "'_", ":_", "'", "exce", "l", "'_", ",_", "'", "tsv", "'_", ":_", "'", "exce", "lta", "b", "'_", "}_", "[_", "format_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "=_", "Unic", "ode", "Writer_", "(_", "outfile_", ",_", "dialect_", "=_", "dialect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "write", " ", "out", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "\\u", "machine_", "=_", "blank", "\\u", "machine", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "row_", "=_", "[_", "u", "'", "SERIAL", "\\u", "ID", "'_", ",_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "sorted_", "(_", "sample", "\\u", "machine_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "(_", "u", "'", "SERIAL", "\\u", "ID", "'_", ",_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", ",_", "u", "'", "ERROR", "\\u", "CODE", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "\\u", "row_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "\\u", "row_", "._", "append_", "(_", "u", "'", "ERROR", "\\u", "CODE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "header", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "warr", "ant", "y", "\\u", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "\\u", "data_", "=_", "[_", "result_", "[_", "u", "'", "SERIAL", "\\u", "ID", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "data_", "._", "append_", "(_", "result_", "[_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "sorted_", "(_", "result_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "(_", "u", "'", "SERIAL", "\\u", "ID", "'_", ",_", "u", "'", "PROD", "\\u", "DESC", "R", "'_", ",_", "u", "'", "ERROR", "\\u", "CODE", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row", "\\u", "data_", "._", "append_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row", "\\u", "data_", "._", "append_", "(_", "result_", "[_", "u", "'", "ERROR", "\\u", "CODE", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "row", "\\u", "data_", ")_", "\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of identical values
Yelp/paasta/paasta_tools/cli/cmds/status.py
[ { "content": "def get_actual_deployments(service, soa_dir):\n deployments_json = load_deployments_json(service, soa_dir)\n if not deployments_json:\n sys.stderr.write(\"Warning: it looks like %s has not been deployed anywhere yet!\\n\" % service)\n # Create a dictionary of actual $service Jenkins deployments\n actual_deployments = {}\n for key in deployments_json:\n service, namespace = key.encode('utf8').split(':')\n if service == service:\n value = deployments_json[key]['docker_image'].encode('utf8')\n sha = value[value.rfind('-') + 1:]\n actual_deployments[namespace.replace('paasta-', '', 1)] = sha\n return actual_deployments", "metadata": "root.get_actual_deployments", "header": "['module', '___EOS___']", "index": 115 } ]
[ { "span": "service == service:", "start_line": 123, "start_column": 11, "end_line": 123, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "identical_", "values_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "actual", "\\u", "deployments", "_", "(_", "service_", ",_", "soa", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deployments", "\\u", "json_", "=_", "load", "\\u", "deployments", "\\u", "json_", "(_", "service_", ",_", "soa", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "deployments", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Warn", "ing", ":", " ", "it", " ", "look", "s", " ", "like", " ", "%", "s", " ", "has", " ", "not", " ", "bee", "n", " ", "deploye", "d", " ", "any", "where", " ", "ye", "t", "!\\\\", "n", "\"_", "%_", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "dictionar", "y", " ", "of", " ", "actual", " ", "$", "service", " ", "Jen", "kins", " ", "deployments", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual", "\\u", "deployments", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "deployments", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service_", ",_", "namespace_", "=_", "key_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "service_", "==_", "service_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "deployments", "\\u", "json_", "[_", "key_", "]_", "[_", "'", "docker", "\\u", "image", "'_", "]_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha_", "=_", "value_", "[_", "value_", "._", "rfind_", "(_", "'-'_", ")_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "deployments", "_", "[_", "namespace_", "._", "replace_", "(_", "'", "paasta", "-'_", ",_", "''_", ",_", "1_", ")_", "]_", "=_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "actual", "\\u", "deployments", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
AnyMesh/anyMesh-Python/example/urwid/main_loop.py
[ { "content": " def handle_exit(self,f):\n \"\"\"\n Decorator that cleanly exits the :class:`GLibEventLoop` if\n :exc:`ExitMainLoop` is thrown inside of the wrapped function. Store the\n exception info if some other exception occurs, it will be reraised after\n the loop quits.\n\n *f* -- function to be wrapped\n \"\"\"\n def wrapper(*args,**kargs):\n try:\n return f(*args,**kargs)\n except ExitMainLoop:\n self._loop.quit()\n except:\n import sys\n self._exc_info = sys.exc_info()\n if self._loop.is_running():\n self._loop.quit()\n return False\n return wrapper", "metadata": "root.GLibEventLoop.handle_exit", "header": "['class', 'GLibEventLoop', '(', 'object', ')', ':', '___EOS___']", "index": 839 }, { "content": " def handle_exit(self, f, enable_idle=True):\n \"\"\"\n Decorator that cleanly exits the :class:`TwistedEventLoop` if\n :class:`ExitMainLoop` is thrown inside of the wrapped function. Store the\n exception info if some other exception occurs, it will be reraised after\n the loop quits.\n\n *f* -- function to be wrapped\n \"\"\"\n def wrapper(*args,**kargs):\n rval = None\n try:\n rval = f(*args,**kargs)\n except ExitMainLoop:\n if self.manage_reactor:\n self.reactor.stop()\n except:\n import sys\n print sys.exc_info()\n self._exc_info = sys.exc_info()\n if self.manage_reactor:\n self.reactor.crash()\n if enable_idle:\n self._enable_twisted_idle()\n return rval\n return wrapper", "metadata": "root.TwistedEventLoop.handle_exit", "header": "['class', 'TwistedEventLoop', '(', 'object', ')', ':', '___EOS___']", "index": 1170 } ]
[ { "span": "except:", "start_line": 853, "start_column": 12, "end_line": 853, "end_column": 19 }, { "span": "except:", "start_line": 1186, "start_column": 12, "end_line": 1186, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "GL", "ib", "Event", "Loop_", "(_", "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_", "handle", "\\u", "exit_", "(_", "self_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "tha", "t", " ", "clean", "ly", " ", "exits", " ", "the", " ", ":", "class", ":`", "GL", "ib", "Event", "Loop", "`", " ", "if", "\\", "10", ";", " ", " ", " ", " ", ":", "exc", ":`", "Exi", "t", "Main", "Loop", "`", " ", "is", " ", "throw", "n", " ", "insi", "de", " ", "of", " ", "the", " ", "wrapp", "ed", " ", "function", ".", " ", "Stor", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "info", " ", "if", " ", "some", " ", "other", " ", "exception", " ", "occur", "s", ",", " ", "it", " ", "will", " ", "be", " ", "reraise", "d", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "loop", " ", "quit", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "f", "*", " ", "--", " ", "function", " ", "to", " ", "be", " ", "wrapp", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exi", "t", "Main", "Loop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "loop_", "._", "quit_", "(_", ")_", "\\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 ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "loop_", "._", "is", "\\u", "running_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "loop_", "._", "quit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twi", "sted", "Event", "Loop_", "(_", "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_", "handle", "\\u", "exit_", "(_", "self_", ",_", "f_", ",_", "enable", "\\u", "idle_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "tha", "t", " ", "clean", "ly", " ", "exits", " ", "the", " ", ":", "class", ":`", "Twi", "sted", "Event", "Loop", "`", " ", "if", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "Exi", "t", "Main", "Loop", "`", " ", "is", " ", "throw", "n", " ", "insi", "de", " ", "of", " ", "the", " ", "wrapp", "ed", " ", "function", ".", " ", "Stor", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "info", " ", "if", " ", "some", " ", "other", " ", "exception", " ", "occur", "s", ",", " ", "it", " ", "will", " ", "be", " ", "reraise", "d", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "loop", " ", "quit", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "f", "*", " ", "--", " ", "function", " ", "to", " ", "be", " ", "wrapp", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "=_", "f_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exi", "t", "Main", "Loop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "manage", "\\u", "reactor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "reactor_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "manage", "\\u", "reactor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "reactor_", "._", "crash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "enable", "\\u", "idle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "enable", "\\u", "twist", "ed", "\\u", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-json-api/django-rest-framework-json-api/example/tests/integration/test_non_paginated_responses.py
[ { "content": "from django.core.urlresolvers import reverse\nfrom django.conf import settings\n\nimport pytest\n\nfrom example.views import EntryViewSet\nfrom rest_framework_json_api.pagination import PageNumberPagination\n\nfrom example.tests.utils import dump_json, redump_json\n\npytestmark = pytest.mark.django_db\n\n\n# rf == request_factory\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_multiple_entries_no_pagination(multiple_entries, rf):\n\n expected = {\n \"data\": [\n {\n \"type\": \"posts\",\n \"id\": \"1\",\n \"attributes\":\n {\n \"headline\": multiple_entries[0].headline,\n \"bodyText\": multiple_entries[0].body_text,\n \"pubDate\": None,\n \"modDate\": None\n },\n \"meta\": {\n \"bodyFormat\": \"text\"\n },\n \"relationships\":\n {\n \"blog\": {\n \"data\": {\"type\": \"blogs\", \"id\": \"1\"}\n },\n \"authors\": {\n \"meta\": {\"count\": 1},\n \"data\": [{\"type\": \"authors\", \"id\": \"1\"}]\n },\n \"comments\": {\n \"meta\": {\"count\": 1},\n \"data\": [{\"type\": \"comments\", \"id\": \"1\"}]\n },\n \"suggested\": {\n \"data\": [{\"type\": \"entries\", \"id\": \"2\"}]\n }\n }\n },\n {\n \"type\": \"posts\",\n \"id\": \"2\",\n \"attributes\":\n {\n \"headline\": multiple_entries[1].headline,\n \"bodyText\": multiple_entries[1].body_text,\n \"pubDate\": None,\n \"modDate\": None\n },\n \"meta\": {\n \"bodyFormat\": \"text\"\n },\n \"relationships\":\n {\n \"blog\": {\n \"data\": {\"type\": \"blogs\", \"id\": \"2\"}\n },\n \"authors\": {\n \"meta\": {\"count\": 1},\n \"data\": [{\"type\": \"authors\", \"id\": \"2\"}]\n },\n \"comments\": {\n \"meta\": {\"count\": 1},\n \"data\": [{\"type\": \"comments\", \"id\": \"2\"}]\n },\n \"suggested\": {\n \"data\": [{\"type\": \"entries\", \"id\": \"1\"}]\n }\n }\n },\n ]\n }\n\n class NoPagination(PageNumberPagination):\n page_size = None\n\n class NonPaginatedEntryViewSet(EntryViewSet):\n pagination_class = NoPagination\n\n request = rf.get(\n reverse(\"entry-list\"))\n view = NonPaginatedEntryViewSet.as_view({'get': 'list'})\n response = view(request)\n response.render()\n\n content_dump = redump_json(response.content)\n expected_dump = dump_json(expected)\n\n assert content_dump == expected_dump", "metadata": "root.test_multiple_entries_no_pagination", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "from django.conf import settings", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "example_", "._", "views_", "import_", "Entr", "y", "View", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "frame", "work", "\\u", "json", "\\u", "api_", "._", "pagination_", "import_", "Page", "Number", "Pagination", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "example_", "._", "tests_", "._", "utils_", "import_", "dump", "\\u", "json_", ",_", "redu", "mp", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pytest", "mark_", "=_", "pytest_", "._", "mark_", "._", "django", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rf", " ", "==", " ", "request", "\\u", "factory_", "\\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", "multiple", "\\u", "entri", "es", "\\u", "no", "\\u", "pagination_", "(_", "multiple", "\\u", "entries_", ",_", "rf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "posts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "attribute", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "headline", "\"_", ":_", "multiple", "\\u", "entries_", "[_", "0_", "]_", "._", "headline", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "Text", "\"_", ":_", "multiple", "\\u", "entries_", "[_", "0_", "]_", "._", "body", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pub", "Date", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mod", "Date", "\"_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "Format", "\"_", ":_", "\"", "text", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "relation", "ships", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "blog", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "{_", "\"", "type", "\"_", ":_", "\"", "blogs", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "author", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\"", "count", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "author", "s", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\"", "count", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "comment", "s", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "suggested", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "entri", "es", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "2", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "posts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "attribute", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "headline", "\"_", ":_", "multiple", "\\u", "entries_", "[_", "1_", "]_", "._", "headline", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "Text", "\"_", ":_", "multiple", "\\u", "entries_", "[_", "1_", "]_", "._", "body", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pub", "Date", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mod", "Date", "\"_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "Format", "\"_", ":_", "\"", "text", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "relation", "ships", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "blog", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "{_", "\"", "type", "\"_", ":_", "\"", "blogs", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "2", "\"_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "author", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\"", "count", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "author", "s", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "2", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "\"_", ":_", "{_", "\"", "count", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "comment", "s", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "2", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "suggested", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "[_", "{_", "\"", "type", "\"_", ":_", "\"", "entri", "es", "\"_", ",_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "No", "Pagination", "_", "(_", "Page", "Number", "Pagination", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "size_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Non", "Pagina", "ted", "Entr", "y", "View", "Set_", "(_", "Entr", "y", "View", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pagina", "tion", "\\u", "class_", "=_", "No", "Pagination", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "rf_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "entry", "-", "list", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "Non", "Pagina", "ted", "Entr", "y", "View", "Set_", "._", "as", "\\u", "view_", "(_", "{_", "'", "get", "'_", ":_", "'", "list", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "view_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "dump_", "=_", "redu", "mp", "\\u", "json_", "(_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "dump_", "=_", "dump", "\\u", "json_", "(_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "content", "\\u", "dump_", "==_", "expected", "\\u", "dump_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
QuantSoftware/QuantSoftwareToolkit/QSTK/qstklearn/fastknn.py
[ { "content": "\"\"\"\n(c) 2011, 2012 Georgia Tech Research Corporation\nThis source code is released under the New BSD license. Please see\nhttp://wiki.quantsoftware.org/index.php?title=QSTK_License\nfor license details.\n\nThis package is an implementation of a novel improvement to KNN which\nspeeds up query times\n\"\"\"\nimport math,random,sys,bisect,time\nimport numpy,scipy.spatial.distance,scipy.spatial.kdtree\nimport cProfile,pstats,gendata\n\n\n\n\n\t\n\n\n\t\n\t\n\n\nif __name__==\"__main__\":\n\ttest()\n\t#prof= cProfile.Profile()\n\t#prof.run('test()')\n\t#stats = pstats.Stats(prof)\n\t#stats.sort_stats(\"cumulative\").print_stats()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def adistfun(u,v):\n\t#assuming 1xN ndarrays\n\t#return math.sqrt(((u-v)**2).sum())\n\t#return ((u-v)**2).sum()\n\ttmp = (u-v)\n\treturn math.sqrt(numpy.dot(tmp,tmp))", "metadata": "root.adistfun", "header": "['module', '___EOS___']", "index": 13 }, { "content": "class FastKNN:\n\t\"\"\"\n\tA class which implements the KNN learning algorithm with sped up\n\tquery times.\n\n\tThis class follows the conventions of other classes in the qstklearn\n\tmodule, with a constructor that initializes basic parameters and\n\tbookkeeping variables, an 'addEvidence' method for adding labeled\n\ttraining data individually or as a batch, and a 'query' method\n\tthat returns an estimated class for an unlabled point. Training\n\tand testing data are in the form of numpy arrays, and classes are\n\tdiscrete.\n\t\n\tIn order to speed up query times, this class keeps a number of lists which\n\tsort the training data by distance to 'anchor' points. The lists aren't\n\tsorted until the first call to the 'query' method, after which, the lists\n\tare kept in sorted order. Initial sort is done using pythons 'sort'\n\t(samplesort), and sorted insertions with 'insort' from the bisect module.\n\t\"\"\"\n\t\n\t\t\t\t\n\t\n\t", "metadata": "root.FastKNN", "header": "['module', '___EOS___']", "index": 20 }, { "content": "\tdef __init__(self, num_anchors, k):\n\t\t\"\"\"\n\t\tCreates a new FastKNN object that will use the given number of \n\t\tanchors.\n\t\t\"\"\"\n\t\tself.num_anchors = num_anchors\n\t\tself.training_data = list()\n\t\tself.anchors = list()\n\t\tself.data_by_anchors = dict()\n\t\tself.data_classes = dict()\n\t\tself.is_sorted = False\n\t\t#self.distfun = scipy.spatial.distance.euclidean\n\t\tself.distfun = adistfun\n\t\tself.num_checks = 0\n\t\tself.kdt = None\n\t\tself.k = k", "metadata": "root.FastKNN.__init__", "header": "['class', 'FastKNN', ':', '___EOS___']", "index": 39 }, { "content": "\tdef resetAnchors(self,selection_type='random'):\n\t\t\"\"\"\n\t\tPicks a new set of anchors. The anchor lists will be re-sorted upon\n\t\tthe next call to 'query'.\n\t\t\n\t\tselection_type - the method to use when selecting new anchor points.\n\t\t'random' performs a random permutation of the training points and\n\t\tpicks the first 'num_anchors' as new anchors.\n\t\t\"\"\"\n\t\tif selection_type == 'random':\n\t\t\tself.anchors = range(len(self.training_data))\n\t\t\trandom.shuffle(self.anchors)\n\t\t\tself.anchors = self.anchors[0:self.num_anchors]\n\t\t\tself.kdt = scipy.spatial.kdtree.KDTree(numpy.array(self.training_data)[self.anchors,:])\n\t\tself.is_sorted = False", "metadata": "root.FastKNN.resetAnchors", "header": "['class', 'FastKNN', ':', '___EOS___']", "index": 56 }, { "content": "\tdef addEvidence(self,data,label):\n\t\t\"\"\"\n\t\tAdds to the set of training data. If the anchor lists were sorted\n\t\tbefore the call to this method, the new data will be inserted into\n\t\tthe anchor lists using 'bisect.insort'\n\t\t\n\t\tdata - a numpy array, either a single point (1D) or a set of\n\t\tpoints (2D)\n\t\t\n\t\tlabel - the label for data. A single value, or a list of values\n\t\tin the same order as the points in data.\n\t\t\"\"\"\n\t\tif len(data.shape)==1:\n\t\t\tnew_idx = len(self.training_data)\n\t\t\tself.training_data.append(data)\n\t\t\tself.data_classes[new_idx] = label\n\t\t\tif self.is_sorted:\n\t\t\t\tfor a in self.anchors:\n\t\t\t\t\tdist = self.distfun(data,self.training_data[a])\n\t\t\t\t\tbisect.insort(self.data_by_anchors[a],(dist,new_idx))\n\t\telif len(data.shape)>1:\n\t\t\tfor i in xrange(len(data)):\n\t\t\t\tthing = data[i]\n\t\t\t\tnew_idx = len(self.training_data)\n\t\t\t\tself.training_data.append(thing)\n\t\t\t\tself.data_classes[new_idx] = label[i]\n\t\t\t\tif self.is_sorted:\n\t\t\t\t\tfor a in self.anchors:\n\t\t\t\t\t\tdist = self.distfun(thing,self.training_data[a])\n\t\t\t\t\t\tbisect.insort(self.data_by_anchors[a],(dist,new_idx))", "metadata": "root.FastKNN.addEvidence", "header": "['class', 'FastKNN', ':', '___EOS___']", "index": 73 }, { "content": "\tdef query(self,point,k=None,method='mode',slow=False,dumdumcheck=False):\n\t\t\"\"\"\n\t\tReturns class value for an unlabled point by examining its k nearest\n\t\tneighbors. 'method' determines how the class of the unlabled point is\n\t\tdetermined.\n\t\t\"\"\"\n\t\tif k is None:\n\t\t\tk = self.k\n\t\t#stime = time.time()\n\t\tif len(self.anchors) < self.num_anchors:\n\t\t\tself.resetAnchors()\n\t\tif not self.is_sorted:\n\t\t\tfor a in self.anchors:\n\t\t\t\tself.data_by_anchors[a] = [ ( self.distfun(self.training_data[datai],self.training_data[a]), datai) for datai in range(len(self.training_data))]\n\t\t\t\tself.data_by_anchors[a].sort(key=lambda pnt: pnt[0])\n\t\t#select the anchor to search from\n\t\t#right now pick the anchor closest to the query point\n\t\t\n\t\t#anchor = self.anchors[0]\n\t\t#anchor_dist = self.distfun(point,self.training_data[anchor]) \n\t\t#for i in xrange(1,len(self.anchors)):\n\t\t#\tnew_anchor = self.anchors[i]\n\t\t#\tnew_anchor_dist = self.distfun(point,self.training_data[new_anchor])\n\t\t#\tif new_anchor_dist < anchor_dist:\n\t\t#\t\tanchor = new_anchor\n\t\t#\t\tanchor_dist = new_anchor_dist\n\t\tres = self.kdt.query(numpy.array([point,]))\n\t\tanchor = self.anchors[res[1][0]]\n\t\tanchor_dist = res[0][0]\n\t\t#print \"Found the anchor\",anchor,anchor_dist\n\t\t\n\t\t#now search through the list\n\t\tanchor_list = self.data_by_anchors[anchor]\n\t\tneighbors = list()\n\t\tmaxd = None\n\t\tmaxd_idx = 0\n\t\tfor i in xrange(0,len(anchor_list)):\n\t\t\tnextpnt_dist = self.distfun(point,self.training_data[anchor_list[i][1]])\n\t\t\tself.num_checks += 1\n\t\t\tnextthing = (nextpnt_dist,anchor_list[i][1])\n\t\t\t\n\t\t\t#ins_idx = bisect.bisect(neighbors,nextthing)\n\t\t\t#if ins_idx <= k:\n\t\t\t#\tneighbors.insert(ins_idx,nextthing)\n\t\t\t#\tneighbors = neighbors[:k]\n\t\t\t#if not(slow) and len(neighbors) >= k:\n\t\t\t#\tif anchor_dist + neighbors[k-1][0] < anchor_list[i][0]:\n\t\t\t#\t\tbreak\n\t\t\t\n\t\t\tif len(neighbors)<k:\n\t\t\t\tif (maxd is None) or (maxd < nextpnt_dist):\n\t\t\t\t\tmaxd = nextpnt_dist\n\t\t\t\t\tmaxd_idx = len(neighbors)\n\t\t\t\tneighbors.append(nextthing)\n\t\t\telif nextpnt_dist < maxd:\n\t\t\t\tneighbors[maxd_idx] = nextthing\n\t\t\t\tmaxthing = max(neighbors)\n\t\t\t\tmaxd_idx = neighbors.index(maxthing)\n\t\t\t\tmaxd = maxthing[0]\n\t\t\tif not(slow) and len(neighbors) >= k:\n\t\t\t\tif anchor_dist + maxd < anchor_list[i][0]:\n\t\t\t\t\tbreak\n\n\t\t#we have the k neighbors, report the class\n\t\t#of the query point via method\n\t\tif method == 'mode':\n\t\t\tclass_count = dict()\n\t\t\tfor n in neighbors:\n\t\t\t\tnid = n[1]\n\t\t\t\tclss = self.data_classes[nid]\n\t\t\t\tif clss in class_count:\n\t\t\t\t\ttmp = class_count[clss]\n\t\t\t\telse:\n\t\t\t\t\ttmp = 0\n\t\t\t\tclass_count[clss] = tmp+1\n\t\t\tbleh = max(class_count.iteritems(),key=lambda item:item[1])\n\t\t\tif dumdumcheck and bleh[1] == 1:\n\t\t\t\tprint \"aHAH!\"\n\t\t\t\tprint point\n\t\t\trv = bleh[0]\n\t\telif method == 'mean':\n\t\t\treturn sum([self.data_classes[n[1]] for n in neighbors])/float(k)\n\t\t#etime = time.time()\n\t\t#print \"Query time:\", etime-stime\n\t\treturn rv", "metadata": "root.FastKNN.query", "header": "['class', 'FastKNN', ':', '___EOS___']", "index": 104 }, { "content": "def dataifywine(fname):\n\tfoo = open(fname)\n\tbar = [line for line in foo]\n\tfoo.close()\n\t#first line is the name of the attributes, strip it off\n\tbar = bar[1:]\n\t#trim, split, and cast the data. seperator is ';'\n\treturn [map(float,thing.strip().split(';')) for thing in bar]", "metadata": "root.dataifywine", "header": "['module', '___EOS___']", "index": 190 }, { "content": "def testwine():\n\twqred = dataifywine('wine/winequality-red.csv') + dataifywine('wine/winequality-white.csv')\n\tleftoutperc = 0.1\n\tleftout = int(len(wqred)*leftoutperc)\n\ttesting = wqred[:leftout]\n\ttraining = wqred[leftout:]\n\tprint \"Training:\",len(training)\n\tprint \"Testing:\",len(testing)\n\tfoo = FastKNN(10)\n\tfoo.addEvidence(numpy.array([thing[:-1] for thing in training]), [thing[-1] for thing in training])\n\tknn.addEvidence(numpy.array(training))\n\ttotal = 0\n\tcorrect = 0\n\tfor x in xrange(len(testing)):\n\t\tthing = testing[x]\n\t\tguess = foo.query(numpy.array(thing[:-1]),3)\n\t\t#realknn = knn.query(numpy.array([thing[:-1],]),3,method='mean')\n\t\t#guess = realknn[0]\n\t\t#print realknn\n\t\t#print guess, thing[-1]\n\t\tif guess == thing[-1]:\n\t\t\tcorrect += 1\n\t\ttotal += 1\n\t\tif total % 50 == 0:\n\t\t\tprint total,'/',len(testing)\n\tprint correct,\"/\",total,\":\",float(correct)/float(total)\n\tprint \"Average checks per query:\", float(foo.num_checks)/float(total)", "metadata": "root.testwine", "header": "['module', '___EOS___']", "index": 199 }, { "content": "def testspiral():\n\tfor leftout in xrange(1,11):\n\t\tprint \"Fold\",leftout\n\t\tfoo = FastKNN(10)\n\t\tfor x in xrange(1,11):\n\t\t\tif x != leftout:\n\t\t\t\tsomedata = open(\"spiral/spiralfold%d.txt\" % x)\n\t\t\t\tpnts = list()\n\t\t\t\tclss = list()\n\t\t\t\tfor line in somedata:\n\t\t\t\t\tpbbbt,x,y = line.split()\n\t\t\t\t\tx,y = float(x),float(y)\n\t\t\t\t\tpnts.append((x,y))\n\t\t\t\t\tclss.append(line.split()[0])\n\t\t\t\tsomedata.close()\n\t\t\t\tpnts = numpy.array(pnts)\n\t\t\t\tfoo.addEvidence(pnts,clss)\n\t\tsomedata = open(\"spiral/spiralfold%d.txt\" % leftout)\n\t\tcorrect = total = 0\n\t\tfor line in somedata:\n\t\t\tpbbbt,x,y = line.split()\n\t\t\tx,y = float(x),float(y)\n\t\t\tguess=foo.query((x,y),10)\n\t\t\t#guess2 = foo.query((x,y),10,slow=True)\n\t\t\t#if guess != guess2:\n\t\t\t#\tprint \"Crap!\"\n\t\t\t#\tprint guess,guess2,(x,y,pbbbt)\n\t\t\t#print guess, pbbbt\n\t\t\tif guess == pbbbt:\n\t\t\t\tcorrect += 1\n\t\t\ttotal += 1\n\t\tprint correct,\"/\",total,\":\",float(correct)/float(total)\n\t\tprint \"Average number of checks per query:\", \n\t\tprint float(foo.num_checks)/float(total)", "metadata": "root.testspiral", "header": "['module', '___EOS___']", "index": 227 }, { "content": "def getflatcsv(fname):\n\tinf = open(fname)\n\treturn numpy.array([map(float,s.strip().split(',')) for s in inf.readlines()])", "metadata": "root.getflatcsv", "header": "['module', '___EOS___']", "index": 262 }, { "content": "def testgendata():\n\tanchors = 200\n\tfname = 'test2.dat'\n\tquerys = 1000\n\td = 2\n\tk = 3\n\tbnds = ((-10,10),)*d\n\tclsses = (0,1)\n\tfoo = FastKNN(anchors,k)\n\tdata = getflatcsv(fname)\n\tfoo.addEvidence(data[:,:-1],data[:,-1])\n\tfoo.num_checks = 0\n\tfor x in xrange(querys):\n\t\tpnt = numpy.array(gendata.gensingle(d,bnds,clsses))\n\t\tfoo.query(pnt[:-1])\n\t\tif x % 50 == 0:\n\t\t\tprint float(foo.num_checks)/float(x+1),\n\t\t\tprint x,\"/\",querys\n\tprint \"Average # queries:\", float(foo.num_checks)/float(querys)", "metadata": "root.testgendata", "header": "['module', '___EOS___']", "index": 266 }, { "content": "def test():\n\ttestgendata()", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 288 } ]
[ { "span": "import math,random,sys,bisect,time", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 34 }, { "span": "import cProfile,pstats,gendata", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "(", "c", ")", " ", "2011", ",", " ", "2012", " ", "Georg", "ia", " ", "Te", "ch", " ", "Rese", "arch", " ", "Cor", "porat", "ion", "\\", "10", ";", "Thi", "s", " ", "source", " ", "code", " ", "is", " ", "released", " ", "under", " ", "the", " ", "New", " ", "BS", "D", " ", "license", ".", " ", " ", "Ple", "ase", " ", "see", "\\", "10", ";", "http", "://", "wiki", ".", "quant", "software", ".", "org", "/", "index", ".", "php", "?", "title", "=", "QS", "TK", "\\u", "License", "\\", "10", ";", "for", " ", "license", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "package", " ", "is", " ", "an", " ", "implementation", " ", "of", " ", "a", " ", "novel", " ", "improvement", " ", "to", " ", "KN", "N", " ", "whi", "ch", "\\", "10", ";", "speeds", " ", "up", " ", "query", " ", "times", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", ",_", "random_", ",_", "sys_", ",_", "bisect_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", ",_", "scipy_", "._", "spatial_", "._", "distance_", ",_", "scipy_", "._", "spatial_", "._", "kd", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Profile_", ",_", "pstat", "s_", ",_", "gen", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "prof", "=", " ", "c", "Profil", "e", ".", "Profil", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "prof", ".", "run", "('", "test", "()'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stats", " ", "=", " ", "pstat", "s", ".", "Stat", "s", "(", "prof", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stats", ".", "sort", "\\u", "stats", "(\"", "cumul", "ative", "\")", ".", "print", "\\u", "stats", "()", "_", "\\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_", "adi", "stf", "un_", "(_", "u_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ass", "umi", "ng", " ", "1x", "N", " ", "ndar", "rays", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "math", ".", "sqrt", "(((", "u", "-", "v", ")**", "2", ").", "sum", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "((", "u", "-", "v", ")**", "2", ").", "sum", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tmp_", "=_", "(_", "u_", "-_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "math_", "._", "sqrt_", "(_", "numpy_", "._", "dot_", "(_", "tmp_", ",_", "tmp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fast", "KN", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "A", " ", "class", " ", "whi", "ch", " ", "implement", "s", " ", "the", " ", "KN", "N", " ", "learn", "ing", " ", "algo", "rit", "hm", " ", "with", " ", "spe", "d", " ", "up", "\\", "10", ";", "\t", "query", " ", "times", ".", "\\", "10", ";", "\\", "10", ";", "\t", "Thi", "s", " ", "class", " ", "follow", "s", " ", "the", " ", "convention", "s", " ", "of", " ", "other", " ", "classe", "s", " ", "in", " ", "the", " ", "qst", "kle", "arn", "\\", "10", ";", "\t", "module", ",", " ", "with", " ", "a", " ", "construct", "or", " ", "tha", "t", " ", "initialize", "s", " ", "basic", " ", "parameter", "s", " ", "and", "\\", "10", ";", "\t", "book", "keep", "ing", " ", "variab", "les", ",", " ", "an", " ", "'", "add", "Evi", "denc", "e", "'", " ", "method", " ", "for", " ", "addin", "g", " ", "label", "ed", "\\", "10", ";", "\t", "train", "ing", " ", "data", " ", "individual", "ly", " ", "or", " ", "as", " ", "a", " ", "batch", ",", " ", "and", " ", "a", " ", "'", "query", "'", " ", "method", "\\", "10", ";", "\t", "tha", "t", " ", "return", "s", " ", "an", " ", "estimate", "d", " ", "class", " ", "for", " ", "an", " ", "unla", "ble", "d", " ", "point", ".", " ", " ", "Train", "ing", "\\", "10", ";", "\t", "and", " ", "testi", "ng", " ", "data", " ", "are", " ", "in", " ", "the", " ", "form", " ", "of", " ", "nump", "y", " ", "arrays", ",", " ", "and", " ", "classe", "s", " ", "are", "\\", "10", ";", "\t", "discrete", ".", "\\", "10", ";", "\t", "\\", "10", ";", "\t", "In", " ", "order", " ", "to", " ", "speed", " ", "up", " ", "query", " ", "times", ",", " ", "this", " ", "class", " ", "keep", "s", " ", "a", " ", "number", " ", "of", " ", "lists", " ", "whi", "ch", "\\", "10", ";", "\t", "sort", " ", "the", " ", "train", "ing", " ", "data", " ", "by", " ", "distance", " ", "to", " ", "'", "anchor", "'", " ", "points", ".", " ", " ", "The", " ", "lists", " ", "are", "n", "'", "t", "\\", "10", ";", "\t", "sorte", "d", " ", "unti", "l", " ", "the", " ", "first", " ", "call", " ", "to", " ", "the", " ", "'", "query", "'", " ", "method", ",", " ", "after", " ", "whi", "ch", ",", " ", "the", " ", "lists", "\\", "10", ";", "\t", "are", " ", "kep", "t", " ", "in", " ", "sorte", "d", " ", "order", ".", " ", "Initial", " ", "sort", " ", "is", " ", "don", "e", " ", "usi", "ng", " ", "python", "s", " ", "'", "sort", "'", "\\", "10", ";", "\t", "(", "samples", "ort", "),", " ", "and", " ", "sorte", "d", " ", "insertion", "s", " ", "with", " ", "'", "ins", "ort", "'", " ", "from", " ", "the", " ", "bisect", " ", "module", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fast", "KN", "N_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "num", "\\u", "anchors_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Creat", "es", " ", "a", " ", "new", " ", "Fast", "KN", "N", " ", "object", " ", "tha", "t", " ", "will", " ", "use", " ", "the", " ", "give", "n", " ", "number", " ", "of", " ", "\\", "10", ";", "\t", "\t", "anchors", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "anchors_", "=_", "num", "\\u", "anchors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "train", "ing", "\\u", "data_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "anchors_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "classes_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "sorted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "dist", "fun", " ", "=", " ", "sci", "py", ".", "spat", "ial", ".", "distance", ".", "euclidean", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dist", "fun_", "=_", "adi", "stf", "un_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "checks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kd", "t_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "k_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fast", "KN", "N_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset", "Anc", "hor", "s_", "(_", "self_", ",_", "selection", "\\u", "type_", "=_", "'", "random", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Pick", "s", " ", "a", " ", "new", " ", "set", " ", "of", " ", "anchors", ".", " ", " ", "The", " ", "anchor", " ", "lists", " ", "will", " ", "be", " ", "re", "-", "sorte", "d", " ", "upo", "n", "\\", "10", ";", "\t", "\t", "the", " ", "next", " ", "call", " ", "to", " ", "'", "query", "'.", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", "selection", "\\u", "type", " ", "-", " ", "the", " ", "method", " ", "to", " ", "use", " ", "whe", "n", " ", "selecti", "ng", " ", "new", " ", "anchor", " ", "points", ".", "\\", "10", ";", "\t", "\t", "'", "random", "'", " ", "perform", "s", " ", "a", " ", "random", " ", "permutation", " ", "of", " ", "the", " ", "train", "ing", " ", "points", " ", "and", "\\", "10", ";", "\t", "\t", "picks", " ", "the", " ", "first", " ", "'", "num", "\\u", "anchors", "'", " ", "as", " ", "new", " ", "anchors", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection", "\\u", "type_", "==_", "'", "random", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "anchors_", "=_", "range_", "(_", "len_", "(_", "self_", "._", "train", "ing", "\\u", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "self_", "._", "anchors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "anchors_", "=_", "self_", "._", "anchors_", "[_", "0_", ":_", "self_", "._", "num", "\\u", "anchors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kd", "t_", "=_", "scipy_", "._", "spatial_", "._", "kd", "tree_", "._", "KD", "Tree_", "(_", "numpy_", "._", "array_", "(_", "self_", "._", "train", "ing", "\\u", "data_", ")_", "[_", "self_", "._", "anchors_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "is", "\\u", "sorted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fast", "KN", "N_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Evi", "denc", "e_", "(_", "self_", ",_", "data_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Add", "s", " ", "to", " ", "the", " ", "set", " ", "of", " ", "train", "ing", " ", "data", ".", " ", "If", " ", "the", " ", "anchor", " ", "lists", " ", "wer", "e", " ", "sorte", "d", "\\", "10", ";", "\t", "\t", "bef", "ore", " ", "the", " ", "call", " ", "to", " ", "this", " ", "method", ",", " ", "the", " ", "new", " ", "data", " ", "will", " ", "be", " ", "inserted", " ", "int", "o", "\\", "10", ";", "\t", "\t", "the", " ", "anchor", " ", "lists", " ", "usi", "ng", " ", "'", "bisect", ".", "ins", "ort", "'", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", "data", " ", "-", " ", "a", " ", "nump", "y", " ", "array", ",", " ", "eit", "her", " ", "a", " ", "single", " ", "point", " ", "(", "1", "D", ")", " ", "or", " ", "a", " ", "set", " ", "of", "\\", "10", ";", "\t", "\t", "points", " ", "(", "2", "D", ")", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", "label", " ", "-", " ", "the", " ", "label", " ", "for", " ", "data", ".", " ", "A", " ", "single", " ", "value", ",", " ", "or", " ", "a", " ", "list", " ", "of", " ", "values", "\\", "10", ";", "\t", "\t", "in", " ", "the", " ", "same", " ", "order", " ", "as", " ", "the", " ", "points", " ", "in", " ", "data", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "data_", "._", "shape_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "new", "\\u", "idx_", "=_", "len_", "(_", "self_", "._", "train", "ing", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "train", "ing", "\\u", "data_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "classes_", "[_", "new", "\\u", "idx_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "sorted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "a_", "in_", "self_", "._", "anchors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "dist_", "=_", "self_", "._", "dist", "fun_", "(_", "data_", ",_", "self_", "._", "train", "ing", "\\u", "data_", "[_", "a_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bisect_", "._", "ins", "ort_", "(_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "[_", "a_", "]_", ",_", "(_", "dist_", ",_", "new", "\\u", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "data_", "._", "shape_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "thing_", "=_", "data_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "idx_", "=_", "len_", "(_", "self_", "._", "train", "ing", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "train", "ing", "\\u", "data_", "._", "append_", "(_", "thing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "classes_", "[_", "new", "\\u", "idx_", "]_", "=_", "label_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "sorted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "for_", "a_", "in_", "self_", "._", "anchors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "dist_", "=_", "self_", "._", "dist", "fun_", "(_", "thing_", ",_", "self_", "._", "train", "ing", "\\u", "data_", "[_", "a_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bisect_", "._", "ins", "ort_", "(_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "[_", "a_", "]_", ",_", "(_", "dist_", ",_", "new", "\\u", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fast", "KN", "N_", ":_", "\\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_", "query_", "(_", "self_", ",_", "point_", ",_", "k_", "=_", "None_", ",_", "method_", "=_", "'", "mode", "'_", ",_", "slow_", "=_", "False_", ",_", "dum", "dum", "check_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Return", "s", " ", "class", " ", "value", " ", "for", " ", "an", " ", "unla", "ble", "d", " ", "point", " ", "by", " ", "exam", "inin", "g", " ", "its", " ", "k", " ", "near", "est", "\\", "10", ";", "\t", "\t", "neighbor", "s", ".", " ", "'", "method", "'", " ", "dete", "rmin", "es", " ", "how", " ", "the", " ", "class", " ", "of", " ", "the", " ", "unla", "ble", "d", " ", "point", " ", "is", "\\", "10", ";", "\t", "\t", "dete", "rmin", "ed", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "k_", "=_", "self_", "._", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "stime", " ", "=", " ", "time", ".", "time", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "anchors_", ")_", "<_", "self_", "._", "num", "\\u", "anchors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "reset", "Anc", "hor", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "sorted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "a_", "in_", "self_", "._", "anchors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "[_", "a_", "]_", "=_", "[_", "(_", "self_", "._", "dist", "fun_", "(_", "self_", "._", "train", "ing", "\\u", "data_", "[_", "datai", "_", "]_", ",_", "self_", "._", "train", "ing", "\\u", "data_", "[_", "a_", "]_", ")_", ",_", "datai", "_", ")_", "for_", "datai", "_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "train", "ing", "\\u", "data_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "[_", "a_", "]_", "._", "sort_", "(_", "key_", "=_", "lambda_", "pnt", "_", ":_", "pnt", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "select", " ", "the", " ", "anchor", " ", "to", " ", "search", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", "right", " ", "now", " ", "pick", " ", "the", " ", "anchor", " ", "closest", " ", "to", " ", "the", " ", "query", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "anchor", " ", "=", " ", "self", ".", "anchors", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "anchor", "\\u", "dist", " ", "=", " ", "self", ".", "dist", "fun", "(", "point", ",", "self", ".", "train", "ing", "\\u", "data", "[", "anchor", "])", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "i", " ", "in", " ", "xran", "ge", "(", "1", ",", "len", "(", "self", ".", "anchors", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "new", "\\u", "anchor", " ", "=", " ", "self", ".", "anchors", "[", "i", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "new", "\\u", "anchor", "\\u", "dist", " ", "=", " ", "self", ".", "dist", "fun", "(", "point", ",", "self", ".", "train", "ing", "\\u", "data", "[", "new", "\\u", "anchor", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "new", "\\u", "anchor", "\\u", "dist", " ", "<", " ", "anchor", "\\u", "dist", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "anchor", " ", "=", " ", "new", "\\u", "anchor_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "anchor", "\\u", "dist", " ", "=", " ", "new", "\\u", "anchor", "\\u", "dist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "self_", "._", "kd", "t_", "._", "query_", "(_", "numpy_", "._", "array_", "(_", "[_", "point_", ",_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anchor_", "=_", "self_", "._", "anchors_", "[_", "res_", "[_", "1_", "]_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anchor", "\\u", "dist_", "=_", "res_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Foun", "d", " ", "the", " ", "anchor", "\",", "anchor", ",", "anchor", "\\u", "dist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "now", " ", "search", " ", "through", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "anchor", "\\u", "list_", "=_", "self_", "._", "data\\u", "by", "\\u", "anchors_", "[_", "anchor_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "\\u", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "len_", "(_", "anchor", "\\u", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "nextp", "nt", "\\u", "dist_", "=_", "self_", "._", "dist", "fun_", "(_", "point_", ",_", "self_", "._", "train", "ing", "\\u", "data_", "[_", "anchor", "\\u", "list_", "[_", "i_", "]_", "[_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "checks_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "thing_", "=_", "(_", "nextp", "nt", "\\u", "dist_", ",_", "anchor", "\\u", "list_", "[_", "i_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ins", "\\u", "idx", " ", "=", " ", "bisect", ".", "bisect", "(", "neighbor", "s", ",", "next", "thing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "ins", "\\u", "idx", " ", "<=", " ", "k", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "neighbor", "s", ".", "insert", "(", "ins", "\\u", "idx", ",", "next", "thing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "neighbor", "s", " ", "=", " ", "neighbor", "s", "[:", "k", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", "(", "slow", ")", " ", "and", " ", "len", "(", "neighbor", "s", ")", " ", ">=", " ", "k", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "anchor", "\\u", "dist", " ", "+", " ", "neighbor", "s", "[", "k", "-1", "][", "0", "]", " ", "<", " ", "anchor", "\\u", "list", "[", "i", "][", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "break_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "neighbors_", ")_", "<_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "(_", "maxd", "_", "is_", "None_", ")_", "or_", "(_", "maxd", "_", "<_", "nextp", "nt", "\\u", "dist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "maxd", "_", "=_", "nextp", "nt", "\\u", "dist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "\\u", "idx_", "=_", "len_", "(_", "neighbors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neighbors_", "._", "append_", "(_", "next", "thing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nextp", "nt", "\\u", "dist_", "<_", "maxd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "neighbors_", "[_", "maxd", "\\u", "idx_", "]_", "=_", "next", "thing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxt", "hing_", "=_", "max_", "(_", "neighbors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "\\u", "idx_", "=_", "neighbors_", "._", "index_", "(_", "maxt", "hing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "_", "=_", "maxt", "hing_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "slow_", ")_", "and_", "len_", "(_", "neighbors_", ")_", ">=_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "anchor", "\\u", "dist_", "+_", "maxd", "_", "<_", "anchor", "\\u", "list_", "[_", "i_", "]_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "have", " ", "the", " ", "k", " ", "neighbor", "s", ",", " ", "report", " ", "the", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", "of", " ", "the", " ", "query", " ", "point", " ", "via", " ", "method_", "\\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_", "method_", "==_", "'", "mode", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "class", "\\u", "count_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "neighbors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "nid_", "=_", "n_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "s_", "=_", "self_", "._", "data\\u", "classes_", "[_", "nid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls", "s_", "in_", "class", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tmp_", "=_", "class", "\\u", "count_", "[_", "cls", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tmp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class", "\\u", "count_", "[_", "cls", "s_", "]_", "=_", "tmp_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ble", "h_", "=_", "max_", "(_", "class", "\\u", "count_", "._", "iteritems_", "(_", ")_", ",_", "key_", "=_", "lambda_", "item_", ":_", "item_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dum", "dum", "check_", "and_", "ble", "h_", "[_", "1_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "\"", "a", "HA", "H", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rv_", "=_", "ble", "h_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "mean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "sum_", "(_", "[_", "self_", "._", "data\\u", "classes_", "[_", "n_", "[_", "1_", "]_", "]_", "for_", "n_", "in_", "neighbors_", "]_", ")_", "/_", "float_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "etime", " ", "=", " ", "time", ".", "time", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Query", " ", "time", ":\"", ",", " ", "etime", "-", "stime", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rv_", "\\u\\u\\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_", "datai", "fy", "wine", "_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "foo_", "=_", "open_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "[_", "line_", "for_", "line_", "in_", "foo_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "first", " ", "line", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "attribute", "s", ",", " ", "strip", " ", "it", " ", "off_", "\\u\\u\\uNL\\u\\u\\u_", "bar_", "=_", "bar_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "trim", ",", " ", "split", ",", " ", "and", " ", "cast", " ", "the", " ", "data", ".", " ", "seperat", "or", " ", "is", " ", "';'_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "map_", "(_", "float_", ",_", "thing_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "';'_", ")_", ")_", "for_", "thing_", "in_", "bar_", "]_", "\\u\\u\\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", "wine", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "wq", "red_", "=_", "datai", "fy", "wine", "_", "(_", "'", "wine", "/", "wine", "quali", "ty", "-", "red", ".", "csv", "'_", ")_", "+_", "datai", "fy", "wine", "_", "(_", "'", "wine", "/", "wine", "quali", "ty", "-", "white", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lefto", "ut", "perc_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lefto", "ut_", "=_", "int_", "(_", "len_", "(_", "wq", "red_", ")_", "*_", "lefto", "ut", "perc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testing_", "=_", "wq", "red_", "[_", ":_", "lefto", "ut_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "training_", "=_", "wq", "red_", "[_", "lefto", "ut_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Train", "ing", ":\"_", ",_", "len_", "(_", "training_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Test", "ing", ":\"_", ",_", "len_", "(_", "testing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "=_", "Fast", "KN", "N_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "add", "Evi", "denc", "e_", "(_", "numpy_", "._", "array_", "(_", "[_", "thing_", "[_", ":_", "-_", "1_", "]_", "for_", "thing_", "in_", "training_", "]_", ")_", ",_", "[_", "thing_", "[_", "-_", "1_", "]_", "for_", "thing_", "in_", "training_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knn", "_", "._", "add", "Evi", "denc", "e_", "(_", "numpy_", "._", "array_", "(_", "training_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "len_", "(_", "testing_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "thing_", "=_", "testing_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guess_", "=_", "foo_", "._", "query_", "(_", "numpy_", "._", "array_", "(_", "thing_", "[_", ":_", "-_", "1_", "]_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "real", "knn", " ", "=", " ", "knn", ".", "query", "(", "nump", "y", ".", "array", "([", "thing", "[:", "-1", "],", "])", ",", "3", ",", "method", "='", "mean", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "guess", " ", "=", " ", "real", "knn", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "real", "knn", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "guess", ",", " ", "thing", "[-", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "guess_", "==_", "thing_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "correct_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total_", "%_", "50_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "total_", ",_", "'/'_", ",_", "len_", "(_", "testing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "correct_", ",_", "\"/\"_", ",_", "total_", ",_", "\":\"_", ",_", "float_", "(_", "correct_", ")_", "/_", "float_", "(_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Average", " ", "checks", " ", "per", " ", "query", ":\"_", ",_", "float_", "(_", "foo_", "._", "num", "\\u", "checks_", ")_", "/_", "float_", "(_", "total_", ")_", "\\u\\u\\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_", "tests", "pir", "al_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "lefto", "ut_", "in_", "xrange_", "(_", "1_", ",_", "11_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "\"", "Fold", "\"_", ",_", "lefto", "ut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "=_", "Fast", "KN", "N_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "1_", ",_", "11_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "x_", "!=_", "lefto", "ut_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "some", "data_", "=_", "open_", "(_", "\"", "spir", "al", "/", "spir", "alf", "old", "%", "d", ".", "txt", "\"_", "%_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pnt", "s_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "s_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "some", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pb", "bb", "t_", ",_", "x_", ",_", "y_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "float_", "(_", "x_", ")_", ",_", "float_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pnt", "s_", "._", "append_", "(_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "s_", "._", "append_", "(_", "line_", "._", "split_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "some", "data_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pnt", "s_", "=_", "numpy_", "._", "array_", "(_", "pnt", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "add", "Evi", "denc", "e_", "(_", "pnt", "s_", ",_", "cls", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "some", "data_", "=_", "open_", "(_", "\"", "spir", "al", "/", "spir", "alf", "old", "%", "d", ".", "txt", "\"_", "%_", "lefto", "ut_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct_", "=_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "some", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pb", "bb", "t_", ",_", "x_", ",_", "y_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "float_", "(_", "x_", ")_", ",_", "float_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guess_", "=_", "foo_", "._", "query_", "(_", "(_", "x_", ",_", "y_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "guess", "2", " ", "=", " ", "foo", ".", "query", "((", "x", ",", "y", "),", "10", ",", "slow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "guess", " ", "!=", " ", "guess", "2", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "print", " ", "\"", "Cra", "p", "!\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "print", " ", "guess", ",", "guess", "2", ",(", "x", ",", "y", ",", "pb", "bb", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "guess", ",", " ", "pb", "bb", "t_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "guess_", "==_", "pb", "bb", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "correct_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "correct_", ",_", "\"/\"_", ",_", "total_", ",_", "\":\"_", ",_", "float_", "(_", "correct_", ")_", "/_", "float_", "(_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Average", " ", "number", " ", "of", " ", "checks", " ", "per", " ", "query", ":\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "float_", "(_", "foo_", "._", "num", "\\u", "checks_", ")_", "/_", "float_", "(_", "total_", ")_", "\\u\\u\\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_", "getf", "lat", "csv_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "inf_", "=_", "open_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "array_", "(_", "[_", "map_", "(_", "float_", ",_", "s_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "','_", ")_", ")_", "for_", "s_", "in_", "inf_", "._", "readlines_", "(_", ")_", "]_", ")_", "\\u\\u\\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", "gen", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "anchors_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "'", "test", "2", ".", "dat", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "querys", "_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bnd", "s_", "=_", "(_", "(_", "-_", "10_", ",_", "10_", ")_", ",_", ")_", "*_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "ses_", "=_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "=_", "Fast", "KN", "N_", "(_", "anchors_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "getf", "lat", "csv_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "add", "Evi", "denc", "e_", "(_", "data_", "[_", ":_", ",_", ":_", "-_", "1_", "]_", ",_", "data_", "[_", ":_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "num", "\\u", "checks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "querys", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pnt", "_", "=_", "numpy_", "._", "array_", "(_", "gen", "data_", "._", "gens", "ingl", "e_", "(_", "d_", ",_", "bnd", "s_", ",_", "cls", "ses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "query_", "(_", "pnt", "_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "%_", "50_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "float_", "(_", "foo_", "._", "num", "\\u", "checks_", ")_", "/_", "float_", "(_", "x_", "+_", "1_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "x_", ",_", "\"/\"_", ",_", "querys", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Average", " ", "#", " ", "querie", "s", ":\"_", ",_", "float_", "(_", "foo_", "._", "num", "\\u", "checks_", ")_", "/_", "float_", "(_", "querys", "_", ")_", "\\u\\u\\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\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "test", "gen", "data_", "(_", ")_", "\\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, 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cher/src/gkno/dataConsistency.py
[ { "content": "def checkNode(graph, superpipeline, source, target, nodeType, expectedDataType, values, isInput):\n \n # Define error handling,\n errors = er.consistencyErrors()\n\n # Get pipeline configuration data.\n data = superpipeline.pipelineConfigurationData[superpipeline.pipeline]\n\n # Get the required attributes.\n longFormArgument = graph.CM_getArgumentAttribute(graph.graph, source, target, 'longFormArgument')\n dataType = graph.CM_getArgumentAttribute(graph.graph, source, target, 'dataType')\n\n # Check if this edge hgas been marked as a link only. This occurs when a nodes values are constructed using values from\n # another node. An edge is included to ensure that the workflow and dependencies are correct, but there will be no\n # argument associated with the edge and the following checks are not required.\n isLinkOnly = graph.CM_getArgumentAttribute(graph.graph, source, target, 'isLinkOnly')\n if not isLinkOnly:\n\n # If this is the first argument parsed, populate the expectedDataType variable with the data type for this argument.\n if not expectedDataType: expectedDataType = dataType\n \n # If expectedDataType is populated and this data type is different to the expectedDataType, this implies that different\n # arguments using the same values expect different data types. This is clearly impossible, so terminate.\n #TODO ERROR\n elif expectedDataType != dataType: print('dataConsistency.checkNode - 1', dataType, expectedDataType); exit(0)\n \n # Loop over each of the values for this node.\n for value in values:\n \n # Check that the data type is correct.\n #TODO ERROR\n if not isCorrectDataType(value, expectedDataType): print('dataConsistency.checkNode - 2', longFormArgument, value, dataType, type(value)); exit(0)\n \n # If this is a file, check that the extension is valid. Do not perform this check for stubs.\n if nodeType == 'file':\n if not graph.CM_getArgumentAttribute(graph.graph, source, target, 'isStub'):\n extensions = graph.CM_getArgumentAttribute(graph.graph, source, target, 'extensions')\n \n # Not all files have specified extensions. If no extensions are supplied, this check should not be performed.\n if extensions:\n task = target if isInput else source\n fileNodeId = source if isInput else target\n \n # Fail if there was an error.\n if not checkExtensions(value, extensions):\n \n # Check if a top level pipeline argument exists.\n if longFormArgument in data.longFormArguments.keys():\n shortFormArgument = data.longFormArguments[longFormArgument].shortFormArgument\n errors.invalidExtensionPipeline(longFormArgument, shortFormArgument, value, extensions)\n \n # If no pipeline argument exists for this argument, list the task and argument.\n else:\n shortFormArgument = graph.CM_getArgumentAttribute(graph.graph, source, target, 'shortFormArgument')\n errors.invalidExtension(task, longFormArgument, shortFormArgument, value, extensions)\n\n # Return the expected data type\n return expectedDataType", "metadata": "root.checkNode", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def isCorrectDataType(value, dataType):\n\n # The value can only be none, if this is a flag.\n if not value and value != 0 and dataType != 'flag': return False\n elif not value: return True\n\n # If the expected data type is an integer.\n if dataType == 'integer':\n try: value = int(value)\n except: return False\n return True\n\n # If the expected data type is a float.\n elif dataType == 'float':\n try: value = float(value)\n except: return False\n return True\n\n # If the expected data type is a string.\n elif dataType == 'string':\n try: value = str(value)\n except: return False\n return True\n\n # If the expected data type is a Boolean.\n elif dataType == 'bool':\n if value == 'true' or value == 'True' or value == 'false' or value == 'False': return True\n return False\n\n # If the expected data type is a flag.\n elif dataType == 'flag':\n if value == 'set' or value == 'unset': return True\n return False\n\n # If none of the above conditions were met, the data type is incorrect.\n return False", "metadata": "root.isCorrectDataType", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def checkRequiredArguments(graph, superpipeline, args, isTerminate):\n\n # Define error handling,\n errors = er.consistencyErrors()\n isSuccess = True\n\n # Keep track of nodes that can have their values constructed.\n constructableNodes = []\n\n # Loop over the defined pipeline arguments and check that all arguments listed as required have\n # been set.\n for argument in args.arguments:\n\n # If the pipeline specifies if this argument is required or not, update the properties of the nodes.\n # If not specified (i.e. isRequired == None), it is left to the tool configuration to determine if\n # the argument is required. This allows the pipeline configuration file to not only specify that an\n # argument is required even if the underlying tool doesn't require the value, the pipeline can also\n # override the tools claim that the argument is required.\n if args.arguments[argument].isRequired == False:\n for nodeId in args.arguments[argument].graphNodeIds: graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n if args.arguments[argument].isRequired:\n\n # Loop over the associated graph nodes and see if the values are set.\n for nodeId in args.arguments[argument].graphNodeIds:\n graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n\n # Check if this argument was imported from a task in the pipeline. If so, determine if there are\n # any instructions for constructing the filename (if not an option). Only terminate if the argument\n # is for an option, or there are no instructions.\n hasInstructions = False\n if args.arguments[argument].isImported:\n task = args.arguments[argument].importedFromTask\n tool = graph.getGraphNodeAttribute(task, 'tool')\n toolData = superpipeline.getToolData(tool)\n hasInstructions = True if toolData.getArgumentAttribute(argument, 'constructionInstructions') else False\n\n # If the values haven't been set, terminate. This is a pipeline argument listed as required\n # and so must be set by the user (and not constructed).\n if not graph.getGraphNodeAttribute(nodeId, 'values') and not hasInstructions:\n isSuccess = False\n shortFormArgument = args.arguments[argument].shortFormArgument\n description = args.arguments[argument].description\n if isTerminate: errors.unsetRequiredArgument(argument, shortFormArgument, description)\n\n # Loop over all tasks in the workflow\n for task in graph.workflow:\n\n # Get the tool for the task.\n tool = superpipeline.tasks[task]\n toolData = superpipeline.getToolData(tool)\n\n # Loop over all of the arguments for the tool and check that all required arguments have a node\n # and that the node has values.\n for argument in toolData.arguments:\n\n # Check if the argument is required.\n if toolData.getArgumentAttribute(argument, 'isRequired'):\n\n # Record if a node for this node is seen.\n foundNode = False\n\n # Determine if the argument is for an input file, output file or an option.\n isInput = toolData.getArgumentAttribute(argument, 'isInput')\n isOutput = toolData.getArgumentAttribute(argument, 'isOutput')\n\n # If this is an output file with construction instructions, the filenames will be constructed\n # later, so this does not need to be checked. Keep track of the nodes which will be constructed\n # as these could be inputs to other tasks and so the check for existence is also not required\n # for these input files.\n\n # Start with input files and options.\n if not isOutput:\n\n # Loop over all input nodes looking for edges that use this argument.\n for nodeId in graph.CM_getInputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(nodeId, task, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If this node has already been marked as not required (i.e. the tools requirement has been superceded\n # by instructions in the pipeline configuration file).\n if graph.getGraphNodeAttribute(nodeId, 'isRequired'):\n hasInstructions = False if graph.getArgumentAttribute(nodeId, task, 'constructionInstructions') == None else True\n hasValues = True if len(graph.getGraphNodeAttribute(nodeId, 'values')) != 0 else False\n if not hasValues and not hasInstructions and nodeId not in constructableNodes:\n isSuccess = False\n \n # Check to see if this node can have it's values set with a top level pipeline argument (e.g. can\n # be set without defining the task on the command line).\n longFormArgument = graph.getGraphNodeAttribute(nodeId, 'longFormArgument')\n if longFormArgument and '.' not in longFormArgument:\n \n # Get the short form of the pipeline argument and the argument description.\n #shortFormArgument = args.arguments[longFormArgument].shortFormArgument\n shortFormArgument = graph.getGraphNodeAttribute(nodeId, 'shortFormArgument')\n description = graph.getGraphNodeAttribute(nodeId, 'description')\n if isTerminate: errors.unsetRequiredArgument(longFormArgument, shortFormArgument, description)\n \n # If this is not a top level argument, provide a different error.\n # TODO CHECK THIS\n else: \n \n # Get the short form version of the argument as well as the argument description. This is as defined\n # for the tool, so if this argument can be set using a pipeline argument, these values are incorrect.\n shortFormArgument = graph.getArgumentAttribute(nodeId, task, 'shortFormArgument')\n description = graph.getArgumentAttribute(nodeId, task, 'description')\n if isTerminate: errors.unsetRequiredNestedArgument(task, argument, shortFormArgument, description, superpipeline.pipeline)\n\n # If there is no node for this argument, this means that the pipeline configuration file does not contain\n # a unique or shared node for this argument. In addition, the value has not been provided on the command\n # line. This means that no values will get assigned to this argument, so terminate.\n if not foundNode:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n if not instructions: \n isSuccess = False\n\n # Check if arguments were imported for this task. If so, check to see if this argument is therefore\n # available on the command line.\n if task == superpipeline.pipelineConfigurationData[superpipeline.pipeline].importArgumentsFromTool:\n if isTerminate: \n errors.unsetRequiredArgument(argument, args.arguments[argument].shortFormArgument, args.arguments[argument].description)\n else:\n if isTerminate: errors.noInputNode(task, tool, argument)\n \n # If there are instructions, but no node, construct the node.\n else:\n if instructions['method'] == 'from tool argument':\n argumentToUse = instructions['use argument']\n\n # Find all nodes for this task using this argument.\n for predecessorNodeId in graph.graph.predecessors(task):\n if graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument') == argumentToUse:\n nodeAddress = str(predecessorNodeId + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Attach the name of the node from which this filename is constructed to the node.\n graph.setGraphNodeAttribute(nodeAddress, 'constructUsingNode', predecessorNodeId)\n\n # If there are instructions, but the construction method does not use another argument, create a node.\n else:\n nodeAddress = str(task + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Now consider output files.\n else:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n\n # Loop over all output nodes looking for edges that use this argument.\n for nodeId in graph.CM_getOutputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(task, nodeId, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If construction instructions are provided.\n if instructions:\n\n # If the construction is to proceed by using an argument from this task, ensure that that\n # argument is either set, or is itelf a successor to another task and so has the chance\n # of being set.\n if instructions['method'] == 'from tool argument':\n longFormArgument = toolData.getLongFormArgument(instructions['use argument'])\n foundNode = False\n for predecessorNodeId in graph.graph.predecessors(task):\n edgeArgument = graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument')\n if edgeArgument == longFormArgument:\n foundNode = True\n constructionNodeId = predecessorNodeId\n\n # If the node being used to construct the file does not exist, then it cannot be used to \n # construct the filename and so some data must be missing.\n if not foundNode:\n isSuccess = False\n if isTerminate: errors.noNodeForConstruction(task, tool, argument, longFormArgument)\n\n # If the node used to construct this filename exists, but it has no values or predecessors,\n # it also will not be able to be used to construct the argument.\n #elif not graph.getGraphNodeAttribute(constructionNodeId, 'values'):\n #if not graph.graph.predecessors(constructionNodeId):\n # TODO ERROR\n #print('dataConsistency - checkRequiredArguments - cannot construct output', task, argument); exit(1)\n\n # Add the node to the list of nodes that have the potential to be constructed.\n if nodeId not in constructableNodes: constructableNodes.append(nodeId)\n\n # If no instructions are provided check that there are values supplied.\n if not instructions and not graph.getGraphNodeAttribute(nodeId, 'values'):\n isSuccess = False\n if isTerminate: errors.noConstructionMethod(task, tool, argument)\n\n # If no node exists for this argument, determine the course of action.\n if not foundNode:\n\n # If there are no instructions for constructing the filename, terminate.\n if not instructions: print('dataConsistency.checkRequiredArguments - no output node', task, argument); exit(1)\n\n # If there are instructions, but no node, construct the node.\n nodeAddress = str(task + '.' + argument)\n argumentAttributes = toolData.getArgumentData(argument)\n\n # Determine if this node is a stub. If so, this is an output that is not shared with any other tasks, so\n # construct as many nodes as required.\n if argumentAttributes.isStub: #graph.constructOutputStubs()\n for i, stubExtension in enumerate(argumentAttributes.stubExtensions):\n modifiedNodeAddress = str(nodeAddress + '.' + stubExtension)\n stubAttributes = deepcopy(argumentAttributes)\n stubAttributes.stubExtension = stubExtension\n stubAttributes.isPrimaryStubNode = True if i == 0 else False\n graph.addFileNode(modifiedNodeAddress, modifiedNodeAddress)\n graph.addEdge(task, modifiedNodeAddress, stubAttributes)\n\n # If this is not a stub, add the node and edge.\n else:\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(task, nodeAddress, argumentAttributes)\n\n # Return if the operation was a success.\n return isSuccess", "metadata": "root.checkRequiredArguments", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "fileNodeId ", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 22 }, { "span": "value ", "start_line": 104, "start_column": 9, "end_line": 104, "end_column": 14 }, { "span": "value ", "start_line": 110, "start_column": 9, "end_line": 110, "end_column": 14 }, { "span": "value ", "start_line": 116, "start_column": 9, "end_line": 116, "end_column": 14 }, { "span": "isInput ", "start_line": 210, "start_column": 8, "end_line": 210, "end_column": 15 }, { "span": "constructionNodeId ", "start_line": 326, "start_column": 22, "end_line": 326, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Node_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "source_", ",_", "target_", ",_", "node", "Type_", ",_", "expected", "Data", "Type_", ",_", "values_", ",_", "is", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "error", " ", "handling", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "er_", "._", "consiste", "nc", "y", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "pipeline", " ", "configura", "tion", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "super", "pipeline_", "._", "pipeline", "Configura", "tion", "Data_", "[_", "super", "pipeline_", "._", "pipeline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "require", "d", " ", "attribute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "long", "Form", "Argument_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Type_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "data", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "edge", " ", "hg", "as", " ", "bee", "n", " ", "marked", " ", "as", " ", "a", " ", "link", " ", "only", ".", " ", "Thi", "s", " ", "occur", "s", " ", "whe", "n", " ", "a", " ", "nodes", " ", "values", " ", "are", " ", "construct", "ed", " ", "usi", "ng", " ", "values", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anot", "her", " ", "node", ".", " ", "An", " ", "edge", " ", "is", " ", "include", "d", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "workf", "low", " ", "and", " ", "dependen", "cies", " ", "are", " ", "correct", ",", " ", "but", " ", "there", " ", "will", " ", "be", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "associate", "d", " ", "with", " ", "the", " ", "edge", " ", "and", " ", "the", " ", "follow", "ing", " ", "checks", " ", "are", " ", "not", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "Link", "Only_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "is", "Link", "On", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "Link", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "the", " ", "first", " ", "argu", "ment", " ", "parsed", ",", " ", "populate", " ", "the", " ", "expected", "Data", "Type", " ", "variab", "le", " ", "with", " ", "the", " ", "data", " ", "type", " ", "for", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "expected", "Data", "Type_", ":_", "expected", "Data", "Type_", "=_", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "expected", "Data", "Type", " ", "is", " ", "populate", "d", " ", "and", " ", "this", " ", "data", " ", "type", " ", "is", " ", "different", " ", "to", " ", "the", " ", "expected", "Data", "Type", ",", " ", "this", " ", "implies", " ", "tha", "t", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", "s", " ", "usi", "ng", " ", "the", " ", "same", " ", "values", " ", "expect", " ", "different", " ", "data", " ", "types", ".", " ", "Thi", "s", " ", "is", " ", "clear", "ly", " ", "impossible", ",", " ", "so", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "elif_", "expected", "Data", "Type_", "!=_", "data", "Type_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Node", " ", "-", " ", "1", "'_", ",_", "data", "Type_", ",_", "expected", "Data", "Type_", ")_", ";_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "each", " ", "of", " ", "the", " ", "values", " ", "for", " ", "this", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "data", " ", "type", " ", "is", " ", "correct", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "Correct", "Data", "Type_", "(_", "value_", ",_", "expected", "Data", "Type_", ")_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Node", " ", "-", " ", "2", "'_", ",_", "long", "Form", "Argument_", ",_", "value_", ",_", "data", "Type_", ",_", "type_", "(_", "value_", ")_", ")_", ";_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "a", " ", "file", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "extensi", "on", " ", "is", " ", "valid", ".", " ", "Do", " ", "not", " ", "perform", " ", "this", " ", "check", " ", "for", " ", "stub", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "node", "Type_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "is", "Stu", "b", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensions_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "extensi", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "all", " ", "files", " ", "have", " ", "specified", " ", "extensi", "ons", ".", " ", "If", " ", "no", " ", "extensi", "ons", " ", "are", " ", "supplie", "d", ",", " ", "this", " ", "check", " ", "shou", "ld", " ", "not", " ", "be", " ", "perform", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "target_", "if_", "is", "Input_", "else_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Node", "Id_", "=_", "source_", "if_", "is", "Input_", "else_", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "there", " ", "was", " ", "an", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "Extensions_", "(_", "value_", ",_", "extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "a", " ", "top", " ", "level", " ", "pipeline", " ", "argu", "ment", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "long", "Form", "Argument_", "in_", "data_", "._", "long", "Form", "Arguments_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "short", "Form", "Argument_", "=_", "data_", "._", "long", "Form", "Arguments_", "[_", "long", "Form", "Argument_", "]_", "._", "short", "Form", "Argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "._", "invalid", "Ext", "ensi", "on", "Pipeline_", "(_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "value_", ",_", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "pipeline", " ", "argu", "ment", " ", "exist", "s", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "list", " ", "the", " ", "task", " ", "and", " ", "argu", "ment", "._", "\\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 ", " _", "short", "Form", "Argument_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "._", "invalid", "Extension_", "(_", "task_", ",_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "value_", ",_", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "expected", " ", "data", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "expected", "Data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Correct", "Data", "Type_", "(_", "value_", ",_", "data", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "value", " ", "can", " ", "only", " ", "be", " ", "none", ",", " ", "if", " ", "this", " ", "is", " ", "a", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "and_", "value_", "!=_", "0_", "and_", "data", "Type_", "!=_", "'", "flag", "'_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "not_", "value_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "an", " ", "integ", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data", "Type_", "==_", "'", "integ", "er", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "float", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "float", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "string", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "Boo", "lean", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "bool", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "'", "true", "'_", "or_", "value_", "==_", "'", "Tru", "e", "'_", "or_", "value_", "==_", "'", "fal", "se", "'_", "or_", "value_", "==_", "'", "Fal", "se", "'_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "flag", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "'", "set", "'_", "or_", "value_", "==_", "'", "unse", "t", "'_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", " ", "of", " ", "the", " ", "above", " ", "condition", "s", " ", "wer", "e", " ", "met", ",", " ", "the", " ", "data", " ", "type", " ", "is", " ", "incorrect", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Requ", "ired", "Arguments_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "args_", ",_", "is", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "error", " ", "handling", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "er_", "._", "consiste", "nc", "y", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "nodes", " ", "tha", "t", " ", "can", " ", "have", " ", "thei", "r", " ", "values", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "construct", "able", "Nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "defin", "ed", " ", "pipeline", " ", "argu", "ment", "s", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "argu", "ment", "s", " ", "liste", "d", " ", "as", " ", "require", "d", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "args_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "pipeline", " ", "speci", "fie", "s", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "or", " ", "not", ",", " ", "update", " ", "the", " ", "proper", "ties", " ", "of", " ", "the", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "specified", " ", "(", "i", ".", "e", ".", " ", "is", "Requ", "ired", " ", "==", " ", "Non", "e", "),", " ", "it", " ", "is", " ", "left", " ", "to", " ", "the", " ", "tool", " ", "configura", "tion", " ", "to", " ", "dete", "rmin", "e", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", ".", " ", "Thi", "s", " ", "allow", "s", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "to", " ", "not", " ", "only", " ", "speci", "fy", " ", "tha", "t", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "even", " ", "if", " ", "the", " ", "underl", "ying", " ", "tool", " ", "doe", "sn", "'", "t", " ", "require", " ", "the", " ", "value", ",", " ", "the", " ", "pipeline", " ", "can", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "the", " ", "tool", "s", " ", "claim", " ", "tha", "t", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "associate", "d", " ", "graph", " ", "nodes", " ", "and", " ", "see", " ", "if", " ", "the", " ", "values", " ", "are", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "argu", "ment", " ", "was", " ", "import", "ed", " ", "from", " ", "a", " ", "task", " ", "in", " ", "the", " ", "pipeline", ".", " ", "If", " ", "so", ",", " ", "dete", "rmin", "e", " ", "if", " ", "there", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", " ", "(", "if", " ", "not", " ", "an", " ", "option", ").", " ", "On", "ly", " ", "terminate", " ", "if", " ", "the", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "for", " ", "an", " ", "option", ",", " ", "or", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "has", "Instructions", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Imported", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "import", "ed", "Fro", "m", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "task_", ",_", "'", "tool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Instructions", "_", "=_", "True_", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "values", " ", "have", "n", "'", "t", " ", "bee", "n", " ", "set", ",", " ", "terminate", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "pipeline", " ", "argu", "ment", " ", "liste", "d", " ", "as", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "so", " ", "must", " ", "be", " ", "set", " ", "by", " ", "the", " ", "user", " ", "(", "and", " ", "not", " ", "construct", "ed", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", "and_", "not_", "has", "Instructions", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "Form", "Argument_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "task", "s", " ", "in", " ", "the", " ", "workflow_", "\\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_", "for_", "task_", "in_", "graph_", "._", "workflow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "for", " ", "the", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tool_", "=_", "super", "pipeline_", "._", "tasks_", "[_", "task_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "tool", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "require", "d", " ", "argu", "ment", "s", " ", "have", " ", "a", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "tha", "t", " ", "the", " ", "node", " ", "has", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "tool", "Data_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "if", " ", "a", " ", "node", " ", "for", " ", "this", " ", "node", " ", "is", " ", "see", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "for", " ", "an", " ", "input", " ", "file", ",", " ", "output", " ", "file", " ", "or", " ", "an", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "Input_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Inp", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Output_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "an", " ", "output", " ", "file", " ", "with", " ", "constructi", "on", " ", "instruct", "ion", "s", ",", " ", "the", " ", "filename", "s", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "r", ",", " ", "so", " ", "this", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "checke", "d", ".", " ", "Keep", " ", "track", " ", "of", " ", "the", " ", "nodes", " ", "whi", "ch", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "these", " ", "coul", "d", " ", "be", " ", "inputs", " ", "to", " ", "other", " ", "task", "s", " ", "and", " ", "so", " ", "the", " ", "check", " ", "for", " ", "existence", " ", "is", " ", "als", "o", " ", "not", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "these", " ", "input", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "with", " ", "input", " ", "files", " ", "and", " ", "options", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "input", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Inp", "ut", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "marked", " ", "as", " ", "not", " ", "require", "d", " ", "(", "i", ".", "e", ".", " ", "the", " ", "tool", "s", " ", "require", "ment", " ", "has", " ", "bee", "n", " ", "superc", "eded", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "instruct", "ion", "s", " ", "in", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "Instructions", "_", "=_", "False_", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "==_", "None_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Values_", "=_", "True_", "if_", "len_", "(_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ")_", "!=_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "Values_", "and_", "not_", "has", "Instructions", "_", "and_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "node", " ", "can", " ", "have", " ", "it", "'", "s", " ", "values", " ", "set", " ", "with", " ", "a", " ", "top", " ", "level", " ", "pipeline", " ", "argu", "ment", " ", "(", "e", ".", "g", ".", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "set", " ", "with", "out", " ", "defini", "ng", " ", "the", " ", "task", " ", "on", " ", "the", " ", "command", " ", "line", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "long", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "long", "Form", "Argument_", "and_", "'.'_", "not_", "in_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "of", " ", "the", " ", "pipeline", " ", "argu", "ment", " ", "and", " ", "the", " ", "argu", "ment", " ", "description", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "short", "Form", "Arg", "ument", " ", "=", " ", "args", ".", "argu", "ment", "s", "[", "long", "Form", "Arg", "ument", "].", "short", "Form", "Argument_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "top", " ", "level", " ", "argu", "ment", ",", " ", "provide", " ", "a", " ", "different", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "CHECK", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "version", " ", "of", " ", "the", " ", "argu", "ment", " ", "as", " ", "well", " ", "as", " ", "the", " ", "argu", "ment", " ", "description", ".", " ", "Thi", "s", " ", "is", " ", "as", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "tool", ",", " ", "so", " ", "if", " ", "this", " ", "argu", "ment", " ", "can", " ", "be", " ", "set", " ", "usi", "ng", " ", "a", " ", "pipeline", " ", "argu", "ment", ",", " ", "these", " ", "values", " ", "are", " ", "incorrect", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Nest", "ed", "Argument_", "(_", "task_", ",_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ",_", "super", "pipeline_", "._", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "no", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "this", " ", "means", " ", "tha", "t", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "contain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "unique", " ", "or", " ", "shared", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ".", " ", "In", " ", "addition", ",", " ", "the", " ", "value", " ", "has", " ", "not", " ", "bee", "n", " ", "provided", " ", "on", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "line", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "no", " ", "values", " ", "will", " ", "get", " ", "assign", "ed", " ", "to", " ", "this", " ", "argu", "ment", ",", " ", "so", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "argu", "ment", "s", " ", "wer", "e", " ", "import", "ed", " ", "for", " ", "this", " ", "task", ".", " ", "If", " ", "so", ",", " ", "check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "there", "fore", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avail", "able", " ", "on", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "==_", "super", "pipeline_", "._", "pipeline", "Configura", "tion", "Data_", "[_", "super", "pipeline_", "._", "pipeline_", "]_", "._", "import", "Arg", "ument", "s", "Fro", "m", "Tool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Inp", "ut", "Node_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argu", "ment", "To", "Use_", "=_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "all", " ", "nodes", " ", "for", " ", "this", " ", "task", " ", "usi", "ng", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "==_", "argu", "ment", "To", "Use_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "node", "Address_", "=_", "str_", "(_", "predecessor", "Node", "Id_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attach", " ", "the", " ", "name", " ", "of", " ", "the", " ", "node", " ", "from", " ", "whi", "ch", " ", "this", " ", "filename", " ", "is", " ", "construct", "ed", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Address_", ",_", "'", "construct", "Us", "ing", "Node", "'_", ",_", "predecessor", "Node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "the", " ", "constructi", "on", " ", "method", " ", "doe", "s", " ", "not", " ", "use", " ", "anot", "her", " ", "argu", "ment", ",", " ", "create", " ", "a", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "consider", " ", "output", " ", "files", "._", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "output", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Output", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "task_", ",_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "constructi", "on", " ", "instruct", "ion", "s", " ", "are", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "constructi", "on", " ", "is", " ", "to", " ", "proceed", " ", "by", " ", "usi", "ng", " ", "an", " ", "argu", "ment", " ", "from", " ", "this", " ", "task", ",", " ", "ensure", " ", "tha", "t", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "eit", "her", " ", "set", ",", " ", "or", " ", "is", " ", "ite", "lf", " ", "a", " ", "successor", " ", "to", " ", "anot", "her", " ", "task", " ", "and", " ", "so", " ", "has", " ", "the", " ", "chance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "bei", "ng", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "Form", "Argument_", "=_", "tool", "Data_", "._", "get", "Long", "Form", "Argument_", "(_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constructi", "on", "Node", "Id_", "=_", "predecessor", "Node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "bei", "ng", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", ",", " ", "then", " ", "it", " ", "cann", "ot", " ", "be", " ", "used", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "the", " ", "filename", " ", "and", " ", "so", " ", "some", " ", "data", " ", "must", " ", "be", " ", "missi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Node", "For", "Construct", "ion_", "(_", "task_", ",_", "tool_", ",_", "argument_", ",_", "long", "Form", "Argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "used", " ", "to", " ", "construct", " ", "this", " ", "filename", " ", "exist", "s", ",", " ", "but", " ", "it", " ", "has", " ", "no", " ", "values", " ", "or", " ", "predecessor", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "als", "o", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "be", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "not", " ", "graph", ".", "get", "Graph", "Node", "Attribute", "(", "constructi", "on", "Node", "Id", ",", " ", "'", "values", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "graph", ".", "graph", ".", "predecessor", "s", "(", "constructi", "on", "Node", "Id", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "data", "Cons", "iste", "nc", "y", " ", "-", " ", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "cann", "ot", " ", "construct", " ", "output", "',", " ", "task", ",", " ", "argu", "ment", ");", " ", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "to", " ", "the", " ", "list", " ", "of", " ", "nodes", " ", "tha", "t", " ", "have", " ", "the", " ", "potenti", "al", " ", "to", " ", "be", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "construct", "able", "Nodes_", "._", "append_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "instruct", "ion", "s", " ", "are", " ", "provided", " ", "check", " ", "tha", "t", " ", "there", " ", "are", " ", "values", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instructions_", "and_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Construct", "ion", "Method_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "node", " ", "exist", "s", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "dete", "rmin", "e", " ", "the", " ", "course", " ", "of", " ", "action", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", ",", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "instructions_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "no", " ", "output", " ", "node", "'_", ",_", "task_", ",_", "argument_", ")_", ";_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "this", " ", "node", " ", "is", " ", "a", " ", "stub", ".", " ", "If", " ", "so", ",", " ", "this", " ", "is", " ", "an", " ", "output", " ", "tha", "t", " ", "is", " ", "not", " ", "shared", " ", "with", " ", "any", " ", "other", " ", "task", "s", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "as", " ", "many", " ", "nodes", " ", "as", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argu", "ment", "Attributes_", "._", "is", "Stub_", ":_", "#", "graph", ".", "construct", "Output", "Stu", "bs", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "stub", "Extension_", "in_", "enumerate_", "(_", "argu", "ment", "Attributes_", "._", "stub", "Extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "Node", "Address_", "=_", "str_", "(_", "node", "Address_", "+_", "'.'_", "+_", "stub", "Extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "=_", "deepcopy_", "(_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "stub", "Extension_", "=_", "stub", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "is", "Prim", "ary", "Stu", "b", "Node_", "=_", "True_", "if_", "i_", "==_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "modifi", "ed", "Node", "Address_", ",_", "modifi", "ed", "Node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "modifi", "ed", "Node", "Address_", ",_", "stub", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "stub", ",", " ", "add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "node", "Address_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "if", " ", "the", " ", "operati", "on", "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rom rx.abstractobserver import AbstractObserver\nfrom rx.disposables import Disposable\n\nfrom .subscription import Subscription\nfrom .reactive_assert import AssertList\n\nlog = logging.getLogger(\"Rx\")\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HotObservable(Observable):\n", "metadata": "root.HotObservable", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, scheduler, messages):\n log.debug(\"HotObservable.__init__()\")\n Observable.__init__(self, self._subscribe)\n\n self.scheduler = scheduler\n self.messages = messages\n self.subscriptions = AssertList()\n self.observers = []\n\n observable = self\n\n def get_action(notification):\n def action(scheduler, state):\n for observer in observable.observers[:]:\n notification.accept(observer)\n return Disposable.empty()\n return action\n\n for message in self.messages:\n notification = message.value\n\n # Warning: Don't make closures within a loop\n action = get_action(notification)\n scheduler.schedule_absolute(message.time, action)", "metadata": "root.HotObservable.__init__", "header": "['class', 'HotObservable', '(', 'Observable', ')', ':', '___EOS___']", "index": 12 }, { "content": " def _subscribe(self, observer):\n log.debug(\"HotObservable:subscribe()\")\n\n observable = self\n self.observers.append(observer)\n self.subscriptions.append(Subscription(self.scheduler.clock))\n index = len(self.subscriptions) - 1\n\n def dispose_action():\n log.debug(\"HotObservable:subscribe:dispose_action(%s)\" % self.scheduler.clock)\n observable.observers.remove(observer)\n start = observable.subscriptions[index].subscribe\n end = observable.scheduler.clock\n observable.subscriptions[index] = Subscription(start, end)\n\n return Disposable(dispose_action)", "metadata": "root.HotObservable._subscribe", "header": "['class', 'HotObservable', '(', 'Observable', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "from rx import Observable, Observer", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 35 }, { "span": "from rx.abstractobserver import AbstractObserver", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "import_", "Observable_", ",_", "Observer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "abstract", "observer_", "import_", "Abstract", "Observer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "subscription_", "import_", "Subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "reacti", "ve", "\\u", "assert_", "import_", "Assert", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "Rx", "\"_", ")_", "\\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_", "Hot", "Observable_", "(_", "Observable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hot", "Observable_", "(_", "Observable_", ")_", ":_", "\\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_", ",_", "scheduler_", ",_", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "Hot", "Observa", "ble", ".\\u", "\\u", "init", "\\u\\u()\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Observable_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "self_", "._", "\\u", "subscribe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scheduler_", "=_", "scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "messages_", "=_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subscriptions_", "=_", "Assert", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "observers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observable_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "action_", "(_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "action_", "(_", "scheduler_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "observer_", "in_", "observable_", "._", "observers_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "notification_", "._", "accept_", "(_", "observer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Dispo", "sab", "le_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "message_", "in_", "self_", "._", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notification_", "=_", "message_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Warn", "ing", ":", " ", "Don", "'", "t", " ", "make", " ", "clos", "ure", "s", " ", "within", " ", "a", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "get", "\\u", "action_", "(_", "notification_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "schedule", "\\u", "absolute_", "(_", "message_", "._", "time_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hot", "Observable_", "(_", "Observable_", ")_", ":_", "\\u\\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", "subscribe_", "(_", "self_", ",_", "observer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "Hot", "Observa", "ble", ":", "subscribe", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observable_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "observers_", "._", "append_", "(_", "observer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subscriptions_", "._", "append_", "(_", "Subscription_", "(_", "self_", "._", "scheduler_", "._", "clock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "len_", "(_", "self_", "._", "subscriptions_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dispose", "\\u", "action_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "Hot", "Observa", "ble", ":", "subscribe", ":", "dispose", "\\u", "action", "(%", "s", ")\"_", "%_", "self_", "._", "scheduler_", "._", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observable_", "._", "observers_", "._", "remove_", "(_", "observer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "observable_", "._", "subscriptions_", "[_", "index_", "]_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "observable_", "._", "scheduler_", "._", "clock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observable_", "._", "subscriptions_", "[_", "index_", "]_", "=_", "Subscription_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Dispo", "sab", "le_", "(_", "dispose", "\\u", "action_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
stefanfoulis/django-database-email-backend/database_email_backend/migrations/0002_auto__add_attachment.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'database_email_backend.attachment': {\n 'Meta': {'object_name': 'Attachment'},\n 'content_base64': ('database_email_backend.fields.Base64Field', [], {'default': 'None', 'null': 'True', 'db_column': \"'content'\", 'blank': 'True'}),\n 'email': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['database_email_backend.Email']\"}),\n 'filename': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mimetype': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'})\n },\n 'database_email_backend.email': {\n 'Meta': {'object_name': 'Email'},\n 'all_recipients': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'bcc_emails': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'body': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'cc_emails': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'from_email': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '255', 'blank': 'True'}),\n 'headers': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'raw': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'sent_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'subject': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'to_emails': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'})\n }\n }\n\n complete_apps = ['database_email_backend']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Adding model 'Attachment'\n db.create_table('database_email_backend_attachment', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('email', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['database_email_backend.Email'])),\n ('filename', self.gf('django.db.models.fields.CharField')(default=None, max_length=255, null=True, blank=True)),\n ('content_base64', self.gf('database_email_backend.fields.Base64Field')(default=None, null=True, db_column='content', blank=True)),\n ('mimetype', self.gf('django.db.models.fields.CharField')(default=None, max_length=255, null=True, blank=True)),\n ))\n db.send_create_signal('database_email_backend', ['Attachment'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Deleting model 'Attachment'\n db.delete_table('database_email_backend_attachment')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "attach", "ment", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Attach", "ment", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "base64", "'_", ":_", "(_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "fields", ".", "Base", "64", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "column", "'_", ":_", "\"'", "content", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "Ema", "il", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filename", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "email", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ema", "il", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "recip", "ients", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bcc", "\\u", "email", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cc", "\\u", "email", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "\\u", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "raw", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sent", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "\\u", "email", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Attach", "ment", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", "\\u", "attach", "ment", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "email", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "Ema", "il", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "filename", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "None_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "\\u", "base64", "'_", ",_", "self_", "._", "gf_", "(_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", ".", "fields", ".", "Base", "64", "Field", "'_", ")_", "(_", "default_", "=_", "None_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "column_", "=_", "'", "content", "'_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mime", "type", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "None_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", "'_", ",_", "[_", "'", "Attach", "ment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Attach", "ment", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "'", "databa", "se", "\\u", "email", "\\u", "back", "end", "\\u", "attach", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Insecure temporary file
PyTables/PyTables/tables/tests/test_numpy.py
[ { "content": " def WriteRead(self, testArray):\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running test for array with typecode '%s'\" %\n testArray.dtype.char, end=' ')\n print(\"for class check:\", self.title)\n\n # Create an instance of HDF5 Table\n self.h5fname = tempfile.mktemp(\".h5\")\n try:\n with tables.open_file(self.h5fname, mode=\"w\") as self.h5file:\n self.root = self.h5file.root\n\n # Create the array under root and name 'somearray'\n a = testArray\n self.h5file.create_array(self.root, 'somearray', a,\n \"Some array\")\n\n # Re-open the file in read-only mode\n with tables.open_file(self.h5fname, mode=\"r\") as self.h5file:\n self.root = self.h5file.root\n\n # Read the saved array\n b = self.root.somearray.read()\n\n # For cases that read returns a python type instead of a\n # numpy type\n if not hasattr(b, \"shape\"):\n b = np.np.array(b, dtype=a.dtype.str)\n\n # Compare them. They should be equal.\n # if not allequal(a,b, \"numpy\") and common.verbose:\n if common.verbose:\n print(\"Array written:\", a)\n print(\"Array written shape:\", a.shape)\n print(\"Array written itemsize:\", a.itemsize)\n print(\"Array written type:\", a.dtype.char)\n print(\"Array read:\", b)\n print(\"Array read shape:\", b.shape)\n print(\"Array read itemsize:\", b.itemsize)\n print(\"Array read type:\", b.dtype.char)\n\n type_ = self.root.somearray.atom.type\n\n # Check strictly the array equality\n self.assertEqual(type(a), type(b))\n self.assertEqual(a.shape, b.shape)\n self.assertEqual(a.shape, self.root.somearray.shape)\n self.assertEqual(a.dtype, b.dtype)\n if a.dtype.char[0] == \"S\":\n self.assertEqual(type_, \"string\")\n else:\n self.assertEqual(a.dtype.base.name, type_)\n\n self.assertTrue(allequal(a, b, \"numpy\"))\n finally:\n # Then, delete the file\n if os.path.exists(self.h5fname):\n os.remove(self.h5fname)", "metadata": "root.BasicTestCase.WriteRead", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 50 } ]
[ { "span": "tempfile.mktemp(\".h5\")", "start_line": 58, "start_column": 23, "end_line": 58, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Write", "Read_", "(_", "self_", ",_", "test", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "test", " ", "for", " ", "array", " ", "with", " ", "typec", "ode", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Array_", "._", "dtype_", "._", "char_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "for", " ", "class", " ", "check", ":\"_", ",_", "self_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5", "fname_", "=_", "tempfile_", "._", "mktemp_", "(_", "\".", "h5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "tables_", "._", "open", "\\u", "file_", "(_", "self_", "._", "h5", "fname_", ",_", "mode_", "=_", "\"", "w", "\"_", ")_", "as_", "self_", "._", "h5file", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "array", " ", "under", " ", "root", " ", "and", " ", "name", " ", "'", "some", "array", "'_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "test", "Array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "self_", "._", "root_", ",_", "'", "some", "array", "'_", ",_", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Some", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Re", "-", "open", " ", "the", " ", "file", " ", "in", " ", "read", "-", "only", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "tables_", "._", "open", "\\u", "file_", "(_", "self_", "._", "h5", "fname_", ",_", "mode_", "=_", "\"", "r", "\"_", ")_", "as_", "self_", "._", "h5file", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "saved", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "self_", "._", "root_", "._", "some", "array_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "case", "s", " ", "tha", "t", " ", "read", " ", "return", "s", " ", "a", " ", "python", " ", "type", " ", "inst", "ead", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nump", "y", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "b_", ",_", "\"", "shape", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "b_", "=_", "np_", "._", "np_", "._", "array_", "(_", "b_", ",_", "dtype_", "=_", "a_", "._", "dtype_", "._", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compare", " ", "them", ".", " ", "The", "y", " ", "shou", "ld", " ", "be", " ", "equal", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "alle", "qual", "(", "a", ",", "b", ",", " ", "\"", "nump", "y", "\")", " ", "and", " ", "common", ".", "verbo", "se", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Array", " ", "writt", "en", ":\"_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "shape", ":\"_", ",_", "a_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "items", "ize", ":\"_", ",_", "a_", "._", "itemsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "type", ":\"_", ",_", "a_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", ":\"_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "shape", ":\"_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "items", "ize", ":\"_", ",_", "b_", "._", "itemsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "type", ":\"_", ",_", "b_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "type\\u_", "=_", "self_", "._", "root_", "._", "some", "array_", "._", "atom_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "strict", "ly", " ", "the", " ", "array", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "a_", ")_", ",_", "type_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "self_", "._", "root_", "._", "some", "array_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "dtype_", ",_", "b_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "dtype_", "._", "char_", "[_", "0_", "]_", "==_", "\"", "S", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "Equal_", "(_", "type\\u_", ",_", "\"", "string", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "dtype_", "._", "base_", "._", "name_", ",_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "a_", ",_", "b_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "n", ",", " ", "delete", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "h5", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "h5", "fname_", ")_", "\\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, 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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 ]
Except block handles 'BaseException'
jawerty/AlienFeed/alienfeed/alien.py
[ { "content": "def submission_getter(submission_list, verbose = False):\n submissions = []\n scores = []\n subreddits = set()\n\n for x, submission in enumerate(submission_list):\n submissions.append(submission)\n if verbose:\n scores.append(submission.score)\n subreddits.add(str(submission.subreddit))\n\n if not verbose:\n return submissions\n\n count_width = int(math.log(len(submissions), 10)) + 1\n score_width = len(str(max(scores)))\n\n fmt = {'arrow': ' -> '}\n indent = ' ' * (count_width + len(fmt['arrow']) + score_width + 1)\n\n try:\n _, terminal_width = os.popen('stty size', 'r').read().split()\n terminal_width = int(terminal_width)\n except:\n terminal_width = 80\n\n wrapper = TextWrapper(subsequent_indent = indent, width = terminal_width)\n\n for i, submission in enumerate(submissions):\n fmt['count'] = color.OKGREEN + str(i + 1).rjust(count_width)\n fmt['score'] = color.WARNING + str(submission.score).rjust(score_width)\n fmt['title'] = color.OKBLUE + submission.title\n fmt['tags'] = get_link_types(submission)\n\n if len(subreddits) > 1:\n fmt['title'] += color.SUBTEXT + u' ({0})'.format(submission.subreddit)\n\n wrap = wrapper.wrap(\n u'{count}{arrow}{score} {title} {tags}'.format(**fmt))\n\n for line in wrap:\n print line\n\n return submissions", "metadata": "root.submission_getter", "header": "['module', '___EOS___']", "index": 74 } ]
[ { "span": "except:", "start_line": 97, "start_column": 4, "end_line": 97, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subm", "ission", "\\u", "getter_", "(_", "subm", "ission", "\\u", "list_", ",_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submissions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subred", "dit", "s_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "submission_", "in_", "enumerate_", "(_", "subm", "ission", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submissions_", "._", "append_", "(_", "submission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scores_", "._", "append_", "(_", "submission_", "._", "score_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subred", "dit", "s_", "._", "add_", "(_", "str_", "(_", "submission_", "._", "subreddit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "submissions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "count", "\\u", "width_", "=_", "int_", "(_", "math_", "._", "log_", "(_", "len_", "(_", "submissions_", ")_", ",_", "10_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score", "\\u", "width_", "=_", "len_", "(_", "str_", "(_", "max_", "(_", "scores_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fmt_", "=_", "{_", "'", "arrow", "'_", ":_", "'", " ", "->", " ", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indent_", "=_", "'", " ", "'_", "*_", "(_", "count", "\\u", "width_", "+_", "len_", "(_", "fmt_", "[_", "'", "arrow", "'_", "]_", ")_", "+_", "score", "\\u", "width_", "+_", "1_", ")_", "\\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 ", " _", "\\u_", ",_", "termina", "l\\u", "width_", "=_", "os_", "._", "popen_", "(_", "'", "stt", "y", " ", "size", "'_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "termina", "l\\u", "width_", "=_", "int_", "(_", "termina", "l\\u", "width_", ")_", "\\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 ", " _", "termina", "l\\u", "width_", "=_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapper_", "=_", "Text", "Wrapper_", "(_", "subsequen", "t", "\\u", "indent_", "=_", "indent_", ",_", "width_", "=_", "termina", "l\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "submission_", "in_", "enumerate_", "(_", "submissions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "[_", "'", "count", "'_", "]_", "=_", "color_", "._", "OK", "GREEN_", "+_", "str_", "(_", "i_", "+_", "1_", ")_", "._", "rjust_", "(_", "count", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "[_", "'", "score", "'_", "]_", "=_", "color_", "._", "WARNING_", "+_", "str_", "(_", "submission_", "._", "score_", ")_", "._", "rjust_", "(_", "score", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "[_", "'", "title", "'_", "]_", "=_", "color_", "._", "OK", "BLUE_", "+_", "submission_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "[_", "'", "tags", "'_", "]_", "=_", "get", "\\u", "link", "\\u", "types_", "(_", "submission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "subred", "dit", "s_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "[_", "'", "title", "'_", "]_", "+=_", "color_", "._", "SUBT", "EXT_", "+_", "u", "'", " ", "({", "0", "})'_", "._", "format_", "(_", "submission_", "._", "subreddit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrap_", "=_", "wrapper_", "._", "wrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'{", "count", "}{", "arrow", "}{", "score", "}", " ", "{", "title", "}", " ", "{", "tags", "}'_", "._", "format_", "(_", "**_", "fmt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "wrap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "line_", "\\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 ]
Unused local variable
jmg/elixir/tests/test_autoload.py
[ { "content": " def test_fk_auto_join_sa(self):\n # SQLAlchemy produces the join in this case\n person_table = Table('person', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(32)))\n\n animal_table = Table('animal', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(30)),\n Column('owner_id', Integer, ForeignKey('person.id')))\n\n metadata.create_all()\n metadata.clear()\n\n class Person(Entity):\n pets = OneToMany('Animal')\n\n class Animal(Entity):\n owner = ManyToOne('Person')\n\n setup_all()\n\n snowball = Animal(name=\"Snowball\")\n snowball2 = Animal(name=\"Snowball II\")\n slh = Animal(name=\"Santa's Little Helper\")\n homer = Person(name=\"Homer\", pets=[slh, snowball])\n lisa = Person(name=\"Lisa\", pets=[snowball2])\n\n session.commit()\n session.expunge_all()\n\n homer = Person.get_by(name=\"Homer\")\n lisa = Person.get_by(name=\"Lisa\")\n slh = Animal.get_by(name=\"Santa's Little Helper\")\n\n assert len(homer.pets) == 2\n assert homer == slh.owner\n assert lisa.pets[0].name == \"Snowball II\"", "metadata": "root.TestAutoload.test_fk_auto_join_sa", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_fk_auto_join_colname(self):\n person_table = Table('person', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(32)))\n\n animal_table = Table('animal', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(30)),\n Column('owner_id', Integer, ForeignKey('person.id')),\n Column('feeder_id', Integer, ForeignKey('person.id')))\n\n metadata.create_all()\n metadata.clear()\n\n class Person(Entity):\n pets = OneToMany('Animal', inverse='owner')\n animals = OneToMany('Animal', inverse='feeder')\n\n class Animal(Entity):\n owner = ManyToOne('Person', colname='owner_id')\n feeder = ManyToOne('Person', colname='feeder_id')\n\n setup_all()\n\n snowball = Animal(name=\"Snowball II\")\n slh = Animal(name=\"Santa's Little Helper\")\n homer = Person(name=\"Homer\", animals=[snowball, slh], pets=[slh])\n lisa = Person(name=\"Lisa\", pets=[snowball])\n\n session.commit()\n session.expunge_all()\n\n homer = Person.get_by(name=\"Homer\")\n lisa = Person.get_by(name=\"Lisa\")\n slh = Animal.get_by(name=\"Santa's Little Helper\")\n\n assert len(homer.animals) == 2\n assert homer == lisa.pets[0].feeder\n assert homer == slh.owner", "metadata": "root.TestAutoload.test_fk_auto_join_colname", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_selfref(self):\n person_table = Table('person', metadata,\n Column('id', Integer, primary_key=True),\n Column('father_id', Integer, ForeignKey('person.id')),\n Column('name', String(32)))\n\n metadata.create_all()\n metadata.clear()\n\n class Person(Entity):\n father = ManyToOne('Person')\n children = OneToMany('Person')\n\n setup_all()\n\n grampa = Person(name=\"Abe\")\n homer = Person(name=\"Homer\")\n bart = Person(name=\"Bart\")\n lisa = Person(name=\"Lisa\")\n\n grampa.children.append(homer)\n homer.children.append(bart)\n lisa.father = homer\n\n session.commit()\n session.expunge_all()\n\n p = Person.get_by(name=\"Homer\")\n\n assert p in p.father.children\n assert p.father.name == \"Abe\"\n assert p.father is Person.get_by(name=\"Abe\")\n assert p is Person.get_by(name=\"Lisa\").father", "metadata": "root.TestAutoload.test_selfref", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": " def test_m2m(self):\n person_table = Table('person', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(32)))\n\n category_table = Table('category', metadata,\n Column('name', String(30), primary_key=True))\n\n person_category_table = Table('person_category', metadata,\n Column('person_id', Integer, ForeignKey('person.id')),\n Column('category_name', String(30), ForeignKey('category.name')))\n\n metadata.create_all()\n metadata.clear()\n\n class Person(Entity):\n categories = ManyToMany('Category',\n tablename='person_category')\n\n class Category(Entity):\n persons = ManyToMany('Person',\n tablename='person_category')\n\n setup_all()\n\n stupid = Category(name=\"Stupid\")\n simpson = Category(name=\"Simpson\")\n old = Category(name=\"Old\")\n\n grampa = Person(name=\"Abe\", categories=[simpson, old])\n homer = Person(name=\"Homer\", categories=[simpson, stupid])\n bart = Person(name=\"Bart\")\n lisa = Person(name=\"Lisa\")\n\n simpson.persons.extend([bart, lisa])\n\n session.commit()\n session.expunge_all()\n\n c = Category.get_by(name=\"Simpson\")\n grampa = Person.get_by(name=\"Abe\")\n\n assert len(c.persons) == 4\n assert c in grampa.categories", "metadata": "root.TestAutoload.test_m2m", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 169 }, { "content": " def test_m2m_selfref(self):\n person_table = Table('person', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(32)))\n\n person_person_table = Table('person_person', metadata,\n Column('person_id1', Integer, ForeignKey('person.id')),\n Column('person_id2', Integer, ForeignKey('person.id')))\n\n metadata.create_all()\n metadata.clear()\n\n class Person(Entity):\n appreciate = ManyToMany('Person',\n tablename='person_person',\n local_colname='person_id1')\n isappreciatedby = ManyToMany('Person',\n tablename='person_person',\n # this one is not necessary\n local_colname='person_id2')\n\n setup_all()\n\n barney = Person(name=\"Barney\")\n homer = Person(name=\"Homer\", appreciate=[barney])\n\n session.commit()\n session.expunge_all()\n\n homer = Person.get_by(name=\"Homer\")\n barney = Person.get_by(name=\"Barney\")\n\n assert barney in homer.appreciate\n assert homer in barney.isappreciatedby", "metadata": "root.TestAutoload.test_m2m_selfref", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def _create_table_a(self):\n a_table = Table('a', metadata,\n Column('id', Integer, primary_key=True),\n Column('name', String(32)))\n\n metadata.create_all()\n metadata.clear()", "metadata": "root.TestAutoload._create_table_a", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 300 }, { "content": " def test_nopk(self):\n table = Table('a', metadata,\n Column('id', Integer),\n Column('name', String(32)))\n\n metadata.create_all()\n metadata.clear()\n\n class A(Entity):\n using_mapper_options(primary_key=['id'])\n\n setup_all()\n\n a1 = A(id=1, name=\"a1\")\n\n session.commit()\n session.expunge_all()\n\n res = A.query.all()\n\n assert len(res) == 1\n assert res[0].name == \"a1\"", "metadata": "root.TestAutoload.test_nopk", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 347 }, { "content": " def test_inheritance(self):\n table = Table('father', metadata,\n Column('id', Integer, primary_key=True),\n Column('row_type', elixir.options.POLYMORPHIC_COL_TYPE))\n\n metadata.create_all()\n metadata.clear()\n\n class Father(Entity):\n pass\n\n class Son(Father):\n pass\n\n setup_all()", "metadata": "root.TestAutoload.test_inheritance", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 370 }, { "content": " def test_autoload_mixed(self):\n # mixed autoloaded entity with a non autoloaded one\n conn = metadata.bind.connect()\n conn.execute(\"CREATE TABLE user (\"\n \"user_id INTEGER PRIMARY KEY AUTOINCREMENT)\")\n conn.close()\n\n class User(Entity):\n using_options(tablename='user', autoload=True)\n\n class Item(Entity):\n using_options(autoload=False)\n\n owner = ManyToOne('User')\n\n setup_all(True)\n\n colname = Item.table.c['owner_user_id'].foreign_keys[0].column.name\n assert colname == 'user_id'", "metadata": "root.TestAutoload.test_autoload_mixed", "header": "['class', 'TestAutoload', '(', 'object', ')', ':', '___EOS___']", "index": 386 } ]
[ { "span": "person_table ", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 20 }, { "span": "animal_table ", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 20 }, { "span": "person_table ", "start_line": 96, "start_column": 8, "end_line": 96, "end_column": 20 }, { "span": "animal_table ", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 20 }, { "span": "person_table ", "start_line": 136, "start_column": 8, "end_line": 136, "end_column": 20 }, { "span": "person_table ", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 20 }, { "span": "category_table ", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 22 }, { "span": "person_category_table ", "start_line": 177, "start_column": 8, "end_line": 177, "end_column": 29 }, { "span": "homer ", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 13 }, { "span": "person_table ", "start_line": 263, "start_column": 8, "end_line": 263, "end_column": 20 }, { "span": "person_person_table ", "start_line": 267, "start_column": 8, "end_line": 267, "end_column": 27 }, { "span": "a_table ", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 15 }, { "span": "table ", "start_line": 348, "start_column": 8, "end_line": 348, "end_column": 13 }, { "span": "a1 ", "start_line": 360, "start_column": 8, "end_line": 360, "end_column": 10 }, { "span": "table ", "start_line": 371, "start_column": 8, "end_line": 371, "end_column": 13 }, { "span": "Son(", "start_line": 381, "start_column": 14, "end_line": 381, "end_column": 17 }, { "span": "User(", "start_line": 393, "start_column": 14, "end_line": 393, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fk", "\\u", "auto", "\\u", "join", "\\u", "sa_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SQL", "Al", "chem", "y", " ", "produce", "s", " ", "the", " ", "join", " ", "in", " ", "this", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "animal", "\\u", "table_", "=_", "Table_", "(_", "'", "animal", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "30_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "owner", "\\u", "id", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pets", "_", "=_", "One", "To", "Many", "_", "(_", "'", "Anima", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Anima", "l_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "Many", "To", "One_", "(_", "'", "Person", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "snow", "ball_", "=_", "Anima", "l_", "(_", "name_", "=_", "\"", "Snow", "bal", "l", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snow", "bal", "l2_", "=_", "Anima", "l_", "(_", "name_", "=_", "\"", "Snow", "bal", "l", " ", "II", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "h_", "=_", "Anima", "l_", "(_", "name_", "=_", "\"", "Santa", "'", "s", " ", "Litt", "le", " ", "Help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "=_", "Person_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ",_", "pets", "_", "=_", "[_", "sl", "h_", ",_", "snow", "ball_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ",_", "pets", "_", "=_", "[_", "snow", "bal", "l2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "home", "r_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "h_", "=_", "Anima", "l_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Santa", "'", "s", " ", "Litt", "le", " ", "Help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "home", "r_", "._", "pets", "_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "home", "r_", "==_", "sl", "h_", "._", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lis", "a_", "._", "pets", "_", "[_", "0_", "]_", "._", "name_", "==_", "\"", "Snow", "bal", "l", " ", "II", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fk", "\\u", "auto", "\\u", "join", "\\u", "colname_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "animal", "\\u", "table_", "=_", "Table_", "(_", "'", "animal", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "30_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "owner", "\\u", "id", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "feeder", "\\u", "id", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pets", "_", "=_", "One", "To", "Many", "_", "(_", "'", "Anima", "l", "'_", ",_", "inverse_", "=_", "'", "owner", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "animal", "s_", "=_", "One", "To", "Many", "_", "(_", "'", "Anima", "l", "'_", ",_", "inverse_", "=_", "'", "feeder", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Anima", "l_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "Many", "To", "One_", "(_", "'", "Person", "'_", ",_", "colname_", "=_", "'", "owner", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feeder", "_", "=_", "Many", "To", "One_", "(_", "'", "Person", "'_", ",_", "colname_", "=_", "'", "feeder", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "snow", "ball_", "=_", "Anima", "l_", "(_", "name_", "=_", "\"", "Snow", "bal", "l", " ", "II", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "h_", "=_", "Anima", "l_", "(_", "name_", "=_", "\"", "Santa", "'", "s", " ", "Litt", "le", " ", "Help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "=_", "Person_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ",_", "animal", "s_", "=_", "[_", "snow", "ball_", ",_", "sl", "h_", "]_", ",_", "pets", "_", "=_", "[_", "sl", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ",_", "pets", "_", "=_", "[_", "snow", "ball_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "home", "r_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "h_", "=_", "Anima", "l_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Santa", "'", "s", " ", "Litt", "le", " ", "Help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "home", "r_", "._", "animal", "s_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "home", "r_", "==_", "lis", "a_", "._", "pets", "_", "[_", "0_", "]_", "._", "feeder", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "home", "r_", "==_", "sl", "h_", "._", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "self", "ref_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "fat", "her", "\\u", "id", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "father_", "=_", "Many", "To", "One_", "(_", "'", "Person", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "One", "To", "Many", "_", "(_", "'", "Person", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gram", "pa_", "=_", "Person_", "(_", "name_", "=_", "\"", "Ab", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "=_", "Person_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bart", "_", "=_", "Person_", "(_", "name_", "=_", "\"", "Bar", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gram", "pa_", "._", "children_", "._", "append_", "(_", "home", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "._", "children_", "._", "append_", "(_", "bart", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "._", "father_", "=_", "home", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "p_", "in_", "p_", "._", "father_", "._", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "father_", "._", "name_", "==_", "\"", "Ab", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "father_", "is_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Ab", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "is_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ")_", "._", "father_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "m2", "m_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "category", "\\u", "table_", "=_", "Table_", "(_", "'", "category", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "30_", ")_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "person", "\\u", "category", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "\\u", "category", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "person", "\\u", "id", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "category", "\\u", "name", "'_", ",_", "String_", "(_", "30_", ")_", ",_", "Fore", "ign", "Key_", "(_", "'", "category", ".", "name", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "=_", "Many", "To", "Many", "_", "(_", "'", "Cate", "gory", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "'", "person", "\\u", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Category_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persons_", "=_", "Many", "To", "Many", "_", "(_", "'", "Person", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "'", "person", "\\u", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stu", "pid_", "=_", "Category_", "(_", "name_", "=_", "\"", "Stu", "pid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simp", "son_", "=_", "Category_", "(_", "name_", "=_", "\"", "Simp", "son", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "Category_", "(_", "name_", "=_", "\"", "Old", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gram", "pa_", "=_", "Person_", "(_", "name_", "=_", "\"", "Ab", "e", "\"_", ",_", "categories_", "=_", "[_", "simp", "son_", ",_", "old_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "=_", "Person_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ",_", "categories_", "=_", "[_", "simp", "son_", ",_", "stu", "pid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bart", "_", "=_", "Person_", "(_", "name_", "=_", "\"", "Bar", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lis", "a_", "=_", "Person_", "(_", "name_", "=_", "\"", "Lis", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "simp", "son_", "._", "persons_", "._", "extend_", "(_", "[_", "bart", "_", ",_", "lis", "a_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Category_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Simp", "son", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram", "pa_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Ab", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "c_", "._", "persons_", ")_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "in_", "gram", "pa_", "._", "categories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "m2", "m", "\\u", "self", "ref_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "person", "\\u", "person", "\\u", "table_", "=_", "Table_", "(_", "'", "person", "\\u", "person", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "person", "\\u", "id", "1", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "person", "\\u", "id2", "'_", ",_", "Integer_", ",_", "Fore", "ign", "Key_", "(_", "'", "person", ".", "id", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "reci", "ate_", "=_", "Many", "To", "Many", "_", "(_", "'", "Person", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "'", "person", "\\u", "person", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "colname_", "=_", "'", "person", "\\u", "id", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isa", "ppr", "eci", "ated", "by_", "=_", "Many", "To", "Many", "_", "(_", "'", "Person", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "'", "person", "\\u", "person", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "one", " ", "is", " ", "not", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "colname_", "=_", "'", "person", "\\u", "id2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bar", "ne", "y_", "=_", "Person_", "(_", "name_", "=_", "\"", "Bar", "ne", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "r_", "=_", "Person_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ",_", "app", "reci", "ate_", "=_", "[_", "bar", "ne", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "home", "r_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Home", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "ne", "y_", "=_", "Person_", "._", "get", "\\u", "by_", "(_", "name_", "=_", "\"", "Bar", "ne", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "bar", "ne", "y_", "in_", "home", "r_", "._", "app", "reci", "ate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "home", "r_", "in_", "bar", "ne", "y_", "._", "isa", "ppr", "eci", "ated", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "table", "\\u", "a_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "table_", "=_", "Table_", "(_", "'", "a", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nop", "k_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "Table_", "(_", "'", "a", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "name", "'_", ",_", "String_", "(_", "32_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "A_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usi", "ng", "\\u", "mapper", "\\u", "options_", "(_", "primary", "\\u", "key_", "=_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a1_", "=_", "A_", "(_", "id_", "=_", "1_", ",_", "name_", "=_", "\"", "a1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "exp", "unge", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "A_", "._", "query_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "res_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "res_", "[_", "0_", "]_", "._", "name_", "==_", "\"", "a1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "inherita", "nce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "Table_", "(_", "'", "fat", "her", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "id", "'_", ",_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Column_", "(_", "'", "row", "\\u", "type", "'_", ",_", "eli", "xi", "r_", "._", "options_", "._", "POLY", "MOR", "PHI", "C", "\\u", "COL", "\\u", "TYPE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Fat", "her_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Son", "_", "(_", "Fat", "her_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auto", "load_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "autoload", "\\u", "mixed", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mixed", " ", "autoload", "ed", " ", "entity", " ", "with", " ", "a", " ", "non", " ", "autoload", "ed", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "metadata_", "._", "bind_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "user", " ", "(\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\\u", "id", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", " ", "AUTO", "INCREMENT", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usi", "ng", "\\u", "options_", "(_", "tablename_", "=_", "'", "user", "'_", ",_", "autoload", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Item_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usi", "ng", "\\u", "options_", "(_", "autoload", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "Many", "To", "One_", "(_", "'", "User", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "all_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "colname_", "=_", "Item_", "._", "table_", "._", "c_", "[_", "'", "owner", "\\u", "user", "\\u", "id", "'_", "]_", "._", "foreign", "\\u", "keys_", "[_", "0_", "]_", "._", "column_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "colname_", "==_", "'", "user", "\\u", "id", "'_" ]
[ 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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 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
rcbops/opencenter/opencenter/backends/chef-client/__init__.py
[ { "content": " def converge_chef(self, state_data, api,\n node_id, **kwargs): # pragma: no cover\n def safe_get_fact(node, fact):\n if not fact in node['facts']:\n return None\n\n return node['facts'][fact]\n\n def verify_facts(node, facts):\n for fact in facts:\n if not fact in node['facts']:\n return False\n\n return True\n\n # we are converging a node. If the node is a container,\n # that probably implies converging all nodes under it.\n self.logger.info('Converging node %s via chef-client backend' % (\n node_id,))\n\n node = api._model_get_by_id('nodes', node_id)\n api.apply_expression(node_id, 'attrs.converged := false')\n\n if not 'chef_server_consumed' in node['facts']:\n return self._fail(msg='missing fact: chef_server_consumed')\n\n chef_server_consumed = node['facts']['chef_server_consumed']\n cs = api._model_get_by_id('nodes', chef_server_consumed)\n\n if not cs:\n return self._fail(msg='cannot find consumed chef server')\n\n if not verify_facts(cs, ['chef_server_uri',\n 'chef_server_client_name',\n 'chef_server_client_pem']):\n return self._fail(msg='chef server missing chef attrs')\n\n chef_server_uri = cs['facts']['chef_server_uri']\n chef_server_client_name = cs['facts']['chef_server_client_name']\n chef_server_client_pem = cs['facts']['chef_server_client_pem']\n\n self.logger.debug('Creating connection to chef server')\n\n # make a chef api object\n pem = StringIO.StringIO(chef_server_client_pem)\n rsa_key = chef.rsa.Key(pem)\n\n chef_api = chef.ChefAPI(chef_server_uri,\n rsa_key,\n chef_server_client_name)\n pem.close()\n\n if not 'chef_environment' in node['facts']:\n # this node has been pulled out of a chef environment.\n # this is hateful, but...\n api.apply_expression(node_id, 'facts.backends := '\n 'remove(facts.backends, \"chef-client\")')\n\n if self._node_exists(node['name'], chef_api):\n chef_node = chef.Node(node['name'], chef_api)\n chef_node.delete()\n\n return self._ok()\n\n # generate node and environment settings\n node_attrs, env_attrs = self._represent_node_attributes(api, node_id)\n\n self.logger.debug('node: %s' % node_attrs)\n self.logger.debug('environment: %s' % env_attrs)\n\n nova_role = node['facts']['nova_role']\n chef_environment = node['facts']['chef_environment'].replace(' ', '_')\n\n # create the environment if it does not exist\n env = None\n\n if not self._environment_exists(chef_environment, chef_api):\n self.logger.debug('Creating non-existent environment: %s' %\n chef_environment)\n\n env = chef.Environment.create(chef_environment,\n api=chef_api)\n env.save()\n else:\n env = chef.Environment(chef_environment, chef_api)\n\n if env is None:\n self.logger.error('Cannot find/create chef environment')\n return self._fail()\n\n old_env_overrides = env.override_attributes\n\n self.logger.debug('Old environment overrides: %s' % old_env_overrides)\n\n # Find the node. Sometimes chef takes a while to index; we will retry\n for i in range(3):\n if self._node_exists(node['name'], chef_api):\n break\n else:\n self.logger.info(\"Node '%s' is not registered with chef\"\n \"server. Retrying %s/3)\" % (\n node['name'], i + 1))\n time.sleep(10)\n if i == 3:\n msg = (\"Node '%s' is not registered to chef. \"\n \"Exceeded max retries\" % node['name'])\n self.logger.error(msg)\n return self._fail(msg=msg)\n\n chef_node = chef.Node(node['name'], chef_api)\n old_node_overrides = self._serialize_node_blob(chef_node.normal)\n\n self.logger.debug('Old node overrides: %s' % old_node_overrides)\n\n # we'll always converge node, just to be sure\n need_node_converge = False\n need_env_converge = False\n\n query = '\"adventurator\" in attrs.opencenter_agent_output_modules'\n adventurator = api._model_get_first_by_query('nodes', query)\n if not adventurator:\n self.logger.error('Could not find adventurator')\n return self._fail(msg='could not find adventurator')\n\n # we'll always stomp this stuff..\n\n # if old_node_overrides != node_attrs or \\\n # chef_node.chef_environment != chef_environment or\\\n # chef_node.run_list != self._map_roles(nova_role):\n self.logger.debug('Updating chef node')\n self.logger.debug('Setting environment to %s' % chef_environment)\n chef_node.chef_environment = chef_environment\n chef_node.normal = node_attrs\n old_runlist = chef_node.run_list\n chef_node.run_list = self._map_roles(nova_role)\n chef_node.save()\n\n if old_runlist != chef_node.run_list:\n # roles changed, refresh node and then all other nodes in env\n need_node_converge = True\n\n if old_env_overrides != env_attrs:\n # refresh entire environment in one go\n self.logger.debug('Updating environment')\n need_env_converge = True\n env.override_attributes = env_attrs\n env.save()\n\n if need_node_converge:\n # first run converge on the node in question\n self.logger.debug('chef updating node: %s' % node_id)\n result_b, result_s = self._watch_converge_task(\n api, [node_id])\n if result_b is not True:\n return self._fail(msg='First node pass: %s' % result_s)\n\n nodelist = self._get_nodes_in_env(chef_environment, api)\n if node_id in nodelist:\n nodelist.remove(node_id)\n\n self.logger.debug('chef updating env: %s: nodes %s' %\n (chef_environment, nodelist))\n result_b, result_s = self._watch_converge_task(\n api, nodelist)\n if result_b is not True:\n return self._fail(msg='First env pass: %s' % result_s)\n\n if need_env_converge:\n # converge ALL of the nodes\n nodelist = self._get_nodes_in_env(chef_environment, api)\n self.logger.debug('chef updating nodes: %s' % nodelist)\n\n result_b, result_s = self._watch_converge_task(\n api, nodelist)\n if result_b is not True:\n return self._fail(msg='First env pass: %s' % result_s)\n\n return self._ok()", "metadata": "root.ChefClientBackend.converge_chef", "header": "['class', 'ChefClientBackend', '(', 'opencenter', '.', 'backends', '.', 'Backend', ')', ':', '___EOS___']", "index": 221 } ]
[ { "span": "safe_get_fact(", "start_line": 223, "start_column": 12, "end_line": 223, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Che", "f", "Client", "Backend_", "(_", "openc", "enter_", "._", "backends_", "._", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "converg", "e\\u", "chef", "_", "(_", "self_", ",_", "state", "\\u", "data_", ",_", "api_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "safe", "\\u", "get", "\\u", "fact_", "(_", "node_", ",_", "fact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fact_", "in_", "node_", "[_", "'", "fact", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "[_", "'", "fact", "s", "'_", "]_", "[_", "fact_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "facts_", "(_", "node_", ",_", "facts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fact_", "in_", "facts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fact_", "in_", "node_", "[_", "'", "fact", "s", "'_", "]_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "converg", "ing", " ", "a", " ", "node", ".", " ", " ", "If", " ", "the", " ", "node", " ", "is", " ", "a", " ", "container", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "probab", "ly", " ", "implies", " ", "converg", "ing", " ", "all", " ", "nodes", " ", "under", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "'", "Conve", "rgi", "ng", " ", "node", " ", "%", "s", " ", "via", " ", "chef", "-", "client", " ", "back", "end", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "api_", "._", "\\u", "model", "\\u", "get", "\\u", "by", "\\u", "id_", "(_", "'", "nodes", "'_", ",_", "node", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "appl", "y", "\\u", "expression_", "(_", "node", "\\u", "id_", ",_", "'", "attr", "s", ".", "converged", " ", ":", "=", " ", "fal", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "'", "chef", "\\u", "server", "\\u", "consume", "d", "'_", "in_", "node_", "[_", "'", "fact", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "missi", "ng", " ", "fact", ":", " ", "chef", "\\u", "server", "\\u", "consume", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chef", "\\u", "server", "\\u", "consume", "d_", "=_", "node_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "chef", "\\u", "server", "\\u", "consume", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "=_", "api_", "._", "\\u", "model", "\\u", "get", "\\u", "by", "\\u", "id_", "(_", "'", "nodes", "'_", ",_", "chef", "\\u", "server", "\\u", "consume", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "cs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "cann", "ot", " ", "find", " ", "consume", "d", " ", "chef", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "verify", "\\u", "facts_", "(_", "cs_", ",_", "[_", "'", "chef", "\\u", "server", "\\u", "uri", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "chef", "\\u", "server", "\\u", "client", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "chef", "\\u", "server", "\\u", "client", "\\u", "pe", "m", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "chef", " ", "server", " ", "missi", "ng", " ", "chef", " ", "attr", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chef", "\\u", "server", "\\u", "uri_", "=_", "cs_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "chef", "\\u", "server", "\\u", "uri", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "server", "\\u", "client", "\\u", "name_", "=_", "cs_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "chef", "\\u", "server", "\\u", "client", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "server", "\\u", "client", "\\u", "pem_", "=_", "cs_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "chef", "\\u", "server", "\\u", "client", "\\u", "pe", "m", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Creat", "ing", " ", "connecti", "on", " ", "to", " ", "chef", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "chef", " ", "api", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "pem_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "chef", "\\u", "server", "\\u", "client", "\\u", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsa", "\\u", "key_", "=_", "chef", "_", "._", "rsa", "_", "._", "Key_", "(_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chef", "\\u", "api_", "=_", "chef", "_", "._", "Che", "f", "API_", "(_", "chef", "\\u", "server", "\\u", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsa", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chef", "\\u", "server", "\\u", "client", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pem_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "'", "chef", "\\u", "environ", "ment", "'_", "in_", "node_", "[_", "'", "fact", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "node", " ", "has", " ", "bee", "n", " ", "pull", "ed", " ", "out", " ", "of", " ", "a", " ", "chef", " ", "environ", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "hat", "efu", "l", ",", " ", "but", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api_", "._", "appl", "y", "\\u", "expression_", "(_", "node", "\\u", "id_", ",_", "'", "fact", "s", ".", "back", "ends", " ", ":", "=", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "(", "fact", "s", ".", "back", "ends", ",", " ", "\"", "chef", "-", "client", "\")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "node", "\\u", "exists_", "(_", "node_", "[_", "'", "name", "'_", "]_", ",_", "chef", "\\u", "api_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chef", "\\u", "node_", "=_", "chef", "_", "._", "Node_", "(_", "node_", "[_", "'", "name", "'_", "]_", ",_", "chef", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "node_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "ok_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "node", " ", "and", " ", "environ", "ment", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "\\u", "attrs_", ",_", "env", "\\u", "attrs_", "=_", "self_", "._", "\\u", "represent", "\\u", "node", "\\u", "attributes_", "(_", "api_", ",_", "node", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "node", ":", " ", "%", "s", "'_", "%_", "node", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "environ", "ment", ":", " ", "%", "s", "'_", "%_", "env", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nova", "\\u", "role_", "=_", "node_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "nova", "\\u", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "environment_", "=_", "node_", "[_", "'", "fact", "s", "'_", "]_", "[_", "'", "chef", "\\u", "environ", "ment", "'_", "]_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "environ", "ment", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "environ", "ment", "\\u", "exists_", "(_", "chef", "\\u", "environment_", ",_", "chef", "\\u", "api_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Creat", "ing", " ", "non", "-", "existen", "t", " ", "environ", "ment", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "chef", "\\u", "environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "chef", "_", "._", "Environment_", "._", "create_", "(_", "chef", "\\u", "environment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api_", "=_", "chef", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "chef", "_", "._", "Environment_", "(_", "chef", "\\u", "environment_", ",_", "chef", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "find", "/", "create", " ", "chef", " ", "environ", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "env", "\\u", "overrides_", "=_", "env_", "._", "override", "\\u", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Old", " ", "environ", "ment", " ", "override", "s", ":", " ", "%", "s", "'_", "%_", "old", "\\u", "env", "\\u", "overrides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "node", ".", " ", " ", "Some", "times", " ", "chef", " ", "take", "s", " ", "a", " ", "whi", "le", " ", "to", " ", "index", ";", " ", "we", " ", "will", " ", "retry_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "node", "\\u", "exists_", "(_", "node_", "[_", "'", "name", "'_", "]_", ",_", "chef", "\\u", "api_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\"", "Node", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "register", "ed", " ", "with", " ", "chef", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "server", ".", " ", " ", "Retr", "ying", " ", "%", "s", "/", "3", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "[_", "'", "name", "'_", "]_", ",_", "i_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "\"", "Node", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "register", "ed", " ", "to", " ", "chef", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Exce", "eded", " ", "max", " ", "retrie", "s", "\"_", "%_", "node_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chef", "\\u", "node_", "=_", "chef", "_", "._", "Node_", "(_", "node_", "[_", "'", "name", "'_", "]_", ",_", "chef", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "node", "\\u", "overrides_", "=_", "self_", "._", "\\u", "serialize", "\\u", "node", "\\u", "blob_", "(_", "chef", "\\u", "node_", "._", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Old", " ", "node", " ", "override", "s", ":", " ", "%", "s", "'_", "%_", "old", "\\u", "node", "\\u", "overrides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "ll", " ", "alw", "ay", "s", " ", "converg", "e", " ", "node", ",", " ", "just", " ", "to", " ", "be", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "node", "\\u", "converg", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "env", "\\u", "converg", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "'\"", "adve", "ntu", "rator", "\"", " ", "in", " ", "attr", "s", ".", "openc", "enter", "\\u", "agent", "\\u", "output", "\\u", "module", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adve", "ntu", "rator", "_", "=_", "api_", "._", "\\u", "model", "\\u", "get", "\\u", "first", "\\u", "by", "\\u", "query_", "(_", "'", "nodes", "'_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "adve", "ntu", "rator", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "adve", "ntu", "rator", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "coul", "d", " ", "not", " ", "find", " ", "adve", "ntu", "rator", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "ll", " ", "alw", "ay", "s", " ", "sto", "mp", " ", "this", " ", "stu", "ff", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "old", "\\u", "node", "\\u", "override", "s", " ", "!=", " ", "node", "\\u", "attr", "s", " ", "or", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "chef", "\\u", "node", ".", "chef", "\\u", "environ", "ment", " ", "!=", " ", "chef", "\\u", "environ", "ment", " ", "or", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "chef", "\\u", "node", ".", "run", "\\u", "list", " ", "!=", " ", "self", ".\\u", "map", "\\u", "role", "s", "(", "nova", "\\u", "role", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Up", "dati", "ng", " ", "chef", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Sett", "ing", " ", "environ", "ment", " ", "to", " ", "%", "s", "'_", "%_", "chef", "\\u", "environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "node_", "._", "chef", "\\u", "environment_", "=_", "chef", "\\u", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "node_", "._", "normal_", "=_", "node", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "run", "list_", "=_", "chef", "\\u", "node_", "._", "run", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "node_", "._", "run", "\\u", "list_", "=_", "self_", "._", "\\u", "map", "\\u", "roles_", "(_", "nova", "\\u", "role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chef", "\\u", "node_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "old", "\\u", "run", "list_", "!=_", "chef", "\\u", "node_", "._", "run", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "role", "s", " ", "change", "d", ",", " ", "refre", "sh", " ", "node", " ", "and", " ", "then", " ", "all", " ", "other", " ", "nodes", " ", "in", " ", "env_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "\\u", "node", "\\u", "converg", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "\\u", "env", "\\u", "overrides_", "!=_", "env", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refre", "sh", " ", "entire", " ", "environ", "ment", " ", "in", " ", "one", " ", "go_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Up", "dati", "ng", " ", "environ", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "env", "\\u", "converg", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "override", "\\u", "attributes_", "=_", "env", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "need", "\\u", "node", "\\u", "converg", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "run", " ", "converg", "e", " ", "on", " ", "the", " ", "node", " ", "in", " ", "question_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "chef", " ", "updat", "ing", " ", "node", ":", " ", "%", "s", "'_", "%_", "node", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "b_", ",_", "result", "\\u", "s_", "=_", "self_", "._", "\\u", "watch", "\\u", "converg", "e\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "api_", ",_", "[_", "node", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "b_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "Fi", "rst", " ", "node", " ", "pass", ":", " ", "%", "s", "'_", "%_", "result", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodelist_", "=_", "self_", "._", "\\u", "get", "\\u", "nodes", "\\u", "in", "\\u", "env_", "(_", "chef", "\\u", "environment_", ",_", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node", "\\u", "id_", "in_", "nodelist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodelist_", "._", "remove_", "(_", "node", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "chef", " ", "updat", "ing", " ", "env", ":", " ", "%", "s", ":", " ", "nodes", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "chef", "\\u", "environment_", ",_", "nodelist_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "b_", ",_", "result", "\\u", "s_", "=_", "self_", "._", "\\u", "watch", "\\u", "converg", "e\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "api_", ",_", "nodelist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "b_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "Fi", "rst", " ", "env", " ", "pass", ":", " ", "%", "s", "'_", "%_", "result", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "need", "\\u", "env", "\\u", "converg", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "converg", "e", " ", "ALL", " ", "of", " ", "the", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodelist_", "=_", "self_", "._", "\\u", "get", "\\u", "nodes", "\\u", "in", "\\u", "env_", "(_", "chef", "\\u", "environment_", ",_", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "chef", " ", "updat", "ing", " ", "nodes", ":", " ", "%", "s", "'_", "%_", "nodelist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "b_", ",_", "result", "\\u", "s_", "=_", "self_", "._", "\\u", "watch", "\\u", "converg", "e\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "api_", ",_", "nodelist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "b_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fail_", "(_", "msg_", "=_", "'", "Fi", "rst", " ", "env", " ", "pass", ":", " ", "%", "s", "'_", "%_", "result", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "ok_", "(_", ")_", "\\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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
IanLewis/kay/kay/management/gae_bulkloader.py
[ { "content": "def _PerformBulkload(arg_dict,\n check_file=CheckFile,\n check_output_file=CheckOutputFile):\n \"\"\"Runs the bulkloader, given the command line options.\n\n Args:\n arg_dict: Dictionary of bulkloader options.\n check_file: Used for dependency injection.\n check_output_file: Used for dependency injection.\n\n Returns:\n An exit code.\n\n Raises:\n ConfigurationError: if inconsistent options are passed.\n \"\"\"\n app_id = arg_dict['app_id']\n url = arg_dict['url']\n filename = arg_dict['filename']\n batch_size = arg_dict['batch_size']\n kind = arg_dict['kind']\n num_threads = arg_dict['num_threads']\n bandwidth_limit = arg_dict['bandwidth_limit']\n rps_limit = arg_dict['rps_limit']\n http_limit = arg_dict['http_limit']\n db_filename = arg_dict['db_filename']\n config_file = arg_dict['config_file']\n auth_domain = arg_dict['auth_domain']\n has_header = arg_dict['has_header']\n download = arg_dict['download']\n result_db_filename = arg_dict['result_db_filename']\n loader_opts = arg_dict['loader_opts']\n exporter_opts = arg_dict['exporter_opts']\n mapper_opts = arg_dict['mapper_opts']\n email = arg_dict['email']\n passin = arg_dict['passin']\n perform_map = arg_dict['map']\n dump = arg_dict['dump']\n restore = arg_dict['restore']\n\n os.environ['AUTH_DOMAIN'] = auth_domain\n\n kind = ParseKind(kind)\n\n if not dump and not restore:\n check_file(config_file)\n\n if download and perform_map:\n logger.error('--download and --map are mutually exclusive.')\n\n if download or dump:\n check_output_file(filename)\n elif not perform_map:\n check_file(filename)\n\n if dump:\n Exporter.RegisterExporter(DumpExporter(kind, result_db_filename))\n elif restore:\n Loader.RegisterLoader(RestoreLoader(kind, app_id))\n else:\n LoadConfig(config_file)\n\n os.environ['APPLICATION_ID'] = app_id\n\n throttle_layout = ThrottleLayout(bandwidth_limit, http_limit, rps_limit)\n logger.info('Throttling transfers:')\n logger.info('Bandwidth: %s bytes/second', bandwidth_limit)\n logger.info('HTTP connections: %s/second', http_limit)\n logger.info('Entities inserted/fetched/modified: %s/second', rps_limit)\n\n throttle = remote_api_throttle.Throttle(layout=throttle_layout)\n signature = _MakeSignature(app_id=app_id,\n url=url,\n kind=kind,\n db_filename=db_filename,\n download=download,\n perform_map=perform_map,\n has_header=has_header,\n result_db_filename=result_db_filename,\n dump=dump,\n restore=restore)\n\n\n max_queue_size = max(DEFAULT_QUEUE_SIZE, 3 * num_threads + 5)\n\n if db_filename == 'skip':\n progress_db = StubProgressDatabase()\n elif not download and not perform_map and not dump:\n progress_db = ProgressDatabase(db_filename, signature)\n else:\n progress_db = ExportProgressDatabase(db_filename, signature)\n\n return_code = 1\n\n if not download and not perform_map and not dump:\n loader = Loader.RegisteredLoader(kind)\n try:\n loader.initialize(filename, loader_opts)\n workitem_generator_factory = GetCSVGeneratorFactory(\n kind, filename, batch_size, has_header)\n\n app = BulkUploaderApp(arg_dict,\n workitem_generator_factory,\n throttle,\n progress_db,\n ProgressTrackerThread,\n max_queue_size,\n RequestManager,\n DataSourceThread,\n Queue.Queue)\n try:\n return_code = app.Run()\n except AuthenticationError:\n logger.info('Authentication Failed')\n finally:\n loader.finalize()\n elif not perform_map:\n result_db = ResultDatabase(result_db_filename, signature)\n exporter = Exporter.RegisteredExporter(kind)\n try:\n exporter.initialize(filename, exporter_opts)\n\n def KeyRangeGeneratorFactory(request_manager, progress_queue,\n progress_gen):\n return KeyRangeItemGenerator(request_manager, kind, progress_queue,\n progress_gen, DownloadItem)\n\n def ExportProgressThreadFactory(progress_queue, progress_db):\n return ExportProgressThread(kind,\n progress_queue,\n progress_db,\n result_db)\n\n app = BulkDownloaderApp(arg_dict,\n KeyRangeGeneratorFactory,\n throttle,\n progress_db,\n ExportProgressThreadFactory,\n 0,\n RequestManager,\n DataSourceThread,\n Queue.Queue)\n try:\n return_code = app.Run()\n except AuthenticationError:\n logger.info('Authentication Failed')\n finally:\n exporter.finalize()\n elif not download:\n mapper = Mapper.RegisteredMapper(kind)\n try:\n mapper.initialize(mapper_opts)\n def KeyRangeGeneratorFactory(request_manager, progress_queue,\n progress_gen):\n return KeyRangeItemGenerator(request_manager, kind, progress_queue,\n progress_gen, MapperItem)\n\n def MapperProgressThreadFactory(progress_queue, progress_db):\n return MapperProgressThread(kind,\n progress_queue,\n progress_db)\n\n app = BulkMapperApp(arg_dict,\n KeyRangeGeneratorFactory,\n throttle,\n progress_db,\n MapperProgressThreadFactory,\n 0,\n RequestManager,\n DataSourceThread,\n Queue.Queue)\n try:\n return_code = app.Run()\n except AuthenticationError:\n logger.info('Authentication Failed')\n finally:\n mapper.finalize()\n return return_code", "metadata": "root._PerformBulkload", "header": "['module', '___EOS___']", "index": 3587 } ]
[ { "span": "email ", "start_line": 3621, "start_column": 2, "end_line": 3621, "end_column": 7 }, { "span": "passin ", "start_line": 3622, "start_column": 2, "end_line": 3622, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Perform", "Bul", "kl", "oad", "_", "(_", "arg", "\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "file_", "=_", "Check", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "output", "\\u", "file_", "=_", "Check", "Output", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", "s", " ", "the", " ", "bul", "kl", "oad", "er", ",", " ", "give", "n", " ", "the", " ", "command", " ", "line", " ", "options", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "arg", "\\u", "dict", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "bul", "kl", "oad", "er", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "check", "\\u", "file", ":", " ", "Us", "ed", " ", "for", " ", "dependen", "cy", " ", "injection", ".", "\\", "10", ";", " ", " ", " ", " ", "check", "\\u", "output", "\\u", "file", ":", " ", "Us", "ed", " ", "for", " ", "dependen", "cy", " ", "injection", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "exit", " ", "code", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Configura", "tion", "Error", ":", " ", "if", " ", "inconsistent", " ", "options", " ", "are", " ", "pass", "ed", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "id_", "=_", "arg", "\\u", "dict_", "[_", "'", "app", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "arg", "\\u", "dict_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "arg", "\\u", "dict_", "[_", "'", "filename", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "size_", "=_", "arg", "\\u", "dict_", "[_", "'", "batch", "\\u", "size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind_", "=_", "arg", "\\u", "dict_", "[_", "'", "kind", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "threads_", "=_", "arg", "\\u", "dict_", "[_", "'", "num", "\\u", "thread", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bandwi", "dth", "\\u", "limit_", "=_", "arg", "\\u", "dict_", "[_", "'", "bandwi", "dth", "\\u", "limit", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rps", "\\u", "limit_", "=_", "arg", "\\u", "dict_", "[_", "'", "rps", "\\u", "limit", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "\\u", "limit_", "=_", "arg", "\\u", "dict_", "[_", "'", "http", "\\u", "limit", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "filename_", "=_", "arg", "\\u", "dict_", "[_", "'", "db", "\\u", "filename", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "file_", "=_", "arg", "\\u", "dict_", "[_", "'", "config", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "domain_", "=_", "arg", "\\u", "dict_", "[_", "'", "auth", "\\u", "domain", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "header_", "=_", "arg", "\\u", "dict_", "[_", "'", "has", "\\u", "header", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "download_", "=_", "arg", "\\u", "dict_", "[_", "'", "download", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "db", "\\u", "filename_", "=_", "arg", "\\u", "dict_", "[_", "'", "result", "\\u", "db", "\\u", "filename", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "er", "\\u", "opts_", "=_", "arg", "\\u", "dict_", "[_", "'", "load", "er", "\\u", "opts", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter", "\\u", "opts_", "=_", "arg", "\\u", "dict_", "[_", "'", "exporter", "\\u", "opts", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "opts_", "=_", "arg", "\\u", "dict_", "[_", "'", "mapper", "\\u", "opts", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "arg", "\\u", "dict_", "[_", "'", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passi", "n_", "=_", "arg", "\\u", "dict_", "[_", "'", "passi", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perform", "\\u", "map_", "=_", "arg", "\\u", "dict_", "[_", "'", "map", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump_", "=_", "arg", "\\u", "dict_", "[_", "'", "dump", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore_", "=_", "arg", "\\u", "dict_", "[_", "'", "restore", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "AUTH", "\\u", "DOM", "AIN", "'_", "]_", "=_", "auth", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "Pars", "e", "Kind_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "dump_", "and_", "not_", "restore_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "file_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "download_", "and_", "perform", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'--", "download", " ", "and", " ", "--", "map", " ", "are", " ", "mutual", "ly", " ", "exclu", "sive", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "download_", "or_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "output", "\\u", "file_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "perform", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "file_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Exporter_", "._", "Register", "Exporter_", "(_", "Dump", "Exporter_", "(_", "kind_", ",_", "result", "\\u", "db", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "restore_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Loader_", "._", "Register", "Loader_", "(_", "Restor", "e", "Loader_", "(_", "kind_", ",_", "app", "\\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 ", " _", "Load", "Config_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "APPLICATION", "\\u", "ID", "'_", "]_", "=_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "throttle", "\\u", "layout_", "=_", "Throttle", "Layout_", "(_", "bandwi", "dth", "\\u", "limit_", ",_", "http", "\\u", "limit_", ",_", "rps", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Thr", "ott", "ling", " ", "transfers", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Band", "widt", "h", ":", " ", "%", "s", " ", "bytes", "/", "second", "'_", ",_", "bandwi", "dth", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "HTTP", " ", "connections", ":", " ", "%", "s", "/", "second", "'_", ",_", "http", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Entit", "ies", " ", "inserted", "/", "fetched", "/", "modifi", "ed", ":", " ", "%", "s", "/", "second", "'_", ",_", "rps", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "throttle_", "=_", "remote", "\\u", "api", "\\u", "throttle_", "._", "Throttle", "_", "(_", "layout_", "=_", "throttle", "\\u", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signature_", "=_", "\\u", "Make", "Signature_", "(_", "app", "\\u", "id_", "=_", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "filename_", "=_", "db", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download_", "=_", "download_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "perform", "\\u", "map_", "=_", "perform", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "header_", "=_", "has", "\\u", "header_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "db", "\\u", "filename_", "=_", "result", "\\u", "db", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dump_", "=_", "dump_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "restore_", "=_", "restore_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "queue", "\\u", "size_", "=_", "max_", "(_", "DEF", "AUL", "T", "\\u", "QUEUE", "\\u", "SIZE_", ",_", "3_", "*_", "num", "\\u", "threads_", "+_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "db", "\\u", "filename_", "==_", "'", "skip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "progress", "\\u", "db_", "=_", "Stu", "b", "Progres", "s", "Database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "download_", "and_", "not_", "perform", "\\u", "map_", "and_", "not_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "progress", "\\u", "db_", "=_", "Progres", "s", "Database_", "(_", "db", "\\u", "filename_", ",_", "signature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "progress", "\\u", "db_", "=_", "Export", "Progres", "s", "Database_", "(_", "db", "\\u", "filename_", ",_", "signature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "code_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "download_", "and_", "not_", "perform", "\\u", "map_", "and_", "not_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "Loader_", "._", "Register", "ed", "Loader_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "._", "initialize_", "(_", "filename_", ",_", "load", "er", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "work", "item", "\\u", "generat", "or", "\\u", "factory_", "=_", "Get", "CSV", "Generat", "or", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", ",_", "filename_", ",_", "batch", "\\u", "size_", ",_", "has", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Bul", "k", "Upload", "er", "App_", "(_", "arg", "\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "work", "item", "\\u", "generat", "or", "\\u", "factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "throttle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Progres", "s", "Track", "er", "Thread_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "queue", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Data", "Sou", "rce", "Thread_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Queue_", "._", "Queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "code_", "=_", "app_", "._", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Auth", "entica", "tion", " ", "Fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "perform", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "db_", "=_", "Result", "Database_", "(_", "result", "\\u", "db", "\\u", "filename_", ",_", "signature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter_", "=_", "Exporter_", "._", "Register", "ed", "Exporter_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "._", "initialize_", "(_", "filename_", ",_", "exporter", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Key", "Range", "Generat", "or", "Factory_", "(_", "request", "\\u", "manager_", ",_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Key", "Range", "Item", "Generator_", "(_", "request", "\\u", "manager_", ",_", "kind_", ",_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "gen_", ",_", "Down", "load", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Export", "Progres", "s", "Thread", "Factory_", "(_", "progress", "\\u", "queue_", ",_", "progress", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Export", "Progres", "s", "Thread_", "(_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "=_", "Bul", "k", "Downloade", "r", "App_", "(_", "arg", "\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Key", "Range", "Generat", "or", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "throttle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Export", "Progres", "s", "Thread", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Data", "Sou", "rce", "Thread_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Queue_", "._", "Queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "code_", "=_", "app_", "._", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Auth", "entica", "tion", " ", "Fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "download_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapper_", "=_", "Mapper_", "._", "Register", "ed", "Mapper_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapper_", "._", "initialize_", "(_", "mapper", "\\u", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Key", "Range", "Generat", "or", "Factory_", "(_", "request", "\\u", "manager_", ",_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Key", "Range", "Item", "Generator_", "(_", "request", "\\u", "manager_", ",_", "kind_", ",_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "gen_", ",_", "Map", "per", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Map", "per", "Progres", "s", "Thread", "Factory_", "(_", "progress", "\\u", "queue_", ",_", "progress", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Map", "per", "Progres", "s", "Thread_", "(_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "=_", "Bul", "k", "Map", "per", "App_", "(_", "arg", "\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Key", "Range", "Generat", "or", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "throttle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "progress", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Map", "per", "Progres", "s", "Thread", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Data", "Sou", "rce", "Thread_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Queue_", "._", "Queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "code_", "=_", "app_", "._", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Auth", "entica", "tion", " ", "Fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapper_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "return", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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py
[ { "content": " def test_range_tz_dateutil(self):\n # GH 2906\n tm._skip_if_no_dateutil()\n # Use maybe_get_tz to fix filename in tz under dateutil.\n from pandas.tslib import maybe_get_tz\n tz = lambda x: maybe_get_tz('dateutil/' + x)\n\n start = datetime(2011, 1, 1, tzinfo=tz('US/Eastern'))\n end = datetime(2011, 1, 3, tzinfo=tz('US/Eastern'))\n\n dr = date_range(start=start, periods=3)\n self.assertTrue(dr.tz == tz('US/Eastern'))\n self.assertTrue(dr[0] == start)\n self.assertTrue(dr[2] == end)\n\n dr = date_range(end=end, periods=3)\n self.assertTrue(dr.tz == tz('US/Eastern'))\n self.assertTrue(dr[0] == start)\n self.assertTrue(dr[2] == end)\n\n dr = date_range(start=start, end=end)\n self.assertTrue(dr.tz == tz('US/Eastern'))\n self.assertTrue(dr[0] == start)\n self.assertTrue(dr[2] == end)", "metadata": "root.TestDateRange.test_range_tz_dateutil", "header": "['class', 'TestDateRange', '(', 'tm', '.', 'TestCase', ')', ':', '___EOS___']", "index": 418 } ]
[ { "span": "self.assertTrue(dr.tz == tz('US/Eastern'))", "start_line": 429, "start_column": 8, "end_line": 429, "end_column": 50 }, { "span": "self.assertTrue(dr[0] == start)", "start_line": 430, "start_column": 8, "end_line": 430, "end_column": 39 }, { "span": "self.assertTrue(dr[2] == end)", "start_line": 431, "start_column": 8, "end_line": 431, "end_column": 37 }, { "span": "self.assertTrue(dr.tz == tz('US/Eastern'))", "start_line": 434, "start_column": 8, "end_line": 434, "end_column": 50 }, { "span": "self.assertTrue(dr[0] == start)", "start_line": 435, "start_column": 8, "end_line": 435, "end_column": 39 }, { "span": "self.assertTrue(dr[2] == end)", "start_line": 436, "start_column": 8, "end_line": 436, "end_column": 37 }, { "span": "self.assertTrue(dr.tz == tz('US/Eastern'))", "start_line": 439, "start_column": 8, "end_line": 439, "end_column": 50 }, { "span": "self.assertTrue(dr[0] == start)", "start_line": 440, "start_column": 8, "end_line": 440, "end_column": 39 }, { "span": "self.assertTrue(dr[2] == end)", "start_line": 441, "start_column": 8, "end_line": 441, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Date", "Range_", "(_", "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_", "def_", "test\\u", "range", "\\u", "tz", "\\u", "dateutil_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "GH", " ", "290", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tm_", "._", "\\u", "skip", "\\u", "if", "\\u", "no", "\\u", "dateutil_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "may", "be", "\\u", "get", "\\u", "tz", " ", "to", " ", "fix", " ", "filename", " ", "in", " ", "tz", " ", "under", " ", "date", "util", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pandas_", "._", "ts", "lib_", "import_", "may", "be", "\\u", "get", "\\u", "tz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tz_", "=_", "lambda_", "x_", ":_", "may", "be", "\\u", "get", "\\u", "tz_", "(_", "'", "date", "util", "/'_", "+_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "datetime_", "(_", "2011_", ",_", "1_", ",_", "1_", ",_", "tzinfo_", "=_", "tz_", "(_", "'", "US", "/", "Eas", "tern", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "datetime_", "(_", "2011_", ",_", "1_", ",_", "3_", ",_", "tzinfo_", "=_", "tz_", "(_", "'", "US", "/", "Eas", "tern", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dr_", "=_", "date", "\\u", "range_", "(_", "start_", "=_", "start_", ",_", "periods_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "._", "tz_", "==_", "tz_", "(_", "'", "US", "/", "Eas", "tern", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "0_", "]_", "==_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "2_", "]_", "==_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dr_", "=_", "date", "\\u", "range_", "(_", "end_", "=_", "end_", ",_", "periods_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "._", "tz_", "==_", "tz_", "(_", "'", "US", "/", "Eas", "tern", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "0_", "]_", "==_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "2_", "]_", "==_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dr_", "=_", "date", "\\u", "range_", "(_", "start_", "=_", "start_", ",_", "end_", "=_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "._", "tz_", "==_", "tz_", "(_", "'", "US", "/", "Eas", "tern", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "0_", "]_", "==_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dr_", "[_", "2_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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
enthought/envisage/envisage/ui/tasks/tasks_application.py
[ { "content": " def _load_state(self):\n \"\"\" Loads saved application state, if possible.\n \"\"\"\n state = TasksApplicationState()\n filename = os.path.join(self.state_location, 'application_memento')\n if os.path.exists(filename):\n # Attempt to unpickle the saved application state.\n try:\n with open(filename, 'r') as f:\n restored_state = pickle.load(f)\n if state.version == restored_state.version:\n state = restored_state\n else:\n logger.warn('Discarding outdated application layout')\n except:\n # If anything goes wrong, log the error and continue.\n logger.exception('Restoring application layout from %s',\n filename)\n self._state = state", "metadata": "root.TasksApplication._load_state", "header": "['class', 'TasksApplication', '(', 'Application', ')', ':', '___EOS___']", "index": 309 }, { "content": " def _save_state(self):\n \"\"\" Saves the application state.\n \"\"\"\n # Grab the current window layouts.\n window_layouts = [ w.get_window_layout() for w in self.windows ]\n self._state.previous_window_layouts = window_layouts\n\n # Attempt to pickle the application state.\n filename = os.path.join(self.state_location, 'application_memento')\n try:\n with open(filename, 'w') as f:\n pickle.dump(self._state, f)\n except:\n # If anything goes wrong, log the error and continue.\n logger.exception('Saving application layout')", "metadata": "root.TasksApplication._save_state", "header": "['class', 'TasksApplication', '(', 'Application', ')', ':', '___EOS___']", "index": 351 } ]
[ { "span": "except:", "start_line": 323, "start_column": 12, "end_line": 323, "end_column": 19 }, { "span": "except:", "start_line": 363, "start_column": 8, "end_line": 363, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Task", "s", "Application_", "(_", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Load", "s", " ", "saved", " ", "applica", "tion", " ", "state", ",", " ", "if", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "Task", "s", "Applica", "tion", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "state", "\\u", "location_", ",_", "'", "applica", "tion", "\\u", "meme", "nto", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "unpickle", " ", "the", " ", "saved", " ", "applica", "tion", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "restore", "d\\u", "state_", "=_", "pickle_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "._", "version_", "==_", "restore", "d\\u", "state_", "._", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "state_", "=_", "restore", "d\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Discard", "ing", " ", "outdate", "d", " ", "applica", "tion", " ", "layout", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "anyt", "hing", " ", "go", "es", " ", "wrong", ",", " ", "log", " ", "the", " ", "error", " ", "and", " ", "continue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "Restor", "ing", " ", "applica", "tion", " ", "layout", " ", "from", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "s", "Application_", "(_", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "save", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Save", "s", " ", "the", " ", "applica", "tion", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "current", " ", "window", " ", "layouts", "._", "\\u\\u\\uNL\\u\\u\\u_", "window", "\\u", "layouts", "_", "=_", "[_", "w_", "._", "get", "\\u", "window", "\\u", "layout_", "(_", ")_", "for_", "w_", "in_", "self_", "._", "windows_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "state_", "._", "previ", "ous", "\\u", "window", "\\u", "layouts", "_", "=_", "window", "\\u", "layouts", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "pickle", " ", "the", " ", "applica", "tion", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "state", "\\u", "location_", ",_", "'", "applica", "tion", "\\u", "meme", "nto", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pickle_", "._", "dump_", "(_", "self_", "._", "\\u", "state_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "anyt", "hing", " ", "go", "es", " ", "wrong", ",", " ", "log", " ", "the", " ", "error", " ", "and", " ", "continue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "Sav", "ing", " ", "applica", "tion", " ", "layout", "'_", ")_", "\\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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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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
PyTables/PyTables/bench/LRU-experiments2.py
[ { "content": "# Testbed to perform experiments in order to determine best values for\n# the node numbers in LRU cache. Arrays version.\n\nfrom __future__ import print_function\nfrom time import time\nimport tables\n\nprint(\"PyTables version-->\", tables.__version__)\n\nfilename = \"/tmp/junk-array.h5\"\nNOBJS = 1000\n\n\n\n\n\n\n\nif 1:\n # create_junk()\n # modify_junk_LRU() # uses the iterador version (walk_nodes)\n modify_junk_LRU2() # uses a regular loop (getattr)\nelse:\n import profile\n import pstats\n profile.run('modify_junk_LRU2()', 'modify.prof')\n stats = pstats.Stats('modify.prof')\n stats.strip_dirs()\n stats.sort_stats('time', 'calls')\n stats.print_stats()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import profile", "start_line": 50, "start_column": 4, "end_line": 50, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Test", "bed", " ", "to", " ", "perform", " ", "experiment", "s", " ", "in", " ", "order", " ", "to", " ", "dete", "rmin", "e", " ", "best", " ", "values", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "node", " ", "numbers", " ", "in", " ", "LR", "U", " ", "cache", ".", " ", "Arrays", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Py", "Table", "s", " ", "version", "-->", "\"_", ",_", "tables_", "._", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/", "junk", "-", "array", ".", "h5", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NO", "BJ", "S_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", "\\u", "junk", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modif", "y", "\\u", "junk", "\\u", "LR", "U", "()", " ", " ", " ", " ", "#", " ", "use", "s", " ", "the", " ", "iter", "ador", " ", "version", " ", "(", "walk", "\\u", "nodes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modif", "y", "\\u", "junk", "\\u", "LR", "U2", "_", "(_", ")_", "#", " ", "use", "s", " ", "a", " ", "regular", " ", "loop", " ", "(", "getattr", ")_", "\\u\\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_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pstat", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "run_", "(_", "'", "modif", "y", "\\u", "junk", "\\u", "LR", "U2", "()'_", ",_", "'", "modif", "y", ".", "prof", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "pstat", "s_", "._", "Stats_", "(_", "'", "modif", "y", ".", "prof", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "._", "strip", "\\u", "dirs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "._", "sort", "\\u", "stats_", "(_", "'", "time", "'_", ",_", "'", "calls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "._", "print", "\\u", "stats_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
miusuncle/HiveOpener/opener.py
[ { "content": " def open_file(self, filename, preview=False):\n if preview: return self.window.open_file(filename, sublime.TRANSIENT)\n name, ext = path.splitext(filename)\n\n if self.binfile_open_in_subl or not self.is_binary_file(filename):\n self.open_file_inside_subl(filename)\n else:\n self.open_file_outside_subl(filename)", "metadata": "root.HiveOpenCommand.open_file", "header": "['class', 'HiveOpenCommand', '(', 'sublime_plugin', '.', 'WindowCommand', ')', ':', '___EOS___']", "index": 106 } ]
[ { "span": "name,", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 12 }, { "span": "ext ", "start_line": 108, "start_column": 14, "end_line": 108, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Hi", "ve", "Open", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "file_", "(_", "self_", ",_", "filename_", ",_", "preview_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "preview_", ":_", "return_", "self_", "._", "window_", "._", "open", "\\u", "file_", "(_", "filename_", ",_", "sublime_", "._", "TRANS", "IENT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "ext_", "=_", "path_", "._", "splitext_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "bin", "file", "\\u", "open", "\\u", "in", "\\u", "subl", "_", "or_", "not_", "self_", "._", "is", "\\u", "binar", "y", "\\u", "file_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "open", "\\u", "file", "\\u", "insi", "de", "\\u", "subl", "_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "open", "\\u", "file", "\\u", "outsi", "de", "\\u", "subl", "_", "(_", "filename_", ")_", "\\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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
marcwebbie/passpie/tests/test_importers/test_default_importer.py
[ { "content": "from collections import namedtuple\nimport os\nimport shutil\nimport sys\nimport tempfile\n\nimport yaml\n\nfrom passpie.importers import find_importer, BaseImporter, get_instances\nfrom passpie.importers.default_importer import DefaultImporter\nfrom passpie.importers.pysswords_importer import PysswordsImporter\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mock_open():\n try:\n from mock import mock_open as mopen\n except:\n from unittest.mock import mock_open as mopen\n return mopen()", "metadata": "root.mock_open", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def test_find_importer_returns_first_match_default_importer(mocker):\n mock_importer = mocker.Mock()\n mock_importer2 = mocker.Mock()\n mock_importer.match.return_value = False\n mock_importer2.match.return_value = True\n\n mocker.patch('passpie.importers.get_instances',\n return_value=[mock_importer, mock_importer2])\n\n importer = find_importer('mockpath')\n\n assert importer is mock_importer2", "metadata": "root.test_find_importer_returns_first_match_default_importer", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_default_importer_match_passpie_exported_yaml(mocker):\n dict_content = {'handler': 'passpie', 'version': 1.0}\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n return_value=dict_content)\n\n result = DefaultImporter().match('filepath')\n assert result is True", "metadata": "root.test_default_importer_match_passpie_exported_yaml", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def test_default_importer_returns_false_when_bad_file(mocker):\n mockopen = mocker.patch(\n 'passpie.importers.default_importer.open', mock_open(), create=True)()\n mockopen.read.side_effect = OSError\n\n result = DefaultImporter().match('filepath')\n assert result is False", "metadata": "root.test_default_importer_returns_false_when_bad_file", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def test_default_importer_returns_false_when_missing_version_key(mocker):\n dict_content = {'handler': 'passpie'}\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n return_value=dict_content)\n\n result = DefaultImporter().match('filepath')\n assert result is False", "metadata": "root.test_default_importer_returns_false_when_missing_version_key", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def test_default_importer_returns_false_when_missing_handler_key(mocker):\n dict_content = {'version': 1.0}\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n return_value=dict_content)\n\n result = DefaultImporter().match('filepath')\n assert result is False", "metadata": "root.test_default_importer_returns_false_when_missing_handler_key", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def test_default_importer_returns_false_when_version_keys_isnt_float(mocker):\n dict_content = {'version': '1.0'}\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n return_value=dict_content)\n\n result = DefaultImporter().match('filepath')\n assert result is False", "metadata": "root.test_default_importer_returns_false_when_version_keys_isnt_float", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def test_default_importer_returns_loaded_credentials_from_yaml_file(mocker):\n dict_content = {'credentials': {'name': 'foo', 'name': 'bar'}}\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n return_value=dict_content)\n\n result = DefaultImporter().handle('filepath')\n assert result is dict_content.get('credentials')", "metadata": "root.test_default_importer_returns_loaded_credentials_from_yaml_file", "header": "['module', '___EOS___']", "index": 88 }, { "content": "def test_default_importer_match_returns_false_when_bad_yaml(mocker):\n mocker.patch('passpie.importers.default_importer.open',\n mock_open(), create=True)\n mocker.patch('passpie.importers.default_importer.yaml.load',\n side_effect=[yaml.scanner.ScannerError])\n\n result = DefaultImporter().match('filepath')\n assert result is False", "metadata": "root.test_default_importer_match_returns_false_when_bad_yaml", "header": "['module', '___EOS___']", "index": 99 } ]
[ { "span": "from collections import namedtuple", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 34 }, { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "import shutil", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 }, { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import tempfile", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "from passpie.importers import find_importer, BaseImporter, get_instances", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 72 }, { "span": "from passpie.importers.pysswords_importer import PysswordsImporter", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "import_", "find", "\\u", "importer_", ",_", "Base", "Importer_", ",_", "get", "\\u", "instances_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "._", "default", "\\u", "importer_", "import_", "Default", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "._", "pys", "sword", "s", "\\u", "importer_", "import_", "Py", "ssword", "s", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "mock", "\\u", "open_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mock_", "import_", "mock", "\\u", "open_", "as_", "mop", "en_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "unittest_", "._", "mock_", "import_", "mock", "\\u", "open_", "as_", "mop", "en_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mop", "en_", "(_", ")_", "\\u\\u\\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", "find", "\\u", "importer", "\\u", "return", "s", "\\u", "first", "\\u", "match", "\\u", "default", "\\u", "importer_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "importer_", "=_", "mocker_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "importer", "2_", "=_", "mocker_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "importer_", "._", "match_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "importer", "2_", "._", "match_", "._", "return", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "get", "\\u", "instance", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "[_", "mock", "\\u", "importer_", ",_", "mock", "\\u", "importer", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "importer_", "=_", "find", "\\u", "importer_", "(_", "'", "mock", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "importer_", "is_", "mock", "\\u", "importer", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "match", "\\u", "passp", "ie", "\\u", "exported", "\\u", "yaml_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "content_", "=_", "{_", "'", "handler", "'_", ":_", "'", "passp", "ie", "'_", ",_", "'", "version", "'_", ":_", "1.0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "dict", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "whe", "n", "\\u", "bad", "\\u", "file_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "open_", "=_", "mocker_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "open_", "._", "read_", "._", "side", "\\u", "effect_", "=_", "OSE", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "whe", "n", "\\u", "missi", "ng", "\\u", "version", "\\u", "key_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "content_", "=_", "{_", "'", "handler", "'_", ":_", "'", "passp", "ie", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "dict", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "whe", "n", "\\u", "missi", "ng", "\\u", "handler", "\\u", "key_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "content_", "=_", "{_", "'", "version", "'_", ":_", "1.0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "dict", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "whe", "n", "\\u", "version", "\\u", "keys", "\\u", "isn", "t", "\\u", "float_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "content_", "=_", "{_", "'", "version", "'_", ":_", "'", "1.0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "dict", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "return", "s", "\\u", "load", "ed", "\\u", "cred", "ential", "s", "\\u", "from", "\\u", "yaml", "\\u", "file_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "content_", "=_", "{_", "'", "cred", "ential", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "foo", "'_", ",_", "'", "name", "'_", ":_", "'", "bar", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "dict", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Default", "Importer_", "(_", ")_", "._", "handle_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "dict", "\\u", "content_", "._", "get_", "(_", "'", "cred", "ential", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "importer", "\\u", "match", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "whe", "n", "\\u", "bad", "\\u", "yaml_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "open_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "default", "\\u", "importer", ".", "yaml", ".", "load", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effect_", "=_", "[_", "yaml_", "._", "scanner_", "._", "Scann", "er", "Error_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
jansel/opentuner/opentuner/utils/stats.py
[ { "content": " def __init__(self, args):\n self.args = args\n path = args.stats_input\n self.dbs = list()\n for f in os.listdir(path):\n if 'journal' in f:\n continue\n try:\n e, sm = resultsdb.connect('sqlite:///'+os.path.join(path, f))\n self.dbs.append(sm())\n except:\n log.error('failed to load database: %s', \n os.path.join(path, f),\n exc_info=True)", "metadata": "root.StatsMain.__init__", "header": "['class', 'StatsMain', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": " def technique_scores(self, directory, labels, ykey, xkey='#sec', factor=10.0):\n max_duration = None\n min_value = float('inf')\n for label in labels:\n try:\n dr = csv.DictReader(open(os.path.join(directory,label+\"_percentiles.dat\")), delimiter=' ', lineterminator='\\n')\n lastrow = list(dr)[-1]\n max_duration = max(max_duration, float(lastrow[xkey]))\n min_value = min(min_value, float(lastrow[ykey]))\n except:\n log.exception(\"failed computing score\")\n\n scores = list()\n\n for label in labels:\n try:\n dr = csv.DictReader(open(os.path.join(directory,label+\"_percentiles.dat\")), delimiter=' ', lineterminator='\\n')\n score = 0.0\n lastsec = 0.0\n value = float('inf')\n for row in dr:\n duration = float(row[xkey]) - lastsec\n lastsec = float(row[xkey])\n value = float(row[ykey])\n score += duration * (value - min_value)\n score += (factor*max_duration - lastsec) * (value - min_value)\n scores.append((score, label))\n except:\n log.exception(\"failed computing score\")\n\n return sorted(scores)", "metadata": "root.StatsMain.technique_scores", "header": "['class', 'StatsMain', '(', 'object', ')', ':', '___EOS___']", "index": 266 } ]
[ { "span": "except:", "start_line": 116, "start_column": 6, "end_line": 116, "end_column": 13 }, { "span": "except:", "start_line": 275, "start_column": 6, "end_line": 275, "end_column": 13 }, { "span": "except:", "start_line": 293, "start_column": 6, "end_line": 293, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Stat", "s", "Main_", "(_", "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_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "args_", "._", "stats", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbs_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "journal", "'_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", ",_", "sm_", "=_", "results", "db_", "._", "connect_", "(_", "'", "sql", "ite", ":///", "'_", "+_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbs_", "._", "append_", "(_", "sm_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "error_", "(_", "'", "fail", "ed", " ", "to", " ", "load", " ", "databa", "se", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stat", "s", "Main_", "(_", "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_", "technique", "\\u", "scores_", "(_", "self_", ",_", "directory_", ",_", "labels_", ",_", "yk", "ey_", ",_", "xk", "ey_", "=_", "'#", "sec", "'_", ",_", "factor_", "=_", "10.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "duration_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "value_", "=_", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "labels_", ":_", "\\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 ", " _", "dr_", "=_", "csv_", "._", "Dict", "Reader_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "label_", "+_", "\"\\u", "percentile", "s", ".", "dat", "\"_", ")_", ")_", ",_", "delimiter_", "=_", "'", " ", "'_", ",_", "linet", "ermina", "tor_", "=_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastr", "ow_", "=_", "list_", "(_", "dr_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "duration_", "=_", "max_", "(_", "max", "\\u", "duration_", ",_", "float_", "(_", "lastr", "ow_", "[_", "xk", "ey_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "value_", "=_", "min_", "(_", "min", "\\u", "value_", ",_", "float_", "(_", "lastr", "ow_", "[_", "yk", "ey_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "\"", "fail", "ed", " ", "compu", "ting", " ", "score", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scores_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "label_", "in_", "labels_", ":_", "\\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 ", " _", "dr_", "=_", "csv_", "._", "Dict", "Reader_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "label_", "+_", "\"\\u", "percentile", "s", ".", "dat", "\"_", ")_", ")_", ",_", "delimiter_", "=_", "'", " ", "'_", ",_", "linet", "ermina", "tor_", "=_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lasts", "ec_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "dr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "float_", "(_", "row_", "[_", "xk", "ey_", "]_", ")_", "-_", "lasts", "ec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lasts", "ec_", "=_", "float_", "(_", "row_", "[_", "xk", "ey_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "row_", "[_", "yk", "ey_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "+=_", "duration_", "*_", "(_", "value_", "-_", "min", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "score_", "+=_", "(_", "factor_", "*_", "max", "\\u", "duration_", "-_", "lasts", "ec_", ")_", "*_", "(_", "value_", "-_", "min", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "._", "append_", "(_", "(_", "score_", ",_", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "\"", "fail", "ed", " ", "compu", "ting", " ", "score", "\"_", ")_", "\\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_", "sorted_", "(_", "scores_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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"content": "import unittest\nfrom test import test_support\n\nimport posixpath, os\nfrom posixpath import realpath, abspath, join, dirname, basename\n\n# An absolute path to a temporary filename for testing. We can't rely on TESTFN\n# being an absolute path, so we need this.\n\nABSTFN = abspath(test_support.TESTFN)\n\n\n\nif __name__==\"__main__\":\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PosixPathTest(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n if os.name != 'java':\n\n\n\n\n\n\n\n if hasattr(os, \"symlink\"):\n\n\n\n\n\n # Convenience functions for removing temporary files.\n\n", "metadata": "root.PosixPathTest", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def assertIs(self, a, b):\n self.assert_(a is b)", "metadata": "root.PosixPathTest.assertIs", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_normcase(self):\n # Check that normcase() is idempotent\n p = \"FoO/./BaR\"\n p = posixpath.normcase(p)\n self.assertEqual(p, posixpath.normcase(p))\n\n self.assertRaises(TypeError, posixpath.normcase)", "metadata": "root.PosixPathTest.test_normcase", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_join(self):\n self.assertEqual(posixpath.join(\"/foo\", \"bar\", \"/bar\", \"baz\"), \"/bar/baz\")\n self.assertEqual(posixpath.join(\"/foo\", \"bar\", \"baz\"), \"/foo/bar/baz\")\n self.assertEqual(posixpath.join(\"/foo/\", \"bar/\", \"baz/\"), \"/foo/bar/baz/\")\n\n self.assertRaises(TypeError, posixpath.join)", "metadata": "root.PosixPathTest.test_join", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_splitdrive(self):\n self.assertEqual(posixpath.splitdrive(\"/foo/bar\"), (\"\", \"/foo/bar\"))\n\n self.assertRaises(TypeError, posixpath.splitdrive)", "metadata": "root.PosixPathTest.test_splitdrive", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_split(self):\n self.assertEqual(posixpath.split(\"/foo/bar\"), (\"/foo\", \"bar\"))\n self.assertEqual(posixpath.split(\"/\"), (\"/\", \"\"))\n self.assertEqual(posixpath.split(\"foo\"), (\"\", \"foo\"))\n self.assertEqual(posixpath.split(\"////foo\"), (\"////\", \"foo\"))\n self.assertEqual(posixpath.split(\"//foo//bar\"), (\"//foo\", \"bar\"))\n\n self.assertRaises(TypeError, posixpath.split)", "metadata": "root.PosixPathTest.test_split", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test_splitext(self):\n self.assertEqual(posixpath.splitext(\"foo.ext\"), (\"foo\", \".ext\"))\n self.assertEqual(posixpath.splitext(\"/foo/foo.ext\"), (\"/foo/foo\", \".ext\"))\n self.assertEqual(posixpath.splitext(\".ext\"), (\"\", \".ext\"))\n self.assertEqual(posixpath.splitext(\"/foo.ext/foo\"), (\"/foo.ext/foo\", \"\"))\n self.assertEqual(posixpath.splitext(\"foo.ext/\"), (\"foo.ext/\", \"\"))\n self.assertEqual(posixpath.splitext(\"\"), (\"\", \"\"))\n self.assertEqual(posixpath.splitext(\"foo.bar.ext\"), (\"foo.bar\", \".ext\"))\n\n self.assertRaises(TypeError, posixpath.splitext)", "metadata": "root.PosixPathTest.test_splitext", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_isabs(self):\n self.assertIs(posixpath.isabs(\"\"), False)\n self.assertIs(posixpath.isabs(\"/\"), True)\n self.assertIs(posixpath.isabs(\"/foo\"), True)\n self.assertIs(posixpath.isabs(\"/foo/bar\"), True)\n self.assertIs(posixpath.isabs(\"foo/bar\"), False)\n\n self.assertRaises(TypeError, posixpath.isabs)", "metadata": "root.PosixPathTest.test_isabs", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_splitdrive(self):\n self.assertEqual(posixpath.splitdrive(\"/foo/bar\"), (\"\", \"/foo/bar\"))\n\n self.assertRaises(TypeError, posixpath.splitdrive)", "metadata": "root.PosixPathTest.test_splitdrive", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 65 }, { "content": " def test_basename(self):\n self.assertEqual(posixpath.basename(\"/foo/bar\"), \"bar\")\n self.assertEqual(posixpath.basename(\"/\"), \"\")\n self.assertEqual(posixpath.basename(\"foo\"), \"foo\")\n self.assertEqual(posixpath.basename(\"////foo\"), \"foo\")\n self.assertEqual(posixpath.basename(\"//foo//bar\"), \"bar\")\n\n self.assertRaises(TypeError, posixpath.basename)", "metadata": "root.PosixPathTest.test_basename", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_dirname(self):\n self.assertEqual(posixpath.dirname(\"/foo/bar\"), \"/foo\")\n self.assertEqual(posixpath.dirname(\"/\"), \"/\")\n self.assertEqual(posixpath.dirname(\"foo\"), \"\")\n self.assertEqual(posixpath.dirname(\"////foo\"), \"////\")\n self.assertEqual(posixpath.dirname(\"//foo//bar\"), \"//foo\")\n\n self.assertRaises(TypeError, posixpath.dirname)", "metadata": "root.PosixPathTest.test_dirname", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_commonprefix(self):\n self.assertEqual(\n posixpath.commonprefix([]),\n \"\"\n )\n self.assertEqual(\n posixpath.commonprefix([\"/home/swenson/spam\", \"/home/swen/spam\"]),\n \"/home/swen\"\n )\n self.assertEqual(\n posixpath.commonprefix([\"/home/swen/spam\", \"/home/swen/eggs\"]),\n \"/home/swen/\"\n )\n self.assertEqual(\n posixpath.commonprefix([\"/home/swen/spam\", \"/home/swen/spam\"]),\n \"/home/swen/spam\"\n )", "metadata": "root.PosixPathTest.test_commonprefix", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def test_getsize(self):\n f = open(test_support.TESTFN, \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertEqual(posixpath.getsize(test_support.TESTFN), 3)\n finally:\n if not f.closed:\n f.close()\n os.remove(test_support.TESTFN)", "metadata": "root.PosixPathTest.test_getsize", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_time(self):\n f = open(test_support.TESTFN, \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n f = open(test_support.TESTFN, \"ab\")\n f.write(\"bar\")\n f.close()\n f = open(test_support.TESTFN, \"rb\")\n d = f.read()\n f.close()\n self.assertEqual(d, \"foobar\")\n\n self.assert_(\n posixpath.getctime(test_support.TESTFN) <=\n posixpath.getmtime(test_support.TESTFN)\n )\n finally:\n if not f.closed:\n f.close()\n os.remove(test_support.TESTFN)", "metadata": "root.PosixPathTest.test_time", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 }, { "content": " @unittest.skip(\"FIXME: broken\")\n def test_islink(self):\n self.assertIs(posixpath.islink(test_support.TESTFN + \"1\"), False)\n f = open(test_support.TESTFN + \"1\", \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(posixpath.islink(test_support.TESTFN + \"1\"), False)\n if hasattr(os, \"symlink\"):\n os.symlink(test_support.TESTFN + \"1\", test_support.TESTFN + \"2\")\n self.assertIs(posixpath.islink(test_support.TESTFN + \"2\"), True)\n os.remove(test_support.TESTFN + \"1\")\n self.assertIs(posixpath.islink(test_support.TESTFN + \"2\"), True)\n self.assertIs(posixpath.exists(test_support.TESTFN + \"2\"), False)\n self.assertIs(posixpath.lexists(test_support.TESTFN + \"2\"), True)\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN + \"1\")\n except os.error:\n pass\n try:\n os.remove(test_support.TESTFN + \"2\")\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.islink)", "metadata": "root.PosixPathTest.test_islink", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 139 }, { "content": " def test_exists(self):\n self.assertIs(posixpath.exists(test_support.TESTFN), False)\n f = open(test_support.TESTFN, \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(posixpath.exists(test_support.TESTFN), True)\n self.assertIs(posixpath.lexists(test_support.TESTFN), True)\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN)\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.exists)", "metadata": "root.PosixPathTest.test_exists", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_isdir(self):\n self.assertIs(posixpath.isdir(test_support.TESTFN), False)\n f = open(test_support.TESTFN, \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(posixpath.isdir(test_support.TESTFN), False)\n os.remove(test_support.TESTFN)\n os.mkdir(test_support.TESTFN)\n self.assertIs(posixpath.isdir(test_support.TESTFN), True)\n os.rmdir(test_support.TESTFN)\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN)\n except os.error:\n pass\n try:\n os.rmdir(test_support.TESTFN)\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.isdir)", "metadata": "root.PosixPathTest.test_isdir", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 186 }, { "content": " def test_isfile(self):\n self.assertIs(posixpath.isfile(test_support.TESTFN), False)\n f = open(test_support.TESTFN, \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(posixpath.isfile(test_support.TESTFN), True)\n os.remove(test_support.TESTFN)\n os.mkdir(test_support.TESTFN)\n self.assertIs(posixpath.isfile(test_support.TESTFN), False)\n os.rmdir(test_support.TESTFN)\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN)\n except os.error:\n pass\n try:\n os.rmdir(test_support.TESTFN)\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.isdir)\n\n def test_samefile(self):\n f = open(test_support.TESTFN + \"1\", \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(\n posixpath.samefile(\n test_support.TESTFN + \"1\",\n test_support.TESTFN + \"1\"\n ),\n True\n )\n # If we don't have links, assume that os.stat doesn't return resonable\n # inode information and thus, that samefile() doesn't work\n if hasattr(os, \"symlink\"):\n os.symlink(\n test_support.TESTFN + \"1\",\n test_support.TESTFN + \"2\"\n )\n self.assertIs(\n posixpath.samefile(\n test_support.TESTFN + \"1\",\n test_support.TESTFN + \"2\"\n ),\n True\n )\n os.remove(test_support.TESTFN + \"2\")\n f = open(test_support.TESTFN + \"2\", \"wb\")\n f.write(\"bar\")\n f.close()\n self.assertIs(\n posixpath.samefile(\n test_support.TESTFN + \"1\",\n test_support.TESTFN + \"2\"\n ),\n False\n )\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN + \"1\")\n except os.error:\n pass\n try:\n os.remove(test_support.TESTFN + \"2\")\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.samefile)", "metadata": "root.PosixPathTest.test_isfile", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_samestat(self):\n f = open(test_support.TESTFN + \"1\", \"wb\")\n try:\n f.write(\"foo\")\n f.close()\n self.assertIs(\n posixpath.samestat(\n os.stat(test_support.TESTFN + \"1\"),\n os.stat(test_support.TESTFN + \"1\")\n ),\n True\n )\n # If we don't have links, assume that os.stat() doesn't return resonable\n # inode information and thus, that samefile() doesn't work\n if hasattr(os, \"symlink\"):\n if hasattr(os, \"symlink\"):\n os.symlink(test_support.TESTFN + \"1\", test_support.TESTFN + \"2\")\n self.assertIs(\n posixpath.samestat(\n os.stat(test_support.TESTFN + \"1\"),\n os.stat(test_support.TESTFN + \"2\")\n ),\n True\n )\n os.remove(test_support.TESTFN + \"2\")\n f = open(test_support.TESTFN + \"2\", \"wb\")\n f.write(\"bar\")\n f.close()\n self.assertIs(\n posixpath.samestat(\n os.stat(test_support.TESTFN + \"1\"),\n os.stat(test_support.TESTFN + \"2\")\n ),\n False\n )\n finally:\n if not f.close():\n f.close()\n try:\n os.remove(test_support.TESTFN + \"1\")\n except os.error:\n pass\n try:\n os.remove(test_support.TESTFN + \"2\")\n except os.error:\n pass\n\n self.assertRaises(TypeError, posixpath.samestat)", "metadata": "root.PosixPathTest.test_samestat", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def test_ismount(self):\n self.assertIs(posixpath.ismount(\"/\"), True)\n\n self.assertRaises(TypeError, posixpath.ismount)", "metadata": "root.PosixPathTest.test_ismount", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 337 }, { "content": " def test_expanduser(self):\n self.assertEqual(posixpath.expanduser(\"foo\"), \"foo\")\n try:\n import pwd\n except ImportError:\n pass\n else:\n self.assert_(isinstance(posixpath.expanduser(\"~/\"), basestring))\n # if home directory == root directory, this test makes no sense\n if posixpath.expanduser(\"~\") != '/':\n self.assertEqual(\n posixpath.expanduser(\"~\") + \"/\",\n posixpath.expanduser(\"~/\")\n )\n self.assert_(isinstance(posixpath.expanduser(\"~root/\"), basestring))\n self.assert_(isinstance(posixpath.expanduser(\"~foo/\"), basestring))\n\n self.assertRaises(TypeError, posixpath.expanduser)", "metadata": "root.PosixPathTest.test_expanduser", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 342 }, { "content": " def test_expandvars(self):\n oldenv = os.environ.copy()\n try:\n os.environ.clear()\n os.environ[\"foo\"] = \"bar\"\n os.environ[\"{foo\"] = \"baz1\"\n os.environ[\"{foo}\"] = \"baz2\"\n self.assertEqual(posixpath.expandvars(\"foo\"), \"foo\")\n self.assertEqual(posixpath.expandvars(\"$foo bar\"), \"bar bar\")\n self.assertEqual(posixpath.expandvars(\"${foo}bar\"), \"barbar\")\n self.assertEqual(posixpath.expandvars(\"$[foo]bar\"), \"$[foo]bar\")\n self.assertEqual(posixpath.expandvars(\"$bar bar\"), \"$bar bar\")\n self.assertEqual(posixpath.expandvars(\"$?bar\"), \"$?bar\")\n self.assertEqual(posixpath.expandvars(\"${foo}bar\"), \"barbar\")\n self.assertEqual(posixpath.expandvars(\"$foo}bar\"), \"bar}bar\")\n self.assertEqual(posixpath.expandvars(\"${foo\"), \"${foo\")\n self.assertEqual(posixpath.expandvars(\"${{foo}}\"), \"baz1}\")\n finally:\n os.environ.clear()\n os.environ.update(oldenv)\n\n self.assertRaises(TypeError, posixpath.expandvars)", "metadata": "root.PosixPathTest.test_expandvars", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 361 }, { "content": " def test_normpath(self):\n self.assertEqual(posixpath.normpath(\"\"), \".\")\n self.assertEqual(posixpath.normpath(\"/\"), \"/\")\n self.assertEqual(posixpath.normpath(\"//\"), \"//\")\n self.assertEqual(posixpath.normpath(\"///\"), \"/\")\n self.assertEqual(posixpath.normpath(\"///foo/.//bar//\"), \"/foo/bar\")\n self.assertEqual(posixpath.normpath(\"///foo/.//bar//.//..//.//baz\"), \"/foo/baz\")\n self.assertEqual(posixpath.normpath(\"///..//./foo/.//bar\"), \"/foo/bar\")\n\n self.assertRaises(TypeError, posixpath.normpath)", "metadata": "root.PosixPathTest.test_normpath", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 384 }, { "content": " def test_abspath(self):\n self.assert_(\"foo\" in posixpath.abspath(\"foo\"))\n\n self.assertRaises(TypeError, posixpath.abspath)", "metadata": "root.PosixPathTest.test_abspath", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 395 }, { "content": " def test_realpath(self):\n self.assert_(\"foo\" in realpath(\"foo\"))\n self.assertRaises(TypeError, posixpath.realpath)", "metadata": "root.PosixPathTest.test_realpath", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 400 }, { "content": " @unittest.skip(\"FIXME: broken\")\n def test_realpath_basic(self):\n # Basic operation.\n try:\n os.symlink(ABSTFN+\"1\", ABSTFN)\n self.assertEqual(realpath(ABSTFN), ABSTFN+\"1\")\n finally:\n self.safe_remove(ABSTFN)", "metadata": "root.PosixPathTest.test_realpath_basic", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 405 }, { "content": " def test_realpath_symlink_loops(self):\n # Bug #930024, return the path unchanged if we get into an infinite\n # symlink loop.\n try:\n old_path = abspath('.')\n os.symlink(ABSTFN, ABSTFN)\n self.assertEqual(realpath(ABSTFN), ABSTFN)\n\n os.symlink(ABSTFN+\"1\", ABSTFN+\"2\")\n os.symlink(ABSTFN+\"2\", ABSTFN+\"1\")\n self.assertEqual(realpath(ABSTFN+\"1\"), ABSTFN+\"1\")\n self.assertEqual(realpath(ABSTFN+\"2\"), ABSTFN+\"2\")\n\n # Test using relative path as well.\n os.chdir(dirname(ABSTFN))\n self.assertEqual(realpath(basename(ABSTFN)), ABSTFN)\n finally:\n os.chdir(old_path)\n self.safe_remove(ABSTFN)\n self.safe_remove(ABSTFN+\"1\")\n self.safe_remove(ABSTFN+\"2\")", "metadata": "root.PosixPathTest.test_realpath_symlink_loops", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 414 }, { "content": " @unittest.skip(\"FIXME: broken\")\n def test_realpath_resolve_parents(self):\n # We also need to resolve any symlinks in the parents of a relative\n # path passed to realpath. E.g.: current working directory is\n # /usr/doc with 'doc' being a symlink to /usr/share/doc. We call\n # realpath(\"a\"). This should return /usr/share/doc/a/.\n try:\n old_path = abspath('.')\n os.mkdir(ABSTFN)\n os.mkdir(ABSTFN + \"/y\")\n os.symlink(ABSTFN + \"/y\", ABSTFN + \"/k\")\n\n os.chdir(ABSTFN + \"/k\")\n self.assertEqual(realpath(\"a\"), ABSTFN + \"/y/a\")\n finally:\n os.chdir(old_path)\n self.safe_remove(ABSTFN + \"/k\")\n self.safe_rmdir(ABSTFN + \"/y\")\n self.safe_rmdir(ABSTFN)", "metadata": "root.PosixPathTest.test_realpath_resolve_parents", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 436 }, { "content": " @unittest.skip(\"FIXME: broken\")\n def test_realpath_resolve_before_normalizing(self):\n # Bug #990669: Symbolic links should be resolved before we\n # normalize the path. E.g.: if we have directories 'a', 'k' and 'y'\n # in the following hierarchy:\n # a/k/y\n #\n # and a symbolic link 'link-y' pointing to 'y' in directory 'a',\n # then realpath(\"link-y/..\") should return 'k', not 'a'.\n try:\n old_path = abspath('.')\n os.mkdir(ABSTFN)\n os.mkdir(ABSTFN + \"/k\")\n os.mkdir(ABSTFN + \"/k/y\")\n os.symlink(ABSTFN + \"/k/y\", ABSTFN + \"/link-y\")\n\n # Absolute path.\n self.assertEqual(realpath(ABSTFN + \"/link-y/..\"), ABSTFN + \"/k\")\n # Relative path.\n os.chdir(dirname(ABSTFN))\n self.assertEqual(realpath(basename(ABSTFN) + \"/link-y/..\"), ABSTFN + \"/k\")\n finally:\n os.chdir(old_path)\n self.safe_remove(ABSTFN + \"/link-y\")\n self.safe_rmdir(ABSTFN + \"/k/y\")\n self.safe_rmdir(ABSTFN + \"/k\")\n self.safe_rmdir(ABSTFN)", "metadata": "root.PosixPathTest.test_realpath_resolve_before_normalizing", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 456 }, { "content": " @unittest.skip(\"FIXME: broken\")\n def test_realpath_resolve_first(self):\n # Bug #1213894: The first component of the path, if not absolute,\n # must be resolved too.\n\n try:\n old_path = abspath('.')\n os.mkdir(ABSTFN)\n os.mkdir(ABSTFN + \"/k\")\n os.symlink(ABSTFN, ABSTFN + \"link\")\n os.chdir(dirname(ABSTFN))\n\n base = basename(ABSTFN)\n self.assertEqual(realpath(base + \"link\"), ABSTFN)\n self.assertEqual(realpath(base + \"link/k\"), ABSTFN + \"/k\")\n finally:\n os.chdir(old_path)\n self.safe_remove(ABSTFN + \"link\")\n self.safe_rmdir(ABSTFN + \"/k\")\n self.safe_rmdir(ABSTFN)", "metadata": "root.PosixPathTest.test_realpath_resolve_first", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 484 }, { "content": " def pass_os_error(self, func, filename):\n try: func(filename)\n except OSError: pass", "metadata": "root.PosixPathTest.pass_os_error", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 506 }, { "content": " def safe_remove(self, filename):\n self.pass_os_error(os.remove, filename)", "metadata": "root.PosixPathTest.safe_remove", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 510 }, { "content": " def safe_rmdir(self, dirname):\n self.pass_os_error(os.rmdir, dirname)", "metadata": "root.PosixPathTest.safe_rmdir", "header": "['class', 'PosixPathTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 513 }, { "content": "def test_main():\n test_support.run_unittest(PosixPathTest)", "metadata": "root.test_main", "header": "['module', '___EOS___']", "index": 516 } ]
[ { "span": "from posixpath import realpath, abspath, join, dirname, basename", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "import_", "test\\u", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "posixpath_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "posixpath_", "import_", "realpath_", ",_", "abspath_", ",_", "join_", ",_", "dirname_", ",_", "basename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "abs", "olute", " ", "path", " ", "to", " ", "a", " ", "temporar", "y", " ", "filename", " ", "for", " ", "testi", "ng", ".", " ", "We", " ", "can", "'", "t", " ", "rely", " ", "on", " ", "TESTFN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bei", "ng", " ", "an", " ", "abs", "olute", " ", "path", ",", " ", "so", " ", "we", " ", "need", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "TF", "N_", "=_", "abspath_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "name_", "!=_", "'", "java", "'_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "\"", "symlink", "\"_", ")_", ":_", "\\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_", "#", " ", "Conve", "nie", "nce", " ", "function", "s", " ", "for", " ", "remo", "ving", " ", "temporar", "y", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "Is_", "(_", "self_", ",_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "a_", "is_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "norm", "case_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "norm", "case", "()", " ", "is", " ", "idempotent", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "\"", "Fo", "O", "/.", "/", "Ba", "R", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "posixpath_", "._", "norm", "case_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p_", ",_", "posixpath_", "._", "norm", "case_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "norm", "case_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "join_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "join_", "(_", "\"/", "foo", "\"_", ",_", "\"", "bar", "\"_", ",_", "\"/", "bar", "\"_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "\"/", "bar", "/", "ba", "z", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "join_", "(_", "\"/", "foo", "\"_", ",_", "\"", "bar", "\"_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "\"/", "foo", "/", "bar", "/", "ba", "z", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "join_", "(_", "\"/", "foo", "/\"_", ",_", "\"", "bar", "/\"_", ",_", "\"", "ba", "z", "/\"_", ")_", ",_", "\"/", "foo", "/", "bar", "/", "ba", "z", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "join_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "split", "drive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split", "drive_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "(_", "\"\"_", ",_", "\"/", "foo", "/", "bar", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "split", "drive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "split_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "(_", "\"/", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split_", "(_", "\"/\"_", ")_", ",_", "(_", "\"/\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split_", "(_", "\"", "foo", "\"_", ")_", ",_", "(_", "\"\"_", ",_", "\"", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split_", "(_", "\"//", "//", "foo", "\"_", ")_", ",_", "(_", "\"//", "//", "\"_", ",_", "\"", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split_", "(_", "\"//", "foo", "//", "bar", "\"_", ")_", ",_", "(_", "\"//", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "split_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "splitext_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"", "foo", ".", "ext", "\"_", ")_", ",_", "(_", "\"", "foo", "\"_", ",_", "\".", "ext", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"/", "foo", "/", "foo", ".", "ext", "\"_", ")_", ",_", "(_", "\"/", "foo", "/", "foo", "\"_", ",_", "\".", "ext", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\".", "ext", "\"_", ")_", ",_", "(_", "\"\"_", ",_", "\".", "ext", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"/", "foo", ".", "ext", "/", "foo", "\"_", ")_", ",_", "(_", "\"/", "foo", ".", "ext", "/", "foo", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"", "foo", ".", "ext", "/\"_", ")_", ",_", "(_", "\"", "foo", ".", "ext", "/\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"\"_", ")_", ",_", "(_", "\"\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "splitext_", "(_", "\"", "foo", ".", "bar", ".", "ext", "\"_", ")_", ",_", "(_", "\"", "foo", ".", "bar", "\"_", ",_", "\".", "ext", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "splitext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "isabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isabs_", "(_", "\"\"_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isabs_", "(_", "\"/\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isabs_", "(_", "\"/", "foo", "\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isabs_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isabs_", "(_", "\"", "foo", "/", "bar", "\"_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "isabs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "split", "drive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "split", "drive_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "(_", "\"\"_", ",_", "\"/", "foo", "/", "bar", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "split", "drive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "basename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "basename_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "basename_", "(_", "\"/\"_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "basename_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "basename_", "(_", "\"//", "//", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "basename_", "(_", "\"//", "foo", "//", "bar", "\"_", ")_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "dirname_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "dirname_", "(_", "\"/", "foo", "/", "bar", "\"_", ")_", ",_", "\"/", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "dirname_", "(_", "\"/\"_", ")_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "dirname_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "dirname_", "(_", "\"//", "//", "foo", "\"_", ")_", ",_", "\"//", "//", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "dirname_", "(_", "\"//", "foo", "//", "bar", "\"_", ")_", ",_", "\"//", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "dirname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "common", "prefix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "common", "prefix_", "(_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "common", "prefix_", "(_", "[_", "\"/", "home", "/", "swe", "nso", "n", "/", "spam", "\"_", ",_", "\"/", "home", "/", "swe", "n", "/", "spam", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "home", "/", "swe", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "common", "prefix_", "(_", "[_", "\"/", "home", "/", "swe", "n", "/", "spam", "\"_", ",_", "\"/", "home", "/", "swe", "n", "/", "egg", "s", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "home", "/", "swe", "n", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "common", "prefix_", "(_", "[_", "\"/", "home", "/", "swe", "n", "/", "spam", "\"_", ",_", "\"/", "home", "/", "swe", "n", "/", "spam", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "home", "/", "swe", "n", "/", "spam", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "getsize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "getsize_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "d_", ",_", "\"", "fooba", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "getc", "time_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "<=_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "getmtime_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "\"", "FIX", "ME", ":", " ", "broken", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "islink_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "islink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "islink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "\"", "symlink", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "symlink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "islink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "islink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "exists_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "lexi", "sts_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "islink_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "exists_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "exists_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "lexi", "sts_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "exists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "isdir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rmdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "isdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "isfile_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isfile_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isfile_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "isfile_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rmdir_", "(_", "test\\u", "support_", "._", "TESTFN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "isdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "same", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "don", "'", "t", " ", "have", " ", "link", "s", ",", " ", "assume", " ", "tha", "t", " ", "os", ".", "stat", " ", "doe", "sn", "'", "t", " ", "return", " ", "reso", "nable", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inode", " ", "informati", "on", " ", "and", " ", "thu", "s", ",", " ", "tha", "t", " ", "same", "file", "()", " ", "doe", "sn", "'", "t", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "\"", "symlink", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "symlink_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "same", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "same", "stat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "stat_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "don", "'", "t", " ", "have", " ", "link", "s", ",", " ", "assume", " ", "tha", "t", " ", "os", ".", "stat", "()", " ", "doe", "sn", "'", "t", " ", "return", " ", "reso", "nable", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inode", " ", "informati", "on", " ", "and", " ", "thu", "s", ",", " ", "tha", "t", " ", "same", "file", "()", " ", "doe", "sn", "'", "t", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "\"", "symlink", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hasattr_", "(_", "os_", ",_", "\"", "symlink", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "symlink_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ",_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "stat_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "open_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "same", "stat_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "stat_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "close_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "remove_", "(_", "test\\u", "support_", "._", "TESTFN_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "same", "stat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "ism", "ount_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "posixpath_", "._", "ism", "ount_", "(_", "\"/\"_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "ism", "ount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "expanduser_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expanduser_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "posixpath_", "._", "expanduser_", "(_", "\"~/", "\"_", ")_", ",_", "basestring_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "home", " ", "director", "y", " ", "==", " ", "root", " ", "director", "y", ",", " ", "this", " ", "test", " ", "make", "s", " ", "no", " ", "sense_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "posixpath_", "._", "expanduser_", "(_", "\"~\"_", ")_", "!=_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "expanduser_", "(_", "\"~\"_", ")_", "+_", "\"/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "posixpath_", "._", "expanduser_", "(_", "\"~/", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "posixpath_", "._", "expanduser_", "(_", "\"", "~", "root", "/\"_", ")_", ",_", "basestring_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "posixpath_", "._", "expanduser_", "(_", "\"", "~", "foo", "/\"_", ")_", ",_", "basestring_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "expanduser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "expand", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "env_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"", "foo", "\"_", "]_", "=_", "\"", "bar", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"{", "foo", "\"_", "]_", "=_", "\"", "ba", "z", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"{", "foo", "}\"_", "]_", "=_", "\"", "ba", "z", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "foo", " ", "bar", "\"_", ")_", ",_", "\"", "bar", " ", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "{", "foo", "}", "bar", "\"_", ")_", ",_", "\"", "barb", "ar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "[", "foo", "]", "bar", "\"_", ")_", ",_", "\"$", "[", "foo", "]", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "bar", " ", "bar", "\"_", ")_", ",_", "\"$", "bar", " ", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "?", "bar", "\"_", ")_", ",_", "\"$", "?", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "{", "foo", "}", "bar", "\"_", ")_", ",_", "\"", "barb", "ar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "foo", "}", "bar", "\"_", ")_", ",_", "\"", "bar", "}", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "{", "foo", "\"_", ")_", ",_", "\"$", "{", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "expand", "vars_", "(_", "\"$", "{{", "foo", "}}\"_", ")_", ",_", "\"", "ba", "z", "1", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "._", "update_", "(_", "old", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "expand", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "normpath_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"\"_", ")_", ",_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"/\"_", ")_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"//", "\"_", ")_", ",_", "\"//", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"//", "/\"_", ")_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"//", "/", "foo", "/.", "//", "bar", "//", "\"_", ")_", ",_", "\"/", "foo", "/", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"//", "/", "foo", "/.", "//", "bar", "//", "./", "/../", "/.", "//", "ba", "z", "\"_", ")_", ",_", "\"/", "foo", "/", "ba", "z", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "posixpath_", "._", "normpath_", "(_", "\"//", "/../", "/.", "/", "foo", "/.", "//", "bar", "\"_", ")_", ",_", "\"/", "foo", "/", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "normpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "abspath_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "\"", "foo", "\"_", "in_", "posixpath_", "._", "abspath_", "(_", "\"", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "abspath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "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", "realpath_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "\"", "foo", "\"_", "in_", "realpath_", "(_", "\"", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "posixpath_", "._", "realpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "unittest_", "._", "skip_", "(_", "\"", "FIX", "ME", ":", " ", "broken", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "real", "path", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Basic", " ", "operati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ",_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "ABS", "TF", "N_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "real", "path", "\\u", "symlink", "\\u", "loops_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bug", " ", "#", "930", "024", ",", " ", "return", " ", "the", " ", "path", " ", "unchanged", " ", "if", " ", "we", " ", "get", " ", "int", "o", " ", "an", " ", "infini", "te_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symlink", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "path_", "=_", "abspath_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", ",_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "ABS", "TF", "N_", ")_", ",_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ",_", "ABS", "TF", "N_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", "+_", "\"", "2", "\"_", ",_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "ABS", "TF", "N_", "+_", "\"", "2", "\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "usi", "ng", " ", "relative", " ", "path", " ", "as", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "dirname_", "(_", "ABS", "TF", "N_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "basename_", "(_", "ABS", "TF", "N_", ")_", ")_", ",_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "old", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", "+_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", "+_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "\"", "FIX", "ME", ":", " ", "broken", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "real", "path", "\\u", "resolve", "\\u", "parents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "als", "o", " ", "need", " ", "to", " ", "resolve", " ", "any", " ", "symlinks", " ", "in", " ", "the", " ", "parents", " ", "of", " ", "a", " ", "relative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "path", " ", "pass", "ed", " ", "to", " ", "real", "path", ".", " ", "E", ".", "g", ".:", " ", "current", " ", "working", " ", "director", "y", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "doc", " ", "with", " ", "'", "doc", "'", " ", "bei", "ng", " ", "a", " ", "symlink", " ", "to", " ", "/", "usr", "/", "share", "/", "doc", ".", " ", "We", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "real", "path", "(\"", "a", "\")", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "return", " ", "/", "usr", "/", "share", "/", "doc", "/", "a", "/.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "path_", "=_", "abspath_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", "+_", "\"/", "y", "\"_", ",_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "\"", "a", "\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"/", "y", "/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "old", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "\"", "FIX", "ME", ":", " ", "broken", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "real", "path", "\\u", "resolve", "\\u", "bef", "ore", "\\u", "normali", "zin", "g_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bug", " ", "#", "990", "669", ":", " ", "Symboli", "c", " ", "link", "s", " ", "shou", "ld", " ", "be", " ", "resolve", "d", " ", "bef", "ore", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normali", "ze", " ", "the", " ", "path", ".", " ", "E", ".", "g", ".:", " ", "if", " ", "we", " ", "have", " ", "director", "ies", " ", "'", "a", "',", " ", "'", "k", "'", " ", "and", " ", "'", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "follow", "ing", " ", "hier", "arch", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", "/", "k", "/", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "a", " ", "symbolic", " ", "link", " ", "'", "link", "-", "y", "'", " ", "pointi", "ng", " ", "to", " ", "'", "y", "'", " ", "in", " ", "director", "y", " ", "'", "a", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "real", "path", "(\"", "link", "-", "y", "/.", ".\"", ")", " ", "shou", "ld", " ", "return", " ", "'", "k", "',", " ", "not", " ", "'", "a", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "path_", "=_", "abspath_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "/", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "/", "y", "\"_", ",_", "ABS", "TF", "N_", "+_", "\"/", "link", "-", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abs", "olute", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "ABS", "TF", "N_", "+_", "\"/", "link", "-", "y", "/.", ".\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Relative", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "dirname_", "(_", "ABS", "TF", "N_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "basename_", "(_", "ABS", "TF", "N_", ")_", "+_", "\"/", "link", "-", "y", "/.", ".\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "old", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", "+_", "\"/", "link", "-", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "/", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "\"", "FIX", "ME", ":", " ", "broken", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "real", "path", "\\u", "resolve", "\\u", "first_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bug", " ", "#", "121", "389", "4", ":", " ", "The", " ", "first", " ", "component", " ", "of", " ", "the", " ", "path", ",", " ", "if", " ", "not", " ", "abs", "olute", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "must", " ", "be", " ", "resolve", "d", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "path_", "=_", "abspath_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "ABS", "TF", "N_", ",_", "ABS", "TF", "N_", "+_", "\"", "link", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "dirname_", "(_", "ABS", "TF", "N_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "basename_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "base_", "+_", "\"", "link", "\"_", ")_", ",_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "realpath_", "(_", "base_", "+_", "\"", "link", "/", "k", "\"_", ")_", ",_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "old", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "remove_", "(_", "ABS", "TF", "N_", "+_", "\"", "link", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", "+_", "\"/", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "safe", "\\u", "rmdir_", "(_", "ABS", "TF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pass", "\\u", "os", "\\u", "error_", "(_", "self_", ",_", "func_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "func_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "safe", "\\u", "remove_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pass", "\\u", "os", "\\u", "error_", "(_", "os_", "._", "remove_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "x", "Path", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "safe", "\\u", "rmdir_", "(_", "self_", ",_", "dirname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pass", "\\u", "os", "\\u", "error_", "(_", "os_", "._", "rmdir_", ",_", "dirname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "support_", "._", "run", "\\u", "unittest_", "(_", "Posi", "x", "Path", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 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
mindsnacks/Zinc/tests/testZincCatalog.py
[ { "content": "import os\nimport logging\nimport json\n\nfrom zinc.models import ZincIndex, ZincManifest, ZincFlavorSpec\nfrom zinc.catalog import ZincCatalogPathHelper\nfrom zinc.defaults import defaults\nfrom zinc.catalog import ZincCatalog\nfrom zinc.storages import StorageBackend\n\nfrom zinc.client import connect, create_bundle_version\n\nimport zinc.helpers as helpers\nimport zinc.utils as utils\n\nfrom tests import *\n\n\n# TODO: relocate\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class StorageBackendTestCase(unittest.TestCase):\n\n\n\n", "metadata": "root.StorageBackendTestCase", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def setUp(self):\n self.storage = StorageBackend()", "metadata": "root.StorageBackendTestCase.setUp", "header": "['class', 'StorageBackendTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_get_raises(self):\n self.assertRaises(NotImplementedError, self.storage.get, 'foo')", "metadata": "root.StorageBackendTestCase.test_get_raises", "header": "['class', 'StorageBackendTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_get_meta_raises(self):\n self.assertRaises(NotImplementedError, self.storage.get_meta, 'foo')", "metadata": "root.StorageBackendTestCase.test_get_meta_raises", "header": "['class', 'StorageBackendTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_put_raises(self):\n self.assertRaises(NotImplementedError, self.storage.put, 'foo', 'bar')", "metadata": "root.StorageBackendTestCase.test_put_raises", "header": "['class', 'StorageBackendTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": "def create_catalog_at_path(path, id):\n service = connect('/')\n service.create_catalog(id=id, loc=path)\n catalog = service.get_catalog(loc=path)\n return catalog", "metadata": "root.create_catalog_at_path", "header": "['module', '___EOS___']", "index": 34 }, { "content": "class ZincCatalogPathHelperTestCase(unittest.TestCase):\n\n\n\n", "metadata": "root.ZincCatalogPathHelperTestCase", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def setUp(self):\n self.pathHelper = ZincCatalogPathHelper()", "metadata": "root.ZincCatalogPathHelperTestCase.setUp", "header": "['class', 'ZincCatalogPathHelperTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_config_dir(self):\n self.assertEquals(self.pathHelper.config_dir, \"config\")", "metadata": "root.ZincCatalogPathHelperTestCase.test_config_dir", "header": "['class', 'ZincCatalogPathHelperTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_config_flavors_spec_dir(self):\n self.assertEquals(self.pathHelper.config_flavorspec_dir, \"config/flavorspecs\")", "metadata": "root.ZincCatalogPathHelperTestCase.test_config_flavors_spec_dir", "header": "['class', 'ZincCatalogPathHelperTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_path_for_flavor_spec_name(self):\n flavor_spec_name = \"games\"\n expected_path = \"config/flavorspecs/%s.json\" % flavor_spec_name\n actual_path = self.pathHelper.path_for_flavorspec_name(flavor_spec_name)\n self.assertEquals(expected_path, actual_path)", "metadata": "root.ZincCatalogPathHelperTestCase.test_path_for_flavor_spec_name", "header": "['class', 'ZincCatalogPathHelperTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": "class ZincCatalogTestCase(TempDirTestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ZincCatalogTestCase", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def setUp(self):\n super(ZincCatalogTestCase, self).setUp()\n\n self.catalog_dir = os.path.join(self.dir, \"catalog\")\n os.mkdir(self.catalog_dir)\n self.scratch_dir = os.path.join(self.dir, \"scratch\")\n os.mkdir(self.scratch_dir)\n logging.info(\"catalog: %s\" % self.catalog_dir)\n logging.info(\"scratch: %s\" % self.scratch_dir)", "metadata": "root.ZincCatalogTestCase.setUp", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def path_exists_in_catalog(self, subpath):\n fullpath = os.path.join(self.catalog_dir, subpath)\n return os.path.exists(fullpath)", "metadata": "root.ZincCatalogTestCase.path_exists_in_catalog", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_catalog_create(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n self.assertTrue(catalog is not None)\n self.assertTrue(len(catalog.index.bundle_names()) == 0)\n self.assertTrue(catalog.format() == defaults['zinc_format'])", "metadata": "root.ZincCatalogTestCase.test_catalog_create", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_catalog_read_invalid_format(self):\n create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n index_path = os.path.join(self.catalog_dir, defaults['catalog_index_name'])\n index = ZincIndex.from_path(index_path)\n index._format = 2\n index.write(index_path)\n self.assertRaises(Exception, ZincCatalog, (self.catalog_dir))", "metadata": "root.ZincCatalogTestCase.test_catalog_read_invalid_format", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_catalog_import_file(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n f1 = create_random_file(self.scratch_dir)\n catalog.import_path(f1)", "metadata": "root.ZincCatalogTestCase.test_catalog_import_file", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": " def test_bundle_names_with_no_bundles(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n self.assertTrue(len(catalog.index.bundle_names()) == 0)", "metadata": "root.ZincCatalogTestCase.test_bundle_names_with_no_bundles", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_versions_for_nonexistant_bundle(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n versions = catalog.index.versions_for_bundle(\"meep\")\n self.assertTrue(len(versions) == 0)", "metadata": "root.ZincCatalogTestCase.test_versions_for_nonexistant_bundle", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _build_test_catalog(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n catalog._reload() # TODO: fix/remove/something\n return catalog", "metadata": "root.ZincCatalogTestCase._build_test_catalog", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 103 }, { "content": " def test_create_bundle_version(self):\n catalog = self._build_test_catalog()\n self.assertTrue(\"meep\" in catalog.get_index().bundle_names())\n self.assertTrue(1 in catalog.get_index().versions_for_bundle(\"meep\"))\n manifest = catalog.manifest_for_bundle(\"meep\", 1)\n self.assertTrue(manifest is not None)\n for (file, props) in manifest.files.items():\n sha = props['sha']\n formats = props['formats']\n for format in formats.keys():\n ext = None\n if format == 'gz':\n ext = 'gz'\n object_path = ZincCatalogPathHelper().path_for_file_with_sha(sha, ext)\n self.assertTrue(self.path_exists_in_catalog(object_path))", "metadata": "root.ZincCatalogTestCase.test_create_bundle_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_bundle_name_in_manifest(self):\n catalog = self._build_test_catalog()\n bundle_name = \"meep\"\n manifest = catalog.manifest_for_bundle(bundle_name, 1)\n self.assertTrue(manifest.bundle_name == bundle_name)", "metadata": "root.ZincCatalogTestCase.test_bundle_name_in_manifest", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def test_create_bundle_with_subdirs(self):\n create_random_file(self.scratch_dir)\n one_dir = os.mkdir(os.path.join(self.scratch_dir, \"one\"))\n create_random_file(one_dir)\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_bundle_version(catalog, \"meep\", self.scratch_dir)", "metadata": "root.ZincCatalogTestCase.test_create_bundle_with_subdirs", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_create_second_bundle_version(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n new_index = ZincIndex.from_path(os.path.join(catalog.path, defaults['catalog_index_name']))\n self.assertTrue(1 in new_index.versions_for_bundle(\"meep\"))\n self.assertTrue(2 in new_index.versions_for_bundle(\"meep\"))", "metadata": "root.ZincCatalogTestCase.test_create_second_bundle_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": " def test_create_duplicate_bundle_version_no_force(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n # create first version\n manifest1 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n # attempt to create same version again\n manifest2 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertEquals(manifest1.version, manifest2.version)", "metadata": "root.ZincCatalogTestCase.test_create_duplicate_bundle_version_no_force", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_create_duplicate_bundle_version_with_force(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n # create first version\n manifest1 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n # attempt to create same version again, with force\n manifest2 = create_bundle_version(catalog, \"meep\", self.scratch_dir,\n force=True)\n self.assertNotEquals(manifest1.version, manifest2.version)", "metadata": "root.ZincCatalogTestCase.test_create_duplicate_bundle_version_with_force", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def test_create_identical_bundle_version(self):\n catalog = self._build_test_catalog()\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertEquals(len(catalog.get_index().versions_for_bundle(\"meep\")), 1)", "metadata": "root.ZincCatalogTestCase.test_create_identical_bundle_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_path_for_manifest_with_name_version(self):\n catalog = self._build_test_catalog()\n manifest = ZincManifest(catalog.index.id, 'zoo', 1)\n path = ZincCatalogPathHelper().path_for_manifest(manifest)\n filename = os.path.split(path)[-1]\n self.assertEquals(filename, 'zoo-1.json')", "metadata": "root.ZincCatalogTestCase.test_path_for_manifest_with_name_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def test_single_file_bundle_does_not_create_archive(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n archive_path = ZincCatalogPathHelper().path_for_archive_for_bundle_version(\"meep\", 1)\n self.assertFalse(self.path_exists_in_catalog(archive_path))", "metadata": "root.ZincCatalogTestCase.test_single_file_bundle_does_not_create_archive", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 185 }, { "content": " def test_more_than_one_file_bundle_does_create_archive(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n archive_path = ZincCatalogPathHelper().path_for_archive_for_bundle_version(\"meep\", 1)\n self.assertTrue(self.path_exists_in_catalog(archive_path))", "metadata": "root.ZincCatalogTestCase.test_more_than_one_file_bundle_does_create_archive", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test_single_file_flavor_does_not_create_archive(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n flavor_spec = ZincFlavorSpec.from_dict({'dummy': ['+ *']})\n create_bundle_version(catalog, \"meep\", self.scratch_dir,\n flavor_spec=flavor_spec)\n archive_path = ZincCatalogPathHelper().path_for_archive_for_bundle_version(\"meep\", 1,\n flavor='dummy')\n self.assertFalse(self.path_exists_in_catalog(archive_path))", "metadata": "root.ZincCatalogTestCase.test_single_file_flavor_does_not_create_archive", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test_skip_master_archive_and_no_flavor_specified(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir,\n skip_master_archive=True)\n archive_path = ZincCatalogPathHelper().path_for_archive_for_bundle_version(\"meep\", 1)\n self.assertTrue(self.path_exists_in_catalog(archive_path))", "metadata": "root.ZincCatalogTestCase.test_skip_master_archive_and_no_flavor_specified", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_skip_master_archive_and_flavor_specified(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n create_random_file(self.scratch_dir)\n create_random_file(self.scratch_dir)\n flavor_spec = ZincFlavorSpec.from_dict({'dummy': ['+ *']})\n create_bundle_version(catalog, \"meep\", self.scratch_dir,\n flavor_spec=flavor_spec, skip_master_archive=True)\n archive_path = ZincCatalogPathHelper().path_for_archive_for_bundle_version(\"meep\", 1)\n self.assertFalse(self.path_exists_in_catalog(archive_path))", "metadata": "root.ZincCatalogTestCase.test_skip_master_archive_and_flavor_specified", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def test_update_distro_basic(self):\n # set up\n catalog = self._build_test_catalog()\n bundle_name, distro = \"meep\", \"master\"\n\n # create 'master' distro at v1\n catalog.update_distribution(distro, bundle_name, 1)\n\n # verify\n version = catalog.index.version_for_bundle(bundle_name, distro)\n self.assertEquals(version, 1)", "metadata": "root.ZincCatalogTestCase.test_update_distro_basic", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 229 }, { "content": " def test_save_prev_distro_if_no_previous(self):\n # set up\n catalog = self._build_test_catalog()\n bundle_name, distro = \"meep\", \"master\"\n\n # create 'master' distro at v1\n catalog.update_distribution(distro, bundle_name, 1)\n\n # verify\n prev_distro = helpers.distro_previous_name(distro)\n prev_version = catalog.index.version_for_bundle(bundle_name, prev_distro)\n self.assertTrue(prev_version is None)", "metadata": "root.ZincCatalogTestCase.test_save_prev_distro_if_no_previous", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 241 }, { "content": " def test_save_prev_distro_if_prev_exists(self):\n # set up\n catalog = self._build_test_catalog()\n bundle_name, distro = \"meep\", \"master\"\n\n # create 'master' distro at v1\n catalog.update_distribution(distro, bundle_name, 1)\n\n # create a bundle version 2\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, bundle_name, self.scratch_dir)\n\n # update 'master' distro to v2\n catalog.update_distribution(distro, bundle_name, 2)\n\n # verify\n prev_distro = helpers.distro_previous_name(distro)\n prev_version = catalog.index.version_for_bundle(bundle_name, prev_distro)\n self.assertEquals(prev_version, 1)", "metadata": "root.ZincCatalogTestCase.test_save_prev_distro_if_prev_exists", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 254 }, { "content": " def add_dummy_flavorspec(self, catalog, flavorspec_name):\n flavorspec_string = json.dumps({'dummy': ['+ *']})\n subpath = catalog.path_helper.path_for_flavorspec_name(flavorspec_name)\n catalog._storage.puts(subpath, flavorspec_string)", "metadata": "root.ZincCatalogTestCase.add_dummy_flavorspec", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 274 }, { "content": " def test_update_flavorspec(self):\n #set up\n catalog = self._build_test_catalog()\n flavorspec_string = json.dumps({'dummy': ['+ *']})\n\n # add the flavorspec\n catalog.update_flavorspec_from_json_string(\"dummy\", flavorspec_string)\n\n # verify\n expected_path = catalog._ph.path_for_flavorspec_name(\"dummy\")\n self.path_exists_in_catalog(expected_path)", "metadata": "root.ZincCatalogTestCase.test_update_flavorspec", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 279 }, { "content": " def test_list_flavorspec(self):\n # set up\n catalog = self._build_test_catalog()\n self.add_dummy_flavorspec(catalog, \"test\")\n\n # get list\n actual_names = catalog.get_flavorspec_names()\n\n # verify\n self.assertEquals([\"test\"], actual_names)", "metadata": "root.ZincCatalogTestCase.test_list_flavorspec", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 291 }, { "content": " def test_delete_flavorspec(self):\n # set up\n catalog = self._build_test_catalog()\n self.add_dummy_flavorspec(catalog, \"test\")\n\n # delete flavorspec\n catalog.delete_flavorspec(\"test\")\n\n # verify\n subpath = catalog.path_helper.path_for_flavorspec_name(\"test\")\n self.assertFalse(os.path.exists(os.path.join(self.dir, subpath)))", "metadata": "root.ZincCatalogTestCase.test_delete_flavorspec", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 302 } ]
[ { "span": "import zinc.utils as utils", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zin", "c_", "._", "models_", "import_", "Zi", "nc", "Index_", ",_", "Zi", "nc", "Manifest", "_", ",_", "Zi", "nc", "Fla", "vor", "Spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zin", "c_", "._", "catalog_", "import_", "Zi", "nc", "Catalog", "Path", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zin", "c_", "._", "defaults_", "import_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zin", "c_", "._", "catalog_", "import_", "Zi", "nc", "Catalog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zin", "c_", "._", "storage", "s_", "import_", "Stor", "age", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zin", "c_", "._", "client_", "import_", "connect_", ",_", "create", "\\u", "bundle", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zin", "c_", "._", "helpers_", "as_", "helpers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zin", "c_", "._", "utils_", "as_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tests_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "relocat", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Stor", "age", "Back", "end", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Stor", "age", "Back", "end", "Test", "Case_", "(_", "unittest_", "._", "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_", "._", "storage_", "=_", "Stor", "age", "Backend_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stor", "age", "Back", "end", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "raises_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "self_", "._", "storage_", "._", "get_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stor", "age", "Back", "end", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "meta", "\\u", "raises_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "self_", "._", "storage_", "._", "get", "\\u", "meta_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stor", "age", "Back", "end", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "put", "\\u", "raises_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "self_", "._", "storage_", "._", "put_", ",_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\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_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "path_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service_", "=_", "connect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "create", "\\u", "catalog_", "(_", "id_", "=_", "id_", ",_", "loc_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalog_", "=_", "service_", "._", "get", "\\u", "catalog_", "(_", "loc_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "catalog_", "\\u\\u\\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_", "Zi", "nc", "Catalog", "Path", "Help", "er", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Path", "Help", "er", "Test", "Case_", "(_", "unittest_", "._", "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_", "._", "path", "Helper_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Path", "Help", "er", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path", "Helper_", "._", "config", "\\u", "dir_", ",_", "\"", "config", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Path", "Help", "er", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config", "\\u", "flavor", "s", "\\u", "spec", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path", "Helper_", "._", "config", "\\u", "flavor", "spec", "\\u", "dir_", ",_", "\"", "config", "/", "flavor", "spec", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Path", "Help", "er", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "path", "\\u", "for", "\\u", "flavor", "\\u", "spec", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor", "\\u", "spec", "\\u", "name_", "=_", "\"", "games", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "path_", "=_", "\"", "config", "/", "flavor", "spec", "s", "/", "%", "s", ".", "json", "\"_", "%_", "flavor", "\\u", "spec", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "path_", "=_", "self_", "._", "path", "Helper_", "._", "path", "\\u", "for", "\\u", "flavor", "spec", "\\u", "name_", "(_", "flavor", "\\u", "spec", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "expected", "\\u", "path_", ",_", "actual", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "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_", "(_", "Zi", "nc", "Catalog", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "catal", "og", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dir_", ",_", "\"", "catal", "og", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scratch", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dir_", ",_", "\"", "scratch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "catal", "og", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "catal", "og", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "scratch", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "self_", ",_", "subpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fullpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "subpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "exists_", "(_", "fullpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "catal", "og", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "catalog_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "catalog_", "._", "index_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "catalog_", "._", "format_", "(_", ")_", "==_", "defaults_", "[_", "'", "zin", "c\\u", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "catal", "og", "\\u", "read", "\\u", "invalid", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "defaults_", "[_", "'", "catal", "og", "\\u", "index", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "Zi", "nc", "Index_", "._", "from", "\\u", "path_", "(_", "index", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "._", "\\u", "format_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "._", "write_", "(_", "index", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Exception_", ",_", "Zi", "nc", "Catalog_", ",_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "catal", "og", "\\u", "import", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "=_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalog_", "._", "import", "\\u", "path_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bundle", "\\u", "names", "\\u", "with", "\\u", "no", "\\u", "bundles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "catalog_", "._", "index_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "version", "s", "\\u", "for", "\\u", "nonexist", "ant", "\\u", "bundle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "catalog_", "._", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "versions_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalog_", "._", "\\u", "reload_", "(_", ")_", "#", " ", "TOD", "O", ":", " ", "fix", "/", "remove", "/", "something_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "catalog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "bundle", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "mee", "p", "\"_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "catalog_", "._", "manifest", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "manifest_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "file_", ",_", "props_", ")_", "in_", "manifest_", "._", "files_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sha_", "=_", "props_", "[_", "'", "sha", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "props_", "[_", "'", "formats", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "format_", "in_", "formats_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format_", "==_", "'", "gz", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ext_", "=_", "'", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "file", "\\u", "with", "\\u", "sha_", "(_", "sha_", ",_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "object\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "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", "bundle", "\\u", "name", "\\u", "in", "\\u", "manifest_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", "=_", "\"", "mee", "p", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "catalog_", "._", "manifest", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "manifest_", "._", "bundle", "\\u", "name_", "==_", "bundle", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "bundle", "\\u", "with", "\\u", "subdirs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "one", "\\u", "dir_", "=_", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\"", "one", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "one", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "second", "\\u", "bundle", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "index_", "=_", "Zi", "nc", "Index_", "._", "from", "\\u", "path_", "(_", "os_", "._", "path_", "._", "join_", "(_", "catalog_", "._", "path_", ",_", "defaults_", "[_", "'", "catal", "og", "\\u", "index", "\\u", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "new", "\\u", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "new", "\\u", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "duplicat", "e\\u", "bundle", "\\u", "version", "\\u", "no", "\\u", "force_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "first", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "1_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "create", " ", "same", " ", "version", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "2_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "manifest", "1_", "._", "version_", ",_", "manifest", "2_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "duplicat", "e\\u", "bundle", "\\u", "version", "\\u", "with", "\\u", "force_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "first", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "1_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "create", " ", "same", " ", "version", " ", "again", ",", " ", "with", " ", "force_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "2_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "manifest", "1_", "._", "version_", ",_", "manifest", "2_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "identi", "cal", "\\u", "bundle", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "path", "\\u", "for", "\\u", "manifest", "\\u", "with", "\\u", "name", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "Zi", "nc", "Manifest", "_", "(_", "catalog_", "._", "index_", "._", "id_", ",_", "'", "zoo", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "manifest_", "(_", "manifest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "filename_", ",_", "'", "zoo", "-1", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "file", "\\u", "bundle", "\\u", "doe", "s", "\\u", "not", "\\u", "create", "\\u", "archive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "archive", "\\u", "for", "\\u", "bundle", "\\u", "version_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "archive", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "more", "\\u", "than", "\\u", "one", "\\u", "file", "\\u", "bundle", "\\u", "doe", "s", "\\u", "create", "\\u", "archive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "archive", "\\u", "for", "\\u", "bundle", "\\u", "version_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "archive", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "file", "\\u", "flavor", "\\u", "doe", "s", "\\u", "not", "\\u", "create", "\\u", "archive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor", "\\u", "spec_", "=_", "Zi", "nc", "Fla", "vor", "Spec_", "._", "from", "\\u", "dict_", "(_", "{_", "'", "dummy", "'_", ":_", "[_", "'+", " ", "*'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "spec_", "=_", "flavor", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "archive", "\\u", "for", "\\u", "bundle", "\\u", "version_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor_", "=_", "'", "dummy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "archive", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "skip", "\\u", "master", "\\u", "archive", "\\u", "and", "\\u", "no", "\\u", "flavor", "\\u", "specified", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "master", "\\u", "archive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "archive", "\\u", "for", "\\u", "bundle", "\\u", "version_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "archive", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "skip", "\\u", "master", "\\u", "archive", "\\u", "and", "\\u", "flavor", "\\u", "specified", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor", "\\u", "spec_", "=_", "Zi", "nc", "Fla", "vor", "Spec_", "._", "from", "\\u", "dict_", "(_", "{_", "'", "dummy", "'_", ":_", "[_", "'+", " ", "*'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "spec_", "=_", "flavor", "\\u", "spec_", ",_", "skip", "\\u", "master", "\\u", "archive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "archive", "\\u", "for", "\\u", "bundle", "\\u", "version_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "archive", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "distr", "o", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", ",_", "distro_", "=_", "\"", "mee", "p", "\"_", ",_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "'", "master", "'", " ", "distr", "o", " ", "at", " ", "v1_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "distribution_", "(_", "distro_", ",_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "catalog_", "._", "index_", "._", "version", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "version_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "prev", "\\u", "distr", "o", "\\u", "if", "\\u", "no", "\\u", "previous_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", ",_", "distro_", "=_", "\"", "mee", "p", "\"_", ",_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "'", "master", "'", " ", "distr", "o", " ", "at", " ", "v1_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "distribution_", "(_", "distro_", ",_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "distro_", "=_", "helpers_", "._", "distr", "o", "\\u", "previ", "ous", "\\u", "name_", "(_", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "version_", "=_", "catalog_", "._", "index_", "._", "version", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "prev", "\\u", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "prev", "\\u", "version_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "prev", "\\u", "distr", "o", "\\u", "if", "\\u", "prev", "\\u", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", ",_", "distro_", "=_", "\"", "mee", "p", "\"_", ",_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "'", "master", "'", " ", "distr", "o", " ", "at", " ", "v1_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "distribution_", "(_", "distro_", ",_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "bundle", " ", "version", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "bundle", "\\u", "name_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "'", "master", "'", " ", "distr", "o", " ", "to", " ", "v2_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "distribution_", "(_", "distro_", ",_", "bundle", "\\u", "name_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "distro_", "=_", "helpers_", "._", "distr", "o", "\\u", "previ", "ous", "\\u", "name_", "(_", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "version_", "=_", "catalog_", "._", "index_", "._", "version", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "prev", "\\u", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "prev", "\\u", "version_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "dummy", "\\u", "flavor", "spec_", "(_", "self_", ",_", "catalog_", ",_", "flavor", "spec", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor", "spec", "\\u", "string_", "=_", "json_", "._", "dumps_", "(_", "{_", "'", "dummy", "'_", ":_", "[_", "'+", " ", "*'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpath_", "=_", "catalog_", "._", "path", "\\u", "helper_", "._", "path", "\\u", "for", "\\u", "flavor", "spec", "\\u", "name_", "(_", "flavor", "spec", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalog_", "._", "\\u", "storage_", "._", "puts_", "(_", "subpath_", ",_", "flavor", "spec", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "flavor", "spec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor", "spec", "\\u", "string_", "=_", "json_", "._", "dumps_", "(_", "{_", "'", "dummy", "'_", ":_", "[_", "'+", " ", "*'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "flavor", "spec_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "flavor", "spec", "\\u", "from", "\\u", "json", "\\u", "string_", "(_", "\"", "dummy", "\"_", ",_", "flavor", "spec", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "path_", "=_", "catalog_", "._", "\\u", "ph_", "._", "path", "\\u", "for", "\\u", "flavor", "spec", "\\u", "name_", "(_", "\"", "dummy", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "expected", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "flavor", "spec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "dummy", "\\u", "flavor", "spec_", "(_", "catalog_", ",_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "names_", "=_", "catalog_", "._", "get", "\\u", "flavor", "spec", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "[_", "\"", "test", "\"_", "]_", ",_", "actual", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "flavor", "spec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "dummy", "\\u", "flavor", "spec_", "(_", "catalog_", ",_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "flavor", "spec_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "delete", "\\u", "flavor", "spec_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "subpath_", "=_", "catalog_", "._", "path", "\\u", "helper_", "._", "path", "\\u", "for", "\\u", "flavor", "spec", "\\u", "name_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dir_", ",_", "subpath_", ")_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
RobotLocomotion/director/src/python/director/surprisetask.py
[ { "content": "import os\nimport sys\nimport vtkAll as vtk\nimport math\nimport time\nimport types\nimport functools\nimport numpy as np\n\nfrom director import transformUtils\nfrom director import lcmUtils\nfrom director.timercallback import TimerCallback\nfrom director.asynctaskqueue import AsyncTaskQueue\nfrom director import objectmodel as om\nfrom director import visualization as vis\nfrom director import applogic as app\nfrom director.debugVis import DebugData\nfrom director import ikplanner\nfrom director.ikparameters import IkParameters\nfrom director import ioUtils\nfrom director.simpletimer import SimpleTimer\nfrom director.utime import getUtime\nfrom director import affordanceitems\nfrom director import robotstate\nfrom director import robotplanlistener\nfrom director import segmentation\nfrom director import planplayback\nfrom director import affordanceupdater\nfrom director import segmentationpanel\nfrom director import vtkNumpy as vnp\nfrom director import switchplanner\n\nfrom director.tasks.taskuserpanel import TaskUserPanel\nfrom director.tasks.taskuserpanel import ImageBasedAffordanceFit\n\nimport director.tasks.robottasks as rt\nimport director.tasks.taskmanagerwidget as tmw\n\nimport drc as lcmdrc\nimport copy\n\nfrom PythonQt import QtCore, QtGui\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SurpriseTaskPlanner(object):\n", "metadata": "root.SurpriseTaskPlanner", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __init__(self, robotSystem):\n self.robotSystem = robotSystem\n self.robotModel = robotSystem.robotStateModel\n self.ikPlanner = robotSystem.ikPlanner\n self.lockBackForManip = False\n self.lockBaseForManip = True\n self.side = 'right'\n self.toolTipToHandFrame = robotSystem.ikPlanner.newPalmOffsetGraspToHandFrame(self.side, 0.1)", "metadata": "root.SurpriseTaskPlanner.__init__", "header": "['class', 'SurpriseTaskPlanner', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": "class ImageFitter(ImageBasedAffordanceFit):\n\n\n", "metadata": "root.ImageFitter", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def __init__(self, switchPlanner):\n ImageBasedAffordanceFit.__init__(self, numberOfPoints=1)\n self.switchPlanner = switchPlanner\n self.fitFunc = None\n self.pickLineRadius = 0.05\n self.pickNearestToCamera = False\n\n self.useLocalPlaneFit = True\n self.useVoxelGrid = True", "metadata": "root.ImageFitter.__init__", "header": "['class', 'ImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 59 }, { "content": " def fit(self, polyData, points):\n if self.fitFunc:\n self.fitFunc(polyData, points)", "metadata": "root.ImageFitter.fit", "header": "['class', 'ImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 69 }, { "content": " def fitSwitchBox(self, polyData, points):\n boxPosition = points[0]\n wallPoint = points[1]\n\n\n # find a frame that is aligned with wall\n searchRadius = 0.2\n planePoints, normal = segmentation.applyLocalPlaneFit(polyData, points[0], searchRadius=np.linalg.norm(points[1] - points[0]), searchRadiusEnd=1.0)\n\n obj = vis.updatePolyData(planePoints, 'wall plane points', color=[0,1,0], visible=False)\n obj.setProperty('Point Size', 7)\n\n viewDirection = segmentation.SegmentationContext.getGlobalInstance().getViewDirection()\n if np.dot(normal, viewDirection) < 0:\n normal = -normal\n\n origin = segmentation.computeCentroid(planePoints)\n\n zaxis = [0,0,1]\n xaxis = normal\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n t = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n\n # translate that frame to the box position\n t.PostMultiply()\n t.Translate(boxPosition)\n\n boxFrame = transformUtils.copyFrame(t)\n self.switchPlanner.spawnBoxAffordanceAtFrame(boxFrame)", "metadata": "root.ImageFitter.fitSwitchBox", "header": "['class', 'ImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 73 }, { "content": "class SurpriseTaskPanel(TaskUserPanel):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SurpriseTaskPanel", "header": "['module', '___EOS___']", "index": 107 }, { "content": " def __init__(self, robotSystem):\n\n TaskUserPanel.__init__(self, windowTitle='Surprise Task')\n\n self.planner = SurpriseTaskPlanner(robotSystem)\n self.switchPlanner = switchplanner.SwitchPlanner(robotSystem)\n self.fitter = ImageFitter(self.switchPlanner)\n self.initImageView(self.fitter.imageView)\n\n self.addDefaultProperties()\n self.addButtons()\n self.addSwitchTasks()", "metadata": "root.SurpriseTaskPanel.__init__", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 109 }, { "content": " def test(self):\n print 'test'", "metadata": "root.SurpriseTaskPanel.test", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 123 }, { "content": " def addButtons(self):\n\n self.addManualSpacer()\n self.addManualButton('arms prep 1', self.switchPlanner.planArmsPrep1)\n self.addManualButton('arms prep 2', self.switchPlanner.planArmsPrep2)\n self.addManualButton('fit switch box', self.fitSwitchBox)\n self.addManualButton('spawn switch box affordance', self.switchPlanner.spawnBoxAffordance)\n self.addManualButton('spawn footstep frame', self.switchPlanner.spawnFootstepFrame)\n self.addManualButton('reset reach frame', self.switchPlanner.updateReachFrame)\n # self.addManualButton('plan reach to reach frame', self.switchPlanner.planReach)\n self.addManualButton('Reach to pinch reach frame', self.onPlanPinchReach)\n self.addManualButton('Commit Manip Plan', self.switchPlanner.commitManipPlan)", "metadata": "root.SurpriseTaskPanel.addButtons", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 126 }, { "content": " def onPlanPinchReach(self):\n self.switchPlanner.planPinchReach(maxDegreesPerSecond=self.maxDegreesPerSecond)", "metadata": "root.SurpriseTaskPanel.onPlanPinchReach", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 139 }, { "content": " def getSide(self):\n return self.params.getPropertyEnumValue('Hand').lower()", "metadata": "root.SurpriseTaskPanel.getSide", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 142 }, { "content": " def addDefaultProperties(self):\n self.params.addProperty('max degrees per second', 10, attributes=om.PropertyAttributes(singleStep=1, decimals=2))\n self.params.addProperty('Hand', 0, attributes=om.PropertyAttributes(enumNames=['Left', 'Right']))\n self.params.setProperty('Hand', self.planner.side.capitalize())", "metadata": "root.SurpriseTaskPanel.addDefaultProperties", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 145 }, { "content": " def onPropertyChanged(self, propertySet, propertyName):\n if propertyName == 'Hand':\n self.planner.side = self.getSide()\n\n self.syncProperties()", "metadata": "root.SurpriseTaskPanel.onPropertyChanged", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 151 }, { "content": " def syncProperties(self):\n self.maxDegreesPerSecond = self.params.getProperty('max degrees per second')", "metadata": "root.SurpriseTaskPanel.syncProperties", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 157 }, { "content": " def setParamsPreTeleop(self):\n self.params.setProperty('max degrees per second', 30)", "metadata": "root.SurpriseTaskPanel.setParamsPreTeleop", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 160 }, { "content": " def setParamsTeleop(self):\n self.params.setProperty('max degrees per second', 10)", "metadata": "root.SurpriseTaskPanel.setParamsTeleop", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 163 }, { "content": " def addTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(name, func, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n prevFolder = self.folder\n addFolder(name, prevFolder)\n addFunc('plan', planFunc)\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc('execute manip plan', self.drillDemo.commitManipPlan)\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n self.folder = prevFolder\n\n\n self.taskTree.removeAllTasks()\n side = self.getSide()\n\n ###############\n # add the tasks\n\n # prep\n # addFolder('Prep')\n # addTask(rt.CloseHand(name='close left hand', side='Left'))\n # addTask(rt.CloseHand(name='close right hand', side='Right'))\n self.addSwitchTasks()", "metadata": "root.SurpriseTaskPanel.addTasks", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 166 }, { "content": " def addSwitchTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(name, func, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n prevFolder = self.folder\n addFolder(name, prevFolder)\n addFunc('plan', planFunc)\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc('execute manip plan', self.switchPlanner.commitManipPlan)\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n self.folder = prevFolder\n\n\n self.taskTree.removeAllTasks()\n side = self.getSide()\n\n addFolder('Fit Box Affordance')\n addFunc('fit switch box affordance', self.fitSwitchBox)\n addTask(rt.UserPromptTask(name='verify/adjust affordance', message='verify/adjust affordance.'))\n\n # walk to drill\n addFolder('Walk')\n addFunc('plan footstep frame', self.switchPlanner.spawnFootstepFrame)\n addTask(rt.RequestFootstepPlan(name='plan walk to drill', stanceFrameName='switch box stance frame'))\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to switch box', planName='switch box stance frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n armsUp = addFolder('Arms Up')\n addManipTask('Arms Up 1', self.switchPlanner.planArmsPrep1, userPrompt=True)\n self.folder = armsUp\n addManipTask('Arms Up 2', self.switchPlanner.planArmsPrep2, userPrompt=True)\n addTask(rt.CloseHand(side='Right', mode='Pinch', name='set finger pinch'))\n reach = addFolder('Reach')\n\n addFunc('set degrees per second 30', self.setParamsPreTeleop)\n addFunc('update reach frame', self.switchPlanner.updateReachFrame)\n addTask(rt.UserPromptTask(name='adjust frame', message='adjust reach frame if necessary'))\n addManipTask('reach above box', self.onPlanPinchReach, userPrompt=True)\n\n teleop = addFolder('Teleop')\n addFunc('set degrees per second 10', self.setParamsTeleop)\n addTask(rt.UserPromptTask(name='wait for teleop', message='continue when finished with task.'))\n\n\n armsDown = addFolder('Arms Down')\n addTask(rt.UserPromptTask(name='check left hand free', message='check left hand free to close and move back'))\n addTask(rt.CloseHand(name='close left hand', side='Right'))\n addManipTask('Arms Down 1', self.switchPlanner.planArmsPrep2, userPrompt=True)\n self.folder = armsDown\n self.folder = armsDown\n addManipTask('Arms Down 2', self.switchPlanner.planArmsPrep1, userPrompt=True)\n self.folder = armsDown\n addManipTask('plan nominal', self.switchPlanner.planNominal, userPrompt=True)", "metadata": "root.SurpriseTaskPanel.addSwitchTasks", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 205 }, { "content": " def fitSwitchBox(self):\n print 'fitting switch box'\n self.fitter.imagePicker.numberOfPoints = 2\n self.fitter.pointCloudSource = 'lidar'\n self.fitter.fitFunc = self.fitter.fitSwitchBox", "metadata": "root.SurpriseTaskPanel.fitSwitchBox", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 275 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import vtkAll as vtk", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 20 }, { "span": "import math", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import time", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import types", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 12 }, { "span": "import functools", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 16 }, { "span": "from director import lcmUtils", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 }, { "span": "from director.timercallback import TimerCallback", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 48 }, { "span": "from director.asynctaskqueue import AsyncTaskQueue", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 50 }, { "span": "from director import applogic as app", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 36 }, { "span": "from director.debugVis import DebugData", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 39 }, { "span": "from director import ikplanner", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 30 }, { "span": "from director.ikparameters import IkParameters", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 46 }, { "span": "from director import ioUtils", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 28 }, { "span": "from director.simpletimer import SimpleTimer", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 44 }, { "span": "from director.utime import getUtime", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 35 }, { "span": "from director import affordanceitems", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 36 }, { "span": "from director import robotstate", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 31 }, { "span": "from director import robotplanlistener", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 38 }, { "span": "from director import planplayback", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 33 }, { "span": "from director import affordanceupdater", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 38 }, { "span": "from director import segmentationpanel", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 38 }, { "span": "from director import vtkNumpy as vnp", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 36 }, { "span": "import director.tasks.taskmanagerwidget as tmw", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 46 }, { "span": "import drc as lcmdrc", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 20 }, { "span": "import copy", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 11 }, { "span": "from PythonQt import QtCore, QtGui", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vtk", "All_", "as_", "vtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "director_", "import_", "transform", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "timer", "callback_", "import_", "Time", "r", "Callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "async", "task", "queue_", "import_", "Async", "Task", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "object", "model_", "as_", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "visualization", "_", "as_", "vis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "appl", "ogi", "c_", "as_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "debug", "Vis", "_", "import_", "Deb", "ug", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik", "planner", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "ik", "parameters_", "import_", "Ik", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "io", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "simple", "timer_", "import_", "Simple", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "utime", "_", "import_", "get", "Ut", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "aff", "orda", "nce", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robots", "tate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robot", "plan", "listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "segmentation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "plan", "playback", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "aff", "orda", "nce", "updater_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "segmentation", "panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "vtk", "Num", "py_", "as_", "vn", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "switch", "planner", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "director_", "._", "tasks_", "._", "task", "userp", "ane", "l_", "import_", "Task", "User", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "tasks_", "._", "task", "userp", "ane", "l_", "import_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "director_", "._", "tasks_", "._", "robot", "tasks_", "as_", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "director_", "._", "tasks_", "._", "task", "manage", "rw", "idge", "t_", "as_", "tm", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dr", "c_", "as_", "lcm", "dr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Pyth", "on", "Qt_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Sur", "pris", "e", "Task", "Plann", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Plann", "er_", "(_", "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_", ",_", "robot", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "robot", "System_", "=_", "robot", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "robot", "Model_", "=_", "robot", "System_", "._", "robot", "State", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "=_", "robot", "System_", "._", "ik", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock", "Back", "For", "Mani", "p_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock", "Base", "For", "Mani", "p_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "side_", "=_", "'", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tool", "Tip", "To", "Hand", "Frame_", "=_", "robot", "System_", "._", "ik", "Plann", "er_", "._", "new", "Pal", "m", "Off", "set", "Gra", "sp", "To", "Hand", "Frame_", "(_", "self_", "._", "side_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\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_", ",_", "switch", "Plann", "er_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "switch", "Plann", "er_", "=_", "switch", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fit", "Func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "Line", "Radius_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "Near", "est", "To", "Camera_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "use", "Local", "Plan", "e", "Fit_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "Vo", "xel", "Grid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit_", "(_", "self_", ",_", "poly", "Data_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "fit", "Func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fit", "Func_", "(_", "poly", "Data_", ",_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Switch", "Box_", "(_", "self_", ",_", "poly", "Data_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "box", "Position_", "=_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Point_", "=_", "points_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "a", " ", "frame", " ", "tha", "t", " ", "is", " ", "aligned", " ", "with", " ", "wall_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Radius_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", ",_", "normal_", "=_", "segmentation_", "._", "appl", "y", "Local", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "points_", "[_", "0_", "]_", ",_", "search", "Radius_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "points_", "[_", "1_", "]_", "-_", "points_", "[_", "0_", "]_", ")_", ",_", "search", "Rad", "ius", "End_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "vis_", "._", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "wall", " ", "plane", " ", "points", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "segmentation_", "._", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "normal_", ",_", "view", "Direction_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normal_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "origin_", "=_", "segmentation_", "._", "compute", "Centro", "id_", "(_", "plane", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translat", "e", " ", "tha", "t", " ", "frame", " ", "to", " ", "the", " ", "box", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "box", "Position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "box", "Frame_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Box", "Aff", "orda", "nce", "At", "Frame_", "(_", "box", "Frame_", ")_", "\\u\\u\\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_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\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_", ",_", "robot", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Task", "User", "Panel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "window", "Title_", "=_", "'", "Sur", "pris", "e", " ", "Task", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "planner", "_", "=_", "Sur", "pris", "e", "Task", "Plann", "er_", "(_", "robot", "System_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "switch", "Plann", "er_", "=_", "switch", "planner", "_", "._", "Switch", "Plann", "er_", "(_", "robot", "System_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fitter", "_", "=_", "Image", "Fitt", "er_", "(_", "self_", "._", "switch", "Plann", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "Image", "View_", "(_", "self_", "._", "fitter", "_", "._", "image", "View_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Default", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Buttons_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Switch", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Buttons_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Manu", "al", "Spacer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "arms", " ", "prep", " ", "1", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "arms", " ", "prep", " ", "2", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "fit", " ", "switch", " ", "box", "'_", ",_", "self_", "._", "fit", "Switch", "Box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "spawn", " ", "switch", " ", "box", " ", "aff", "orda", "nce", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Box", "Aff", "orda", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "spawn", " ", "foot", "step", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Foot", "step", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "reset", " ", "reach", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "update", "Reach", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "add", "Manu", "al", "Butt", "on", "('", "plan", " ", "reach", " ", "to", " ", "reach", " ", "frame", "',", " ", "self", ".", "switch", "Plann", "er", ".", "plan", "Reach", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Reach", " ", "to", " ", "pin", "ch", " ", "reach", " ", "frame", "'_", ",_", "self_", "._", "on", "Plan", "Pin", "ch", "Reach", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Manu", "al", "Button_", "(_", "'", "Commi", "t", " ", "Mani", "p", " ", "Plan", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Plan", "Pin", "ch", "Reach", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Pin", "ch", "Reach", "_", "(_", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "max", "Degrees", "Per", "Second", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Side_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "params_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Hand", "'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Default", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "max", " ", "degr", "ees", " ", "per", " ", "second", "'_", ",_", "10_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "single", "Step_", "=_", "1_", ",_", "decimals_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Hand", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Le", "ft", "'_", ",_", "'", "Rig", "ht", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "set", "Property_", "(_", "'", "Hand", "'_", ",_", "self_", "._", "planner", "_", "._", "side_", "._", "capitalize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "property", "Name_", "==_", "'", "Hand", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "planner", "_", "._", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sync", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sync", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Degrees", "Per", "Second", "_", "=_", "self_", "._", "params_", "._", "get", "Property_", "(_", "'", "max", " ", "degr", "ees", " ", "per", " ", "second", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Param", "s", "Pre", "Tele", "op_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "set", "Property_", "(_", "'", "max", " ", "degr", "ees", " ", "per", " ", "second", "'_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Param", "s", "Tele", "op_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "set", "Property_", "(_", "'", "max", " ", "degr", "ees", " ", "per", " ", "second", "'_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "name_", ",_", "func_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "Folder_", "=_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Folder_", "(_", "name_", ",_", "prev", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", "'_", ",_", "plan", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "info", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "self_", "._", "drill", "Demo", "_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "prev", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prep_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Fold", "er", "('", "Prep", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Task", "(", "rt", ".", "Clos", "e", "Hand", "(", "name", "='", "close", " ", "left", " ", "hand", "',", " ", "side", "='", "Le", "ft", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Task", "(", "rt", ".", "Clos", "e", "Hand", "(", "name", "='", "close", " ", "right", " ", "hand", "',", " ", "side", "='", "Rig", "ht", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Switch", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Switch", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "name_", ",_", "func_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "Folder_", "=_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Folder_", "(_", "name_", ",_", "prev", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", "'_", ",_", "plan", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "info", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "prev", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Folder_", "(_", "'", "Fit", " ", "Box", " ", "Aff", "orda", "nce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "fit", " ", "switch", " ", "box", " ", "aff", "orda", "nce", "'_", ",_", "self_", "._", "fit", "Switch", "Box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "verify", "/", "adjust", " ", "aff", "orda", "nce", "'_", ",_", "message_", "=_", "'", "verify", "/", "adjust", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk", " ", "to", " ", "drill", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Folder_", "(_", "'", "Walk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", " ", "foot", "step", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Foot", "step", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Request", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "to", " ", "drill", "'_", ",_", "stance", "Frame", "Name_", "=_", "'", "switch", " ", "box", " ", "stance", " ", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "switch", " ", "box", "'_", ",_", "plan", "Name_", "=_", "'", "switch", " ", "box", " ", "stance", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arms", "Up_", "=_", "add", "Folder_", "(_", "'", "Arm", "s", " ", "Up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Up", " ", "1", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "1_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Up", " ", "2", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "2_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "side_", "=_", "'", "Rig", "ht", "'_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ",_", "name_", "=_", "'", "set", " ", "finger", " ", "pin", "ch", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reach", "_", "=_", "add", "Folder_", "(_", "'", "Reach", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Func_", "(_", "'", "set", " ", "degr", "ees", " ", "per", " ", "second", " ", "30", "'_", ",_", "self_", "._", "set", "Param", "s", "Pre", "Tele", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "update", " ", "reach", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "update", "Reach", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "adjust", " ", "frame", "'_", ",_", "message_", "=_", "'", "adjust", " ", "reach", " ", "frame", " ", "if", " ", "necessar", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "reach", " ", "above", " ", "box", "'_", ",_", "self_", "._", "on", "Plan", "Pin", "ch", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tele", "op_", "=_", "add", "Folder_", "(_", "'", "Tele", "op", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "set", " ", "degr", "ees", " ", "per", " ", "second", " ", "10", "'_", ",_", "self_", "._", "set", "Param", "s", "Tele", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "tele", "op", "'_", ",_", "message_", "=_", "'", "continue", " ", "whe", "n", " ", "finish", "ed", " ", "with", " ", "task", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arms", "Down_", "=_", "add", "Folder_", "(_", "'", "Arm", "s", " ", "Down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "check", " ", "left", " ", "hand", " ", "free", "'_", ",_", "message_", "=_", "'", "check", " ", "left", " ", "hand", " ", "free", " ", "to", " ", "close", " ", "and", " ", "move", " ", "back", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Down", " ", "1", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "2_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Down", " ", "2", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "1_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "plan", " ", "nominal", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Nomi", "nal_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Switch", "Box_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "fitting", " ", "switch", " ", "box", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fitter", "_", "._", "image", "Picke", "r_", "._", "number", "Of", "Points_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fitter", "_", "._", "point", "Cloud", "Source_", "=_", "'", "lida", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fitter", "_", "._", "fit", "Func_", "=_", "self_", "._", "fitter", "_", "._", "fit", "Switch", "Box_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/gadget/guest.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport re\nimport pwd\nimport os.path\nimport glob\nimport time\n\nimport web\n\nimport karesansui\nfrom karesansui.lib.rest import Rest, auth\nfrom karesansui.lib.const import ICON_DIR_TPL, \\\n VIRT_COMMAND_CREATE_GUEST, VIRT_COMMAND_REPLICATE_GUEST, \\\n VIRT_COMMAND_DELETE_GUEST, \\\n GRAPHICS_PORT_MIN_NUMBER, PORT_MAX_NUMBER, \\\n MEMORY_MIN_SIZE, DISK_MIN_SIZE, \\\n VIRT_DOMAINS_DIR, DEFAULT_KEYMAP\n\nfrom karesansui.lib.const import XEN_KEYMAP_DIR, KVM_KEYMAP_DIR, KVM_BRIDGE_PREFIX\n\nfrom karesansui.lib.utils import comma_split, \\\n generate_mac_address, is_param, \\\n next_number, generate_uuid, string_from_uuid, uniq_sort, \\\n uni_force, get_partition_info, chk_create_disk, json_dumps, \\\n get_ifconfig_info, get_keymaps, available_virt_mechs, \\\n available_virt_uris, is_iso9660_filesystem_format, \\\n get_dom_list, get_dom_type, base64_encode, \\\n uri_split, uri_join, dict_search\n\nfrom karesansui.lib.utils import get_xml_parse as XMLParse\nfrom karesansui.lib.utils import get_xml_xpath as XMLXpath\nfrom karesansui.lib.utils import get_nums_xml_xpath as XMLXpathNum\nfrom karesansui.lib.file.configfile import ConfigFile\n\nfrom karesansui.lib.checker import Checker, \\\n CHECK_EMPTY, CHECK_VALID, CHECK_LENGTH, CHECK_ONLYSPACE, \\\n CHECK_MIN, CHECK_MAX, CHECK_EXIST\n\nfrom karesansui.lib.const import \\\n NOTE_TITLE_MIN_LENGTH, NOTE_TITLE_MAX_LENGTH, \\\n MACHINE_NAME_MIN_LENGTH, MACHINE_NAME_MAX_LENGTH, \\\n TAG_MIN_LENGTH, TAG_MAX_LENGTH, \\\n GRAPHICS_PORT_MIN_NUMBER, GRAPHICS_PORT_MAX_NUMBER, \\\n HYPERVISOR_MIN_SIZE, HYPERVISOR_MAX_SIZE, \\\n MEMORY_MIN_SIZE, DISK_MIN_SIZE, \\\n DOMAIN_NAME_MIN_LENGTH, DOMAIN_NAME_MAX_LENGTH, \\\n MACHINE_HYPERVISOR, MACHINE_ATTRIBUTE, \\\n DISK_QEMU_FORMAT, DISK_NON_QEMU_FORMAT, \\\n VIRT_COMMAND_CREATE_STORAGE_VOLUME, \\\n VIRT_COMMAND_DELETE_STORAGE_VOLUME, STORAGE_VOLUME_PWD, \\\n DISK_USES\n\nfrom karesansui.lib.virt.virt import KaresansuiVirtConnection, KaresansuiVirtConnectionAuth\nfrom karesansui.lib.virt.config_export import ExportConfigParam\n\nfrom karesansui.lib.merge import MergeGuest, MergeHost\n\nfrom karesansui.db.access.machine import \\\n findbyhost1guestall, findbyhost1, \\\n findbyguest1, \\\n new as m_new, save as m_save, delete as m_delete\n\nfrom karesansui.db.access.machine2jobgroup import new as m2j_new, save as m2j_save\nfrom karesansui.db.access.notebook import new as n_new\n#from karesansui.db.access.tag import new as t_new, samecount as t_count, findby1name as t_name\nfrom karesansui.db.access.tag import new as t_new, samecount as t_count, findby1name as t_name\nfrom karesansui.db.access._2pysilhouette import jg_save, jg_delete\nfrom karesansui.db.model._2pysilhouette import Job, JobGroup\n\nfrom pysilhouette.command import dict2command\n\n\n\n# public method\n\n\n\nurls = (\n '/host/(\\d+)/guest/?(\\.part|\\.json)$', Guest,\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def validates_guest_add(obj):\n checker = Checker()\n check = True\n\n _ = obj._\n checker.errors = []\n\n if not is_param(obj.input, 'm_name'):\n check = False\n checker.add_error(_('Parameter m_name does not exist.'))\n else:\n check = checker.check_string(\n _('Machine Name'),\n obj.input.m_name,\n CHECK_EMPTY | CHECK_LENGTH | CHECK_ONLYSPACE,\n None,\n min = MACHINE_NAME_MIN_LENGTH,\n max = MACHINE_NAME_MAX_LENGTH,\n ) and check\n\n if is_param(obj.input, 'note_title'):\n check = checker.check_string(\n _('Title'),\n obj.input.note_title,\n CHECK_LENGTH | CHECK_ONLYSPACE,\n None,\n min = NOTE_TITLE_MIN_LENGTH,\n max = NOTE_TITLE_MAX_LENGTH,\n ) and check\n\n if is_param(obj.input, 'note_value'):\n check = checker.check_string(\n _('Note'),\n obj.input.note_value,\n CHECK_ONLYSPACE,\n None,\n None,\n None,\n ) and check\n\n if is_param(obj.input, 'tags'):\n for tag in comma_split(obj.input.tags):\n check = checker.check_string(\n _('Tag'),\n tag,\n CHECK_LENGTH | CHECK_ONLYSPACE,\n None,\n min = TAG_MIN_LENGTH,\n max = TAG_MAX_LENGTH,\n ) and check\n\n\n if not is_param(obj.input, 'm_hypervisor'):\n check = False\n checker.add_error(_('Parameter m_hypervisor does not exist.'))\n else:\n check = checker.check_hypervisor(\n _('Hypervisor'),\n obj.input.m_hypervisor,\n CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,\n HYPERVISOR_MIN_SIZE,\n HYPERVISOR_MAX_SIZE,\n ) and check\n\n if not is_param(obj.input, 'domain_name'):\n check = False\n checker.add_error(_('Parameter domain_name does not exist.'))\n else:\n check = checker.check_string(\n _('Domain Name'),\n obj.input.domain_name,\n CHECK_EMPTY | CHECK_VALID | CHECK_LENGTH | CHECK_ONLYSPACE,\n '[^-a-zA-Z0-9_\\.]+',\n DOMAIN_NAME_MIN_LENGTH,\n DOMAIN_NAME_MAX_LENGTH,\n ) and check\n\n if obj.input.domain_name in get_dom_list():\n dom_type = get_dom_type(obj.input.domain_name)\n checker.add_error(_(\"The same domain name already exists for hypervisor '%s'.\") % dom_type.upper())\n check = False\n\n if is_param(obj.input, 'vm_mem_size'):\n check = checker.check_number(\n _('Memory Size (MB)'),\n obj.input.vm_mem_size,\n CHECK_VALID | CHECK_MIN | CHECK_EMPTY,\n MEMORY_MIN_SIZE,\n None,\n ) and check\n\n if is_param(obj.input, 'pool_type'):\n if obj.input.pool_type != \"block\":\n if is_param(obj.input, 'vm_disk_size'):\n check = checker.check_number(\n _('Disk Size (MB)'),\n obj.input.vm_disk_size,\n CHECK_VALID | CHECK_MIN | CHECK_EMPTY,\n DISK_MIN_SIZE,\n None,\n ) and check\n\n if not is_param(obj.input, 'boot_image'):\n check = False\n checker.add_error(_('Parameter boot_image does not exist.'))\n else:\n if obj.input.boot_image == \"kernel\":\n if not is_param(obj.input, 'vm_kernel'):\n check = False\n checker.add_error(_('Parameter vm_kernel does not exist.'))\n else:\n check = checker.check_startfile(\n _('Kernel Image'),\n obj.input.vm_kernel,\n CHECK_EMPTY | CHECK_VALID | CHECK_EXIST,\n ) and check\n\n if not is_param(obj.input, 'vm_initrd'):\n check = False\n checker.add_error(_('Parameter vm_initrd does not exist.'))\n else:\n check = checker.check_startfile(\n _('Initrd Image'),\n obj.input.vm_initrd,\n CHECK_EMPTY | CHECK_VALID | CHECK_EXIST,\n ) and check\n\n if obj.input.boot_image == \"iso\":\n if not is_param(obj.input, 'vm_iso'):\n check = False\n checker.add_error(_('Parameter vm_iso does not exist.'))\n else:\n check = checker.check_startfile(\n _('ISO Image'),\n obj.input.vm_iso,\n CHECK_EMPTY | CHECK_VALID | CHECK_EXIST,\n ) and check\n if check:\n check = is_iso9660_filesystem_format(obj.input.vm_iso)\n checker.add_error(_('\"%s\" is not valid ISO 9660 CD-ROM filesystem data.') % obj.input.vm_iso)\n\n if not is_param(obj.input, 'keymap'):\n check = False\n checker.add_error(_('\"%s\" is required.') % _('Graphics Keymap'))\n else:\n hypervisor = \"KVM\"\n if int(obj.input.m_hypervisor) == MACHINE_HYPERVISOR['XEN']:\n hypervisor = \"XEN\"\n elif int(obj.input.m_hypervisor) == MACHINE_HYPERVISOR['KVM']:\n hypervisor = \"KVM\"\n check = checker.check_keymap(\n _('Graphics Keymap'),\n obj.input.keymap,\n CHECK_EMPTY | CHECK_EXIST,\n hypervisor\n ) and check\n\n if not is_param(obj.input, 'vm_graphics_port'):\n check = False\n checker.add_error(_('Parameter vm_graphics_port does not exist.'))\n else:\n check = checker.check_number(\n _('Graphics Port Number'),\n obj.input.vm_graphics_port,\n CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,\n GRAPHICS_PORT_MIN_NUMBER,\n GRAPHICS_PORT_MAX_NUMBER,\n ) and check\n\n if not is_param(obj.input, 'vm_mac'):\n check = False\n checker.add_error(_('Parameter vm_mac does not exist.'))\n else:\n check = checker.check_macaddr(\n _('MAC Address'),\n obj.input.vm_mac,\n CHECK_EMPTY | CHECK_VALID,\n ) and check\n\n obj.view.alert = checker.errors\n return check", "metadata": "root.validates_guest_add", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def make_storage_volume_job(uuid, name, pool_name, format,\n capacity, allocation, unit, order):\n cmdname = u\"Create Storage Volume\"\n cmd = VIRT_COMMAND_CREATE_STORAGE_VOLUME\n\n options = {}\n options['volume_name'] = uuid\n options['name'] = name\n options['pool_name'] = pool_name\n options['format'] = format\n options['capacity'] = capacity\n options['allocation'] = allocation\n options['unit'] = unit\n options['permission_owner'] = pwd.getpwnam(STORAGE_VOLUME_PWD[\"OWNER\"])[2]\n options['permission_group'] = pwd.getpwnam(STORAGE_VOLUME_PWD[\"GROUP\"])[2]\n options['permission_mode'] = STORAGE_VOLUME_PWD[\"MODE\"]\n options['use'] = DISK_USES[\"IMAGES\"]\n\n _cmd = dict2command(\n \"%s/%s\" % (karesansui.config['application.bin.dir'], cmd), options)\n\n rollback_options = {}\n #rollback_options[\"name\"] = name\n rollback_options[\"name\"] = uuid\n rollback_options[\"pool_name\"] = pool_name\n rollback_options[\"use\"] = DISK_USES[\"IMAGES\"]\n\n rollback_cmd = dict2command(\n \"%s/%s\" % (karesansui.config['application.bin.dir'], VIRT_COMMAND_DELETE_STORAGE_VOLUME),\n rollback_options)\n\n _job = Job('%s command' % cmdname, order, _cmd)\n # delete_guestコマンドが削除まで担当してくれるので、ここではロールバックコマンドを設定しない。\n #_job.rollback_command = rollback_cmd\n return _job", "metadata": "root.make_storage_volume_job", "header": "['module', '___EOS___']", "index": 279 }, { "content": "def regist_guest(obj, _guest, icon_filename,\n cmd, options, cmdname, rollback_options, is_create=False):\n\n if icon_filename:\n _guest.icon = icon_filename\n\n if (karesansui.sheconf.has_key('env.uniqkey') is False) \\\n or (karesansui.sheconf['env.uniqkey'].strip('') == ''):\n raise \n\n action_cmd = dict2command(\n \"%s/%s\" % (karesansui.config['application.bin.dir'], cmd),\n options)\n\n rollback_cmd = dict2command(\n \"%s/%s\" % (karesansui.config['application.bin.dir'], VIRT_COMMAND_DELETE_GUEST),\n rollback_options)\n\n _jobgroup = JobGroup(cmdname[0], karesansui.sheconf['env.uniqkey'])\n\n # create volume job\n order = 0\n if is_create is True:\n _volume_job = make_storage_volume_job(options[\"uuid\"],\n options[\"storage-volume\"],\n options[\"storage-pool\"],\n options[\"disk-format\"],\n options[\"disk-size\"],\n options[\"disk-size\"],\n 'M',\n order\n )\n\n order += 1\n _jobgroup.jobs.append(_volume_job)\n\n\n _job = Job('%s command' % cmdname[1], order, action_cmd)\n _job.rollback_command = rollback_cmd\n _jobgroup.jobs.append(_job)\n\n # GuestOS INSERT\n try:\n m_save(obj.orm, _guest)\n obj.orm.commit()\n except:\n obj.logger.error('Failed to register the Guest OS. #1 - guest name=%s' \\\n % _guest.name)\n raise # throw\n\n # JobGroup INSERT\n try:\n jg_save(obj.pysilhouette.orm, _jobgroup)\n obj.pysilhouette.orm.commit()\n except:\n # rollback(machine)\n obj.logger.error('Failed to register the JobGroup. #2 - jobgroup name=%s' \\\n % _jobgroup.name)\n\n try:\n m_delete(obj.orm, _guest)\n obj.orm.commit()\n obj.logger.error('#3 Rollback successful. - guest id=%d' % _guest.id)\n except:\n obj.logger.critical('#4 Rollback failed. - guest id=%d' % _guest.id)\n raise\n\n raise # throw\n\n # Machine2JobGroup INSERT\n try:\n _m2j = m2j_new(machine=_guest,\n jobgroup_id=_jobgroup.id,\n uniq_key=karesansui.sheconf['env.uniqkey'],\n created_user=obj.me,\n modified_user=obj.me,\n )\n m2j_save(obj.orm, _m2j)\n obj.orm.commit()\n except:\n # rollback(machine, jobgroup)\n try:\n m_delete(obj.orm, _guest)\n obj.orm.commit()\n except:\n # rollback(machine)\n obj.logger.critical('Failed to register the Machine. #5 - guest id=%d' \\\n % _guest.id)\n try:\n jg_delete(obj.pysilhouette.orm, _jobgroup)\n obj.pysilhouette.orm.commit()\n except:\n # rollback(jobgroup)\n obj.logger.critical('Failed to register the JobGroup. #6 - jobgroup id=%d' \\\n % _jobgroup.id)\n raise # throw\n\n return True", "metadata": "root.regist_guest", "header": "['module', '___EOS___']", "index": 315 }, { "content": "class Guest(Rest):\n\n\n", "metadata": "root.Guest", "header": "['module', '___EOS___']", "index": 414 }, { "content": " def _post(self, f):\n ret = Rest._post(self, f)\n if hasattr(self, \"kvc\") is True:\n self.kvc.close()\n return ret", "metadata": "root.Guest._post", "header": "['class', 'Guest', '(', 'Rest', ')', ':', '___EOS___']", "index": 416 }, { "content": " @auth\n def _GET(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n model = findbyhost1(self.orm, host_id)\n uris = available_virt_uris()\n\n #import pdb; pdb.set_trace()\n if model.attribute == MACHINE_ATTRIBUTE[\"URI\"]:\n uri_guests = []\n uri_guests_status = {}\n uri_guests_kvg = {}\n uri_guests_info = {}\n uri_guests_name = {}\n segs = uri_split(model.hostname)\n uri = uri_join(segs, without_auth=True)\n creds = ''\n if segs[\"user\"] is not None:\n creds += segs[\"user\"]\n if segs[\"passwd\"] is not None:\n creds += ':' + segs[\"passwd\"]\n\n # Output .part\n if self.is_mode_input() is not True:\n try:\n self.kvc = KaresansuiVirtConnectionAuth(uri,creds)\n host = MergeHost(self.kvc, model)\n for guest in host.guests:\n\n _virt = self.kvc.search_kvg_guests(guest.info[\"model\"].name)\n if 0 < len(_virt):\n for _v in _virt:\n uuid = _v.get_info()[\"uuid\"]\n uri_guests_info[uuid] = guest.info\n uri_guests_kvg[uuid] = _v\n uri_guests_name[uuid] = guest.info[\"model\"].name.encode(\"utf8\")\n\n for name in sorted(uri_guests_name.values(),key=str.lower):\n for uuid in dict_search(name,uri_guests_name):\n uri_guests.append(MergeGuest(uri_guests_info[uuid][\"model\"], uri_guests_kvg[uuid]))\n uri_guests_status[uuid] = uri_guests_info[uuid]['virt'].status()\n\n finally:\n self.kvc.close()\n\n # .json\n if self.is_json() is True:\n guests_json = []\n for x in uri_guests:\n guests_json.append(x.get_json(self.me.languages))\n\n self.view.uri_guests = json_dumps(guests_json)\n else:\n self.view.uri_guests = uri_guests\n self.view.uri_guests_status = uri_guests_status\n\n self.kvc = KaresansuiVirtConnection()\n try: # libvirt connection scope -->\n\n # Storage Pool\n #inactive_pool = self.kvc.list_inactive_storage_pool()\n inactive_pool = []\n active_pool = self.kvc.list_active_storage_pool()\n pools = inactive_pool + active_pool\n pools.sort()\n\n if not pools:\n return web.badrequest('One can not start a storage pool.')\n\n # Output .input\n if self.is_mode_input() is True:\n self.view.pools = pools\n pools_info = {}\n pools_vols_info = {}\n pools_iscsi_blocks = {}\n already_vols = []\n guests = []\n\n guests += self.kvc.list_inactive_guest()\n guests += self.kvc.list_active_guest()\n for guest in guests:\n already_vol = self.kvc.get_storage_volume_bydomain(domain=guest,\n image_type=None,\n attr='path')\n if already_vol:\n already_vols += already_vol.keys()\n\n for pool in pools:\n pool_obj = self.kvc.search_kvn_storage_pools(pool)[0]\n if pool_obj.is_active() is True:\n pools_info[pool] = pool_obj.get_info()\n\n blocks = None\n if pools_info[pool]['type'] == 'iscsi':\n blocks = self.kvc.get_storage_volume_iscsi_block_bypool(pool)\n if blocks:\n pools_iscsi_blocks[pool] = []\n vols_obj = pool_obj.search_kvn_storage_volumes(self.kvc)\n vols_info = {}\n\n for vol_obj in vols_obj:\n vol_name = vol_obj.get_storage_volume_name()\n vols_info[vol_name] = vol_obj.get_info()\n if blocks:\n if vol_name in blocks and vol_name not in already_vols:\n pools_iscsi_blocks[pool].append(vol_obj.get_info())\n\n pools_vols_info[pool] = vols_info\n\n self.view.pools_info = pools_info\n self.view.pools_vols_info = pools_vols_info\n self.view.pools_iscsi_blocks = pools_iscsi_blocks\n\n bridge_prefix = {\n \"XEN\":\"xenbr\",\n \"KVM\":KVM_BRIDGE_PREFIX,\n }\n self.view.host_id = host_id\n self.view.DEFAULT_KEYMAP = DEFAULT_KEYMAP\n self.view.DISK_NON_QEMU_FORMAT = DISK_NON_QEMU_FORMAT\n self.view.DISK_QEMU_FORMAT = DISK_QEMU_FORMAT\n\n self.view.hypervisors = {}\n self.view.mac_address = {}\n self.view.keymaps = {}\n self.view.phydev = {}\n self.view.virnet = {}\n\n used_ports = {}\n\n for k,v in MACHINE_HYPERVISOR.iteritems():\n if k in available_virt_mechs():\n self.view.hypervisors[k] = v\n uri = uris[k]\n mem_info = self.kvc.get_mem_info()\n active_networks = self.kvc.list_active_network()\n used_graphics_ports = self.kvc.list_used_graphics_port()\n bus_types = self.kvc.bus_types\n self.view.bus_types = bus_types\n self.view.max_mem = mem_info['host_max_mem']\n self.view.free_mem = mem_info['host_free_mem']\n self.view.alloc_mem = mem_info['guest_alloc_mem']\n\n self.view.mac_address[k] = generate_mac_address(k)\n self.view.keymaps[k] = eval(\"get_keymaps(%s_KEYMAP_DIR)\" % k)\n\n # Physical device\n phydev = []\n phydev_regex = re.compile(r\"%s\" % bridge_prefix[k])\n for dev,dev_info in get_ifconfig_info().iteritems():\n try:\n if phydev_regex.match(dev):\n phydev.append(dev)\n except:\n pass\n if len(phydev) == 0:\n phydev.append(\"%s0\" % bridge_prefix[k])\n phydev.sort()\n self.view.phydev[k] = phydev # Physical device\n\n # Virtual device\n self.view.virnet[k] = sorted(active_networks)\n used_ports[k] = used_graphics_ports\n\n\n exclude_ports = []\n for k, _used_port in used_ports.iteritems():\n exclude_ports = exclude_ports + _used_port\n exclude_ports = sorted(exclude_ports)\n exclude_ports = [p for p, q in zip(exclude_ports, exclude_ports[1:] + [None]) if p != q]\n self.view.graphics_port = next_number(GRAPHICS_PORT_MIN_NUMBER,\n PORT_MAX_NUMBER,\n exclude_ports)\n\n else: # .part\n models = findbyhost1guestall(self.orm, host_id)\n guests = []\n if models:\n # Physical Guest Info\n self.view.hypervisors = {}\n for model in models:\n for k,v in MACHINE_HYPERVISOR.iteritems():\n if k in available_virt_mechs():\n self.view.hypervisors[k] = v\n uri = uris[k]\n if hasattr(self, \"kvc\") is not True:\n self.kvc = KaresansuiVirtConnection(uri)\n domname = self.kvc.uuid_to_domname(model.uniq_key)\n #if not domname: return web.conflict(web.ctx.path)\n _virt = self.kvc.search_kvg_guests(domname)\n if 0 < len(_virt):\n guests.append(MergeGuest(model, _virt[0]))\n else:\n guests.append(MergeGuest(model, None))\n\n # Exported Guest Info\n exports = {}\n for pool_name in pools:\n files = []\n\n pool = self.kvc.search_kvn_storage_pools(pool_name)\n path = pool[0].get_info()[\"target\"][\"path\"]\n\n if os.path.exists(path):\n for _afile in glob.glob(\"%s/*/info.dat\" % (path,)):\n param = ExportConfigParam()\n param.load_xml_config(_afile)\n\n _dir = os.path.dirname(_afile)\n\n uuid = param.get_uuid()\n name = param.get_domain()\n created = param.get_created()\n title = param.get_title()\n if title != \"\":\n title = re.sub(\"[\\r\\n]\",\"\",title)\n if title == \"\":\n title = _('untitled')\n\n if created != \"\":\n created_str = time.strftime(\"%Y/%m/%d %H:%M:%S\", \\\n time.localtime(float(created)))\n else:\n created_str = _(\"N/A\")\n\n files.append({\"dir\": _dir,\n \"pool\" : pool_name,\n #\"b64dir\" : base64_encode(_dir),\n \"uuid\" : uuid,\n \"name\" : name,\n \"created\" : int(created),\n \"created_str\" : created_str,\n \"title\" : title,\n \"icon\" : param.get_database()[\"icon\"],\n })\n\n exports[pool_name] = files\n\n # .json\n if self.is_json() is True:\n guests_json = []\n for x in guests:\n guests_json.append(x.get_json(self.me.languages))\n\n self.view.guests = json_dumps(guests_json)\n else:\n self.view.exports = exports\n self.view.guests = guests\n\n return True\n except:\n pass\n finally:\n #self.kvc.close()\n pass # libvirt connection scope --> Guest#_post()", "metadata": "root.Guest._GET", "header": "['class', 'Guest', '(', 'Rest', ')', ':', '___EOS___']", "index": 422 }, { "content": " @auth\n def _POST(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n model = findbyhost1(self.orm, host_id)\n if model.attribute == 0 and model.hypervisor == MACHINE_HYPERVISOR[\"XEN\"]:\n uri = uris[\"XEN\"]\n elif model.attribute == 0 and model.hypervisor == MACHINE_HYPERVISOR[\"KVM\"]:\n uri = uris[\"KVM\"]\n else:\n uri = None\n\n if not validates_guest_add(self):\n return web.badrequest(self.view.alert)\n\n try:\n try:\n self.kvc = KaresansuiVirtConnection(uri)\n active_guests = self.kvc.list_active_guest()\n inactive_guests = self.kvc.list_inactive_guest()\n used_graphics_ports = self.kvc.list_used_graphics_port()\n used_mac_addrs = self.kvc.list_used_mac_addr()\n mem_info = self.kvc.get_mem_info()\n\n if is_param(self.input, \"vm_mem_size\"):\n if mem_info['host_free_mem'] < int(self.input.vm_mem_size):\n return web.badrequest(_(\"Space not enough to allocate guest memory.\"))\n\n if is_param(self.input, \"pool_type\") and \\\n self.input.pool_type != \"block\" and \\\n is_param(self.input, \"pool_dir\"):\n target_path = self.kvc.get_storage_pool_targetpath(self.input.pool_dir)\n if target_path: # disk\n if not chk_create_disk(target_path, self.input.vm_disk_size):\n partition = get_partition_info(target_path, header=False)\n return web.badrequest(_(\"No space available to create disk image in '%s' partition.\") % partition[5][0])\n except:\n raise\n finally:\n del self.kvc\n\n # Check on whether value has already been used\n # Guest OS\n if (self.input.domain_name in active_guests) \\\n or (self.input.domain_name in inactive_guests):\n return web.conflict(web.ctx.path, \"Guest OS is already there.\")\n # Graphics Port Number\n if(int(self.input.vm_graphics_port) in used_graphics_ports):\n return web.conflict(web.ctx.path, \"Graphics Port is already there.\")\n # MAC Address\n if(self.input.vm_mac in used_mac_addrs):\n return web.conflict(web.ctx.path, \"MAC Address is already there.\")\n\n uuid = string_from_uuid(generate_uuid())\n\n options = {}\n options['uuid'] = uuid\n\n if is_param(self.input, \"domain_name\"):\n options['name'] = self.input.domain_name\n if is_param(self.input, \"vm_mem_size\"):\n options['mem-size'] = self.input.vm_mem_size\n if is_param(self.input, \"vm_kernel\"):\n options['kernel'] = self.input.vm_kernel\n if is_param(self.input, \"vm_initrd\"):\n options['initrd'] = self.input.vm_initrd\n if is_param(self.input, \"vm_iso\"):\n options['iso'] = self.input.vm_iso\n if is_param(self.input, \"keymap\"):\n options['keymap'] = self.input.keymap\n\n is_create = False\n if is_param(self.input, \"pool_type\"):\n if is_param(self.input, \"bus_type\"):\n options['bus'] = self.input.bus_type\n\n if self.input.pool_type == \"dir\" or self.input.pool_type == \"fs\": # create volume\n is_create = True\n options['disk-format'] = self.input.disk_format\n options[\"storage-pool\"] = self.input.pool_dir\n options[\"storage-volume\"] = options['name'] # default domain name\n options['disk-size'] = self.input.vm_disk_size\n\n elif self.input.pool_type == \"block\": # iscsi block device\n (iscsi_pool, iscsi_volume) = self.input.pool_dir.split(\"/\", 2)\n options[\"storage-pool\"] = iscsi_pool\n options[\"storage-volume\"] = iscsi_volume\n else:\n return web.badrequest()\n else:\n return web.badrequest()\n\n if is_param(self.input, \"vm_graphics_port\"):\n options['graphics-port'] = self.input.vm_graphics_port\n if is_param(self.input, \"vm_mac\"):\n options['mac'] = self.input.vm_mac\n if is_param(self.input, \"vm_extra\"):\n options['extra'] = self.input.vm_extra\n if is_param(self.input, \"nic_type\"):\n if self.input.nic_type == \"phydev\":\n options['interface-format'] = \"b:\" + self.input.phydev\n elif self.input.nic_type == \"virnet\":\n options['interface-format'] = \"n:\" + self.input.virnet\n\n if int(self.input.m_hypervisor) == MACHINE_HYPERVISOR['XEN']:\n i_hypervisor = MACHINE_HYPERVISOR['XEN']\n options['type'] = u\"XEN\"\n elif int(self.input.m_hypervisor) == MACHINE_HYPERVISOR['KVM']:\n i_hypervisor = MACHINE_HYPERVISOR['KVM']\n options['type'] = u\"KVM\"\n else:\n return web.badrequest(\"This is not the hypervisor.\")\n\n host = findbyhost1(self.orm, host_id)\n\n # notebook\n note_title = None\n if is_param(self.input, \"note_title\"):\n note_title = self.input.note_title\n\n note_value = None\n if is_param(self.input, \"note_value\"):\n note_value = self.input.note_value\n\n _notebook = n_new(note_title, note_value)\n\n # tags\n _tags = None\n if is_param(self.input, \"tags\"):\n _tags = []\n tag_array = comma_split(self.input.tags)\n tag_array = uniq_sort(tag_array)\n for x in tag_array:\n if t_count(self.orm, x) == 0:\n _tags.append(t_new(x))\n else:\n _tags.append(t_name(self.orm, x))\n\n # Icon\n icon_filename = None\n if is_param(self.input, \"icon_filename\", empty=True):\n icon_filename = self.input.icon_filename\n\n _guest = m_new(created_user=self.me,\n modified_user=self.me,\n uniq_key=uni_force(uuid),\n name=self.input.m_name,\n attribute=MACHINE_ATTRIBUTE['GUEST'],\n hypervisor=i_hypervisor,\n notebook=_notebook,\n tags=_tags,\n icon=icon_filename,\n is_deleted=False,\n parent=host,\n )\n\n ret = regist_guest(self,\n _guest,\n icon_filename,\n VIRT_COMMAND_CREATE_GUEST,\n options,\n ('Create Guest', 'Create Guest'),\n {\"name\": options['name'],\n \"pool\" : options[\"storage-pool\"],\n \"volume\" : options[\"uuid\"],\n },\n is_create,\n )\n if ret is True:\n return web.accepted()\n else:\n return False", "metadata": "root.Guest._POST", "header": "['class', 'Guest', '(', 'Rest', ')', ':', '___EOS___']", "index": 679 } ]
[ { "span": "from karesansui.lib.const import ICON_DIR_TPL, \\\n VIRT_COMMAND_CREATE_GUEST, VIRT_COMMAND_REPLICATE_GUEST, \\\n VIRT_COMMAND_DELETE_GUEST, \\\n GRAPHICS_PORT_MIN_NUMBER, PORT_MAX_NUMBER, \\\n MEMORY_MIN_SIZE, DISK_MIN_SIZE, \\\n VIRT_DOMAINS_DIR, DEFAULT_KEYMAP", "start_line": 35, "start_column": 0, "end_line": 40, "end_column": 37 }, { "span": "from karesansui.lib.const import XEN_KEYMAP_DIR, KVM_KEYMAP_DIR, KVM_BRIDGE_PREFIX", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 82 }, { "span": "from karesansui.lib.utils import comma_split, \\\n generate_mac_address, is_param, \\\n next_number, generate_uuid, string_from_uuid, uniq_sort, \\\n uni_force, get_partition_info, chk_create_disk, json_dumps, \\\n get_ifconfig_info, get_keymaps, available_virt_mechs, \\\n available_virt_uris, is_iso9660_filesystem_format, \\\n get_dom_list, get_dom_type, base64_encode, \\\n uri_split, uri_join, dict_search", "start_line": 44, "start_column": 0, "end_line": 51, "end_column": 37 }, { "span": "from karesansui.lib.utils import get_xml_parse as XMLParse", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 58 }, { "span": "from karesansui.lib.utils import get_xml_xpath as XMLXpath", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 58 }, { "span": "from karesansui.lib.utils import get_nums_xml_xpath as XMLXpathNum", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 66 }, { "span": "from karesansui.lib.file.configfile import ConfigFile", "start_line": 56, "start_column": 0, "end_line": 56, "end_column": 53 }, { "span": "from karesansui.db.access.machine import \\\n findbyhost1guestall, findbyhost1, \\\n findbyguest1, \\\n new as m_new, save as m_save, delete as m_delete", "start_line": 81, "start_column": 0, "end_line": 84, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "rest_", "import_", "Rest", "_", ",_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "ICON", "\\u", "DIR", "\\u", "TP", "L_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "GUE", "ST_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "REPLICA", "TE", "\\u", "GUE", "ST_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "GUE", "ST_", ",_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", ",_", "PORT", "\\u", "MAX", "\\u", "NUMBER_", ",_", "MEM", "ORY", "\\u", "MIN", "\\u", "SIZE_", ",_", "DISK", "\\u", "MIN", "\\u", "SIZE_", ",_", "VIR", "T", "\\u", "DOM", "AINS", "\\u", "DIR_", ",_", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "XE", "N", "\\u", "KEY", "MAP", "\\u", "DIR_", ",_", "KV", "M", "\\u", "KEY", "MAP", "\\u", "DIR_", ",_", "KV", "M", "\\u", "BRIDGE", "\\u", "PREFIX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "comma", "\\u", "split_", ",_", "generat", "e\\u", "mac", "\\u", "address_", ",_", "is", "\\u", "param_", ",_", "next", "\\u", "number_", ",_", "generat", "e\\u", "uuid_", ",_", "string", "\\u", "from", "\\u", "uuid_", ",_", "uniq", "\\u", "sort_", ",_", "uni", "\\u", "force_", ",_", "get", "\\u", "partit", "ion", "\\u", "info_", ",_", "chk", "\\u", "create", "\\u", "disk_", ",_", "json", "\\u", "dumps_", ",_", "get", "\\u", "ifconfig", "\\u", "info_", ",_", "get", "\\u", "keymap", "s_", ",_", "avail", "able", "\\u", "virt", "\\u", "mech", "s_", ",_", "avail", "able", "\\u", "virt", "\\u", "uris_", ",_", "is", "\\u", "iso", "966", "0", "\\u", "filesystem", "\\u", "format_", ",_", "get", "\\u", "dom", "\\u", "list_", ",_", "get", "\\u", "dom", "\\u", "type_", ",_", "base64", "\\u", "encode_", ",_", "uri", "\\u", "split_", ",_", "uri", "\\u", "join_", ",_", "dict", "\\u", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "xml", "\\u", "parse_", "as_", "XML", "Parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "nums", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "file_", "._", "configfile_", "import_", "Config", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "checker_", "import_", "Checker_", ",_", "CHECK", "\\u", "EMPTY_", ",_", "CHECK", "\\u", "VALID", "_", ",_", "CHECK", "\\u", "LENGTH_", ",_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "CHECK", "\\u", "MIN_", ",_", "CHECK", "\\u", "MAX_", ",_", "CHECK", "\\u", "EXIST", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "NOTE", "\\u", "TIT", "LE", "\\u", "MIN", "\\u", "LENGTH_", ",_", "NOTE", "\\u", "TIT", "LE", "\\u", "MAX", "\\u", "LENGTH_", ",_", "MACHINE", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", ",_", "MACHINE", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", ",_", "TAG", "\\u", "MIN", "\\u", "LENGTH_", ",_", "TAG", "\\u", "MAX", "\\u", "LENGTH_", ",_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", ",_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MAX", "\\u", "NUMBER_", ",_", "HYP", "ERV", "ISO", "R", "\\u", "MIN", "\\u", "SIZE_", ",_", "HYP", "ERV", "ISO", "R", "\\u", "MAX", "\\u", "SIZE_", ",_", "MEM", "ORY", "\\u", "MIN", "\\u", "SIZE_", ",_", "DISK", "\\u", "MIN", "\\u", "SIZE_", ",_", "DOM", "AIN", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", ",_", "DOM", "AIN", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", ",_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", ",_", "MACHINE", "\\u", "ATTRIBUTE_", ",_", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", ",_", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "STOR", "AGE", "\\u", "VOLUME_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "STOR", "AGE", "\\u", "VOLUME_", ",_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "PWD", "_", ",_", "DISK", "\\u", "USE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "virt_", "import_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", ",_", "Kar", "esa", "nsu", "i", "Virt", "Connect", "ion", "Auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "config", "\\u", "export_", "import_", "Export", "Config", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "merge_", "import_", "Merge", "Gue", "st_", ",_", "Merge", "Host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "find", "by", "host", "1", "guest", "all_", ",_", "find", "by", "host", "1_", ",_", "find", "by", "guest", "1_", ",_", "new_", "as_", "m", "\\u", "new_", ",_", "save_", "as_", "m", "\\u", "save_", ",_", "delete_", "as_", "m", "\\u", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine", "2j", "ob", "group_", "import_", "new_", "as_", "m2", "j", "\\u", "new_", ",_", "save_", "as_", "m2", "j", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "notebook_", "import_", "new_", "as_", "n", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "kar", "esa", "nsu", "i", ".", "db", ".", "access", ".", "tag", " ", "import", " ", "new", " ", "as", " ", "t", "\\u", "new", ",", " ", "same", "count", " ", "as", " ", "t", "\\u", "count", ",", " ", "find", "by", "1", "name", " ", "as", " ", "t", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "tag_", "import_", "new_", "as_", "t", "\\u", "new_", ",_", "same", "count_", "as_", "t", "\\u", "count_", ",_", "find", "by", "1", "name_", "as_", "t", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "\\u", "2py", "sil", "hou", "ette", "_", "import_", "jg", "\\u", "save_", ",_", "jg", "\\u", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "model_", "._", "\\u", "2py", "sil", "hou", "ette", "_", "import_", "Job_", ",_", "Jo", "b", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pys", "il", "hou", "ette", "_", "._", "command_", "import_", "dict2", "command_", "\\u\\u\\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_", "#", " ", "public", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "urls_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "host", "/(", "\\\\", "d", "+)", "/", "guest", "/?", "(\\\\", ".", "part", "|\\\\", ".", "json", ")$'_", ",_", "Gue", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validates", "\\u", "guest", "\\u", "add_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checker_", "=_", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "obj_", "._", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "m", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "m", "\\u", "name", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Machine", " ", "Name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "m", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "LENGTH_", "|_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "=_", "MACHINE", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "=_", "MACHINE", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "note", "\\u", "title", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Tit", "le", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "note", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "LENGTH_", "|_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "=_", "NOTE", "\\u", "TIT", "LE", "\\u", "MIN", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "=_", "NOTE", "\\u", "TIT", "LE", "\\u", "MAX", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "note", "\\u", "value", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Not", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "note", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "tags", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tag_", "in_", "comma", "\\u", "split_", "(_", "obj_", "._", "input_", "._", "tags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Ta", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "LENGTH_", "|_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "=_", "TAG", "\\u", "MIN", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "=_", "TAG", "\\u", "MAX", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\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_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "m", "\\u", "hypervisor", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "m", "\\u", "hypervisor", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "hypervisor", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Hyper", "visor", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "m", "\\u", "hypervisor", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "MIN_", "|_", "CHECK", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "HYP", "ERV", "ISO", "R", "\\u", "MIN", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "HYP", "ERV", "ISO", "R", "\\u", "MAX", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "domain", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "domain", "\\u", "name", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Doma", "in", " ", "Name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "domain", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "LENGTH_", "|_", "CHECK", "\\u", "ONL", "YS", "PACE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'[", "^", "-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u\\\\", ".]+", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOM", "AIN", "\\u", "NAME", "\\u", "MIN", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOM", "AIN", "\\u", "NAME", "\\u", "MAX", "\\u", "LENGTH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj_", "._", "input_", "._", "domain", "\\u", "name_", "in_", "get", "\\u", "dom", "\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom", "\\u", "type_", "=_", "get", "\\u", "dom", "\\u", "type_", "(_", "obj_", "._", "input_", "._", "domain", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "\"", "The", " ", "same", " ", "domain", " ", "name", " ", "alr", "ead", "y", " ", "exist", "s", " ", "for", " ", "hypervisor", " ", "'%", "s", "'.\"_", ")_", "%_", "dom", "\\u", "type_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "mem", "\\u", "size", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "number_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Memo", "ry", " ", "Size", " ", "(", "MB", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "mem", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "MIN_", "|_", "CHECK", "\\u", "EMPTY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MEM", "ORY", "\\u", "MIN", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "pool", "\\u", "type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "._", "input_", "._", "pool", "\\u", "type_", "!=_", "\"", "block", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "disk", "\\u", "size", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "number_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Disk", " ", "Size", " ", "(", "MB", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "disk", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "MIN_", "|_", "CHECK", "\\u", "EMPTY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DISK", "\\u", "MIN", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "boot", "\\u", "image", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "boot", "\\u", "image", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "obj_", "._", "input_", "._", "boot", "\\u", "image_", "==_", "\"", "kernel", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "kernel", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "vm", "\\u", "kernel", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "start", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Kern", "el", " ", "Image", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "kernel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "EXIST", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "initrd", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "vm", "\\u", "initrd", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "start", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Ini", "tr", "d", " ", "Image", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "initrd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "EXIST", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\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_", "obj_", "._", "input_", "._", "boot", "\\u", "image_", "==_", "\"", "iso", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "iso", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "vm", "\\u", "iso", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "start", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "ISO", " ", "Image", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "iso_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "EXIST", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "check_", "=_", "is", "\\u", "iso", "966", "0", "\\u", "filesystem", "\\u", "format_", "(_", "obj_", "._", "input_", "._", "vm", "\\u", "iso_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "not", " ", "valid", " ", "ISO", " ", "966", "0", " ", "CD", "-", "ROM", " ", "filesystem", " ", "data", ".'_", ")_", "%_", "obj_", "._", "input_", "._", "vm", "\\u", "iso_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "keymap", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "require", "d", ".'_", ")_", "%_", "\\u_", "(_", "'", "Graphic", "s", " ", "Key", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hypervisor", "_", "=_", "\"", "KV", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "obj_", "._", "input_", "._", "m", "\\u", "hypervisor", "_", ")_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "XE", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hypervisor", "_", "=_", "\"", "XE", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "int_", "(_", "obj_", "._", "input_", "._", "m", "\\u", "hypervisor", "_", ")_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "KV", "M", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hypervisor", "_", "=_", "\"", "KV", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check_", "=_", "checker_", "._", "check", "\\u", "keymap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Graphic", "s", " ", "Key", "map", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "keymap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "EXIST", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "graphic", "s", "\\u", "port", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "vm", "\\u", "graphic", "s", "\\u", "port", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "number_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Graphic", "s", " ", "Port", " ", "Number", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "graphic", "s", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", "|_", "CHECK", "\\u", "MIN_", "|_", "CHECK", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MAX", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "vm", "\\u", "mac", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'", "Parameter", " ", "vm", "\\u", "mac", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ")_", "\\u\\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_", "=_", "checker_", "._", "check", "\\u", "maca", "ddr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "MAC", " ", "Address", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "vm", "\\u", "mac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "view_", "._", "alert_", "=_", "checker_", "._", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "storage", "\\u", "volume", "\\u", "job_", "(_", "uuid_", ",_", "name_", ",_", "pool", "\\u", "name_", ",_", "format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "capacity_", ",_", "allocation_", ",_", "unit_", ",_", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "name_", "=_", "u", "\"", "Creat", "e", " ", "Stor", "age", " ", "Volume", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "STOR", "AGE", "\\u", "VOLUME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "volume", "\\u", "name", "'_", "]_", "=_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "pool", "\\u", "name", "'_", "]_", "=_", "pool", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "format", "'_", "]_", "=_", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "capacit", "y", "'_", "]_", "=_", "capacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "allocat", "ion", "'_", "]_", "=_", "allocation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "unit", "'_", "]_", "=_", "unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "permissi", "on", "\\u", "owner", "'_", "]_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "PWD", "_", "[_", "\"", "OWNER", "\"_", "]_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "permissi", "on", "\\u", "group", "'_", "]_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "PWD", "_", "[_", "\"", "GROU", "P", "\"_", "]_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "permissi", "on", "\\u", "mode", "'_", "]_", "=_", "STOR", "AGE", "\\u", "VOLUM", "E", "\\u", "PWD", "_", "[_", "\"", "MODE", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "use", "'_", "]_", "=_", "DISK", "\\u", "USE", "S_", "[_", "\"", "IMAGES", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "cmd_", "=_", "dict2", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "bin", ".", "dir", "'_", "]_", ",_", "cmd_", ")_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rollback", "\\u", "options", "[\"", "name", "\"]", " ", "=", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "options_", "[_", "\"", "name", "\"_", "]_", "=_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "options_", "[_", "\"", "pool", "\\u", "name", "\"_", "]_", "=_", "pool", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rollback", "\\u", "options_", "[_", "\"", "use", "\"_", "]_", "=_", "DISK", "\\u", "USE", "S_", "[_", "\"", "IMAGES", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "cmd_", "=_", "dict2", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "bin", ".", "dir", "'_", "]_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "STOR", "AGE", "\\u", "VOLUME_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "job_", "=_", "Job_", "(_", "'%", "s", " ", "command", "'_", "%_", "cmd", "name_", ",_", "order_", ",_", "\\u", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", "\\u", "guest", "\\", "124", "6", "7", ";", "\\", "1251", "0", ";", "\\", "125", "3", "1", ";", "\\", "124", "89", ";", "\\", "123", "64", ";", "\\", "210", "6", "6", ";", "\\", "385", "00", ";", "\\", "124", "14", ";", "\\", "123", "9", "1", ";", "\\", "252", "85", ";", "\\", "244", "03", ";", "\\", "123", "7", "5", ";", "\\", "123", "90", ";", "\\", "123", "6", "7", ";", "\\", "124", "2", "8", ";", "\\", "124", "2", "7", ";", "\\", "123", "98", ";", "\\", "123", "9", "1", ";", "\\", "122", "89", ";", "\\", "123", "7", "1", ";", "\\", "123", "7", "1", ";", "\\", "123", "9", "1", ";", "\\", "123", "9", "9", ";", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "1252", "3", ";", "\\", "124", "96", ";", "\\", "124", "8", "3", ";", "\\", "124", "6", "3", ";", "\\", "124", "6", "7", ";", "\\", "1251", "0", ";", "\\", "125", "3", "1", ";", "\\", "124", "89", ";", "\\", "124", "3", "4", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "123", "7", "5", ";", "\\", "123", "9", "4", ";", "\\", "123", "56", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#\\u", "job", ".", "rollback", "\\u", "command", " ", "=", " ", "rollback", "\\u", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "job_", "\\u\\u\\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_", "regi", "st", "\\u", "guest_", "(_", "obj_", ",_", "\\u", "guest_", ",_", "icon", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", ",_", "options_", ",_", "cmd", "name_", ",_", "rollback", "\\u", "options_", ",_", "is", "\\u", "create_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "icon", "\\u", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "guest_", "._", "icon_", "=_", "icon", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "kar", "esa", "nsu", "i_", "._", "she", "conf_", "._", "has", "\\u", "key_", "(_", "'", "env", ".", "uniq", "key", "'_", ")_", "is_", "False_", ")_", "or_", "(_", "kar", "esa", "nsu", "i_", "._", "she", "conf_", "[_", "'", "env", ".", "uniq", "key", "'_", "]_", "._", "strip_", "(_", "''_", ")_", "==_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action", "\\u", "cmd_", "=_", "dict2", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "bin", ".", "dir", "'_", "]_", ",_", "cmd_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "cmd_", "=_", "dict2", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "bin", ".", "dir", "'_", "]_", ",_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "DELET", "E", "\\u", "GUE", "ST_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rollback", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "job", "group_", "=_", "Jo", "b", "Group_", "(_", "cmd", "name_", "[_", "0_", "]_", ",_", "kar", "esa", "nsu", "i_", "._", "she", "conf_", "[_", "'", "env", ".", "uniq", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "volume", " ", "job_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "create_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "volume", "\\u", "job_", "=_", "make", "\\u", "storage", "\\u", "volume", "\\u", "job_", "(_", "options_", "[_", "\"", "uuid", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "volume", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "pool", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "[_", "\"", "disk", "-", "format", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "[_", "\"", "disk", "-", "size", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "[_", "\"", "disk", "-", "size", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "job", "group_", "._", "jobs_", "._", "append_", "(_", "\\u", "volume", "\\u", "job_", ")_", "\\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", "job_", "=_", "Job_", "(_", "'%", "s", " ", "command", "'_", "%_", "cmd", "name_", "[_", "1_", "]_", ",_", "order_", ",_", "action", "\\u", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "job_", "._", "rollback", "\\u", "command_", "=_", "rollback", "\\u", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "job", "group_", "._", "jobs_", "._", "append_", "(_", "\\u", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gue", "st", "OS", " ", "INSERT", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "save_", "(_", "obj_", "._", "orm_", ",_", "\\u", "guest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "orm_", "._", "commit_", "(_", ")_", "\\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 ", " _", "obj_", "._", "logger_", "._", "error_", "(_", "'", "Fail", "ed", " ", "to", " ", "register", " ", "the", " ", "Gue", "st", " ", "OS", ".", " ", "#", "1", " ", "-", " ", "guest", " ", "name", "=", "%", "s", "'_", "%_", "\\u", "guest_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "#", " ", "throw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Jo", "b", "Group", " ", "INSERT", "_", "\\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 ", " _", "jg", "\\u", "save_", "(_", "obj_", "._", "pys", "il", "hou", "ette", "_", "._", "orm_", ",_", "\\u", "job", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "pys", "il", "hou", "ette", "_", "._", "orm_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rollback", "(", "machine", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "logger_", "._", "error_", "(_", "'", "Fail", "ed", " ", "to", " ", "register", " ", "the", " ", "Jo", "b", "Group", ".", " ", "#", "2", " ", "-", " ", "job", "group", " ", "name", "=", "%", "s", "'_", "%_", "\\u", "job", "group_", "._", "name_", ")_", "\\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 ", " _", "m", "\\u", "delete_", "(_", "obj_", "._", "orm_", ",_", "\\u", "guest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "orm_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "logger_", "._", "error_", "(_", "'#", "3", " ", "Roll", "back", " ", "success", "ful", ".", " ", "-", " ", "guest", " ", "id", "=", "%", "d", "'_", "%_", "\\u", "guest_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "logger_", "._", "critical_", "(_", "'#", "4", " ", "Roll", "back", " ", "fail", "ed", ".", " ", "-", " ", "guest", " ", "id", "=", "%", "d", "'_", "%_", "\\u", "guest_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "#", " ", "throw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Machine", "2", "Jo", "b", "Group", " ", "INSERT", "_", "\\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 ", " _", "\\u", "m2", "j_", "=_", "m2", "j", "\\u", "new_", "(_", "machine_", "=_", "\\u", "guest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "group", "\\u", "id_", "=_", "\\u", "job", "group_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uniq", "\\u", "key_", "=_", "kar", "esa", "nsu", "i_", "._", "she", "conf_", "[_", "'", "env", ".", "uniq", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "created", "\\u", "user_", "=_", "obj_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "user_", "=_", "obj_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "j", "\\u", "save_", "(_", "obj_", "._", "orm_", ",_", "\\u", "m2", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "orm_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rollback", "(", "machine", ",", " ", "job", "group", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "delete_", "(_", "obj_", "._", "orm_", ",_", "\\u", "guest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "orm_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rollback", "(", "machine", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "logger_", "._", "critical_", "(_", "'", "Fail", "ed", " ", "to", " ", "register", " ", "the", " ", "Machine", ".", " ", "#", "5", " ", "-", " ", "guest", " ", "id", "=", "%", "d", "'_", "%_", "\\u", "guest_", "._", "id_", ")_", "\\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 ", " _", "jg", "\\u", "delete_", "(_", "obj_", "._", "pys", "il", "hou", "ette", "_", "._", "orm_", ",_", "\\u", "job", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "pys", "il", "hou", "ette", "_", "._", "orm_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rollback", "(", "job", "group", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "logger_", "._", "critical_", "(_", "'", "Fail", "ed", " ", "to", " ", "register", " ", "the", " ", "Jo", "b", "Group", ".", " ", "#", "6", " ", "-", " ", "job", "group", " ", "id", "=", "%", "d", "'_", "%_", "\\u", "job", "group_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "#", " ", "throw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gue", "st_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Gue", "st_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "post_", "(_", "self_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "Rest", "_", "._", "\\u", "post_", "(_", "self_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "kv", "c", "\"_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kv", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gue", "st_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "GET_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uris_", "=_", "avail", "able", "\\u", "virt", "\\u", "uris_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "pdb", ";", " ", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model_", "._", "attribute_", "==_", "MACHINE", "\\u", "ATTRIBUTE_", "[_", "\"", "URI", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "status_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "name_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segs_", "=_", "uri", "\\u", "split_", "(_", "model_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uri", "\\u", "join_", "(_", "segs_", ",_", "with", "out", "\\u", "auth_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segs_", "[_", "\"", "user", "\"_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "+=_", "segs_", "[_", "\"", "user", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segs_", "[_", "\"", "passw", "d", "\"_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "creds_", "+=_", "':'_", "+_", "segs_", "[_", "\"", "passw", "d", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", ".", "part_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "mode", "\\u", "input_", "(_", ")_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connect", "ion", "Auth_", "(_", "uri_", ",_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "Merge", "Host_", "(_", "self_", "._", "kv", "c_", ",_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "guest_", "in_", "host_", "._", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "virt_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "g", "\\u", "guest", "s_", "(_", "guest_", "._", "info_", "[_", "\"", "model", "\"_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "<_", "len_", "(_", "\\u", "virt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "\\u", "v_", "in_", "\\u", "virt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uuid_", "=_", "\\u", "v_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "uuid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "=_", "guest_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "[_", "uuid_", "]_", "=_", "\\u", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "name_", "[_", "uuid_", "]_", "=_", "guest_", "._", "info_", "[_", "\"", "model", "\"_", "]_", "._", "name_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "sorted_", "(_", "uri", "\\u", "guest", "s", "\\u", "name_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "str_", "._", "lower_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "uuid_", "in_", "dict", "\\u", "search_", "(_", "name_", ",_", "uri", "\\u", "guest", "s", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uri", "\\u", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "[_", "\"", "model", "\"_", "]_", ",_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "[_", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "status_", "[_", "uuid_", "]_", "=_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "[_", "'", "virt", "'_", "]_", "._", "status_", "(_", ")_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "kv", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "json_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "guest", "s", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "uri", "\\u", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s", "\\u", "json_", "._", "append_", "(_", "x_", "._", "get", "\\u", "json_", "(_", "self_", "._", "me_", "._", "languages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "uri", "\\u", "guest", "s_", "=_", "json", "\\u", "dumps_", "(_", "guest", "s", "\\u", "json_", ")_", "\\u\\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_", "._", "view_", "._", "uri", "\\u", "guest", "s_", "=_", "uri", "\\u", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "uri", "\\u", "guest", "s", "\\u", "status_", "=_", "uri", "\\u", "guest", "s", "\\u", "status_", "\\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_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "#", " ", "libvi", "rt", " ", "connecti", "on", " ", "scope", " ", "-->", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "age", " ", "Pool_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inact", "ive", "\\u", "pool", " ", "=", " ", "self", ".", "kv", "c", ".", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inact", "ive", "\\u", "pool_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "pool_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "=_", "inact", "ive", "\\u", "pool_", "+_", "active", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "'", "One", " ", "can", " ", "not", " ", "start", " ", "a", " ", "storage", " ", "pool", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", ".", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "mode", "\\u", "input_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "pools_", "=_", "pools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "vol", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "iscsi", "\\u", "blocks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "\\u", "vols_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "s_", "+=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "inact", "ive", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "+=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "guest_", "in_", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "alr", "ead", "y", "\\u", "vol_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "by", "domain_", "(_", "domain_", "=_", "guest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", "=_", "'", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alr", "ead", "y", "\\u", "vol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "alr", "ead", "y", "\\u", "vols_", "+=_", "alr", "ead", "y", "\\u", "vol_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pool_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pool", "\\u", "obj_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pool", "\\u", "obj_", "._", "is", "\\u", "active_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "info_", "[_", "pool_", "]_", "=_", "pool", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blocks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pools", "\\u", "info_", "[_", "pool_", "]_", "[_", "'", "type", "'_", "]_", "==_", "'", "iscsi", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "blocks_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "iscsi", "\\u", "block", "\\u", "by", "pool_", "(_", "pool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "iscsi", "\\u", "blocks_", "[_", "pool_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vol", "s", "\\u", "obj_", "=_", "pool", "\\u", "obj_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "volumes_", "(_", "self_", "._", "kv", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "vol", "\\u", "obj_", "in_", "vol", "s", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "vol", "\\u", "name_", "=_", "vol", "\\u", "obj_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "s", "\\u", "info_", "[_", "vol", "\\u", "name_", "]_", "=_", "vol", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "vol", "\\u", "name_", "in_", "blocks_", "and_", "vol", "\\u", "name_", "not_", "in_", "alr", "ead", "y", "\\u", "vols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "iscsi", "\\u", "blocks_", "[_", "pool_", "]_", "._", "append_", "(_", "vol", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pools", "\\u", "vol", "s", "\\u", "info_", "[_", "pool_", "]_", "=_", "vol", "s", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "info_", "=_", "pools", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "vol", "s", "\\u", "info_", "=_", "pools", "\\u", "vol", "s", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "iscsi", "\\u", "blocks_", "=_", "pools", "\\u", "iscsi", "\\u", "blocks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bridge", "\\u", "prefix_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "XE", "N", "\"_", ":_", "\"", "xen", "br", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "KV", "M", "\"_", ":_", "KV", "M", "\\u", "BRIDGE", "\\u", "PREFIX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "host", "\\u", "id_", "=_", "host", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "=_", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "hypervisor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "mac", "\\u", "address_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "keymap", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "phy", "dev_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "vir", "net_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "used", "\\u", "ports_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "k_", "in_", "avail", "able", "\\u", "virt", "\\u", "mech", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "hypervisor", "s_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uris_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "\\u", "info_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "mem", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "networks_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "network_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "graphic", "s", "\\u", "ports_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "used", "\\u", "graphic", "s", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bus", "\\u", "types_", "=_", "self_", "._", "kv", "c_", "._", "bus", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "bus", "\\u", "types_", "=_", "bus", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "max", "\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "host", "\\u", "max", "\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "free", "\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "host", "\\u", "free", "\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "allo", "c\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "guest", "\\u", "allo", "c\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "mac", "\\u", "address_", "[_", "k_", "]_", "=_", "generat", "e\\u", "mac", "\\u", "address_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "keymap", "s_", "[_", "k_", "]_", "=_", "eval_", "(_", "\"", "get", "\\u", "keymap", "s", "(%", "s", "\\u", "KEY", "MAP", "\\u", "DIR", ")\"_", "%_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Phys", "ical", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "phy", "dev_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phy", "dev", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "\"%", "s", "\"_", "%_", "bridge", "\\u", "prefix_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dev_", ",_", "dev", "\\u", "info_", "in_", "get", "\\u", "ifconfig", "\\u", "info_", "(_", ")_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "phy", "dev", "\\u", "regex_", "._", "match_", "(_", "dev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "phy", "dev_", "._", "append_", "(_", "dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "phy", "dev_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "phy", "dev_", "._", "append_", "(_", "\"%", "s0", "\"_", "%_", "bridge", "\\u", "prefix_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "phy", "dev_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "phy", "dev_", "[_", "k_", "]_", "=_", "phy", "dev_", "#", " ", "Phys", "ical", " ", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Virt", "ual", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "vir", "net_", "[_", "k_", "]_", "=_", "sorted_", "(_", "active", "\\u", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "ports_", "[_", "k_", "]_", "=_", "used", "\\u", "graphic", "s", "\\u", "ports_", "\\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_", "exclu", "de", "\\u", "ports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "\\u", "used", "\\u", "port_", "in_", "used", "\\u", "ports_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exclu", "de", "\\u", "ports_", "=_", "exclu", "de", "\\u", "ports_", "+_", "\\u", "used", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "ports_", "=_", "sorted_", "(_", "exclu", "de", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "ports_", "=_", "[_", "p_", "for_", "p_", ",_", "q_", "in_", "zip_", "(_", "exclu", "de", "\\u", "ports_", ",_", "exclu", "de", "\\u", "ports_", "[_", "1_", ":_", "]_", "+_", "[_", "None_", "]_", ")_", "if_", "p_", "!=_", "q_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "graphic", "s", "\\u", "port_", "=_", "next", "\\u", "number_", "(_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PORT", "\\u", "MAX", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", ".", "part_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "models_", "=_", "find", "by", "host", "1", "guest", "all_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Phys", "ical", " ", "Gue", "st", " ", "Info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "view_", "._", "hypervisor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "k_", ",_", "v_", "in_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "k_", "in_", "avail", "able", "\\u", "virt", "\\u", "mech", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "hypervisor", "s_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uris_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "kv", "c", "\"_", ")_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dom", "name_", "=_", "self_", "._", "kv", "c_", "._", "uuid", "\\u", "to", "\\u", "dom", "name_", "(_", "model_", "._", "uniq", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "not", " ", "dom", "name", ":", " ", "return", " ", "web", ".", "confl", "ict", "(", "web", ".", "ctx", ".", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "virt_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "g", "\\u", "guest", "s_", "(_", "dom", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "<_", "len_", "(_", "\\u", "virt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "model_", ",_", "\\u", "virt_", "[_", "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 ", " ", " _", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "model_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exporte", "d", " ", "Gue", "st", " ", "Info_", "\\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_", "exports_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pool", "\\u", "name_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pool_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "pool_", "[_", "0_", "]_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "target", "\"_", "]_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "\\u", "afile", "_", "in_", "glob_", "._", "glob_", "(_", "\"%", "s", "/*", "/", "info", ".", "dat", "\"_", "%_", "(_", "path_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "Export", "Config", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "param_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "param_", "._", "get", "\\u", "created_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "param_", "._", "get", "\\u", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "title_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "re_", "._", "sub_", "(_", "\"[\\\\", "r", "\\\\", "n", "]\"_", ",_", "\"\"_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "title_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "\\u_", "(_", "'", "unti", "tle", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "created_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "/", "%", "m", "/", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", "float_", "(_", "created_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "\\u_", "(_", "\"", "N", "/", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "._", "append_", "(_", "{_", "\"", "dir", "\"_", ":_", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "pool", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "b64", "dir", "\"", " ", ":", " ", "base64", "\\u", "encode", "(\\u", "dir", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\"_", ":_", "int_", "(_", "created_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\\u", "str", "\"_", ":_", "created", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "param_", "._", "get", "\\u", "database_", "(_", ")_", "[_", "\"", "icon", "\"_", "]_", ",_", "\\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_", "exports_", "[_", "pool", "\\u", "name_", "]_", "=_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "json_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "guest", "s", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s", "\\u", "json_", "._", "append_", "(_", "x_", "._", "get", "\\u", "json_", "(_", "self_", "._", "me_", "._", "languages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "guest", "s_", "=_", "json", "\\u", "dumps_", "(_", "guest", "s", "\\u", "json_", ")_", "\\u\\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_", "._", "view_", "._", "exports_", "=_", "exports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "guest", "s_", "=_", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "kv", "c", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "libvi", "rt", " ", "connecti", "on", " ", "scope", " ", "-->", " ", "Gue", "st", "#\\u", "post", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gue", "st_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "POST_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "._", "attribute_", "==_", "0_", "and_", "model_", "._", "hypervisor", "_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "\"", "XE", "N", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "uris_", "[_", "\"", "XE", "N", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "model_", "._", "attribute_", "==_", "0_", "and_", "model_", "._", "hypervisor", "_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "\"", "KV", "M", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "uris_", "[_", "\"", "KV", "M", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "validates", "\\u", "guest", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "self_", "._", "view_", "._", "alert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "guest", "s_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inact", "ive", "\\u", "guest", "s_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "inact", "ive", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "graphic", "s", "\\u", "ports_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "used", "\\u", "graphic", "s", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "mac", "\\u", "addrs_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "used", "\\u", "mac", "\\u", "addr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "\\u", "info_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "mem", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "mem", "\\u", "size", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "mem", "\\u", "info_", "[_", "'", "host", "\\u", "free", "\\u", "mem", "'_", "]_", "<_", "int_", "(_", "self_", "._", "input_", "._", "vm", "\\u", "mem", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "web_", "._", "bad", "request_", "(_", "\\u_", "(_", "\"", "Spac", "e", " ", "not", " ", "eno", "ugh", " ", "to", " ", "allocate", " ", "guest", " ", "memory", ".\"_", ")_", ")_", "\\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_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "pool", "\\u", "type", "\"_", ")_", "and_", "self_", "._", "input_", "._", "pool", "\\u", "type_", "!=_", "\"", "block", "\"_", "and_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "pool", "\\u", "dir", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "path_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "storage", "\\u", "pool", "\\u", "target", "path_", "(_", "self_", "._", "input_", "._", "pool", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "path_", ":_", "#", " ", "disk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "chk", "\\u", "create", "\\u", "disk_", "(_", "target", "\\u", "path_", ",_", "self_", "._", "input_", "._", "vm", "\\u", "disk", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "partition_", "=_", "get", "\\u", "partit", "ion", "\\u", "info_", "(_", "target", "\\u", "path_", ",_", "header_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "bad", "request_", "(_", "\\u_", "(_", "\"", "No", " ", "space", " ", "avail", "able", " ", "to", " ", "create", " ", "disk", " ", "image", " ", "in", " ", "'%", "s", "'", " ", "partit", "ion", ".\"_", ")_", "%_", "partition_", "[_", "5_", "]_", "[_", "0_", "]_", ")_", "\\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_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "kv", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "on", " ", "whe", "ther", " ", "value", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gue", "st", " ", "OS_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "input_", "._", "domain", "\\u", "name_", "in_", "active", "\\u", "guest", "s_", ")_", "or_", "(_", "self_", "._", "input_", "._", "domain", "\\u", "name_", "in_", "inact", "ive", "\\u", "guest", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "conflict_", "(_", "web_", "._", "ctx_", "._", "path_", ",_", "\"", "Gue", "st", " ", "OS", " ", "is", " ", "alr", "ead", "y", " ", "there", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Graphic", "s", " ", "Port", " ", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "int_", "(_", "self_", "._", "input_", "._", "vm", "\\u", "graphic", "s", "\\u", "port_", ")_", "in_", "used", "\\u", "graphic", "s", "\\u", "ports_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "conflict_", "(_", "web_", "._", "ctx_", "._", "path_", ",_", "\"", "Graphic", "s", " ", "Port", " ", "is", " ", "alr", "ead", "y", " ", "there", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "MAC", " ", "Address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "input_", "._", "vm", "\\u", "mac_", "in_", "used", "\\u", "mac", "\\u", "addrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "conflict_", "(_", "web_", "._", "ctx_", "._", "path_", ",_", "\"", "MAC", " ", "Address", " ", "is", " ", "alr", "ead", "y", " ", "there", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uuid_", "=_", "string", "\\u", "from", "\\u", "uuid_", "(_", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "uuid", "'_", "]_", "=_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "domain", "\\u", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "name", "'_", "]_", "=_", "self_", "._", "input_", "._", "domain", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "mem", "\\u", "size", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "mem", "-", "size", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "mem", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "kernel", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "kernel", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "kernel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "initrd", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "initrd", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "initrd", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "iso", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "iso", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "iso_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "keymap", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "keymap", "'_", "]_", "=_", "self_", "._", "input_", "._", "keymap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "create_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "pool", "\\u", "type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "bus", "\\u", "type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "bus", "'_", "]_", "=_", "self_", "._", "input_", "._", "bus", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "input_", "._", "pool", "\\u", "type_", "==_", "\"", "dir", "\"_", "or_", "self_", "._", "input_", "._", "pool", "\\u", "type_", "==_", "\"", "fs", "\"_", ":_", "#", " ", "create", " ", "volume_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "create_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "disk", "-", "format", "'_", "]_", "=_", "self_", "._", "input_", "._", "disk", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "pool", "\"_", "]_", "=_", "self_", "._", "input_", "._", "pool", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "volume", "\"_", "]_", "=_", "options_", "[_", "'", "name", "'_", "]_", "#", " ", "default", " ", "domain", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "disk", "-", "size", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "disk", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "input_", "._", "pool", "\\u", "type_", "==_", "\"", "block", "\"_", ":_", "#", " ", "iscsi", " ", "block", " ", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "iscsi", "\\u", "pool_", ",_", "iscsi", "\\u", "volume_", ")_", "=_", "self_", "._", "input_", "._", "pool", "\\u", "dir_", "._", "split_", "(_", "\"/\"_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "pool", "\"_", "]_", "=_", "iscsi", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "\"", "storage", "-", "volume", "\"_", "]_", "=_", "iscsi", "\\u", "volume_", "\\u\\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_", "web_", "._", "bad", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "graphic", "s", "\\u", "port", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "graphic", "s", "-", "port", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "graphic", "s", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "mac", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "mac", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "mac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "vm", "\\u", "extra", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "extra", "'_", "]_", "=_", "self_", "._", "input_", "._", "vm", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "nic", "\\u", "type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "input_", "._", "nic", "\\u", "type_", "==_", "\"", "phy", "dev", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "interface", "-", "format", "'_", "]_", "=_", "\"", "b", ":\"_", "+_", "self_", "._", "input_", "._", "phy", "dev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "input_", "._", "nic", "\\u", "type_", "==_", "\"", "vir", "net", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "interface", "-", "format", "'_", "]_", "=_", "\"", "n", ":\"_", "+_", "self_", "._", "input_", "._", "vir", "net_", "\\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_", "int_", "(_", "self_", "._", "input_", "._", "m", "\\u", "hypervisor", "_", ")_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "XE", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "hypervisor", "_", "=_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "XE", "N", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "type", "'_", "]_", "=_", "u", "\"", "XE", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "int_", "(_", "self_", "._", "input_", "._", "m", "\\u", "hypervisor", "_", ")_", "==_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "KV", "M", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "hypervisor", "_", "=_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "[_", "'", "KV", "M", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'", "type", "'_", "]_", "=_", "u", "\"", "KV", "M", "\"_", "\\u\\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_", "web_", "._", "bad", "request_", "(_", "\"", "Thi", "s", " ", "is", " ", "not", " ", "the", " ", "hypervisor", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notebook_", "\\u\\u\\uNL\\u\\u\\u_", "note", "\\u", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "note", "\\u", "title", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "note", "\\u", "title_", "=_", "self_", "._", "input_", "._", "note", "\\u", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "note", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "note", "\\u", "value", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "note", "\\u", "value_", "=_", "self_", "._", "input_", "._", "note", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "notebook_", "=_", "n", "\\u", "new_", "(_", "note", "\\u", "title_", ",_", "note", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tags_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "tags", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "array_", "=_", "comma", "\\u", "split_", "(_", "self_", "._", "input_", "._", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "array_", "=_", "uniq", "\\u", "sort_", "(_", "tag", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "tag", "\\u", "array_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t", "\\u", "count_", "(_", "self_", "._", "orm_", ",_", "x_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "tags_", "._", "append_", "(_", "t", "\\u", "new_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "tags_", "._", "append_", "(_", "t", "\\u", "name_", "(_", "self_", "._", "orm_", ",_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Icon_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "icon", "\\u", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "param_", "(_", "self_", "._", "input_", ",_", "\"", "icon", "\\u", "filename", "\"_", ",_", "empty_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "filename_", "=_", "self_", "._", "input_", "._", "icon", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "guest_", "=_", "m", "\\u", "new_", "(_", "created", "\\u", "user_", "=_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "user_", "=_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uniq", "\\u", "key_", "=_", "uni", "\\u", "force_", "(_", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "input_", "._", "m", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", "=_", "MACHINE", "\\u", "ATTRIBUTE_", "[_", "'", "GUE", "ST", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "_", "=_", "i", "\\u", "hypervisor", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notebook_", "=_", "\\u", "notebook_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "\\u", "tags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon_", "=_", "icon", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "deleted_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "regi", "st", "\\u", "guest_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "guest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "VIR", "T", "\\u", "COMMA", "ND", "\\u", "CREATE", "\\u", "GUE", "ST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Creat", "e", " ", "Gue", "st", "'_", ",_", "'", "Creat", "e", " ", "Gue", "st", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "name", "\"_", ":_", "options_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "options_", "[_", "\"", "storage", "-", "pool", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "\"_", ":_", "options_", "[_", "\"", "uuid", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "create_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "accepted_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
galaxyproject/pulsar/pulsar/managers/staging/post.py
[ { "content": "def postprocess(job_directory, action_executor):\n # Returns True if outputs were collected.\n try:\n staging_config = job_directory.load_metadata(\"staging_config\", None)\n collected = __collect_outputs(job_directory, staging_config, action_executor)\n return collected\n finally:\n job_directory.write_file(\"postprocessed\", \"\")\n return False", "metadata": "root.postprocess", "header": "['module', '___EOS___']", "index": 13 } ]
[ { "span": "return False", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "postprocess", "_", "(_", "job", "\\u", "directory_", ",_", "action", "\\u", "executor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "output", "s", " ", "wer", "e", " ", "collected", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "staging", "\\u", "config_", "=_", "job", "\\u", "directory_", "._", "load", "\\u", "metadata_", "(_", "\"", "staging", "\\u", "config", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collected", "_", "=_", "\\u\\u", "collect", "\\u", "outputs_", "(_", "job", "\\u", "directory_", ",_", "staging", "\\u", "config_", ",_", "action", "\\u", "executor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "collected", "_", "\\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 ", " _", "job", "\\u", "directory_", "._", "write", "\\u", "file_", "(_", "\"", "postprocess", "ed", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2 ]
Except block handles 'BaseException'
EiNSTeiN-/idapython/examples/ex_add_menu_item.py
[ { "content": "import idaapi\n\n\ntry:\n ex_addmenu_item_ctx\n idaapi.del_menu_item(ex_addmenu_item_ctx)\n print(\"Menu removed\")\n del ex_addmenu_item_ctx\nexcept:\n ex_addmenu_item_ctx = idaapi.add_menu_item(\"Search/\", \"X\", \"\", 0, cb, tuple(\"hello world\"))\n if ex_addmenu_item_ctx is None:\n print(\"Failed to add menu!\")\n del ex_addmenu_item_ctx\n else:\n print(\"Menu added successfully. Run the script again to delete the menu\")", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "ida", "api_", "\\u\\u\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ida", "api_", "._", "del", "\\u", "menu", "\\u", "item_", "(_", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Menu", " ", "remove", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", "=_", "ida", "api_", "._", "add", "\\u", "menu", "\\u", "item_", "(_", "\"", "Sear", "ch", "/\"_", ",_", "\"", "X", "\"_", ",_", "\"\"_", ",_", "0_", ",_", "cb_", ",_", "tuple_", "(_", "\"", "hell", "o", " ", "world", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Fail", "ed", " ", "to", " ", "add", " ", "menu", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ex", "\\u", "add", "menu", "\\u", "item", "\\u", "ctx_", "\\u\\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_", "(_", "\"", "Menu", " ", "adde", "d", " ", "success", "full", "y", ".", " ", "Run", " ", "the", " ", "script", " ", "again", " ", "to", " ", "delete", " ", "the", " ", "menu", "\"_", ")_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
kayhayen/Nuitka/tests/basics/ComparisonChains.py
[ { "content": "def side_effect_comparisons():\n print(\"Should have side effect:\")\n print(1 < side_effect() < 9)\n\n print(\"Should not have side effect due to short circuit:\")\n print(3 < 2 < side_effect() < 9)", "metadata": "root.side_effect_comparisons", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def inOperatorChain():\n print(\"In operator chains:\")\n print(3 in [3,4] in [[3,4]])\n print(3 in [3,4] not in [[3,4]])\n\n if 3 in [3,4] in [[3,4]]:\n print(\"Yes\")\n else:\n print(\"No\")\n\n if 3 in [3,4] not in [[3,4]]:\n print(\"Yes\")\n else:\n print(\"No\")", "metadata": "root.inOperatorChain", "header": "['module', '___EOS___']", "index": 122 } ]
[ { "span": "3 < 2 < side_effect() < 9)", "start_line": 44, "start_column": 10, "end_line": 44, "end_column": 35 }, { "span": "3 in [3,4] in [[3,4]])", "start_line": 124, "start_column": 10, "end_line": 124, "end_column": 31 }, { "span": "3 in [3,4] not in [[3,4]])", "start_line": 125, "start_column": 10, "end_line": 125, "end_column": 35 }, { "span": "3 in [3,4] in [[3,4]]:", "start_line": 127, "start_column": 7, "end_line": 127, "end_column": 28 }, { "span": "3 in [3,4] not in [[3,4]]:", "start_line": 132, "start_column": 7, "end_line": 132, "end_column": 32 } ]
[]
1
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_", "def_", "side", "\\u", "effect", "\\u", "comparisons", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Sho", "ul", "d", " ", "have", " ", "side", " ", "effect", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "1_", "<_", "side", "\\u", "effect_", "(_", ")_", "<_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "not", " ", "have", " ", "side", " ", "effect", " ", "due", " ", "to", " ", "short", " ", "circuit", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "3_", "<_", "2_", "<_", "side", "\\u", "effect_", "(_", ")_", "<_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "in", "Opera", "tor", "Chain_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "In", " ", "opera", "tor", " ", "chain", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "not_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Ye", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "No", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "not_", "in_", "[_", "[_", "3_", ",_", "4_", "]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modules/tests/smoke/broken_links.py
[ { "content": "\"\"\" Sahana Eden Test Framework\n\n @copyright: 2011-2016 (c) Sahana Software Foundation\n @license: MIT\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\n\nfrom time import time\ntry:\n from cStringIO import StringIO # Faster, where available\nexcept:\n from StringIO import StringIO\nimport sys\nimport socket\n\nfrom tests.web2unittest import Web2UnitTest\nfrom gluon import current\ntry:\n from twill import get_browser\n from twill import set_output\n from twill.browser import *\nexcept ImportError:\n raise NameError(\"Twill not installed\")\ntry:\n import mechanize\n #from mechanize import BrowserStateError\n #from mechanize import ControlNotFoundError\nexcept ImportError:\n raise NameError(\"Mechanize not installed\")\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def login(self, credentials):\n if credentials == \"UNAUTHENTICATED\":\n url = \"%s/default/user/logout\" % self.homeURL\n self.b.go(url)\n return True\n try:\n (self.user, self.password) = credentials.split(\"/\",1)\n except:\n msg = \"Unable to split %s into a user name and password\" % user\n self.reporter(msg)\n return False\n url = \"%s/default/user/login\" % self.homeURL\n self.b.go(url)\n forms = self.b.get_all_forms()\n for form in forms:\n try:\n if form[\"_formname\"] == \"login\":\n self.b._browser.form = form\n form[\"email\"] = self.user\n form[\"password\"] = self.password\n self.b.submit(\"Login\")\n # If login is successful then should be redirected to the homepage\n return self.b.get_url()[len(self.homeURL):] == \"/default/index\"\n except:\n # This should be a mechanize.ControlNotFoundError, but\n # for some unknown reason that isn't caught on Windows or Mac\n pass\n return False", "metadata": "root.BrokenLinkTest.login", "header": "['class', 'BrokenLinkTest', '(', 'Web2UnitTest', ')', ':', '___EOS___']", "index": 106 }, { "content": " def record_timings(self):\n import_error = \"\"\n try:\n import xlrd\n except:\n import_error += \"ERROR: the xlrd modules is needed to record timings\\n\"\n try:\n import xlwt\n except:\n import_error += \"ERROR: the xlwt modules is needed to record timings\\n\"\n if import_error != \"\":\n print >> self.stderr, import_error\n return\n rec_time_filename = self.config.record_timings_filename\n try:\n workbook = xlrd.open_workbook(filename=rec_time_filename,\n formatting_info=True)\n except:\n workbook = None\n summary = {}\n if workbook:\n summary = self.read_timings_sheet(workbook)\n if len(summary[\"date\"]) > 100:\n # Need to rotate the file\n # 1) make a summary and save this\n self.report_timings_summary(summary, rec_time_filename)\n # 2) archive the file\n from zipfile import ZipFile\n import os\n zip_filename = os.path.join(self.config.path, \"rec_time.zip\")\n archive = ZipFile(zip_filename, \"a\")\n arc_name = \"%s-%s.xls\" % (rec_time_filename[len(self.config.path):-4],\n current.request.now.date()\n )\n archive.write(rec_time_filename,arc_name)\n archive.close()\n # 3) clear the current file\n os.unlink(rec_time_filename)\n summary = {}\n if \"date\" not in summary:\n last_col = 0\n summary[\"date\"] = [current.request.now.date()]\n else:\n last_col = len(summary[\"date\"])\n summary[\"date\"].append(current.request.now.date())\n for (url, rd_obj) in self.results.items():\n if url not in summary:\n summary[url] = []\n # ensure that the row is as long as the number of dates\n shortage = last_col - len(summary[url])\n if shortage > 0:\n summary[url] = summary[url] + ['']*shortage\n summary[url].append((rd_obj.get_duration(), rd_obj.is_broken()))\n self.write_timings_sheet(summary, rec_time_filename)", "metadata": "root.BrokenLinkTest.record_timings", "header": "['class', 'BrokenLinkTest', '(', 'Web2UnitTest', ')', ':', '___EOS___']", "index": 297 }, { "content": " def brokenReport(self):\n self.reporter(\"Broken Links\")\n as_html = current.test_config.html\n self.broken_links_count = 0\n for (url, rd_obj) in self.results.items():\n if as_html:\n print_url = \"<a href=%s%s target=\\\"_blank\\\">%s</a>\" % (self.homeURL, url, url)\n else:\n print_url = url\n if rd_obj.is_broken():\n if rd_obj.threw_exception():\n msg = \"(Exception) %s\" % print_url\n else:\n http_code = rd_obj.return_http_code()\n ticket = rd_obj.the_ticket(as_html)\n try:\n parent = self.urlParentList[url]\n if as_html:\n parent = \"<a href=%s%s target=\\\"_blank\\\">Parent</a>\" % (self.homeURL, parent)\n except:\n parent = \"unknown\"\n msg = \"%3d. (%s - %s) %s called from %s\" % (self.broken_links_count + 1,\n http_code,\n ticket,\n print_url,\n parent\n )\n self.reporter(msg)\n self.broken_links_count += 1", "metadata": "root.BrokenLinkTest.brokenReport", "header": "['class', 'BrokenLinkTest', '(', 'Web2UnitTest', ')', ':', '___EOS___']", "index": 488 }, { "content": " def scatterplot(self):\n \"\"\"\n Method to draw a scatterplot of the average time to download links\n against time. Add a regression line to show the trend over time.\n \"\"\"\n try:\n from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas\n self.FigureCanvas = FigureCanvas\n from matplotlib.figure import Figure\n self.Figure = Figure\n import numpy\n except ImportError:\n return\n try:\n import xlrd\n except:\n import_error += \"ERROR: the xlrd modules is needed to record timings\\n\"\n rec_time_filename = self.config.record_timings_filename\n try:\n workbook = xlrd.open_workbook(filename=rec_time_filename,\n formatting_info=True)\n except:\n return\n import numpy\n # Only include the mean in the regression values if there are at least 10 URL timings\n summary = self.read_timings_sheet(workbook)\n (date_summary, gv_mean, gv_std, m, b) = self.report_timings_summary(summary, mean_threshold=10)\n if len(gv_mean) <= 2:\n return\n fig = Figure(figsize=(5, 2.5))\n canvas = self.FigureCanvas(fig)\n ax = fig.add_subplot(111)\n linear = numpy.poly1d([m,b])\n denom = numpy.max(gv_std)/50\n size = gv_std/denom\n ax.scatter(date_summary, gv_mean, marker=\"d\", s=size)\n ax.plot(date_summary, linear(date_summary), '--r')\n\n chart = StringIO()\n canvas.print_figure(chart)\n image = chart.getvalue()\n import base64\n base64Img = base64.b64encode(image)\n image = \"<img src=\\\"data:image/png;base64,%s\\\">\" % base64Img\n self.reporter(\"Scatterplot of average link times per successful run\")\n self.reporter(image)\n self.reporter(\"The trend line has a current slope of %s\" % m)\n self.reporter(\"The y-intercept is %s seconds\" % b)", "metadata": "root.BrokenLinkTest.scatterplot", "header": "['class', 'BrokenLinkTest', '(', 'Web2UnitTest', ')', ':', '___EOS___']", "index": 541 } ]
[ { "span": "except:", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 7 }, { "span": "except:", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 15 }, { "span": "except:", "start_line": 129, "start_column": 12, "end_line": 129, "end_column": 19 }, { "span": "except:", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 15 }, { "span": "except:", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 15 }, { "span": "except:", "start_line": 314, "start_column": 8, "end_line": 314, "end_column": 15 }, { "span": "except:", "start_line": 507, "start_column": 20, "end_line": 507, "end_column": 27 }, { "span": "except:", "start_line": 556, "start_column": 8, "end_line": 556, "end_column": 15 }, { "span": "except:", "start_line": 562, "start_column": 8, "end_line": 562, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Sa", "han", "a", " ", "Ed", "en", " ", "Test", " ", "Frame", "work", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "copyr", "ight", ":", " ", "2011", "-", "2016", " ", "(", "c", ")", " ", "Sa", "han", "a", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", "\\", "10", ";", " ", " ", " ", " ", "@", "license", ":", " ", "MIT", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", "\\", "10", ";", " ", " ", " ", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", "\\", "10", ";", " ", " ", " ", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", "\\", "10", ";", " ", " ", " ", " ", "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", "\\", "10", ";", " ", " ", " ", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "include", "d", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", "\\", "10", ";", " ", " ", " ", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", "\\", "10", ";", " ", " ", " ", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", "\\", "10", ";", " ", " ", " ", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", "\\", "10", ";", " ", " ", " ", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", "\\", "10", ";", " ", " ", " ", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", "\\", "10", ";", " ", " ", " ", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "#", " ", "Fast", "er", ",", " ", "where", " ", "available_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tests_", "._", "web", "2u", "nit", "test_", "import_", "Web", "2", "Unit", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "import_", "current_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twi", "ll_", "import_", "get", "\\u", "browser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twi", "ll_", "import_", "set\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twi", "ll_", "._", "browser_", "import_", "*_", "\\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 ", " _", "raise_", "Name", "Error_", "(_", "\"", "Twi", "ll", " ", "not", " ", "install", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "mechani", "ze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "mechani", "ze", " ", "import", " ", "Brows", "er", "State", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "mechani", "ze", " ", "import", " ", "Control", "Not", "Foun", "d", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "\"", "Mechani", "ze", " ", "not", " ", "install", "ed", "\"_", ")_", "\\u\\u\\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]_", "class_", "Bro", "ken", "Link", "Test_", "(_", "Web", "2", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "credentials_", "==_", "\"", "UNA", "UTH", "ENTI", "CATE", "D", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"%", "s", "/", "default", "/", "user", "/", "logo", "ut", "\"_", "%_", "self_", "._", "home", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "._", "go_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "user_", ",_", "self_", "._", "password_", ")_", "=_", "credentials_", "._", "split_", "(_", "\"/\"_", ",_", "1_", ")_", "\\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_", "=_", "\"", "Una", "ble", " ", "to", " ", "split", " ", "%", "s", " ", "int", "o", " ", "a", " ", "user", " ", "name", " ", "and", " ", "password", "\"_", "%_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "\"%", "s", "/", "default", "/", "user", "/", "login", "\"_", "%_", "self_", "._", "home", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "._", "go_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forms_", "=_", "self_", "._", "b_", "._", "get", "\\u", "all", "\\u", "forms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "form_", "in_", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form_", "[_", "\"\\u", "form", "name", "\"_", "]_", "==_", "\"", "login", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "b_", "._", "\\u", "browser_", "._", "form_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "\"", "email", "\"_", "]_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "\"", "password", "\"_", "]_", "=_", "self_", "._", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "._", "submit_", "(_", "\"", "Logi", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "login", " ", "is", " ", "success", "ful", " ", "then", " ", "shou", "ld", " ", "be", " ", "redirected", " ", "to", " ", "the", " ", "homepage_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "b_", "._", "get", "\\u", "url_", "(_", ")_", "[_", "len_", "(_", "self_", "._", "home", "URL_", ")_", ":_", "]_", "==_", "\"/", "default", "/", "index", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "mechani", "ze", ".", "Control", "Not", "Foun", "d", "Error", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "some", " ", "unknown", " ", "reason", " ", "tha", "t", " ", "isn", "'", "t", " ", "cau", "ght", " ", "on", " ", "Window", "s", " ", "or", " ", "Mac", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bro", "ken", "Link", "Test_", "(_", "Web", "2", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "record", "\\u", "timings", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import", "\\u", "error_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xlr", "d_", "\\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 ", " _", "import", "\\u", "error_", "+=_", "\"", "ERROR", ":", " ", "the", " ", "xlr", "d", " ", "module", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "record", " ", "timings", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xl", "wt_", "\\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 ", " _", "import", "\\u", "error_", "+=_", "\"", "ERROR", ":", " ", "the", " ", "xl", "wt", " ", "module", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "record", " ", "timings", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "import", "\\u", "error_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "self_", "._", "stderr_", ",_", "import", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rec", "\\u", "time", "\\u", "filename_", "=_", "self_", "._", "config_", "._", "record", "\\u", "timings", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workbook_", "=_", "xlr", "d_", "._", "open", "\\u", "workbook_", "(_", "filename_", "=_", "rec", "\\u", "time", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format", "ting", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workbook_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "workbook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "self_", "._", "read", "\\u", "timings", "\\u", "sheet_", "(_", "workbook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "summary_", "[_", "\"", "date", "\"_", "]_", ")_", ">_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "rota", "te", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ")", " ", "make", " ", "a", " ", "summar", "y", " ", "and", " ", "save", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "timings", "\\u", "summary_", "(_", "summary_", ",_", "rec", "\\u", "time", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "2", ")", " ", "archive", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zipfile_", "import_", "Zip", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "config_", "._", "path_", ",_", "\"", "rec", "\\u", "time", ".", "zip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "=_", "Zip", "File_", "(_", "zip", "\\u", "filename_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arc", "\\u", "name_", "=_", "\"%", "s", "-%", "s", ".", "xls", "\"_", "%_", "(_", "rec", "\\u", "time", "\\u", "filename_", "[_", "len_", "(_", "self_", "._", "config_", "._", "path_", ")_", ":_", "-_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current_", "._", "request_", "._", "now_", "._", "date_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "._", "write_", "(_", "rec", "\\u", "time", "\\u", "filename_", ",_", "arc", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "3", ")", " ", "clear", " ", "the", " ", "current", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "rec", "\\u", "time", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "date", "\"_", "not_", "in_", "summary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "col_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "[_", "\"", "date", "\"_", "]_", "=_", "[_", "current_", "._", "request_", "._", "now_", "._", "date_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "col_", "=_", "len_", "(_", "summary_", "[_", "\"", "date", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "[_", "\"", "date", "\"_", "]_", "._", "append_", "(_", "current_", "._", "request_", "._", "now_", "._", "date_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "url_", ",_", "rd", "\\u", "obj_", ")_", "in_", "self_", "._", "results_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "url_", "not_", "in_", "summary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "[_", "url_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "tha", "t", " ", "the", " ", "row", " ", "is", " ", "as", " ", "long", " ", "as", " ", "the", " ", "number", " ", "of", " ", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "short", "age_", "=_", "last", "\\u", "col_", "-_", "len_", "(_", "summary_", "[_", "url_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "short", "age_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "[_", "url_", "]_", "=_", "summary_", "[_", "url_", "]_", "+_", "[_", "''_", "]_", "*_", "short", "age_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "summary_", "[_", "url_", "]_", "._", "append_", "(_", "(_", "rd", "\\u", "obj_", "._", "get", "\\u", "duration_", "(_", ")_", ",_", "rd", "\\u", "obj_", "._", "is", "\\u", "broken", "_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write", "\\u", "timings", "\\u", "sheet_", "(_", "summary_", ",_", "rec", "\\u", "time", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bro", "ken", "Link", "Test_", "(_", "Web", "2", "Unit", "Test_", ")_", ":_", "\\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_", "broken", "Report_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reporter_", "(_", "\"", "Bro", "ken", " ", "Link", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "as", "\\u", "html_", "=_", "current_", "._", "test\\u", "config_", "._", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broken", "\\u", "link", "s", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "url_", ",_", "rd", "\\u", "obj_", ")_", "in_", "self_", "._", "results_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "as", "\\u", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "url_", "=_", "\"<", "a", " ", "href", "=", "%", "s", "%", "s", " ", "target", "=\\\\\"", "\\u", "blank", "\\\\\">", "%", "s", "</", "a", ">\"_", "%_", "(_", "self_", "._", "home", "URL_", ",_", "url_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rd", "\\u", "obj_", "._", "is", "\\u", "broken", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rd", "\\u", "obj_", "._", "thr", "ew", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "\"(", "Except", "ion", ")", " ", "%", "s", "\"_", "%_", "print", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "http", "\\u", "code_", "=_", "rd", "\\u", "obj_", "._", "return", "\\u", "http", "\\u", "code_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ticket_", "=_", "rd", "\\u", "obj_", "._", "the", "\\u", "ticket_", "(_", "as", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parent_", "=_", "self_", "._", "url", "Parent", "List_", "[_", "url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parent_", "=_", "\"<", "a", " ", "href", "=", "%", "s", "%", "s", " ", "target", "=\\\\\"", "\\u", "blank", "\\\\\">", "Parent", "</", "a", ">\"_", "%_", "(_", "self_", "._", "home", "URL_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parent_", "=_", "\"", "unknown", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "\"%", "3d", ".", " ", "(%", "s", " ", "-", " ", "%", "s", ")", " ", "%", "s", " ", "call", "ed", " ", "from", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "broken", "\\u", "link", "s", "\\u", "count_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ticket_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reporter_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broken", "\\u", "link", "s", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bro", "ken", "Link", "Test_", "(_", "Web", "2", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scatter", "plot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "draw", " ", "a", " ", "scatter", "plot", " ", "of", " ", "the", " ", "averag", "e", " ", "time", " ", "to", " ", "download", " ", "link", "s", "\\", "10", ";", " ", " ", " ", " ", "against", " ", "time", ".", " ", "Add", " ", "a", " ", "regress", "ion", " ", "line", " ", "to", " ", "show", " ", "the", " ", "trend", " ", "over", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "matplotlib_", "._", "backends_", "._", "back", "end", "\\u", "agg_", "import_", "Fig", "ure", "Can", "vas", "Agg", "_", "as_", "Fig", "ure", "Canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Fig", "ure", "Canvas_", "=_", "Fig", "ure", "Canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "figure_", "import_", "Figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Figure_", "=_", "Figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xlr", "d_", "\\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 ", " _", "import", "\\u", "error_", "+=_", "\"", "ERROR", ":", " ", "the", " ", "xlr", "d", " ", "module", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "record", " ", "timings", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rec", "\\u", "time", "\\u", "filename_", "=_", "self_", "._", "config_", "._", "record", "\\u", "timings", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workbook_", "=_", "xlr", "d_", "._", "open", "\\u", "workbook_", "(_", "filename_", "=_", "rec", "\\u", "time", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format", "ting", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "include", " ", "the", " ", "mean", " ", "in", " ", "the", " ", "regress", "ion", " ", "values", " ", "if", " ", "there", " ", "are", " ", "at", " ", "leas", "t", " ", "10", " ", "URL", " ", "timings", "_", "\\u\\u\\uNL\\u\\u\\u_", "summary_", "=_", "self_", "._", "read", "\\u", "timings", "\\u", "sheet_", "(_", "workbook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "date", "\\u", "summary_", ",_", "gv", "\\u", "mean_", ",_", "gv", "\\u", "std_", ",_", "m_", ",_", "b_", ")_", "=_", "self_", "._", "report", "\\u", "timings", "\\u", "summary_", "(_", "summary_", ",_", "mean", "\\u", "threshold_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "gv", "\\u", "mean_", ")_", "<=_", "2_", ":_", "\\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_", "fig_", "=_", "Figure_", "(_", "figsize_", "=_", "(_", "5_", ",_", "2.5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "=_", "self_", "._", "Fig", "ure", "Canvas_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linear_", "=_", "numpy_", "._", "poly", "1d_", "(_", "[_", "m_", ",_", "b_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "denom_", "=_", "numpy_", "._", "max_", "(_", "gv", "\\u", "std_", ")_", "/_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "gv", "\\u", "std_", "/_", "denom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "scatter_", "(_", "date", "\\u", "summary_", ",_", "gv", "\\u", "mean_", ",_", "marker_", "=_", "\"", "d", "\"_", ",_", "s_", "=_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "plot_", "(_", "date", "\\u", "summary_", ",_", "linear_", "(_", "date", "\\u", "summary_", ")_", ",_", "'--", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "._", "print", "\\u", "figure_", "(_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "chart_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base64", "Img_", "=_", "base64_", "._", "b64encode_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "\"<", "img", " ", "src", "=\\\\\"", "data", ":", "image", "/", "png", ";", "base64", ",%", "s", "\\\\\">", "\"_", "%_", "base64", "Img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "(_", "\"", "Scatter", "plot", " ", "of", " ", "averag", "e", " ", "link", " ", "times", " ", "per", " ", "success", "ful", " ", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "(_", "\"", "The", " ", "trend", " ", "line", " ", "has", " ", "a", " ", "current", " ", "slope", " ", "of", " ", "%", "s", "\"_", "%_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "(_", "\"", "The", " ", "y", "-", "intercept", " ", "is", " ", "%", "s", " ", "second", "s", "\"_", "%_", "b_", ")_", "\\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,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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 ]
Except block handles 'BaseException'
tophatmonocle/ims_lti_py/ims_lti_py/outcome_request.py
[ { "content": " def process_xml(self, xml):\n '''\n Parse Outcome Request data from XML.\n '''\n root = objectify.fromstring(xml)\n self.message_identifier = str(\n root.imsx_POXHeader.imsx_POXRequestHeaderInfo.\n imsx_messageIdentifier)\n try:\n result = root.imsx_POXBody.replaceResultRequest\n self.operation = REPLACE_REQUEST\n # Get result sourced id from resultRecord\n self.lis_result_sourcedid = result.resultRecord.\\\n sourcedGUID.sourcedId\n self.score = str(result.resultRecord.result.\n resultScore.textString)\n except:\n pass\n\n try:\n result = root.imsx_POXBody.deleteResultRequest\n self.operation = DELETE_REQUEST\n # Get result sourced id from resultRecord\n self.lis_result_sourcedid = result.resultRecord.\\\n sourcedGUID.sourcedId\n except:\n pass\n\n try:\n result = root.imsx_POXBody.readResultRequest\n self.operation = READ_REQUEST\n # Get result sourced id from resultRecord\n self.lis_result_sourcedid = result.resultRecord.\\\n sourcedGUID.sourcedId\n except:\n pass", "metadata": "root.OutcomeRequest.process_xml", "header": "['class', 'OutcomeRequest', '(', ')', ':', '___EOS___']", "index": 170 } ]
[ { "span": "except:", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 15 }, { "span": "except:", "start_line": 195, "start_column": 8, "end_line": 195, "end_column": 15 }, { "span": "except:", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Outcome", "Request_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "xml_", "(_", "self_", ",_", "xml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "Outcome", " ", "Request", " ", "data", " ", "from", " ", "XML", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "objecti", "fy_", "._", "fromstring_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message", "\\u", "identifier_", "=_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "._", "ims", "x", "\\u", "PO", "XH", "eader", "_", "._", "ims", "x", "\\u", "PO", "XR", "eque", "st", "Head", "er", "Info_", "._", "\\u\\u\\uNL\\u\\u\\u_", "ims", "x", "\\u", "message", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "root_", "._", "ims", "x", "\\u", "PO", "XB", "ody", "_", "._", "replace", "Result", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operation_", "=_", "REPLACE", "\\u", "REQUEST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "result", " ", "sourced", " ", "id", " ", "from", " ", "result", "Record_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lis", "\\u", "result", "\\u", "sourced", "id_", "=_", "result_", "._", "result", "Record_", "._", "sourced", "GUID", "_", "._", "sourced", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "score_", "=_", "str_", "(_", "result_", "._", "result", "Record_", "._", "result_", "._", "\\u\\u\\uNL\\u\\u\\u_", "result", "Score_", "._", "text", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "root_", "._", "ims", "x", "\\u", "PO", "XB", "ody", "_", "._", "delete", "Result", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operation_", "=_", "DELET", "E", "\\u", "REQUEST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "result", " ", "sourced", " ", "id", " ", "from", " ", "result", "Record_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lis", "\\u", "result", "\\u", "sourced", "id_", "=_", "result_", "._", "result", "Record_", "._", "sourced", "GUID", "_", "._", "sourced", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "root_", "._", "ims", "x", "\\u", "PO", "XB", "ody", "_", "._", "read", "Result", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operation_", "=_", "READ", "\\u", "REQUEST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "result", " ", "sourced", " ", "id", " ", "from", " ", "result", "Record_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lis", "\\u", "result", "\\u", "sourced", "id_", "=_", "result_", "._", "result", "Record_", "._", "sourced", "GUID", "_", "._", "sourced", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
kayhayen/Nuitka/tests/syntax/ClosureDel_2.py
[ { "content": "def deletingClosure():\n a = 1\n\n def closureTaker():\n return a\n\n del a\n\n try:\n x = closureTaker()\n except Exception as e:\n print \"Occurred %r\" % e", "metadata": "root.deletingClosure", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "x ", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "delet", "ing", "Clos", "ure_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clos", "ure", "Tak", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "a_", "\\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 ", " _", "x_", "=_", "clos", "ure", "Tak", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Occur", "red", " ", "%", "r", "\"_", "%_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
globocom/database-as-a-service/dbaas/workflow/steps/mongodb/upgrade/prereq_change_storage_engine_single.py
[ { "content": " def undo(self, workflow_dict):\n try:\n pass\n\n return True\n except Exception:\n traceback = full_stack()\n\n workflow_dict['exceptions']['error_codes'].append(DBAAS_0023)\n workflow_dict['exceptions']['traceback'].append(traceback)\n\n return False", "metadata": "root.PreReqChangeMongoDBStorageEngine.undo", "header": "['class', 'PreReqChangeMongoDBStorageEngine', '(', 'BaseStep', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "except Exception:", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Pre", "Re", "q", "Change", "Mon", "go", "DB", "Stor", "age", "Engine_", "(_", "Base", "Step_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "undo_", "(_", "self_", ",_", "workf", "low", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\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 ", " _", "traceback_", "=_", "full", "\\u", "stack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workf", "low", "\\u", "dict_", "[_", "'", "exception", "s", "'_", "]_", "[_", "'", "error", "\\u", "codes", "'_", "]_", "._", "append_", "(_", "DBA", "AS", "\\u", "002", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workf", "low", "\\u", "dict_", "[_", "'", "exception", "s", "'_", "]_", "[_", "'", "traceback", "'_", "]_", "._", "append_", "(_", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "False_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
sympy/sympy/sympy/assumptions/tests/test_assumptions_2.py
[ { "content": "\"\"\"\nrename this to test_assumptions.py when the old assumptions system is deleted\n\"\"\"\nfrom sympy.abc import x, y\nfrom sympy.assumptions.assume import global_assumptions, Predicate\nfrom sympy.assumptions.ask import _extract_facts, Q\nfrom sympy.core import symbols\nfrom sympy.logic.boolalg import Or\nfrom sympy.printing import pretty\nfrom sympy.assumptions.ask import Q\nfrom sympy.utilities.pytest import XFAIL\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_equal():\n \"\"\"Test for equality\"\"\"\n assert Q.positive(x) == Q.positive(x)\n assert Q.positive(x) != ~Q.positive(x)\n assert ~Q.positive(x) == ~Q.positive(x)", "metadata": "root.test_equal", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def test_pretty():\n assert pretty(Q.positive(x)) == \"Q.positive(x)\"\n assert pretty(\n set([Q.positive, Q.integer])) == \"set([Q.integer, Q.positive])\"", "metadata": "root.test_pretty", "header": "['module', '___EOS___']", "index": 20 }, { "content": "def test_extract_facts():\n a, b = symbols('a b', cls=Predicate)\n assert _extract_facts(a(x), x) == a\n assert _extract_facts(a(x), y) is None\n assert _extract_facts(~a(x), x) == ~a\n assert _extract_facts(~a(x), y) is None\n assert _extract_facts(a(x) | b(x), x) == a | b\n assert _extract_facts(a(x) | ~b(x), x) == a | ~b\n assert _extract_facts(a(x) & b(y), x) == a\n assert _extract_facts(a(x) & b(y), y) == b\n assert _extract_facts(a(x) | b(y), x) == None\n assert _extract_facts(~(a(x) | b(y)), x) == ~a", "metadata": "root.test_extract_facts", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def test_global():\n \"\"\"Test for global assumptions\"\"\"\n global_assumptions.add(Q.is_true(x > 0))\n assert Q.is_true(x > 0) in global_assumptions\n global_assumptions.remove(Q.is_true(x > 0))\n assert not Q.is_true(x > 0) in global_assumptions\n # same with multiple of assumptions\n global_assumptions.add(Q.is_true(x > 0), Q.is_true(y > 0))\n assert Q.is_true(x > 0) in global_assumptions\n assert Q.is_true(y > 0) in global_assumptions\n global_assumptions.clear()\n assert not Q.is_true(x > 0) in global_assumptions\n assert not Q.is_true(y > 0) in global_assumptions", "metadata": "root.test_global", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "from sympy.logic.boolalg import Or", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 34 }, { "span": "from sympy.utilities.pytest import XFAIL", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "rename", " ", "this", " ", "to", " ", "test\\u", "assumption", "s", ".", "py", " ", "whe", "n", " ", "the", " ", "old", " ", "assumption", "s", " ", "system", " ", "is", " ", "delete", "d", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "abc_", "import_", "x_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "assumption", "s_", "._", "assume", "_", "import_", "global", "\\u", "assumption", "s_", ",_", "Predicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "assumption", "s_", "._", "ask_", "import_", "\\u", "extract", "\\u", "facts_", ",_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "core_", "import_", "symbols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "logic_", "._", "bool", "alg_", "import_", "Or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "printin", "g_", "import_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "assumption", "s_", "._", "ask_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "utilities_", "._", "pytest_", "import_", "XF", "AI", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "equal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "for", " ", "equality", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "._", "positive_", "(_", "x_", ")_", "==_", "Q_", "._", "positive_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "._", "positive_", "(_", "x_", ")_", "!=_", "~_", "Q_", "._", "positive_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "~_", "Q_", "._", "positive_", "(_", "x_", ")_", "==_", "~_", "Q_", "._", "positive_", "(_", "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_", "test\\u", "pretty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "pretty_", "(_", "Q_", "._", "positive_", "(_", "x_", ")_", ")_", "==_", "\"", "Q", ".", "posit", "ive", "(", "x", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pretty_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "(_", "[_", "Q_", "._", "positive_", ",_", "Q_", "._", "integer_", "]_", ")_", ")_", "==_", "\"", "set", "([", "Q", ".", "integ", "er", ",", " ", "Q", ".", "posit", "ive", "])\"_", "\\u\\u\\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", "extract", "\\u", "facts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "b_", "=_", "symbols_", "(_", "'", "a", " ", "b", "'_", ",_", "cls_", "=_", "Predicate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", ",_", "x_", ")_", "==_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", ",_", "y_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "~_", "a_", "(_", "x_", ")_", ",_", "x_", ")_", "==_", "~_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "~_", "a_", "(_", "x_", ")_", ",_", "y_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", "|_", "b_", "(_", "x_", ")_", ",_", "x_", ")_", "==_", "a_", "|_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", "|_", "~_", "b_", "(_", "x_", ")_", ",_", "x_", ")_", "==_", "a_", "|_", "~_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", "&_", "b_", "(_", "y_", ")_", ",_", "x_", ")_", "==_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", "&_", "b_", "(_", "y_", ")_", ",_", "y_", ")_", "==_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "a_", "(_", "x_", ")_", "|_", "b_", "(_", "y_", ")_", ",_", "x_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "extract", "\\u", "facts_", "(_", "~_", "(_", "a_", "(_", "x_", ")_", "|_", "b_", "(_", "y_", ")_", ")_", ",_", "x_", ")_", "==_", "~_", "a_", "\\u\\u\\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", "global_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "for", " ", "global", " ", "assumption", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "assumption", "s_", "._", "add_", "(_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "assumption", "s_", "._", "remove_", "(_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "same", " ", "with", " ", "multiple", " ", "of", " ", "assumption", "s_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "assumption", "s_", "._", "add_", "(_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", ",_", "Q_", "._", "is", "\\u", "true_", "(_", "y_", ">_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "._", "is", "\\u", "true_", "(_", "y_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "assumption", "s_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "Q_", "._", "is", "\\u", "true_", "(_", "x_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "Q_", "._", "is", "\\u", "true_", "(_", "y_", ">_", "0_", ")_", "in_", "global", "\\u", "assumption", "s_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
AppScale/appscale/AppServer/google/appengine/ext/preload/__init__.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\n\n\n\"\"\"Preloads many modules to reduce loading time of third-party code.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\n_original_os_urandom = os.urandom\nos.urandom = os_urandom_replacement\nimport random\n\n\n\nos.urandom = _original_os_urandom\nrandom._urandom = _original_os_urandom\n\n\nimport BaseHTTPServer\nimport Bastion\nimport CGIHTTPServer\nimport ConfigParser\nimport Cookie\nimport DocXMLRPCServer\nimport HTMLParser\nimport MimeWriter\nimport Queue\nimport SimpleHTTPServer\nimport SimpleXMLRPCServer\nimport SocketServer\nimport StringIO\nimport UserDict\nimport UserList\nimport UserString\nimport aifc\nimport anydbm\n\n\nimport atexit\nimport audiodev\nimport base64\nimport bdb\nimport binhex\nimport bisect\nimport bz2\n\nimport calendar\nimport cgi\nimport cgitb\nimport chunk\nimport cmd\nimport code\nimport codecs\nimport codeop\nimport colorsys\nimport commands\n\n\nimport cookielib\nimport copy\nimport copy_reg\nimport csv\nimport datetime\n\n\nimport difflib\nimport dircache\nimport dis\nimport doctest\nimport dumbdbm\nimport filecmp\nimport fileinput\nimport fnmatch\nimport formatter\nimport fpformat\nimport ftplib\n\nimport getopt\nimport getpass\nimport gettext\nimport glob\n\nimport gzip\n\nimport heapq\nimport hmac\nimport htmlentitydefs\nimport htmllib\nimport httplib\n\nimport imaplib\nimport imghdr\nimport imputil\nimport inspect\nimport keyword\nimport linecache\nimport locale\nimport logging\nimport macpath\nimport macurl2path\nimport mailbox\nimport mailcap\nimport markupbase\nimport math\nimport md5\nimport mhlib\nimport mimetools\nimport mimetypes\n\nimport modulefinder\nimport multifile\nimport mutex\nimport netrc\nimport new\nimport nntplib\nimport ntpath\nimport nturl2path\nimport opcode\nimport optparse\nimport os2emxpath\nimport pdb\nimport pickle\nimport pickletools\nimport pipes\nimport pkgutil\n\nimport popen2\nimport poplib\n\nimport posixpath\nimport pprint\nimport profile\nimport pstats\n\n\nimport pyclbr\nimport pydoc\nimport quopri\nimport re\nimport repr\n\nimport rfc822\n\nimport robotparser\n\nimport sched\nimport sets\nimport sgmllib\nimport sha\nimport shelve\nimport shlex\nimport shutil\nimport site\n\nimport smtplib\nimport sndhdr\nimport socket\n\n\n\n\nimport stat\nimport statvfs\nimport string\nimport stringold\nimport stringprep\nimport struct\n\nimport sunau\nimport sunaudio\nimport symbol\n\nimport sys\nimport tabnanny\nimport tarfile\nimport telnetlib\nimport tempfile\nimport textwrap\n\nimport time\nimport timeit\nimport toaiff\nimport token\nimport tokenize\nimport trace\nimport traceback\n\nimport types\nimport unittest\nimport urllib\nimport urllib2\nimport urlparse\n\nimport uu\nimport uuid\nimport warnings\nimport wave\nimport weakref\n\nimport whichdb\nimport xdrlib\nimport xml.parsers.expat\nimport xml.dom\nimport xml.sax\n\nimport xmlrpclib\nimport zipfile\nimport zlib\n\n\n\nimport neo_cs\nimport neo_util\nimport webob\nimport wsgiref.handlers\n\n\nfrom google.appengine.api import datastore\nfrom google.appengine.api import files\nfrom google.appengine.api import images\nfrom google.appengine.api import mail\nfrom google.appengine.api import memcache\nfrom google.appengine.api import runtime\nfrom google.appengine.api import taskqueue\nfrom google.appengine.api import urlfetch\nfrom google.appengine.api import users\n\n\nfrom google.appengine.ext import bulkload\nfrom google.appengine.ext import db\nfrom google.appengine.ext import gql\nfrom google.appengine.ext import search\nfrom google.appengine.ext import webapp\n\n\nfrom google.appengine.runtime import apiproxy\n\nif __name__ == '__main__':\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "MimeWriter", "start_line": 56, "start_column": 7, "end_line": 56, "end_column": 17 }, { "span": "md5", "start_line": 135, "start_column": 7, "end_line": 135, "end_column": 10 }, { "span": "mimetools", "start_line": 137, "start_column": 7, "end_line": 137, "end_column": 16 }, { "span": "multifile", "start_line": 141, "start_column": 7, "end_line": 141, "end_column": 16 }, { "span": "rfc822", "start_line": 172, "start_column": 7, "end_line": 172, "end_column": 13 }, { "span": "sets", "start_line": 177, "start_column": 7, "end_line": 177, "end_column": 11 }, { "span": "sha", "start_line": 179, "start_column": 7, "end_line": 179, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Pre", "load", "s", " ", "many", " ", "module", "s", " ", "to", " ", "reduce", " ", "load", "ing", " ", "time", " ", "of", " ", "third", "-", "part", "y", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "=_", "os_", "._", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "urandom_", "=_", "os", "\\u", "uran", "dom", "\\u", "replacement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "urandom_", "=_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "\\u", "urandom_", "=_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Base", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Bas", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGI", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Cookie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Doc", "XMLRPC", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "HTM", "LP", "arser", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Mim", "e", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Simple", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Simple", "XMLRPC", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Sock", "et", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "aif", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "any", "dbm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "audio", "dev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bdb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bin", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bisect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bz2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi", "tb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "colors", "ys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cookie", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy", "\\u", "reg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "difflib", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dir", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dumb", "dbm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "filec", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fileinput_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fp", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ftp", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html", "entity", "defs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "imap", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "img", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imput", "il_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "linec", "ache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mac", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mac", "url2", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mailbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mail", "cap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "markup", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mh", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mime", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "module", "finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multi", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mutex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "net", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nn", "tpl", "ib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ntpath", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ntu", "rl", "2p", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "opcode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os", "2e", "mx", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pipes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "popen", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pop", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "posixpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pstat", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyc", "lbr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pydo", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "quo", "pri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "rfc", "822", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "robot", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sched_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sg", "ml", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shelve", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "smtplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "snd", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat", "vfs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string", "prep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sun", "au_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sun", "audio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tab", "nan", "ny_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "telnet", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "toa", "iff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tokenize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "uu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wave_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "whi", "chd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xdr", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "parsers_", "._", "expa", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "sax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "xmlrpclib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "neo", "\\u", "cs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "neo", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wsgi", "ref_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "task", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "urlf", "etch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "bul", "kl", "oad", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "gq", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "webapp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "runtime_", "import_", "api", "proxy_", "\\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 ", " _", "pass_", "\\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, 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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 ]
Unused local variable
lsbardel/python-stdnet/tests/all/query/transaction.py
[ { "content": " def testCreate(self):\n session = self.session()\n query = session.query(self.model)\n with session.begin() as t:\n self.assertEqual(t.session, session)\n s = t.add(self.model(code='test', description='just a test'))\n self.assertFalse(s.id)\n s2 = session.add(self.model(code='test2',\n description='just a test'))\n yield t.on_result\n all = yield query.filter(code=('test','test2')).all()\n self.assertEqual(len(all), 2)\n receiver = self.receiver\n self.assertTrue(len(receiver.transactions), 1)\n sender, instances = receiver.transactions[0]\n self.assertEqual(sender, self.model)\n self.assertTrue(instances)\n self.assertEqual(instances, all)", "metadata": "root.TestTransactions.testCreate", "header": "['class', 'TestTransactions', '(', 'test', '.', 'TestWrite', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "s2 ", "start_line": 35, "start_column": 12, "end_line": 35, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Transactions", "_", "(_", "test_", "._", "Test", "Write_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "session_", "._", "query_", "(_", "self_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "session_", "._", "begin_", "(_", ")_", "as_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "session_", ",_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "t_", "._", "add_", "(_", "self_", "._", "model_", "(_", "code_", "=_", "'", "test", "'_", ",_", "description_", "=_", "'", "just", " ", "a", " ", "test", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "s_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "=_", "session_", "._", "add_", "(_", "self_", "._", "model_", "(_", "code_", "=_", "'", "test", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "just", " ", "a", " ", "test", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "t_", "._", "on", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all_", "=_", "yield_", "query_", "._", "filter_", "(_", "code_", "=_", "(_", "'", "test", "'_", ",_", "'", "test", "2", "'_", ")_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "all_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receiver_", "=_", "self_", "._", "receiver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "receiver_", "._", "transactions_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sender_", ",_", "instances_", "=_", "receiver_", "._", "transactions_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sender_", ",_", "self_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", ",_", "all_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Deprecated slice method
benoitc/couchdbkit/couchdbkit/schema/properties.py
[ { "content": " def __delslice__(self, i, j):\n del self.doc[i:j]\n list.__delslice__(self, i, j)", "metadata": "root.LazyList.__delslice__", "header": "['class', 'LazyList', '(', 'list', ')', ':', '___EOS___']", "index": 677 }, { "content": " def __getslice__(self, i, j):\n return LazyList(self.doc[i:j], self.item_type)", "metadata": "root.LazyList.__getslice__", "header": "['class', 'LazyList', '(', 'list', ')', ':', '___EOS___']", "index": 681 }, { "content": " def __setslice__(self, i, j, seq):\n self.doc[i:j] = (value_to_json(v, item_type=self.item_type) for v in seq)\n list.__setslice__(self, i, j, seq)", "metadata": "root.LazyList.__setslice__", "header": "['class', 'LazyList', '(', 'list', ')', ':', '___EOS___']", "index": 684 } ]
[ { "span": "def __delslice__(self, i, j):", "start_line": 677, "start_column": 4, "end_line": 677, "end_column": 33 }, { "span": "def __getslice__(self, i, j):", "start_line": 681, "start_column": 4, "end_line": 681, "end_column": 33 }, { "span": "def __setslice__(self, i, j, seq):", "start_line": 684, "start_column": 4, "end_line": 684, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "La", "zy", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dels", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "doc_", "[_", "i_", ":_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "._", "\\u\\u", "dels", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "La", "zy", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gets", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "La", "zy", "List_", "(_", "self_", "._", "doc_", "[_", "i_", ":_", "j_", "]_", ",_", "self_", "._", "item", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "La", "zy", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ",_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "doc_", "[_", "i_", ":_", "j_", "]_", "=_", "(_", "value", "\\u", "to", "\\u", "json_", "(_", "v_", ",_", "item", "\\u", "type_", "=_", "self_", "._", "item", "\\u", "type_", ")_", "for_", "v_", "in_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "._", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ",_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tvidas/a5/scripts/bin/control.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# requires:\n# beanstalkc\n# PyYaml\n# \n# Update /etc/sysctl.conf to keep the arp entries from timing out\n# ARP cache entry timeout\n# net.ipv4.neigh.default.gc_stale_time = 3600\n#\nimport os\nimport sys\nimport time\nimport signal\nimport struct\nimport fcntl\nimport socket\nimport shutil\nimport re\nimport subprocess\nimport beanstalkc\nimport syslog\nimport pprint\nimport random\nimport shlex\nimport traceback\nfrom pwd import getpwnam\nfrom grp import getgrnam\nimport multiprocessing \nfrom lxml import etree\nimport msdb\nimport libIntent\nimport logging\n\n#Read and execute global config\n#exec open('/opt/ms/config/config.py').read()\nsys.path.append('../config')\nfrom config import *\n\n#this is global and will be assigned early in main\nlogger = None\n\n\n\n\n\n\n__DEBUG__ = True\n\n#number of children workers to spawn\n# could be multiprocessing.cpu_count() - 1\nNUMWORKERS = 5\nNUMACTIVEWORKERS = 5\nADBPORT = 5554\nPSIZE = 128\nADBTRIES = 10\n\n\nVM_POLL_REST = 7\n\n#TODO used commands like this to give helpful error messages when avd create fails\n#\"android update sdk --no-ui\" \n#\"android list sdk\" \n#\"./android update sdk --no-ui -n --filter 1,2,11\" (2.2, plus tools) \n#\"./android list targets\"\n\n#emulator default sdcard size, in MB\nVMSDCARD = 100\n\n\n#no reason to do anything if we can't get to adb or emulator\nif not os.path.isfile(SDKPATH + \"/emulator\"):\n\tlogger.info( \"can't find emulator at %s\" % SDKPATH)\nif not os.path.isfile(ADBPATH + \"/adb\"):\n\tlogger.info( \"can't find adb at %s\" % ADBPATH)\n\n\n#Globals\nbeanstalk = None\nADBFAILCOUNT = None\n#beanstalk = beanstalkc.Connection(host=BSHOST, port=BSPORT)\n#beanstalk.watch(BSMSBOXQ)\n#beanstalk.use(BSMSBOXQ)\n#beanstalk.ignore('default')\n\n\n\n#setup syslog output - this is where we will write all messages\n#syslog.openlog(os.path.basename(sys.argv[0]), syslog.LOG_PID, syslog.LOG_DAEMON)\nsyslog.openlog(\"MS\", syslog.LOG_PID, syslog.LOG_DAEMON)\n\n#global flag to signal termination. No need for event.\nflagTerminate = False\n\n\n\n\n\n\n\t\t\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\tmain()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Consumer(multiprocessing.Process):\n \n", "metadata": "root.Consumer", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self, task_queue, result_queue):\n multiprocessing.Process.__init__(self)\n self.task_queue = task_queue\n self.result_queue = result_queue", "metadata": "root.Consumer.__init__", "header": "['class', 'Consumer', '(', 'multiprocessing', '.', 'Process', ')', ':', '___EOS___']", "index": 45 }, { "content": " def run(self):\n proc_name = self.name\n while True:\n next_task = self.task_queue.get()\n if next_task is None:\n # Poison pill means we should exit\n logger.info( '%s: Exiting' % proc_name)\n break\n logger.info( '%s: %s' % (proc_name, next_task))\n answer = next_task()\n self.result_queue.put(answer)\n return", "metadata": "root.Consumer.run", "header": "['class', 'Consumer', '(', 'multiprocessing', '.', 'Process', ')', ':', '___EOS___']", "index": 50 }, { "content": "class Task(object):", "metadata": "root.Task", "header": "['module', '___EOS___']", "index": 64 }, { "content": " def __init__(self, a, b):\n self.a = a\n self.b = b", "metadata": "root.Task.__init__", "header": "['class', 'Task', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def __call__(self):\n time.sleep(0.1) # pretend to take some time to do our work\n return '%s * %s = %s' % (self.a, self.b, self.a * self.b)", "metadata": "root.Task.__call__", "header": "['class', 'Task', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def __str__(self):\n return '%s * %s' % (self.a, self.b)", "metadata": "root.Task.__str__", "header": "['class', 'Task', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": "class ActivePool(object):", "metadata": "root.ActivePool", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def __init__(self):\n super(ActivePool, self).__init__()\n self.mgr = multiprocessing.Manager()\n self.active = self.mgr.list()\n self.lock = multiprocessing.Lock()", "metadata": "root.ActivePool.__init__", "header": "['class', 'ActivePool', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def makeActive(self, name):\n with self.lock:\n self.active.append(name)", "metadata": "root.ActivePool.makeActive", "header": "['class', 'ActivePool', '(', 'object', ')', ':', '___EOS___']", "index": 80 }, { "content": " def makeInactive(self, name):\n with self.lock:\n self.active.remove(name)", "metadata": "root.ActivePool.makeInactive", "header": "['class', 'ActivePool', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def __str__(self):\n with self.lock:\n return str(self.active)", "metadata": "root.ActivePool.__str__", "header": "['class', 'ActivePool', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": "class AVM(object):", "metadata": "root.AVM", "header": "['module', '___EOS___']", "index": 129 }, { "content": " def __init__(self, name, path, state, version):\n\tself.name = name\n\tself.path = path\n\tself.state = state\n\tself.version = version", "metadata": "root.AVM.__init__", "header": "['class', 'AVM', '(', 'object', ')', ':', '___EOS___']", "index": 130 }, { "content": " def setVersion(self, v):\n\tself.state = v ", "metadata": "root.AVM.setVersion", "header": "['class', 'AVM', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": " def setState(self, state):\n\tself.state = state", "metadata": "root.AVM.setState", "header": "['class', 'AVM', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": "def sigint_handler(signal, frame):\n\tglobal flagTerminate\n\tsyslog.syslog('Caught SIGINT - Waiting for %d active jobs to terminate...' % len(assignments))\n\tflagTerminate = True", "metadata": "root.sigint_handler", "header": "['module', '___EOS___']", "index": 148 }, { "content": "def formatExceptionInfo(maxTBlevel=5):\n cla, exc, trbk = sys.exc_info()\n excName = cla.__name__\n try:\n excArgs = exc.__dict__[\"args\"]\n except KeyError:\n excArgs = \"<no args>\"\n excTb = traceback.format_tb(trbk, maxTBlevel)\n return (excName, excArgs, excTb)", "metadata": "root.formatExceptionInfo", "header": "['module', '___EOS___']", "index": 153 }, { "content": "def get_VMs(VMs):\n #lookup from filesystem\n #VMs[2] = avm({\"name\": \"ms-vm002\", \"path\": \"some/path/\", \"state\": \"Off\", \"version\": \"5\"})\n for item in os.listdir(VMBASEDIR):\n if os.path.isdir(os.path.join(VMBASEDIR, item)):\n m = re.match(\"ms-sdk(\\d{3})-\\d{3}\",item)\n if m :\n logger.info( item)\n logger.info( m.group(1))\n\t\t d = {\"name\": m.group(0), \"path\": os.path.join(VMBASEDIR, item), \"state\": \"Off\", \"version\": m.group(1)}\n\t\t VMs[m.group(0)] = AVM(**d)\n\t\t #VMs[m.group(0)] = (avm({\"name\": m.group(0), \"path\": os.path.join(VMBASEDIR, item), \"state\": \"Off\", \"version\": m.group(1)}))", "metadata": "root.get_VMs", "header": "['module', '___EOS___']", "index": 163 }, { "content": "def list_VMs(VMs):\n\tlogger.debug(\"---VMList---\")\n\tfor i in VMs.keys():\n\t\tlogger.debug( \"%s %s %10s %s \" % (VMs[i].name, VMs[i].path, VMs[i].state, VMs[i].version))\n\tlogger.debug(\"------------\")\n\tfor i in VMs.keys():\n\t\tif VMs[i].state != \"Off\":\n\t\t\tlogger.info( \"%s %s %10s %s \" % (VMs[i].name, VMs[i].path, VMs[i].state, VMs[i].version))", "metadata": "root.list_VMs", "header": "['module', '___EOS___']", "index": 176 }, { "content": "def kick_adb():\n\tname = multiprocessing.current_process().name\n\tADBKICK = \"%s/adb kill-server\"\n\t#whatever the next issue of adb is, it will automatically start the server again\n\tcmd = ADBKICK % ( ADBPATH )\n\tlogger.info( name + \":\" + cmd)\n\ttry:\n\t\targs = shlex.split(cmd)\n\t\tpKick = subprocess.Popen(args)\n\t\tpKick.terminate()\n\texcept:\n\t\tlogger.info( name + \":\" + \"adb kick error\", sys.exc_info()[0])", "metadata": "root.kick_adb", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def kick_adb_maybe(adbl,fcnt):\n\twith adbl:\n\t\tfcnt.value += 1\n\t\tif fcnt.value > 20:\n\t\t\tfcnt.value = 0\n\t\t\tkick_adb()", "metadata": "root.kick_adb_maybe", "header": "['module', '___EOS___']", "index": 198 }, { "content": "def find_key(dic, val):\n\t\"\"\"return the key of dictionary dic given the value\"\"\"\n\treturn [k for k, v in dic.iteritems() if v == val][0]", "metadata": "root.find_key", "header": "['module', '___EOS___']", "index": 206 }, { "content": "def error_log(msg):\n\tlogmsg = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime()) + ' : ' + msg\n\tlogger.info( logmsg)\n\tsyslog.syslog(logmsg)", "metadata": "root.error_log", "header": "['module', '___EOS___']", "index": 210 }, { "content": "def updateStatus(workers,alive,dead):\n\tf = open('ms-status.csv','w')\n\tf.write(\"%s,%s,%s\" % (workers,alive,dead))\n\tf.close()", "metadata": "root.updateStatus", "header": "['module', '___EOS___']", "index": 215 }, { "content": "def runInVM(m,job,VMs,adbport,vmlock,adbl,results, fcnt):\n\tname = multiprocessing.current_process().name\n\n \tformatter = logging.Formatter(fmt=LOGFORMAT,datefmt=LOGDATEFORMAT)\n \tpathForFile = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-run.log\"\n\tprint \"HH%sHH\" % pathForFile\n \thandler = logging.FileHandler(pathForFile, mode='w')\n \thandler.setFormatter(formatter)\n\n \tvlogger = logger.getChild(\"worker\" + name + \".vm\")\n \tvlogger.setLevel(logging.DEBUG)\n \tvlogger.addHandler(handler)\n\n\tvlogger.info(\"logging started at \" + pathForFile)\n\n\n\trval = True\n\tif VMs[m].state in [\"Reserved\"] :\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Starting\"\n\t\t\tVMs[m] = VMlocal;\n\t\t#emulator doens't observe system hosts: (must start emulator with -partition-size 128 (for example) to give room to write)\n\t\t#adb pull /etc/hosts\n\t\t#edit to 10.0.2.2 (your local machine)\n\t\t#adb remount\n\t\t#adb push hosts /etc/hosts\n\t\tt1 = time.time()\n\t\t\n\n\t\t#emulator -avd NAME -partition-size 128 -ports 5,2322 -no-window -tcpdump FILE -dns-server SERVER -http-proxy PROXY\n\t\t#TODO instead of wipe-data, would be best to re-create the VM\n\t\tEMUSTART = \"%s/emulator -avd %s -partition-size %s -port %s -no-window -tcpdump %s -wipe-data\"\n\t\t#./adb logcat\n\t\t#./adb install /storage/malware/RU.apk\n\t\t#./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED\n\n\t\t#start (with specified ports)\n\t\t#emulator -ports X,Y @avd_X\n\n\t\t#wait for emulator to be fully started\n\t\t#./adb -s emulator-5584 wait-for-device\n\t\tEMUWAIT = \"%s/adb -s %s wait-for-device\"\n\n\t\tEMULOGCAT = \"%s/adb -s %s logcat\"\n\n\t\t#command\n\t\t#adb -s emualtor-X shell cmd\n\n\t\tEMUINSTALL = \"%s/adb -s %s install %s\"\n\n\t\t#<INTENT> specifications include these flags:\n\t\t# [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n\t\t# [-c <CATEGORY> [-c <CATEGORY>] ...]\n\t\t# [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]\n\t\t# [--esn <EXTRA_KEY> ...]\n\t\t# [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]\n\t\t# [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]\n\t\t#adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver\n\t\t#am broadcast -a android.intent.action.BOOT_COMPLETED\n\t\tEMUINTENT = \"%s/adb -s %s shell am broadcast -a %s\"\n\t\n\t\t#adb shell am start -n com.package.name/com.package.name.ActivityName\n\t\t#am start -a android.intent.action.MAIN -n com.iftitah.android.contact/com.iftitah.android.contact.Contact\n\t\t#am start -a <ACTION> -n <PACKAGE>/<PACKAGE><ACTIVITYCLASS>\n\t\tEMULAUNCH = \"%s/adb -s %s shell am start -a %s -n %s/%s\"\n\n\t\t#kill\n\t\t#could do adb shell stop\n\t\t#but why really? just going to reset for next run anyway\n\t\t# (though a stop would preserve state)\n\t\t#adb -s emulator-X emu kill\n\t\tEMUKILL = \"%s/adb -s %s emu kill\"\n\n\t\t#monkey\n\t\t#$ adb shell monkey -v -p your.package.name 100 --ignore-security-exceptions -s SEED\n\t\tEMUMONKEY = \"%s/adb -s %s shell monkey -v -p %s 100 --ignore-security-exceptions -s %s --throttle 250\"\n\n\t\t#update database with start values\n\t\tpermissions_filename = job['sha256'] + \".xml\"\n\t\timage_used = VMs[m].name\n\t\tstart_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tmsdb.updateStartRun(job['jobuuid'],image_used,start_time,permissions_filename,MSVERSION)\n\n\t\tvlogger.info( name + \":\" + \"...starting VM \" + VMs[m].name)\n\t\t#start it\n\t\tcmd = EMUSTART % ( SDKPATH, VMs[m].name, PSIZE, str(adbport), MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256']+ \"-orig.pcap\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpEmu = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tpEmu = subprocess.Popen(args)\n\t\texcept:\n\t\t\tvlogger.info( name + \":\" + \"emulator start error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\t\t#check for start error conditions:\n\t\t#emulator: WARNING: ignoring locked SD Card image at /path/to/avd/ms-sdk003-003/sdcard.img\n\t\t#it seems too many emulator instances are running on this machine. Aborting\n\n\n\t\t#wait for it to start\n\t\tcmd = EMUWAIT % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator wait returned: %d\" % ret )\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator wait error: %s\" % cmd )\n\t\t\tsys.exit(1)\n\t\tvlogger.info( name + \":\" + \"emulator-\" + str(adbport) + \" started\")\n\t\ttime.sleep(VM_POLL_REST * 3)\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Running\"\n\t\t\tVMs[m] = VMlocal;\n\n\t\t#start logcat\n\t\t#start it\n\t\tcmd = EMULOGCAT % ( SDKPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpLogCat = None\n\t\tfLogCat = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tvlogger.info( args)\n\t\t\tfLogCat = open(MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".logcat\",\"w\")\n\t\t\tfNull = open(\"/dev/null\")\n#TODO\t\t\tpLogCat = subprocess.Popen(args, stdin=fNull, stderr=fNull, stdout=fLogCat)\n\t\texcept:\n\t\t\tvlogger.error( name + \": \" + cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tvlogger.error( name + \":\" + \"emulator logcat error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\n\t\t#install malicious app\n\t\tcmd = EMUINSTALL % ( ADBPATH, \"emulator-\" + str(adbport), \"'\" + job['fullpath'] + \"'\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator install returned: %s\" % ret )\n\t\t\tinstall_attempts = ADBTRIES\n\t\t\twhile \"Success\" not in ret and install_attempts > 0:\n\t\t\t\tkick_adb_maybe(adbl, fcnt)\n\t\t\t\tvlogger.info( name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\ttime.sleep(VM_POLL_REST)\n\n\t\t\t\t#TODO FIXME, track down why this sometimes stalls forever, seem on SDKs 11 and 14...\n\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\t\tinstall_attempts -= 1\n\t\t\t\tif install_attempts <= 0:\n\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\tvlogger.error(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator install fatal error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#possible errors:\n\t\t#Error: Could not access the Package Manager. Is the system running?\n\n\t\ttime.sleep(VM_POLL_REST * 3)\n\n\t\t#stimulate\n\t\tdoc = etree.parse( MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".xml\")\n\t\tpackage = doc.find('package')\n\n\t\t\n\t\tli = libIntent.libIntent(\"localhost\",adbport)\n\t\n\t\t#for each rint\n\t\tfor rint in doc.findall('rint'):\n\t\t\tvlogger.info( name + \" handling \" + str(rint.text))\n\t\t\tli.handleRIntent(str(rint.text))\n\n\t\t#for each permission (actions and rints _should_ catch all these....)\n\t\tfor perm in doc.findall('permission'):\n\t\t\tvlogger.info( name + \" handling \" + str(perm.text))\n\t\t\tli.handlePermission(str(perm.text))\n\n\t\t#for each action\n\t\tfor action in doc.findall('action'):\n\t\t\tvlogger.info( name + \" handling \" + str(action.text))\n\t\t\tli.handleAction(str(action.text))\n\t\t\t#BROADCASTS are done this way\n\t\t\t#cmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), \"android.intent.action.BOOT_COMPLETED\")\n\t\t\tcmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text))\n\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\ttry:\n\t\t\t\t#TODO check for \"Broadcast completed\" in output, repeat if necessary\n\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\texcept:\n\t\t\t\tsyslog.syslog(\"app %s error sending intent %s\" % (job['sha256'],str(action.text)))\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %s\" % cmd )\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %d\" % ret )\n\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t#sys.exit(1)\n\t\t\t\t#sys.exit(1)\n\n\t\t#somethings just don't have nice rint or actions\n\t\tli.sendCall()\n\t\ttime.sleep(VM_POLL_REST)\n\t\tli.endAllCalls()\n\n\t\t#open app\n\n\n\t\t# TODO this should not be a for/for loop, the actions shoudl be paired with activities\n\t\tfor activity in doc.findall('activity'):\n\t\t\tfor action in doc.findall('action'):\n\t\t\t\tvlogger.info( name + \": \" + \"################## launching activity \" + str(activity.text))\n\t\t\t\tcmd = EMULAUNCH % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text), str(package.text), str(activity.text))\n\t\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\t\ttry:\n\t\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\t\texcept:\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %s\" % cmd )\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %d\" % ret )\n\t\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t\t#sys.exit(1)\n\n\t\ttime.sleep(VM_POLL_REST * 5)\n\n\t\t#monkey around\n\t\tcmd = EMUMONKEY % ( ADBPATH, \"emulator-\" + str(adbport), str(package.text), random.randint(1,100))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator monkey returned: %s\" % ret )\n#\t\t\tmonkey_attempts = ADBTRIES\n#\t\t\twhile \"Success\" not in ret and monkey_attempts > 0:\n#\t\t\t\tkick_adb_maybe(adbl, fcnt)\n#\t\t\t\tvlogger.info( name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n#\t\t\t\ttime.sleep(VM_POLL_REST)\n#\n#\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n#\t\t\t\tmonkey_attempts -= 1\n#\t\t\t\tif monkey_attempts <= 0:\n#\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator monkey fatal error: %s\" % cmd )\n\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#kill\n\t\tcmd = EMUKILL % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator kill error\")\n\t\t\tsys.exit(1)\n\n\t\t#cleanup\n\t\tif pEmu.poll() is not None:\n\t\t\tvlogger.info( name + \": \" + \"poll is \" + str(pEmu.poll()))\n\t\t\ttry:\t\n\t\t\t\tpEmu.terminate()\n\t\t\texcept:\n\t\t\t\tvlogger.error( name + \": \" + \"pEmu term failed\")\n#TODO\t\tif pLogCat.poll() is not None:\n#TODO\t\t\tpLogCat.terminate()\n\t\tfLogCat.flush()\n\t\tfLogCat.close()\n\t\tfNull.close()\n\t\t\n\t\ttime.sleep(VM_POLL_REST)\n\t\tvlogger.info( name + \":\" + \"...stopping VM \" + VMs[m].name)\n\t\twith vmlock:\t\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Off\"\n\t\t\tVMs[m] = VMlocal;\n\t\n\t\tt2 = time.time()\t\n\n\t\tcomplete_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tresults_file = job['sha256'] + \".pcap\"\n\t\tmsdb.updateFinishRun(job['jobuuid'],complete_time,results_file)\n\n\t\t#post process pcap, pretty crude for now, adb uses it's port and port+1; so two prunes\n\t\t#...and it seems that adb uses 5555 regardless of which even port is specified\n\t\toriginalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-orig.pcap\"\n\t\ttmppcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-temp.pcap\"\n\t\tfinalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".pcap\"\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(adbport))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,tmppcap, str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(int(adbport)+1))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (tmppcap,finalpcap, str(int(adbport)+1))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(5555))\n#\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,finalpcap, str(adbport))\n#\t\tvlogger.info( name + \":\" + cmd)\n#\t\ttry:\n#\t\t\tret = subprocess.check_call([cmd], shell=True)\n#\t\texcept:\n#\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n#\t\t\tsys.exit(1)\n\n\t\t#TODO unique ip addresses\n\t\t#tshark -r <input.pcap> -T fields -e ip.dst ip.src | sort | uniq\n\n\n\t\tvlogger.info( name + \":\" + \"sample took %s seconds process\" % str(t2 - t1))\n\t\tresults.put(t2-t1)\n\n\telif VMs[m].state in [\"Off\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: found in state OFF!\")\n\t\trval = False\n\telif VMs[m].state in [\"Ready\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: is running and not available for new malware\")\n\t\trval = False\n\t\t#if m.name in assignments:\n\t\t#\tif assignments[m.name]['timeout'] <= time.time():\n\t\t#\t\t#do anything you want to wrap up\n\t\t#\t\tjob_post_process(m)\n\t\t#\t\tjob_cleanup(m)\n\t\t#\t\tvm_poweroff(m)\n\t\t#else: # if the machine is running but there is no job assigned to it then kill it\n\t\t#\tpcap_terminate(m)\n\t\t#\tvm_poweroff(m)\n#\telse: #not sure this is relevant...may need to remove it\n#\t\tvm_poweroff(m) #I need to get a list of states that I want to poweroff by default\n\treturn rval", "metadata": "root.runInVM", "header": "['module', '___EOS___']", "index": 221 }, { "content": "def findCompatibleVM(job,VMs,vml):\n\trval = None\t\n\twith vml:\n\t\t#logger.info( \" ...uuid is \" + job['jobuuid'])\n\t\t#logger.info( \" ...app target is \" + str(job['target']))\n\t\tfor m in VMs.keys():\n\t\t\t#logger.info( \" seeing if \" + VMs[m].name + \" is compat...\")\n\t\t\t#logger.info( \" ...version is \" + str(int(VMs[m].version)) + \" ...\")\n\t#\t\t#Don't process machines without the ms naming convention\n\t#\t\tif not re.match('ms-vm\\d{3}',VMs[m].name):\n\t#\t\t\tcontinue\n\n\n\t\t\t#if the AndroidManifest doesn't havd a minsdk, maxsdk or targetsdk, then we don't know anything\n\t\t\t#about what version the app was created for, so we randomly pick something\n\t\t\t#if we pick \"wrong\" for our VM set, the job will just get delayed and we'll pick something else later\n\n\t\t\ttargetsdk = int(job['target'])\n\t\t\tif targetsdk == 0:\n\t\t\t\ttargetsdk = random.randint(MINSDKVER,MAXSDKVER)\n\t\t\t\tsyslog.syslog(\"app %s didn't specify any sdk information selecting %s\" % (job['sha256'],targetsdk))\n\t\t\t\t\n\n\t# states are Off=not powered on, Ready=powered on and ready for malware, Running=currently running (some other) malware, reserved=found, but not on yet\n\t\t\tif VMs[m].state in [\"Off\"] and int(VMs[m].version) == targetsdk:\n\t\t\t\tif not flagTerminate: #Dont assign more jobs if we are terminating\n\t\t\t\t\tlogger.info( VMs[m].name + \" (\" + str(m) + \") is available\")\n\t\t\t\t\tVMlocal = VMs[m];\n\t\t\t\t\tVMlocal.setState(\"Reserved\")\n\t\t\t\t\tVMs[m] = VMlocal;\n\t\t\t\t\t\n\t\t\t\t\trval = m\n\t\t\t\t\tbreak\n\t\t\t\t\t#job_assign(m) #vm is started at end of job assignment\n\t\t\t\t\t#Uncomment the next time to debug one job at a time\n\t\t\t\t\t#flagTerminate = True\n\t\t\telif VMs[m].state in [\"Running\"]:\n\t\t\t\tv = 1\n\t\t\t\t#logger.info( VMs[m].name + \" is running and not available for new malware\")\n\t\t\t\t#if m.name in assignments:\n\t\t\t\t#\tif assignments[m.name]['timeout'] <= time.time():\n\t\t\t\t#\t\t#do anything you want to wrap up\n\t\t\t\t#\t\tjob_post_process(m)\n\t\t\t\t#\t\tjob_cleanup(m)\n\t\t\t\t#\t\tvm_poweroff(m)\n\t\t\t\t#else: # if the machine is running but there is no job assigned to it then kill it\n\t\t\t\t#\tpcap_terminate(m)\n\t\t\t\t#\tvm_poweroff(m)\n\t#\t\telse: #not sure this is relevant...may need to remove it\n\t#\t\t\tvm_poweroff(m) #I need to get a list of states that I want to poweroff by default\n\treturn rval", "metadata": "root.findCompatibleVM", "header": "['module', '___EOS___']", "index": 565 }, { "content": "def rebeanstalk():\n\tglobal beanstalk\n\tif not beanstalk:\n\t\terror_log('Re-establishing connection to beanstalkd')\n\t\tbeanstalk = beanstalkc.Connection(host=BSHOST, port=BSPORT)\n\t\tbeanstalk.watch(BSMSBOXQ)\n\t\tbeanstalk.use(BSMSBOXQ)\n\t\tbeanstalk.ignore('default')", "metadata": "root.rebeanstalk", "header": "['module', '___EOS___']", "index": 617 }, { "content": "def worker(s, pool, q, str1, VMs, vml, adbport, count, adbl, results, fcnt):\n #global assignments\n global beanstalk\n\n name = multiprocessing.current_process().name\n\n formatter = logging.Formatter(fmt=LOGFORMAT,datefmt=LOGDATEFORMAT)\n handler = logging.FileHandler(\"worker.log\")\n handler.setFormatter(formatter)\n\n wlogger = logger.getChild(\"worker\" + name)\n wlogger.setLevel(logging.DEBUG)\n wlogger.addHandler(handler)\n\n with s:\n pool.makeActive(name)\n\twhile True:\n\t\t#funky kill pill\n\t\tcontent = q.get()\n\t\tq.put(content)\n \tif content == \"die\":\n\t\t\twlogger.info( name + \":\" + \" is committing suicide\")\n\t\t\tpool.makeInactive(name)\n\t\t\tsys.exit(0)\n\t\telse:\n\t\t\t#logger.info( 'Now running: %s %s %s (%s)' % (str(pool), str1, content,adbport))\n\t\t\twlogger.info( name + \":\" + \" is working...\")\n\n\t\t\t#check for a job in the beanstalk Q\n\t\t\t#if not beanstalk:\n\t\t\t#\terror_log('Re-establishing connection to beanstalkd')\n\t\t\t#\tbeanstalk = beanstalkc.Connection(host=BSHOST, port=BSPORT)\n\t\t\t#\tbeanstalk.watch(BSMSBOXQ)\n\t\t\t#\tbeanstalk.use(BSMSBOXQ)\n\t\t\t#\tbeanstalk.ignore('default')\n\t\t\trebeanstalk()\n\n\t\t\t#all this checking is just \"best effort\" another thread may still reserve first\n\t\t\tif BSMSBOXQ not in beanstalk.tubes():\n\t\t\t\t\twlogger.info( name + \":\" + \"there are no samples in the beanstalk\")\n\t\t\telse:\n\t\t\t\tarejobs = beanstalk.peek_ready()\n\t\t\t\tif arejobs is None:\n\t\t\t\t\twlogger.info( name + \":\" + \"there are no samples ready in the beanstalk\")\n\t\t\t\t\ttime.sleep(VM_POLL_REST)\n\t\t\t\telse:\n\n\t\t\t\t\t#we want to reserve, not peak_ready because if we can't process, we want to release with a delay later\n\t\t\t\t\tbeansalkjob = None\n\t\t\t\t\ttry:\n\t\t\t\t\t\tbeanstalkjob = beanstalk.reserve()\n\t\t\t\t\texcept:\n\t\t\t\t\t\twlogger.info( name + \": \" + \"beanstalk reserve error, probably out of jobs\")\n\n\t\t\t\t\t#if there was a job and we got it then queue up analysis\n\t\t\t\t\tjob = None\n\t\t\t\t\tif beanstalkjob:\n\t\t\t\t\t\ttry:\n\t\t\t\t\t\t\tjob = eval(beanstalkjob.body)\n\t\t\t\t\t\texcept:\n\t\t\t\t\t\t\terror_log('ERROR: could not eval job - invalid job')\n\t\t\t\t\t\t\tbeanstalkjob.delete()\n\t\t\t\t\t\t\twlogger.info( name + \":\" + \"BAD JOB, deleting\")\n\t\t\t\t\t\t\t#return False\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tif job:\n\t\t\t\t\t\t\t#is there a VM compatible with this sample that is ready to be used?\n\t\t\t\t\t\t\tm = findCompatibleVM(job,VMs,vml)\n\t\t\t\t\t\t\tif m is not None:\n\t\t\t\t\t\t\t\t#wlogger.info( name + \":\" + \"using VM \" + str(m))\n\t\t\t\t\t\t\t\twlogger.info( name + \":\" + \"using VM \" + str(m) + \" for \" + job['basename'] + \"(\" + job['target'] + \")\")\n\t\t\t\t\t\t\t\t#process sample\n\n\t\t\t\t\t\t\t\t#TODO this delete should really only happen if runInVM succeeds\n\t\t\t\t\t\t\t\tbeanstalkjob.delete()\n\t\t\t\t\t\t\t\tif runInVM(m,job,VMs,adbport,vml,adbl,results, fcnt):\n\t\t\t\t\t\t\t\t\t#runInVM might take a while\n\t\t\t\t\t\t\t\t\trebeanstalk()\n\t\t\t\t\t\t\t\t\t#delete from BSqueue if successfull\n\t\t\t\t\t\t\t\t\t#beanstalkjob.delete()\n\t\t\t\t\t\t\t\t\tcount.value += 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#should never hit this due to live/die toggle\t\t\n\t\t\t\t\t\t\t\tif flagTerminate:\n\t\t\t\t\t\t\t\t\twlogger.info( name + \":\" + \"terminating?!\")\n\t\t\t\t\t\t\t\t\tsys.exit(0)\n\t\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\t\tcontinue\n\n\t\t\t\t\t\t\t\t#put back into VMready Q\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\t#no VM found, put it back in the queue (nobody will process for 60 seconds\n\t\t\t\t\t\t\t\tbeanstalkjob.release(delay=BSDELAY)\n\t\t\t\t\t\t\t\twlogger.info( name + \":\" + \"requeuing job requiring a target version \" + job['target'])\n\t\t\t#time.sleep(VM_POLL_REST)", "metadata": "root.worker", "header": "['module', '___EOS___']", "index": 627 }, { "content": "def setupLogger():\n formatter = logging.Formatter(fmt=LOGFORMAT,datefmt=LOGDATEFORMAT)\n handler = logging.FileHandler(LOGFILE)\n handler.setFormatter(formatter)\n\n logger = logging.getLogger() #must not specify a name in order to grab module logs\n logger.setLevel(logging.DEBUG)\n logger.addHandler(handler)\n return logger", "metadata": "root.setupLogger", "header": "['module', '___EOS___']", "index": 723 }, { "content": "def main():\n\tglobal flagTerminate\n global beanstalk\n\tglobal logger\n\n\tlogger = setupLogger()\n\n \t# define a Handler which writes INFO messages or higher to the sys.stderr\n\tconsole = logging.StreamHandler()\n\tconsole.setLevel(logging.INFO)\n\t# set a format which is simpler for console use\n\tformatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')\n\t# tell the handler to use this format\n\tconsole.setFormatter(formatter)\n\t# add the handler to the root logger\n\tlogging.getLogger().addHandler(console)\n\n\trandom.seed()\n\n\tpool = ActivePool()\n\tassignments = pool.mgr.dict()\n\tcount = pool.mgr.Value('i', 0)\n\tADBFAILCOUNT = pool.mgr.Value('i', 0)\n\n\tVMs = pool.mgr.dict()\n\n\ts = multiprocessing.Semaphore(NUMACTIVEWORKERS)\n\tq = multiprocessing.Queue()\n\tr = multiprocessing.Queue()\n\tresults = []\n\tal = multiprocessing.RLock()\n\tvml = multiprocessing.RLock()\n\tcl = multiprocessing.RLock()\n\n\tget_VMs(VMs)\n\tlist_VMs(VMs)\n\t#make sure any pcaps are killed and we are starting with a clean filesystem\n\n\tfor i in range(30):\n\t\t#q.put(\"item \" + str(i) + \" content\")\n\t\tq.put(\"live\" + str(i))\n\t\t\n\n\t#adb ports are 5554 - 5584, only even\t\n\tport = ADBPORT\n\tjobs = [\n\t\tmultiprocessing.Process(target=worker, name=str(i), args=(s, pool, q, \"hi\", VMs, vml, str(port+(i*2)), count, al, r, ADBFAILCOUNT))\n\t\tfor i in range(NUMWORKERS)\n\t\t]\n\n\tfor j in jobs:\n\t\tlogger.info( \"starting worker %s\" % j.name)\n\t\tj.start()\n\n#\tfor j in jobs:\n#\t\tj.join()\n#\t\tlogger.info( 'Now running: %s' % str(pool))\n\n\t#make the connection after the child spawning, each child makes thier own connections\n\trebeanstalk()\n\n\twhile True:\n\n\t\tlogger.info( \"==============================\")\n\t\tlogger.info( \"processed %d samples so far\" % count.value)\n\t\ttry:\n\t\t\t#not great, but the parent is the only consumer of r items\n\t\t\tthing = r.get(block=False)\n\t\t\tresults.append(thing)\n\t\texcept:\n\t\t\tlogger.warning( \"results queue exception\")\n\t\t\n\t\tif len(results) > 0:\n\t\t\tlogger.info( \"average sample time: %s\" % str(sum(results) / float(len(results))))\n\t\ttry:\n\t\t\tif BSMSBOXQ not in beanstalk.tubes():\n\t\t\t\t\tlogger.info( \"there are no samples in the beanstalk\")\n\t\t\telse:\n\t\t\t\tif beanstalk.peek_ready() is not None:\n\t\t\t\t\tlogger.info( str(beanstalk.stats_tube(BSMSBOXQ)['current-jobs-ready']) + \" samples ready to process\")\n\t\t\t\telse:\n\t\t\t\t\tlogger.info( \"0 samples ready to process\")\n\t\t\t\tif beanstalk.peek_reserved() is not None:\n\t\t\t\t\tlogger.info( str(beanstalk.stats_tube(BSMSBOXQ)['current-jobs-reserved']) + \" samples are processing\")\n\t\t\t\telse:\n\t\t\t\t\tlogger.info( \"0 samples are processing\")\n\t\t\t\tif beanstalk.peek_delayed() is not None:\n\t\t\t\t\tlogger.info( str(beanstalk.stats_tube(BSMSBOXQ)['current-jobs-delayed']) + \" samples are delayed\")\n\t\t\t\telse:\n\t\t\t\t\tlogger.info( \"0 samples are delayed\")\n\t\texcept KeyError:\n\t\t\tlogger.warning( \"beanstalk keyerror\")\n\t\texcept:\n\t\t\tlogger.warning( \"beanstalk general error\")\n\t\tlogger.info( \"about \" + str(q.qsize()) + \" current q items\")\n\t\tlogger.info( \"adb has failed \" + str(ADBFAILCOUNT.value) + \" times since last kick\")\n\t\tlogger.debug( \"should be \" + str(NUMWORKERS) + \" processes:\")\n\t\twalive = 0\n\t\twdead = 0\n\t\tfor j in jobs:\n\t\t\tif j.is_alive():\n\t\t\t\tlogger.debug( \" \" + str(j.pid))\n\t\t\t\twalive += 1\n\t\t\telse: \n\t\t\t\tlogger.debug( \" dead\")\n\t\t\t\twdead += 1\n\t\t\t\t#this will kill the controller, leaving the children pipes wanting more (you will get sigpipe errors)\n\t\t\t\t#this is pretty harsh and shouldn't probably be done in production\n\t\t\t\t#TODO\n\t\t\t\t#sys.exit(1)\n\t\tlogger.info( \"%s alive; %s dead\" % (walive, wdead))\n\t\tupdateStatus(NUMWORKERS,walive,wdead)\n\n\t\tlist_VMs(VMs)\n\t\ttime.sleep(VM_POLL_REST + 10)\n\n\t\t#blocks until all items in q are processed\n\t\t#safe to exit\n\t\t#should check for sigint\n\t\t#if q.qsize() == 0:\n\t\t#\tfor i in jobs:\n\t\t#\t\tq.put(\"die\")\n\t\t#\tq.close()\n\n\tsys.exit(0)\n\n\n\tsignal.signal(signal.SIGINT, sigint_handler)\n\tsyslog.syslog('Startup - Entering main polling loop...')\n\twhile True:\n\n\t\tget_VMs(VMs)\n\t\tlist_VMs(VMs)\n\t\t#make sure any pcaps are killed and we are starting with a clean filesystem\n\t\t#pcap_terminate(m)\n\t\t#job_cleanup(m)\n\n\t\t#check for a job in the beanstalk Q\n\t\tif not beanstalk:\n\t\t\terror_log('Re-establishing connection to beanstalkd')\n\t\t\tbeanstalk = beanstalkc.Connection(host=BSHOST, port=BSPORT)\n\t\t\tbeanstalk.watch(BSMSBOXQ)\n\t\t\tbeanstalk.use(BSMSBOXQ)\n\t\t\tbeanstalk.ignore('default')\n\n\t\t#we want to reserve, not peak_ready because if we can't process, we want to release with a delay later\n\t\tbeanstalkjob = beanstalk.reserve()\n\n\t\t#if there was a job and we got it then queue up analysis\n\t\tif beanstalkjob:\n\t\t\ttry:\n\t\t\t\tjob = eval(beanstalkjob.body)\n\t\t\texcept:\n\t\t\t\terror_log('ERROR: could not eval job - invalid job')\n\t\t\t\tbeanstalkjob.delete()\n\t\t\t\treturn False\n\n\t\t\t#is there a VM compatible with this sample that is ready to be used?\n\t\t\tm = findCompatibleVM(job,VMs,vml)\n\t\t\tif m is not None:\n\t\t\t\tlogger.info( \"yay using VM \" + str(m))\n\t\t\t\t#process sample\n\n\t\t\t\tsys.exit(0)\n\n\t\t\t\t#delete from queue if successfull\n\t\t\t\t#beanstalkjob.delete()\n\t\t\telse:\n\t\t\t\t#no VM found, put it back in the queue (nobody will process for 60 seconds\n\t\t\t\tbeanstalkjob.release(delay=60)\n\t\t\t\tlogger.info( \"requeuing job requiring a target version \" + job['target'])\n\n\n#\t\t\n#\t\t#break ot of the loop and exit if the assignments are clear and the terminate flag is set\n\t\tif flagTerminate and len(assignments)==0:\n\t\t\tsyslog.syslog('All assigned jobs are completed (EXITING)...')\n\t\t\tbreak\n\t\t#put a pause in the polling cycle...set to 0 for no pause\n\t\ttime.sleep(VM_POLL_REST)\n\t\tsys.exit(0)\n\tsyslog.syslog('Shutdown - Leaving main polling loop...')\n\treturn 0", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 733 } ]
[ { "span": "import struct", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 13 }, { "span": "import fcntl", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 12 }, { "span": "import socket", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 13 }, { "span": "import shutil", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 13 }, { "span": "import pprint", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 13 }, { "span": "from pwd import getpwnam", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 24 }, { "span": "from grp import getgrnam", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "require", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "beans", "talk", "c_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Py", "Ya", "ml_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "/", "etc", "/", "sysc", "tl", ".", "conf", " ", "to", " ", "keep", " ", "the", " ", "arp", " ", "entri", "es", " ", "from", " ", "tim", "ing", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARP", " ", "cache", " ", "entry", " ", "timeout_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "net", ".", "ipv", "4", ".", "neigh", ".", "default", ".", "gc", "\\u", "stale", "\\u", "time", " ", "=", " ", "3600_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fcntl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "beans", "talk", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "syslog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pwd_", "import_", "getpw", "nam_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grp_", "import_", "getg", "rnam", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "msd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lib", "Inten", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Read", " ", "and", " ", "execute", " ", "global", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "#", "exec", " ", "open", "('", "/", "opt", "/", "ms", "/", "config", "/", "config", ".", "py", "')", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'../", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "config_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "this", " ", "is", " ", "global", " ", "and", " ", "will", " ", "be", " ", "assign", "ed", " ", "ear", "ly", " ", "in", " ", "main_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "DEBU", "G", "\\u\\u_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "number", " ", "of", " ", "child", "ren", " ", "worker", "s", " ", "to", " ", "spawn_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "be", " ", "multipro", "cess", "ing", ".", "cpu", "\\u", "count", "()", " ", "-", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "NUM", "WORKER", "S_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NUM", "ACTI", "VE", "WORKER", "S_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BP", "ORT", "_", "=_", "555", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PS", "IZE_", "=_", "128_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BT", "RIE", "S_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VM", "\\u", "POLL", "\\u", "REST", "_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "used", " ", "command", "s", " ", "like", " ", "this", " ", "to", " ", "give", " ", "help", "ful", " ", "error", " ", "message", "s", " ", "whe", "n", " ", "av", "d", " ", "create", " ", "fails_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "android", " ", "update", " ", "sd", "k", " ", "--", "no", "-", "ui", "\"", " _", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "android", " ", "list", " ", "sd", "k", "\"", " _", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "./", "android", " ", "update", " ", "sd", "k", " ", "--", "no", "-", "ui", " ", "-", "n", " ", "--", "filter", " ", "1", ",", "2", ",", "11", "\"", " ", "(", "2.2", ",", " ", "plus", " ", "tool", "s", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "./", "android", " ", "list", " ", "target", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "default", " ", "sdc", "ard", " ", "size", ",", " ", "in", " ", "MB_", "\\u\\u\\uNL\\u\\u\\u_", "VM", "SD", "CARD", "_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "no", " ", "reason", " ", "to", " ", "do", " ", "anyt", "hing", " ", "if", " ", "we", " ", "can", "'", "t", " ", "get", " ", "to", " ", "adb", " ", "or", " ", "emulator", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "SD", "KP", "ATH", "_", "+_", "\"/", "emulator", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "logger_", "._", "info_", "(_", "\"", "can", "'", "t", " ", "find", " ", "emulator", " ", "at", " ", "%", "s", "\"_", "%_", "SD", "KP", "ATH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "AD", "BP", "ATH", "_", "+_", "\"/", "adb", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "logger_", "._", "info_", "(_", "\"", "can", "'", "t", " ", "find", " ", "adb", " ", "at", " ", "%", "s", "\"_", "%_", "AD", "BP", "ATH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beans", "talk", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BF", "AI", "LC", "OUN", "T_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "beans", "talk", " ", "=", " ", "beans", "talk", "c", ".", "Connect", "ion", "(", "host", "=", "BS", "HOST", ",", " ", "port", "=", "BS", "PORT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "beans", "talk", ".", "watch", "(", "BS", "MS", "BO", "XQ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "beans", "talk", ".", "use", "(", "BS", "MS", "BO", "XQ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "beans", "talk", ".", "ignore", "('", "default", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "syslo", "g", " ", "output", " ", "-", " ", "this", " ", "is", " ", "where", " ", "we", " ", "will", " ", "write", " ", "all", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", "syslo", "g", ".", "openl", "og", "(", "os", ".", "path", ".", "basen", "ame", "(", "sys", ".", "argv", "[", "0", "])", ",", " ", "syslo", "g", ".", "LOG", "\\u", "PID", ",", " ", "syslo", "g", ".", "LOG", "\\u", "DA", "EMO", "N", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "syslog_", "._", "openl", "og_", "(_", "\"", "MS", "\"_", ",_", "syslog_", "._", "LOG", "\\u", "PID_", ",_", "syslog_", "._", "LOG", "\\u", "DA", "EMO", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "global", " ", "flag", " ", "to", " ", "signal", " ", "termination", ".", " ", " ", "No", " ", "need", " ", "for", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "flag", "Terminate", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Consumer_", "(_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\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_", "Consumer_", "(_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\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_", ",_", "task", "\\u", "queue_", ",_", "result", "\\u", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiprocessing_", "._", "Process_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "\\u", "queue_", "=_", "task", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result", "\\u", "queue_", "=_", "result", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Consumer_", "(_", "multiprocessing_", "._", "Process_", ")_", ":_", "\\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 ", " _", "proc", "\\u", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "task_", "=_", "self_", "._", "task", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "task_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pois", "on", " ", "pill", " ", "means", " ", "we", " ", "shou", "ld", " ", "exit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'%", "s", ":", " ", "Exi", "ting", "'_", "%_", "proc", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "proc", "\\u", "name_", ",_", "next", "\\u", "task_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "next", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result", "\\u", "queue_", "._", "put_", "(_", "answer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task_", "(_", "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_", ",_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "#", " ", "prete", "nd", " ", "to", " ", "take", " ", "some", " ", "time", " ", "to", " ", "do", " ", "our", " ", "work_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", " ", "*", " ", "%", "s", " ", "=", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "a_", ",_", "self_", "._", "b_", ",_", "self_", "._", "a_", "*_", "self_", "._", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\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_", "'%", "s", " ", "*", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "a_", ",_", "self_", "._", "b_", ")_", "\\u\\u\\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_", "Activ", "e", "Pool_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Pool_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Activ", "e", "Pool_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mgr_", "=_", "multiprocessing_", "._", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "active_", "=_", "self_", "._", "mgr_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "multiprocessing_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Pool_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Active_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "active_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Pool_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Ina", "ctive", "_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "active_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Pool_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "active_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "AV", "M_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AV", "M_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "path_", ",_", "state_", ",_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AV", "M_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Version_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "self_", "._", "state_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AV", "M_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "State_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "self_", "._", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sig", "int\\u", "handler_", "(_", "signal_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "flag", "Terminate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "'", "Cau", "ght", " ", "SIG", "INT", " ", "-", " ", "Wait", "ing", " ", "for", " ", "%", "d", " ", "active", " ", "jobs", " ", "to", " ", "terminate", "...'_", "%_", "len_", "(_", "assignments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag", "Terminate", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format", "Except", "ion", "Info_", "(_", "max", "TB", "level_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cla", "_", ",_", "exc_", ",_", "tr", "bk", "_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "Name_", "=_", "cla", "_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "Args_", "=_", "exc_", "._", "\\u\\u", "dict\\u\\u_", "[_", "\"", "args", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "Args_", "=_", "\"<", "no", " ", "args", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc", "Tb", "_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tr", "bk", "_", ",_", "max", "TB", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "exc", "Name_", ",_", "exc", "Args_", ",_", "exc", "Tb", "_", ")_", "\\u\\u\\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", "VM", "s_", "(_", "VM", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "look", "up", " ", "from", " ", "filesystem_", "\\u\\u\\uNL\\u\\u\\u_", "#", "VM", "s", "[", "2", "]", " ", "=", " ", "av", "m", "({", "\"", "name", "\":", " ", "\"", "ms", "-", "vm", "002", "\",", " ", "\"", "path", "\":", " ", "\"", "some", "/", "path", "/\"", ",", " ", "\"", "state", "\":", " ", "\"", "Off", "\",", " ", "\"", "version", "\":", " ", "\"", "5", "\"}", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "os_", "._", "listdir_", "(_", "VM", "BASED", "IR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "VM", "BASED", "IR_", ",_", "item_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "\"", "ms", "-", "sd", "k", "(\\\\", "d", "{", "3", "})", "-\\\\", "d", "{", "3", "}\"_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "\"", "name", "\"_", ":_", "m_", "._", "group_", "(_", "0_", ")_", ",_", "\"", "path", "\"_", ":_", "os_", "._", "path_", "._", "join_", "(_", "VM", "BASED", "IR_", ",_", "item_", ")_", ",_", "\"", "state", "\"_", ":_", "\"", "Off", "\"_", ",_", "\"", "version", "\"_", ":_", "m_", "._", "group_", "(_", "1_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "._", "group_", "(_", "0_", ")_", "]_", "=_", "AV", "M_", "(_", "**_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "VM", "s", "[", "m", ".", "group", "(", "0", ")]", " ", "=", " ", "(", "av", "m", "({", "\"", "name", "\":", " ", "m", ".", "group", "(", "0", "),", " ", "\"", "path", "\":", " ", "os", ".", "path", ".", "join", "(", "VM", "BASED", "IR", ",", " ", "item", "),", " ", "\"", "state", "\":", " ", "\"", "Off", "\",", " ", "\"", "version", "\":", " ", "m", ".", "group", "(", "1", ")}", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "logger_", "._", "debug_", "(_", "\"--", "-", "VM", "List", "---\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "VM", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "logger_", "._", "debug_", "(_", "\"%", "s", " ", "%", "s", " ", "%", "10", "s", " ", "%", "s", " ", "\"_", "%_", "(_", "VM", "s_", "[_", "i_", "]_", "._", "name_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "path_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "state_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"-------", "-----", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "VM", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "VM", "s_", "[_", "i_", "]_", "._", "state_", "!=_", "\"", "Off", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "logger_", "._", "info_", "(_", "\"%", "s", " ", "%", "s", " ", "%", "10", "s", " ", "%", "s", " ", "\"_", "%_", "(_", "VM", "s_", "[_", "i_", "]_", "._", "name_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "path_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "state_", ",_", "VM", "s_", "[_", "i_", "]_", "._", "version_", ")_", ")_", "\\u\\u\\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_", "kick", "\\u", "adb_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BK", "IC", "K_", "=_", "\"%", "s", "/", "adb", " ", "kill", "-", "server", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "what", "ever", " ", "the", " ", "next", " ", "issue", " ", "of", " ", "adb", " ", "is", ",", " ", "it", " ", "will", " ", "automati", "call", "y", " ", "start", " ", "the", " ", "server", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "AD", "BK", "IC", "K_", "%_", "(_", "AD", "BP", "ATH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Kick", "_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Kick", "_", "._", "terminate_", "(_", ")_", "\\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\t", "\t_", "logger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "adb", " ", "kick", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kick", "\\u", "adb", "\\u", "may", "be_", "(_", "adb", "l_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "with_", "adb", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "fcn", "t_", "._", "value_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fcn", "t_", "._", "value_", ">_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "fcn", "t_", "._", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kick", "\\u", "adb_", "(_", ")_", "\\u\\u\\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_", "find", "\\u", "key_", "(_", "dic_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "return", " ", "the", " ", "key", " ", "of", " ", "dictionar", "y", " ", "dic", " ", "give", "n", " ", "the", " ", "value", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "k_", "for_", "k_", ",_", "v_", "in_", "dic_", "._", "iteritems_", "(_", ")_", "if_", "v_", "==_", "val_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "error", "\\u", "log_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "logm", "sg_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "+_", "'", " ", ":", " ", "'_", "+_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "logm", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "logm", "sg_", ")_", "\\u\\u\\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_", "update", "Status_", "(_", "workers_", ",_", "alive_", ",_", "dead_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "f_", "=_", "open_", "(_", "'", "ms", "-", "status", ".", "csv", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"%", "s", ",%", "s", ",%", "s", "\"_", "%_", "(_", "workers_", ",_", "alive_", ",_", "dead_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "In", "VM_", "(_", "m_", ",_", "job_", ",_", "VM", "s_", ",_", "adb", "port_", ",_", "vm", "lock_", ",_", "adb", "l_", ",_", "results_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", "=_", "LOG", "FORMAT_", ",_", "datefmt_", "=_", "LOG", "DAT", "EF", "ORM", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "For", "File_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "run", ".", "log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "HH", "%", "s", "HH", "\"_", "%_", "path", "For", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "path", "For", "File_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "=_", "logger_", "._", "get", "Child_", "(_", "\"", "worker", "\"_", "+_", "name_", "+_", "\".", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "\"", "logg", "ing", " ", "start", "ed", " ", "at", " ", "\"_", "+_", "path", "For", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Reserve", "d", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Start", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "emulator", " ", "doe", "ns", "'", "t", " ", "observe", " ", "system", " ", "host", "s", ":", " ", " ", "(", "must", " ", "start", " ", "emulator", " ", "with", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "(", "for", " ", "example", ")", " ", "to", " ", "give", " ", "room", " ", "to", " ", "write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "pull", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "#", "edit", " ", "to", " ", "10.", "0.", "2.2", " ", "(", "your", " ", "local", " ", "machine", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "remo", "unt_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "push", " ", "host", "s", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "av", "d", " ", "NAME", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "-", "port", "s", " ", "5", ",", "232", "2", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "FILE", " ", "-", "dns", "-", "server", " ", "SERVER", " ", "-", "http", "-", "proxy", " ", "PROX", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "inst", "ead", " ", "of", " ", "wipe", "-", "data", ",", " ", "wou", "ld", " ", "be", " ", "best", " ", "to", " ", "re", "-", "create", " ", "the", " ", "VM_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UST", "ART", "_", "=_", "\"%", "s", "/", "emulator", " ", "-", "av", "d", " ", "%", "s", " ", "-", "partit", "ion", "-", "size", " ", "%", "s", " ", "-", "port", " ", "%", "s", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "%", "s", " ", "-", "wipe", "-", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#.", "/", "adb", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "install", " ", "/", "storage", "/", "mal", "ware", "/", "RU", ".", "apk", "_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "(", "with", " ", "specified", " ", "port", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "port", "s", " ", "X", ",", "Y", " ", "@", "av", "d\\u", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "emulator", " ", "to", " ", "be", " ", "full", "y", " ", "started_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "-", "s", " ", "emulator", "-", "558", "4", " ", "wait", "-", "for", "-", "device_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UW", "AI", "T_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "wait", "-", "for", "-", "device", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UL", "OG", "CAT", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "logc", "at", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emu", "alt", "or", "-", "X", " ", "shell", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UI", "NS", "TAL", "L_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "install", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "<", "INTEN", "T", ">", " ", "specifica", "tion", "s", " ", "include", " ", "these", " ", "flags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "a", " ", "<", "ACTI", "ON", ">]", " ", "[-", "d", " ", "<", "DATA", "\\u", "URI", ">]", " ", "[-", "t", " ", "<", "MIME", "\\u", "TYPE", ">]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "c", " ", "<", "CATEGORY", ">", " ", "[-", "c", " ", "<", "CATEGORY", ">]", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "es", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "STRING", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "esn", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "ez", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "BOOLEAN", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "ei", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "INT", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", " ", "-", "c", " ", "android", ".", "intent", ".", "category", ".", "HOM", "E", " ", "-", "n", " ", "net", ".", "fsta", "b", ".", "check", "it", "\\u", "android", "/.", "Start", "up", "Receiver_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UINT", "ENT_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "start", " ", "-", "n", " ", "com", ".", "package", ".", "name", "/", "com", ".", "package", ".", "name", ".", "Activ", "it", "y", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "MAIN", " ", "-", "n", " ", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", "/", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", ".", "Contact_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "<", "ACTI", "ON", ">", " ", "-", "n", " ", "<", "PACKAG", "E", ">/", "<", "PACKAG", "E", "><", "ACTIVITY", "CLASS", ">_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "ULA", "UNC", "H_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "start", " ", "-", "a", " ", "%", "s", " ", "-", "n", " ", "%", "s", "/", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "#", "coul", "d", " ", "do", " ", "adb", " ", "shell", " ", "stop_", "\\u\\u\\uNL\\u\\u\\u_", "#", "but", " ", "wh", "y", " ", "reall", "y", "?", " ", " ", "just", " ", "goi", "ng", " ", "to", " ", "reset", " ", "for", " ", "next", " ", "run", " ", "anyway", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "tho", "ugh", " ", "a", " ", "stop", " ", "wou", "ld", " ", "preserve", " ", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emulator", "-", "X", " ", "emu", " ", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UK", "ILL", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "emu", " ", "kill", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey_", "\\u\\u\\uNL\\u\\u\\u_", "#$", " ", "adb", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "your", ".", "package", ".", "name", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "SEED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UM", "ON", "KEY_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "%", "s", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "%", "s", " ", "--", "throttle", " ", "250", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", " ", "databa", "se", " ", "with", " ", "start", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "ons", "\\u", "filename_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "used_", "=_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Start", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "image", "\\u", "used_", ",_", "start", "\\u", "time_", ",_", "permissi", "ons", "\\u", "filename_", ",_", "MS", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "startin", "g", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UST", "ART", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ",_", "PS", "IZE_", ",_", "str_", "(_", "adb", "port_", ")_", ",_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "subprocess_", "._", "Popen_", "(_", "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\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "start", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "for", " ", "start", " ", "error", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", ":", " ", "WARN", "ING", ":", " ", "ign", "orin", "g", " ", "lock", "ed", " ", "SD", " ", "Card", " ", "image", " ", "at", " ", "/", "path", "/", "to", "/", "av", "d", "/", "ms", "-", "sd", "k", "003", "-0", "03", "/", "sdc", "ard", ".", "img_", "\\u\\u\\uNL\\u\\u\\u_", "#", "it", " ", "see", "ms", " ", "too", " ", "many", " ", "emulator", " ", "instance", "s", " ", "are", " ", "runn", "ing", " ", "on", " ", "this", " ", "machine", ".", " ", "Abo", "rti", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "it", " ", "to", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UW", "AI", "T_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "return", "ed", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", "+_", "\"", " ", "start", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Run", "ning", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UL", "OG", "CAT", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "open_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "logc", "at", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "=_", "open_", "(_", "\"/", "dev", "/", "null", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", " ", "=", " ", "subproc", "ess", ".", "Pop", "en", "(", "args", ",", " ", "std", "in", "=", "f", "Null", ",", " ", "std", "err", "=", "f", "Null", ",", " ", "stdout", "=", "f", "Log", "Cat", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "logc", "at", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "install", " ", "mali", "cio", "us", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UI", "NS", "TAL", "L_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "\"'\"_", "+_", "job_", "[_", "'", "full", "path", "'_", "]_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\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\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "=_", "AD", "BT", "RIE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "\"", "Success", "\"_", "not_", "in_", "ret_", "and_", "install", "\\u", "attempts_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "kick", "\\u", "adb", "\\u", "may", "be_", "(_", "adb", "l_", ",_", "fcn", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "FIX", "ME", ",", " ", "track", " ", "down", " ", "wh", "y", " ", "this", " ", "somet", "imes", " ", "stall", "s", " ", "forever", ",", " ", "see", "m", " ", "on", " ", "SD", "Ks", " ", "11", " ", "and", " ", "14.", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "install", "\\u", "attempts_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "possib", "le", " ", "error", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Error", ":", " ", "Cou", "ld", " ", "not", " ", "access", " ", "the", " ", "Packa", "ge", " ", "Manager", ".", " ", " ", "Is", " ", "the", " ", "system", " ", "runn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stimul", "ate_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "etree_", "._", "parse_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "doc_", "._", "find_", "(_", "'", "package", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "li_", "=_", "lib", "Inten", "t_", "._", "lib", "Inten", "t_", "(_", "\"", "local", "host", "\"_", ",_", "adb", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "rint_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rint_", "in_", "doc_", "._", "findall_", "(_", "'", "rint", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "RI", "ntent", "_", "(_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "permissi", "on", " ", "(", "action", "s", " ", "and", " ", "rint", "s", " ", "\\u", "shou", "ld", "\\u", " ", "catch", " ", "all", " ", "these", "....", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "perm_", "in_", "doc_", "._", "findall_", "(_", "'", "permissi", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Permission_", "(_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "action_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Action_", "(_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "BROADCAST", "S", " ", "are", " ", "don", "e", " ", "this", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "EM", "UINT", "ENT", " ", "%", " ", "(", " ", "AD", "BP", "ATH", ",", " ", "\"", "emulator", "-\"", " ", "+", " ", "str", "(", "adb", "port", "),", " ", "\"", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UINT", "ENT_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "check", " ", "for", " ", "\"", "Broad", "cast", " ", "complete", "d", "\"", " ", "in", " ", "output", ",", " ", "repeat", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "syslog_", "._", "syslog_", "(_", "\"", "app", " ", "%", "s", " ", "error", " ", "sendin", "g", " ", "intent", " ", "%", "s", "\"_", "%_", "(_", "job_", "[_", "'", "sha2", "56", "'_", "]_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "somet", "hing", "s", " ", "just", " ", "don", "'", "t", " ", "have", " ", "nice", " ", "rint", " ", "or", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "li_", "._", "send", "Call_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "end", "All", "Calls", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "open", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "this", " ", "shou", "ld", " ", "not", " ", "be", " ", "a", " ", "for", "/", "for", " ", "loop", ",", " ", "the", " ", "action", "s", " ", "shou", "dl", " ", "be", " ", "paired", " ", "with", " ", "activities_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "activity_", "in_", "doc_", "._", "findall_", "(_", "'", "activit", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"############", "######", " ", "launch", "ing", " ", "activit", "y", " ", "\"_", "+_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "EM", "ULA", "UNC", "H_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\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_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UM", "ON", "KEY_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\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\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "\t\t\t", "monkey", "\\u", "atte", "mpt", "s", " ", "=", " ", "AD", "BT", "RIE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "whi", "le", " ", "\"", "Success", "\"", " ", "not", " ", "in", " ", "ret", " ", "and", " ", "monkey", "\\u", "atte", "mpt", "s", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "kick", "\\u", "adb", "\\u", "may", "be", "(", "adb", "l", ",", " ", "fcn", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "time", ".", "sleep", "(", "VM", "\\u", "POLL", "\\u", "REST", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "output", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "monkey", "\\u", "atte", "mpt", "s", " ", "-=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "if", " ", "monkey", "\\u", "atte", "mpt", "s", " ", "<=", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "\t", "syslo", "g", ".", "syslo", "g", "(", "VM", "s", "[", "m", "].", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UK", "ILL", "_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "kill", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "Em", "u_", "._", "poll_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "poll", " ", "is", " ", "\"_", "+_", "str_", "(_", "p", "Em", "u_", "._", "poll_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "p", "Em", "u_", "._", "terminate_", "(_", ")_", "\\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\t", "\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "p", "Em", "u", " ", "term", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t", "\t", "if", " ", "p", "Log", "Cat", ".", "poll", "()", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", ".", "terminate", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "Log", "Cat_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "stopping", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Off", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "file_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Finish", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "complete", "\\u", "time_", ",_", "results", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "post", " ", "process", " ", "pcap", ",", " ", "pretty", " ", "crud", "e", " ", "for", " ", "now", ",", " ", "adb", " ", "use", "s", " ", "it", "'", "s", " ", "port", " ", "and", " ", "port", "+", "1", ";", " ", "so", " ", "two", " ", "prune", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#..", ".", "and", " ", "it", " ", "see", "ms", " ", "tha", "t", " ", "adb", " ", "use", "s", " ", "5555", " ", "rega", "rd", "less", " ", "of", " ", "whi", "ch", " ", "even", " ", "port", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "original", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "temp", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "original", "pcap", "_", ",_", "tmp", "pcap", "_", ",_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "int", "(", "adb", "port", ")+", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "tmp", "pcap", "_", ",_", "final", "pcap", "_", ",_", "str_", "(_", "int_", "(_", "adb", "port_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "5555", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "original", "pcap", ",", "final", "pcap", ",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "call", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "vlo", "gger", ".", "error", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "pcap", " ", "prune", " ", "error", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "unique", " ", "ip", " ", "addresses_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tsh", "ark", " ", "-", "r", " ", "<", "input", ".", "pcap", ">", " ", "-", "T", " ", "fields", " ", "-", "e", " ", "ip", ".", "dst", " ", "ip", ".", "src", " ", "|", " ", "sort", " ", "|", " ", "uniq", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "sample", " ", "too", "k", " ", "%", "s", " ", "second", "s", " ", "process", "\"_", "%_", "str_", "(_", "t2_", "-_", "t1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "put_", "(_", "t2_", "-_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Off", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "found", " ", "in", " ", "state", " ", "OFF", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Read", "y", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "is", " ", "runn", "ing", " ", "and", " ", "not", " ", "avail", "able", " ", "for", " ", "new", " ", "mal", "ware", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "m", ".", "name", " ", "in", " ", "assign", "ment", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "assign", "ment", "s", "[", "m", ".", "name", "]['", "timeo", "ut", "']", " ", "<=", " ", "time", ".", "time", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "do", " ", "anyt", "hing", " ", "you", " ", "want", " ", "to", " ", "wrap", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "post", "\\u", "process", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "clean", "up", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", "#", " ", "if", " ", "the", " ", "machine", " ", "is", " ", "runn", "ing", " ", "but", " ", "there", " ", "is", " ", "no", " ", "job", " ", "assign", "ed", " ", "to", " ", "it", " ", "then", " ", "kill", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "pcap", "\\u", "terminate", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "else", ":", " ", "#", "not", " ", "sure", " ", "this", " ", "is", " ", "rele", "van", "t", "...", "may", " ", "need", " ", "to", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")", " ", "#", "I", " ", "need", " ", "to", " ", "get", " ", "a", " ", "list", " ", "of", " ", "state", "s", " ", "tha", "t", " ", "I", " ", "want", " ", "to", " ", "power", "off", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\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_", "find", "Compatible", "VM_", "(_", "job_", ",_", "VM", "s_", ",_", "vm", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "rval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "\"", " ", " ", " ", "...", "uuid", " ", "is", " ", "\"", " ", "+", " ", "job", "['", "job", "uuid", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "\"", " ", " ", " ", "...", "app", " ", "target", " ", "is", " ", "\"", " ", "+", " ", "str", "(", "job", "['", "target", "'])", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "m_", "in_", "VM", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "\"", " ", " ", " ", "see", "ing", " ", "if", " ", "\"", " ", "+", " ", "VM", "s", "[", "m", "].", "name", " ", "+", " ", "\"", " ", "is", " ", "compa", "t", "...\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "\"", " ", " ", " ", "...", "version", " ", "is", " ", "\"", " ", "+", " ", "str", "(", "int", "(", "VM", "s", "[", "m", "].", "version", "))", " ", "+", " ", "\"", " ", "...\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "Don", "'", "t", " ", "process", " ", "machine", "s", " ", "with", "out", " ", "the", " ", "ms", " ", "nami", "ng", " ", "convention", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "if", " ", "not", " ", "re", ".", "match", "('", "ms", "-", "vm", "\\\\", "d", "{", "3", "}'", ",", "VM", "s", "[", "m", "].", "name", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "the", " ", "And", "roid", "Manifest", " ", "doe", "sn", "'", "t", " ", "hav", "d", " ", "a", " ", "mins", "dk", ",", " ", "maxs", "dk", " ", "or", " ", "target", "sd", "k", ",", " ", "then", " ", "we", " ", "don", "'", "t", " ", "know", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "#", "abo", "ut", " ", "what", " ", "version", " ", "the", " ", "app", " ", "was", " ", "created", " ", "for", ",", " ", "so", " ", "we", " ", "random", "ly", " ", "pick", " ", "something_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "we", " ", "pick", " ", "\"", "wrong", "\"", " ", "for", " ", "our", " ", "VM", " ", "set", ",", " ", "the", " ", "job", " ", "will", " ", "just", " ", "get", " ", "delayed", " ", "and", " ", "we", "'", "ll", " ", "pick", " ", "somet", "hing", " ", "else", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "target", "sdk_", "=_", "int_", "(_", "job_", "[_", "'", "target", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "sdk_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "target", "sdk_", "=_", "random_", "._", "randint_", "(_", "MIN", "SD", "KV", "ER_", ",_", "MAX", "SD", "KV", "ER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "\"", "app", " ", "%", "s", " ", "did", "n", "'", "t", " ", "speci", "fy", " ", "any", " ", "sd", "k", " ", "informati", "on", " ", "selecti", "ng", " ", "%", "s", "\"_", "%_", "(_", "job_", "[_", "'", "sha2", "56", "'_", "]_", ",_", "target", "sdk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "state", "s", " ", "are", " ", "Off", "=", "not", " ", "powered", " ", "on", ",", " ", "Read", "y", "=", "powered", " ", "on", " ", "and", " ", "read", "y", " ", "for", " ", "mal", "ware", ",", " ", "Run", "ning", "=", "currentl", "y", " ", "runn", "ing", " ", "(", "some", " ", "other", ")", " ", "mal", "ware", ",", " ", "reserve", "d", "=", "found", ",", " ", "but", " ", "not", " ", "on", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Off", "\"_", "]_", "and_", "int_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "version_", ")_", "==_", "target", "sdk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "flag", "Terminate", "_", ":_", "#", "Don", "t", " ", "assign", " ", "more", " ", "jobs", " ", "if", " ", "we", " ", "are", " ", "termina", "ting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "m_", ")_", "+_", "\")", " ", "is", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "set", "State_", "(_", "\"", "Reserve", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "job", "\\u", "assign", "(", "m", ")", " ", "#", "vm", " ", "is", " ", "start", "ed", " ", "at", " ", "end", " ", "of", " ", "job", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Unco", "mmen", "t", " ", "the", " ", "next", " ", "time", " ", "to", " ", "debug", " ", "one", " ", "job", " ", "at", " ", "a", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", "flag", "Terminate", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Run", "ning", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "v_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "VM", "s", "[", "m", "].", "name", " ", "+", " ", "\"", " ", "is", " ", "runn", "ing", " ", "and", " ", "not", " ", "avail", "able", " ", "for", " ", "new", " ", "mal", "ware", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "m", ".", "name", " ", "in", " ", "assign", "ment", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "assign", "ment", "s", "[", "m", ".", "name", "]['", "timeo", "ut", "']", " ", "<=", " ", "time", ".", "time", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "do", " ", "anyt", "hing", " ", "you", " ", "want", " ", "to", " ", "wrap", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "post", "\\u", "process", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "clean", "up", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", "#", " ", "if", " ", "the", " ", "machine", " ", "is", " ", "runn", "ing", " ", "but", " ", "there", " ", "is", " ", "no", " ", "job", " ", "assign", "ed", " ", "to", " ", "it", " ", "then", " ", "kill", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "pcap", "\\u", "terminate", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "else", ":", " ", "#", "not", " ", "sure", " ", "this", " ", "is", " ", "rele", "van", "t", "...", "may", " ", "need", " ", "to", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "vm", "\\u", "power", "off", "(", "m", ")", " ", "#", "I", " ", "need", " ", "to", " ", "get", " ", "a", " ", "list", " ", "of", " ", "state", "s", " ", "tha", "t", " ", "I", " ", "want", " ", "to", " ", "power", "off", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\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_", "reb", "ean", "stal", "k_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "beans", "talk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "beans", "talk", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "error", "\\u", "log_", "(_", "'", "Re", "-", "establish", "ing", " ", "connecti", "on", " ", "to", " ", "beans", "talk", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "=_", "beans", "talk", "c_", "._", "Connection_", "(_", "host_", "=_", "BS", "HOST_", ",_", "port_", "=_", "BS", "PORT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "watch_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "use_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "ignore_", "(_", "'", "default", "'_", ")_", "\\u\\u\\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_", "worker_", "(_", "s_", ",_", "pool_", ",_", "q_", ",_", "str1_", ",_", "VM", "s_", ",_", "vm", "l_", ",_", "adb", "port_", ",_", "count_", ",_", "adb", "l_", ",_", "results_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "assignments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "beans", "talk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", "=_", "LOG", "FORMAT_", ",_", "datefmt_", "=_", "LOG", "DAT", "EF", "ORM", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "\"", "worker", ".", "log", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "ogg", "er_", "=_", "logger_", "._", "get", "Child_", "(_", "\"", "worker", "\"_", "+_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wl", "ogg", "er_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wl", "ogg", "er_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pool_", "._", "make", "Active_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "fun", "ky", " ", "kill", " ", "pill", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "content_", "=_", "q_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "._", "put_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content_", "==_", "\"", "die", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", " ", "is", " ", "committ", "ing", " ", "sui", "cide", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "make", "Ina", "ctive", "_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "(", " ", "'", "No", "w", " ", "runn", "ing", ":", " ", "%", "s", " ", "%", "s", " ", "%", "s", " ", "(%", "s", ")'", " ", "%", " ", "(", "str", "(", "pool", "),", " ", "str", "1", ",", " ", "content", ",", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", " ", "is", " ", "working", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "a", " ", "job", " ", "in", " ", "the", " ", "beans", "talk", " ", "Q_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "beans", "talk", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "error", "\\u", "log", "('", "Re", "-", "establish", "ing", " ", "connecti", "on", " ", "to", " ", "beans", "talk", "d", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "beans", "talk", " ", "=", " ", "beans", "talk", "c", ".", "Connect", "ion", "(", "host", "=", "BS", "HOST", ",", " ", "port", "=", "BS", "PORT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "beans", "talk", ".", "watch", "(", "BS", "MS", "BO", "XQ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "beans", "talk", ".", "use", "(", "BS", "MS", "BO", "XQ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "beans", "talk", ".", "ignore", "('", "default", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "reb", "ean", "stal", "k_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "all", " ", "this", " ", "checking", " ", "is", " ", "just", " ", "\"", "best", " ", "effort", "\"", " ", "anot", "her", " ", "thread", " ", "may", " ", "still", " ", "reserve", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "BS", "MS", "BO", "XQ", "_", "not_", "in_", "beans", "talk", "_", "._", "tube", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "there", " ", "are", " ", "no", " ", "samples", " ", "in", " ", "the", " ", "beans", "talk", "\"_", ")_", "\\u\\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_", "are", "jobs_", "=_", "beans", "talk", "_", "._", "peek", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "are", "jobs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "there", " ", "are", " ", "no", " ", "samples", " ", "read", "y", " ", "in", " ", "the", " ", "beans", "talk", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "want", " ", "to", " ", "reserve", ",", " ", "not", " ", "peak", "\\u", "read", "y", " ", "bec", "aus", "e", " ", "if", " ", "we", " ", "can", "'", "t", " ", "process", ",", " ", "we", " ", "want", " ", "to", " ", "release", " ", "with", " ", "a", " ", "dela", "y", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "beans", "alk", "job_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "beans", "talk", "job_", "=_", "beans", "talk", "_", "._", "reserve", "_", "(_", ")_", "\\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\t", "\t\t\t\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "beans", "talk", " ", "reserve", " ", "error", ",", " ", "probab", "ly", " ", "out", " ", "of", " ", "jobs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "there", " ", "was", " ", "a", " ", "job", " ", "and", " ", "we", " ", "got", " ", "it", " ", "then", " ", "queue", " ", "up", " ", "analysis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beans", "talk", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "job_", "=_", "eval_", "(_", "beans", "talk", "job_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "error", "\\u", "log_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "eval", " ", "job", " ", "-", " ", "invalid", " ", "job", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "job_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "BAD", " ", "JOB", ",", " ", "delet", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "is", " ", "there", " ", "a", " ", "VM", " ", "compatible", " ", "with", " ", "this", " ", "sample", " ", "tha", "t", " ", "is", " ", "read", "y", " ", "to", " ", "be", " ", "used", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "m_", "=_", "find", "Compatible", "VM_", "(_", "job_", ",_", "VM", "s_", ",_", "vm", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "wl", "ogg", "er", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "usi", "ng", " ", "VM", " ", "\"", " ", "+", " ", "str", "(", "m", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "usi", "ng", " ", "VM", " ", "\"_", "+_", "str_", "(_", "m_", ")_", "+_", "\"", " ", "for", " ", "\"_", "+_", "job_", "[_", "'", "basen", "ame", "'_", "]_", "+_", "\"(\"_", "+_", "job_", "[_", "'", "target", "'_", "]_", "+_", "\")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "process", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "this", " ", "delete", " ", "shou", "ld", " ", "reall", "y", " ", "only", " ", "happ", "en", " ", "if", " ", "run", "In", "VM", " ", "succeeds", "_", "\\u\\u\\uNL\\u\\u\\u_", "beans", "talk", "job_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "In", "VM_", "(_", "m_", ",_", "job_", ",_", "VM", "s_", ",_", "adb", "port_", ",_", "vm", "l_", ",_", "adb", "l_", ",_", "results_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "run", "In", "VM", " ", "mig", "ht", " ", "take", " ", "a", " ", "while_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "reb", "ean", "stal", "k_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "delete", " ", "from", " ", "BS", "queue", " ", "if", " ", "success", "full_", "\\u\\u\\uNL\\u\\u\\u_", "#", "beans", "talk", "job", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "._", "value_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shou", "ld", " ", "neve", "r", " ", "hit", " ", "this", " ", "due", " ", "to", " ", "live", "/", "die", " ", "toggle", "\t\t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flag", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "termina", "ting", "?!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "put", " ", "back", " ", "int", "o", " ", "VM", "read", "y", " ", "Q_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "no", " ", "VM", " ", "found", ",", " ", "put", " ", "it", " ", "back", " ", "in", " ", "the", " ", "queue", " ", "(", "nob", "ody", " ", "will", " ", "process", " ", "for", " ", "60", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "beans", "talk", "job_", "._", "release_", "(_", "delay_", "=_", "BS", "DELAY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wl", "ogg", "er_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "reque", "uin", "g", " ", "job", " ", "requi", "ring", " ", "a", " ", "target", " ", "version", " ", "\"_", "+_", "job_", "[_", "'", "target", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "time", ".", "sleep", "(", "VM", "\\u", "POLL", "\\u", "REST", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "Logger_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", "=_", "LOG", "FORMAT_", ",_", "datefmt_", "=_", "LOG", "DAT", "EF", "ORM", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "LOG", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "#", "must", " ", "not", " ", "speci", "fy", " ", "a", " ", "name", " ", "in", " ", "order", " ", "to", " ", "gra", "b", " ", "module", " ", "logs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "flag", "Terminate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "beans", "talk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "setup", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "a", " ", "Handle", "r", " ", "whi", "ch", " ", "writes", " ", "INFO", " ", "message", "s", " ", "or", " ", "higher", " ", "to", " ", "the", " ", "sys", ".", "stderr_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "=_", "logging_", "._", "Stream", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "a", " ", "format", " ", "whi", "ch", " ", "is", " ", "simple", "r", " ", "for", " ", "console", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "'%", "(", "name", ")-", "1", "2s", ":", " ", "%", "(", "level", "name", ")-", "8s", " ", "%", "(", "message", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tell", " ", "the", " ", "handler", " ", "to", " ", "use", " ", "this", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "handler", " ", "to", " ", "the", " ", "root", " ", "logger_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "add", "Handler_", "(_", "console_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "seed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pool_", "=_", "Activ", "e", "Pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignments_", "=_", "pool_", "._", "mgr_", "._", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "pool_", "._", "mgr_", "._", "Value_", "(_", "'", "i", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AD", "BF", "AI", "LC", "OUN", "T_", "=_", "pool_", "._", "mgr_", "._", "Value_", "(_", "'", "i", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VM", "s_", "=_", "pool_", "._", "mgr_", "._", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "multiprocessing_", "._", "Semaphore", "_", "(_", "NUM", "ACTI", "VE", "WORKER", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al_", "=_", "multiprocessing_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm", "l_", "=_", "multiprocessing_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "=_", "multiprocessing_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "make", " ", "sure", " ", "any", " ", "pcap", "s", " ", "are", " ", "kille", "d", " ", "and", " ", "we", " ", "are", " ", "startin", "g", " ", "with", " ", "a", " ", "clean", " ", "filesystem_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "30_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "q", ".", "put", "(\"", "item", " ", "\"", " ", "+", " ", "str", "(", "i", ")", " ", "+", " ", "\"", " ", "content", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "q_", "._", "put_", "(_", "\"", "live", "\"_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "port", "s", " ", "are", " ", "555", "4", " ", "-", " ", "558", "4", ",", " ", "only", " ", "even", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port_", "=_", "AD", "BP", "ORT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jobs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "worker_", ",_", "name_", "=_", "str_", "(_", "i_", ")_", ",_", "args_", "=_", "(_", "s_", ",_", "pool_", ",_", "q_", ",_", "\"", "hi", "\"_", ",_", "VM", "s_", ",_", "vm", "l_", ",_", "str_", "(_", "port_", "+_", "(_", "i_", "*_", "2_", ")_", ")_", ",_", "count_", ",_", "al_", ",_", "r_", ",_", "AD", "BF", "AI", "LC", "OUN", "T_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "NUM", "WORKER", "S_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "jobs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "logger_", "._", "info_", "(_", "\"", "startin", "g", " ", "worker", " ", "%", "s", "\"_", "%_", "j_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "for", " ", "j", " ", "in", " ", "jobs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "j", ".", "join", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "logg", "er", ".", "info", "(", " ", "'", "No", "w", " ", "runn", "ing", ":", " ", "%", "s", "'", " ", "%", " ", "str", "(", "pool", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "make", " ", "the", " ", "connecti", "on", " ", "after", " ", "the", " ", "child", " ", "spawn", "ing", ",", " ", "each", " ", "child", " ", "make", "s", " ", "thi", "er", " ", "own", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reb", "ean", "stal", "k_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "logger_", "._", "info_", "(_", "\"====", "==============", "============", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "process", "ed", " ", "%", "d", " ", "samples", " ", "so", " ", "far", "\"_", "%_", "count_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "not", " ", "great", ",", " ", "but", " ", "the", " ", "parent", " ", "is", " ", "the", " ", "only", " ", "consume", "r", " ", "of", " ", "r", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "thing_", "=_", "r_", "._", "get_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "thing_", ")_", "\\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\t", "\t\t_", "logger_", "._", "warning_", "(_", "\"", "results", " ", "queue", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "logger_", "._", "info_", "(_", "\"", "averag", "e", " ", "sample", " ", "time", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "sum_", "(_", "results_", ")_", "/_", "float_", "(_", "len_", "(_", "results_", ")_", ")_", ")_", ")_", "\\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\t", "\t\t_", "if_", "BS", "MS", "BO", "XQ", "_", "not_", "in_", "beans", "talk", "_", "._", "tube", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "\"", "there", " ", "are", " ", "no", " ", "samples", " ", "in", " ", "the", " ", "beans", "talk", "\"_", ")_", "\\u\\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_", "if_", "beans", "talk", "_", "._", "peek", "\\u", "ready_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "str_", "(_", "beans", "talk", "_", "._", "stats", "\\u", "tube", "_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "[_", "'", "current", "-", "jobs", "-", "read", "y", "'_", "]_", ")_", "+_", "\"", " ", "samples", " ", "read", "y", " ", "to", " ", "process", "\"_", ")_", "\\u\\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_", "logger_", "._", "info_", "(_", "\"", "0", " ", "samples", " ", "read", "y", " ", "to", " ", "process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "beans", "talk", "_", "._", "peek", "\\u", "reserved_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "str_", "(_", "beans", "talk", "_", "._", "stats", "\\u", "tube", "_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "[_", "'", "current", "-", "jobs", "-", "reserve", "d", "'_", "]_", ")_", "+_", "\"", " ", "samples", " ", "are", " ", "process", "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\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "\"", "0", " ", "samples", " ", "are", " ", "process", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "beans", "talk", "_", "._", "peek", "\\u", "delayed_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "logger_", "._", "info_", "(_", "str_", "(_", "beans", "talk", "_", "._", "stats", "\\u", "tube", "_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "[_", "'", "current", "-", "jobs", "-", "delayed", "'_", "]_", ")_", "+_", "\"", " ", "samples", " ", "are", " ", "delayed", "\"_", ")_", "\\u\\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_", "logger_", "._", "info_", "(_", "\"", "0", " ", "samples", " ", "are", " ", "delayed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "logger_", "._", "warning_", "(_", "\"", "beans", "talk", " ", "key", "error", "\"_", ")_", "\\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\t", "\t\t_", "logger_", "._", "warning_", "(_", "\"", "beans", "talk", " ", "genera", "l", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "abo", "ut", " ", "\"_", "+_", "str_", "(_", "q_", "._", "qsize_", "(_", ")_", ")_", "+_", "\"", " ", "current", " ", "q", " ", "items", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "adb", " ", "has", " ", "fail", "ed", " ", "\"_", "+_", "str_", "(_", "AD", "BF", "AI", "LC", "OUN", "T_", "._", "value_", ")_", "+_", "\"", " ", "times", " ", "sinc", "e", " ", "last", " ", "kick", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "shou", "ld", " ", "be", " ", "\"_", "+_", "str_", "(_", "NUM", "WORKER", "S_", ")_", "+_", "\"", " ", "process", "es", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wal", "ive_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wd", "ead_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "jobs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "j_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "logger_", "._", "debug_", "(_", "\"", " ", " ", " ", "\"_", "+_", "str_", "(_", "j_", "._", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wal", "ive_", "+=_", "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\t", "\t\t\t_", "logger_", "._", "debug_", "(_", "\"", " ", " ", " ", "dead", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wd", "ead_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "will", " ", "kill", " ", "the", " ", "controlle", "r", ",", " ", "leaving", " ", "the", " ", "child", "ren", " ", "pipe", "s", " ", "want", "ing", " ", "more", " ", "(", "you", " ", "will", " ", "get", " ", "sig", "pipe", " ", "error", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "this", " ", "is", " ", "pretty", " ", "har", "sh", " ", "and", " ", "shou", "ld", "n", "'", "t", " ", "probab", "ly", " ", "be", " ", "don", "e", " ", "in", " ", "production_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "s", " ", "alive", ";", " ", "%", "s", " ", "dead", "\"_", "%_", "(_", "wal", "ive_", ",_", "wd", "ead_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Status_", "(_", "NUM", "WORKER", "S_", ",_", "wal", "ive_", ",_", "wd", "ead_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "+_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "blocks", " ", "unti", "l", " ", "all", " ", "items", " ", "in", " ", "q", " ", "are", " ", "processed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "safe", " ", "to", " ", "exit_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shou", "ld", " ", "check", " ", "for", " ", "sig", "int_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "q", ".", "qs", "ize", "()", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "for", " ", "i", " ", "in", " ", "jobs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "q", ".", "put", "(\"", "die", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "q", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "sig", "int\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "'", "Start", "up", " ", "-", " ", "Enter", "ing", " ", "main", " ", "polling", " ", "loop", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "get", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "VM", "s_", "(_", "VM", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "make", " ", "sure", " ", "any", " ", "pcap", "s", " ", "are", " ", "kille", "d", " ", "and", " ", "we", " ", "are", " ", "startin", "g", " ", "with", " ", "a", " ", "clean", " ", "filesystem_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pcap", "\\u", "terminate", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "job", "\\u", "clean", "up", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "a", " ", "job", " ", "in", " ", "the", " ", "beans", "talk", " ", "Q_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "beans", "talk", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "error", "\\u", "log_", "(_", "'", "Re", "-", "establish", "ing", " ", "connecti", "on", " ", "to", " ", "beans", "talk", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "=_", "beans", "talk", "c_", "._", "Connection_", "(_", "host_", "=_", "BS", "HOST_", ",_", "port_", "=_", "BS", "PORT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "watch_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "use_", "(_", "BS", "MS", "BO", "XQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "_", "._", "ignore_", "(_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "want", " ", "to", " ", "reserve", ",", " ", "not", " ", "peak", "\\u", "read", "y", " ", "bec", "aus", "e", " ", "if", " ", "we", " ", "can", "'", "t", " ", "process", ",", " ", "we", " ", "want", " ", "to", " ", "release", " ", "with", " ", "a", " ", "dela", "y", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beans", "talk", "job_", "=_", "beans", "talk", "_", "._", "reserve", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "there", " ", "was", " ", "a", " ", "job", " ", "and", " ", "we", " ", "got", " ", "it", " ", "then", " ", "queue", " ", "up", " ", "analysis_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "beans", "talk", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "job_", "=_", "eval_", "(_", "beans", "talk", "job_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "error", "\\u", "log_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "eval", " ", "job", " ", "-", " ", "invalid", " ", "job", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beans", "talk", "job_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "is", " ", "there", " ", "a", " ", "VM", " ", "compatible", " ", "with", " ", "this", " ", "sample", " ", "tha", "t", " ", "is", " ", "read", "y", " ", "to", " ", "be", " ", "used", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "find", "Compatible", "VM_", "(_", "job_", ",_", "VM", "s_", ",_", "vm", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "logger_", "._", "info_", "(_", "\"", "ya", "y", " ", "usi", "ng", " ", "VM", " ", "\"_", "+_", "str_", "(_", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "process", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "delete", " ", "from", " ", "queue", " ", "if", " ", "success", "full_", "\\u\\u\\uNL\\u\\u\\u_", "#", "beans", "talk", "job", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "no", " ", "VM", " ", "found", ",", " ", "put", " ", "it", " ", "back", " ", "in", " ", "the", " ", "queue", " ", "(", "nob", "ody", " ", "will", " ", "process", " ", "for", " ", "60", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "beans", "talk", "job_", "._", "release_", "(_", "delay_", "=_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "reque", "uin", "g", " ", "job", " ", "requi", "ring", " ", "a", " ", "target", " ", "version", " ", "\"_", "+_", "job_", "[_", "'", "target", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "break", " ", "ot", " ", "of", " ", "the", " ", "loop", " ", "and", " ", "exit", " ", "if", " ", "the", " ", "assign", "ment", "s", " ", "are", " ", "clear", " ", "and", " ", "the", " ", "terminate", " ", "flag", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flag", "Terminate", "_", "and_", "len_", "(_", "assignments_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "syslog_", "._", "syslog_", "(_", "'", "All", " ", "assign", "ed", " ", "jobs", " ", "are", " ", "complete", "d", " ", "(", "EXIT", "ING", ").", "..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "put", " ", "a", " ", "paus", "e", " ", "in", " ", "the", " ", "polling", " ", "cycle", "...", "set", " ", "to", " ", "0", " ", "for", " ", "no", " ", "pause_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "'", "Shut", "down", " ", "-", " ", "Leav", "ing", " ", "main", " ", "polling", " ", "loop", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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]
Unused import
TylerTemp/docpie/docpie/tracemore.py
[ { "content": "import sys\nimport traceback\nimport logging\ntry:\n from io import StringIO\nexcept ImportError:\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO\n\nif sys.version_info[0] < 3:\nelse:\n\n_tmp_stream = StringIO()\n\n\n\n\n\n\nif __name__ == '__main__':\n\n stream = StringIO()\n try:\n zero_error()\n except Exception:\n print_exc_plus(stream)\n\n print('Err from stream:')\n print(stream.getvalue())\n stream.close()\n\n try:\n zero_error()\n except Exception:\n print('Err from get_exc_plus():')\n print(get_exc_plus())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def u(strs):\n return strs.decode('utf-8')", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def u(strs):\n return strs", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def print_exc_plus(stream=sys.stdout):\n '''print normal traceback information with some local arg values'''\n # code of this mothod is mainly from <Python Cookbook>\n write = stream.write # assert the mothod exists\n flush = stream.flush\n tp, value, tb = sys.exc_info()\n while tb.tb_next:\n tb = tb.tb_next\n stack = list()\n f = tb.tb_frame\n while f:\n stack.append(f)\n f = f.f_back\n stack.reverse()\n try:\n traceback.print_exc(None, stream)\n except BaseException as e:\n write(u(\"FAILED PRINTING TRACE\\n\\n\"))\n write(u(str(value)))\n write(u('\\n\\n'))\n finally:\n flush()\n\n write(u('Locals by frame, innermost last\\n'))\n for frame in stack:\n write(u('\\nFrame %s in %s at line %s\\n' % (frame.f_code.co_name,\n frame.f_code.co_filename,\n frame.f_lineno)))\n for key, value, in frame.f_locals.items():\n write(u('\\t%20s = ' % key))\n try:\n write(u('%s\\n' % value))\n except:\n write(u('<ERROR WHILE PRINTING VALUE>\\n'))\n flush()", "metadata": "root.print_exc_plus", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def get_exc_plus():\n _tmp_stream.seek(0)\n _tmp_stream.truncate()\n print_exc_plus(_tmp_stream)\n _tmp_stream.seek(0)\n return _tmp_stream.read()", "metadata": "root.get_exc_plus", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def zero_error():\n local_1 = range(5)\n local_2 = 'a local arg'\n 1/0", "metadata": "root.zero_error", "header": "['module', '___EOS___']", "index": 67 } ]
[ { "span": "import logging", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "tmp", "\\u", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zero", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "exc", "\\u", "plus_", "(_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "Err", " ", "from", " ", "stream", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "stream_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "close_", "(_", ")_", "\\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 ", " _", "zero", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Err", " ", "from", " ", "get", "\\u", "exc", "\\u", "plus", "():", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "get", "\\u", "exc", "\\u", "plus_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "u_", "(_", "strs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "strs_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "u_", "(_", "strs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "strs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "\\u", "exc", "\\u", "plus_", "(_", "stream_", "=_", "sys_", "._", "stdout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "print", " ", "normal", " ", "traceback", " ", "informati", "on", " ", "with", " ", "some", " ", "local", " ", "arg", " ", "values", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "code", " ", "of", " ", "this", " ", "mot", "hod", " ", "is", " ", "mainl", "y", " ", "from", " ", "<", "Pyth", "on", " ", "Coo", "kb", "ook", ">_", "\\u\\u\\uNL\\u\\u\\u_", "write_", "=_", "stream_", "._", "write_", "#", " ", "assert", " ", "the", " ", "mot", "hod", " ", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "=_", "stream_", "._", "flush_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", ",_", "value_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "tb_", "._", "tb", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "tb_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stack_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "tb_", "._", "tb", "\\u", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "f_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stack_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", "None_", ",_", "stream_", ")_", "\\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 ", " _", "write_", "(_", "u_", "(_", "\"", "FAIL", "ED", " ", "PRINT", "ING", " ", "TRACE", "\\\\", "n", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write_", "(_", "u_", "(_", "str_", "(_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write_", "(_", "u_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", ")_", "\\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 ", " _", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write_", "(_", "u_", "(_", "'", "Local", "s", " ", "by", " ", "frame", ",", " ", "inner", "most", " ", "last", "\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", "in_", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "(_", "u_", "(_", "'\\\\", "n", "Frame", " ", "%", "s", " ", "in", " ", "%", "s", " ", "at", " ", "line", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame_", "._", "f", "\\u", "lineno_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "value_", ",_", "in_", "frame_", "._", "f", "\\u", "locals_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "(_", "u_", "(_", "'\\\\", "t", "%", "20", "s", " ", "=", " ", "'_", "%_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "(_", "u_", "(_", "'%", "s", "\\\\", "n", "'_", "%_", "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 ", " _", "write_", "(_", "u_", "(_", "'<", "ERROR", " ", "WH", "ILE", " ", "PRINT", "ING", " ", "VALU", "E", ">\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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", "\\u", "exc", "\\u", "plus_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "tmp", "\\u", "stream_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "tmp", "\\u", "stream_", "._", "truncate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "exc", "\\u", "plus_", "(_", "\\u", "tmp", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "tmp", "\\u", "stream_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "tmp", "\\u", "stream_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "zero", "\\u", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "1_", "=_", "range_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "2_", "=_", "'", "a", " ", "local", " ", "arg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "1_", "/_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
beville/ComicStreamer/comicstreamerlib/server.py
[ { "content": " def processPagingArgs(self, query):\n per_page = self.get_argument(u\"per_page\", default=None)\n offset = self.get_argument(u\"offset\", default=None)\n # offset and max_results should be processed last\n \n total_results = None\n if per_page is not None:\n total_results = query.distinct().count()\n try:\n max = 0\n max = int(per_page)\n if total_results > max:\n query = query.limit(max)\n except:\n pass \n\n if offset is not None:\n try:\n off = 0\n off = int(offset)\n query = query.offset(off)\n except:\n pass\n \n return query, total_results", "metadata": "root.JSONResultAPIHandler.processPagingArgs", "header": "['class', 'JSONResultAPIHandler', '(', 'GenericAPIHandler', ')', ':', '___EOS___']", "index": 100 }, { "content": " def processComicQueryArgs(self, query):\n def hasValue(obj):\n return obj is not None and obj != \"\"\n \n keyphrase_filter = self.get_argument(u\"keyphrase\", default=None)\n series_filter = self.get_argument(u\"series\", default=None)\n path_filter = self.get_argument(u\"path\", default=None)\n folder_filter = self.get_argument(u\"folder\", default=\"\")\n title_filter = self.get_argument(u\"title\", default=None)\n start_filter = self.get_argument(u\"start_date\", default=None)\n end_filter = self.get_argument(u\"end_date\", default=None)\n added_since = self.get_argument(u\"added_since\", default=None)\n modified_since = self.get_argument(u\"modified_since\", default=None)\n lastread_since = self.get_argument(u\"lastread_since\", default=None)\n order = self.get_argument(u\"order\", default=None)\n character = self.get_argument(u\"character\", default=None)\n team = self.get_argument(u\"team\", default=None)\n location = self.get_argument(u\"location\", default=None)\n storyarc = self.get_argument(u\"storyarc\", default=None)\n volume = self.get_argument(u\"volume\", default=None)\n publisher = self.get_argument(u\"publisher\", default=None)\n credit_filter = self.get_argument(u\"credit\", default=None)\n tag = self.get_argument(u\"tag\", default=None)\n genre = self.get_argument(u\"genre\", default=None)\n\n if folder_filter != \"\":\n folder_filter = os.path.normcase(os.path.normpath(folder_filter))\n print folder_filter\n \n person = None\n role = None\n if hasValue(credit_filter):\n credit_info = credit_filter.split(\":\")\n if len(credit_info[0]) != 0:\n person = credit_info[0] \n if len(credit_info) > 1:\n role = credit_info[1]\n\n if hasValue(person):\n query = query.join(Credit).filter(Person.name.ilike(person.replace(\"*\",\"%\"))).filter(Credit.person_id==Person.id)\n if role is not None:\n query = query.filter(Credit.role_id==Role.id).filter(Role.name.ilike(role.replace(\"*\",\"%\")))\n #query = query.filter( Comic.persons.contains(unicode(person).replace(\"*\",\"%\") ))\n \n if hasValue(keyphrase_filter):\n keyphrase_filter = unicode(keyphrase_filter).replace(\"*\",\"%\")\n keyphrase_filter = \"%\" + keyphrase_filter + \"%\"\n query = query.filter( Comic.series.ilike(keyphrase_filter) \n | Comic.title.ilike(keyphrase_filter)\n | Comic.publisher.ilike(keyphrase_filter)\n | Comic.path.ilike(keyphrase_filter)\n | Comic.comments.ilike(keyphrase_filter)\n #| Comic.characters_raw.any(Character.name.ilike(keyphrase_filter))\n #| Comic.teams_raw.any(Team.name.ilike(keyphrase_filter))\n #| Comic.locations_raw.any(Location.name.ilike(keyphrase_filter))\n #| Comic.storyarcs_raw.any(StoryArc.name.ilike(keyphrase_filter))\n | Comic.persons_raw.any(Person.name.ilike(keyphrase_filter))\n )\n\n def addQueryOnScalar(query, obj_prop, filt):\n if hasValue(filt):\n filt = unicode(filt).replace(\"*\",\"%\")\n return query.filter( obj_prop.ilike(filt))\n else:\n return query\n def addQueryOnList(query, obj_list, list_prop, filt):\n if hasValue(filt):\n filt = unicode(filt).replace(\"*\",\"%\")\n return query.filter( obj_list.any(list_prop.ilike(filt)))\n else:\n return query\n\n query = addQueryOnScalar(query, Comic.series, series_filter)\n query = addQueryOnScalar(query, Comic.title, title_filter)\n query = addQueryOnScalar(query, Comic.path, path_filter)\n query = addQueryOnScalar(query, Comic.folder, folder_filter)\n query = addQueryOnScalar(query, Comic.publisher, publisher)\n query = addQueryOnList(query, Comic.characters_raw, Character.name, character)\n query = addQueryOnList(query, Comic.generictags_raw, GenericTag.name, tag)\n query = addQueryOnList(query, Comic.teams_raw, Team.name, team)\n query = addQueryOnList(query, Comic.locations_raw, Location.name, location)\n query = addQueryOnList(query, Comic.storyarcs_raw, StoryArc.name, storyarc)\n query = addQueryOnList(query, Comic.genres_raw, Genre.name, genre)\n #if hasValue(series_filter):\n # query = query.filter( Comic.series.ilike(unicode(series_filter).replace(\"*\",\"%\") ))\n #if hasValue(title_filter):\n # query = query.filter( Comic.title.ilike(unicode(title_filter).replace(\"*\",\"%\") ))\n #if hasValue(filename_filter):\n # query = query.filter( Comic.path.ilike(unicode(filename_filter).replace(\"*\",\"%\") ))\n #if hasValue(publisher):\n # query = query.filter( Comic.publisher.ilike(unicode(publisher).replace(\"*\",\"%\") ))\n #if hasValue(character):\n # query = query.filter( Comic.characters_raw.any(Character.name.ilike(unicode(character).replace(\"*\",\"%\") )))\n #if hasValue(tag):\n # query = query.filter( Comic.generictags.contains(unicode(tag).replace(\"*\",\"%\") ))\n #if hasValue(team):\n # query = query.filter( Comic.teams.contains(unicode(team).replace(\"*\",\"%\") ))\n #if hasValue(location):\n # query = query.filter( Comic.locations.contains(unicode(location).replace(\"*\",\"%\") ))\n #if hasValue(storyarc):\n # query = query.filter( Comic.storyarcs.contains(unicode(storyarc).replace(\"*\",\"%\") ))\n #if hasValue(genre):\n # query = query.filter( Comic.genres.contains(unicode(genre).replace(\"*\",\"%\") ))\n if hasValue(volume):\n try:\n vol = 0\n vol = int(volume)\n query = query.filter(Comic.volume == vol)\n except:\n pass\n \n if hasValue(start_filter):\n try:\n dt = dateutil.parser.parse(start_filter)\n query = query.filter( Comic.date >= dt)\n except:\n pass\n \n if hasValue(end_filter):\n try:\n dt = dateutil.parser.parse(end_filter)\n query = query.filter( Comic.date <= dt)\n except:\n pass\n \n if hasValue(modified_since):\n try:\n dt=dateutil.parser.parse(modified_since)\n resultset = resultset.filter( Comic.mod_ts >= dt )\n except:\n pass\n\n if hasValue(added_since):\n try:\n dt=dateutil.parser.parse(added_since)\n query = query.filter( Comic.added_ts >= dt )\n except:\n pass\n \n if hasValue(lastread_since):\n try:\n dt=dateutil.parser.parse(lastread_since)\n query = query.filter( Comic.lastread_ts >= dt, Comic.lastread_ts != \"\" )\n except:\n pass\n \n order_key = None\n # ATB temp hack to cover \"slicing\" bug where\n # if no order specified, the child collections\n # get chopped off sometimes\n if not hasValue(order):\n order = \"id\"\n \n if hasValue(order):\n if order[0] == \"-\":\n order_desc = True\n order = order[1:]\n else:\n order_desc = False\n if order == \"id\":\n order_key = Comic.id \n if order == \"series\":\n order_key = Comic.series\n elif order == \"modified\":\n order_key = Comic.mod_ts\n elif order == \"added\":\n order_key = Comic.added_ts\n elif order == \"lastread\":\n order_key = Comic.lastread_ts\n elif order == \"volume\":\n order_key = Comic.volume\n elif order == \"issue\":\n order_key = Comic.issue_num\n elif order == \"date\":\n order_key = Comic.date\n elif order == \"publisher\":\n order_key = Comic.publisher\n elif order == \"title\":\n order_key = Comic.title\n elif order == \"path\":\n order_key = Comic.path\n \n if order_key is not None:\n if order_desc:\n order_key = order_key.desc() \n query = query.order_by(order_key)\n\n return query ", "metadata": "root.JSONResultAPIHandler.processComicQueryArgs", "header": "['class', 'JSONResultAPIHandler', '(', 'GenericAPIHandler', ')', ':', '___EOS___']", "index": 127 }, { "content": " def get(self):\n self.validateAPIKey()\n \n # get all deleted comics first\n session = self.application.dm.Session()\n resultset = session.query(DeletedComic)\n \n since_filter = self.get_argument(u\"since\", default=None)\n \n # now winnow it down with timestampe, if requested\n if since_filter is not None:\n try:\n dt=dateutil.parser.parse(since_filter)\n resultset = resultset.filter( DeletedComic.ts >= dt )\n except:\n pass \n json_data = resultSetToJson(resultset, \"deletedcomics\")\n \n self.writeResults(json_data) ", "metadata": "root.DeletedAPIHandler.get", "header": "['class', 'DeletedAPIHandler', '(', 'ZippableAPIHandler', ')', ':', '___EOS___']", "index": 460 }, { "content": " def get(self, args): \n self.validateAPIKey()\n session = self.application.dm.Session()\n \n if args is None:\n args = \"\"\n arglist=args.split('/')\n \n arglist = filter(None, arglist)\n argcount = len(arglist)\n \n entities = {\n 'characters' : Character.name,\n 'persons' : Person.name,\n 'publishers' : Comic.publisher,\n 'roles' : Role.name,\n 'series': Comic.series,\n 'volumes' : Comic.volume,\n 'teams' : Team.name,\n 'storyarcs' : StoryArc.name,\n 'genres' : Genre.name,\n 'locations' : Location.name,\n 'generictags' : GenericTag.name, \n 'comics' : Comic\n }\n #logging.debug(\"In EntityAPIHandler {0}\".format(arglist))\n #/entity1/filter1/entity2/filter2...\n \n # validate all entities keys in args\n #( check every other item)\n for e in arglist[0::2]:\n if e not in entities:\n raise tornado.web.HTTPError(404, \"Unknown entity:{0}\".format(e))\n #look for dupes\n if len(arglist[0::2])!=len(set(arglist[0::2])):\n raise tornado.web.HTTPError(400, \"Duplicate entity\")\n #look for dupes\n if 'comics' in arglist[0::2] and arglist[-1] != \"comics\":\n raise tornado.web.HTTPError(400, \"\\\"comics\\\" must be final entity\")\n\n\n resp = \"\"\n # even number means listing entities\n if argcount % 2 == 0:\n name_list = [key for key in entities]\n # (remove already-traversed entities)\n for e in arglist[0::2]:\n try:\n name_list.remove(e)\n except: \n pass\n \n # Find out how many of each entity are left, and build a list of\n # dicts with name and count\n dict_list = []\n for e in name_list:\n tmp_arg_list = list()\n tmp_arg_list.extend(arglist)\n tmp_arg_list.append(e)\n query = self.buildQuery(session, entities, tmp_arg_list)\n e_dict = dict()\n e_dict['name'] = e\n #self.application.dm.engine.echo = True\n e_dict['count'] = query.distinct().count()\n #self.application.dm.engine.echo = False\n #print \"----\", e_dict, query\n dict_list.append(e_dict)\n \n #name_list = sorted(name_list)\n\n resp = {\"entities\" : dict_list}\n self.setContentType()\n self.write(resp)\n return\n\n # odd number means listing last entity VALUES\n else:\n entity = arglist[-1] # the final entity in the list\n query = self.buildQuery(session, entities, arglist)\n \n if entity == \"comics\":\n \n query = self.processComicQueryArgs(query)\n query, total_results = self.processPagingArgs(query)\n\n query = query.options(subqueryload('characters_raw'))\n query = query.options(subqueryload('storyarcs_raw'))\n query = query.options(subqueryload('locations_raw'))\n query = query.options(subqueryload('teams_raw'))\n #query = query.options(subqueryload('credits_raw')) \n query = query.options(subqueryload('generictags_raw')) \n query = query.all()\n resp = resultSetToJson(query, \"comics\", total_results) \n else:\n resp = {entity : sorted(list(set([i[0] for i in query.all()])))}\n self.application.dm.engine.echo = False\n\n self.setContentType()\n self.write(resp)", "metadata": "root.EntityAPIHandler.get", "header": "['class', 'EntityAPIHandler', '(', 'JSONResultAPIHandler', ')', ':', '___EOS___']", "index": 666 } ]
[ { "span": "except:", "start_line": 113, "start_column": 12, "end_line": 113, "end_column": 19 }, { "span": "except:", "start_line": 121, "start_column": 12, "end_line": 121, "end_column": 19 }, { "span": "except:", "start_line": 235, "start_column": 12, "end_line": 235, "end_column": 19 }, { "span": "except:", "start_line": 242, "start_column": 12, "end_line": 242, "end_column": 19 }, { "span": "except:", "start_line": 249, "start_column": 12, "end_line": 249, "end_column": 19 }, { "span": "except:", "start_line": 256, "start_column": 12, "end_line": 256, "end_column": 19 }, { "span": "except:", "start_line": 263, "start_column": 12, "end_line": 263, "end_column": 19 }, { "span": "except:", "start_line": 270, "start_column": 12, "end_line": 270, "end_column": 19 }, { "span": "except:", "start_line": 474, "start_column": 12, "end_line": 474, "end_column": 19 }, { "span": "except: ", "start_line": 715, "start_column": 16, "end_line": 715, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "JSONR", "esult", "API", "Handler_", "(_", "Gene", "ric", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Pag", "ing", "Args_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "per", "\\u", "page_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "per", "\\u", "page", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "offset", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "offset", " ", "and", " ", "max", "\\u", "results", " ", "shou", "ld", " ", "be", " ", "process", "ed", " ", "last_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "per", "\\u", "page_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "results_", "=_", "query_", "._", "distinct_", "(_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max_", "=_", "int_", "(_", "per", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "\\u", "results_", ">_", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "query_", "._", "limit_", "(_", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "offset_", "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 ", " _", "off_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "off_", "=_", "int_", "(_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "offset_", "(_", "off_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "query_", ",_", "total", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSONR", "esult", "API", "Handler_", "(_", "Gene", "ric", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Com", "ic", "Query", "Args_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "has", "Value_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "is_", "not_", "None_", "and_", "obj_", "!=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key", "phrase", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "key", "phrase", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "series", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "path", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "folder", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "title", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "start", "\\u", "date", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "end", "\\u", "date", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adde", "d\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "adde", "d\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifi", "ed", "\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "modifi", "ed", "\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastr", "ead", "\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "lastr", "ead", "\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "order", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "character_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "character", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "team_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "team", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "location", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stor", "yar", "c_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "stor", "yar", "c", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "volume", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "publi", "sher", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credit", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "credit", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "tag", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genre_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "genr", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "folder", "\\u", "filter_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "\\u", "filter_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "folder", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "folder", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "person_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "Value_", "(_", "credit", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credit", "\\u", "info_", "=_", "credit", "\\u", "filter_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "credit", "\\u", "info_", "[_", "0_", "]_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person_", "=_", "credit", "\\u", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "credit", "\\u", "info_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "role_", "=_", "credit", "\\u", "info_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "person_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "join_", "(_", "Credit", "_", ")_", "._", "filter_", "(_", "Person_", "._", "name_", "._", "ili", "ke_", "(_", "person_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", ")_", ")_", "._", "filter_", "(_", "Credit", "_", "._", "person", "\\u", "id_", "==_", "Person_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "role_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "filter_", "(_", "Credit", "_", "._", "role", "\\u", "id_", "==_", "Role_", "._", "id_", ")_", "._", "filter_", "(_", "Role_", "._", "name_", "._", "ili", "ke_", "(_", "role_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "person", "s", ".", "contain", "s", "(", "unicode", "(", "person", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\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_", "has", "Value_", "(_", "key", "phrase", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "phrase", "\\u", "filter_", "=_", "unicode_", "(_", "key", "phrase", "\\u", "filter_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "phrase", "\\u", "filter_", "=_", "\"%\"_", "+_", "key", "phrase", "\\u", "filter_", "+_", "\"%\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "series_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "title_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "publisher_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "path_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "comments_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "character", "s", "\\u", "raw", ".", "any", "(", "Char", "acte", "r", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "team", "s", "\\u", "raw", ".", "any", "(", "Tea", "m", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "location", "s", "\\u", "raw", ".", "any", "(", "Locat", "ion", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "stor", "yar", "cs", "\\u", "raw", ".", "any", "(", "Stor", "y", "Arc", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "person", "s", "\\u", "raw_", "._", "any_", "(_", "Person_", "._", "name_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "obj", "\\u", "prop_", ",_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "Value_", "(_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "=_", "unicode_", "(_", "filt_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "query_", "._", "filter_", "(_", "obj", "\\u", "prop_", "._", "ili", "ke_", "(_", "filt_", ")_", ")_", "\\u\\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_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Query", "On", "List_", "(_", "query_", ",_", "obj", "\\u", "list_", ",_", "list", "\\u", "prop_", ",_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "Value_", "(_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "=_", "unicode_", "(_", "filt_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "query_", "._", "filter_", "(_", "obj", "\\u", "list_", "._", "any_", "(_", "list", "\\u", "prop_", "._", "ili", "ke_", "(_", "filt_", ")_", ")_", ")_", "\\u\\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_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "series_", ",_", "series", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "title_", ",_", "title", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "path_", ",_", "path", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "folder_", ",_", "folder", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "publisher_", ",_", "publisher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "character", "s", "\\u", "raw_", ",_", "Character_", "._", "name_", ",_", "character_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "gener", "ict", "ags", "\\u", "raw_", ",_", "Gene", "ric", "Tag_", "._", "name_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "team", "s", "\\u", "raw_", ",_", "Team_", "._", "name_", ",_", "team_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "location", "s", "\\u", "raw_", ",_", "Location_", "._", "name_", ",_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "stor", "yar", "cs", "\\u", "raw_", ",_", "Stor", "y", "Arc_", "._", "name_", ",_", "stor", "yar", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "genr", "es", "\\u", "raw_", ",_", "Genr", "e_", "._", "name_", ",_", "genre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "series", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "series", ".", "ili", "ke", "(", "unicode", "(", "series", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "title", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "title", ".", "ili", "ke", "(", "unicode", "(", "title", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "filename", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "path", ".", "ili", "ke", "(", "unicode", "(", "filename", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "publi", "sher", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "publi", "sher", ".", "ili", "ke", "(", "unicode", "(", "publi", "sher", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "character", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "character", "s", "\\u", "raw", ".", "any", "(", "Char", "acte", "r", ".", "name", ".", "ili", "ke", "(", "unicode", "(", "character", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "tag", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "gener", "ict", "ags", ".", "contain", "s", "(", "unicode", "(", "tag", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "team", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "team", "s", ".", "contain", "s", "(", "unicode", "(", "team", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "location", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "location", "s", ".", "contain", "s", "(", "unicode", "(", "location", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "stor", "yar", "c", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "stor", "yar", "cs", ".", "contain", "s", "(", "unicode", "(", "stor", "yar", "c", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "genr", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "genr", "es", ".", "contain", "s", "(", "unicode", "(", "genr", "e", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "has", "Value_", "(_", "volume_", ")_", ":_", "\\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 ", " _", "vol_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol_", "=_", "int_", "(_", "volume_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "volume_", "==_", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "start", "\\u", "filter_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "start", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "date_", ">=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "end", "\\u", "filter_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "end", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "date_", "<=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "modifi", "ed", "\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "modifi", "ed", "\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "et_", "=_", "results", "et_", "._", "filter_", "(_", "Com", "ic_", "._", "mod", "\\u", "ts_", ">=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "adde", "d\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "adde", "d\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "adde", "d\\u", "ts_", ">=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "lastr", "ead", "\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "lastr", "ead", "\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", ">=_", "dt_", ",_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", "!=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "order", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AT", "B", " ", "temp", " ", "hack", " ", "to", " ", "cover", " ", "\"", "slicing", "\"", " ", "bug", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "order", " ", "specified", ",", " ", "the", " ", "child", " ", "collections_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "chop", "ped", " ", "off", " ", "somet", "imes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "has", "Value_", "(_", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "\"", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order_", "[_", "0_", "]_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "desc_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "order_", "[_", "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 ", " _", "order", "\\u", "desc_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "\"", "id", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "\"", "series", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "modifi", "ed", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "mod", "\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "adde", "d", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "adde", "d\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "lastr", "ead", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "volume", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "volume_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "issue", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "issue", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "date", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "publi", "sher", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "publisher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "title", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "path", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order", "\\u", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "order", "\\u", "key_", "._", "desc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "query_", "._", "order", "\\u", "by_", "(_", "order", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Delete", "d", "API", "Handler_", "(_", "Zip", "pab", "le", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validat", "e", "API", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "delete", "d", " ", "comics", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "self_", "._", "application_", "._", "dm_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "et_", "=_", "session_", "._", "query_", "(_", "Delete", "d", "Com", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sinc", "e\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "win", "now", " ", "it", " ", "down", " ", "with", " ", "timestamp", "e", ",", " ", "if", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sinc", "e\\u", "filter_", "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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "sinc", "e\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "et_", "=_", "results", "et_", "._", "filter_", "(_", "Delete", "d", "Com", "ic_", "._", "ts_", ">=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json", "\\u", "data_", "=_", "result", "Set", "To", "Json_", "(_", "results", "et_", ",_", "\"", "delete", "dco", "mic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "Results_", "(_", "json", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entit", "y", "API", "Handler_", "(_", "JSONR", "esult", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validat", "e", "API", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "=_", "self_", "._", "application_", "._", "dm_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arglist_", "=_", "args_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arglist_", "=_", "filter_", "(_", "None_", ",_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "ount_", "=_", "len_", "(_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "entities_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "character", "s", "'_", ":_", "Character_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "person", "s", "'_", ":_", "Person_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publishers", "'_", ":_", "Com", "ic_", "._", "publisher_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "role", "s", "'_", ":_", "Role_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "series", "'_", ":_", "Com", "ic_", "._", "series_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "s", "'_", ":_", "Com", "ic_", "._", "volume_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "team", "s", "'_", ":_", "Team_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stor", "yar", "cs", "'_", ":_", "Stor", "y", "Arc_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "genr", "es", "'_", ":_", "Genr", "e_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "s", "'_", ":_", "Location_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gener", "ict", "ags", "'_", ":_", "Gene", "ric", "Tag_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comics", "'_", ":_", "Com", "ic_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "ing", ".", "debug", "(\"", "In", " ", "Entit", "y", "API", "Handle", "r", " ", "{", "0", "}\"", ".", "format", "(", "argl", "ist", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "/", "entity", "1", "/", "filter", "1", "/", "entity", "2", "/", "filter", "2", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validat", "e", " ", "all", " ", "entit", "ies", " ", "keys", " ", "in", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "#(", " ", "check", " ", "every", " ", "other", " ", "item", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "e_", "in_", "arglist_", "[_", "0_", ":_", ":_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "not_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "tornado_", "._", "web_", "._", "HTTP", "Error_", "(_", "404_", ",_", "\"", "Un", "know", "n", " ", "entity", ":", "{", "0", "}\"_", "._", "format_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "look", " ", "for", " ", "dupe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "arglist_", "[_", "0_", ":_", ":_", "2_", "]_", ")_", "!=_", "len_", "(_", "set_", "(_", "arglist_", "[_", "0_", ":_", ":_", "2_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "tornado_", "._", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "\"", "Duplicate", " ", "entity", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "look", " ", "for", " ", "dupe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "comics", "'_", "in_", "arglist_", "[_", "0_", ":_", ":_", "2_", "]_", "and_", "arglist_", "[_", "-_", "1_", "]_", "!=_", "\"", "comics", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "tornado_", "._", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "\"\\\\\"", "comics", "\\\\\"", " ", "must", " ", "be", " ", "final", " ", "entity", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "even", " ", "number", " ", "means", " ", "listi", "ng", " ", "entities_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argc", "ount_", "%_", "2_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "list_", "=_", "[_", "key_", "for_", "key_", "in_", "entities_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "remove", " ", "alr", "ead", "y", "-", "traverse", "d", " ", "entit", "ies", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "e_", "in_", "arglist_", "[_", "0_", ":_", ":_", "2_", "]_", ":_", "\\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", "\\u", "list_", "._", "remove_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "out", " ", "how", " ", "many", " ", "of", " ", "each", " ", "entity", " ", "are", " ", "left", ",", " ", "and", " ", "build", " ", "a", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dict", "s", " ", "with", " ", "name", " ", "and", " ", "count_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dict", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "name", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "arg", "\\u", "list_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "arg", "\\u", "list_", "._", "extend_", "(_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "arg", "\\u", "list_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "self_", "._", "build", "Query_", "(_", "session_", ",_", "entities_", ",_", "tmp", "\\u", "arg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "dict_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "dict_", "[_", "'", "name", "'_", "]_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "applica", "tion", ".", "dm", ".", "eng", "ine", ".", "echo", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "e\\u", "dict_", "[_", "'", "count", "'_", "]_", "=_", "query_", "._", "distinct_", "(_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "applica", "tion", ".", "dm", ".", "eng", "ine", ".", "echo", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"----", "\",", " ", "e\\u", "dict", ",", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "\\u", "list_", "._", "append_", "(_", "e\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "name", "\\u", "list", " ", "=", " ", "sorte", "d", "(", "name", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "{_", "\"", "entit", "ies", "\"_", ":_", "dict", "\\u", "list_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Conten", "t", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "odd", " ", "number", " ", "means", " ", "listi", "ng", " ", "last", " ", "entity", " ", "VALUES_", "\\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 ", " _", "entity_", "=_", "arglist_", "[_", "-_", "1_", "]_", "#", " ", "the", " ", "final", " ", "entity", " ", "in", " ", "the", " ", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "self_", "._", "build", "Query_", "(_", "session_", ",_", "entities_", ",_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "entity_", "==_", "\"", "comics", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "self_", "._", "process", "Com", "ic", "Query", "Args_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", ",_", "total", "\\u", "results_", "=_", "self_", "._", "process", "Pag", "ing", "Args_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "query_", "._", "options_", "(_", "subquery", "load_", "(_", "'", "character", "s", "\\u", "raw", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "options_", "(_", "subquery", "load_", "(_", "'", "stor", "yar", "cs", "\\u", "raw", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "options_", "(_", "subquery", "load_", "(_", "'", "location", "s", "\\u", "raw", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "options_", "(_", "subquery", "load_", "(_", "'", "team", "s", "\\u", "raw", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "query", " ", "=", " ", "query", ".", "options", "(", "subquery", "load", "('", "credits", "\\u", "raw", "'))", " _", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "query_", "._", "options_", "(_", "subquery", "load_", "(_", "'", "gener", "ict", "ags", "\\u", "raw", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "result", "Set", "To", "Json_", "(_", "query_", ",_", "\"", "comics", "\"_", ",_", "total", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "{_", "entity_", ":_", "sorted_", "(_", "list_", "(_", "set_", "(_", "[_", "i_", "[_", "0_", "]_", "for_", "i_", "in_", "query_", "._", "all_", "(_", ")_", "]_", ")_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "application_", "._", "dm_", "._", "engine_", "._", "echo_", "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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 ]
Except block handles 'BaseException'
GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/adaptive_thread_pool.py
[ { "content": " def run(self):\n \"\"\"Perform the work of the thread.\"\"\"\n logger.debug('[%s] %s: started', self.getName(), self.__class__.__name__)\n\n\n try:\n self.WorkOnItems()\n except:\n self.SetError()\n\n logger.debug('[%s] %s: exiting', self.getName(), self.__class__.__name__)", "metadata": "root.WorkerThread.run", "header": "['class', 'WorkerThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 116 } ]
[ { "span": "except:", "start_line": 123, "start_column": 4, "end_line": 123, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Worke", "r", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "the", " ", "work", " ", "of", " ", "the", " ", "thread", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'[", "%", "s", "]", " ", "%", "s", ":", " ", "start", "ed", "'_", ",_", "self_", "._", "get", "Name_", "(_", ")_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Work", "On", "Items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'[", "%", "s", "]", " ", "%", "s", ":", " ", "exit", "ing", "'_", ",_", "self_", "._", "get", "Name_", "(_", ")_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/src/desktop/lib/gen-py/djangothrift_test_gen/ttypes.py
[ { "content": "#\n# Autogenerated by Thrift Compiler (0.9.0)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n# options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n from thrift.protocol import fastbinary\nexcept:\n fastbinary = None\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestEnum(object):\n ENUM_ONE = 0\n ENUM_TWO = 1\n ENUM_THREE = 2\n\n _VALUES_TO_NAMES = {\n 0: \"ENUM_ONE\",\n 1: \"ENUM_TWO\",\n 2: \"ENUM_THREE\",\n }\n\n _NAMES_TO_VALUES = {\n \"ENUM_ONE\": 0,\n \"ENUM_TWO\": 1,\n \"ENUM_THREE\": 2,\n }", "metadata": "root.TestEnum", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class TestStruct(object):\n \"\"\"\n Attributes:\n - a\n - b\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'a', None, None, ), # 1\n (2, TType.I32, 'b', None, None, ), # 2\n )\n\n\n\n\n\n\n\n", "metadata": "root.TestStruct", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self, a=None, b=None,):\n self.a = a\n self.b = b", "metadata": "root.TestStruct.__init__", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.a = iprot.readString();\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.I32:\n self.b = iprot.readI32();\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TestStruct.read", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TestStruct')\n if self.a is not None:\n oprot.writeFieldBegin('a', TType.STRING, 1)\n oprot.writeString(self.a)\n oprot.writeFieldEnd()\n if self.b is not None:\n oprot.writeFieldBegin('b', TType.I32, 2)\n oprot.writeI32(self.b)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TestStruct.write", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def validate(self):\n return", "metadata": "root.TestStruct.validate", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 93 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TestStruct.__repr__", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 97 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TestStruct.__eq__", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TestStruct.__ne__", "header": "['class', 'TestStruct', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": "class TestNesting(object):\n \"\"\"\n Attributes:\n - nested_struct\n - b\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'nested_struct', (TestStruct, TestStruct.thrift_spec), None, ), # 1\n (2, TType.I32, 'b', None, None, ), # 2\n )\n\n\n\n\n\n\n\n", "metadata": "root.TestNesting", "header": "['module', '___EOS___']", "index": 108 }, { "content": " def __init__(self, nested_struct=None, b=None,):\n self.nested_struct = nested_struct\n self.b = b", "metadata": "root.TestNesting.__init__", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 121 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.nested_struct = TestStruct()\n self.nested_struct.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.I32:\n self.b = iprot.readI32();\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TestNesting.read", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 125 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TestNesting')\n if self.nested_struct is not None:\n oprot.writeFieldBegin('nested_struct', TType.STRUCT, 1)\n self.nested_struct.write(oprot)\n oprot.writeFieldEnd()\n if self.b is not None:\n oprot.writeFieldBegin('b', TType.I32, 2)\n oprot.writeI32(self.b)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TestNesting.write", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 150 }, { "content": " def validate(self):\n return", "metadata": "root.TestNesting.validate", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 166 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TestNesting.__repr__", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TestNesting.__eq__", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TestNesting.__ne__", "header": "['class', 'TestNesting', '(', 'object', ')', ':', '___EOS___']", "index": 178 }, { "content": "class TestManyTypes(object):\n \"\"\"\n Attributes:\n - a_bool\n - a_byte\n - a_i16\n - a_i32\n - a_i64\n - a_double\n - a_string\n - a_binary\n - a_enum\n - a_struct\n - a_set\n - a_list\n - a_map\n - a_string_with_default\n - a_string_list\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.BOOL, 'a_bool', None, None, ), # 1\n (2, TType.BYTE, 'a_byte', None, None, ), # 2\n (3, TType.I16, 'a_i16', None, None, ), # 3\n (4, TType.I32, 'a_i32', None, None, ), # 4\n (5, TType.I64, 'a_i64', None, None, ), # 5\n (6, TType.DOUBLE, 'a_double', None, None, ), # 6\n (7, TType.STRING, 'a_string', None, None, ), # 7\n (8, TType.STRING, 'a_binary', None, None, ), # 8\n (9, TType.I32, 'a_enum', None, None, ), # 9\n (10, TType.STRUCT, 'a_struct', (TestStruct, TestStruct.thrift_spec), None, ), # 10\n (11, TType.SET, 'a_set', (TType.I32,None), None, ), # 11\n (12, TType.LIST, 'a_list', (TType.STRUCT,(TestStruct, TestStruct.thrift_spec)), None, ), # 12\n (13, TType.MAP, 'a_map', (TType.I32,None,TType.STRUCT,(TestStruct, TestStruct.thrift_spec)), None, ), # 13\n (14, TType.STRING, 'a_string_with_default', None, \"the_default\", ), # 14\n (15, TType.LIST, 'a_string_list', (TType.STRING,None), None, ), # 15\n )\n\n\n\n\n\n\n\n", "metadata": "root.TestManyTypes", "header": "['module', '___EOS___']", "index": 181 }, { "content": " def __init__(self, a_bool=None, a_byte=None, a_i16=None, a_i32=None, a_i64=None, a_double=None, a_string=None, a_binary=None, a_enum=None, a_struct=None, a_set=None, a_list=None, a_map=None, a_string_with_default=thrift_spec[14][4], a_string_list=None,):\n self.a_bool = a_bool\n self.a_byte = a_byte\n self.a_i16 = a_i16\n self.a_i32 = a_i32\n self.a_i64 = a_i64\n self.a_double = a_double\n self.a_string = a_string\n self.a_binary = a_binary\n self.a_enum = a_enum\n self.a_struct = a_struct\n self.a_set = a_set\n self.a_list = a_list\n self.a_map = a_map\n self.a_string_with_default = a_string_with_default\n self.a_string_list = a_string_list", "metadata": "root.TestManyTypes.__init__", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 220 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.BOOL:\n self.a_bool = iprot.readBool();\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.BYTE:\n self.a_byte = iprot.readByte();\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.I16:\n self.a_i16 = iprot.readI16();\n else:\n iprot.skip(ftype)\n elif fid == 4:\n if ftype == TType.I32:\n self.a_i32 = iprot.readI32();\n else:\n iprot.skip(ftype)\n elif fid == 5:\n if ftype == TType.I64:\n self.a_i64 = iprot.readI64();\n else:\n iprot.skip(ftype)\n elif fid == 6:\n if ftype == TType.DOUBLE:\n self.a_double = iprot.readDouble();\n else:\n iprot.skip(ftype)\n elif fid == 7:\n if ftype == TType.STRING:\n self.a_string = iprot.readString();\n else:\n iprot.skip(ftype)\n elif fid == 8:\n if ftype == TType.STRING:\n self.a_binary = iprot.readString();\n else:\n iprot.skip(ftype)\n elif fid == 9:\n if ftype == TType.I32:\n self.a_enum = iprot.readI32();\n else:\n iprot.skip(ftype)\n elif fid == 10:\n if ftype == TType.STRUCT:\n self.a_struct = TestStruct()\n self.a_struct.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 11:\n if ftype == TType.SET:\n self.a_set = set()\n (_etype3, _size0) = iprot.readSetBegin()\n for _i4 in xrange(_size0):\n _elem5 = iprot.readI32();\n self.a_set.add(_elem5)\n iprot.readSetEnd()\n else:\n iprot.skip(ftype)\n elif fid == 12:\n if ftype == TType.LIST:\n self.a_list = []\n (_etype9, _size6) = iprot.readListBegin()\n for _i10 in xrange(_size6):\n _elem11 = TestStruct()\n _elem11.read(iprot)\n self.a_list.append(_elem11)\n iprot.readListEnd()\n else:\n iprot.skip(ftype)\n elif fid == 13:\n if ftype == TType.MAP:\n self.a_map = {}\n (_ktype13, _vtype14, _size12 ) = iprot.readMapBegin() \n for _i16 in xrange(_size12):\n _key17 = iprot.readI32();\n _val18 = TestStruct()\n _val18.read(iprot)\n self.a_map[_key17] = _val18\n iprot.readMapEnd()\n else:\n iprot.skip(ftype)\n elif fid == 14:\n if ftype == TType.STRING:\n self.a_string_with_default = iprot.readString();\n else:\n iprot.skip(ftype)\n elif fid == 15:\n if ftype == TType.LIST:\n self.a_string_list = []\n (_etype22, _size19) = iprot.readListBegin()\n for _i23 in xrange(_size19):\n _elem24 = iprot.readString();\n self.a_string_list.append(_elem24)\n iprot.readListEnd()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.TestManyTypes.read", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 237 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('TestManyTypes')\n if self.a_bool is not None:\n oprot.writeFieldBegin('a_bool', TType.BOOL, 1)\n oprot.writeBool(self.a_bool)\n oprot.writeFieldEnd()\n if self.a_byte is not None:\n oprot.writeFieldBegin('a_byte', TType.BYTE, 2)\n oprot.writeByte(self.a_byte)\n oprot.writeFieldEnd()\n if self.a_i16 is not None:\n oprot.writeFieldBegin('a_i16', TType.I16, 3)\n oprot.writeI16(self.a_i16)\n oprot.writeFieldEnd()\n if self.a_i32 is not None:\n oprot.writeFieldBegin('a_i32', TType.I32, 4)\n oprot.writeI32(self.a_i32)\n oprot.writeFieldEnd()\n if self.a_i64 is not None:\n oprot.writeFieldBegin('a_i64', TType.I64, 5)\n oprot.writeI64(self.a_i64)\n oprot.writeFieldEnd()\n if self.a_double is not None:\n oprot.writeFieldBegin('a_double', TType.DOUBLE, 6)\n oprot.writeDouble(self.a_double)\n oprot.writeFieldEnd()\n if self.a_string is not None:\n oprot.writeFieldBegin('a_string', TType.STRING, 7)\n oprot.writeString(self.a_string)\n oprot.writeFieldEnd()\n if self.a_binary is not None:\n oprot.writeFieldBegin('a_binary', TType.STRING, 8)\n oprot.writeString(self.a_binary)\n oprot.writeFieldEnd()\n if self.a_enum is not None:\n oprot.writeFieldBegin('a_enum', TType.I32, 9)\n oprot.writeI32(self.a_enum)\n oprot.writeFieldEnd()\n if self.a_struct is not None:\n oprot.writeFieldBegin('a_struct', TType.STRUCT, 10)\n self.a_struct.write(oprot)\n oprot.writeFieldEnd()\n if self.a_set is not None:\n oprot.writeFieldBegin('a_set', TType.SET, 11)\n oprot.writeSetBegin(TType.I32, len(self.a_set))\n for iter25 in self.a_set:\n oprot.writeI32(iter25)\n oprot.writeSetEnd()\n oprot.writeFieldEnd()\n if self.a_list is not None:\n oprot.writeFieldBegin('a_list', TType.LIST, 12)\n oprot.writeListBegin(TType.STRUCT, len(self.a_list))\n for iter26 in self.a_list:\n iter26.write(oprot)\n oprot.writeListEnd()\n oprot.writeFieldEnd()\n if self.a_map is not None:\n oprot.writeFieldBegin('a_map', TType.MAP, 13)\n oprot.writeMapBegin(TType.I32, TType.STRUCT, len(self.a_map))\n for kiter27,viter28 in self.a_map.items():\n oprot.writeI32(kiter27)\n viter28.write(oprot)\n oprot.writeMapEnd()\n oprot.writeFieldEnd()\n if self.a_string_with_default is not None:\n oprot.writeFieldBegin('a_string_with_default', TType.STRING, 14)\n oprot.writeString(self.a_string_with_default)\n oprot.writeFieldEnd()\n if self.a_string_list is not None:\n oprot.writeFieldBegin('a_string_list', TType.LIST, 15)\n oprot.writeListBegin(TType.STRING, len(self.a_string_list))\n for iter29 in self.a_string_list:\n oprot.writeString(iter29)\n oprot.writeListEnd()\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.TestManyTypes.write", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 350 }, { "content": " def validate(self):\n return", "metadata": "root.TestManyTypes.validate", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 431 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.TestManyTypes.__repr__", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 435 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.TestManyTypes.__eq__", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 440 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.TestManyTypes.__ne__", "header": "['class', 'TestManyTypes', '(', 'object', ')', ':', '___EOS___']", "index": 443 } ]
[ { "span": "from thrift.Thrift import TType, TMessageType, TException, TApplicationException", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 80 }, { "span": "from thrift.protocol import TBinaryProtocol, TProtocol", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 54 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "generat", "ed", " ", "by", " ", "Thri", "ft", " ", "Compil", "er", " ", "(", "0.", "9.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "EDIT", " ", "UNL", "ESS", " ", "YOU", " ", "ARE", " ", "SUR", "E", " ", "THA", "T", " ", "YOU", " ", "KN", "OW", " ", "WH", "AT", " ", "YOU", " ", "ARE", " ", "DOI", "NG_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "options", " ", "string", ":", " ", "py", ":", "new", "\\u", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "Thri", "ft_", "import_", "TT", "ype_", ",_", "TM", "essage", "Type_", ",_", "TE", "xcept", "ion_", ",_", "TA", "ppl", "ication", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", ",_", "TP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "thrift", "_", "._", "protocol_", "import_", "fastbinary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Enum_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ENUM", "\\u", "ONE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENUM", "\\u", "TWO", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENUM", "\\u", "THREE", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "VALU", "ES", "\\u", "TO", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "ENUM", "\\u", "ONE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "ENUM", "\\u", "TWO", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "ENUM", "\\u", "THREE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NAMES", "\\u", "TO", "\\u", "VALUES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ENUM", "\\u", "ONE", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ENUM", "\\u", "TWO", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ENUM", "\\u", "THREE", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\", "10", ";", " ", " ", " ", "-", " ", "b", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "a", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "I32_", ",_", "'", "b", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "a_", "=_", "None_", ",_", "b_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "b_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Test", "Stru", "ct", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "a_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "b", "'_", ",_", "TT", "ype_", "._", "I32_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I32_", "(_", "self_", "._", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "nest", "ed", "\\u", "struct", "\\", "10", ";", " ", " ", " ", "-", " ", "b", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "nest", "ed", "\\u", "struct", "'_", ",_", "(_", "Test", "Struct_", ",_", "Test", "Struct_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "I32_", ",_", "'", "b", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "nest", "ed", "\\u", "struct_", "=_", "None_", ",_", "b_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nest", "ed", "\\u", "struct_", "=_", "nest", "ed", "\\u", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nest", "ed", "\\u", "struct_", "=_", "Test", "Struct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nest", "ed", "\\u", "struct_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "b_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Test", "Nest", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "nest", "ed", "\\u", "struct_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "nest", "ed", "\\u", "struct", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nest", "ed", "\\u", "struct_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "b", "'_", ",_", "TT", "ype_", "._", "I32_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I32_", "(_", "self_", "._", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nest", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "bool", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "byte", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "i1", "6", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "i3", "2", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "i", "64", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "double", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "string", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "binar", "y", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "enum", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "struct", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "set", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "list", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "map", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "string", "\\u", "with", "\\u", "default", "\\", "10", ";", " ", " ", " ", "-", " ", "a", "\\u", "string", "\\u", "list", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "'", "a", "\\u", "bool", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "BYTE_", ",_", "'", "a", "\\u", "byte", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "I1", "6_", ",_", "'", "a", "\\u", "i1", "6", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "TT", "ype_", "._", "I32_", ",_", "'", "a", "\\u", "i3", "2", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "TT", "ype_", "._", "I64_", ",_", "'", "a", "\\u", "i", "64", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "6_", ",_", "TT", "ype_", "._", "DOUBLE_", ",_", "'", "a", "\\u", "double", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "6_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "7_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "a", "\\u", "string", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "7_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "8_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "a", "\\u", "binar", "y", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "8_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "TT", "ype_", "._", "I32_", ",_", "'", "a", "\\u", "enum", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "9_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "a", "\\u", "struct", "'_", ",_", "(_", "Test", "Struct_", ",_", "Test", "Struct_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "11_", ",_", "TT", "ype_", "._", "SET_", ",_", "'", "a", "\\u", "set", "'_", ",_", "(_", "TT", "ype_", "._", "I32_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "11_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "12_", ",_", "TT", "ype_", "._", "LIST_", ",_", "'", "a", "\\u", "list", "'_", ",_", "(_", "TT", "ype_", "._", "STRUCT_", ",_", "(_", "Test", "Struct_", ",_", "Test", "Struct_", "._", "thrift", "\\u", "spec_", ")_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "12_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "13_", ",_", "TT", "ype_", "._", "MAP_", ",_", "'", "a", "\\u", "map", "'_", ",_", "(_", "TT", "ype_", "._", "I32_", ",_", "None_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "(_", "Test", "Struct_", ",_", "Test", "Struct_", "._", "thrift", "\\u", "spec_", ")_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "13_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "14_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "a", "\\u", "string", "\\u", "with", "\\u", "default", "'_", ",_", "None_", ",_", "\"", "the", "\\u", "default", "\"_", ",_", ")_", ",_", "#", " ", "14_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "15_", ",_", "TT", "ype_", "._", "LIST_", ",_", "'", "a", "\\u", "string", "\\u", "list", "'_", ",_", "(_", "TT", "ype_", "._", "STRING_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "15_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "a", "\\u", "bool_", "=_", "None_", ",_", "a", "\\u", "byte_", "=_", "None_", ",_", "a", "\\u", "i1", "6_", "=_", "None_", ",_", "a", "\\u", "i3", "2_", "=_", "None_", ",_", "a", "\\u", "i", "64_", "=_", "None_", ",_", "a", "\\u", "double_", "=_", "None_", ",_", "a", "\\u", "string_", "=_", "None_", ",_", "a", "\\u", "binary_", "=_", "None_", ",_", "a", "\\u", "enum_", "=_", "None_", ",_", "a", "\\u", "struct_", "=_", "None_", ",_", "a", "\\u", "set_", "=_", "None_", ",_", "a", "\\u", "list_", "=_", "None_", ",_", "a", "\\u", "map_", "=_", "None_", ",_", "a", "\\u", "string", "\\u", "with", "\\u", "default_", "=_", "thrift", "\\u", "spec_", "[_", "14_", "]_", "[_", "4_", "]_", ",_", "a", "\\u", "string", "\\u", "list_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "bool_", "=_", "a", "\\u", "bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "byte_", "=_", "a", "\\u", "byte_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "i1", "6_", "=_", "a", "\\u", "i1", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "i3", "2_", "=_", "a", "\\u", "i3", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "i", "64_", "=_", "a", "\\u", "i", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "double_", "=_", "a", "\\u", "double_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "string_", "=_", "a", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "binary_", "=_", "a", "\\u", "binary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "enum_", "=_", "a", "\\u", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "struct_", "=_", "a", "\\u", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "set_", "=_", "a", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "list_", "=_", "a", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "map_", "=_", "a", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "string", "\\u", "with", "\\u", "default_", "=_", "a", "\\u", "string", "\\u", "with", "\\u", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "string", "\\u", "list_", "=_", "a", "\\u", "string", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "BOOL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "bool_", "=_", "iprot_", "._", "read", "Bool_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "BYTE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "byte_", "=_", "iprot_", "._", "read", "Byte_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I1", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "i1", "6_", "=_", "iprot_", "._", "read", "I1", "6_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "i3", "2_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "i", "64_", "=_", "iprot_", "._", "read", "I64_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "DOUBLE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "double_", "=_", "iprot_", "._", "read", "Double_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "string_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "binary_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "enum_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "struct_", "=_", "Test", "Struct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "struct_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "11_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "SET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "3_", ",_", "\\u", "size", "0_", ")_", "=_", "iprot_", "._", "read", "Set", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i", "4_", "in_", "xrange_", "(_", "\\u", "size", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "5_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "set_", "._", "add_", "(_", "\\u", "elem", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Set", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "LIST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "9_", ",_", "\\u", "size", "6_", ")_", "=_", "iprot_", "._", "read", "List", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i1", "0_", "in_", "xrange_", "(_", "\\u", "size", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "11_", "=_", "Test", "Struct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "elem", "11_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "list_", "._", "append_", "(_", "\\u", "elem", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "13_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "kt", "ype", "13_", ",_", "\\u", "vty", "pe", "14_", ",_", "\\u", "size", "12_", ")_", "=_", "iprot_", "._", "read", "Map", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i1", "6_", "in_", "xrange_", "(_", "\\u", "size", "12_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "key", "17_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "val", "18_", "=_", "Test", "Struct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "val", "18_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "map_", "[_", "\\u", "key", "17_", "]_", "=_", "\\u", "val", "18_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Map", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "14_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "string", "\\u", "with", "\\u", "default_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "15_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "LIST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "string", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "22_", ",_", "\\u", "size", "19_", ")_", "=_", "iprot_", "._", "read", "List", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i2", "3_", "in_", "xrange_", "(_", "\\u", "size", "19_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "24_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "string", "\\u", "list_", "._", "append_", "(_", "\\u", "elem", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Test", "Many", "Type", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "bool_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "bool", "'_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Bool_", "(_", "self_", "._", "a", "\\u", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "byte_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "byte", "'_", ",_", "TT", "ype_", "._", "BYTE_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Byte_", "(_", "self_", "._", "a", "\\u", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "i1", "6_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "i1", "6", "'_", ",_", "TT", "ype_", "._", "I1", "6_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I1", "6_", "(_", "self_", "._", "a", "\\u", "i1", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "i3", "2_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "i3", "2", "'_", ",_", "TT", "ype_", "._", "I32_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I32_", "(_", "self_", "._", "a", "\\u", "i3", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "i", "64_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "i", "64", "'_", ",_", "TT", "ype_", "._", "I64_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I64_", "(_", "self_", "._", "a", "\\u", "i", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "double_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "double", "'_", ",_", "TT", "ype_", "._", "DOUBLE_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Double_", "(_", "self_", "._", "a", "\\u", "double_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "string_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "string", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "a", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "binary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "binar", "y", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "a", "\\u", "binary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "enum_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "enum", "'_", ",_", "TT", "ype_", "._", "I32_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I32_", "(_", "self_", "._", "a", "\\u", "enum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "struct_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "struct", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "struct_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "set_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "set", "'_", ",_", "TT", "ype_", "._", "SET_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Set", "Begin_", "(_", "TT", "ype_", "._", "I32_", ",_", "len_", "(_", "self_", "._", "a", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "25_", "in_", "self_", "._", "a", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "I32_", "(_", "iter", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Set", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "list_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "list", "'_", ",_", "TT", "ype_", "._", "LIST_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "List", "Begin_", "(_", "TT", "ype_", "._", "STRUCT_", ",_", "len_", "(_", "self_", "._", "a", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "26_", "in_", "self_", "._", "a", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter", "26_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "map_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "map", "'_", ",_", "TT", "ype_", "._", "MAP_", ",_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Map", "Begin_", "(_", "TT", "ype_", "._", "I32_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "len_", "(_", "self_", "._", "a", "\\u", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "kite", "r2", "7_", ",_", "vite", "r2", "8_", "in_", "self_", "._", "a", "\\u", "map_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "I32_", "(_", "kite", "r2", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vite", "r2", "8_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Map", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "string", "\\u", "with", "\\u", "default_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "string", "\\u", "with", "\\u", "default", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "a", "\\u", "string", "\\u", "with", "\\u", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "a", "\\u", "string", "\\u", "list_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "a", "\\u", "string", "\\u", "list", "'_", ",_", "TT", "ype_", "._", "LIST_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "List", "Begin_", "(_", "TT", "ype_", "._", "STRING_", ",_", "len_", "(_", "self_", "._", "a", "\\u", "string", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "29_", "in_", "self_", "._", "a", "\\u", "string", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "String_", "(_", "iter", "29_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 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
ganeti/ganeti/test/py/ganeti.utils.process_unittest.py
[ { "content": " def test(self):\n sample_cmd = \"sleep 20; true\"\n pid = subprocess.Popen(sample_cmd, shell=True).pid\n cmdline = utils.GetProcCmdline(pid)\n # As the popen will quote and pass on the sample_cmd, it should be returned\n # by the function as an element in the list of arguments\n self.assertTrue(sample_cmd in cmdline)", "metadata": "root.GetCmdline.test", "header": "['class', 'GetCmdline', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 746 } ]
[ { "span": "self.assertTrue(sample_cmd in cmdline)", "start_line": 752, "start_column": 4, "end_line": 752, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Get", "Cmd", "line_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample", "\\u", "cmd_", "=_", "\"", "sleep", " ", "20", ";", " ", "true", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", "=_", "subprocess_", "._", "Popen_", "(_", "sample", "\\u", "cmd_", ",_", "shell_", "=_", "True_", ")_", "._", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "=_", "utils_", "._", "Get", "Proc", "Cmd", "line_", "(_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "As", " ", "the", " ", "popen", " ", "will", " ", "quote", " ", "and", " ", "pass", " ", "on", " ", "the", " ", "sample", "\\u", "cmd", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "the", " ", "function", " ", "as", " ", "an", " ", "element", " ", "in", " ", "the", " ", "list", " ", "of", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "sample", "\\u", "cmd_", "in_", "cmdline_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
ProgVal/Limnoria/plugins/GPG/config.py
[ { "content": "###\n# Copyright (c) 2015, Valentin Lorentz\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions, and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions, and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of the author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\ntry:\n from supybot.i18n import PluginInternationalization\n _ = PluginInternationalization('GPG')\nexcept:\n # Placeholder that allows to run the plugin on a bot\n # without the i18n module\n _ = lambda x: x\n\n\n\n\nGPG = conf.registerPlugin('GPG')\n# This is where your configuration variables (if any) should go. For example:\n# conf.registerGlobalValue(GPG, 'someConfigVariableName',\n# registry.Boolean(False, _(\"\"\"Help for someConfigVariableName.\"\"\")))\n\nconf.registerGroup(GPG, 'auth')\nconf.registerGroup(GPG.auth, 'sign')\n\nconf.registerGlobalValue(GPG.auth.sign, 'enable',\n registry.Boolean(True, \"\"\"Determines whether or not users are\n allowed to use GPG signing for authentication.\"\"\"))\nconf.registerGlobalValue(GPG.auth.sign, 'TokenTimeout',\n registry.PositiveInteger(60*10, \"\"\"Determines the lifetime of a GPG\n signature authentication token (in seconds).\"\"\"))\n\n\n# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "Val", "enti", "n", " ", "Lore", "ntz", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "registry_", "as_", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "GPG", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Place", "holder", " ", "tha", "t", " ", "allow", "s", " ", "to", " ", "run", " ", "the", " ", "plugin", " ", "on", " ", "a", " ", "bot_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "the", " ", "i18n", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "GPG", "_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "GPG", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "where", " ", "your", " ", "configura", "tion", " ", "variab", "les", " ", "(", "if", " ", "any", ")", " ", "shou", "ld", " ", "go", ".", " ", " ", "For", " ", "example", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conf", ".", "register", "Global", "Value", "(", "GPG", ",", " ", "'", "some", "Config", "Varia", "ble", "Name", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registr", "y", ".", "Boo", "lean", "(", "Fal", "se", ",", " ", "\\u(", "\"\"\"", "Help", " ", "for", " ", "some", "Config", "Varia", "ble", "Name", ".\"", "\"\"", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Group_", "(_", "GPG", "_", ",_", "'", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Group_", "(_", "GPG", "_", "._", "auth_", ",_", "'", "sign", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "GPG", "_", "._", "auth_", "._", "sign_", ",_", "'", "enable", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "True_", ",_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "or", " ", "not", " ", "users", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "allow", "ed", " ", "to", " ", "use", " ", "GPG", " ", "signin", "g", " ", "for", " ", "authenticat", "ion", ".\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "GPG", "_", "._", "auth_", "._", "sign_", ",_", "'", "Token", "Time", "out", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Posi", "tiv", "e", "Integer_", "(_", "60_", "*_", "10_", ",_", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "life", "time", " ", "of", " ", "a", " ", "GPG", "\\", "10", ";", " ", " ", " ", " ", "signa", "ture", " ", "authenticat", "ion", " ", "token", " ", "(", "in", " ", "second", "s", ").\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
practo/r5d4/r5d4/analytics_worker.py
[ { "content": "def actual_worker(analytics_name, sub, app):\n log = get_worker_log(analytics_name)\n try:\n conf_db = get_conf_db(app, exclusive=True)\n defn = conf_db.get(\"Analytics:ByName:%s\" % analytics_name)\n analytics = Analytics(defn)\n if analytics[\"data_db\"]:\n data_db = get_data_db(analytics[\"data_db\"], app=app)\n else:\n data_db = get_data_db(app=app)\n measures = set(analytics[\"measures\"])\n query_dimensions = set(analytics[\"query_dimensions\"])\n slice_dimensions = set(analytics[\"slice_dimensions\"])\n mapping = analytics[\"mapping\"]\n for content in sub.listen():\n if content[\"type\"] == \"message\":\n try:\n data = json.loads(content[\"data\"])\n transaction = data[\"payload\"]\n tr_type = data[\"tr_type\"]\n\n snoq_dimensions = slice_dimensions - query_dimensions\n qnos_dimensions = query_dimensions - slice_dimensions\n\n def build_key_str(dimensions):\n key = []\n for dimension in sorted(list(dimensions)):\n d_type = mapping[dimension][\"type\"]\n function = DIMENSION_PARSERS_MAP[d_type]\n field = mapping[dimension][\"field\"]\n key.append(dimension)\n key.append(function(transaction[field]))\n return construct_key(key)\n\n query_key_str = build_key_str(query_dimensions)\n slice_key_str = build_key_str(slice_dimensions)\n snoq_key_str = build_key_str(snoq_dimensions)\n\n # Updating Reference count for qnos dimensions\n for dimension in sorted(list(qnos_dimensions)):\n field = mapping[dimension][\"field\"]\n ref_count_key = construct_key('RefCount',\n slice_key_str,\n dimension)\n if tr_type == \"insert\":\n value = data_db.hincrby(ref_count_key,\n transaction[field],\n 1)\n elif tr_type == \"delete\":\n value = data_db.hincrby(ref_count_key,\n transaction[field],\n -1)\n if value == 0:\n data_db.hdel(ref_count_key, transaction[field])\n\n # Each measure gets added one at a time\n for m in measures:\n if mapping[m][\"resource\"] != content[\"channel\"]:\n continue\n key_str = construct_key(m, query_key_str, snoq_key_str)\n function = MEASURING_FUNCTIONS_MAP[mapping[m][\"type\"]]\n field = mapping[m].get(\"field\", None)\n conditions = mapping[m].get(\"conditions\", [])\n kwargs = {\n \"key_str\": key_str,\n }\n\n for condition in conditions:\n condition_field = condition[\"field\"]\n equals = condition.get(\"equals\", None)\n not_equals = condition.get(\"not_equals\", None)\n if equals is not None:\n if transaction[condition_field] != equals:\n break # Failed equals condition\n elif not_equals is not None:\n if transaction[condition_field] == not_equals:\n break # Failed not equals condition\n else:\n # All conditions passed\n if field is not None:\n kwargs[\"field_val\"] = transaction[field]\n function(data_db, tr_type, **kwargs)\n\n except Exception, e:\n log.error(\"Error while consuming transaction.\\n%s\" %\n traceback.format_exc())\n log.debug(\"Resource was: %s\" % content[\"channel\"])\n log.debug(\"Data was: %s\" % json.dumps(data))\n except Exception, e:\n log.critical(\"Worker crashed.\\nError was: %s\" % str(e))\n log.debug(\"Traceback: %s\" % traceback.format_exc())\n signal.pause()", "metadata": "root.actual_worker", "header": "['module', '___EOS___']", "index": 16 } ]
[ { "span": "value ", "start_line": 61, "start_column": 28, "end_line": 61, "end_column": 33 } ]
[ { "span": "value ", "start_line": 65, "start_column": 28, "end_line": 65, "end_column": 33 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "actual", "\\u", "worker_", "(_", "analytics", "\\u", "name_", ",_", "sub_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "=_", "get", "\\u", "worker", "\\u", "log_", "(_", "analytics", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf", "\\u", "db_", "=_", "get", "\\u", "conf", "\\u", "db_", "(_", "app_", ",_", "exclusive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defn_", "=_", "conf", "\\u", "db_", "._", "get_", "(_", "\"", "Analy", "tic", "s", ":", "By", "Name", ":", "%", "s", "\"_", "%_", "analytics", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analytics", "_", "=_", "Analy", "tic", "s_", "(_", "defn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "analytics", "_", "[_", "\"", "data\\u", "db", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "db_", "=_", "get", "\\u", "data\\u", "db_", "(_", "analytics", "_", "[_", "\"", "data\\u", "db", "\"_", "]_", ",_", "app_", "=_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "db_", "=_", "get", "\\u", "data\\u", "db_", "(_", "app_", "=_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "measures_", "=_", "set_", "(_", "analytics", "_", "[_", "\"", "measure", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "dimensions_", "=_", "set_", "(_", "analytics", "_", "[_", "\"", "query", "\\u", "dimension", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "dimensions_", "=_", "set_", "(_", "analytics", "_", "[_", "\"", "slice", "\\u", "dimension", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "=_", "analytics", "_", "[_", "\"", "mapping", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "content_", "in_", "sub_", "._", "listen_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "content_", "[_", "\"", "type", "\"_", "]_", "==_", "\"", "message", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "json_", "._", "loads_", "(_", "content_", "[_", "\"", "data", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "=_", "data_", "[_", "\"", "payload", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "\\u", "type_", "=_", "data_", "[_", "\"", "tr", "\\u", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sno", "q", "\\u", "dimensions_", "=_", "slice", "\\u", "dimensions_", "-_", "query", "\\u", "dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qn", "os", "\\u", "dimensions_", "=_", "query", "\\u", "dimensions_", "-_", "slice", "\\u", "dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "\\u", "key", "\\u", "str_", "(_", "dimensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "key_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dimension_", "in_", "sorted_", "(_", "list_", "(_", "dimensions_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d\\u", "type_", "=_", "mapping_", "[_", "dimension_", "]_", "[_", "\"", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function_", "=_", "DIMENSION", "\\u", "PARSE", "RS", "\\u", "MAP_", "[_", "d\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "mapping_", "[_", "dimension_", "]_", "[_", "\"", "field", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "append_", "(_", "dimension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "append_", "(_", "function_", "(_", "transaction_", "[_", "field_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "construct", "\\u", "key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "key", "\\u", "str_", "=_", "build", "\\u", "key", "\\u", "str_", "(_", "query", "\\u", "dimensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "key", "\\u", "str_", "=_", "build", "\\u", "key", "\\u", "str_", "(_", "slice", "\\u", "dimensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sno", "q", "\\u", "key", "\\u", "str_", "=_", "build", "\\u", "key", "\\u", "str_", "(_", "sno", "q", "\\u", "dimensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Up", "dati", "ng", " ", "Reference", " ", "count", " ", "for", " ", "qn", "os", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dimension_", "in_", "sorted_", "(_", "list_", "(_", "qn", "os", "\\u", "dimensions_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "field_", "=_", "mapping_", "[_", "dimension_", "]_", "[_", "\"", "field", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "count", "\\u", "key_", "=_", "construct", "\\u", "key_", "(_", "'", "Ref", "Count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "key", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dimension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tr", "\\u", "type_", "==_", "\"", "insert", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "data\\u", "db_", "._", "hin", "cr", "by_", "(_", "ref", "\\u", "count", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transaction_", "[_", "field_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tr", "\\u", "type_", "==_", "\"", "delete", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "data\\u", "db_", "._", "hin", "cr", "by_", "(_", "ref", "\\u", "count", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transaction_", "[_", "field_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data\\u", "db_", "._", "hd", "el_", "(_", "ref", "\\u", "count", "\\u", "key_", ",_", "transaction_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "measure", " ", "gets", " ", "adde", "d", " ", "one", " ", "at", " ", "a", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "m_", "in_", "measures_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "mapping_", "[_", "m_", "]_", "[_", "\"", "resource", "\"_", "]_", "!=_", "content_", "[_", "\"", "channel", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key", "\\u", "str_", "=_", "construct", "\\u", "key_", "(_", "m_", ",_", "query", "\\u", "key", "\\u", "str_", ",_", "sno", "q", "\\u", "key", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function_", "=_", "ME", "AS", "URI", "NG", "\\u", "FUNCTIONS", "\\u", "MAP_", "[_", "mapping_", "[_", "m_", "]_", "[_", "\"", "type", "\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "mapping_", "[_", "m_", "]_", "._", "get_", "(_", "\"", "field", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conditions_", "=_", "mapping_", "[_", "m_", "]_", "._", "get_", "(_", "\"", "condition", "s", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\\u", "str", "\"_", ":_", "key", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "condition_", "in_", "conditions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "condition", "\\u", "field_", "=_", "condition_", "[_", "\"", "field", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "equals_", "=_", "condition_", "._", "get_", "(_", "\"", "equals", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "equals_", "=_", "condition_", "._", "get_", "(_", "\"", "not", "\\u", "equals", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "equals_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "transaction_", "[_", "condition", "\\u", "field_", "]_", "!=_", "equals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "#", " ", "Fail", "ed", " ", "equals", " ", "condition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not", "\\u", "equals_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "transaction_", "[_", "condition", "\\u", "field_", "]_", "==_", "not", "\\u", "equals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "#", " ", "Fail", "ed", " ", "not", " ", "equals", " ", "condition_", "\\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_", "#", " ", "All", " ", "condition", "s", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "kwargs_", "[_", "\"", "field", "\\u", "val", "\"_", "]_", "=_", "transaction_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function_", "(_", "data\\u", "db_", ",_", "tr", "\\u", "type_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "error_", "(_", "\"", "Error", " ", "whi", "le", " ", "consum", "ing", " ", "transaction", ".\\\\", "n", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Reso", "urc", "e", " ", "was", ":", " ", "%", "s", "\"_", "%_", "content_", "[_", "\"", "channel", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Data", " ", "was", ":", " ", "%", "s", "\"_", "%_", "json_", "._", "dumps_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "critical_", "(_", "\"", "Worke", "r", " ", "crash", "ed", ".\\\\", "n", "Error", " ", "was", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_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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 ]
Unused import
benjaoming/django-nyt/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# django-nyt documentation build configuration file, created by\n# sphinx-quickstart on Fri Jan 10 21:56:57 2014.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\nsys.path.insert(0, os.path.abspath('../test-project'))\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"testproject.settings\")\n\nimport django\ndjango.setup()\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n# source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = 'django-nyt'\nfrom datetime import datetime\ncopyright = '{}, Benjamin Bach'.format(datetime.now().year) # @ReservedAssignment\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\n\n\n\nfrom django_nyt import VERSION\n\nversion = VERSION\n# The full version, including alpha/beta/rc tags.\nrelease = VERSION\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n# language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n# today = ''\n# Else, today_fmt is used as the format for a strftime call.\n# today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n# default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n# add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n# add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n# show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n# modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\n\n\nif on_rtd:\n os.system(\"sphinx-apidoc --doc-project='Python Reference' -f -o . ../django_nyt ../django_nyt/tests ../django_nyt/migrations\")\n\nif on_rtd:\n html_theme = 'default'\nelse:\n try:\n import sphinx_rtd_theme # @UnusedImport\n html_theme = 'sphinx_rtd_theme'\n except ImportError:\n html_theme = 'natural'\n\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n# html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n# html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n# html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n# html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n# html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n# html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n# html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n# html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n# html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n# html_additional_pages = {}\n\n# If false, no module index is generated.\n# html_domain_indices = True\n\n# If false, no index is generated.\n# html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n# html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n# html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n# html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n# html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n# html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n# html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'django-nytdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n # The paper size ('letterpaper' or 'a4paper').\n # 'papersize': 'letterpaper',\n\n # The font size ('10pt', '11pt' or '12pt').\n # 'pointsize': '10pt',\n\n # Additional stuff for the LaTeX preamble.\n # 'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'django-nyt.tex', 'django-nyt Documentation', 'Benjamin Bach', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n# latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n# latex_use_parts = False\n\n# If true, show page references after internal links.\n# latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n# latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n# latex_appendices = []\n\n# If false, no module index is generated.\n# latex_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'django-nyt', 'django-nyt Documentation',\n ['Benjamin Bach'], 1)\n]\n\n# If true, show URL addresses after external links.\n# man_show_urls = False\n\n\n# -- Options for Texinfo output ------------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'django-nyt', 'django-nyt Documentation',\n 'Benjamin Bach', 'django-nyt', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n# texinfo_appendices = []\n\n# If false, no module index is generated.\n# texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n# texinfo_show_urls = 'footnote'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sphinx_rtd_theme ", "start_line": 121, "start_column": 8, "end_line": 121, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", "-", "ny", "t", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Fri", " ", "Jan", " ", "10", " ", "21", ":", "56", ":", "5", "7", " ", "2014", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "'..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "'../", "test", "-", "project", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "setdefault_", "(_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", ",_", "\"", "testpro", "ject", ".", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "django_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "'", "django", "-", "ny", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'{}", ",", " ", "Ben", "jam", "in", " ", "Bac", "h", "'_", "._", "format_", "(_", "datetime_", "._", "now_", "(_", ")_", "._", "year_", ")_", "#", " ", "@", "Reserve", "d", "Assignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "\\u", "ny", "t_", "import_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "rtd", "_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "READ", "THE", "DOCS", "'_", ",_", "None_", ")_", "==_", "'", "Tru", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "on", "\\u", "rtd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "sphinx", "-", "apid", "oc", " ", "--", "doc", "-", "project", "='", "Pyth", "on", " ", "Reference", "'", " ", "-", "f", " ", "-", "o", " ", ".", " ", "..", "/", "django", "\\u", "ny", "t", " ", "..", "/", "django", "\\u", "ny", "t", "/", "tests", " ", "..", "/", "django", "\\u", "ny", "t", "/", "migrati", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "on", "\\u", "rtd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\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 ", " _", "import_", "sphinx", "\\u", "rtd", "\\u", "theme_", "#", " ", "@", "Un", "used", "Import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "sphinx", "\\u", "rtd", "\\u", "them", "e", "'_", "\\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 ", " _", "html", "\\u", "theme_", "=_", "'", "natur", "al", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "django", "-", "ny", "tdo", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "django", "-", "ny", "t", ".", "tex", "'_", ",_", "'", "django", "-", "ny", "t", " ", "Document", "ation", "'_", ",_", "'", "Ben", "jam", "in", " ", "Bac", "h", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "django", "-", "ny", "t", "'_", ",_", "'", "django", "-", "ny", "t", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Ben", "jam", "in", " ", "Bac", "h", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "django", "-", "ny", "t", "'_", ",_", "'", "django", "-", "ny", "t", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ben", "jam", "in", " ", "Bac", "h", "'_", ",_", "'", "django", "-", "ny", "t", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
allegro/ralph/src/ralph/admin/tests/tests_widgets.py
[ { "content": " def test_render(self):\n \"\"\"Test render items.\"\"\"\n rendered_widget = self.widget.render(name='test_perms', value='')\n for value, label in self.choices:\n self.assertTrue(label.split(self.separator)[-1] in rendered_widget)", "metadata": "root.PerimissionsSelectWidgetTest.test_render", "header": "['class', 'PerimissionsSelectWidgetTest', '(', 'SimpleTestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_render_selected_option(self):\n \"\"\"Test selected option.\"\"\"\n rendered_option = self.widget.render_option([1, 2, 3], 1, 'test')\n self.assertTrue('checked' in rendered_option)", "metadata": "root.PerimissionsSelectWidgetTest.test_render_selected_option", "header": "['class', 'PerimissionsSelectWidgetTest', '(', 'SimpleTestCase', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "self.assertTrue(label.split(self.separator)[-1] in rendered_widget)", "start_line": 21, "start_column": 12, "end_line": 21, "end_column": 79 }, { "span": "self.assertTrue('checked' in rendered_option)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 53 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Peri", "missio", "ns", "Select", "Wid", "get", "Test_", "(_", "Simple", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "render", " ", "items", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "ed", "\\u", "widget_", "=_", "self_", "._", "widget_", "._", "render_", "(_", "name_", "=_", "'", "test\\u", "perm", "s", "'_", ",_", "value_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", ",_", "label_", "in_", "self_", "._", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "label_", "._", "split_", "(_", "self_", "._", "separator_", ")_", "[_", "-_", "1_", "]_", "in_", "render", "ed", "\\u", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Peri", "missio", "ns", "Select", "Wid", "get", "Test_", "(_", "Simple", "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", "render", "\\u", "selecte", "d\\u", "option_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "selecte", "d", " ", "option", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "ed", "\\u", "option_", "=_", "self_", "._", "widget_", "._", "render", "\\u", "option_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "1_", ",_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "checke", "d", "'_", "in_", "render", "ed", "\\u", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]