lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def __call__(self, VAR_2, VAR_3, VAR_4=None):...\n",
"if VAR_3.strip():\n",
"return\n",
"print('disconnecting for respawn')\n",
"self.XMPP.disconnect(reconnect=False, wait=True)\n",
"print('preparing and running execv')\n",
"os.chdir(self.cwd)\n",
"os.execv(self.argv[0], self.argv)\n"
] | [
"def __call__(self, msg, arguments, errorSink=None):...\n",
"if arguments.strip():\n",
"return\n",
"print('disconnecting for respawn')\n",
"self.XMPP.disconnect(reconnect=False, wait=True)\n",
"print('preparing and running execv')\n",
"os.chdir(self.cwd)\n",
"os.execv(self.argv[0], self.argv)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_42, VAR_43):...\n",
"if not VAR_101.user_is_loggedin or VAR_101.user.needs_captcha():\n",
"if not captcha.valid_solution(VAR_42, VAR_43):\n",
"VAR_101.errors.add(errors.BAD_CAPTCHA)\n"
] | [
"def run(self, iden, solution):...\n",
"if not c.user_is_loggedin or c.user.needs_captcha():\n",
"if not captcha.valid_solution(iden, solution):\n",
"c.errors.add(errors.BAD_CAPTCHA)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'"
] |
[
"def FUNC_16(self, VAR_15, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = self.cursor.execute(\n 'select listid from lists where listhash = \"%s\"' % VAR_15).fetchall()[0]\n",
"print('removing itemind, listid: %s, %s' % (VAR_16, VAR_32[0]))\n",
"VAR_30 = self.cursor.execute(\n 'delete from listi... | [
"def removefromlist(self, listhash, itemind):...\n",
"\"\"\"docstring\"\"\"\n",
"listid = self.cursor.execute(\n 'select listid from lists where listhash = \"%s\"' % listhash).fetchall()[0]\n",
"print('removing itemind, listid: %s, %s' % (itemind, listid[0]))\n",
"r = self.cursor.execute(\n 'delete fr... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_4, VAR_5, VAR_7=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5['output'] = 'XML'\n",
"VAR_16, VAR_17 = self._cliq_run(VAR_4, VAR_5, VAR_7)\n",
"VAR_0.debug(_('CLIQ command returned %s'), VAR_16)\n",
"VAR_18 = etree.fromstring(VAR_16)\n",
"if VAR_7:\n",
"VAR_41 = VAR_18.find('res... | [
"def _cliq_run_xml(self, verb, cliq_args, check_cliq_result=True):...\n",
"\"\"\"docstring\"\"\"\n",
"cliq_args['output'] = 'XML'\n",
"out, _err = self._cliq_run(verb, cliq_args, check_cliq_result)\n",
"LOG.debug(_('CLIQ command returned %s'), out)\n",
"result_xml = etree.fromstring(out)\n",
"if check_c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n",
"VAR_7 = []\n",
"VAR_8 = self.pool.get('ir.model.data')\n",
"VAR_9 = self.pool.get('account.bank.statement')\n",
"VAR_10 = self.pool.get('acc... | [
"def close_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\n",
"statement_obj = self.pool.get('account.bank.statement')\n",
"journa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"... |
[
"@api.public...\n",
"VAR_6.fail('Handler code should not be called')\n"
] | [
"@api.public...\n",
"test.fail('Handler code should not be called')\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_8(self, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = {}\n",
"VAR_5['volumeName'] = VAR_10['name']\n",
"VAR_5['prompt'] = 'false'\n",
"VAR_27 = self._cliq_get_volume_info(VAR_10['name'])\n",
"VAR_0.error('Volume did not exist. It will not be deleted')\n",
"self._cliq_run_xml('deleteVol... | [
"def delete_volume(self, volume):...\n",
"\"\"\"docstring\"\"\"\n",
"cliq_args = {}\n",
"cliq_args['volumeName'] = volume['name']\n",
"cliq_args['prompt'] = 'false'\n",
"volume_info = self._cliq_get_volume_info(volume['name'])\n",
"LOG.error('Volume did not exist. It will not be deleted')\n",
"self._c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1=',', VAR_2=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return [chunk.strip(VAR_2) for chunk in VAR_0.split(VAR_1)]\n"
] | [
"def getlist(option, sep=',', chars=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return [chunk.strip(chars) for chunk in option.split(sep)]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
"VAR_3 = VAR_0.lower()\n",
"if VAR_3 in ('yes', 'true', 't', '1', 'y'):\n",
"return True\n",
"if VAR_3 in ('no', 'false', 'f', 'n', '0'):\n",
"return False\n"
] | [
"def str2bool(value):...\n",
"v = value.lower()\n",
"if v in ('yes', 'true', 't', '1', 'y'):\n",
"return True\n",
"if v in ('no', 'false', 'f', 'n', '0'):\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0 = MySQLdb.connect(host='localhost', port=3306, user=sys.argv[1],\n passwd=sys.argv[2], VAR_0=sys.argv[3])\n",
"return VAR_0\n"
] | [
"def init_db():...\n",
"\"\"\"docstring\"\"\"\n",
"db = MySQLdb.connect(host='localhost', port=3306, user=sys.argv[1], passwd=\n sys.argv[2], db=sys.argv[3])\n",
"return db\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@property...\n",
"VAR_14 = '' if self.version == 'custom' else '-synthetic'\n",
"return {'scalac': ['//:scalac{}'.format(VAR_14)], 'scala-library': [\n '//:scala-library{}'.format(VAR_14)]}\n"
] | [
"@property...\n",
"maybe_suffix = '' if self.version == 'custom' else '-synthetic'\n",
"return {'scalac': ['//:scalac{}'.format(maybe_suffix)], 'scala-library': [\n '//:scala-library{}'.format(maybe_suffix)]}\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n",
"if VAR_23 == 'on_after_task':\n",
"VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n",
"self.assertEqual(True, VAR_50)\n",
"self.assertEqual(False, VAR_51)\n",
"self.assertEqual({'pool': 'default'}, VAR_5)\n",
"self.assertEqual(VAR_22, VAR_52)\n"
] | [
"def call_hook(_botobj, name, *args):...\n",
"if name == 'on_after_task':\n",
"failure, internal_failure, dimensions, summary = args\n",
"self.assertEqual(True, failure)\n",
"self.assertEqual(False, internal_failure)\n",
"self.assertEqual({'pool': 'default'}, dimensions)\n",
"self.assertEqual(result, su... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self\n",
"VAR_12 = []\n",
"VAR_5 = model.Identity(model.IDENTITY_USER, 'joe@example.com')\n",
"def FUNC_27(VAR_13):...\n",
"self.assertEqual('/request', VAR_13.path)\n",
"VAR_12.append('not_applicable')\n",
"return None\n"
] | [
"def test_auth_method_order(self):...\n",
"\"\"\"docstring\"\"\"\n",
"test = self\n",
"calls = []\n",
"ident = model.Identity(model.IDENTITY_USER, 'joe@example.com')\n",
"def not_applicable(request):...\n",
"self.assertEqual('/request', request.path)\n",
"calls.append('not_applicable')\n",
"return N... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def __iter__(self):...\n",
"return self\n"
] | [
"def __iter__(self):...\n",
"return self\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
""
] | [
"def run(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"\"\"\"string\"\"\"\n",
"VAR_0 = {}\n",
"\"\"\"Configuration of remote applications.\"\"\"\n",
"VAR_1 = 'oauth_token'\n",
"\"\"\"Session key prefix used when storing the access token for a remote app.\"\"\"\n"
] | [
"\"\"\" Configuration variables for defining remote applications.\n\n================================ ==============================================\n`OAUTHCLIENT_REMOTE_APPS` Dictionary of remote applications. See example\n below. **Default:** ``{}``.\n`OAUTHCLIENT_SESSION_KE... | [
0,
0,
0,
0,
0
] | [
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
""
] | [
"def run(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(self):...\n",
"VAR_3 = self._normalConnection()\n",
"VAR_3.autocommit(True)\n",
"return VAR_3\n"
] | [
"def newConnection(self):...\n",
"conn = self._normalConnection()\n",
"conn.autocommit(True)\n",
"return conn\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import json\n",
"import mock\n",
"import requests\n",
"from django.test import TransactionTestCase\n",
"from api.models import Release\n",
"def FUNC_0(*V... | [
"\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import json\n",
"import mock\n",
"import requests\n",
"from django.test import TransactionTestCase\n",
"from api.models import Release\n",
"def mock_impo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, VAR_10='_cores _nodes'.split()):...\n",
"VAR_23 = {name: res for name, res in self.resources.items() if name not in\n VAR_10}\n",
"VAR_24 = {name: value for name, value in self.params.items()}\n",
"VAR_25 = {'rule': self.rule.name, 'local': self.dag.workflow.is_local(self.\n rule), 'i... | [
"def properties(self, omit_resources='_cores _nodes'.split()):...\n",
"resources = {name: res for name, res in self.resources.items() if name not in\n omit_resources}\n",
"params = {name: value for name, value in self.params.items()}\n",
"properties = {'rule': self.rule.name, 'local': self.dag.workflow.is_... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_14(VAR_32, VAR_5=False):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_52 = {}\n",
"for VAR_81, info in VAR_32:\n",
"VAR_52[VAR_81.output(VAR_5)] = len(info[0])\n",
"return VAR_52\n"
] | [
"def _get_singlekws(skw_matches, spires=False):...\n",
"\"\"\"docstring\"\"\"\n",
"output = {}\n",
"for single_keyword, info in skw_matches:\n",
"output[single_keyword.output(spires)] = len(info[0])\n",
"return output\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_36(VAR_11, VAR_13, VAR_14):...\n",
"for c in VAR_14:\n",
"if c.check.name == VAR_11 and c.environ.name == VAR_13:\n",
"return c\n"
] | [
"def find_case(cname, ename, cases):...\n",
"for c in cases:\n",
"if c.check.name == cname and c.environ.name == ename:\n",
"return c\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Return'"
] |
[
"@classmethod...\n",
"return [lambda _request: VAR_22]\n"
] | [
"@classmethod...\n",
"return [lambda _request: peer_ident]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_7(self, VAR_2):...\n",
"VAR_8 = self._find_breakpoints(VAR_2)\n",
"VAR_9 = [0] + VAR_8 + [len(VAR_2)]\n",
"VAR_7 = []\n",
"for i in range(len(VAR_8) + 1):\n",
"VAR_14 = VAR_9[i]\n",
"return VAR_7\n",
"VAR_15 = VAR_9[i + 1]\n",
"VAR_16 = VAR_2[VAR_14:VAR_15]\n",
"if VAR_16 and VAR_16[0] =... | [
"def _decompose(self, line):...\n",
"breakpoints = self._find_breakpoints(line)\n",
"inclusive_breakpoints = [0] + breakpoints + [len(line)]\n",
"cmds = []\n",
"for i in range(len(breakpoints) + 1):\n",
"start = inclusive_breakpoints[i]\n",
"return cmds\n",
"end = inclusive_breakpoints[i + 1]\n",
"c... | [
0,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"from __future__ import unicode_literals\n",
"import json\n",
"from django.test import TestCase\n",
"def FUNC_0(self):...\n",
"VAR_1, VAR_2 = 'firstuser', 'password'\n",
"VAR_3 = 'autotest@deis.io'\n",
"VAR_4 = {'username': VAR_1, 'password': VAR_2, 'email': VAR_3}\n",
"VAR_5 = '/api/auth/register'\n"... | [
"from __future__ import unicode_literals\n",
"import json\n",
"from django.test import TestCase\n",
"def test_first_signup(self):...\n",
"username, password = 'firstuser', 'password'\n",
"email = 'autotest@deis.io'\n",
"submit = {'username': username, 'password': password, 'email': email}\n",
"url = '... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
5,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0... | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
... |
[
"def FUNC_3(self):...\n",
"VAR_2 = self.client.get('/datadocument/179486/')\n",
"VAR_3 = VAR_2.content.decode('utf-8')\n",
"VAR_4 = VAR_3.index('<h4>Extracted Text')\n",
"VAR_5 = VAR_3.index('<h4 class=\"d-inline\">Products')\n",
"self.assertTrue(VAR_5 > VAR_4,\n 'Product card should come after Extract... | [
"def test_product_card_location(self):...\n",
"response = self.client.get('/datadocument/179486/')\n",
"html = response.content.decode('utf-8')\n",
"e_idx = html.index('<h4>Extracted Text')\n",
"p_idx = html.index('<h4 class=\"d-inline\">Products')\n",
"self.assertTrue(p_idx > e_idx,\n 'Product card sh... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_34(self):...\n",
""
] | [
"def get(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"from osv import fields, osv\n",
"from tools.translate import _\n",
"VAR_0 = 'product.product'\n",
"def FUNC_0(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_4 is None:\n",
"VAR_4 = {}\n",
"VAR_17 = self.pool.get('product.product').browse(VAR_1, VAR_2, VAR_3, VAR_4\n... | [
"from osv import fields, osv\n",
"from tools.translate import _\n",
"_inherit = 'product.product'\n",
"def get_product_accounts(self, cr, uid, product_id, context=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if context is None:\n",
"context = {}\n",
"product_obj = self.pool.get('product.product').browse(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"self.assertEqual('123', bot_main.generate_version())\n"
] | [
"def test_generate_version(self):...\n",
"self.assertEqual('123', bot_main.generate_version())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_25(self):...\n",
"VAR_31 = json.loads(get_user_settings(self.doctype))\n",
"if hasattr(self, 'user_settings'):\n",
"VAR_31.update(self.user_settings)\n",
"if self.save_user_settings_fields:\n",
"VAR_31['fields'] = self.user_settings_fields\n",
"FUNC_25(self.doctype, VAR_31)\n"
] | [
"def update_user_settings(self):...\n",
"user_settings = json.loads(get_user_settings(self.doctype))\n",
"if hasattr(self, 'user_settings'):\n",
"user_settings.update(self.user_settings)\n",
"if self.save_user_settings_fields:\n",
"user_settings['fields'] = self.user_settings_fields\n",
"update_user_set... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_8, VAR_9, VAR_4, VAR_10=None):...\n",
"return super(VAR_51, self).check_recursion(VAR_8, VAR_9, VAR_4, VAR_10=parent)\n"
] | [
"def check_recursion(self, cursor, user, ids, parent=None):...\n",
"return super(project, self).check_recursion(cursor, user, ids, parent=parent)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self, **VAR_3):...\n",
"VAR_13 = super().get_context_data(**kwargs)\n",
"VAR_13['comments'] = self.object.comment_set.all().order_by('-time')\n",
"VAR_13['form'] = self.get_form()\n",
"VAR_13['md'] = markdown(self.object.content, extensions=[\n 'markdown.extensions.extra', 'markdown.extension... | [
"def get_context_data(self, **kwargs):...\n",
"context = super().get_context_data(**kwargs)\n",
"context['comments'] = self.object.comment_set.all().order_by('-time')\n",
"context['form'] = self.get_form()\n",
"context['md'] = markdown(self.object.content, extensions=[\n 'markdown.extensions.extra', 'mar... | [
0,
0,
0,
0,
3,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_1, VAR_2):...\n",
"VAR_6 = FUNC_3(VAR_1)\n",
"VAR_7 = VAR_6.cursor(MySQLdb.cursors.DictCursor)\n",
"VAR_8 = 'SELECT * FROM questions WHERE id=' + VAR_2\n",
"VAR_7.execute(VAR_8)\n",
"VAR_10 = VAR_7.fetchone()\n",
"if VAR_10:\n",
"VAR_13 = '<p>Question: {q}<br><br>'.format(q=row['questi... | [
"def makeAnswerForm(database, id):...\n",
"conn = dbConnect(database)\n",
"curs = conn.cursor(MySQLdb.cursors.DictCursor)\n",
"statement = 'SELECT * FROM questions WHERE id=' + id\n",
"curs.execute(statement)\n",
"row = curs.fetchone()\n",
"if row:\n",
"s = '<p>Question: {q}<br><br>'.format(q=row['que... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"AugAssign'",
"AugAssign'",
"Condition",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = MappingLevel[VAR_19.upper()]\n",
"VAR_22 = CLASS_1.get_user_by_username(VAR_4)\n",
"VAR_22.set_mapping_level(VAR_46)\n",
"return VAR_22\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"requested_level = MappingLevel[level.upper()]\n",
"user = UserService.get_user_by_username(username)\n",
"user.set_mapping_level(requested_level)\n",
"return user\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.dimensions.get('id', ['unknown'])[0]\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.dimensions.get('id', ['unknown'])[0]\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_8():...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_3('select * from player_static_view order by wins')\n"
] | [
"def playerStandings():...\n",
"\"\"\"docstring\"\"\"\n",
"return fetchall('select * from player_static_view order by wins')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"from datetime import datetime, timedelta\n",
"from time import localtime, strftime\n",
"import sqlite3\n",
"def FUNC_0(VAR_0):...\n",
"VAR_11 = datetime.now()\n",
"if ',' in VAR_0:\n",
"VAR_12 = VAR_0.split(',')\n",
"VAR_13 = VAR_0\n",
"for t in VAR_12:\n",
"if 's' in VAR_13:\n",
"VAR_13 = t\n"... | [
"from datetime import datetime, timedelta\n",
"from time import localtime, strftime\n",
"import sqlite3\n",
"def get_date(time):...\n",
"now = datetime.now()\n",
"if ',' in time:\n",
"times = time.split(',')\n",
"val = time\n",
"for t in times:\n",
"if 's' in val:\n",
"val = t\n",
"return now\... | [
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
] | [
"ImportFrom'",
"ImportFrom'",
"Import'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Co... |
[
"def FUNC_15(self, VAR_34):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_34 = get_filter(self.doctype, VAR_34)\n",
"VAR_52 = '`tab' + VAR_34.doctype + '`'\n",
"if not VAR_52 in self.tables:\n",
"self.append_table(VAR_52)\n",
"if 'ifnull(' in VAR_34.fieldname:\n",
"VAR_59 = VAR_34.fieldname\n",
"VAR_59 = '... | [
"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... | [
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'",
... |
[
"def FUNC_14(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = os.path.join(block.sys_block_path(VAR_1), 'partition')\n",
"return os.path.exists(VAR_15)\n"
] | [
"def identify_partition(device):...\n",
"\"\"\"docstring\"\"\"\n",
"path = os.path.join(block.sys_block_path(device), 'partition')\n",
"return os.path.exists(path)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_6(VAR_13):...\n",
"return os.path.isfile(VAR_13) and os.access(VAR_13, os.X_OK)\n"
] | [
"def is_executable(path):...\n",
"return os.path.isfile(path) and os.access(path, os.X_OK)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"VAR_19 = self.common.create_cloned_volume(VAR_6, VAR_7)\n",
"self.common.client_logout()\n",
"return {'metadata': VAR_19}\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"new_vol = self.common.create_cloned_volume(volume, src_vref)\n",
"self.common.client_logout()\n",
"return {'metadata': new_vol}\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@abc.abstractproperty...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"@abc.abstractproperty...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"Condition",
"Docstring"
] |
[
"def FUNC_20(self):...\n",
"VAR_7 = webapp2.WSGIApplication([webapp2.Route('/authenticated', CLASS_8),\n webapp2.Route('/not-authenticated', CLASS_9)])\n",
"VAR_19 = handler.get_authenticated_routes(VAR_7)\n",
"self.assertEqual(1, len(VAR_19))\n",
"self.assertEqual(CLASS_8, VAR_19[0].handler)\n"
] | [
"def test_get_authenticated_routes(self):...\n",
"app = webapp2.WSGIApplication([webapp2.Route('/authenticated',\n Authenticated), webapp2.Route('/not-authenticated', NotAuthenticated)])\n",
"routes = handler.get_authenticated_routes(app)\n",
"self.assertEqual(1, len(routes))\n",
"self.assertEqual(Authen... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"log.debug('Start caching last active users from the DB...')\n",
"VAR_13 = self.get_last_active_users(VAR_6)\n",
"log.error('Cannot cache users!')\n",
"for VAR_22 in VAR_13:\n",
"return\n",
"if VAR_22[0] not in self.users:\n",
"log.info('Us... | [
"def cache(self, limit):...\n",
"\"\"\"docstring\"\"\"\n",
"log.debug('Start caching last active users from the DB...')\n",
"last_active_users = self.get_last_active_users(limit)\n",
"log.error('Cannot cache users!')\n",
"for items in last_active_users:\n",
"return\n",
"if items[0] not in self.users:\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"For",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(VAR_22, VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = logging.getLogger('ray')\n",
"if type(VAR_22) is str:\n",
"VAR_22 = logging.getLevelName(VAR_22.upper())\n",
"VAR_42.setLevel(VAR_22)\n",
"VAR_21 = logging.StreamHandler()\n",
"VAR_21.setFormatter(logging.Formatter(VAR_23))\n",
... | [
"def setup_logger(logging_level, logging_format):...\n",
"\"\"\"docstring\"\"\"\n",
"logger = logging.getLogger('ray')\n",
"if type(logging_level) is str:\n",
"logging_level = logging.getLevelName(logging_level.upper())\n",
"logger.setLevel(logging_level)\n",
"_default_handler = logging.StreamHandler()\... | [
0,
0,
6,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_9(VAR_3, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = bleach.clean(str(VAR_3))\n",
"VAR_4 = bleach.clean(str(VAR_4))\n",
"FUNC_1('insert into Match(winner, loser) values(%s, %s)', (VAR_3, VAR_4))\n"
] | [
"def reportMatch(winner, loser):...\n",
"\"\"\"docstring\"\"\"\n",
"winner = bleach.clean(str(winner))\n",
"loser = bleach.clean(str(loser))\n",
"execute('insert into Match(winner, loser) values(%s, %s)', (winner, loser))\n"
] | [
0,
0,
4,
4,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"from flask import jsonify, Response, send_from_directory, request\n",
"from api_decorators import *\n",
"from api_utils import *\n",
"from models import Server, Sequence, SequenceItem, NotFoundError, Property, Device, INDIProfile, ImagesDatabase, camera_images_db, main_images_db, commands\n",
"import os\n"... | [
"from flask import jsonify, Response, send_from_directory, request\n",
"from api_decorators import *\n",
"from api_utils import *\n",
"from models import Server, Sequence, SequenceItem, NotFoundError, Property, Device, INDIProfile, ImagesDatabase, camera_images_db, main_images_db, commands\n",
"import os\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'"
] |
[
"def FUNC_5(self, VAR_3):...\n",
"if VAR_3 is not None:\n",
"VAR_7 = [injection_.register for injection_ in injection.objects.filter(\n result=record.id)]\n",
"VAR_7 = []\n",
"for VAR_21 in range(len(VAR_7)):\n",
"if VAR_7[VAR_21] is None:\n",
"if len(VAR_7) > 0:\n",
"VAR_7[VAR_21] = '-'\n",
"ret... | [
"def render_registers(self, record):...\n",
"if record is not None:\n",
"registers = [injection_.register for injection_ in injection.objects.filter\n (result=record.id)]\n",
"registers = []\n",
"for index in range(len(registers)):\n",
"if registers[index] is None:\n",
"if len(registers) > 0:\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_3(VAR_1: HttpRequest):...\n",
""
] | [
"def action_add_multiple_media(request: HttpRequest):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"async def FUNC_11(VAR_6):...\n",
"VAR_10 = {'Authorization': f'Bearer {VAR_1}'}\n",
"VAR_8 = await VAR_6.get(\"/results?page=0&count=2&filter=date eq '2019-07-15'\",\n VAR_10=headers)\n",
"VAR_9 = await VAR_8.json()\n",
"assert VAR_8.status == 200\n",
"assert len(VAR_9) == 1\n",
"VAR_8 = await VAR_6... | [
"async def test_positive_check_filters(test_cli):...\n",
"headers = {'Authorization': f'Bearer {access_token}'}\n",
"resp = await test_cli.get(\"/results?page=0&count=2&filter=date eq '2019-07-15'\"\n , headers=headers)\n",
"resp_json = await resp.json()\n",
"assert resp.status == 200\n",
"assert len(r... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"@auth.require_xsrf_token_request...\n",
"VAR_28, VAR_14, VAR_9, VAR_25, VAR_24, VAR_26 = self._process()\n",
"bot_management.bot_event(VAR_31='bot_connected', VAR_14=bot_id, external_ip\n =self.request.remote_addr, VAR_24=dimensions, VAR_25=state, VAR_9=\n version, VAR_16=bool(quarantined_msg), VAR_17=''... | [
"@auth.require_xsrf_token_request...\n",
"_request, bot_id, version, state, dimensions, quarantined_msg = self._process()\n",
"bot_management.bot_event(event_type='bot_connected', bot_id=bot_id,\n external_ip=self.request.remote_addr, dimensions=dimensions, state=\n state, version=version, quarantined=boo... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_32(self):...\n",
"\"\"\"docstring\"\"\"\n",
"tournament.editPlayer(player='38471237401238', new_name='Michael Bay',\n new_country='Japan')\n"
] | [
"def test_edit_invalid_player_id(self):...\n",
"\"\"\"docstring\"\"\"\n",
"tournament.editPlayer(player='38471237401238', new_name='Michael Bay',\n new_country='Japan')\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"VAR_19 = self.common.create_cloned_volume(VAR_6, VAR_7)\n",
"self.common.client_logout()\n",
"return {'metadata': VAR_19}\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"new_vol = self.common.create_cloned_volume(volume, src_vref)\n",
"self.common.client_logout()\n",
"return {'metadata': new_vol}\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"from django.conf.urls import include, url\n",
"from pretix.control.views import attendees, auth, dashboards, event, help, item, main, orders, organizer, user, vouchers\n",
"VAR_0 = [url('^logout$', auth.logout, name='auth.logout'), url('^login$',\n auth.login, name='auth.login'), url('^register$', auth.regi... | [
"from django.conf.urls import include, url\n",
"from pretix.control.views import attendees, auth, dashboards, event, help, item, main, orders, organizer, user, vouchers\n",
"urlpatterns = [url('^logout$', auth.logout, name='auth.logout'), url(\n '^login$', auth.login, name='auth.login'), url('^register$', au... | [
0,
0,
1
] | [
"ImportFrom'",
"ImportFrom'",
"Assign'"
] |
[
"def FUNC_8():...\n",
"VAR_17 = False\n",
"VAR_18 = 'campaign-data/' + str(self.campaign_data['id']) + '/results/' + str(\n self.result_data['id'])\n",
"os.makedirs(VAR_18)\n",
"VAR_19 = VAR_18 + '/' + self.campaign_data['output_file']\n",
"VAR_20 = 'campaign-data/' + str(self.campaign_data['id']\n ... | [
"def check_output():...\n",
"missing_output = False\n",
"result_folder = 'campaign-data/' + str(self.campaign_data['id']\n ) + '/results/' + str(self.result_data['id'])\n",
"os.makedirs(result_folder)\n",
"output_location = result_folder + '/' + self.campaign_data['output_file']\n",
"gold_location = 'c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
"VAR_27 = self.builder.get_object('password_unlock_entry')\n",
"VAR_33 = self.builder.get_object('composite_unlock_entry')\n",
"VAR_27.set_text('')\n",
"VAR_33.set_text('')\n"
] | [
"def clear_input_fields(self):...\n",
"password_unlock_entry = self.builder.get_object('password_unlock_entry')\n",
"composite_unlock_entry = self.builder.get_object('composite_unlock_entry')\n",
"password_unlock_entry.set_text('')\n",
"composite_unlock_entry.set_text('')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement\n",
"import logging\n",
"import os\n",
"import subprocess\n",
"from collections import namedtuple\n",
"from pants.base.exceptions import TaskError\n",
"from pants.binaries.binar... | [
"from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement\n",
"import logging\n",
"import os\n",
"import subprocess\n",
"from collections import namedtuple\n",
"from pants.base.exceptions import TaskError\n",
"from pants.binaries.binar... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
2,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.docstring = VAR_68\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.docstring = string\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_4(self, VAR_1, VAR_2, VAR_5, VAR_10=None, VAR_11=False, VAR_4=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_10:\n",
"VAR_10 = []\n",
"if VAR_4 is None:\n",
"VAR_4 = {}\n",
"VAR_29 = {}\n",
"for VAR_48 in VAR_5:\n",
"VAR_29[VAR_48] = {}.fromkeys(VAR_10, 0.0)\n",
"for VAR_55 in VAR_... | [
"def _product_available(self, cr, uid, ids, field_names=None, arg=False,...\n",
"\"\"\"docstring\"\"\"\n",
"if not field_names:\n",
"field_names = []\n",
"if context is None:\n",
"context = {}\n",
"res = {}\n",
"for id in ids:\n",
"res[id] = {}.fromkeys(field_names, 0.0)\n",
"for f in field_names:... | [
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",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"For",
"Assign'"
] |
[
"def FUNC_18():...\n",
"populate_test_database()\n",
"FUNC_0(1, 'title', 'thumbnail', 1)\n",
"FUNC_0(1, 'title2', 'thumbnail2', 2)\n",
"VAR_11 = VAR_3.put('/videos/1/1/2')\n",
"assert VAR_11.json['status'] == 'NOK'\n",
"assert VAR_11.json['message'] != None\n",
"VAR_12 = VAR_3.put('/videos/1/1/5')\n",... | [
"def test_should_return_a_not_ok_status_when_either_specifying_an_out_of_bounds_or_similar_position(...\n",
"populate_test_database()\n",
"create_video(1, 'title', 'thumbnail', 1)\n",
"create_video(1, 'title2', 'thumbnail2', 2)\n",
"response = test_app.put('/videos/1/1/2')\n",
"assert response.json['statu... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"import json as json_module\n",
"import logging\n",
"import sys\n",
"from citest.service_testing import HttpContractBuilder\n",
"from citest.service_testing import NoOpOperation\n",
"import citest.gcp_testing as gcp\n",
"import citest.json_contract as jc\n",
"import citest.service_testing as st\n",
... | [
"import json as json_module\n",
"import logging\n",
"import sys\n",
"from citest.service_testing import HttpContractBuilder\n",
"from citest.service_testing import NoOpOperation\n",
"import citest.gcp_testing as gcp\n",
"import citest.json_contract as jc\n",
"import citest.service_testing as st\n",
... | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Conditio... |
[
"def FUNC_11(VAR_7):...\n",
"@wraps(VAR_7)...\n",
"if not app.config.get('USE_AUTH'):\n",
"return VAR_7(*VAR_9, **kwargs)\n",
"VAR_17 = FUNC_8()\n",
"logging.warning('Invalid token version used.')\n",
"if VAR_17:\n",
"return abort(403)\n",
"VAR_2 = 'user'\n",
"if VAR_17['user_type'] not in app.con... | [
"def require_auth(f):...\n",
"@wraps(f)...\n",
"if not app.config.get('USE_AUTH'):\n",
"return f(*args, **kwargs)\n",
"kms_auth_data = _get_kms_auth_data()\n",
"logging.warning('Invalid token version used.')\n",
"if kms_auth_data:\n",
"return abort(403)\n",
"user_type = 'user'\n",
"if kms_auth_dat... | [
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
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Conditi... |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = 'string'.format(VAR_1, VAR_2)\n",
"VAR_6 = FUNC_3(VAR_0, VAR_4)\n",
"if VAR_6 is not None:\n",
"VAR_8 = open('top_articles_report.txt', 'w')\n",
"return False\n",
"for row in VAR_6:\n",
"VAR_8.write('\"{}\" - {} views \\n'.... | [
"def get_top_articles(cur, order, limit):...\n",
"\"\"\"docstring\"\"\"\n",
"query = (\n \"\"\"SELECT articles.title, COUNT(*) as views\n FROM log, articles\n WHERE log.path LIKE '%'||articles.slug AND\n log.method = 'GET'\n GROUP BY articles.title\n ORD... | [
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"For",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_15(self, VAR_16, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = self._eql_execute('volume', 'select', VAR_18['volume_name'],\n 'snapshot', 'select', VAR_18['name'], 'clone', VAR_16['name'])\n",
"VAR_0.error(_('Failed to create volume from snapshot %s'), VAR_18['name'])\n",
"return self._g... | [
"def create_volume_from_snapshot(self, volume, snapshot):...\n",
"\"\"\"docstring\"\"\"\n",
"out = self._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'select', snapshot['name'], 'clone', volume['name'])\n",
"LOG.error(_('Failed to create volume from snapshot %s'), snapshot['name']... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0():...\n",
"return st.ScenarioTestRunner.main(CLASS_0, test_case_list=[\n GoogleKatoIntegrationTest])\n"
] | [
"def main():...\n",
"return st.ScenarioTestRunner.main(GoogleKatoTestScenario, test_case_list=[\n GoogleKatoIntegrationTest])\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
""
] | [
"def do_get(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_18(self, VAR_9):...\n",
"if not self.logged_in():\n",
"print('shrub: unauthenticated; use \"login [username] to log in first')\n",
"VAR_20 = self.send_cmd('delete_comment{} {}'.format(self.insecure_mode, VAR_9))\n",
"return\n",
"print(VAR_20)\n"
] | [
"def do_delete_comment(self, line):...\n",
"if not self.logged_in():\n",
"print('shrub: unauthenticated; use \"login [username] to log in first')\n",
"response = self.send_cmd('delete_comment{} {}'.format(self.insecure_mode, line)\n )\n",
"return\n",
"print(response)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"auth.login(self.request, self.user)\n",
"VAR_5 = import_from_settings('OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS', 60 * 15)\n",
"self.request.session['oidc_id_token_expiration'] = time.time() + VAR_5\n",
"return HttpResponseRedirect(self.success_url)\n"
] | [
"def login_success(self):...\n",
"auth.login(self.request, self.user)\n",
"expiration_interval = import_from_settings('OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS'\n , 60 * 15)\n",
"self.request.session['oidc_id_token_expiration'] = time.time(\n ) + expiration_interval\n",
"return HttpResponseRedirect(self.suc... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"VAR_14 = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n",
"VAR_14.delete('unique-id')\n",
"FUNC_1('delete', VAR_14, 'https://1.2.3.4/api/v1/ports/unique-id')\n"
] | [
"def test_client_delete(self):...\n",
"api = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n",
"api.delete('unique-id')\n",
"assert_call('delete', api, 'https://1.2.3.4/api/v1/ports/unique-id')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(self, VAR_16, VAR_24='GET', VAR_15=None, VAR_12=None, VAR_13=False...\n",
"VAR_40 = VAR_12.copy() if VAR_12 else {}\n",
"VAR_40.update(self._default_headers)\n",
"VAR_41 = self._build_url(VAR_16)\n",
"VAR_42 = getattr(self._conn, VAR_24.lower())\n",
"if not VAR_13:\n",
"VAR_0.debug('REST ca... | [
"def _rest_call(self, url, method='GET', body=None, headers=None, silent=False):...\n",
"request_headers = headers.copy() if headers else {}\n",
"request_headers.update(self._default_headers)\n",
"request_url = self._build_url(url)\n",
"do_request = getattr(self._conn, method.lower())\n",
"if not silent:\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"@property...\n",
"return await GithubUser.get(gid=self.github_id)\n"
] | [
"@property...\n",
"return await GithubUser.get(gid=self.github_id)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_0):...\n",
"self.txt = VAR_0\n"
] | [
"def __init__(self, txt):...\n",
"self.txt = txt\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"@tornado.web.asynchronous...\n",
"def FUNC_5():...\n",
"self.set_status(404, 'Not Found')\n",
"self._headers = tornado.httputil.HTTPHeaders()\n",
"self.add_header('Content-Length', '0')\n",
"self.flush()\n",
"return\n"
] | [
"@tornado.web.asynchronous...\n",
"def invoke_404():...\n",
"self.set_status(404, 'Not Found')\n",
"self._headers = tornado.httputil.HTTPHeaders()\n",
"self.add_header('Content-Length', '0')\n",
"self.flush()\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@property...\n",
"return os.path.expanduser('~/.oms_history')\n"
] | [
"@property...\n",
"return os.path.expanduser('~/.oms_history')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_1(VAR_0, VAR_1=False):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_34 = VAR_0.split('\\n')\n",
"if VAR_1:\n",
"VAR_34 = VAR_34[0:1] + VAR_34[3:]\n",
"return '\\n'.join(VAR_34)\n"
] | [
"def format_error_message(exception_message, task_exception=False):...\n",
"\"\"\"docstring\"\"\"\n",
"lines = exception_message.split('\\n')\n",
"if task_exception:\n",
"lines = lines[0:1] + lines[3:]\n",
"return '\\n'.join(lines)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@classmethod...\n",
"return NotImplementedError()\n"
] | [
"@classmethod...\n",
"return NotImplementedError()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import json\n",
"import os.path\n",
"from django.test import TestCase\n",
"from django.conf import settings\n",
"from api.models import App\n",
"\"\"\"Te... | [
"\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import json\n",
"import os.path\n",
"from django.test import TestCase\n",
"from django.conf import settings\n",
"from api.models import App\n",
"\"\"\"Te... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
5,
0,
0,
0,
5,
0,
0,
5,
0,
5,
0,
0,
0,
5,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"def FUNC_50(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 11}, 'CONFIDENCE': {'HIGH': 11}}\n",
"self.check_example('partial_path_process.py', VAR_2)\n"
] | [
"def test_partial_path(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 11}, 'CONFIDENCE': {'HIGH': 11}}\n",
"self.check_example('partial_path_process.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"@app.route('/people/<user_id>/delete_name/<name_id>', methods=['POST'])...\n",
"if not current_user.editor:\n",
"return redirect(url_for('error403'))\n",
"VAR_9 = Name.query.filter_by(id=name_id).first()\n",
"db.session.delete(VAR_9)\n",
"db.session.commit()\n",
"return redirect(url_for('person_edit', ... | [
"@app.route('/people/<user_id>/delete_name/<name_id>', methods=['POST'])...\n",
"if not current_user.editor:\n",
"return redirect(url_for('error403'))\n",
"name_to_delete = Name.query.filter_by(id=name_id).first()\n",
"db.session.delete(name_to_delete)\n",
"db.session.commit()\n",
"return redirect(url_f... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"import pyxl\n",
"import mysql.connector\n",
"from pypika import MySQLQuery, Table, Field\n",
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"VAR_4 = VAR_0.cursor()\n",
"VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n",
"VAR_4.execute(VAR_5)\n",
"VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_IN... | [
"import pyxl\n",
"import mysql.connector\n",
"from pypika import MySQLQuery, Table, Field\n",
"def write_preset(conn, queryin, descriptin):...\n",
"cursor = conn.cursor()\n",
"quer = 'ALTER TABLE Presets DROP COLUMN id;'\n",
"cursor.execute(quer)\n",
"quer = (\n 'ALTER TABLE Presets ADD COLUMN id I... | [
0,
0,
0,
0,
4,
4,
4,
4,
0,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
4,
4,
4
] | [
"Import'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Condi... |
[
"def FUNC_3(self, VAR_5):...\n",
"self.common = self._init_common()\n",
"self._check_flags()\n",
"self.common.do_setup(VAR_5)\n"
] | [
"def do_setup(self, context):...\n",
"self.common = self._init_common()\n",
"self._check_flags()\n",
"self.common.do_setup(context)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"VAR_23 = self.common.create_volume_from_snapshot(VAR_7, VAR_9)\n",
"self.common.client_logout()\n",
"return {'metadata': VAR_23}\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n",
"self.common.client_logout()\n",
"return {'metadata': metadata}\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_1.route('/run/form/submit', methods=['POST'])...\n",
"VAR_37 = FUNC_15()\n",
"VAR_10 = FUNC_14(VAR_37)\n",
"if VAR_37.validate_on_submit():\n",
"return json.dumps({'commands': VAR_10, 'html': render_template(\n 'run_success.html', VAR_10=commands)})\n",
"return json.dumps({'commands': VAR_10, 'ht... | [
"@app.route('/run/form/submit', methods=['POST'])...\n",
"run_form = get_run_form()\n",
"commands = get_commands(run_form)\n",
"if run_form.validate_on_submit():\n",
"return json.dumps({'commands': commands, 'html': render_template(\n 'run_success.html', commands=commands)})\n",
"return json.dumps({'co... | [
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/api/issue', methods=['PATCH'])...\n",
"return 'Not implemented.', 501\n"
] | [
"@app.route('/api/issue', methods=['PATCH'])...\n",
"return 'Not implemented.', 501\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_5(VAR_2: db.note.Note, VAR_0: Request):...\n",
"content: str = VAR_0.params['note']\n",
"VAR_2.content = content.replace('\\r', '')\n",
"return db.note.save_note(VAR_0.db, VAR_2)\n"
] | [
"def _save_or_create_note(note: db.note.Note, request: Request):...\n",
"content: str = request.params['note']\n",
"note.content = content.replace('\\r', '')\n",
"return db.note.save_note(request.db, note)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"AnnAssign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
""
] | [
"def _check_children_depth(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_6(self, VAR_11):...\n",
"return utils.sanitize_url(VAR_11)\n"
] | [
"def run(self, url):...\n",
"return utils.sanitize_url(url)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if _sparse.issparse(VAR_13) == False:\n",
"VAR_34, VAR_35 = _sla.eigs(VAR_13, VAR_1=1, which='LM', ncv=lanczosVecs,\n VAR_6=maxiter)\n",
"VAR_35 = VAR_35.reshape(VAR_35.size)\n",
"if VAR_14:\n",
"VAR_35 /= sum(VAR_35)\n",
"return VAR_35\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if _sparse.issparse(A) == False:\n",
"w, pi = _sla.eigs(A, k=1, which='LM', ncv=lanczosVecs, maxiter=maxiter)\n",
"pi = pi.reshape(pi.size)\n",
"if normalized:\n",
"pi /= sum(pi)\n",
"return pi\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_39(self, *VAR_19, **VAR_46):...\n",
"return super(CLASS_1, self).render(*VAR_19, **kwargs)\n"
] | [
"def render(self, *args, **kwargs):...\n",
"return super(MetalTemplate, self).render(*args, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_12():...\n",
"VAR_20 = []\n",
"for i in range(int(VAR_2)):\n",
"VAR_26 = subprocess.Popen([sys.executable, __file__], stdout=subprocess.\n PIPE, stderr=subprocess.PIPE)\n",
"VAR_20.append(VAR_26.pid)\n",
"log.info('Started worker with pid %s' % VAR_26.pid)\n"
] | [
"def run_children():...\n",
"child_pids = []\n",
"for i in range(int(no_subprocess)):\n",
"proc = subprocess.Popen([sys.executable, __file__], stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n",
"child_pids.append(proc.pid)\n",
"log.info('Started worker with pid %s' % proc.pid)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = pathexpr.SearcherExists(self, VAR_7)\n",
"VAR_10 = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n",
"VAR_11 = self._doc['rules']['ROOT']\n",
"ds._traverse(VAR_5, VAR_11, VAR_10, self)\n",
"return VAR_5._store\n"
] | [
"def search_paths(self, searchexpr):...\n",
"\"\"\"docstring\"\"\"\n",
"searcher = pathexpr.SearcherExists(self, searchexpr)\n",
"ctx = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n",
"rule = self._doc['rules']['ROOT']\n",
"ds._traverse(searcher, rule, ctx, self)\n",
"return search... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_1=None, VAR_2=5):...\n",
"self.size = VAR_2\n",
"self.data = VAR_1 or []\n"
] | [
"def __init__(self, list=None, size=5):...\n",
"self.size = size\n",
"self.data = list or []\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_24(self, VAR_17):...\n",
"VAR_35, VAR_9, VAR_36 = sys.exc_info()\n",
"VAR_16, VAR_37 = str(VAR_17).split(\"'\")[-2], None\n",
"if 'unique_' in VAR_16:\n",
"VAR_16 = VAR_16.split('_', 1)[1]\n",
"VAR_25 = self.meta.get_field(VAR_16)\n",
"if VAR_25:\n",
"VAR_37 = VAR_25.label\n",
"VAR_54.msgp... | [
"def show_unique_validation_message(self, e):...\n",
"type, value, traceback = sys.exc_info()\n",
"fieldname, label = str(e).split(\"'\")[-2], None\n",
"if 'unique_' in fieldname:\n",
"fieldname = fieldname.split('_', 1)[1]\n",
"df = self.meta.get_field(fieldname)\n",
"if df:\n",
"label = df.label\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = ['hp3par_api_url', 'hp3par_username', 'hp3par_password', 'san_ip',\n 'san_login', 'san_password']\n",
"self.common.check_flags(self.configuration, VAR_18)\n"
] | [
"def _check_flags(self):...\n",
"\"\"\"docstring\"\"\"\n",
"required_flags = ['hp3par_api_url', 'hp3par_username', 'hp3par_password',\n 'san_ip', 'san_login', 'san_password']\n",
"self.common.check_flags(self.configuration, required_flags)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"self.log_debug('Reading file %s' % VAR_14)\n",
"if VAR_67.errno == 2:\n",
"if not self.local:\n",
"self.log_debug('File %s does not exist on node' % VAR_14)\n",
"self.log_error('Error reading %s: %s' % (VAR_14, VAR_67))\n",
"VAR_63 = self.... | [
"def read_file(self, to_read):...\n",
"\"\"\"docstring\"\"\"\n",
"self.log_debug('Reading file %s' % to_read)\n",
"if err.errno == 2:\n",
"if not self.local:\n",
"self.log_debug('File %s does not exist on node' % to_read)\n",
"self.log_error('Error reading %s: %s' % (to_read, err))\n",
"remote = self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"self.uut.executable = 'more'\n",
"self.uut.use_stdin = True\n",
"self.uut.use_stderr = False\n",
"self.uut.process_output = lambda output, filename, file: output\n",
"VAR_1 = self.uut.lint(file=lines)\n",
"self.assertTrue(('abcd\\n', 'efgh\\n') == VAR_1 or ('abcd\\n', 'efgh\\n... | [
"def test_stdin_input(self):...\n",
"self.uut.executable = 'more'\n",
"self.uut.use_stdin = True\n",
"self.uut.use_stderr = False\n",
"self.uut.process_output = lambda output, filename, file: output\n",
"out = self.uut.lint(file=lines)\n",
"self.assertTrue(('abcd\\n', 'efgh\\n') == out or ('abcd\\n', 'e... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = self.get_vendor_id(VAR_14)\n",
"VAR_26 = {'name': VAR_25.id, 'min_qty': VAR_15, 'price': VAR_16,\n 'product_code': VAR_17, 'product_name': self.name, 'date_start': VAR_18,\n 'product_tmpl_id': self.id}... | [
"def insert_historic_cost(self, vendor_ref, min_qty, cost, vendors_code, date):...\n",
"\"\"\"docstring\"\"\"\n",
"vendor_id = self.get_vendor_id(vendor_ref)\n",
"supplierinfo = {'name': vendor_id.id, 'min_qty': min_qty, 'price': cost,\n 'product_code': vendors_code, 'product_name': self.name, 'date_start'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_38(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n",
"self.check_example('subprocess_shell.py', VAR_2)\n"
] | [
"def test_subprocess_shell(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n",
"self.check_example('subprocess_shell.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(VAR_5):...\n",
"VAR_12 = 'string'\n",
"VAR_14 = create_connection()\n",
"VAR_14.close()\n",
"VAR_15 = VAR_14.cursor()\n",
"VAR_15.execute(VAR_12, VAR_5)\n",
"return VAR_15.fetchall()\n"
] | [
"def get_invoice(id):...\n",
"sql_query = (\n 'select t2.id as id_invoice , t2.transaction_date, sum(t3.price * t1.quantity) as montant from invoice_products as t1 inner join invoices as t2 on t2.id = t1.invoice_id inner join products as t3 on t3.id = t1.product_id and t2.user_id= %s group by t2.id, t2... | [
0,
4,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(self, VAR_5, VAR_6):...\n",
"self.reset()\n",
"self.on_sort.emit(self.columns[VAR_5], bool(VAR_6))\n"
] | [
"def sort(self, column, order):...\n",
"self.reset()\n",
"self.on_sort.emit(self.columns[column], bool(order))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.