lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_6(VAR_3):...\n",
"VAR_8 = get_activation_link(VAR_3)\n",
"VAR_9 = {'activation_link': VAR_8, 'user': VAR_3}\n",
"VAR_10 = email.EmailHolder(subject='Verify your {} account'.format(app.\n config['GLOBAL_SITE_NAME']), recipient=user, text=flask.render_template\n ('email/verify.txt', **tmpl_conte... | [
"def send_verification_email(user):...\n",
"activation_link = get_activation_link(user)\n",
"tmpl_context = {'activation_link': activation_link, 'user': user}\n",
"email_msg = email.EmailHolder(subject='Verify your {} account'.format(app.\n config['GLOBAL_SITE_NAME']), recipient=user, text=flask.render_tem... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_30(self, VAR_78):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.version = VAR_78\n",
"return VAR_101\n"
] | [
"def version(self, version):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.version = version\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self, VAR_3):...\n",
"return VAR_3 in self.__slug_map\n"
] | [
"def has_slug(self, entity_slug):...\n",
"return entity_slug in self.__slug_map\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self, VAR_5):...\n",
"return 'LIMIT {}'.format(VAR_5)\n"
] | [
"def create_limit(self, limit):...\n",
"return 'LIMIT {}'.format(limit)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (selec... | [
"def test_query_fields_sanitizer(self):...\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, I... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
"def RestartServer(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"import re\n",
"from django import forms\n",
"from django.contrib.contenttypes.models import ContentType\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from wiki.models import Article\n",
"from wiki.models import ChangeSet\n",
"from wiki.templatetags.wiki_extras import WIKI_WORD_RE\n"... | [
"import re\n",
"from django import forms\n",
"from django.contrib.contenttypes.models import ContentType\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from wiki.models import Article\n",
"from wiki.models import ChangeSet\n",
"from wiki.templatetags.wiki_extras import WIKI_WORD_RE\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
6,
6,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition... |
[
"def FUNC_1(self):...\n",
"self.cursor.close()\n",
"self.mydb.close()\n"
] | [
"def close(self):...\n",
"self.cursor.close()\n",
"self.mydb.close()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_10, VAR_8):...\n",
"VAR_29, VAR_28 = VAR_10.compile(self.lhs)\n",
"return '%s[%s]' % (VAR_29, self.index), VAR_28\n"
] | [
"def as_sql(self, compiler, connection):...\n",
"lhs, params = compiler.compile(self.lhs)\n",
"return '%s[%s]' % (lhs, self.index), params\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.config.getint(self.section, 'listen_port')\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.config.getint(self.section, 'listen_port')\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"return self.title\n"
] | [
"def get_feed(self):...\n",
"return self.title\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import collections\n",
"import os\n",
"import pymongo\n",
"from django.http import Http404\n",
"from cuckoo.core.database import Database, TASK_PENDING\n",
"from cuckoo.common.mongo import mongo\n",
"VAR_0 = Database()\n",
"@staticmethod...\n",
"if not isinstance(VAR_1, int):\n",
"VAR_9 = {}\n",
... | [
"import collections\n",
"import os\n",
"import pymongo\n",
"from django.http import Http404\n",
"from cuckoo.core.database import Database, TASK_PENDING\n",
"from cuckoo.common.mongo import mongo\n",
"db = Database()\n",
"@staticmethod...\n",
"if not isinstance(task_id, int):\n",
"data = {}\n",
... | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"... |
[
"from django.http import HttpResponse\n",
"from django.shortcuts import render\n",
"from django.core.urlresolvers import reverse\n",
"def FUNC_0(VAR_0):...\n",
"if VAR_0.method == 'POST':\n",
"VAR_2 = VAR_0.POST.get('answer', '').lower()\n",
"return render(VAR_0, 'exercises/first_exercise.html')\n",
"... | [
"from django.http import HttpResponse\n",
"from django.shortcuts import render\n",
"from django.core.urlresolvers import reverse\n",
"def first(request):...\n",
"if request.method == 'POST':\n",
"submission = request.POST.get('answer', '').lower()\n",
"return render(request, 'exercises/first_exercise.ht... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_41):...\n",
"VAR_79 = CLASS_24.run(self, VAR_41)\n",
"if VAR_79:\n",
"if not VAR_79._loaded:\n",
"return self.error(errors.NOT_AUTHOR)\n",
"VAR_79._load()\n",
"if VAR_101.user_is_loggedin and VAR_79.author_id == VAR_101.user._id:\n",
"return VAR_79\n"
] | [
"def run(self, fullname):...\n",
"thing = VByName.run(self, fullname)\n",
"if thing:\n",
"if not thing._loaded:\n",
"return self.error(errors.NOT_AUTHOR)\n",
"thing._load()\n",
"if c.user_is_loggedin and thing.author_id == c.user._id:\n",
"return thing\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_7.environ.pop('SWARMING_BOT_ID', None)\n",
"VAR_7.chdir(self.old_cwd)\n",
"file_path.rmtree(self.root_dir)\n",
"super(CLASS_0, self).tearDown()\n"
] | [
"def tearDown(self):...\n",
"os.environ.pop('SWARMING_BOT_ID', None)\n",
"os.chdir(self.old_cwd)\n",
"file_path.rmtree(self.root_dir)\n",
"super(TestBotMain, self).tearDown()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_1.route('/logout')...\n",
"logout_user()\n",
"return redirect(url_for('view_home'))\n"
] | [
"@app.route('/logout')...\n",
"logout_user()\n",
"return redirect(url_for('view_home'))\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_1, VAR_2, VAR_5, VAR_6, VAR_4={}):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = self.pool.get('stock.location')\n",
"VAR_23 = self.pool.get('account.move')\n",
"VAR_24 = self.pool.get('account.move.line')\n",
"VAR_25 = VAR_6.get('new_price', 0.0)\n",
"VAR_19 = VAR_6.get('stock_outpu... | [
"def do_change_standard_price(self, cr, uid, ids, datas, context={}):...\n",
"\"\"\"docstring\"\"\"\n",
"location_obj = self.pool.get('stock.location')\n",
"move_obj = self.pool.get('account.move')\n",
"move_line_obj = self.pool.get('account.move.line')\n",
"new_price = datas.get('new_price', 0.0)\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
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condit... |
[
"def FUNC_15(self, VAR_65):...\n",
"if self.overwrite_workdir is None:\n",
"if not os.path.exists(VAR_65):\n",
"os.makedirs(VAR_65)\n",
"self._workdir = VAR_65\n",
"os.chdir(VAR_65)\n"
] | [
"def workdir(self, workdir):...\n",
"if self.overwrite_workdir is None:\n",
"if not os.path.exists(workdir):\n",
"os.makedirs(workdir)\n",
"self._workdir = workdir\n",
"os.chdir(workdir)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_21(self, VAR_14):...\n",
""
] | [
"def is_relation_one_to_many(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_8(self, VAR_1):...\n",
"return self.data['groups'].get(VAR_1.id, ([], None))\n"
] | [
"def groups(self, instance):...\n",
"return self.data['groups'].get(instance.id, ([], None))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"clear_cache('writers')\n"
] | [
"def on_update(self):...\n",
"clear_cache('writers')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"VAR_0 = 'user_id'\n",
"VAR_1 = 'view_introduction'\n",
"VAR_2 = 'instructor_intro'\n",
"VAR_3 = 'create_course'\n",
"VAR_4 = 'create_courselet'\n",
"VAR_5 = 'create_thread'\n",
"VAR_6 = 'preview_courselet'\n",
"VAR_7 = 'next_steps'\n",
"VAR_8 = 'invite_somebody'\n",
"VAR_9 = 'introduction_course_... | [
"USER_ID = 'user_id'\n",
"STEP_1 = 'view_introduction'\n",
"STEP_2 = 'instructor_intro'\n",
"STEP_3 = 'create_course'\n",
"STEP_4 = 'create_courselet'\n",
"STEP_5 = 'create_thread'\n",
"STEP_6 = 'preview_courselet'\n",
"STEP_7 = 'next_steps'\n",
"STEP_8 = 'invite_somebody'\n",
"INTRODUCTION_COURSE... | [
0,
0,
6,
0,
0,
0,
0,
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
6
] | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_19(self):...\n",
"self.compilation_ok('string')\n"
] | [
"def test_vacationext_basic(self):...\n",
"self.compilation_ok(\n \"\"\"\nrequire \"vacation\";\nif header :contains \"subject\" \"cyrus\" {\n vacation \"I'm out -- send mail to cyrus-bugs\";\n} else {\n vacation \"I'm out -- call me at +1 304 555 0123\";\n}\n\"\"\"\n )\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/losses')...\n",
"if VAR_0 == None:\n",
"FUNC_16()\n",
"VAR_26 = request.args.get('tag', default='christmasmike')\n",
"VAR_8 = \"SELECT * FROM matches WHERE (player1 = '\" + str(VAR_26\n ) + \"' OR \" + \"player2 = '\" + str(VAR_26) + \"') AND winner != '\" + str(\n VAR_26) + \"' ORDER ... | [
"@endpoints.route('/losses')...\n",
"if db == None:\n",
"init()\n",
"player = request.args.get('tag', default='christmasmike')\n",
"sql = \"SELECT * FROM matches WHERE (player1 = '\" + str(player\n ) + \"' OR \" + \"player2 = '\" + str(player) + \"') AND winner != '\" + str(\n player) + \"' ORDER BY d... | [
0,
0,
0,
0,
4,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import copy\n",
"import unittest\n",
"import mock\n",
"from oslo_serialization import jsonutils\n",
"from oslo_utils import uuidutils\n",
"from requests import exceptions as requests_exceptions\n",
"from vmware_nsxlib import v3\n",
"from vmware_nsxlib.v3 import client as nsx_client\n",
"from vmware... | [
"import copy\n",
"import unittest\n",
"import mock\n",
"from oslo_serialization import jsonutils\n",
"from oslo_utils import uuidutils\n",
"from requests import exceptions as requests_exceptions\n",
"from vmware_nsxlib import v3\n",
"from vmware_nsxlib.v3 import client as nsx_client\n",
"from vmware... | [
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'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_53(self):...\n",
"VAR_2 = {'nosec': 2, 'loc': 7, 'issues': {'CONFIDENCE': {'HIGH': 5},\n 'SEVERITY': {'LOW': 5}}}\n",
"self.check_metrics('skip.py', VAR_2)\n",
"VAR_2 = {'nosec': 0, 'loc': 4, 'issues': {'CONFIDENCE': {'HIGH': 2},\n 'SEVERITY': {'LOW': 2}}}\n",
"self.check_metrics('imports.py... | [
"def test_metric_gathering(self):...\n",
"expect = {'nosec': 2, 'loc': 7, 'issues': {'CONFIDENCE': {'HIGH': 5},\n 'SEVERITY': {'LOW': 5}}}\n",
"self.check_metrics('skip.py', expect)\n",
"expect = {'nosec': 0, 'loc': 4, 'issues': {'CONFIDENCE': {'HIGH': 2},\n 'SEVERITY': {'LOW': 2}}}\n",
"self.check_me... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"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_... | [
"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('HT... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"Return'"
] |
[
"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_0(self):...\n",
""
] | [
"def write(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(self):...\n",
"return shellutil.run('service sshd restart', VAR_10=False)\n"
] | [
"def restart_ssh_service(self):...\n",
"return shellutil.run('service sshd restart', chk_err=False)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self):...\n",
"return self._email\n"
] | [
"def email(self):...\n",
"return self._email\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"VAR_0 = 'pos.open.statement'\n",
"VAR_1 = 'Open Statements'\n",
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = []\n",
"VAR_7 = self.pool.get('ir.model.data')\n",
"VAR_8 = self.p... | [
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"_name = 'pos.open.statement'\n",
"_description = 'Open Statements'\n",
"def open_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\... | [
0,
0,
0,
0,
0,
0,
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,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'... |
[
"def FUNC_45(self):...\n",
"return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n"
] | [
"def get_image_column_list(self):...\n",
"return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_18(self, VAR_11):...\n",
"assert json.loads(self.response.content) == json.loads(VAR_11)\n",
"return self\n"
] | [
"def then_response_should_be_json(self, json_string):...\n",
"assert json.loads(self.response.content) == json.loads(json_string)\n",
"return self\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Return'"
] |
[
"def FUNC_9(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"logging.error('Error: %s\\n%s', self._attributes, VAR_8)\n",
"self.post_event('bot_error', VAR_8)\n",
"logging.exception('post_error(%s) failed.', VAR_8)\n"
] | [
"def post_error(self, message):...\n",
"\"\"\"docstring\"\"\"\n",
"logging.error('Error: %s\\n%s', self._attributes, message)\n",
"self.post_event('bot_error', message)\n",
"logging.exception('post_error(%s) failed.', message)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"VAR_5 = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'enableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'credentials': s... | [
"def enable_server_group(self):...\n",
"job = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'enableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'cred... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_31(self):...\n",
""
] | [
"def touch_or_create(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(VAR_6):...\n",
"VAR_18 = VAR_6.result()\n",
"if VAR_18.status_code == requests.codes.server_error:\n",
"FUNC_4(VAR_18.json())\n",
"VAR_18.raise_for_status()\n",
"if VAR_18.text:\n",
"return VAR_18.json()\n",
"return None\n"
] | [
"def JsonFromFuture(future):...\n",
"response = future.result()\n",
"if response.status_code == requests.codes.server_error:\n",
"_RaiseExceptionForData(response.json())\n",
"response.raise_for_status()\n",
"if response.text:\n",
"return response.json()\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self, VAR_14, VAR_12=None, VAR_13=False):...\n",
"return self.url_get(VAR_14, VAR_12=headers, VAR_13=silent)\n"
] | [
"def get(self, uuid, headers=None, silent=False):...\n",
"return self.url_get(uuid, headers=headers, silent=silent)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_7=None, VAR_8=''):...\n",
"if not VAR_4:\n",
"FUNC_0(VAR_51.settings['Output_dir'])\n",
"if VAR_7:\n",
"VAR_28 = random.choice(VAR_7)\n",
"VAR_28 = random.choice(VAR_4)\n",
"print('\\tgetRandomImage(): Chose random image {} (filter {})'.format(VAR_28,\n VAR_8))\n",
"VAR_13 = FUNC_1(... | [
"def getRandomImage(filteredImagesCache=None, randomImageFilter=''):...\n",
"if not savedImagesCache:\n",
"generateSavedImagesCache(settings.settings['Output_dir'])\n",
"if filteredImagesCache:\n",
"randomImage = random.choice(filteredImagesCache)\n",
"randomImage = random.choice(savedImagesCache)\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'DELETE FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"VAR_2.commit()\n"
] | [
"def clear_all(self):...\n",
"connection = self.connect()\n",
"query = 'DELETE FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"connection.commit()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@validate(VAR_0=VMeetup('id'), VAR_15=VMenu('controller', CommentSortMenu),...\n",
"VAR_18 = Link._byID(VAR_0.assoc_link)\n",
"VAR_20 = c.user.pref_num_comments or g.num_comments\n",
"VAR_21 = g.max_comments if VAR_16 == 'true' else VAR_20\n",
"VAR_22 = CommentBuilder(VAR_18, CommentSortMenu.operator(VAR_1... | [
"@validate(meetup=VMeetup('id'), sort=VMenu('controller', CommentSortMenu),...\n",
"article = Link._byID(meetup.assoc_link)\n",
"user_num = c.user.pref_num_comments or g.num_comments\n",
"num = g.max_comments if num_comments == 'true' else user_num\n",
"builder = CommentBuilder(article, CommentSortMenu.oper... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_26(self, VAR_14, VAR_30):...\n",
"VAR_12 = \"%s '%s' '%s'\" % (VAR_5, VAR_30, VAR_14)\n",
"FUNC_7(self.session, VAR_12)\n"
] | [
"def start_clone_session(self, comp_name, session_name):...\n",
"cmd = \"%s '%s' '%s'\" % (SCRIPT_CLONE_PATH, session_name, comp_name)\n",
"send_main_session_command(self.session, cmd)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_8, VAR_10, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.fileExists(VAR_8):\n",
"VAR_7 = (\n \"INSERT INTO {0} (type, path, meta, mod_time) VALUES (1, '{1}', '{2}', '{3}');\"\n .format(VAR_2, VAR_8, utils.SQLiteUtils.escapeText(VAR_10), VAR_9))\n",
"print('addMetafile: M... | [
"def addMetafile(self, pth, metadata, mod_time):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.fileExists(pth):\n",
"command = (\n \"INSERT INTO {0} (type, path, meta, mod_time) VALUES (1, '{1}', '{2}', '{3}');\"\n .format(TABLE_NAME, pth, utils.SQLiteUtils.escapeText(metadata), mod_time))\n",
"print... | [
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_1 = resolve(f'/link_habitandpractice_to_puc/{self.objects.ehp.pk}/')\n",
"self.assertEqual(VAR_1.func, views.link_habitsandpractices)\n"
] | [
"def test_link_habitandpractice_to_puc(self):...\n",
"found = resolve(f'/link_habitandpractice_to_puc/{self.objects.ehp.pk}/')\n",
"self.assertEqual(found.func, views.link_habitsandpractices)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_21 = [VAR_28 for VAR_28 in self.expanded_output if VAR_28.exists]\n",
"if VAR_21:\n",
"logger.info(\n \"\"\"Removing output files of failed job {} since they might be corrupted:\n{}\"\"\"\n .format(self, ', '.join(VAR_21)))\n",
"for VAR_28 i... | [
"def cleanup(self):...\n",
"\"\"\"docstring\"\"\"\n",
"to_remove = [f for f in self.expanded_output if f.exists]\n",
"if to_remove:\n",
"logger.info(\n \"\"\"Removing output files of failed job {} since they might be corrupted:\n{}\"\"\"\n .format(self, ', '.join(to_remove)))\n",
"for f in to_remove... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_15(self, VAR_15, VAR_8):...\n",
"VAR_27, VAR_28 = super().as_sql(VAR_15, VAR_8)\n",
"VAR_27 = '%s::%s' % (VAR_27, self.lhs.output_field.db_type(VAR_8))\n",
"return VAR_27, VAR_28\n"
] | [
"def as_sql(self, qn, connection):...\n",
"sql, params = super().as_sql(qn, connection)\n",
"sql = '%s::%s' % (sql, self.lhs.output_field.db_type(connection))\n",
"return sql, params\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2():...\n",
"for blog in frappe.db.sql_list(\n",
"clear_cache(blog)\n",
"clear_cache('writers')\n"
] | [
"def clear_blog_cache():...\n",
"for blog in frappe.db.sql_list(\n",
"clear_cache(blog)\n",
"clear_cache('writers')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"Expr'"
] |
[
"def __call__(self):...\n",
"return self\n"
] | [
"def __call__(self):...\n",
"return self\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(VAR_8):...\n",
"return urllib.parse.quote_plus(VAR_8)\n"
] | [
"def url_escape(url):...\n",
"return urllib.parse.quote_plus(url)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"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_6(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = ('ga.js', 'analytics.js', 'quant.js', 'chartbeat.js',\n 'chartbeat_mab.js', 'beacon.js', 'krxd.net')\n",
"VAR_19 = str(VAR_6.content)\n",
"for script in VAR_18:\n",
"if script in VAR_19:\n",
"return True\n",
"return False\n"
] | [
"def validate_not_using_analytics(page):...\n",
"\"\"\"docstring\"\"\"\n",
"analytics_scripts = ('ga.js', 'analytics.js', 'quant.js', 'chartbeat.js',\n 'chartbeat_mab.js', 'beacon.js', 'krxd.net')\n",
"page_str = str(page.content)\n",
"for script in analytics_scripts:\n",
"if script in page_str:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_7, **VAR_8):...\n",
"VAR_8['backend'] = 'Simulator'\n",
"super().__init__(VAR_7, **kwargs)\n"
] | [
"def __init__(self, wires, **kwargs):...\n",
"kwargs['backend'] = 'Simulator'\n",
"super().__init__(wires, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.RESTART, *VAR_13, **kwargs)\n"
] | [
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.RESTART, *args, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_8(VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9['name']\n",
"if len(VAR_9['key']) > VAR_5:\n",
"VAR_9['key']\n"
] | [
"def validateNewKeyData(data):...\n",
"\"\"\"docstring\"\"\"\n",
"data['name']\n",
"if len(data['key']) > KEY_SIZE_LIMIT:\n",
"data['key']\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"VAR_15 = self.mock_nsx_clustered_api(http_read_timeout=37, http_timeout=7)\n",
"VAR_15.get('logical-ports')\n",
"VAR_16 = VAR_15.recorded_calls.method_calls[0]\n",
"VAR_17, VAR_0, VAR_1 = VAR_16\n",
"self.assertEqual(VAR_1['timeout'], (7, 37))\n"
] | [
"def test_timeouts(self):...\n",
"api = self.mock_nsx_clustered_api(http_read_timeout=37, http_timeout=7)\n",
"api.get('logical-ports')\n",
"mock_call = api.recorded_calls.method_calls[0]\n",
"name, args, kwargs = mock_call\n",
"self.assertEqual(kwargs['timeout'], (7, 37))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_26(VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_68 = len(VAR_17)\n",
"VAR_69 = lambda x: int(float(x) / 100 * VAR_68)\n",
"VAR_70 = [VAR_17[VAR_69(start):VAR_69(end)] for start, end in bconfig.\n CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(VAR_70)\n"
] | [
"def _get_partial_text(fulltext):...\n",
"\"\"\"docstring\"\"\"\n",
"length = len(fulltext)\n",
"get_index = lambda x: int(float(x) / 100 * length)\n",
"partial_text = [fulltext[get_index(start):get_index(end)] for start, end in\n bconfig.CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(partial_tex... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"if self._services is None:\n",
"VAR_79 = mock(Services)\n",
"return self._services\n",
"VAR_79.keymanager = self.keymanager\n",
"VAR_79.mail_service = self.mail_service\n",
"VAR_79.draft_service = self.draft_service\n",
"VAR_79.search_engine = self.search_engine\n",
"VAR_79.feedba... | [
"@property...\n",
"if self._services is None:\n",
"services = mock(Services)\n",
"return self._services\n",
"services.keymanager = self.keymanager\n",
"services.mail_service = self.mail_service\n",
"services.draft_service = self.draft_service\n",
"services.search_engine = self.search_engine\n",
"ser... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(self, VAR_2: str):...\n",
"\"\"\"docstring\"\"\"\n",
"self.username = VAR_2\n",
"db.session.commit()\n"
] | [
"def update_username(self, username: str):...\n",
"\"\"\"docstring\"\"\"\n",
"self.username = username\n",
"db.session.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(VAR_35, VAR_27):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_52 = ''\n",
"for result in VAR_35:\n",
"VAR_80 = VAR_35[result]\n",
"VAR_52 += '\\n--\\n{0}'.format(FUNC_21())\n",
"if VAR_80:\n",
"return VAR_52\n",
"VAR_89 = sorted(VAR_80, key=lambda x: list_result[x], reverse=True)\n",
"VAR_5... | [
"def _output_text(complete_output, categories):...\n",
"\"\"\"docstring\"\"\"\n",
"output = ''\n",
"for result in complete_output:\n",
"list_result = complete_output[result]\n",
"output += '\\n--\\n{0}'.format(_signature())\n",
"if list_result:\n",
"return output\n",
"list_result_sorted = sorted(lis... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"AugAssign'",
"Condition",
"Return'",
"Assign'",
"AugAssign'",
"For",
"AugAssign'"
] |
[
"def FUNC_0(self):...\n",
"self.reg = self.eng.allocate_qureg(self.wires)\n"
] | [
"def reset(self):...\n",
"self.reg = self.eng.allocate_qureg(self.wires)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __init__(self, VAR_11, VAR_24, VAR_25, VAR_6, VAR_26=None, VAR_27=...\n",
"self.url = VAR_11\n",
"self.output = VAR_24\n",
"self.command = VAR_25\n",
"self.logger = VAR_6.bind(context=type(self).__name__, seedurl=url)\n",
"self.policy = VAR_27\n",
"self.tempdir = VAR_26\n",
"self.copyLock = None ... | [
"def __init__(self, url, output, command, logger, tempdir=None, policy=...\n",
"self.url = url\n",
"self.output = output\n",
"self.command = command\n",
"self.logger = logger.bind(context=type(self).__name__, seedurl=url)\n",
"self.policy = policy\n",
"self.tempdir = tempdir\n",
"self.copyLock = None ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"VAR_19 = self.common.get_volume_stats(VAR_5)\n",
"VAR_19['storage_protocol'] = 'iSCSI'\n",
"VAR_20 = self.configuration.safe_get('volume_backend_name')\n",
"VAR_19['volume_backend_name'] = VAR_20 or self.__class__.__name__... | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"stats = self.common.get_volume_stats(refresh)\n",
"stats['storage_protocol'] = 'iSCSI'\n",
"backend_name = self.configuration.safe_get('volume_backend_name')\n",
"stats['volume_backend_name'] = backend_name or self.__class... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
"def _init_common(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, **VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in VAR_0:\n",
"setattr(self, field_name, VAR_0[field_name])\n",
"VAR_1.pop(-1)\n",
"VAR_2 = self._meta.get_field(field_name)\n",
"VAR_1.extend(['... | [
"def update_fields(self, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"sql = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in kwargs:\n",
"setattr(self, field_name, kwargs[field_name])\n",
"sql.pop(-1)\n",
"field = self._meta.get_field(field_name)\n",
"sql.exten... | [
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
4,
4,
4,
0,
4,
4,
4,
4,
4
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"@FUNC_0...\n",
"VAR_11 = '\\n'.join(('<a href=\"/mapmaker\">/mapmaker</a><br/>',\n '<a href=\"/map\">/map</a><br/>', '<a href=\"/login\">/login</a><br/>',\n '<a href=\"/settings\">/settings</a><br/>',\n '<a href=\"/mazetest\">/mazetest</a><br/>',\n '<a href=\"http://disco.fleo.se/TEAM%2010%20FTW!!!\"... | [
"@handle_html...\n",
"text = '\\n'.join(('<a href=\"/mapmaker\">/mapmaker</a><br/>',\n '<a href=\"/map\">/map</a><br/>', '<a href=\"/login\">/login</a><br/>',\n '<a href=\"/settings\">/settings</a><br/>',\n '<a href=\"/mazetest\">/mazetest</a><br/>',\n '<a href=\"http://disco.fleo.se/TEAM%2010%20FTW!!... | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_38(VAR_0)\n",
"VAR_6 = VAR_6[VAR_6.find(\"'\") + 1:VAR_6.rfind(\"'\")]\n",
"VAR_6 = ':'.join(VAR_6.rsplit('.', 1))\n",
"return VAR_6\n"
] | [
"def class2str(value):...\n",
"\"\"\"docstring\"\"\"\n",
"s = str(value)\n",
"s = s[s.find(\"'\") + 1:s.rfind(\"'\")]\n",
"s = ':'.join(s.rsplit('.', 1))\n",
"return s\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(VAR_36):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = {}\n",
"for VAR_76, v in VAR_36:\n",
"VAR_66[VAR_76] = v\n",
"return VAR_66\n"
] | [
"def _kw(keywords):...\n",
"\"\"\"docstring\"\"\"\n",
"r = {}\n",
"for k, v in keywords:\n",
"r[k] = v\n",
"return r\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"import sqlite3 as sqlite\n",
"from SQLObjectStore import SQLObjectStore\n",
"\"\"\"string\"\"\"\n",
"def FUNC_0(self, VAR_0, VAR_1=False):...\n",
"if not VAR_0.get('database'):\n",
"VAR_0['database'] = '%s.db' % self._model.sqlDatabaseName()\n",
"def FUNC_1(self):...\n",
"VAR_5 = self._dbArgs.copy()\... | [
"import sqlite3 as sqlite\n",
"from SQLObjectStore import SQLObjectStore\n",
"\"\"\"SQLiteObjectStore implements an object store backed by a SQLite database.\n\n See the SQLite docs or the DB API 2.0 docs for more information:\n https://docs.python.org/2/library/sqlite3.html\n https://www.python.or... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Condition",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(), max_retries=5)\n"
] | [
"def test_z_delete_load_balancer(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(), max_retries=5)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_0(self, VAR_1: int, VAR_2: str):...\n",
"VAR_4 = f'SELECT {VAR_2} FROM user_info WHERE member_id = {VAR_1};'\n",
"return await self.db_conn.fetchval(VAR_4)\n"
] | [
"async def fetch_user_info(self, member_id: int, column: str):...\n",
"query = f'SELECT {column} FROM user_info WHERE member_id = {member_id};'\n",
"return await self.db_conn.fetchval(query)\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None, VAR_17='', VAR_18='',...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11)\n",
"VAR_29 = VAR_28.get_tile_path(VAR_17, VAR_18, VAR_19)\n",
"if os.path.isfile(VAR_29):\n",
"VAR_32 = open(VAR_29, 'rb')\n",
"return Htt... | [
"def get(self, request, pk=None, project_pk=None, z='', x='', y=''):...\n",
"\"\"\"docstring\"\"\"\n",
"task = self.get_and_check_task(request, pk, project_pk)\n",
"tile_path = task.get_tile_path(z, x, y)\n",
"if os.path.isfile(tile_path):\n",
"tile = open(tile_path, 'rb')\n",
"return HttpResponse(FileW... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"VAR_15, self._timers = self._timers, []\n",
"for t in VAR_15:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer thread did not ... | [
"def cancel_all_timers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"timers = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"timers, self._timers = self._timers, []\n",
"for t in timers:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer threa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'"
] |
[
"@app.route('/api/indi_profiles', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_profiles]\n"
] | [
"@app.route('/api/indi_profiles', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_profiles]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_8 = dbaseConn()\n",
"VAR_9 = 'DELETE FROM `User` WHERE `uid`=%s'\n",
"cursor.execute(VAR_9, (VAR_4,))\n",
"VAR_8.db_conn_close()\n",
"VAR_8.db_conn_close()\n",
"VAR_8.db.commit()\n",
"return False\n",
"return True\n"
] | [
"@staticmethod...\n",
"dbcon = dbaseConn()\n",
"sql = 'DELETE FROM `User` WHERE `uid`=%s'\n",
"cursor.execute(sql, (user_id,))\n",
"dbcon.db_conn_close()\n",
"dbcon.db_conn_close()\n",
"dbcon.db.commit()\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.ime_properties.get('start_chars')\n",
"return ''\n"
] | [
"def get_start_chars(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.ime_properties.get('start_chars')\n",
"return ''\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'",
"Return'"
] |
[
"def FUNC_19(self, VAR_6, VAR_14):...\n",
"self.common.extend_volume(VAR_6, VAR_14)\n"
] | [
"def extend_volume(self, volume, new_size):...\n",
"self.common.extend_volume(volume, new_size)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@route('GET', '/-test/jquery-cookie.js', VAR_1=website)...\n",
"get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n",
"return (as_path(__file__).dirname() / 'jquery-cookie.js').text()\n"
] | [
"@route('GET', '/-test/jquery-cookie.js', website=website)...\n",
"get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n",
"return (as_path(__file__).dirname() / 'jquery-cookie.js').text()\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = psycopg2.connect(database=DBNAME)\n",
"VAR_3 = VAR_2.cursor()\n",
"VAR_3.execute(\"insert into posts values('%s')\" % VAR_1)\n",
"VAR_2.commit()\n",
"VAR_2.close()\n"
] | [
"def add_post(content):...\n",
"\"\"\"docstring\"\"\"\n",
"db = psycopg2.connect(database=DBNAME)\n",
"c = db.cursor()\n",
"c.execute(\"insert into posts values('%s')\" % content)\n",
"db.commit()\n",
"db.close()\n"
] | [
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_1: 'projects.Project', VAR_2: 'projects.ProjectStep') ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = VAR_2.definition.name.rsplit('.', 1)[0]\n",
"VAR_8 = types.ModuleType(VAR_7)\n",
"VAR_17 = f.read()\n",
"VAR_3 = InspectLoader.source_to_code(VAR_17, VAR_2.source_path)\n",
"return FU... | [
"def run(project: 'projects.Project', step: 'projects.ProjectStep') ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"module_name = step.definition.name.rsplit('.', 1)[0]\n",
"module = types.ModuleType(module_name)\n",
"source_code = f.read()\n",
"code = InspectLoader.source_to_code(source_code, step.source_path... | [
0,
0,
0,
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_31(self):...\n",
"if 'saml_data' in VAR_15:\n",
"return VAR_15['saml_data']['session_index']\n"
] | [
"def _current_saml_session_id(self):...\n",
"if 'saml_data' in session:\n",
"return session['saml_data']['session_index']\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_0():...\n",
""
] | [
"def create_connection():...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(VAR_4, VAR_5=None, VAR_6=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = VAR_4\n",
"VAR_2 = VAR_6\n",
"if VAR_5 is not None:\n",
"assert all(issubclass(VAR_12, CLASS_6) for VAR_12 in VAR_5)\n",
"template.bootstrap({'auth': VAR_0})\n",
"VAR_3 = tuple(VAR_5)\n"
] | [
"def configure_ui(app_name, ui_tabs=None, ui_data_callback=None):...\n",
"\"\"\"docstring\"\"\"\n",
"_ui_app_name = app_name\n",
"_ui_data_callback = ui_data_callback\n",
"if ui_tabs is not None:\n",
"assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)\n",
"template.bootstrap({'auth': TEM... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assert'",
"Expr'",
"Assign'"
] |
[
"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'"
] |
[
"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_14(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
"def NativeFiletypeCompletionUsable(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"return ungettext_lazy(u'Deleted Mapping', u'Deleted Mappings', VAR_7)\n"
] | [
"@staticmethod...\n",
"return ungettext_lazy(u'Deleted Mapping', u'Deleted Mappings', count)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return VAR_6\n",
"for perm in VAR_2:\n",
"if not VAR_0.user.has_perm(perm, VAR_6):\n"
] | [
"def get_and_check_project(request, project_pk, perms=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"project = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return project\n",
"for perm in perms:\n",
"if not request.user.has_perm(perm, project):\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"For",
"Condition"
] |
[
"def FUNC_1(self, VAR_0, VAR_1, *VAR_2, **VAR_3):...\n",
"VAR_12 = JustURL.objects.get(VAR_1=pk)\n",
"VAR_11 = CounterCountingForm()\n",
"return render(VAR_0, 'success-url-view.html', {'object': VAR_12, 'form':\n VAR_11})\n"
] | [
"def get(self, request, pk, *args, **kwargs):...\n",
"object = JustURL.objects.get(pk=pk)\n",
"form = CounterCountingForm()\n",
"return render(request, 'success-url-view.html', {'object': object, 'form':\n form})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_13):...\n",
"self.filters = VAR_13\n"
] | [
"def __init__(self, filters):...\n",
"self.filters = filters\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"return {'id': self.id, 'name': self.name, 'category': self.category,\n 'program': self.program, 'arguments': self.arguments, 'readonly': self.\n readonly, 'ui_properties': self.ui_properties}\n"
] | [
"def to_map(self):...\n",
"return {'id': self.id, 'name': self.name, 'category': self.category,\n 'program': self.program, 'arguments': self.arguments, 'readonly': self.\n readonly, 'ui_properties': self.ui_properties}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, VAR_3):...\n",
"VAR_20 = VAR_3.value.upper()\n",
"if VAR_3.type == 'ID':\n",
"if not VAR_20 in self.spdx.licenses:\n",
"if VAR_3.type == 'EXC':\n",
"self.lastid = VAR_20\n",
"if VAR_20 not in self.spdx.exceptions:\n",
"if VAR_3.type != 'WITH':\n",
"if self.lastid not in self.spdx.e... | [
"def validate(self, tok):...\n",
"id = tok.value.upper()\n",
"if tok.type == 'ID':\n",
"if not id in self.spdx.licenses:\n",
"if tok.type == 'EXC':\n",
"self.lastid = id\n",
"if id not in self.spdx.exceptions:\n",
"if tok.type != 'WITH':\n",
"if self.lastid not in self.spdx.exceptions[id]:\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_2=None, VAR_3=None, VAR_4=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = VAR_2\n",
"self.address = VAR_2\n",
"if VAR_3:\n",
"self.set_variable('ansible_port', int(VAR_3))\n",
"if VAR_4:\n",
"self._uuid = get_unique_id()\n",
"se... | [
"def __init__(self, name=None, port=None, gen_uuid=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = name\n",
"self.address = name\n",
"if port:\n",
"self.set_variable('ansible_port', int(port))\n",
"if gen_uuid:\n",
"self._uuid = get_unique_id()\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\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_8, VAR_9 = 'eviluser', 'password'\n",
"VAR_10, VAR_11 = 'Evil', 'User'\n",
"VAR_12 = 'evil@deis.io'\n",
... | [
"def test_push_abuse(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"username, password = 'eviluser', 'password'\n",
"first_name, last_name = 'Evil', 'User'\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(VAR_7, VAR_10['host'], VAR_10['initiator'])\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(volume, connector['host'], connector[\n 'initiator'])\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"return 'check the main page'\n"
] | [
"def describe(self):...\n",
"return 'check the main page'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(VAR_5, VAR_32=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = VAR_5['device']\n",
"if VAR_1 in VAR_31:\n",
"VAR_32 = max(VAR_31[VAR_1]['level'], VAR_32)\n",
"VAR_31[VAR_1] = {'level': VAR_32, 'device': VAR_1, 'dev_type': VAR_5[\n 'dev_type']}\n",
"for holder in VAR_5['holders']:\n",
"FU... | [
"def flatten_holders_tree(tree, level=0):...\n",
"\"\"\"docstring\"\"\"\n",
"device = tree['device']\n",
"if device in reg:\n",
"level = max(reg[device]['level'], level)\n",
"reg[device] = {'level': level, 'device': device, 'dev_type': tree['dev_type']}\n",
"for holder in tree['holders']:\n",
"flatten... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"super().continue_dut('go 0 1')\n"
] | [
"def continue_dut(self):...\n",
"super().continue_dut('go 0 1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.