lines
sequencelengths 1
444
| raw_lines
sequencelengths 1
444
| label
sequencelengths 1
444
| type
sequencelengths 1
444
|
---|---|---|---|
[
"def FUNC_8(self, VAR_4, VAR_5, VAR_0, VAR_1):...\n",
""
] | [
"def _parse_sig(self, iden, msg, interface, method):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@app.route('/api/cameras', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_server.cameras()]\n"
] | [
"@app.route('/api/cameras', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_server.cameras()]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"return 'SQLite %s' % sqlite.sqlite_version\n"
] | [
"def dbVersion(self):...\n",
"return 'SQLite %s' % sqlite.sqlite_version\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"from __future__ import unicode_literals, print_function, division\n",
"import contextlib\n",
"import httplib\n",
"import uuid\n",
"from logging import getLogger\n",
"from markupsafe import Markup\n",
"from tornado.escape import xhtml_escape\n",
"from veil.frontend.template import template_utility\n",
"from veil.frontend.web.tornado import *\n",
"VAR_0 = getLogger(__name__)\n",
"@contextlib.contextmanager...\n",
"VAR_3 = get_current_http_request()\n",
"VAR_4 = get_current_http_response()\n",
"if not hasattr(VAR_3, '_xsrf_token'):\n",
"VAR_5 = get_cookie(name='_xsrf', VAR_3=request)\n",
"if 'GET' != VAR_3.method.upper():\n",
"VAR_3.is_new_xsrf_token = False\n",
"VAR_5 = get_http_argument('_xsrf', optional=True) or VAR_3.headers.get('X-XSRF'\n , None)\n",
"VAR_3.arguments.pop('_xsrf', None)\n",
"if not VAR_5:\n",
"if not VAR_5:\n",
"yield\n",
"VAR_3.is_new_xsrf_token = True\n",
"VAR_3._xsrf_token = VAR_5\n",
"VAR_4.status_code = httplib.FORBIDDEN\n",
"VAR_6 = FUNC_2()\n",
"def FUNC_1(VAR_1, VAR_2):...\n",
"VAR_5 = uuid.uuid4().get_hex()\n",
"VAR_0.warn('XSRF token not found: request is %(request)s', {'request': str(\n VAR_3)})\n",
"if VAR_6 != VAR_5:\n",
"if get_current_http_request().is_new_xsrf_token:\n",
"VAR_0.debug('assigned XSRF token: %(token)s from %(method)s %(path)s', {\n 'token': VAR_5, 'method': VAR_3.method, 'path': VAR_3.path})\n",
"VAR_0.warn(\n 'XSRF token invalid: request is %(request)s, expected is %(expected_token)s, actual is %(token)s'\n , {'request': VAR_3, 'expected_token': VAR_6, 'token': VAR_5})\n",
"if VAR_2 and '<html' in VAR_2.lower():\n",
"return VAR_2\n",
"set_cookie(name='_xsrf', value=xsrf_token())\n"
] | [
"from __future__ import unicode_literals, print_function, division\n",
"import contextlib\n",
"import httplib\n",
"import uuid\n",
"from logging import getLogger\n",
"from markupsafe import Markup\n",
"from tornado.escape import xhtml_escape\n",
"from veil.frontend.template import template_utility\n",
"from veil.frontend.web.tornado import *\n",
"LOGGER = getLogger(__name__)\n",
"@contextlib.contextmanager...\n",
"request = get_current_http_request()\n",
"response = get_current_http_response()\n",
"if not hasattr(request, '_xsrf_token'):\n",
"token = get_cookie(name='_xsrf', request=request)\n",
"if 'GET' != request.method.upper():\n",
"request.is_new_xsrf_token = False\n",
"token = get_http_argument('_xsrf', optional=True) or request.headers.get(\n 'X-XSRF', None)\n",
"request.arguments.pop('_xsrf', None)\n",
"if not token:\n",
"if not token:\n",
"yield\n",
"request.is_new_xsrf_token = True\n",
"request._xsrf_token = token\n",
"response.status_code = httplib.FORBIDDEN\n",
"expected_token = xsrf_token()\n",
"def set_xsrf_cookie_for_page(route_handler, data):...\n",
"token = uuid.uuid4().get_hex()\n",
"LOGGER.warn('XSRF token not found: request is %(request)s', {'request': str\n (request)})\n",
"if expected_token != token:\n",
"if get_current_http_request().is_new_xsrf_token:\n",
"LOGGER.debug('assigned XSRF token: %(token)s from %(method)s %(path)s', {\n 'token': token, 'method': request.method, 'path': request.path})\n",
"LOGGER.warn(\n 'XSRF token invalid: request is %(request)s, expected is %(expected_token)s, actual is %(token)s'\n , {'request': request, 'expected_token': expected_token, 'token': token})\n",
"if data and '<html' in data.lower():\n",
"return data\n",
"set_cookie(name='_xsrf', value=xsrf_token())\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Expr'"
] |
[
"\"\"\"string\"\"\"\n",
"import collections as _co\n",
"import bisect as _bs\n",
"import itertools as _iter\n",
"import numpy as _np\n",
"import scipy.sparse as _sparse\n",
"import scipy.sparse.linalg as _sla\n",
"import scipy.linalg as _la\n",
"import scipy as _sp\n",
"from pathpy.Log import Log\n",
"from pathpy.Log import Severity\n",
"\"\"\"string\"\"\"\n",
"\"\"\"string\"\"\"\n",
"def __init__(self, VAR_0, VAR_1=1, VAR_2='-', VAR_3=False, VAR_4=...\n",
"\"\"\"docstring\"\"\"\n",
"assert not VAR_3 or VAR_3 and VAR_1 > 1\n",
"assert VAR_4 == 'FirstOrderTransitions' or VAR_4 == 'KOrderPi', 'Error: unknown method to build null model'\n",
"assert VAR_0.paths.keys() and max(VAR_0.paths.keys()\n ) >= VAR_1, 'Error: constructing a model of order k requires paths of at least length k'\n",
"self.order = VAR_1\n",
"self.paths = VAR_0\n",
"self.nodes = []\n",
"self.separator = VAR_2\n",
"self.successors = _co.defaultdict(lambda : set())\n",
"self.predecessors = _co.defaultdict(lambda : set())\n",
"self.outdegrees = _co.defaultdict(lambda : 0.0)\n",
"self.indegrees = _co.defaultdict(lambda : 0.0)\n",
"self.edges = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"self.inweights = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"self.outweights = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"if VAR_1 > 1:\n",
"VAR_38 = CLASS_1(VAR_0, VAR_1=1)\n",
"if not VAR_3:\n",
"VAR_13 = VAR_38.getAdjacencyMatrix(VAR_10=True, VAR_11=False, VAR_12=True)\n",
"VAR_39 = set()\n",
"VAR_41 = list(VAR_38.edges.keys())\n",
"VAR_40 = VAR_0.paths[VAR_1].items()\n",
"for _ in range(VAR_1 - 1):\n",
"if VAR_1 == 0:\n",
"VAR_48 = list()\n",
"assert (VAR_13 ** VAR_1).sum() == len(VAR_41), 'Expected ' + str((VAR_13 **\n VAR_1).sum()) + ' paths but got ' + str(len(VAR_41))\n",
"VAR_39.add('start')\n",
"for key, val in VAR_40:\n",
"for e1 in VAR_41:\n",
"if VAR_4 == 'KOrderPi':\n",
"for key, val in VAR_40:\n",
"VAR_25 = VAR_2.join(key[0:-1])\n",
"self.nodes = list(VAR_39)\n",
"for e2 in VAR_38.edges:\n",
"VAR_41 = VAR_48\n",
"VAR_49 = CLASS_1(VAR_0, VAR_1=k, VAR_2=separator, VAR_3=False)\n",
"VAR_36 = VAR_38.getTransitionMatrix(VAR_10=True)\n",
"VAR_34 = key[0]\n",
"VAR_34 = VAR_2.join(key[1:])\n",
"if VAR_1 == 0:\n",
"if e1[-1] == e2[0]:\n",
"VAR_50 = CLASS_1.getLeadingEigenvector(VAR_49.getTransitionMatrix(VAR_10=\n True), VAR_14=True, VAR_5=lanczosVecs, VAR_6=maxiter)\n",
"for VAR_56 in VAR_41:\n",
"VAR_39.add(VAR_34)\n",
"VAR_39.add(VAR_25)\n",
"self.dof_paths = self.vcount() - 2\n",
"if VAR_1 == 1:\n",
"VAR_56 = e1 + (e2[1],)\n",
"VAR_25 = VAR_56[0]\n",
"self.edges['start', VAR_34] += val\n",
"VAR_39.add(VAR_34)\n",
"self.dof_ngrams = self.vcount() - 2\n",
"VAR_38 = self\n",
"VAR_42 = VAR_38.vcount()\n",
"VAR_48.append(VAR_56)\n",
"for l in range(1, VAR_1):\n",
"self.successors['start'].add(VAR_34)\n",
"self.edges[VAR_25, VAR_34] += val\n",
"def FUNC_0(self):...\n",
"VAR_13 = VAR_38.getAdjacencyMatrix(VAR_10=True, VAR_11=False, VAR_12=True)\n",
"self.dof_ngrams = VAR_42 ** VAR_1 * (VAR_42 - 1)\n",
"VAR_25 = VAR_25 + VAR_2 + VAR_56[l]\n",
"VAR_34 = VAR_56[1]\n",
"self.predecessors[VAR_34].add('start')\n",
"self.successors[VAR_25].add(VAR_34)\n",
"\"\"\"docstring\"\"\"\n",
"VAR_43 = (VAR_13 ** VAR_1).sum()\n",
"for l in range(2, VAR_1 + 1):\n",
"self.indegrees[VAR_34] = len(self.predecessors[VAR_34])\n",
"self.predecessors[VAR_34].add(VAR_25)\n",
"return len(self.nodes)\n",
"VAR_44 = _np.count_nonzero((VAR_13 ** VAR_1).sum(axis=0))\n",
"VAR_34 = VAR_34 + VAR_2 + VAR_56[l]\n",
"if VAR_25 not in self.nodes:\n",
"self.inweights[VAR_34] += val\n",
"self.indegrees[VAR_34] = len(self.predecessors[VAR_34])\n",
"self.dof_paths = VAR_43 - VAR_44\n",
"self.nodes.append(VAR_25)\n",
"if VAR_34 not in self.nodes:\n",
"self.outdegrees['start'] = len(self.successors['start'])\n",
"self.inweights[VAR_34] += val\n",
"self.nodes.append(VAR_34)\n",
"if VAR_4 == 'KOrderPi':\n",
"self.outweights['start'] += val\n",
"self.outdegrees[VAR_25] = len(self.successors[VAR_25])\n",
"self.edges[VAR_25, VAR_34] = _np.array([0, VAR_50[VAR_49.nodes.index(VAR_34)]])\n",
"if VAR_4 == 'FirstOrderTransitions':\n",
"self.outweights[VAR_25] += val\n",
"self.successors[VAR_25].add(VAR_34)\n",
"VAR_55 = VAR_36[VAR_38.nodes.index(VAR_56[-1]), VAR_38.nodes.index(VAR_56[-2])]\n",
"self.indegrees[VAR_34] = len(self.predecessors[VAR_34])\n",
"self.edges[VAR_25, VAR_34] = _np.array([0, VAR_55])\n",
"self.inweights[VAR_34] += self.edges[VAR_25, VAR_34]\n",
"self.outdegrees[VAR_25] = len(self.successors[VAR_25])\n",
"self.outweights[VAR_25] += self.edges[VAR_25, VAR_34]\n"
] | [
"\"\"\"\n pathpy is an OpenSource python package for the analysis of time series data\n on networks using higher- and multi order graphical models.\n\n Copyright (C) 2016-2017 Ingo Scholtes, ETH Zürich\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU Affero General Public License as published\n by the Free Software Foundation, either version 3 of the License, or\n (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 Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n Contact the developer:\n\n E-mail: [email protected]\n Web: http://www.ingoscholtes.net\n\"\"\"\n",
"import collections as _co\n",
"import bisect as _bs\n",
"import itertools as _iter\n",
"import numpy as _np\n",
"import scipy.sparse as _sparse\n",
"import scipy.sparse.linalg as _sla\n",
"import scipy.linalg as _la\n",
"import scipy as _sp\n",
"from pathpy.Log import Log\n",
"from pathpy.Log import Severity\n",
"\"\"\"\n This exception is thrown whenever a non-empty strongly\n connected component is needed, but we encounter an empty one\n \"\"\"\n",
"\"\"\"\n Instances of this class capture a k-th-order representation\n of path statistics. Path statistics can originate from pathway\n data, temporal networks, or from processes observed on top\n of a network topology.\n \"\"\"\n",
"def __init__(self, paths, k=1, separator='-', nullModel=False, method=...\n",
"\"\"\"docstring\"\"\"\n",
"assert not nullModel or nullModel and k > 1\n",
"assert method == 'FirstOrderTransitions' or method == 'KOrderPi', 'Error: unknown method to build null model'\n",
"assert paths.paths.keys() and max(paths.paths.keys()\n ) >= k, 'Error: constructing a model of order k requires paths of at least length k'\n",
"self.order = k\n",
"self.paths = paths\n",
"self.nodes = []\n",
"self.separator = separator\n",
"self.successors = _co.defaultdict(lambda : set())\n",
"self.predecessors = _co.defaultdict(lambda : set())\n",
"self.outdegrees = _co.defaultdict(lambda : 0.0)\n",
"self.indegrees = _co.defaultdict(lambda : 0.0)\n",
"self.edges = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"self.inweights = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"self.outweights = _co.defaultdict(lambda : _np.array([0.0, 0.0]))\n",
"if k > 1:\n",
"g1 = HigherOrderNetwork(paths, k=1)\n",
"if not nullModel:\n",
"A = g1.getAdjacencyMatrix(includeSubPaths=True, weighted=False, transposed=True\n )\n",
"node_set = set()\n",
"possiblePaths = list(g1.edges.keys())\n",
"iterator = paths.paths[k].items()\n",
"for _ in range(k - 1):\n",
"if k == 0:\n",
"E_new = list()\n",
"assert (A ** k).sum() == len(possiblePaths), 'Expected ' + str((A ** k).sum()\n ) + ' paths but got ' + str(len(possiblePaths))\n",
"node_set.add('start')\n",
"for key, val in iterator:\n",
"for e1 in possiblePaths:\n",
"if method == 'KOrderPi':\n",
"for key, val in iterator:\n",
"v = separator.join(key[0:-1])\n",
"self.nodes = list(node_set)\n",
"for e2 in g1.edges:\n",
"possiblePaths = E_new\n",
"g_k = HigherOrderNetwork(paths, k=k, separator=separator, nullModel=False)\n",
"T = g1.getTransitionMatrix(includeSubPaths=True)\n",
"w = key[0]\n",
"w = separator.join(key[1:])\n",
"if k == 0:\n",
"if e1[-1] == e2[0]:\n",
"pi_k = HigherOrderNetwork.getLeadingEigenvector(g_k.getTransitionMatrix(\n includeSubPaths=True), normalized=True, lanczosVecs=lanczosVecs,\n maxiter=maxiter)\n",
"for p in possiblePaths:\n",
"node_set.add(w)\n",
"node_set.add(v)\n",
"self.dof_paths = self.vcount() - 2\n",
"if k == 1:\n",
"p = e1 + (e2[1],)\n",
"v = p[0]\n",
"self.edges['start', w] += val\n",
"node_set.add(w)\n",
"self.dof_ngrams = self.vcount() - 2\n",
"g1 = self\n",
"s = g1.vcount()\n",
"E_new.append(p)\n",
"for l in range(1, k):\n",
"self.successors['start'].add(w)\n",
"self.edges[v, w] += val\n",
"def vcount(self):...\n",
"A = g1.getAdjacencyMatrix(includeSubPaths=True, weighted=False, transposed=True\n )\n",
"self.dof_ngrams = s ** k * (s - 1)\n",
"v = v + separator + p[l]\n",
"w = p[1]\n",
"self.predecessors[w].add('start')\n",
"self.successors[v].add(w)\n",
"\"\"\"docstring\"\"\"\n",
"paths_k = (A ** k).sum()\n",
"for l in range(2, k + 1):\n",
"self.indegrees[w] = len(self.predecessors[w])\n",
"self.predecessors[w].add(v)\n",
"return len(self.nodes)\n",
"non_zero = _np.count_nonzero((A ** k).sum(axis=0))\n",
"w = w + separator + p[l]\n",
"if v not in self.nodes:\n",
"self.inweights[w] += val\n",
"self.indegrees[w] = len(self.predecessors[w])\n",
"self.dof_paths = paths_k - non_zero\n",
"self.nodes.append(v)\n",
"if w not in self.nodes:\n",
"self.outdegrees['start'] = len(self.successors['start'])\n",
"self.inweights[w] += val\n",
"self.nodes.append(w)\n",
"if method == 'KOrderPi':\n",
"self.outweights['start'] += val\n",
"self.outdegrees[v] = len(self.successors[v])\n",
"self.edges[v, w] = _np.array([0, pi_k[g_k.nodes.index(w)]])\n",
"if method == 'FirstOrderTransitions':\n",
"self.outweights[v] += val\n",
"self.successors[v].add(w)\n",
"p_vw = T[g1.nodes.index(p[-1]), g1.nodes.index(p[-2])]\n",
"self.indegrees[w] = len(self.predecessors[w])\n",
"self.edges[v, w] = _np.array([0, p_vw])\n",
"self.inweights[w] += self.edges[v, w]\n",
"self.outdegrees[v] = len(self.successors[v])\n",
"self.outweights[v] += self.edges[v, w]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Expr'",
"Condition",
"Docstring",
"Assert'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assert'",
"Expr'",
"For",
"For",
"Condition",
"For",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"AugAssign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"AugAssign'",
"Expr'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"Assign'",
"AugAssign'"
] |
[
"def FUNC_13(self, VAR_16):...\n",
"return True\n"
] | [
"def does_intersect_rule(self, rulectx):...\n",
"return True\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_7, VAR_20=True, *VAR_15, **VAR_16):...\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n",
"self.redirect = VAR_20\n"
] | [
"def __init__(self, param, redirect=True, *a, **kw):...\n",
"Validator.__init__(self, param, *a, **kw)\n",
"self.redirect = redirect\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"self.lasttok = VAR_3.type\n",
"return VAR_3\n"
] | [
"def t_RPAR(self, tok):...\n",
"\"\"\"docstring\"\"\"\n",
"self.lasttok = tok.type\n",
"return tok\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/regions/<region_id>', methods=['GET'])...\n",
"return get_by_id('regions', VAR_2)\n"
] | [
"@locations.route('/regions/<region_id>', methods=['GET'])...\n",
"return get_by_id('regions', region_id)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_20(VAR_6):...\n",
"return FUNC_7(VAR_6, 'X-Frame-Options', 'DENY')\n"
] | [
"def validate_clickjacking_protection(page):...\n",
"return validate_security_header(page, 'X-Frame-Options', 'DENY')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_40(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 5}, 'CONFIDENCE': {'HIGH': 5}}\n",
"self.check_example('utils-shell.py', VAR_2)\n"
] | [
"def test_utils_shell(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 5}, 'CONFIDENCE': {'HIGH': 5}}\n",
"self.check_example('utils-shell.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_1 = self.c.get('/find/?q=avcat')\n",
"self.assertContains(VAR_1, 'stub_1845')\n"
] | [
"def test_faceted_search_returns_upc(self):...\n",
"response = self.c.get('/find/?q=avcat')\n",
"self.assertContains(response, 'stub_1845')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._workspace\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._workspace\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_15(self, VAR_34):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_34 = get_filter(self.doctype, VAR_34)\n",
"VAR_53 = '`tab' + VAR_34.doctype + '`'\n",
"if not VAR_53 in self.tables:\n",
"self.append_table(VAR_53)\n",
"if 'ifnull(' in VAR_34.fieldname:\n",
"VAR_60 = VAR_34.fieldname\n",
"VAR_60 = '{tname}.{fname}'.format(VAR_53=tname, fname=f.fieldname)\n",
"VAR_54 = True\n",
"if VAR_34.operator.lower() in ('in', 'not in'):\n",
"VAR_61 = VAR_34.value or ''\n",
"VAR_6 = frappe.get_meta(VAR_34.doctype).get('fields', {'fieldname': VAR_34.\n fieldname})\n",
"if not isinstance(VAR_61, (list, tuple)):\n",
"VAR_6 = VAR_6[0] if VAR_6 else None\n",
"VAR_61 = VAR_61.split(',')\n",
"VAR_62 = \"''\"\n",
"if VAR_6 and VAR_6.fieldtype in ('Check', 'Float', 'Int', 'Currency', 'Percent'\n",
"VAR_5 = (frappe.db.escape((v or '').strip(), percent=False) for v in VAR_61)\n",
"VAR_54 = False\n",
"if VAR_34.operator.lower() == 'between' and (VAR_34.fieldname in (\n",
"VAR_5 = '(\"{0}\")'.format('\", \"'.join(VAR_5))\n",
"VAR_5 = FUNC_3(VAR_34.value, VAR_6)\n",
"if VAR_6 and VAR_6.fieldtype == 'Date':\n",
"if self.ignore_ifnull or not VAR_54 or VAR_34.value and VAR_34.operator.lower(\n",
"VAR_62 = \"'0000-00-00 00:00:00'\"\n",
"VAR_5 = getdate(VAR_34.value).strftime('%Y-%m-%d')\n",
"if VAR_6 and VAR_6.fieldtype == 'Datetime' or isinstance(VAR_34.value, datetime\n",
"VAR_63 = '{column_name} {operator} {value}'.format(VAR_60=column_name,\n operator=f.operator, VAR_5=value)\n",
"VAR_63 = 'ifnull({column_name}, {fallback}) {operator} {value}'.format(VAR_60\n =column_name, VAR_62=fallback, operator=f.operator, VAR_5=value)\n",
"if isinstance(VAR_5, string_types) and not VAR_34.operator.lower(\n",
"VAR_62 = \"'0000-00-00'\"\n",
"VAR_5 = get_datetime(VAR_34.value).strftime('%Y-%m-%d %H:%M:%S.%f')\n",
"if VAR_6 and VAR_6.fieldtype == 'Time':\n",
"return VAR_63\n",
"VAR_5 = '\"{0}\"'.format(frappe.db.escape(VAR_5, percent=False))\n",
"VAR_62 = \"'0000-00-00 00:00:00'\"\n",
"VAR_5 = get_time(VAR_34.value).strftime('%H:%M:%S.%f')\n",
"if VAR_34.operator.lower() in ('like', 'not like') or isinstance(VAR_34.\n",
"VAR_62 = \"'00:00:00'\"\n",
"VAR_5 = '' if VAR_34.value == None else VAR_34.value\n",
"VAR_5 = VAR_73(VAR_34.value)\n",
"VAR_62 = '\"\"'\n",
"VAR_62 = 0\n",
"if VAR_34.operator.lower() in ('like', 'not like') and isinstance(VAR_5,\n",
"VAR_5 = VAR_5.replace('\\\\', '\\\\\\\\').replace('%', '%%')\n"
] | [
"def prepare_filter_condition(self, f):...\n",
"\"\"\"docstring\"\"\"\n",
"f = get_filter(self.doctype, f)\n",
"tname = '`tab' + f.doctype + '`'\n",
"if not tname in self.tables:\n",
"self.append_table(tname)\n",
"if 'ifnull(' in f.fieldname:\n",
"column_name = f.fieldname\n",
"column_name = '{tname}.{fname}'.format(tname=tname, fname=f.fieldname)\n",
"can_be_null = True\n",
"if f.operator.lower() in ('in', 'not in'):\n",
"values = f.value or ''\n",
"df = frappe.get_meta(f.doctype).get('fields', {'fieldname': f.fieldname})\n",
"if not isinstance(values, (list, tuple)):\n",
"df = df[0] if df else None\n",
"values = values.split(',')\n",
"fallback = \"''\"\n",
"if df and df.fieldtype in ('Check', 'Float', 'Int', 'Currency', 'Percent'):\n",
"value = (frappe.db.escape((v or '').strip(), percent=False) for v in values)\n",
"can_be_null = False\n",
"if f.operator.lower() == 'between' and (f.fieldname in ('creation',\n",
"value = '(\"{0}\")'.format('\", \"'.join(value))\n",
"value = get_between_date_filter(f.value, df)\n",
"if df and df.fieldtype == 'Date':\n",
"if self.ignore_ifnull or not can_be_null or f.value and f.operator.lower() in (\n",
"fallback = \"'0000-00-00 00:00:00'\"\n",
"value = getdate(f.value).strftime('%Y-%m-%d')\n",
"if df and df.fieldtype == 'Datetime' or isinstance(f.value, datetime):\n",
"condition = '{column_name} {operator} {value}'.format(column_name=\n column_name, operator=f.operator, value=value)\n",
"condition = 'ifnull({column_name}, {fallback}) {operator} {value}'.format(\n column_name=column_name, fallback=fallback, operator=f.operator, value=\n value)\n",
"if isinstance(value, string_types) and not f.operator.lower() == 'between':\n",
"fallback = \"'0000-00-00'\"\n",
"value = get_datetime(f.value).strftime('%Y-%m-%d %H:%M:%S.%f')\n",
"if df and df.fieldtype == 'Time':\n",
"return condition\n",
"value = '\"{0}\"'.format(frappe.db.escape(value, percent=False))\n",
"fallback = \"'0000-00-00 00:00:00'\"\n",
"value = get_time(f.value).strftime('%H:%M:%S.%f')\n",
"if f.operator.lower() in ('like', 'not like') or isinstance(f.value,\n",
"fallback = \"'00:00:00'\"\n",
"value = '' if f.value == None else f.value\n",
"value = flt(f.value)\n",
"fallback = '\"\"'\n",
"fallback = 0\n",
"if f.operator.lower() in ('like', 'not like') and isinstance(value,\n",
"value = value.replace('\\\\', '\\\\\\\\').replace('%', '%%')\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"TestBase.setUp(self)\n",
"self.app = webtest.TestApp(app)\n"
] | [
"def setUp(self):...\n",
"TestBase.setUp(self)\n",
"self.app = webtest.TestApp(app)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(VAR_4, VAR_5):...\n",
"VAR_37 = 'preview-{}'.format(VAR_4)\n",
"import zlib\n",
"return 'preview-' + str(zlib.crc32(VAR_37.encode('utf-8'), 65535)\n ) + '.' + VAR_5\n"
] | [
"def preview_file(identifier, extension):...\n",
"file_identifier = 'preview-{}'.format(identifier)\n",
"import zlib\n",
"return 'preview-' + str(zlib.crc32(file_identifier.encode('utf-8'), 65535)\n ) + '.' + extension\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Import'",
"Return'"
] |
[
"from flask import Blueprint, request, make_response, jsonify\n",
"from flask.views import MethodView\n",
"from ...models import Table\n",
"from ....utils import jwt_required, encode_auth_token\n",
"VAR_0 = Blueprint('auth', __name__)\n",
"\"\"\"\n User Signup API Resource\n \"\"\"\n",
"def FUNC_0(self):...\n",
"VAR_6 = request.get_json(force=True)\n",
"VAR_7 = Table.filter_by(VAR_6.get('email'))\n",
"if not VAR_7:\n",
"VAR_8 = {'status': 'fail', 'message': 'User already exists. Please Log in.'}\n",
"VAR_7 = Table.save(data=post_data)\n",
"print(e)\n",
"def FUNC_1(self, VAR_5=None):...\n",
"return make_response(jsonify(VAR_8)), 202\n",
"VAR_10 = encode_auth_token(VAR_7.get('id')).decode()\n",
"VAR_8 = {'status': 'fail', 'message': 'Some error occurred. Please try again.'}\n",
"VAR_6 = request.get_json(force=True)\n",
"VAR_8 = {'status': 'success', 'message': 'Successfully registered.', 'id':\n VAR_7.get('id'), 'auth_token': VAR_10}\n",
"return make_response(jsonify(VAR_8)), 401\n",
"Table.delete(VAR_5, VAR_6)\n",
"return make_response(jsonify(VAR_8)), 201\n",
"VAR_8 = {'status': 'success', 'message': 'User deleted successfully.'}\n",
"return make_response(jsonify(VAR_8)), 200\n"
] | [
"from flask import Blueprint, request, make_response, jsonify\n",
"from flask.views import MethodView\n",
"from ...models import Table\n",
"from ....utils import jwt_required, encode_auth_token\n",
"auth_blueprint = Blueprint('auth', __name__)\n",
"\"\"\"\n User Signup API Resource\n \"\"\"\n",
"def post(self):...\n",
"post_data = request.get_json(force=True)\n",
"user = Table.filter_by(post_data.get('email'))\n",
"if not user:\n",
"response_object = {'status': 'fail', 'message':\n 'User already exists. Please Log in.'}\n",
"user = Table.save(data=post_data)\n",
"print(e)\n",
"def delete(self, user_id=None):...\n",
"return make_response(jsonify(response_object)), 202\n",
"auth_token = encode_auth_token(user.get('id')).decode()\n",
"response_object = {'status': 'fail', 'message':\n 'Some error occurred. Please try again.'}\n",
"post_data = request.get_json(force=True)\n",
"response_object = {'status': 'success', 'message':\n 'Successfully registered.', 'id': user.get('id'), 'auth_token': auth_token}\n",
"return make_response(jsonify(response_object)), 401\n",
"Table.delete(user_id, post_data)\n",
"return make_response(jsonify(response_object)), 201\n",
"response_object = {'status': 'success', 'message': 'User deleted successfully.'\n }\n",
"return make_response(jsonify(response_object)), 200\n"
] | [
4,
0,
0,
0,
0,
4,
0,
4,
4,
0,
4,
4,
4,
0,
0,
0,
4,
0,
4,
0,
4,
0,
4,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_1 = 'cmd'\n",
"self.assertEqual(escape_path_argument('C:\\\\Windows\\\\has-a-weird-shell.txt',\n VAR_1), '\"C:\\\\Windows\\\\has-a-weird-shell.txt\"')\n",
"self.assertEqual(escape_path_argument('C:\\\\Windows\\\\lolrofl\\\\dirs\\\\', VAR_1\n ), '\"C:\\\\Windows\\\\lolrofl\\\\dirs\\\\\"')\n",
"self.assertEqual(escape_path_argument('X:\\\\Users\\\\Maito Gai\\\\fi le.exe',\n VAR_1), '\"X:\\\\Users\\\\Maito Gai\\\\fi le.exe\"')\n",
"self.assertEqual(escape_path_argument('X:\\\\Users\\\\Mai to Gai\\\\director y\\\\',\n VAR_1), '\"X:\\\\Users\\\\Mai to Gai\\\\director y\\\\\"')\n",
"self.assertEqual(escape_path_argument(\n 'X:\\\\Users\\\\Maito Gai\\\\\"seven-gates\".y', VAR_1),\n '\"X:\\\\Users\\\\Maito Gai\\\\^\"seven-gates^\".y\"')\n",
"self.assertEqual(escape_path_argument('System32\\\\my-custom relative tool\\\\',\n VAR_1), '\"System32\\\\my-custom relative tool\\\\\"')\n",
"self.assertEqual(escape_path_argument('System32\\\\illegal\" name \"\".curd',\n VAR_1), '\"System32\\\\illegal^\" name ^\"^\".curd\"')\n"
] | [
"def test_escape_path_argument_cmd(self):...\n",
"_type = 'cmd'\n",
"self.assertEqual(escape_path_argument('C:\\\\Windows\\\\has-a-weird-shell.txt',\n _type), '\"C:\\\\Windows\\\\has-a-weird-shell.txt\"')\n",
"self.assertEqual(escape_path_argument('C:\\\\Windows\\\\lolrofl\\\\dirs\\\\', _type\n ), '\"C:\\\\Windows\\\\lolrofl\\\\dirs\\\\\"')\n",
"self.assertEqual(escape_path_argument('X:\\\\Users\\\\Maito Gai\\\\fi le.exe',\n _type), '\"X:\\\\Users\\\\Maito Gai\\\\fi le.exe\"')\n",
"self.assertEqual(escape_path_argument('X:\\\\Users\\\\Mai to Gai\\\\director y\\\\',\n _type), '\"X:\\\\Users\\\\Mai to Gai\\\\director y\\\\\"')\n",
"self.assertEqual(escape_path_argument(\n 'X:\\\\Users\\\\Maito Gai\\\\\"seven-gates\".y', _type),\n '\"X:\\\\Users\\\\Maito Gai\\\\^\"seven-gates^\".y\"')\n",
"self.assertEqual(escape_path_argument('System32\\\\my-custom relative tool\\\\',\n _type), '\"System32\\\\my-custom relative tool\\\\\"')\n",
"self.assertEqual(escape_path_argument('System32\\\\illegal\" name \"\".curd',\n _type), '\"System32\\\\illegal^\" name ^\"^\".curd\"')\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_6, VAR_4):...\n",
"VAR_8 = VAR_4.connect()\n",
"VAR_9 = VAR_8.cursor()\n",
"VAR_12 = 'string'.format(VAR_6)\n",
"VAR_9.execute(VAR_12)\n",
"VAR_13 = VAR_9.fetchone()\n",
"return VAR_13\n"
] | [
"def getCalendarDetails(id, sqlInstance):...\n",
"conn = sqlInstance.connect()\n",
"cursor = conn.cursor()\n",
"getCalendarDetails = (\n \"SELECT Calendars.calendarId, Calendars.name, Calendars.day, Users.userEmail FROM Calendars, Users WHERE Calendars.userId = Users.userId AND Calendars.calendarId = '{0}'\"\n .format(id))\n",
"cursor.execute(getCalendarDetails)\n",
"result = cursor.fetchone()\n",
"return result\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self, VAR_3=0, VAR_4='Incomplete', VAR_5='Incomplete'):...\n",
"self.result_data.update({'aux_output': '', 'data_diff': None,\n 'debugger_output': '', 'detected_errors': None, 'dut_output': '',\n 'num_injections': VAR_3, 'outcome_category': VAR_4, 'outcome': VAR_5,\n 'timestamp': None})\n",
"if 'id' in self.result_data:\n",
"db.insert_dict('result', self.result_data)\n",
"self.result_data['id'] = db.cursor.lastrowid\n",
"db.insert_dict('injection', {'result_id': self.result_data['id'],\n 'injection_number': 0})\n"
] | [
"def create_result(self, num_injections=0, outcome_category='Incomplete',...\n",
"self.result_data.update({'aux_output': '', 'data_diff': None,\n 'debugger_output': '', 'detected_errors': None, 'dut_output': '',\n 'num_injections': num_injections, 'outcome_category': outcome_category,\n 'outcome': outcome, 'timestamp': None})\n",
"if 'id' in self.result_data:\n",
"db.insert_dict('result', self.result_data)\n",
"self.result_data['id'] = db.cursor.lastrowid\n",
"db.insert_dict('injection', {'result_id': self.result_data['id'],\n 'injection_number': 0})\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"if FUNC_12(VAR_16, 'temp'):\n",
"return VAR_19(VAR_16, 'protected')\n"
] | [
"def protected(value):...\n",
"\"\"\"docstring\"\"\"\n",
"if is_flagged(value, 'temp'):\n",
"return flag(value, 'protected')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'"
] |
[
"def FUNC_5(VAR_3, VAR_10, VAR_2):...\n",
"if '%(key)s' in VAR_3:\n",
"VAR_3 = VAR_3.replace('%(key)s', VAR_10)\n",
"if '%s' in VAR_3:\n",
"VAR_3 = VAR_3.replace('%s', (VAR_2 or '') + '%')\n",
"return VAR_3\n"
] | [
"def scrub_custom_query(query, key, txt):...\n",
"if '%(key)s' in query:\n",
"query = query.replace('%(key)s', key)\n",
"if '%s' in query:\n",
"query = query.replace('%s', (txt or '') + '%')\n",
"return query\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_9(self, VAR_0):...\n",
"if not cint(self.published):\n",
"VAR_0.full_name = get_fullname(self.owner)\n",
"VAR_0.updated = global_date_format(self.published_on)\n",
"if self.blogger:\n",
"VAR_0.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n",
"VAR_0.description = self.blog_intro or self.content[:140]\n",
"VAR_0.metatags = {'name': self.title, 'description': VAR_0.description}\n",
"if '<!-- markdown -->' in VAR_0.content:\n",
"VAR_0.content = markdown(VAR_0.content)\n",
"VAR_14 = find_first_image(self.content)\n",
"if VAR_14:\n",
"VAR_0.metatags['image'] = VAR_14\n",
"VAR_0.comment_list = get_comment_list(self.doctype, self.name)\n",
"if not VAR_0.comment_list:\n",
"VAR_0.comment_text = _('No comments yet')\n",
"if len(VAR_0.comment_list) == 1:\n",
"VAR_0.category = frappe.db.get_value('Blog Category', VAR_0.doc.\n blog_category, ['title', 'route'], as_dict=1)\n",
"VAR_0.comment_text = _('1 comment')\n",
"VAR_0.comment_text = _('{0} comments').format(len(VAR_0.comment_list))\n",
"VAR_0.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}, {'label': VAR_0.category.title, 'route': VAR_0.\n category.route}]\n"
] | [
"def get_context(self, context):...\n",
"if not cint(self.published):\n",
"context.full_name = get_fullname(self.owner)\n",
"context.updated = global_date_format(self.published_on)\n",
"if self.blogger:\n",
"context.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n",
"context.description = self.blog_intro or self.content[:140]\n",
"context.metatags = {'name': self.title, 'description': context.description}\n",
"if '<!-- markdown -->' in context.content:\n",
"context.content = markdown(context.content)\n",
"image = find_first_image(self.content)\n",
"if image:\n",
"context.metatags['image'] = image\n",
"context.comment_list = get_comment_list(self.doctype, self.name)\n",
"if not context.comment_list:\n",
"context.comment_text = _('No comments yet')\n",
"if len(context.comment_list) == 1:\n",
"context.category = frappe.db.get_value('Blog Category', context.doc.\n blog_category, ['title', 'route'], as_dict=1)\n",
"context.comment_text = _('1 comment')\n",
"context.comment_text = _('{0} comments').format(len(context.comment_list))\n",
"context.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}, {'label': context.category.title, 'route': context.\n category.route}]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_14(self, VAR_17, VAR_18, VAR_19, VAR_20):...\n",
"if 'memory_mapped' in self.targets[VAR_18] and self.targets[VAR_18][\n",
"VAR_10 = 'mm'\n",
"self.command('rm ' + VAR_17 + ' ' + VAR_20, VAR_11=\n 'Error setting register value')\n",
"if 'bits' in self.targets[VAR_18]['registers'][VAR_17]:\n",
"VAR_43 = self.targets[VAR_18]['registers'][VAR_17]['bits']\n",
"VAR_37 = self.targets[VAR_18]['base'][VAR_19] + self.targets[VAR_18][\n 'registers'][VAR_17]['offset']\n",
"if VAR_43 == 8:\n",
"self.command(VAR_10 + ' ' + hex(VAR_37) + ' ' + VAR_20 + ' 1', VAR_11=\n 'Error getting register value')\n",
"VAR_10 += 'b'\n",
"if VAR_43 == 16:\n",
"VAR_10 += 'h'\n",
"if VAR_43 == 64:\n",
"VAR_10 += 'd'\n"
] | [
"def set_register_value(self, register, target, target_index, value):...\n",
"if 'memory_mapped' in self.targets[target] and self.targets[target][\n",
"command = 'mm'\n",
"self.command('rm ' + register + ' ' + value, error_message=\n 'Error setting register value')\n",
"if 'bits' in self.targets[target]['registers'][register]:\n",
"bits = self.targets[target]['registers'][register]['bits']\n",
"address = self.targets[target]['base'][target_index] + self.targets[target][\n 'registers'][register]['offset']\n",
"if bits == 8:\n",
"self.command(command + ' ' + hex(address) + ' ' + value + ' 1',\n error_message='Error getting register value')\n",
"command += 'b'\n",
"if bits == 16:\n",
"command += 'h'\n",
"if bits == 64:\n",
"command += 'd'\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'"
] |
[
"def FUNC_0(self):...\n",
"from cores.xeger import Xeger\n",
"VAR_4 = Xeger()\n",
"while True:\n",
"VAR_5 = VAR_4.xeger(\n \"\"\"((\\\\%3C)|<)((\\\\%69)|i|(\\\\%49))((\\\\%6D)|m|(\\\\%4D))((\\\\%67)|g|(\\\\%47))[^\n]+((\\\\%3E)|>)\"\"\"\n )\n",
"if any(x in VAR_5 for x in '\"\\'><;/'):\n",
"return VAR_5\n"
] | [
"def gen_payload(self):...\n",
"from cores.xeger import Xeger\n",
"generate = Xeger()\n",
"while True:\n",
"_payload = generate.xeger(\n \"\"\"((\\\\%3C)|<)((\\\\%69)|i|(\\\\%49))((\\\\%6D)|m|(\\\\%4D))((\\\\%67)|g|(\\\\%47))[^\n]+((\\\\%3E)|>)\"\"\"\n )\n",
"if any(x in _payload for x in '\"\\'><;/'):\n",
"return _payload\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Condition",
"Assign'",
"For",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import random\n",
"import hashlib\n",
"from urlparse import urlparse\n",
"from decorator import decorator\n",
"from pylons import session, request, config\n",
"from pylons.controllers.util import abort\n",
"from pylons.i18n import _\n",
"def FUNC_0(VAR_0=['POST', 'GET', 'PUT', 'DELETE']):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_5(VAR_1, *VAR_2, **VAR_3):...\n",
"def FUNC_6():...\n",
"if not request.method in VAR_0:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"VAR_7 = urlparse(request.environ.get('HTTP_REFERER'))\n",
"if request.method == 'GET' and FUNC_4():\n",
"VAR_8 = VAR_7.hostname\n",
"return True\n",
"return False\n",
"if VAR_7.port:\n",
"VAR_8 += ':' + str(VAR_7.port)\n",
"if VAR_8.endswith(request.environ['adhocracy.domain']):\n",
"if request.method != 'GET':\n",
"return True\n"
] | [
"\"\"\"\nXSRF is Cross-Site Request Forgery, where an attacker has a user follow a link that triggers an \naction on a site which the user did not intentionally want to perform (i.e. vote in \na certain way). To prevent this, some actions are only possible if authorized via HTTP or if a\nmodtoken - a shared SHA1 hash - is included. \n\"\"\"\n",
"import random\n",
"import hashlib\n",
"from urlparse import urlparse\n",
"from decorator import decorator\n",
"from pylons import session, request, config\n",
"from pylons.controllers.util import abort\n",
"from pylons.i18n import _\n",
"def RequireInternalRequest(methods=['POST', 'GET', 'PUT', 'DELETE']):...\n",
"\"\"\"docstring\"\"\"\n",
"def _decorate(f, *a, **kw):...\n",
"def check():...\n",
"if not request.method in methods:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"ref_url = urlparse(request.environ.get('HTTP_REFERER'))\n",
"if request.method == 'GET' and has_token():\n",
"ref_host = ref_url.hostname\n",
"return True\n",
"return False\n",
"if ref_url.port:\n",
"ref_host += ':' + str(ref_url.port)\n",
"if ref_host.endswith(request.environ['adhocracy.domain']):\n",
"if request.method != 'GET':\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"Expr'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"FunctionDef'",
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = '/api/keys'\n",
"VAR_5 = {'id': 'autotest', 'public': 'string'}\n",
"VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_6.status_code, 201)\n",
"VAR_8 = Key.objects.get(uuid=response.data['uuid'])\n",
"self.assertEqual(str(VAR_8),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN [email protected]')\n"
] | [
"def test_rsa_key_str(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/keys'\n",
"body = {'id': 'autotest', 'public':\n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzqPAwHN70xsB0LXG//KzOgcPikyhdN/KRc4x3j/RA0pmFj63Ywv0PJ2b1LcMSqfR8F11WBlrW8c9xFua0ZAKzI+gEk5uqvOR78bs/SITOtKPomW4e/1d2xEkJqOmYH30u94+NZZYwEBqYaRb34fhtrnJS70XeGF0RhXE5Qea5eh7DBbeLxPfSYd8rfHgzMSb/wmx3h2vmHdQGho20pfJktNu7DxeVkTHn9REMUphf85su7slTgTlWKq++3fASE8PdmFGzb6PkOR4c+LS5WWXd2oM6HyBQBxxiwXbA2lSgQxOdgDiM2FzT0GVSFMUklkUHMdsaG6/HJDw9QckTS0vN [email protected]'\n }\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"key = Key.objects.get(uuid=response.data['uuid'])\n",
"self.assertEqual(str(key),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN [email protected]')\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(self, VAR_2, VAR_1=None):...\n",
"VAR_20 = VAR_2.split('/')\n",
"if len(VAR_20) > 1:\n",
"VAR_30 = ipaddress.ip_network(VAR_2, strict=False)\n",
"VAR_30 = ipaddress.ip_address(VAR_2)\n",
"VAR_31 = VAR_30.network_address\n",
"self.filter_string = '{0} = {1}'.format(self.name, int(VAR_30))\n",
"VAR_32 = VAR_30.broadcast_address\n",
"return self.filter_string\n",
"self.filter_string = '({0} > {1} AND {0} < {2})'.format(self.name, int(\n VAR_31), int(VAR_32))\n"
] | [
"def filter(self, value, op=None):...\n",
"s = value.split('/')\n",
"if len(s) > 1:\n",
"ip = ipaddress.ip_network(value, strict=False)\n",
"ip = ipaddress.ip_address(value)\n",
"start_ip = ip.network_address\n",
"self.filter_string = '{0} = {1}'.format(self.name, int(ip))\n",
"end_ip = ip.broadcast_address\n",
"return self.filter_string\n",
"self.filter_string = '({0} > {1} AND {0} < {2})'.format(self.name, int(\n start_ip), int(end_ip))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_17(self, VAR_14):...\n",
""
] | [
"def is_relation(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_27(self, VAR_43, VAR_44):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_63 = self.getfile(VAR_43)\n",
"if VAR_63 == False:\n",
"VAR_64 = self.getfile(VAR_44)\n",
"if VAR_64 != False:\n",
"self.get_path(os.path.dirname(VAR_43)).remove(VAR_63)\n",
"VAR_63[VAR_1] = os.path.basename(VAR_44)\n",
"self.get_path(os.path.dirname(VAR_44)).append(VAR_63)\n",
"return\n"
] | [
"def rename(self, oldpath, newpath):...\n",
"\"\"\"docstring\"\"\"\n",
"old = self.getfile(oldpath)\n",
"if old == False:\n",
"new = self.getfile(newpath)\n",
"if new != False:\n",
"self.get_path(os.path.dirname(oldpath)).remove(old)\n",
"old[A_NAME] = os.path.basename(newpath)\n",
"self.get_path(os.path.dirname(newpath)).append(old)\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2():...\n",
""
] | [
"def main():...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"async def FUNC_2(self) ->None:...\n",
"VAR_7 = await as_future(session.query(database.Paste).filter(database.Paste\n .removal_id == self.get_body_argument('removal_id')).first)\n",
"if not VAR_7:\n",
"self.set_status(400)\n",
"session.delete(VAR_7)\n",
"return\n",
"session.commit()\n",
"self.set_header('Content-Type', 'application/json')\n",
"self.write(json.dumps([{'paste_id': VAR_7.paste_id, 'status': 'removed'}]))\n"
] | [
"async def post(self) ->None:...\n",
"paste = await as_future(session.query(database.Paste).filter(database.Paste\n .removal_id == self.get_body_argument('removal_id')).first)\n",
"if not paste:\n",
"self.set_status(400)\n",
"session.delete(paste)\n",
"return\n",
"session.commit()\n",
"self.set_header('Content-Type', 'application/json')\n",
"self.write(json.dumps([{'paste_id': paste.paste_id, 'status': 'removed'}]))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self, VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_31 = VAR_12,\n",
"self.cursor.execute('insert into lists (listhash) values (?)', VAR_31)\n",
"self.connection.commit()\n",
"VAR_30 = self.cursor.execute(\n 'select listid, listhash from lists where listhash = \"%s\"' % VAR_12\n ).fetchall()[0]\n",
"return VAR_30\n"
] | [
"def add_shoppinglist(self, slist):...\n",
"\"\"\"docstring\"\"\"\n",
"t = slist,\n",
"self.cursor.execute('insert into lists (listhash) values (?)', t)\n",
"self.connection.commit()\n",
"r = self.cursor.execute(\n 'select listid, listhash from lists where listhash = \"%s\"' % slist\n ).fetchall()[0]\n",
"return r\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_18(self):...\n",
"VAR_13 = ['Line1 passed', 'Line1 failed']\n",
"VAR_14 = ['Line1', 'Line2']\n",
"VAR_15 = [' passed', None]\n",
"self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[0]), VAR_15[0])\n",
"self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[1]), VAR_15[1])\n"
] | [
"def test_get_prefixed_value(self):...\n",
"lines = ['Line1 passed', 'Line1 failed']\n",
"prefix = ['Line1', 'Line2']\n",
"expected_output = [' passed', None]\n",
"self.assertEqual(self.driver._get_prefixed_value(lines, prefix[0]),\n expected_output[0])\n",
"self.assertEqual(self.driver._get_prefixed_value(lines, prefix[1]),\n expected_output[1])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_9 = get_object_or_404(Hunt, id=pk)\n",
"VAR_9.stop()\n",
"VAR_9.delete()\n",
"return redirect('twitter_hunter:index')\n"
] | [
"def hunt_del(request, pk):...\n",
"hunt = get_object_or_404(Hunt, id=pk)\n",
"hunt.stop()\n",
"hunt.delete()\n",
"return redirect('twitter_hunter:index')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_31(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 7}, 'CONFIDENCE': {'HIGH': 7}}\n",
"self.check_example('popen_wrappers.py', VAR_2)\n"
] | [
"def test_popen_wrappers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 7}, 'CONFIDENCE': {'HIGH': 7}}\n",
"self.check_example('popen_wrappers.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"self.run_test_case(self.scenario.disable_server_group())\n"
] | [
"def test_e_disable_server_group(self):...\n",
"self.run_test_case(self.scenario.disable_server_group())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(VAR_3, VAR_4):...\n",
"VAR_14 = {}\n",
"for VAR_24, group in enumerate(VAR_3):\n",
"for VAR_25 in group:\n",
"VAR_15 = [[(0) for _ in range(len(VAR_3))] for _ in range(len(VAR_3))]\n",
"VAR_14[VAR_25] = VAR_24\n",
"for tweet in VAR_4:\n",
"if tweet[0] in VAR_14 and tweet[1] in VAR_14:\n",
"return VAR_15\n",
"VAR_15[VAR_14[tweet[0]]][VAR_14[tweet[1]]] += sentiment_compound_score(tweet[2]\n )\n"
] | [
"def get_sentiment(groups, tweets):...\n",
"groups_dict = {}\n",
"for i, group in enumerate(groups):\n",
"for user in group:\n",
"total_sentiment = [[(0) for _ in range(len(groups))] for _ in range(len(\n groups))]\n",
"groups_dict[user] = i\n",
"for tweet in tweets:\n",
"if tweet[0] in groups_dict and tweet[1] in groups_dict:\n",
"return total_sentiment\n",
"total_sentiment[groups_dict[tweet[0]]][groups_dict[tweet[1]]\n ] += sentiment_compound_score(tweet[2])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"For",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"AugAssign'"
] |
[
"def FUNC_6(self, VAR_68):...\n",
"if not VAR_68:\n",
"return\n",
"if VAR_68.startswith('redirect_'):\n",
"VAR_104 = VAR_68[9:]\n",
"if VAR_68.startswith('vote_'):\n",
"if not VAR_104.startswith(VAR_101.site.path) and not VAR_104.startswith('http:'\n",
"VAR_41 = VAR_68[5:]\n",
"if VAR_68.startswith('share_'):\n",
"VAR_104 = (VAR_101.site.path + VAR_104).replace('//', '/')\n",
"return 'redirect', VAR_104\n",
"VAR_105 = Thing._by_fullname(VAR_41, data=True)\n",
"VAR_41 = VAR_68[6:]\n",
"if VAR_68.startswith('reply_'):\n",
"return 'redirect', VAR_105.make_permalink_slow()\n",
"VAR_105 = Thing._by_fullname(VAR_41, data=True)\n",
"VAR_41 = VAR_68[6:]\n",
"if VAR_68.startswith('sr_change_'):\n",
"return 'redirect', VAR_105.make_permalink_slow()\n",
"VAR_105 = Thing._by_fullname(VAR_41, data=True)\n",
"VAR_111 = VAR_68[10:].split(',')\n",
"return 'redirect', VAR_105.make_permalink_slow()\n",
"VAR_112 = dict(i.split(':') for i in VAR_111)\n",
"VAR_113 = Subreddit._by_fullname(VAR_112.keys(), data=True, return_dict=False)\n",
"VAR_114 = dict((VAR_52, VAR_112[VAR_52._fullname] == 1) for VAR_52 in VAR_113)\n",
"return 'subscribe', VAR_114\n"
] | [
"def run(self, reason):...\n",
"if not reason:\n",
"return\n",
"if reason.startswith('redirect_'):\n",
"dest = reason[9:]\n",
"if reason.startswith('vote_'):\n",
"if not dest.startswith(c.site.path) and not dest.startswith('http:'):\n",
"fullname = reason[5:]\n",
"if reason.startswith('share_'):\n",
"dest = (c.site.path + dest).replace('//', '/')\n",
"return 'redirect', dest\n",
"t = Thing._by_fullname(fullname, data=True)\n",
"fullname = reason[6:]\n",
"if reason.startswith('reply_'):\n",
"return 'redirect', t.make_permalink_slow()\n",
"t = Thing._by_fullname(fullname, data=True)\n",
"fullname = reason[6:]\n",
"if reason.startswith('sr_change_'):\n",
"return 'redirect', t.make_permalink_slow()\n",
"t = Thing._by_fullname(fullname, data=True)\n",
"sr_list = reason[10:].split(',')\n",
"return 'redirect', t.make_permalink_slow()\n",
"fullnames = dict(i.split(':') for i in sr_list)\n",
"srs = Subreddit._by_fullname(fullnames.keys(), data=True, return_dict=False)\n",
"sr_onoff = dict((sr, fullnames[sr._fullname] == 1) for sr in srs)\n",
"return 'subscribe', sr_onoff\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_14(self):...\n",
"self.compilation_ok(\n \"\"\"\nif address :all :is \"from\" \"[email protected]\" {\n discard;\n}\n\"\"\")\n",
"self.representation_is('string')\n"
] | [
"def test_non_ordered_args(self):...\n",
"self.compilation_ok(\n \"\"\"\nif address :all :is \"from\" \"[email protected]\" {\n discard;\n}\n\"\"\")\n",
"self.representation_is(\n \"\"\"\nif (type: control)\n address (type: test)\n :all\n :is\n \"from\"\n \"[email protected]\"\n discard (type: action)\n\"\"\"\n )\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"return tornado.web.authenticated(VAR_7)\n"
] | [
"@staticmethod...\n",
"return tornado.web.authenticated(method)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_2.route('/data/jobnames/')...\n",
"VAR_61 = {'results': VAR_3.jobnames_query()}\n",
"return VAR_61\n"
] | [
"@app.route('/data/jobnames/')...\n",
"json_jobnames = {'results': JOBSDATA.jobnames_query()}\n",
"return json_jobnames\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_26(self, VAR_0, VAR_7):...\n",
"self.set_max_jobs(VAR_7)\n",
"self.assertRaises(KeyboardInterrupt, self.runall, VAR_0)\n",
"self.assertEqual(4, self.runner.stats.num_cases())\n",
"self.assertEqual(4, len(self.runner.stats.failures()))\n",
"self.assert_all_dead()\n"
] | [
"def _run_checks(self, checks, max_jobs):...\n",
"self.set_max_jobs(max_jobs)\n",
"self.assertRaises(KeyboardInterrupt, self.runall, checks)\n",
"self.assertEqual(4, self.runner.stats.num_cases())\n",
"self.assertEqual(4, len(self.runner.stats.failures()))\n",
"self.assert_all_dead()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self, VAR_16):...\n",
"VAR_16 = VAR_0.select('directory', 'id = ' + VAR_16)[0]['id']\n",
"self.path.append(VAR_16)\n"
] | [
"def go_to_directory(self, directory_id):...\n",
"directory_id = db.select('directory', 'id = ' + directory_id)[0]['id']\n",
"self.path.append(directory_id)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_19(self):...\n",
"self.mock(self.bot, 'post_error', lambda *VAR_15: None)\n",
"self.mock(bot_main, 'THIS_FILE', VAR_7.path.join(self.root_dir,\n 'swarming_bot.1.zip'))\n",
"VAR_31 = VAR_7.path.join(self.root_dir, 'swarming_bot.2.zip')\n",
"self.mock(time, 'time', lambda : 1400000000)\n",
"def FUNC_27(VAR_32, VAR_3):...\n",
"self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', VAR_3)\n",
"self.assertEqual(VAR_31, VAR_32)\n",
"z.writestr('__main__.py', 'print(\"hi\")')\n",
"return True\n"
] | [
"def test_update_bot(self):...\n",
"self.mock(self.bot, 'post_error', lambda *_: None)\n",
"self.mock(bot_main, 'THIS_FILE', os.path.join(self.root_dir,\n 'swarming_bot.1.zip'))\n",
"new_zip = os.path.join(self.root_dir, 'swarming_bot.2.zip')\n",
"self.mock(time, 'time', lambda : 1400000000)\n",
"def url_retrieve(f, url):...\n",
"self.assertEqual('https://localhost:1/swarming/api/v1/bot/bot_code/123', url)\n",
"self.assertEqual(new_zip, f)\n",
"z.writestr('__main__.py', 'print(\"hi\")')\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_12():...\n",
"\"\"\"docstring\"\"\"\n",
"from .diary import get_task_info\n",
"VAR_21 = True\n",
"if os.path.isfile(VAR_0):\n",
"while VAR_21:\n",
"click.echo(chalk.red(\n 'There are no goals set. Set a new goal by entering \"yoda goals new\"'))\n",
"click.echo(chalk.blue('Enter the goal name that you would like to examine'))\n",
"VAR_22 = yaml.load(goals_file)\n",
"VAR_3 = VAR_4()\n",
"if len(VAR_22['entries']):\n",
"VAR_29 = FUNC_1(VAR_3)\n",
"VAR_31 = 0\n",
"click.echo(chalk.red(\n 'There are no tasks assigned to the goal. Add a new task by entering \"yoda diary nt\"'\n ))\n",
"if os.path.isfile(VAR_29):\n",
"VAR_33 = 0\n",
"VAR_21 = False\n",
"click.echo('Tasks assigned to the goal:')\n",
"click.echo('----------------')\n",
"click.echo('Status | Date | Text')\n",
"click.echo('-------|---------|-----')\n",
"for entry in VAR_22['entries']:\n",
"VAR_9 = entry['timestamp']\n",
"click.echo('----------------')\n",
"VAR_8 = entry['date']\n",
"click.echo('')\n",
"VAR_36, VAR_2 = get_task_info(VAR_9, VAR_8)\n",
"click.echo('Summary:')\n",
"VAR_31 += 1\n",
"click.echo('----------------')\n",
"VAR_33 += 1 if VAR_36 == 0 else 0\n",
"click.echo(chalk.red('Incomplete tasks assigned to the goal: ' + str(VAR_33)))\n",
"VAR_2 = VAR_2 if VAR_36 == 0 else FUNC_0(VAR_2)\n",
"click.echo(chalk.green('Completed tasks assigned to the goal: ' + str(\n VAR_31 - VAR_33)))\n",
"VAR_36 = 'O' if VAR_36 == 0 else 'X'\n",
"click.echo(' ' + VAR_36 + ' | ' + VAR_8 + '| ' + VAR_2)\n"
] | [
"def view_related_tasks():...\n",
"\"\"\"docstring\"\"\"\n",
"from .diary import get_task_info\n",
"not_valid_name = True\n",
"if os.path.isfile(GOALS_CONFIG_FILE_PATH):\n",
"while not_valid_name:\n",
"click.echo(chalk.red(\n 'There are no goals set. Set a new goal by entering \"yoda goals new\"'))\n",
"click.echo(chalk.blue('Enter the goal name that you would like to examine'))\n",
"contents = yaml.load(goals_file)\n",
"goal_name = input()\n",
"if len(contents['entries']):\n",
"goal_file_name = get_goal_file_path(goal_name)\n",
"total_tasks = 0\n",
"click.echo(chalk.red(\n 'There are no tasks assigned to the goal. Add a new task by entering \"yoda diary nt\"'\n ))\n",
"if os.path.isfile(goal_file_name):\n",
"total_incomplete = 0\n",
"not_valid_name = False\n",
"click.echo('Tasks assigned to the goal:')\n",
"click.echo('----------------')\n",
"click.echo('Status | Date | Text')\n",
"click.echo('-------|---------|-----')\n",
"for entry in contents['entries']:\n",
"timestamp = entry['timestamp']\n",
"click.echo('----------------')\n",
"date = entry['date']\n",
"click.echo('')\n",
"status, text = get_task_info(timestamp, date)\n",
"click.echo('Summary:')\n",
"total_tasks += 1\n",
"click.echo('----------------')\n",
"total_incomplete += 1 if status == 0 else 0\n",
"click.echo(chalk.red('Incomplete tasks assigned to the goal: ' + str(\n total_incomplete)))\n",
"text = text if status == 0 else strike(text)\n",
"click.echo(chalk.green('Completed tasks assigned to the goal: ' + str(\n total_tasks - total_incomplete)))\n",
"status = 'O' if status == 0 else 'X'\n",
"click.echo(' ' + status + ' | ' + date + '| ' + text)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"AugAssign'",
"Expr'",
"AugAssign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.db.sql('delete from tabEvent')\n",
"VAR_4 = FUNC_0()\n",
"VAR_5 = FUNC_0(VAR_1='2016-07-05 23:59:59')\n",
"VAR_6 = FUNC_0(VAR_1='2016-07-06 00:00:00')\n",
"VAR_7 = FUNC_0(VAR_1='2016-07-07 23:59:59')\n",
"VAR_8 = FUNC_0(VAR_1='2016-07-08 00:00:01')\n",
"VAR_3 = DatabaseQuery('Event').execute(filters={'starts_on': ['between',\n None]}, fields=['name'])\n",
"self.assertTrue({'name': VAR_5.name} not in VAR_3)\n",
"VAR_3 = DatabaseQuery('Event').execute(filters={'starts_on': ['between', [\n '2016-07-06', '2016-07-07']]}, fields=['name'])\n",
"self.assertTrue({'name': VAR_6.name} in VAR_3)\n",
"self.assertTrue({'name': VAR_7.name} in VAR_3)\n",
"self.assertTrue({'name': VAR_5.name} not in VAR_3)\n",
"self.assertTrue({'name': VAR_8.name} not in VAR_3)\n",
"VAR_3 = DatabaseQuery('Event').execute(filters={'starts_on': ['between', [\n '2016-07-07']]}, fields=['name'])\n",
"self.assertTrue({'name': VAR_7.name} in VAR_3)\n",
"self.assertTrue({'name': VAR_8.name} in VAR_3)\n",
"self.assertTrue({'name': VAR_4.name} in VAR_3)\n",
"self.assertTrue({'name': VAR_5.name} not in VAR_3)\n",
"self.assertTrue({'name': VAR_6.name} not in VAR_3)\n"
] | [
"def test_between_filters(self):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.db.sql('delete from tabEvent')\n",
"todays_event = create_event()\n",
"event1 = create_event(starts_on='2016-07-05 23:59:59')\n",
"event2 = create_event(starts_on='2016-07-06 00:00:00')\n",
"event3 = create_event(starts_on='2016-07-07 23:59:59')\n",
"event4 = create_event(starts_on='2016-07-08 00:00:01')\n",
"data = DatabaseQuery('Event').execute(filters={'starts_on': ['between',\n None]}, fields=['name'])\n",
"self.assertTrue({'name': event1.name} not in data)\n",
"data = DatabaseQuery('Event').execute(filters={'starts_on': ['between', [\n '2016-07-06', '2016-07-07']]}, fields=['name'])\n",
"self.assertTrue({'name': event2.name} in data)\n",
"self.assertTrue({'name': event3.name} in data)\n",
"self.assertTrue({'name': event1.name} not in data)\n",
"self.assertTrue({'name': event4.name} not in data)\n",
"data = DatabaseQuery('Event').execute(filters={'starts_on': ['between', [\n '2016-07-07']]}, fields=['name'])\n",
"self.assertTrue({'name': event3.name} in data)\n",
"self.assertTrue({'name': event4.name} in data)\n",
"self.assertTrue({'name': todays_event.name} in data)\n",
"self.assertTrue({'name': event1.name} not in data)\n",
"self.assertTrue({'name': event2.name} not in data)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from urllib.parse import urlencode, quote_plus\n",
"from django.http import HttpResponse, JsonResponse\n",
"from django.conf import settings\n",
"from experiences.factories import create_get_experience_interactor\n",
"from profiles.factories import create_get_profile_interactor\n",
"VAR_0 = '/people/me/email-confirmation'\n",
"VAR_1 = '/people/me/login'\n",
"VAR_2 = '/e'\n",
"VAR_3 = '/p'\n",
"VAR_4 = '/experiences'\n",
"VAR_5 = '/profiles'\n",
"def FUNC_0(VAR_6):...\n",
"VAR_9 = HttpResponse('', status=302)\n",
"VAR_9['Location'] = '{}{}?{}'.format(settings.APP_DEEPLINK_DOMAIN, VAR_0,\n VAR_6.GET.urlencode())\n",
"return VAR_9\n"
] | [
"from urllib.parse import urlencode, quote_plus\n",
"from django.http import HttpResponse, JsonResponse\n",
"from django.conf import settings\n",
"from experiences.factories import create_get_experience_interactor\n",
"from profiles.factories import create_get_profile_interactor\n",
"EMAIL_CONFIRMATION_PATH = '/people/me/email-confirmation'\n",
"LOGIN_PATH = '/people/me/login'\n",
"EXPERIENCE_PATH = '/e'\n",
"PROFILE_PATH = '/p'\n",
"EXPERIENCE_DEEPLINK_PATH = '/experiences'\n",
"PROFILE_DEEPLINK_PATH = '/profiles'\n",
"def email_confirmation_redirect(request):...\n",
"response = HttpResponse('', status=302)\n",
"response['Location'] = '{}{}?{}'.format(settings.APP_DEEPLINK_DOMAIN,\n EMAIL_CONFIRMATION_PATH, request.GET.urlencode())\n",
"return response\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"VAR_0.full_clean()\n",
"VAR_8 = CLASS_3(VAR_1)\n",
"VAR_9 = [('%s %s %s' % (VAR_11, VAR_11.name, VAR_8.depth)) for VAR_11 in VAR_8]\n",
"self.assertListEqual(['on_enter: ', 'on_enter: level2', 'on_exit: level2',\n 'on_enter: level2s[a]', 'on_exit: level2s[a]', 'on_enter: level2s[b]',\n 'on_enter: level2s[b].level3s[0]', 'on_exit: level2s[b].level3s[0]',\n 'on_enter: level2s[b].level3s[1]', 'on_exit: level2s[b].level3s[1]',\n 'on_exit: level2s[b]', 'on_enter: level2s[c]',\n 'on_enter: level2s[c].level3s[0]', 'on_exit: level2s[c].level3s[0]',\n 'on_exit: level2s[c]', 'on_exit: ', 'on_enter: ', 'on_enter: level2',\n 'on_exit: level2', 'on_enter: level2s[a]', 'on_exit: level2s[a]',\n 'on_enter: level2s[b]', 'on_enter: level2s[b].level3s[0]',\n 'on_exit: level2s[b].level3s[0]', 'on_enter: level2s[b].level3s[1]',\n 'on_exit: level2s[b].level3s[1]', 'on_exit: level2s[b]',\n 'on_enter: level2s[c]', 'on_enter: level2s[c].level3s[0]',\n 'on_exit: level2s[c].level3s[0]', 'on_exit: level2s[c]', 'on_exit: '],\n VAR_8.events)\n",
"self.assertListEqual(['odin.traversal.Level1 resource a 0',\n 'odin.traversal.Level2 resource b 1',\n 'odin.traversal.Level2 resource c 1',\n 'odin.traversal.Level2 resource d 1',\n 'odin.traversal.Level3 resource e 2',\n 'odin.traversal.Level3 resource f 2',\n 'odin.traversal.Level2 resource g 1',\n 'odin.traversal.Level3 resource h 2',\n 'odin.traversal.Level1 resource i 0',\n 'odin.traversal.Level2 resource j 1',\n 'odin.traversal.Level2 resource k 1',\n 'odin.traversal.Level2 resource l 1',\n 'odin.traversal.Level3 resource m 2',\n 'odin.traversal.Level3 resource n 2',\n 'odin.traversal.Level2 resource o 1',\n 'odin.traversal.Level3 resource p 2'], VAR_9)\n"
] | [
"def test_list_structure(self):...\n",
"TEST_STRUCTURE.full_clean()\n",
"resource_iter = TestResourceTraversalIterator(TEST_LIST_STRUCTURE)\n",
"resources = [('%s %s %s' % (r, r.name, resource_iter.depth)) for r in\n resource_iter]\n",
"self.assertListEqual(['on_enter: ', 'on_enter: level2', 'on_exit: level2',\n 'on_enter: level2s[a]', 'on_exit: level2s[a]', 'on_enter: level2s[b]',\n 'on_enter: level2s[b].level3s[0]', 'on_exit: level2s[b].level3s[0]',\n 'on_enter: level2s[b].level3s[1]', 'on_exit: level2s[b].level3s[1]',\n 'on_exit: level2s[b]', 'on_enter: level2s[c]',\n 'on_enter: level2s[c].level3s[0]', 'on_exit: level2s[c].level3s[0]',\n 'on_exit: level2s[c]', 'on_exit: ', 'on_enter: ', 'on_enter: level2',\n 'on_exit: level2', 'on_enter: level2s[a]', 'on_exit: level2s[a]',\n 'on_enter: level2s[b]', 'on_enter: level2s[b].level3s[0]',\n 'on_exit: level2s[b].level3s[0]', 'on_enter: level2s[b].level3s[1]',\n 'on_exit: level2s[b].level3s[1]', 'on_exit: level2s[b]',\n 'on_enter: level2s[c]', 'on_enter: level2s[c].level3s[0]',\n 'on_exit: level2s[c].level3s[0]', 'on_exit: level2s[c]', 'on_exit: '],\n resource_iter.events)\n",
"self.assertListEqual(['odin.traversal.Level1 resource a 0',\n 'odin.traversal.Level2 resource b 1',\n 'odin.traversal.Level2 resource c 1',\n 'odin.traversal.Level2 resource d 1',\n 'odin.traversal.Level3 resource e 2',\n 'odin.traversal.Level3 resource f 2',\n 'odin.traversal.Level2 resource g 1',\n 'odin.traversal.Level3 resource h 2',\n 'odin.traversal.Level1 resource i 0',\n 'odin.traversal.Level2 resource j 1',\n 'odin.traversal.Level2 resource k 1',\n 'odin.traversal.Level2 resource l 1',\n 'odin.traversal.Level3 resource m 2',\n 'odin.traversal.Level3 resource n 2',\n 'odin.traversal.Level2 resource o 1',\n 'odin.traversal.Level3 resource p 2'], resources)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(VAR_9):...\n",
"@functools.wraps(VAR_9)...\n",
"VAR_19 = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n",
"if VAR_3:\n",
"VAR_19['definitions']['issue']['required'].append('id')\n",
"VAR_19 = {**VAR_19, **{'type': 'object', 'properties': {'data': {'type':\n 'array', 'minItems': 1, 'items': {'$ref': '#/definitions/issue'}}}}}\n",
"VAR_19['definitions']['issue']['properties']['id'] = {'type': ['integer',\n 'string']}\n",
"VAR_20 = request.get_json()\n",
"validate(instance=request_payload, schema=request_schema)\n",
"return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n",
"return VAR_9(*VAR_17, **kwargs)\n"
] | [
"def decorator(func):...\n",
"@functools.wraps(func)...\n",
"request_schema = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n",
"if require_id:\n",
"request_schema['definitions']['issue']['required'].append('id')\n",
"request_schema = {**request_schema, **{'type': 'object', 'properties': {\n 'data': {'type': 'array', 'minItems': 1, 'items': {'$ref':\n '#/definitions/issue'}}}}}\n",
"request_schema['definitions']['issue']['properties']['id'] = {'type': [\n 'integer', 'string']}\n",
"request_payload = request.get_json()\n",
"validate(instance=request_payload, schema=request_schema)\n",
"return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n",
"return func(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_15(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"if FUNC_12(VAR_16, 'temp'):\n",
"return VAR_19(VAR_16, 'protected')\n"
] | [
"def protected(value):...\n",
"\"\"\"docstring\"\"\"\n",
"if is_flagged(value, 'temp'):\n",
"return flag(value, 'protected')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'"
] |
[
"import azurelinuxagent.common.utils.fileutil as fileutil\n",
"import azurelinuxagent.common.utils.shellutil as shellutil\n",
"import azurelinuxagent.common.utils.textutil as textutil\n",
"import azurelinuxagent.common.logger as logger\n",
"from azurelinuxagent.common.exception import OSUtilError\n",
"from azurelinuxagent.common.osutil.default import DefaultOSUtil\n",
"from azurelinuxagent.common.future import ustr\n",
"def __init__(self):...\n",
"super(CLASS_0, self).__init__()\n",
"self._scsi_disks_timeout_set = False\n",
"def FUNC_0(self, VAR_0):...\n",
"VAR_14 = '/etc/rc.conf'\n",
"VAR_15 = fileutil.read_file(VAR_14).split('\\n')\n",
"textutil.set_ini_config(VAR_15, 'hostname', VAR_0)\n",
"fileutil.write_file(VAR_14, '\\n'.join(VAR_15))\n",
"shellutil.run('hostname {0}'.format(VAR_0), VAR_10=False)\n",
"def FUNC_1(self):...\n",
"return shellutil.run('service sshd restart', VAR_10=False)\n"
] | [
"import azurelinuxagent.common.utils.fileutil as fileutil\n",
"import azurelinuxagent.common.utils.shellutil as shellutil\n",
"import azurelinuxagent.common.utils.textutil as textutil\n",
"import azurelinuxagent.common.logger as logger\n",
"from azurelinuxagent.common.exception import OSUtilError\n",
"from azurelinuxagent.common.osutil.default import DefaultOSUtil\n",
"from azurelinuxagent.common.future import ustr\n",
"def __init__(self):...\n",
"super(FreeBSDOSUtil, self).__init__()\n",
"self._scsi_disks_timeout_set = False\n",
"def set_hostname(self, hostname):...\n",
"rc_file_path = '/etc/rc.conf'\n",
"conf_file = fileutil.read_file(rc_file_path).split('\\n')\n",
"textutil.set_ini_config(conf_file, 'hostname', hostname)\n",
"fileutil.write_file(rc_file_path, '\\n'.join(conf_file))\n",
"shellutil.run('hostname {0}'.format(hostname), chk_err=False)\n",
"def restart_ssh_service(self):...\n",
"return shellutil.run('service sshd restart', chk_err=False)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self, VAR_3, **VAR_6):...\n",
"logging.warn('url_open(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n",
"if not self._requests:\n",
"return None\n",
"VAR_6.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == VAR_3:\n",
"self.fail('Unknown request %s' % VAR_3)\n",
"VAR_9 = self._requests.pop(i)\n",
"if len(VAR_9) != 4:\n",
"self.fail('Expected normal request, got json data; %s' % VAR_3)\n",
"VAR_10, VAR_11, VAR_12, VAR_4 = VAR_9\n",
"if callable(VAR_11):\n",
"VAR_11(VAR_6)\n",
"self.assertEqual(VAR_11, VAR_6)\n",
"if VAR_12 is not None:\n",
"return FUNC_0(VAR_12, VAR_3, VAR_4)\n",
"return None\n"
] | [
"def _url_open(self, url, **kwargs):...\n",
"logging.warn('url_open(%s, %s)', url[:500], str(kwargs)[:500])\n",
"if not self._requests:\n",
"return None\n",
"kwargs.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == url:\n",
"self.fail('Unknown request %s' % url)\n",
"data = self._requests.pop(i)\n",
"if len(data) != 4:\n",
"self.fail('Expected normal request, got json data; %s' % url)\n",
"_, expected_kwargs, result, headers = data\n",
"if callable(expected_kwargs):\n",
"expected_kwargs(kwargs)\n",
"self.assertEqual(expected_kwargs, kwargs)\n",
"if result is not None:\n",
"return make_fake_response(result, url, headers)\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_18):...\n",
"if not VAR_18:\n",
"self.error()\n",
"return VAR_18\n"
] | [
"def run(self, item):...\n",
"if not item:\n",
"self.error()\n",
"return item\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_12(self, *VAR_10, **VAR_11):...\n",
"return FUNC_12(*VAR_10, distribution=self, **kwargs)\n"
] | [
"def execute_java_async(self, *args, **kwargs):...\n",
"return execute_java_async(*args, distribution=self, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_61():...\n",
"self.cursor.execute('create table t1 (word varchar (100))')\n",
"VAR_39 = set(['a'])\n",
"self.cursor.executemany('insert into t1 (word) values (?)', [VAR_39])\n"
] | [
"def f():...\n",
"self.cursor.execute('create table t1 (word varchar (100))')\n",
"words = set(['a'])\n",
"self.cursor.executemany('insert into t1 (word) values (?)', [words])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"VAR_3 = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n",
"self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'delete', VAR_3['name'])\n",
"self.mox.ReplayAll()\n",
"self.driver.delete_snapshot(VAR_3)\n"
] | [
"def test_delete_snapshot(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n",
"self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'delete', snapshot['name'])\n",
"self.mox.ReplayAll()\n",
"self.driver.delete_snapshot(snapshot)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_7.route('/register', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"VAR_14 = generate_password_hash(request.form['password'])\n",
"return render_template('user/register/registration.html')\n",
"VAR_15 = reg.registerUser(request.form['email'], VAR_14, VAR_6)\n",
"if VAR_15 == 'Success':\n",
"return render_template('user/register/success.html')\n",
"return render_template('user/register/error.html', VAR_21=request.form['email']\n )\n"
] | [
"@app.route('/register', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"hashedPassword = generate_password_hash(request.form['password'])\n",
"return render_template('user/register/registration.html')\n",
"status = reg.registerUser(request.form['email'], hashedPassword, mysql)\n",
"if status == 'Success':\n",
"return render_template('user/register/success.html')\n",
"return render_template('user/register/error.html', name=request.form['email'])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_34(self, VAR_64):...\n",
"return CLASS_1(VAR_64)\n"
] | [
"def run(self, func):...\n",
"return RuleInfo(func)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(VAR_26, VAR_27, VAR_28=bconfig.CFG_MAIN_FIELD, VAR_29=bconfig....\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53 = 'string'\n",
"VAR_52 = []\n",
"VAR_54, VAR_55, VAR_56 = FUNC_29(VAR_28)\n",
"for VAR_36 in (VAR_26['Single keywords'], VAR_26['Core keywords']):\n",
"for VAR_62 in VAR_36:\n",
"for VAR_42, VAR_36 in ((VAR_29, VAR_26['Author keywords']), (VAR_30, VAR_26\n",
"VAR_52.append(VAR_53 % (VAR_54, VAR_55, VAR_56, encode_for_xml(VAR_31),\n encode_for_xml(VAR_62), VAR_36[VAR_62], encode_for_xml(VAR_27[VAR_62])))\n",
"if VAR_36 and len(VAR_36) and VAR_42:\n",
"return ''.join(VAR_52)\n",
"VAR_54, VAR_55, VAR_56 = FUNC_29(VAR_42)\n",
"for VAR_62, info in VAR_36.items():\n",
"VAR_52.append(VAR_53 % (VAR_54, VAR_55, VAR_56, encode_for_xml(VAR_31),\n encode_for_xml(VAR_62), '', encode_for_xml(VAR_27[VAR_62])))\n"
] | [
"def _output_marc(output_complete, categories, kw_field=bconfig....\n",
"\"\"\"docstring\"\"\"\n",
"kw_template = \"\"\"<datafield tag=\"%s\" ind1=\"%s\" ind2=\"%s\">\n <subfield code=\"2\">%s</subfield>\n <subfield code=\"a\">%s</subfield>\n <subfield code=\"n\">%s</subfield>\n <subfield code=\"9\">%s</subfield>\n</datafield>\n\"\"\"\n",
"output = []\n",
"tag, ind1, ind2 = _parse_marc_code(kw_field)\n",
"for keywords in (output_complete['Single keywords'], output_complete[\n",
"for kw in keywords:\n",
"for field, keywords in ((auth_field, output_complete['Author keywords']), (\n",
"output.append(kw_template % (tag, ind1, ind2, encode_for_xml(provenience),\n encode_for_xml(kw), keywords[kw], encode_for_xml(categories[kw])))\n",
"if keywords and len(keywords) and field:\n",
"return ''.join(output)\n",
"tag, ind1, ind2 = _parse_marc_code(field)\n",
"for kw, info in keywords.items():\n",
"output.append(kw_template % (tag, ind1, ind2, encode_for_xml(provenience),\n encode_for_xml(kw), '', encode_for_xml(categories[kw])))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"For",
"For",
"Expr'",
"Condition",
"Return'",
"Assign'",
"For",
"Expr'"
] |
[
"def __add__(self, VAR_3):...\n",
"if isinstance(VAR_3, CLASS_1):\n",
"return CLASS_1(*(self._path + VAR_3._path))\n",
"if isinstance(VAR_3, six.string_types):\n",
"return CLASS_1(*(self._path + tuple([(CLASS_0, CLASS_0, VAR_3)])))\n"
] | [
"def __add__(self, other):...\n",
"if isinstance(other, TraversalPath):\n",
"return TraversalPath(*(self._path + other._path))\n",
"if isinstance(other, six.string_types):\n",
"return TraversalPath(*(self._path + tuple([(NotSupplied, NotSupplied, other)]))\n )\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def __eq__(self, VAR_12):...\n",
"return self.etag == VAR_12.etag and self.mtime == VAR_12.mtime\n"
] | [
"def __eq__(self, other):...\n",
"return self.etag == other.etag and self.mtime == other.mtime\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@app.route('/people/', methods=['GET'])...\n",
"return render_template('/people/list.html', VAR_14=get_people())\n"
] | [
"@app.route('/people/', methods=['GET'])...\n",
"return render_template('/people/list.html', people=get_people())\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_15, VAR_16, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"self._name = 'Netatmo {} {}'.format(VAR_16, VAR_5[VAR_17][0])\n",
"self.netatmo_data = VAR_15\n",
"self.module_name = VAR_16\n",
"self.type = VAR_17\n",
"self._state = None\n",
"self._device_class = VAR_5[self.type][3]\n",
"self._icon = VAR_5[self.type][2]\n",
"self._unit_of_measurement = VAR_5[self.type][1]\n",
"VAR_20 = self.netatmo_data.station_data.moduleByName(module=module_name)['_id']\n",
"self.module_id = VAR_20[1]\n"
] | [
"def __init__(self, netatmo_data, module_name, sensor_type):...\n",
"\"\"\"docstring\"\"\"\n",
"self._name = 'Netatmo {} {}'.format(module_name, SENSOR_TYPES[sensor_type][0])\n",
"self.netatmo_data = netatmo_data\n",
"self.module_name = module_name\n",
"self.type = sensor_type\n",
"self._state = None\n",
"self._device_class = SENSOR_TYPES[self.type][3]\n",
"self._icon = SENSOR_TYPES[self.type][2]\n",
"self._unit_of_measurement = SENSOR_TYPES[self.type][1]\n",
"module_id = self.netatmo_data.station_data.moduleByName(module=module_name)[\n '_id']\n",
"self.module_id = module_id[1]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(self):...\n",
"self._tab_after('ls \"comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes\" ',), {})])\n"
] | [
"def test_complete_quotes(self):...\n",
"self._tab_after('ls \"comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes\" ',), {})])\n"
] | [
0,
0,
1
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(VAR_1, VAR_3=None):...\n",
"if VAR_3 == None:\n",
"VAR_3 = len(VAR_1)\n",
"return VAR_1 + (VAR_3 - len(VAR_1)) * ' '\n"
] | [
"def print_left_just(output, length=None):...\n",
"if length == None:\n",
"length = len(output)\n",
"return output + (length - len(output)) * ' '\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"@mock.patch('requests.post', FUNC_0)...\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 0)\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_8 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n",
"VAR_8 = {'web': 1}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 204)\n",
"VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"self.assertEqual(VAR_5.data['results'][0]['release'], 'v2')\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_8 = {'image': 'autotest/example'}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"self.assertEqual(VAR_5.data['image'], VAR_8['image'])\n",
"VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"self.assertEqual(VAR_5.data['results'][0]['release'], 'v3')\n",
"VAR_4 = '/api/apps/{app_id}/config'.format(**locals())\n",
"VAR_8 = {'values': json.dumps({'KEY': 'value'})}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"self.assertEqual(VAR_5.data['results'][0]['release'], 'v4')\n"
] | [
"@mock.patch('requests.post', mock_import_repository_task)...\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/containers'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 0)\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/scale'.format(**locals())\n",
"body = {'web': 1}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 204)\n",
"url = '/api/apps/{app_id}/containers'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"self.assertEqual(response.data['results'][0]['release'], 'v2')\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"self.assertEqual(response.data['image'], body['image'])\n",
"url = '/api/apps/{app_id}/containers'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"self.assertEqual(response.data['results'][0]['release'], 'v3')\n",
"url = '/api/apps/{app_id}/config'.format(**locals())\n",
"body = {'values': json.dumps({'KEY': 'value'})}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/containers'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"self.assertEqual(response.data['results'][0]['release'], 'v4')\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(VAR_20, VAR_21):...\n",
"return VAR_21[len(VAR_20):] if VAR_21.startswith(VAR_20) else VAR_21\n"
] | [
"def strip_prefix(prefix, s):...\n",
"return s[len(prefix):] if s.startswith(prefix) else s\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_21(VAR_38, VAR_20):...\n",
"VAR_63, VAR_64 = os.path.split(VAR_20)\n",
"FUNC_19(VAR_63)\n",
"shutil.copy2(VAR_38, VAR_20)\n"
] | [
"def cp(src, dst):...\n",
"r, f = os.path.split(dst)\n",
"mkdir_p(r)\n",
"shutil.copy2(src, dst)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self, VAR_10=None, VAR_14=None, VAR_16=True):...\n",
"\"\"\"docstring\"\"\"\n",
"self.add_extra_args(VAR_10)\n",
"self.args = super().parse_args(VAR_10=args)\n",
"self.opt = vars(self.args)\n",
"self.opt['parlai_home'] = self.parlai_home\n",
"if 'batchsize' in self.opt and self.opt['batchsize'] <= 1:\n",
"self.opt.pop('batch_sort', None)\n",
"if self.opt.get('download_path'):\n",
"self.opt.pop('context_length', None)\n",
"VAR_20.environ['PARLAI_DOWNPATH'] = self.opt['download_path']\n",
"if self.opt.get('datapath'):\n",
"VAR_20.environ['PARLAI_DATAPATH'] = self.opt['datapath']\n",
"if self.opt.get('model_file') is not None:\n",
"self.opt['model_file'] = FUNC_3(self.opt.get('datapath'), self.opt[\n 'model_file'])\n",
"if self.opt.get('dict_file') is not None:\n",
"self.opt['dict_file'] = FUNC_3(self.opt.get('datapath'), self.opt['dict_file'])\n",
"VAR_32 = {}\n",
"VAR_33 = []\n",
"VAR_34 = []\n",
"for group in self._action_groups:\n",
"for a in group._group_actions:\n",
"for VAR_43 in range(len(self.cli_args)):\n",
"if hasattr(a, 'option_strings'):\n",
"if self.cli_args[VAR_43] in VAR_32:\n",
"self.opt['override'] = self.overridable\n",
"for VAR_44 in a.option_strings:\n",
"if self.cli_args[VAR_43] in VAR_33:\n",
"if VAR_16:\n",
"VAR_32[VAR_44] = a.dest\n",
"self.overridable[VAR_32[self.cli_args[VAR_43]]] = True\n",
"if self.cli_args[VAR_43] in VAR_34:\n",
"self.print_args()\n",
"return self.opt\n",
"if '_StoreTrueAction' in VAR_38(type(a)):\n",
"self.overridable[VAR_32[self.cli_args[VAR_43]]] = False\n",
"if VAR_43 < len(self.cli_args) - 1 and self.cli_args[VAR_43 + 1][0] != '-':\n",
"VAR_33.append(VAR_44)\n",
"if '_StoreFalseAction' in VAR_38(type(a)):\n",
"self.overridable[VAR_32[self.cli_args[VAR_43]]] = self.cli_args[VAR_43 + 1]\n",
"VAR_34.append(VAR_44)\n"
] | [
"def parse_args(self, args=None, namespace=None, print_args=True):...\n",
"\"\"\"docstring\"\"\"\n",
"self.add_extra_args(args)\n",
"self.args = super().parse_args(args=args)\n",
"self.opt = vars(self.args)\n",
"self.opt['parlai_home'] = self.parlai_home\n",
"if 'batchsize' in self.opt and self.opt['batchsize'] <= 1:\n",
"self.opt.pop('batch_sort', None)\n",
"if self.opt.get('download_path'):\n",
"self.opt.pop('context_length', None)\n",
"os.environ['PARLAI_DOWNPATH'] = self.opt['download_path']\n",
"if self.opt.get('datapath'):\n",
"os.environ['PARLAI_DATAPATH'] = self.opt['datapath']\n",
"if self.opt.get('model_file') is not None:\n",
"self.opt['model_file'] = modelzoo_path(self.opt.get('datapath'), self.opt[\n 'model_file'])\n",
"if self.opt.get('dict_file') is not None:\n",
"self.opt['dict_file'] = modelzoo_path(self.opt.get('datapath'), self.opt[\n 'dict_file'])\n",
"option_strings_dict = {}\n",
"store_true = []\n",
"store_false = []\n",
"for group in self._action_groups:\n",
"for a in group._group_actions:\n",
"for i in range(len(self.cli_args)):\n",
"if hasattr(a, 'option_strings'):\n",
"if self.cli_args[i] in option_strings_dict:\n",
"self.opt['override'] = self.overridable\n",
"for option in a.option_strings:\n",
"if self.cli_args[i] in store_true:\n",
"if print_args:\n",
"option_strings_dict[option] = a.dest\n",
"self.overridable[option_strings_dict[self.cli_args[i]]] = True\n",
"if self.cli_args[i] in store_false:\n",
"self.print_args()\n",
"return self.opt\n",
"if '_StoreTrueAction' in str(type(a)):\n",
"self.overridable[option_strings_dict[self.cli_args[i]]] = False\n",
"if i < len(self.cli_args) - 1 and self.cli_args[i + 1][0] != '-':\n",
"store_true.append(option)\n",
"if '_StoreFalseAction' in str(type(a)):\n",
"self.overridable[option_strings_dict[self.cli_args[i]]] = self.cli_args[i + 1]\n",
"store_false.append(option)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"For",
"For",
"Condition",
"Condition",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_0, VAR_1, *VAR_2, **VAR_3):...\n",
"VAR_12 = get_object_or_404(JustURL, VAR_1=pk)\n",
"VAR_17 = VAR_12.clicktracking_set.all().order_by('timestamp')\n",
"return render(VAR_0, 'clicktracking-detail-view.html', {'object': VAR_12,\n 'reports': VAR_17})\n"
] | [
"def get(self, request, pk, *args, **kwargs):...\n",
"object = get_object_or_404(JustURL, pk=pk)\n",
"reports = object.clicktracking_set.all().order_by('timestamp')\n",
"return render(request, 'clicktracking-detail-view.html', {'object': object,\n 'reports': reports})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(VAR_9, VAR_10, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = str(VAR_9)\n",
"VAR_10 = str(VAR_10)\n",
"VAR_11 = str(VAR_11)\n",
"FUNC_0(VAR_9)\n",
"FUNC_0(VAR_10)\n",
"FUNC_0(VAR_11)\n",
"VAR_21 = pathlib.Path(VAR_9).glob('**/*.gz')\n",
"for VAR_0 in VAR_21:\n",
"VAR_31 = str(VAR_0)\n",
"VAR_22 = pathlib.Path(VAR_10).glob('**/*.vcf')\n",
"VAR_32 = FUNC_8(VAR_31)\n",
"for VAR_0 in VAR_22:\n",
"VAR_32 = VAR_32[0:len(VAR_32) - 3]\n",
"VAR_34 = str(VAR_0)\n",
"FUNC_1(VAR_10)\n",
"VAR_33 = str(pathlib.Path(VAR_10, VAR_32))\n",
"VAR_35 = FUNC_8(VAR_34)\n",
"VAR_23 = pathlib.Path(VAR_9).glob('**/*.vcf')\n",
"print('[Setup][Data] Decompressing file: {}'.format(VAR_31))\n",
"VAR_36 = str(pathlib.Path(VAR_11, VAR_35))\n",
"for VAR_0 in VAR_23:\n",
"print(' - Output: {}'.format(VAR_33))\n",
"shutil.move(VAR_34, VAR_36)\n",
"VAR_37 = str(VAR_0)\n",
"FUNC_5(VAR_31, VAR_33)\n",
"VAR_35 = FUNC_8(VAR_37)\n",
"VAR_36 = str(pathlib.Path(VAR_11, VAR_35))\n",
"shutil.copy(VAR_37, VAR_36)\n"
] | [
"def process_data_files(input_dir, temp_dir, output_dir):...\n",
"\"\"\"docstring\"\"\"\n",
"input_dir = str(input_dir)\n",
"temp_dir = str(temp_dir)\n",
"output_dir = str(output_dir)\n",
"create_directory_tree(input_dir)\n",
"create_directory_tree(temp_dir)\n",
"create_directory_tree(output_dir)\n",
"pathlist_gz = pathlib.Path(input_dir).glob('**/*.gz')\n",
"for path in pathlist_gz:\n",
"path_str = str(path)\n",
"pathlist_vcf_temp = pathlib.Path(temp_dir).glob('**/*.vcf')\n",
"file_output_str = path_leaf(path_str)\n",
"for path in pathlist_vcf_temp:\n",
"file_output_str = file_output_str[0:len(file_output_str) - 3]\n",
"path_temp_str = str(path)\n",
"remove_directory_tree(temp_dir)\n",
"path_temp_output = str(pathlib.Path(temp_dir, file_output_str))\n",
"filename_str = path_leaf(path_temp_str)\n",
"pathlist_vcf_input = pathlib.Path(input_dir).glob('**/*.vcf')\n",
"print('[Setup][Data] Decompressing file: {}'.format(path_str))\n",
"path_vcf_str = str(pathlib.Path(output_dir, filename_str))\n",
"for path in pathlist_vcf_input:\n",
"print(' - Output: {}'.format(path_temp_output))\n",
"shutil.move(path_temp_str, path_vcf_str)\n",
"path_input_str = str(path)\n",
"decompress_gzip(path_str, path_temp_output)\n",
"filename_str = path_leaf(path_input_str)\n",
"path_vcf_str = str(pathlib.Path(output_dir, filename_str))\n",
"shutil.copy(path_input_str, path_vcf_str)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"return self.request.site.id\n"
] | [
"@property...\n",
"return self.request.site.id\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_5(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.value = beamr.interpreters.Footnote(VAR_1.value[2:-2])\n",
"return VAR_1\n"
] | [
"def t_FOOTNOTE(t):...\n",
"\"\"\"docstring\"\"\"\n",
"t.value = beamr.interpreters.Footnote(t.value[2:-2])\n",
"return t\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"from twisted.internet.defer import inlineCallbacks, returnValue\n",
"from base import Query\n",
"\"\"\"\n Object representing an insert query\n \"\"\"\n",
"def __init__(self, VAR_0, VAR_1):...\n",
"super(CLASS_0, self).__init__(VAR_0)\n",
"self.values = VAR_1\n",
"self.on_conflict = self.model_class._meta.on_conflict\n",
"self.return_id = self.model_class._meta.primary_key\n",
"@inlineCallbacks...\n",
"VAR_2 = self.database.generate_insert(self)\n",
"if self.return_id:\n",
"VAR_3 = yield self.database.runQuery(VAR_2)\n",
"yield self.database.runOperation(VAR_2)\n",
"if VAR_3 and self.model_class._meta.primary_key:\n",
"returnValue(None)\n",
"returnValue(VAR_3[0][0])\n"
] | [
"from twisted.internet.defer import inlineCallbacks, returnValue\n",
"from base import Query\n",
"\"\"\"\n Object representing an insert query\n \"\"\"\n",
"def __init__(self, model_class, values):...\n",
"super(InsertQuery, self).__init__(model_class)\n",
"self.values = values\n",
"self.on_conflict = self.model_class._meta.on_conflict\n",
"self.return_id = self.model_class._meta.primary_key\n",
"@inlineCallbacks...\n",
"query = self.database.generate_insert(self)\n",
"if self.return_id:\n",
"result = yield self.database.runQuery(query)\n",
"yield self.database.runOperation(query)\n",
"if result and self.model_class._meta.primary_key:\n",
"returnValue(None)\n",
"returnValue(result[0][0])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
4,
4,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_23, VAR_20=None, VAR_21=None, VAR_22=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = self.metadata('plugins', VAR_20=database, VAR_21=table, VAR_22=\n fallback)\n",
"if VAR_38 is None:\n",
"return None\n",
"return VAR_38.get(VAR_23)\n"
] | [
"def plugin_config(self, plugin_name, database=None, table=None, fallback=True):...\n",
"\"\"\"docstring\"\"\"\n",
"plugins = self.metadata('plugins', database=database, table=table, fallback\n =fallback)\n",
"if plugins is None:\n",
"return None\n",
"return plugins.get(plugin_name)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_5(self, VAR_3, **VAR_6):...\n",
"logging.warn('url_read_json(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n",
"if not self._requests:\n",
"return None\n",
"VAR_6.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == VAR_3:\n",
"self.fail('Unknown request %s' % VAR_3)\n",
"VAR_9 = self._requests.pop(i)\n",
"if len(VAR_9) != 3:\n",
"self.fail('Expected json request, got normal data; %s' % VAR_3)\n",
"VAR_10, VAR_11, VAR_12 = VAR_9\n",
"if callable(VAR_11):\n",
"VAR_11(VAR_6)\n",
"self.assertEqual(VAR_11, VAR_6)\n",
"if VAR_12 is not None:\n",
"return VAR_12\n",
"return None\n"
] | [
"def _url_read_json(self, url, **kwargs):...\n",
"logging.warn('url_read_json(%s, %s)', url[:500], str(kwargs)[:500])\n",
"if not self._requests:\n",
"return None\n",
"kwargs.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == url:\n",
"self.fail('Unknown request %s' % url)\n",
"data = self._requests.pop(i)\n",
"if len(data) != 3:\n",
"self.fail('Expected json request, got normal data; %s' % url)\n",
"_, expected_kwargs, result = data\n",
"if callable(expected_kwargs):\n",
"expected_kwargs(kwargs)\n",
"self.assertEqual(expected_kwargs, kwargs)\n",
"if result is not None:\n",
"return result\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_7):...\n",
"VAR_10, VAR_11 = self.validate_row(VAR_7)\n",
"if VAR_10:\n",
"VAR_15, VAR_16, VAR_17 = VAR_7\n",
"return VAR_10, VAR_11\n",
"VAR_18 = int(time())\n",
"VAR_19 = VAR_18, VAR_15, VAR_16, VAR_17\n",
"VAR_9 = 'INSERT INTO {} ({}) VALUES {}'.format(VAR_1, VAR_3, str(VAR_19))\n",
"self.connection.execute(VAR_9)\n",
"self.connection.commit()\n"
] | [
"def insert(self, input_row):...\n",
"is_valid, violations = self.validate_row(input_row)\n",
"if is_valid:\n",
"name, location, description = input_row\n",
"return is_valid, violations\n",
"date = int(time())\n",
"args = date, name, location, description\n",
"stmt = 'INSERT INTO {} ({}) VALUES {}'.format(tb_name, columns, str(args))\n",
"self.connection.execute(stmt)\n",
"self.connection.commit()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"if self._IsServerAlive():\n",
"self._server_popen.terminate()\n",
"utils.RemoveIfExists(self._temp_options_filename)\n"
] | [
"def _ServerCleanup(self):...\n",
"if self._IsServerAlive():\n",
"self._server_popen.terminate()\n",
"utils.RemoveIfExists(self._temp_options_filename)\n"
] | [
0,
0,
0,
7
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"async def FUNC_2(VAR_0, VAR_1):...\n",
"if VAR_1.content.startswith('user add '):\n",
"VAR_7 = VAR_1.content.split()[2:]\n",
"if db.rank_check(VAR_1.author.id, 'user add') and len(VAR_7\n",
"db.update(\"INSERT INTO {} (id, nickname, rank) VALUES ('{}', '{}', 'member');\"\n .format(db.user_table, VAR_7[0], VAR_7[1]))\n"
] | [
"async def user_add(bot, message):...\n",
"if message.content.startswith('user add '):\n",
"msg = message.content.split()[2:]\n",
"if db.rank_check(message.author.id, 'user add') and len(msg\n",
"db.update(\"INSERT INTO {} (id, nickname, rank) VALUES ('{}', '{}', 'member');\"\n .format(db.user_table, msg[0], msg[1]))\n"
] | [
0,
0,
0,
0,
4
] | [
"AsyncFunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_56(self):...\n",
"self.run_example('binding.py')\n",
"VAR_10 = self.b_mgr.get_issue_list()\n",
"VAR_11 = VAR_10[0].get_code().splitlines()\n",
"VAR_12 = VAR_10[0].lineno\n",
"self.assertEqual('%i ' % (VAR_12 - 1), VAR_11[0][:2])\n",
"self.assertEqual('%i ' % VAR_12, VAR_11[1][:2])\n",
"self.assertEqual('%i ' % (VAR_12 + 1), VAR_11[2][:2])\n"
] | [
"def test_code_line_numbers(self):...\n",
"self.run_example('binding.py')\n",
"issues = self.b_mgr.get_issue_list()\n",
"code_lines = issues[0].get_code().splitlines()\n",
"lineno = issues[0].lineno\n",
"self.assertEqual('%i ' % (lineno - 1), code_lines[0][:2])\n",
"self.assertEqual('%i ' % lineno, code_lines[1][:2])\n",
"self.assertEqual('%i ' % (lineno + 1), code_lines[2][:2])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"self._hosts_cache = None\n",
"for VAR_12 in self.parent_groups:\n",
"VAR_12.clear_hosts_cache()\n"
] | [
"def clear_hosts_cache(self):...\n",
"self._hosts_cache = None\n",
"for g in self.parent_groups:\n",
"g.clear_hosts_cache()\n"
] | [
0,
0,
1,
1
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_11(VAR_10, VAR_11):...\n",
"VAR_13 = ''\n",
"for product in VAR_11['products']:\n",
"VAR_13 += '('\n",
"VAR_13 = VAR_13[:-1]\n",
"VAR_13 += str(VAR_10['id'])\n",
"return VAR_13\n",
"VAR_13 += ','\n",
"VAR_13 += str(product['product']['productId'])\n",
"VAR_13 += ','\n",
"VAR_13 += str(product['product']['quantity'])\n",
"VAR_13 += '),'\n"
] | [
"def create_invoice_products_values_query(invoiceId, products):...\n",
"invoice_products_values = ''\n",
"for product in products['products']:\n",
"invoice_products_values += '('\n",
"invoice_products_values = invoice_products_values[:-1]\n",
"invoice_products_values += str(invoiceId['id'])\n",
"return invoice_products_values\n",
"invoice_products_values += ','\n",
"invoice_products_values += str(product['product']['productId'])\n",
"invoice_products_values += ','\n",
"invoice_products_values += str(product['product']['quantity'])\n",
"invoice_products_values += '),'\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"AugAssign'",
"Assign'",
"AugAssign'",
"Return'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'"
] |
[
"def FUNC_45(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertTrue(tournament.playerStandings())\n"
] | [
"def test_list_win_ranking(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertTrue(tournament.playerStandings())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"@staticmethod...\n",
"VAR_3 = AnalysisController.get_report(VAR_0)\n",
"VAR_3 = VAR_3['analysis']\n",
"VAR_5 = VAR_3['info']['analysis_path']\n",
"VAR_6 = 0\n",
"for directory in VAR_1:\n",
"VAR_14 = '%s/%s' % (VAR_5, directory)\n",
"for filename in VAR_2:\n",
"if os.path.isdir(VAR_14):\n",
"VAR_14 = '%s/%s' % (VAR_5, filename)\n",
"VAR_7 = VAR_6 / 6.5\n",
"VAR_6 += get_directory_size(VAR_14)\n",
"if os.path.isfile(VAR_14):\n",
"return {'size': int(VAR_7), 'size_human': filesizeformat(VAR_7)}\n",
"VAR_6 += os.path.getsize(VAR_14)\n"
] | [
"@staticmethod...\n",
"report = AnalysisController.get_report(task_id)\n",
"report = report['analysis']\n",
"path = report['info']['analysis_path']\n",
"size_total = 0\n",
"for directory in taken_dirs:\n",
"destination = '%s/%s' % (path, directory)\n",
"for filename in taken_files:\n",
"if os.path.isdir(destination):\n",
"destination = '%s/%s' % (path, filename)\n",
"size_estimated = size_total / 6.5\n",
"size_total += get_directory_size(destination)\n",
"if os.path.isfile(destination):\n",
"return {'size': int(size_estimated), 'size_human': filesizeformat(\n size_estimated)}\n",
"size_total += os.path.getsize(destination)\n"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"Condition",
"Return'",
"AugAssign'"
] |
[
"def __init__(self, VAR_6=None, VAR_7=None):...\n",
"super(CLASS_1, self).__init__()\n",
"self._error_msg = VAR_6\n",
"self.disclaimer_banner_file = VAR_7\n"
] | [
"def __init__(self, error_msg=None, disclaimer_banner_file=None):...\n",
"super(LoginWebSite, self).__init__()\n",
"self._error_msg = error_msg\n",
"self.disclaimer_banner_file = disclaimer_banner_file\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_0(VAR_0):...\n",
"VAR_2 = Post.objects.order_by('pub_date')\n",
"return render(VAR_0, 'posts/home.html', {'posts': VAR_2})\n"
] | [
"def home(request):...\n",
"posts = Post.objects.order_by('pub_date')\n",
"return render(request, 'posts/home.html', {'posts': posts})\n"
] | [
0,
6,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self, VAR_3, **VAR_6):...\n",
"logging.warn('url_read_json(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n",
"if not self._requests:\n",
"return None\n",
"VAR_6.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == VAR_3:\n",
"self.fail('Unknown request %s' % VAR_3)\n",
"VAR_9 = self._requests.pop(i)\n",
"if len(VAR_9) != 3:\n",
"self.fail('Expected json request, got normal data; %s' % VAR_3)\n",
"VAR_10, VAR_11, VAR_12 = VAR_9\n",
"if callable(VAR_11):\n",
"VAR_11(VAR_6)\n",
"self.assertEqual(VAR_11, VAR_6)\n",
"if VAR_12 is not None:\n",
"return VAR_12\n",
"return None\n"
] | [
"def _url_read_json(self, url, **kwargs):...\n",
"logging.warn('url_read_json(%s, %s)', url[:500], str(kwargs)[:500])\n",
"if not self._requests:\n",
"return None\n",
"kwargs.pop('stream', None)\n",
"for i, n in enumerate(self._requests):\n",
"if n[0] == url:\n",
"self.fail('Unknown request %s' % url)\n",
"data = self._requests.pop(i)\n",
"if len(data) != 3:\n",
"self.fail('Expected json request, got normal data; %s' % url)\n",
"_, expected_kwargs, result = data\n",
"if callable(expected_kwargs):\n",
"expected_kwargs(kwargs)\n",
"self.assertEqual(expected_kwargs, kwargs)\n",
"if result is not None:\n",
"return result\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_16(self):...\n",
"return False\n"
] | [
"def do_existing_paths(self):...\n",
"return False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __setstate__(self, VAR_0):...\n",
"return self.deserialize(VAR_0)\n"
] | [
"def __setstate__(self, data):...\n",
"return self.deserialize(data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(VAR_14, VAR_19, VAR_3=None, VAR_4=None, VAR_5=None, VAR_2=VAR_0,...\n",
"if VAR_14.method == 'GET':\n",
"VAR_27 = {'title': VAR_19}\n",
"return HttpResponseNotAllowed(['GET'])\n",
"if VAR_3 is not None:\n",
"VAR_8 = get_object_or_404(VAR_5, **{group_slug_field: group_slug})\n",
"VAR_46 = VAR_47 = True\n",
"VAR_27.update({'content_type': get_ct(VAR_8), 'object_id': VAR_8.id})\n",
"if not VAR_46:\n",
"VAR_46 = FUNC_3(VAR_14.user, VAR_8, VAR_12, VAR_13)\n",
"return HttpResponseForbidden()\n",
"VAR_28 = get_object_or_404(VAR_2, **article_args)\n",
"VAR_47 = FUNC_4(VAR_14.user, VAR_8, VAR_12)\n",
"VAR_55 = VAR_28.changeset_set.all().order_by('-revision')\n",
"VAR_48 = {'article': VAR_28, 'changes': VAR_55, 'allow_write': VAR_47}\n",
"if VAR_3 is not None:\n",
"VAR_48['group'] = VAR_8\n",
"if VAR_18 is not None:\n",
"VAR_48.update(VAR_18)\n",
"return render_to_response('/'.join([VAR_17, VAR_16]), VAR_48,\n context_instance=RequestContext(request))\n"
] | [
"def article_history(request, title, group_slug=None, group_slug_field=None,...\n",
"if request.method == 'GET':\n",
"article_args = {'title': title}\n",
"return HttpResponseNotAllowed(['GET'])\n",
"if group_slug is not None:\n",
"group = get_object_or_404(group_qs, **{group_slug_field: group_slug})\n",
"allow_read = allow_write = True\n",
"article_args.update({'content_type': get_ct(group), 'object_id': group.id})\n",
"if not allow_read:\n",
"allow_read = has_read_perm(request.user, group, is_member, is_private)\n",
"return HttpResponseForbidden()\n",
"article = get_object_or_404(article_qs, **article_args)\n",
"allow_write = has_write_perm(request.user, group, is_member)\n",
"changes = article.changeset_set.all().order_by('-revision')\n",
"template_params = {'article': article, 'changes': changes, 'allow_write':\n allow_write}\n",
"if group_slug is not None:\n",
"template_params['group'] = group\n",
"if extra_context is not None:\n",
"template_params.update(extra_context)\n",
"return render_to_response('/'.join([template_dir, template_name]),\n template_params, context_instance=RequestContext(request))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"import pymysql\n",
"def FUNC_0():...\n",
"VAR_3 = pymysql.connect(host='localhost', user='root', passwd='', db='ebola')\n",
"print('connection error: ', error)\n",
"return VAR_3\n"
] | [
"import pymysql\n",
"def create_connection():...\n",
"connection = pymysql.connect(host='localhost', user='root', passwd='', db=\n 'ebola')\n",
"print('connection error: ', error)\n",
"return connection\n"
] | [
0,
0,
0,
0,
0
] | [
"Import'",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"from flask import request\n",
"from flask_jwt_extended import jwt_required\n",
"from flask_restplus import Namespace, Resource, fields, reqparse\n",
"from utilities import database_utilities\n",
"VAR_0 = Namespace('spaces', description='Information relating to spaces')\n",
"def FUNC_0(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = reqparse.RequestParser()\n",
"VAR_2.add_argument('building_id')\n",
"VAR_3 = VAR_2.parse_args()\n",
"VAR_4 = 'WHERE building_id = %s' if VAR_3['building_id'] else ''\n",
"VAR_5 = f'SELECT * FROM spaces {VAR_4}'\n",
"VAR_6 = VAR_3['building_id'],\n",
"return database_utilities.execute_query(VAR_5, VAR_6)\n"
] | [
"from flask import request\n",
"from flask_jwt_extended import jwt_required\n",
"from flask_restplus import Namespace, Resource, fields, reqparse\n",
"from utilities import database_utilities\n",
"api = Namespace('spaces', description='Information relating to spaces')\n",
"def get(self):...\n",
"\"\"\"docstring\"\"\"\n",
"parser = reqparse.RequestParser()\n",
"parser.add_argument('building_id')\n",
"args = parser.parse_args()\n",
"where_query = 'WHERE building_id = %s' if args['building_id'] else ''\n",
"query = f'SELECT * FROM spaces {where_query}'\n",
"parameters = args['building_id'],\n",
"return database_utilities.execute_query(query, parameters)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.fileExists(VAR_8):\n",
"VAR_7 = \"SELECT meta FROM {0} where path='{1}';\".format(VAR_2, VAR_8)\n",
"print(\"getMetadata: file doesn't exist!\")\n",
"VAR_4 = self._run_command(VAR_7)\n",
"VAR_4 = None\n",
"VAR_4 = VAR_4[0][0]\n",
"VAR_4 = None\n",
"return VAR_4\n"
] | [
"def getMetadata(self, pth):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.fileExists(pth):\n",
"command = \"SELECT meta FROM {0} where path='{1}';\".format(TABLE_NAME, pth)\n",
"print(\"getMetadata: file doesn't exist!\")\n",
"data = self._run_command(command)\n",
"data = None\n",
"data = data[0][0]\n",
"data = None\n",
"return data\n"
] | [
0,
0,
0,
4,
0,
4,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import sqlite3\n",
"import os\n",
"from collections import defaultdict\n",
"from HistoryEdge import HistoryEdge\n",
"from HistoryGraph import HistoryGraph\n",
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"os.remove(VAR_1)\n",
"VAR_13 = sqlite3.connect(VAR_1)\n",
"VAR_13.execute('string')\n",
"VAR_13.execute('DELETE FROM edge')\n",
"for VAR_27 in VAR_0.objects:\n",
"VAR_23 = VAR_0.objects[VAR_27]\n",
"VAR_13.commit()\n",
"for document in VAR_23:\n",
"VAR_13.close()\n",
"VAR_39 = document.history\n",
"os.remove(VAR_2)\n",
"VAR_10 = sqlite3.connect(VAR_2)\n",
"VAR_38 = VAR_39.edges[VAR_30]\n",
"VAR_5 = defaultdict(list)\n",
"VAR_26 = list(VAR_38.startnodes)\n",
"for classname in VAR_0.classes:\n",
"if len(VAR_38.startnodes) == 1:\n",
"VAR_24 = VAR_0.classes[classname]\n",
"VAR_6 = defaultdict(list)\n",
"VAR_31 = VAR_26[0]\n",
"if len(VAR_38.startnodes) == 2:\n",
"VAR_14 = [VAR_45 for VAR_45 in dir(VAR_24) if not VAR_45.startswith('__') and\n not callable(getattr(VAR_24, VAR_45))]\n",
"for classname in VAR_0.classes:\n",
"VAR_32 = ''\n",
"VAR_31 = VAR_26[0]\n",
"assert False\n",
"for VAR_45 in VAR_14:\n",
"VAR_24 = VAR_0.classes[classname]\n",
"for k in VAR_5:\n",
"if VAR_38.propertytype is None:\n",
"VAR_32 = VAR_26[1]\n",
"if isinstance(getattr(VAR_24, VAR_45), FieldList):\n",
"VAR_14 = [VAR_45 for VAR_45 in dir(VAR_24) if not VAR_45.startswith('__') and\n not callable(getattr(VAR_24, VAR_45))]\n",
"for classname, VAR_45 in VAR_5[k]:\n",
"for classname in VAR_6:\n",
"VAR_42 = ''\n",
"VAR_42 = VAR_38.propertytype.__name__\n",
"VAR_5[getattr(VAR_24, VAR_45).theclass.__name__].append((classname, VAR_45))\n",
"for VAR_45 in VAR_14:\n",
"VAR_6[k].append((classname + 'id', 'text'))\n",
"VAR_25 = VAR_6[classname]\n",
"for VAR_27 in VAR_0.objects:\n",
"VAR_13.execute(\"INSERT INTO edge VALUES ('\" + document.id + \"', '\" +\n document.__class__.__name__ + \"', '\" + VAR_38.__class__.__name__ +\n \"', '\" + VAR_38.edgeid + \"', \" + \"'\" + VAR_31 + \"', '\" + VAR_32 +\n \"', '\" + VAR_38.endnode + \"', '\" + VAR_38.propertyownerid + \"', '\" +\n VAR_38.propertyname + \"', '\" + str(VAR_38.propertyvalue) + \"', '\" +\n VAR_42 + \"')\")\n",
"if isinstance(getattr(VAR_24, VAR_45), FieldList) == False:\n",
"VAR_16 = 'CREATE TABLE ' + classname + ' (id text '\n",
"FUNC_1(VAR_10, VAR_0.objects[VAR_27][0], None, VAR_5, VAR_6)\n",
"VAR_10.commit()\n",
"VAR_6[classname].append((VAR_45, 'int' if isinstance(getattr(VAR_24, VAR_45\n ), FieldInt) else 'text'))\n",
"for VAR_45, thetype in VAR_25:\n",
"def FUNC_1(self, VAR_3, VAR_4, VAR_5, VAR_6):...\n",
"VAR_16 += ','\n",
"VAR_16 += ')'\n",
"VAR_14 = [VAR_45 for VAR_45 in dir(VAR_3.__class__) if not VAR_45.\n startswith('__') and not callable(getattr(VAR_3.__class__, VAR_45))]\n",
"VAR_16 += VAR_45 + ' ' + thetype\n",
"VAR_10.execute(VAR_16)\n",
"for VAR_45 in VAR_14:\n",
"if isinstance(getattr(VAR_3.__class__, VAR_45), FieldList):\n",
"VAR_15 = ''\n",
"for childobj in getattr(VAR_3, VAR_45):\n",
"if VAR_3.__class__.__name__ in VAR_5:\n",
"self.SaveDocumentObject(childobj, VAR_3, VAR_5, VAR_6)\n",
"if len(VAR_5[VAR_3.__class__.__name__]) == 0:\n",
"VAR_16 = ('INSERT INTO ' + VAR_3.__class__.__name__ + \" VALUES ('\" + VAR_3.\n id + \"'\")\n",
"if len(VAR_5[VAR_3.__class__.__name__]) == 1:\n",
"for columnname, columntype in VAR_6[VAR_3.__class__.__name__]:\n",
"VAR_15, VAR_45 = VAR_5[VAR_3.__class__.__name__][0]\n",
"assert False\n",
"if columntype == 'int':\n",
"VAR_16 += ')'\n",
"VAR_41 = ''\n",
"if columntype == 'text':\n",
"self.database.execute(VAR_16)\n",
"VAR_16 += ','\n",
"VAR_41 = \"'\"\n",
"assert False\n",
"VAR_7 = False\n",
"if VAR_15 != '' and VAR_15 + 'id' == columnname:\n",
"VAR_41 = ''\n",
"VAR_8 = ''\n",
"VAR_16 += VAR_41 + VAR_4.id + VAR_41\n",
"VAR_16 += VAR_41 + str(getattr(VAR_3, columnname)) + VAR_41\n",
"def FUNC_2(VAR_0, VAR_1, VAR_9):...\n",
"VAR_13 = sqlite3.connect(VAR_1)\n",
"for VAR_38 in VAR_9:\n",
"VAR_26 = list(VAR_38.startnodes)\n",
"VAR_13.commit()\n",
"if len(VAR_38.startnodes) == 1:\n",
"VAR_13.close()\n",
"VAR_31 = VAR_26[0]\n",
"if len(VAR_38.startnodes) == 2:\n",
"def FUNC_1(VAR_10, VAR_3, VAR_4, VAR_5, VAR_6):...\n",
"VAR_32 = ''\n",
"VAR_31 = VAR_26[0]\n",
"assert False\n",
"VAR_14 = [VAR_45 for VAR_45 in dir(VAR_3.__class__) if not VAR_45.\n startswith('__') and not callable(getattr(VAR_3.__class__, VAR_45))]\n",
"if VAR_38.propertytype is None:\n",
"VAR_32 = VAR_26[1]\n",
"for VAR_45 in VAR_14:\n",
"VAR_42 = ''\n",
"VAR_42 = VAR_38.propertytype\n",
"if isinstance(getattr(VAR_3.__class__, VAR_45), FieldList):\n",
"VAR_15 = ''\n",
"if VAR_31 == '':\n",
"for childobj in getattr(VAR_3, VAR_45):\n",
"if VAR_3.__class__.__name__ in VAR_5:\n",
"if VAR_8 == '':\n",
"VAR_13.execute(\"INSERT OR IGNORE INTO edge VALUES ('\" + VAR_38.documentid +\n \"', '\" + VAR_38.documentclassname + \"', '\" + VAR_38.__class__.__name__ +\n \"', '\" + VAR_38.edgeid + \"', \" + \"'\" + VAR_31 + \"', '\" + VAR_32 +\n \"', '\" + VAR_38.endnode + \"', '\" + VAR_38.propertyownerid + \"', '\" +\n VAR_38.propertyname + \"', '\" + str(VAR_38.propertyvalue) + \"', '\" +\n VAR_42 + \"')\")\n",
"FUNC_1(VAR_10, childobj, VAR_3, VAR_5, VAR_6)\n",
"if len(VAR_5[VAR_3.__class__.__name__]) == 0:\n",
"VAR_16 = ('INSERT INTO ' + VAR_3.__class__.__name__ + \" VALUES ('\" + VAR_3.\n id + \"'\")\n",
"VAR_8 = VAR_38.edgeid\n",
"assert VAR_7 == False or VAR_8 == VAR_38.edgeid\n",
"if len(VAR_5[VAR_3.__class__.__name__]) == 1:\n",
"for columnname, columntype in VAR_6[VAR_3.__class__.__name__]:\n",
"VAR_7 = True\n",
"VAR_15, VAR_45 = VAR_5[VAR_3.__class__.__name__][0]\n",
"assert False\n",
"if columntype == 'int':\n",
"VAR_16 += ')'\n",
"VAR_41 = ''\n",
"if columntype == 'text':\n",
"VAR_10.execute(VAR_16)\n",
"VAR_16 += ','\n",
"VAR_41 = \"'\"\n",
"assert False\n",
"def FUNC_3(self, VAR_11):...\n",
"if VAR_15 != '' and VAR_15 + 'id' == columnname:\n",
"VAR_41 = ''\n",
"VAR_17 = list()\n",
"VAR_16 += VAR_41 + VAR_4.id + VAR_41\n",
"VAR_16 += VAR_41 + str(getattr(VAR_3, columnname)) + VAR_41\n",
"VAR_18 = self.database.cursor()\n",
"VAR_18.execute(VAR_11)\n",
"VAR_19 = VAR_18.fetchall()\n",
"for row in VAR_19:\n",
"for classname in self.documentsbyclass:\n",
"return VAR_17\n",
"for obj in self.documentsbyclass[classname]:\n",
"if obj.id == row[0]:\n",
"VAR_17.append(obj)\n"
] | [
"import sqlite3\n",
"import os\n",
"from collections import defaultdict\n",
"from HistoryEdge import HistoryEdge\n",
"from HistoryGraph import HistoryGraph\n",
"def SaveDocumentCollection(dc, filenameedges, filenamedata):...\n",
"os.remove(filenameedges)\n",
"c = sqlite3.connect(filenameedges)\n",
"c.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS edge (\n documentid text, \n documentclassname text, \n edgeclassname text, \n edgeid text PRIMARY KEY, \n startnode1id text, \n startnode2id text, \n endnodeid text, \n propertyownerid text, \n propertyname text, \n propertyvalue text, \n propertytype text\n )\"\"\"\n )\n",
"c.execute('DELETE FROM edge')\n",
"for documentid in dc.objects:\n",
"documentlist = dc.objects[documentid]\n",
"c.commit()\n",
"for document in documentlist:\n",
"c.close()\n",
"history = document.history\n",
"os.remove(filenamedata)\n",
"database = sqlite3.connect(filenamedata)\n",
"edge = history.edges[edgeid]\n",
"foreignkeydict = defaultdict(list)\n",
"startnodes = list(edge.startnodes)\n",
"for classname in dc.classes:\n",
"if len(edge.startnodes) == 1:\n",
"theclass = dc.classes[classname]\n",
"columndict = defaultdict(list)\n",
"startnode1id = startnodes[0]\n",
"if len(edge.startnodes) == 2:\n",
"variables = [a for a in dir(theclass) if not a.startswith('__') and not\n callable(getattr(theclass, a))]\n",
"for classname in dc.classes:\n",
"startnode2id = ''\n",
"startnode1id = startnodes[0]\n",
"assert False\n",
"for a in variables:\n",
"theclass = dc.classes[classname]\n",
"for k in foreignkeydict:\n",
"if edge.propertytype is None:\n",
"startnode2id = startnodes[1]\n",
"if isinstance(getattr(theclass, a), FieldList):\n",
"variables = [a for a in dir(theclass) if not a.startswith('__') and not\n callable(getattr(theclass, a))]\n",
"for classname, a in foreignkeydict[k]:\n",
"for classname in columndict:\n",
"propertytypename = ''\n",
"propertytypename = edge.propertytype.__name__\n",
"foreignkeydict[getattr(theclass, a).theclass.__name__].append((classname, a))\n",
"for a in variables:\n",
"columndict[k].append((classname + 'id', 'text'))\n",
"columnlist = columndict[classname]\n",
"for documentid in dc.objects:\n",
"c.execute(\"INSERT INTO edge VALUES ('\" + document.id + \"', '\" + document.\n __class__.__name__ + \"', '\" + edge.__class__.__name__ + \"', '\" + edge.\n edgeid + \"', \" + \"'\" + startnode1id + \"', '\" + startnode2id + \"', '\" +\n edge.endnode + \"', '\" + edge.propertyownerid + \"', '\" + edge.\n propertyname + \"', '\" + str(edge.propertyvalue) + \"', '\" +\n propertytypename + \"')\")\n",
"if isinstance(getattr(theclass, a), FieldList) == False:\n",
"sql = 'CREATE TABLE ' + classname + ' (id text '\n",
"SaveDocumentObject(database, dc.objects[documentid][0], None,\n foreignkeydict, columndict)\n",
"database.commit()\n",
"columndict[classname].append((a, 'int' if isinstance(getattr(theclass, a),\n FieldInt) else 'text'))\n",
"for a, thetype in columnlist:\n",
"def SaveDocumentObject(self, documentobject, parentobject, foreignkeydict,...\n",
"sql += ','\n",
"sql += ')'\n",
"variables = [a for a in dir(documentobject.__class__) if not a.startswith(\n '__') and not callable(getattr(documentobject.__class__, a))]\n",
"sql += a + ' ' + thetype\n",
"database.execute(sql)\n",
"for a in variables:\n",
"if isinstance(getattr(documentobject.__class__, a), FieldList):\n",
"foreignkeyclassname = ''\n",
"for childobj in getattr(documentobject, a):\n",
"if documentobject.__class__.__name__ in foreignkeydict:\n",
"self.SaveDocumentObject(childobj, documentobject, foreignkeydict, columndict)\n",
"if len(foreignkeydict[documentobject.__class__.__name__]) == 0:\n",
"sql = ('INSERT INTO ' + documentobject.__class__.__name__ + \" VALUES ('\" +\n documentobject.id + \"'\")\n",
"if len(foreignkeydict[documentobject.__class__.__name__]) == 1:\n",
"for columnname, columntype in columndict[documentobject.__class__.__name__]:\n",
"foreignkeyclassname, a = foreignkeydict[documentobject.__class__.__name__][0]\n",
"assert False\n",
"if columntype == 'int':\n",
"sql += ')'\n",
"quote = ''\n",
"if columntype == 'text':\n",
"self.database.execute(sql)\n",
"sql += ','\n",
"quote = \"'\"\n",
"assert False\n",
"firstsaved = False\n",
"if foreignkeyclassname != '' and foreignkeyclassname + 'id' == columnname:\n",
"quote = ''\n",
"firstsavededgeid = ''\n",
"sql += quote + parentobject.id + quote\n",
"sql += quote + str(getattr(documentobject, columnname)) + quote\n",
"def SaveEdges(dc, filenameedges, edges):...\n",
"c = sqlite3.connect(filenameedges)\n",
"for edge in edges:\n",
"startnodes = list(edge.startnodes)\n",
"c.commit()\n",
"if len(edge.startnodes) == 1:\n",
"c.close()\n",
"startnode1id = startnodes[0]\n",
"if len(edge.startnodes) == 2:\n",
"def SaveDocumentObject(database, documentobject, parentobject,...\n",
"startnode2id = ''\n",
"startnode1id = startnodes[0]\n",
"assert False\n",
"variables = [a for a in dir(documentobject.__class__) if not a.startswith(\n '__') and not callable(getattr(documentobject.__class__, a))]\n",
"if edge.propertytype is None:\n",
"startnode2id = startnodes[1]\n",
"for a in variables:\n",
"propertytypename = ''\n",
"propertytypename = edge.propertytype\n",
"if isinstance(getattr(documentobject.__class__, a), FieldList):\n",
"foreignkeyclassname = ''\n",
"if startnode1id == '':\n",
"for childobj in getattr(documentobject, a):\n",
"if documentobject.__class__.__name__ in foreignkeydict:\n",
"if firstsavededgeid == '':\n",
"c.execute(\"INSERT OR IGNORE INTO edge VALUES ('\" + edge.documentid + \"', '\" +\n edge.documentclassname + \"', '\" + edge.__class__.__name__ + \"', '\" +\n edge.edgeid + \"', \" + \"'\" + startnode1id + \"', '\" + startnode2id +\n \"', '\" + edge.endnode + \"', '\" + edge.propertyownerid + \"', '\" + edge.\n propertyname + \"', '\" + str(edge.propertyvalue) + \"', '\" +\n propertytypename + \"')\")\n",
"SaveDocumentObject(database, childobj, documentobject, foreignkeydict,\n columndict)\n",
"if len(foreignkeydict[documentobject.__class__.__name__]) == 0:\n",
"sql = ('INSERT INTO ' + documentobject.__class__.__name__ + \" VALUES ('\" +\n documentobject.id + \"'\")\n",
"firstsavededgeid = edge.edgeid\n",
"assert firstsaved == False or firstsavededgeid == edge.edgeid\n",
"if len(foreignkeydict[documentobject.__class__.__name__]) == 1:\n",
"for columnname, columntype in columndict[documentobject.__class__.__name__]:\n",
"firstsaved = True\n",
"foreignkeyclassname, a = foreignkeydict[documentobject.__class__.__name__][0]\n",
"assert False\n",
"if columntype == 'int':\n",
"sql += ')'\n",
"quote = ''\n",
"if columntype == 'text':\n",
"database.execute(sql)\n",
"sql += ','\n",
"quote = \"'\"\n",
"assert False\n",
"def GetSQLObjects(self, query):...\n",
"if foreignkeyclassname != '' and foreignkeyclassname + 'id' == columnname:\n",
"quote = ''\n",
"ret = list()\n",
"sql += quote + parentobject.id + quote\n",
"sql += quote + str(getattr(documentobject, columnname)) + quote\n",
"cur = self.database.cursor()\n",
"cur.execute(query)\n",
"rows = cur.fetchall()\n",
"for row in rows:\n",
"for classname in self.documentsbyclass:\n",
"return ret\n",
"for obj in self.documentsbyclass[classname]:\n",
"if obj.id == row[0]:\n",
"ret.append(obj)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
4,
0,
4,
4,
4,
0,
4,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"For",
"Assign'",
"Expr'",
"For",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assert'",
"For",
"Assign'",
"For",
"Condition",
"Assign'",
"Condition",
"Assign'",
"For",
"For",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Assign'",
"For",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"For",
"FunctionDef'",
"AugAssign'",
"AugAssign'",
"Assign'",
"AugAssign'",
"Expr'",
"For",
"Condition",
"Assign'",
"For",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"For",
"Assign'",
"Assert'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"Expr'",
"AugAssign'",
"Assign'",
"Assert'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"AugAssign'",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"FunctionDef'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"For",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assert'",
"Condition",
"For",
"Assign'",
"Assign'",
"Assert'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"Expr'",
"AugAssign'",
"Assign'",
"Assert'",
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"AugAssign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"For",
"Return'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_24(self, *VAR_71, **VAR_72):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.params = VAR_71, VAR_72\n",
"return VAR_101\n"
] | [
"def params(self, *params, **kwparams):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.params = params, kwparams\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"self.compilation_ok('string')\n"
] | [
"def test_vacationext_medium(self):...\n",
"self.compilation_ok(\n \"\"\"\nrequire \"vacation\";\nif header :contains \"subject\" \"lunch\" {\n vacation :handle \"ran-away\" \"I'm out and can't meet for lunch\";\n} else {\n vacation :handle \"ran-away\" \"I'm out\";\n}\n\"\"\"\n )\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"self.run_test_case(self.scenario.create_app())\n"
] | [
"def test_a_create_app(self):...\n",
"self.run_test_case(self.scenario.create_app())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.benchmark = VAR_74\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.benchmark = benchmark\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.