lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_22(self):...\n",
"self.cursor.execute('create table t1(s varchar(20))')\n",
"self.cursor.execute('insert into t1 values(?)', '1')\n",
"VAR_24 = self.cursor.execute('select * from t1').fetchone()\n",
"self.assertEqual(VAR_24[0], '1')\n",
"self.assertEqual(VAR_24[-1], '1')\n"
] | [
"def test_negative_row_index(self):...\n",
"self.cursor.execute('create table t1(s varchar(20))')\n",
"self.cursor.execute('insert into t1 values(?)', '1')\n",
"row = self.cursor.execute('select * from t1').fetchone()\n",
"self.assertEqual(row[0], '1')\n",
"self.assertEqual(row[-1], '1')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, *VAR_13, **VAR_14):...\n",
"super(CLASS_8, self).__init__(*VAR_13, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(CustomConfigForm, self).__init__(*args, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_10 = get_object_or_404(JustURL, VAR_1=pk)\n",
"return redirect(VAR_10.input_url)\n"
] | [
"def link_redirect(request, pk):...\n",
"instance = get_object_or_404(JustURL, pk=pk)\n",
"return redirect(instance.input_url)\n"
] | [
0,
6,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"from python_version_check import check_version\n",
"check_version((3, 4, 3))\n",
"VAR_0 = 1, 0, 10\n",
"import logging\n",
"from random import choice\n",
"from time import time\n",
"import requests, json\n",
"from threading import Thread\n",
"from queue import Queue\n",
"from traceback_printer im... | [
"from python_version_check import check_version\n",
"check_version((3, 4, 3))\n",
"VERSION_NUMBER = 1, 0, 10\n",
"import logging\n",
"from random import choice\n",
"from time import time\n",
"import requests, json\n",
"from threading import Thread\n",
"from queue import Queue\n",
"from traceback_p... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assig... |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.message = VAR_73\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.message = message\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, VAR_23):...\n",
"VAR_32 = ', '.join([str(each) for each in VAR_23])\n",
"for VAR_16 in VAR_23:\n",
"VAR_7 = self.get_directory_content(VAR_16)\n",
"VAR_0.delete('directory', 'id in (' + VAR_32 + ')')\n",
"self.remove_files([each['id'] for each in VAR_7['files']])\n",
"self.remove_dire... | [
"def remove_directories(self, directory_ids):...\n",
"directory_ids_string = ', '.join([str(each) for each in directory_ids])\n",
"for directory_id in directory_ids:\n",
"content = self.get_directory_content(directory_id)\n",
"db.delete('directory', 'id in (' + directory_ids_string + ')')\n",
"self.remove... | [
0,
4,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"return super().get_queryset().filter(Q(child_branch__isnull=False) | Q(\n child_leaf__learning_container_year__isnull=False))\n"
] | [
"def get_queryset(self):...\n",
"return super().get_queryset().filter(Q(child_branch__isnull=False) | Q(\n child_leaf__learning_container_year__isnull=False))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self, VAR_28=None, VAR_29=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = set(self.targets(VAR_28))\n",
"VAR_43 = defaultdict(set)\n",
"for target in self.targets(VAR_29):\n",
"for dependency in target.dependencies:\n",
"return VAR_43\n",
"if dependency in VAR_42:\n",
"VAR_43[target]... | [
"def dependents(self, on_predicate=None, from_predicate=None):...\n",
"\"\"\"docstring\"\"\"\n",
"core = set(self.targets(on_predicate))\n",
"dependees = defaultdict(set)\n",
"for target in self.targets(from_predicate):\n",
"for dependency in target.dependencies:\n",
"return dependees\n",
"if dependen... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Condition",
"Expr'"
] |
[
"@property...\n",
"return os.path.exists(self.file)\n"
] | [
"@property...\n",
"return os.path.exists(self.file)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_0(VAR_1):...\n",
"for key in VAR_6.__all__:\n",
"if not hasattr(VAR_1, key):\n",
"setattr(VAR_1, key, getattr(VAR_6, key))\n"
] | [
"def _include_filters(obj):...\n",
"for key in filters.__all__:\n",
"if not hasattr(obj, key):\n",
"setattr(obj, key, getattr(filters, key))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_42(self, VAR_16):...\n",
"VAR_25 = self.meta.get_field(VAR_16)\n",
"VAR_46 = self.get(VAR_16)\n",
"return self.cast(VAR_46, VAR_25)\n"
] | [
"def get_value(self, fieldname):...\n",
"df = self.meta.get_field(fieldname)\n",
"val = self.get(fieldname)\n",
"return self.cast(val, df)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_1.route('/')...\n",
"VAR_8 = ''\n",
"if VAR_18.get('tempFile') is not None:\n",
"if VAR_18['tempFile'] != '':\n",
"if 'filename' in request.args or VAR_4 != '' or 'currentFile' in VAR_18:\n",
"VAR_8 = open(VAR_18['tempFile']).read()\n",
"if not VAR_4:\n",
"return render_template('editor.html', V... | [
"@app.route('/')...\n",
"editor_content = ''\n",
"if session.get('tempFile') is not None:\n",
"if session['tempFile'] != '':\n",
"if 'filename' in request.args or filename != '' or 'currentFile' in session:\n",
"editor_content = open(session['tempFile']).read()\n",
"if not filename:\n",
"return render... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"VAR_11, VAR_10 = FUNC_1()\n",
"VAR_12 = FUNC_0()\n",
"VAR_11.execute(\"select image, avg(legit) as l FROM npc WHERE race='\" +\n VAR_2 + \"' AND class='\" + VAR_3 + \"' AND sex='\" + VAR_4 +\n \"' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;\")\n... | [
"def findNPC(race, classe, sex, level):...\n",
"c, conn = getConnection()\n",
"date = now()\n",
"c.execute(\"select image, avg(legit) as l FROM npc WHERE race='\" + race +\n \"' AND class='\" + classe + \"' AND sex='\" + sex +\n \"' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;\")\n",
"conn.co... | [
0,
0,
0,
4,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = 'koester@jimmy.harvard.edu'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import re\n",
"import sys\n",
"import inspect\n",
"import sre_constants\n",
"from collections import defaultdict\n",
"f... | [
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = 'koester@jimmy.harvard.edu'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import re\n",
"import sys\n",
"import inspect\n",
"import sre_constants\n",
"from collections import defaultdict\n",
"f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"FunctionDef... |
[
"def FUNC_4(self):...\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 2... | [
"def test_container_api_heroku(self):...\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/containers'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEq... | [
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"A... |
[
"def FUNC_22(self, VAR_17, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"import sys\n",
"import os\n",
"import re\n",
"import json\n",
"import shlex\n",
"import urllib.request\n",
"import codecs\n",
"VAR_0 = codecs.getreader('utf-8')\n",
"VAR_1 = 0\n",
"VAR_7 = '\\x1b[94m'\n",
"VAR_8 = '\\x1b[94m'\n",
"VAR_9 = '\\x1b[92m'\n",
"VAR_10 = '\\x1b[93m'\n",
"VAR_11 ... | [
"import sys\n",
"import os\n",
"import re\n",
"import json\n",
"import shlex\n",
"import urllib.request\n",
"import codecs\n",
"reader = codecs.getreader('utf-8')\n",
"return_code = 0\n",
"HEADER = '\\x1b[94m'\n",
"OKBLUE = '\\x1b[94m'\n",
"OKGREEN = '\\x1b[92m'\n",
"WARNING = '\\x1b[93m'\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
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Expr'... |
[
"import argparse\n",
"import logging\n",
"import os\n",
"import shutil\n",
"from .pyweb import DEFAULT_PYWEB_CONTENT_DIR, DEFAULT_PYWEB_LOG_DIR\n",
"def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n",
"self.logger = VAR_4 or logging.getLogger('ContentInstaller')\n",
"VAR_12, VAR_13, VAR_14 = s... | [
"import argparse\n",
"import logging\n",
"import os\n",
"import shutil\n",
"from .pyweb import DEFAULT_PYWEB_CONTENT_DIR, DEFAULT_PYWEB_LOG_DIR\n",
"def __init__(self, src_path, dst_path, www_root, logger=None):...\n",
"self.logger = logger or logging.getLogger('ContentInstaller')\n",
"_src, _dst, _ww... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"... |
[
"def FUNC_1():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = 'testing inband sql injection on parameter '\n",
"VAR_3 += \"'%s'\" % kb.injParameter\n",
"logger.info(VAR_3)\n",
"VAR_4 = ''\n",
"VAR_0 = agent.prefixQuery(' UNION ALL SELECT NULL')\n",
"for VAR_1 in (queries[kb.dbms].comment, ''):\n",
"VAR_... | [
"def unionTest():...\n",
"\"\"\"docstring\"\"\"\n",
"logMsg = 'testing inband sql injection on parameter '\n",
"logMsg += \"'%s'\" % kb.injParameter\n",
"logger.info(logMsg)\n",
"value = ''\n",
"query = agent.prefixQuery(' UNION ALL SELECT NULL')\n",
"for comment in (queries[kb.dbms].comment, ''):\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AugAssign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"AugAssign'",
"AugAssign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"async def FUNC_5(self):...\n",
"self.username = self.get_argument('username').lower()\n",
"self.email = self.get_argument('email').lower()\n",
"self.password = self.get_argument('psword').lower()\n",
"if re.fullmatch('^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$',\n",
"self.render('signup.h... | [
"async def post(self):...\n",
"self.username = self.get_argument('username').lower()\n",
"self.email = self.get_argument('email').lower()\n",
"self.password = self.get_argument('psword').lower()\n",
"if re.fullmatch('^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$',\n",
"self.render('signup.htm... | [
0,
0,
0,
0,
0,
0,
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_9(self, VAR_0, VAR_1, VAR_8, VAR_2, VAR_3=None):...\n",
"if not VAR_3:\n",
"VAR_3 = self.make_reqid()\n",
"VAR_5 = FUNC_9(VAR_0, VAR_1, VAR_8, VAR_3)\n",
"self.set_response_handler(VAR_3, VAR_2)\n",
"return VAR_5\n"
] | [
"def make_req_msg(self, interface, method, args, fun, reqid=None):...\n",
"if not reqid:\n",
"reqid = self.make_reqid()\n",
"msg = make_req_msg(interface, method, args, reqid)\n",
"self.set_response_handler(reqid, fun)\n",
"return msg\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_19():...\n",
"VAR_28 = getattr(VAR_1, VAR_30, None)\n",
"if not VAR_28:\n",
"VAR_64 = self.inspect()[VAR_30]\n",
"VAR_55 = self.sql_time_limit_ms\n",
"if VAR_64['file'] == ':memory:':\n",
"if VAR_34 and VAR_34 < VAR_55:\n",
"VAR_28 = sqlite3.connect(':memory:')\n",
"VAR_28 = sqlite3.connec... | [
"def sql_operation_in_thread():...\n",
"conn = getattr(connections, db_name, None)\n",
"if not conn:\n",
"info = self.inspect()[db_name]\n",
"time_limit_ms = self.sql_time_limit_ms\n",
"if info['file'] == ':memory:':\n",
"if custom_time_limit and custom_time_limit < time_limit_ms:\n",
"conn = sqlite3.... | [
0,
0,
0,
0,
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'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"As... |
[
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import psycopg2\n",
"import secretConstants\n",
"VAR_0 = ('dbname=' + secretConstants.DATABASE_NAME + ' user=' +\n secretConstants.DATABASE_USER + ' host=' + secretConstants.\n DATABASE_HOST + ' password=' + secretConstants.DATABASE_PASSWORD +\n ' port=' + secretConstants.DATABASE_PORT)\n",
"VAR_1 =... | [
"import psycopg2\n",
"import secretConstants\n",
"connectionString = ('dbname=' + secretConstants.DATABASE_NAME + ' user=' +\n secretConstants.DATABASE_USER + ' host=' + secretConstants.\n DATABASE_HOST + ' password=' + secretConstants.DATABASE_PASSWORD +\n ' port=' + secretConstants.DATABASE_PORT)\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_13(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"VAR_9 = '10.1.2.3'\n",
"for feature in ('confirmation', 'paging', 'events', 'formatoutput'):\n",
"self.driver._eql_execute('cli-settings', feature, 'off')\n",
"self.driver._eql_execute('grpparams', 's... | [
"def test_do_setup(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"fake_group_ip = '10.1.2.3'\n",
"for feature in ('confirmation', 'paging', 'events', 'formatoutput'):\n",
"self.driver._eql_execute('cli-settings', feature, 'off')\n",
"self.driver._eql_execute('... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = request.args.get('group_by')\n",
"if not VAR_4:\n",
"VAR_4 = ''\n",
"return VAR_4\n"
] | [
"def get_group_by_args():...\n",
"\"\"\"docstring\"\"\"\n",
"group_by = request.args.get('group_by')\n",
"if not group_by:\n",
"group_by = ''\n",
"return group_by\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"return 'magnet:?xt=urn:btih:%s&dn=%s' % (str(self.infohash).encode('hex'),\n self.title) + ('&tr=%s' % self.tracker_info if self.tracker_info else '')\n"
] | [
"def get_magnet(self):...\n",
"return 'magnet:?xt=urn:btih:%s&dn=%s' % (str(self.infohash).encode('hex'),\n self.title) + ('&tr=%s' % self.tracker_info if self.tracker_info else '')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_35(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 7}, 'CONFIDENCE': {'HIGH': 7}}\n",
"self.check_example('skip.py', VAR_2, VAR_1=True)\n"
] | [
"def test_ignore_skip(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 7}, 'CONFIDENCE': {'HIGH': 7}}\n",
"self.check_example('skip.py', expect, ignore_nosec=True)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_16(self, VAR_8, **VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = dict()\n",
"VAR_22.update(self.rule.workflow.globals)\n",
"VAR_22.update(dict(input=self.input, output=self.output, VAR_24=self.params,\n VAR_16=self._format_wildcards, threads=self.threads, VAR_23=self.\n resources, log=s... | [
"def format_wildcards(self, string, **variables):...\n",
"\"\"\"docstring\"\"\"\n",
"_variables = dict()\n",
"_variables.update(self.rule.workflow.globals)\n",
"_variables.update(dict(input=self.input, output=self.output, params=self.\n params, wildcards=self._format_wildcards, threads=self.threads,\n ... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self, VAR_0, VAR_2, VAR_1=False):...\n",
"\"\"\"docstring\"\"\"\n",
"self.b_mgr.scores = []\n",
"self.run_example(VAR_0, VAR_1=ignore_nosec)\n",
"VAR_5 = 0\n",
"VAR_6 = 0\n",
"for test_scores in self.b_mgr.scores:\n",
"for score_type in test_scores:\n",
"self.assertEqual(VAR_5, VAR_6)\n"... | [
"def check_example(self, example_script, expect, ignore_nosec=False):...\n",
"\"\"\"docstring\"\"\"\n",
"self.b_mgr.scores = []\n",
"self.run_example(example_script, ignore_nosec=ignore_nosec)\n",
"expected = 0\n",
"result = 0\n",
"for test_scores in self.b_mgr.scores:\n",
"for score_type in test_scor... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"For",
"Expr'",
"Expr'",
"For",
"AugAssign'",
"AugAssign'"
] |
[
"def FUNC_1():...\n",
""
] | [
"def b():...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@staticmethod...\n",
"return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', VAR_0)))\n"
] | [
"@staticmethod...\n",
"return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', scriptname)))\n"
] | [
0,
2
] | [
"Condition",
"Return'"
] |
[
"from . import pathexpr\n",
"from . import attrexpr\n",
"from . import ugoexpr\n",
"from . import fs\n",
"import copy\n",
"import collections\n",
"import itertools\n",
"import os\n",
"import glob\n",
"\"\"\"string\"\"\"\n",
"\"\"\"string\"\"\"\n",
"VAR_0 = {}\n",
"def FUNC_0(VAR_1):...\n",
... | [
"from . import pathexpr\n",
"from . import attrexpr\n",
"from . import ugoexpr\n",
"from . import fs\n",
"import copy\n",
"import collections\n",
"import itertools\n",
"import os\n",
"import glob\n",
"\"\"\"\n\n{\n \n 'collections' : {\n },\n \n 'globals' : {},\n \n 'rules' : {\n \n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Expr'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_30 = os.environ.get('OS_CONFIG_APPLIER_TEMPLATES', None)\n",
"if VAR_30 is None:\n",
"VAR_30 = '/opt/stack/os-apply-config/templates'\n",
"return VAR_30\n",
"if not os.path.isdir(VAR_30):\n",
"VAR_30 = '/opt/stack/os-config-applier/templates'\n",
... | [
"def templates_dir():...\n",
"\"\"\"docstring\"\"\"\n",
"templates_dir = os.environ.get('OS_CONFIG_APPLIER_TEMPLATES', None)\n",
"if templates_dir is None:\n",
"templates_dir = '/opt/stack/os-apply-config/templates'\n",
"return templates_dir\n",
"if not os.path.isdir(templates_dir):\n",
"templates_dir... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_34(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_80 = map(int, self.request.POST.getlist('case'))\n",
"self._update_objects = TestCase.objects.filter(pk__in=case_ids)\n",
"return self._update_objects\n"
] | [
"def get_update_targets(self):...\n",
"\"\"\"docstring\"\"\"\n",
"case_ids = map(int, self.request.POST.getlist('case'))\n",
"self._update_objects = TestCase.objects.filter(pk__in=case_ids)\n",
"return self._update_objects\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"import time\n",
"from urllib.parse import urlencode\n",
"from urllib import urlencode\n",
"from django.core.exceptions import SuspiciousOperation\n",
"from django.core.urlresolvers import reverse\n",
"from django.contrib import auth\n",
"from django.http import HttpResponseRedirect\n",
"from django.u... | [
"import time\n",
"from urllib.parse import urlencode\n",
"from urllib import urlencode\n",
"from django.core.exceptions import SuspiciousOperation\n",
"from django.core.urlresolvers import reverse\n",
"from django.contrib import auth\n",
"from django.http import HttpResponseRedirect\n",
"from django.u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_1(VAR_29, VAR_30, VAR_31, VAR_32, VAR_33):...\n",
"VAR_31.pack_forget()\n",
"VAR_10.forget()\n",
"VAR_40 = VAR_32, VAR_33\n",
"for key, value in VAR_25.items():\n",
"if value == VAR_40:\n",
"FUNC_5(VAR_29, VAR_32, VAR_33)\n",
"key.destroy()\n",
"FUNC_4(VAR_30)\n",
"VAR_41 = Label(VAR_15,... | [
"def add_recipe(recipe, ingredients, view, row, column):...\n",
"view.pack_forget()\n",
"viewRecipeFrame.forget()\n",
"searchIndex = row, column\n",
"for key, value in buttonDict.items():\n",
"if value == searchIndex:\n",
"save_weeks_recipes(recipe, row, column)\n",
"key.destroy()\n",
"save_ingredie... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_7.route('/create-calendar', methods=['GET', 'POST'])...\n",
"VAR_10 = FUNC_0()\n",
"if not VAR_10:\n",
"return 'Unauthorized'\n",
"VAR_8, VAR_3 = FUNC_1()\n",
"if request.method == 'POST':\n",
"VAR_16, VAR_17 = calendar.createCalendar(request.form['calendarName'],\n request.form['day'], VAR_8, ... | [
"@app.route('/create-calendar', methods=['GET', 'POST'])...\n",
"isAuthorized = isUserAuthorized()\n",
"if not isAuthorized:\n",
"return 'Unauthorized'\n",
"username, password = getUsernameAndPassword()\n",
"if request.method == 'POST':\n",
"res, calendarId = calendar.createCalendar(request.form['calend... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(VAR_0) == 22 and VAR_0[16:22] == '.onion':\n",
"return True\n",
"VAR_2 = str(VAR_0).split(':')\n",
"if len(VAR_2) == 2:\n",
"VAR_0 = VAR_2[0]\n",
"if VAR_0 in GLSetting.accepted_hosts:\n",
"return True\n",
"log.debug('Error in host requ... | [
"def validate_host(host_key):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(host_key) == 22 and host_key[16:22] == '.onion':\n",
"return True\n",
"hostchunk = str(host_key).split(':')\n",
"if len(hostchunk) == 2:\n",
"host_key = hostchunk[0]\n",
"if host_key in GLSetting.accepted_hosts:\n",
"return True... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_1):...\n",
"VAR_0[VAR_1.__name__] = VAR_1()\n",
"return VAR_1\n"
] | [
"def register_level(cls):...\n",
"FnLevel[cls.__name__] = cls()\n",
"return cls\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"VAR_24 = {'json': {'name': 'json', 'verbose_name': 'JSON'}, 'csv': {'name':\n 'csv', 'verbose_name': 'CSV'}, 'excel.csv': {'name': 'excel.csv',\n 'verbose_name': VAR_29('Excel compatible CSV')}}\n",
"return VAR_24[VAR_11]\n"
] | [
"@register.simple_tag...\n",
"format_infos = {'json': {'name': 'json', 'verbose_name': 'JSON'}, 'csv': {\n 'name': 'csv', 'verbose_name': 'CSV'}, 'excel.csv': {'name':\n 'excel.csv', 'verbose_name': _('Excel compatible CSV')}}\n",
"return format_infos[format]\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self, VAR_7, VAR_3=None):...\n",
"return self.get(VAR_7, VAR_3=filters, VAR_4=1)[0]\n"
] | [
"def getone(self, key, filters=None):...\n",
"return self.get(key, filters=filters, limit=1)[0]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"self.comp_name = VAR_2\n"
] | [
"def __init__(self, comp_name):...\n",
"\"\"\"docstring\"\"\"\n",
"self.comp_name = comp_name\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_4(VAR_11, VAR_12=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1['VERBOSITY'] >= 1:\n",
"VAR_0.info('$ ' + ' '.join(VAR_11))\n",
"VAR_19 = dict()\n",
"if VAR_1['VERBOSITY'] >= 3:\n",
"VAR_19['stdout'] = io.open(os.devnull, 'wb')\n",
"VAR_32 = subprocess.call(VAR_11, **kwargs)\n",
"VAR_... | [
"def sh(cmdline, ignore_failure=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if CONFIG['VERBOSITY'] >= 1:\n",
"logger.info('$ ' + ' '.join(cmdline))\n",
"kwargs = dict()\n",
"if CONFIG['VERBOSITY'] >= 3:\n",
"kwargs['stdout'] = io.open(os.devnull, 'wb')\n",
"ret = subprocess.call(cmdline, **kwargs)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = exifread.process_file(VAR_1, details=False)\n",
"if not len(VAR_9.keys()):\n",
"VAR_28 = \"This picture doesn't contain EXIF.\"\n",
"VAR_10 = VAR_9.get('EXIF DateTimeOriginal', None)\n",
"log.info(VAR_28)\n",
"VAR_10 = str(VAR_10) if VAR_10 els... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"exif = exifread.process_file(file, details=False)\n",
"if not len(exif.keys()):\n",
"reason = \"This picture doesn't contain EXIF.\"\n",
"date_time = exif.get('EXIF DateTimeOriginal', None)\n",
"log.info(reason)\n",
"date_time = str(date_time) if date_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(VAR_3):...\n",
"if not VAR_3:\n",
"return errors.BAD_USERNAME_CHARS\n",
"if len(VAR_3) < 3:\n",
"return errors.BAD_USERNAME_SHORT\n",
"if len(VAR_3) > 20:\n",
"return errors.BAD_USERNAME_LONG\n",
"return errors.BAD_USERNAME_CHARS\n"
] | [
"def whyuserbad(x):...\n",
"if not x:\n",
"return errors.BAD_USERNAME_CHARS\n",
"if len(x) < 3:\n",
"return errors.BAD_USERNAME_SHORT\n",
"if len(x) > 20:\n",
"return errors.BAD_USERNAME_LONG\n",
"return errors.BAD_USERNAME_CHARS\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_13(self, *VAR_16, **VAR_10):...\n",
"if not self.is_group_user(VAR_8):\n",
"return VAR_7(self, *VAR_16, **kwargs)\n"
] | [
"def wrapper(self, *args, **kwargs):...\n",
"if not self.is_group_user(group):\n",
"return method(self, *args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"@VAR_0.route('/entry_type')...\n",
"VAR_5 = ['Metals', 'Organics']\n",
"return render_template('entry.html', VAR_5=methods)\n"
] | [
"@app.route('/entry_type')...\n",
"methods = ['Metals', 'Organics']\n",
"return render_template('entry.html', methods=methods)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"import discord\n",
"from discord.ext import commands\n",
"from sys import argv\n",
"\"\"\"\n Commands that will mostly be used in #help-and-questions.\n \"\"\"\n",
"def __init__(self, VAR_0):...\n",
"self.bot = VAR_0\n",
"print('Addon \"{}\" loaded'.format(self.__class__.__name__))\n",
"async d... | [
"import discord\n",
"from discord.ext import commands\n",
"from sys import argv\n",
"\"\"\"\n Commands that will mostly be used in #help-and-questions.\n \"\"\"\n",
"def __init__(self, bot):...\n",
"self.bot = bot\n",
"print('Addon \"{}\" loaded'.format(self.__class__.__name__))\n",
"async def s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
... |
[
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"VAR_0 = pd.read_csv('Data.csv')\n",
"VAR_1 = VAR_0.iloc[:, :-1].values\n",
"VAR_2 = VAR_0.iloc[:, (-1)].values\n"
] | [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"dataset = pd.read_csv('Data.csv')\n",
"X = dataset.iloc[:, :-1].values\n",
"y = dataset.iloc[:, (-1)].values\n"
] | [
0,
0,
0,
7,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_20(self):...\n",
"VAR_25 = c.get('/test2')\n",
"self.assertEqual(VAR_25.status_code, 302)\n",
"self.assertTrue(VAR_25.location.startswith(self.app.config[\n 'TOKEN_SERVICE_URL']))\n"
] | [
"def test_authn(self):...\n",
"resp = c.get('/test2')\n",
"self.assertEqual(resp.status_code, 302)\n",
"self.assertTrue(resp.location.startswith(self.app.config['TOKEN_SERVICE_URL']))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_6 = self.client.get('/api/apps')\n",
"self.assertEqual(VAR_6.status_code, 200)\n",
"self.assertEqual(len(VAR_6.data['results']), 2)\n",
"VAR_8 = VAR_6.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n",
"VAR_6 = self.c... | [
"def test_create(self):...\n",
"response = self.client.get('/api/apps')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 2)\n",
"app_id = response.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(username='autotest-2', password='password'... | [
0,
5,
0,
0,
0,
5,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"For",
"Assign'",
"Expr'"
] |
[
"def FUNC_26(VAR_20):...\n",
"api.reset_local_state()\n",
"return VAR_7.get('/request', VAR_20=headers).body\n"
] | [
"def call(headers):...\n",
"api.reset_local_state()\n",
"return app.get('/request', headers=headers).body\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"from utils.admin import load_credentials\n",
"import MySQLdb\n",
"import json\n",
"VAR_0 = load_credentials()\n",
"VAR_1 = VAR_0['dbhost'], VAR_0['dbuser'], VAR_0['dbpass'], VAR_0['dbname']\n",
"def __init__(self):...\n",
"self.conn = MySQLdb.connect(*self.dsn)\n",
"self.cur = self.conn.cursor()\n",
... | [
"from utils.admin import load_credentials\n",
"import MySQLdb\n",
"import json\n",
"credentials = load_credentials()\n",
"dsn = credentials['dbhost'], credentials['dbuser'], credentials['dbpass'\n ], credentials['dbname']\n",
"def __init__(self):...\n",
"self.conn = MySQLdb.connect(*self.dsn)\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"self.assert404(self.client.get(url_for('oauthclient.authorized', remote_app\n ='invalid')))\n",
"self.assert404(self.client.get(url_for('oauthclient.disconnect', remote_app\n ='invalid')))\n"
] | [
"def test_no_remote_app(self):...\n",
"self.assert404(self.client.get(url_for('oauthclient.authorized', remote_app\n ='invalid')))\n",
"self.assert404(self.client.get(url_for('oauthclient.disconnect', remote_app\n ='invalid')))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = self.bot.ws._trace[0]\n",
"VAR_29 = 'the gateway'\n",
"await self.bot.change_presence(game=discord.Game(name=gateway, type=2),\n status=discord.Status.dnd)\n"
] | [
"async def on_connect(self):...\n",
"\"\"\"docstring\"\"\"\n",
"gateway = self.bot.ws._trace[0]\n",
"gateway = 'the gateway'\n",
"await self.bot.change_presence(game=discord.Game(name=gateway, type=2),\n status=discord.Status.dnd)\n"
] | [
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_34(self):...\n",
"VAR_51 = self.targetsfile\n",
"if not os.path.isfile(VAR_51):\n",
"return\n",
"VAR_52 = pickle.loads(f.read())\n",
"if 'targets' in VAR_52:\n",
"self.log.debug('Target list was loaded')\n",
"if 'forums' in VAR_52:\n",
"VAR_5.update(VAR_52['targets'])\n",
"self.log.debug... | [
"def load_targets(self):...\n",
"fname = self.targetsfile\n",
"if not os.path.isfile(fname):\n",
"return\n",
"data = pickle.loads(f.read())\n",
"if 'targets' in data:\n",
"self.log.debug('Target list was loaded')\n",
"if 'forums' in data:\n",
"targets.update(data['targets'])\n",
"self.log.debug('F... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"For",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = '(?P<var>(pass|key|secret|PASS|KEY|SECRET).*?=)(?P<value>.*?\\\\s)'\n",
"return re.sub(VAR_29, '\\\\g<var>****** ', VAR_4)\n"
] | [
"def _sanitize_log_msg(self, msg):...\n",
"\"\"\"docstring\"\"\"\n",
"reg = '(?P<var>(pass|key|secret|PASS|KEY|SECRET).*?=)(?P<value>.*?\\\\s)'\n",
"return re.sub(reg, '\\\\g<var>****** ', msg)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_24():...\n",
"\"\"\"docstring\"\"\"\n",
"Activity.__default_acl__ = property(FUNC_3)\n",
"CancelInvoice.__default_acl__ = property(FUNC_10)\n",
"Company.__default_acl__ = property(FUNC_4)\n",
"CompetenceGrid.__acl__ = property(FUNC_23)\n",
"CompetenceGridItem.__acl__ = property(FUNC_23)\n",
... | [
"def set_models_acl():...\n",
"\"\"\"docstring\"\"\"\n",
"Activity.__default_acl__ = property(get_activity_acl)\n",
"CancelInvoice.__default_acl__ = property(get_cancelinvoice_default_acl)\n",
"Company.__default_acl__ = property(get_company_acl)\n",
"CompetenceGrid.__acl__ = property(get_competence_acl)\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
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",... |
[
"def FUNC_12(self, VAR_13, VAR_14=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_36 = self.run_tracker.get_background_root_workunit()\n",
"if VAR_14:\n",
"VAR_44 = self.run_tracker.new_workunit_under_parent(VAR_17=\n parent_workunit_name, VAR_18=[WorkUnitLabel.MULTITOOL], parent=\n background_root_work... | [
"def submit_background_work_chain(self, work_chain, parent_workunit_name=None):...\n",
"\"\"\"docstring\"\"\"\n",
"background_root_workunit = self.run_tracker.get_background_root_workunit()\n",
"if parent_workunit_name:\n",
"workunit_parent_ctx = self.run_tracker.new_workunit_under_parent(name=\n parent_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_0, VAR_1, VAR_2):...\n",
"VAR_3 = VAR_0.get_input('project', default='')\n",
"VAR_4 = VAR_0.get_input('username', default='')\n",
"VAR_1['GCE_EMAIL'] = VAR_4\n",
"VAR_1['GCE_PROJECT'] = VAR_3\n",
"VAR_5 = {'type': 'service_account', 'private_key': VAR_0.get_input(\n 'ssh_key_data', defa... | [
"def gce(cred, env, private_data_dir):...\n",
"project = cred.get_input('project', default='')\n",
"username = cred.get_input('username', default='')\n",
"env['GCE_EMAIL'] = username\n",
"env['GCE_PROJECT'] = project\n",
"json_cred = {'type': 'service_account', 'private_key': cred.get_input(\n 'ssh_key... | [
0,
0,
0,
0,
0,
2,
2,
2,
2,
2,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_1(self):...\n",
"self.events.append('on_enter: %s' % self.path)\n"
] | [
"def on_enter(self):...\n",
"self.events.append('on_enter: %s' % self.path)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"if self._IsServerAlive():\n",
"self._server_popen.terminate()\n",
"utils.RemoveIfExists(self._temp_options_filename)\n"
] | [
"def _ServerCleanup(self):...\n",
"if self._IsServerAlive():\n",
"self._server_popen.terminate()\n",
"utils.RemoveIfExists(self._temp_options_filename)\n"
] | [
0,
0,
0,
7
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_38):...\n",
"if not VAR_38:\n",
"if self.emp_error is not None:\n",
"if len(VAR_38) > self.length:\n",
"VAR_101.errors.add(self.emp_error)\n",
"VAR_101.errors.add(self.len_error)\n",
"return VAR_38\n"
] | [
"def run(self, title):...\n",
"if not title:\n",
"if self.emp_error is not None:\n",
"if len(title) > self.length:\n",
"c.errors.add(self.emp_error)\n",
"c.errors.add(self.len_error)\n",
"return title\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"return self.submission_count\n"
] | [
"def get_submission_count(self):...\n",
"return self.submission_count\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"self.mock(time, 'time', lambda : 126.0)\n",
"def FUNC_22(VAR_14, VAR_15):...\n",
"VAR_37 = VAR_14.state['sleep_streak']\n",
"self.assertEqual(VAR_14.remote, self.server)\n",
"if VAR_37 == 5:\n",
"return False\n"
] | [
"def test_run_bot(self):...\n",
"self.mock(time, 'time', lambda : 126.0)\n",
"def poll_server(botobj, _):...\n",
"sleep_streak = botobj.state['sleep_streak']\n",
"self.assertEqual(botobj.remote, self.server)\n",
"if sleep_streak == 5:\n",
"return False\n"
] | [
0,
0,
0,
0,
5,
0,
0
] | [
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Return'"
] |
[
"def FUNC_16(self):...\n",
"self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n"
] | [
"def test_z_delete_app(self):...\n",
"self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_22(VAR_37):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_64 = {}\n",
"for VAR_95, info in iteritems(VAR_37):\n",
"if not VAR_95.nostandalone:\n",
"return VAR_64\n",
"VAR_64[VAR_95] = info\n"
] | [
"def clean_before_output(kw_matches):...\n",
"\"\"\"docstring\"\"\"\n",
"filtered_kw_matches = {}\n",
"for kw_match, info in iteritems(kw_matches):\n",
"if not kw_match.nostandalone:\n",
"return filtered_kw_matches\n",
"filtered_kw_matches[kw_match] = info\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_13(self, VAR_13, VAR_12, VAR_22=0):...\n",
"VAR_23 = self.wz.make_dealer_rep_msg(VAR_13, VAR_22, wzrpc.status.error, VAR_12\n )\n",
"self.wz_sock.send_multipart(VAR_23)\n"
] | [
"def send_wz_error(self, reqid, data, seqid=0):...\n",
"msg = self.wz.make_dealer_rep_msg(reqid, seqid, wzrpc.status.error, data)\n",
"self.wz_sock.send_multipart(msg)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4():...\n",
"VAR_11 = open('RedditAPIAccess.txt')\n",
"VAR_12 = []\n",
"for line in VAR_11:\n",
"VAR_12.append(line)\n",
"return line[2]\n"
] | [
"def getBotUsername():...\n",
"inputFile = open('RedditAPIAccess.txt')\n",
"lines = []\n",
"for line in inputFile:\n",
"lines.append(line)\n",
"return line[2]\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_18(*VAR_20, **VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = VAR_20[0]\n",
"if len(VAR_20) == 1:\n",
"VAR_53 = product\n",
"if len(VAR_20) == 2:\n",
"if isinstance(VAR_32, str):\n",
"VAR_53 = VAR_20[1]\n",
"VAR_32 = [VAR_32]\n",
"def FUNC_36(VAR_11):...\n",
"for VAR_51, VAR_58 in... | [
"def expand(*args, **wildcards):...\n",
"\"\"\"docstring\"\"\"\n",
"filepatterns = args[0]\n",
"if len(args) == 1:\n",
"combinator = product\n",
"if len(args) == 2:\n",
"if isinstance(filepatterns, str):\n",
"combinator = args[1]\n",
"filepatterns = [filepatterns]\n",
"def flatten(wildcards):...\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"FunctionDef'",
"For",
"Condition",
"Return'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7):...\n",
"setattr(self, 'name', VAR_1)\n",
"setattr(self, 'id', VAR_0)\n",
"VAR_17 = {}\n",
"VAR_17['type'] = None\n",
"VAR_17['issued'] = str(VAR_6)\n",
"VAR_17['synopsis'] = VAR_2\n",
"VAR_17['description'] = VAR_4\n",
"VAR... | [
"def __init__(self, id, name, synopsis, severity, description, solution,...\n",
"setattr(self, 'name', name)\n",
"setattr(self, 'id', id)\n",
"mydict = {}\n",
"mydict['type'] = None\n",
"mydict['issued'] = str(issued)\n",
"mydict['synopsis'] = synopsis\n",
"mydict['description'] = description\n",
"m... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3():...\n",
"def FUNC_12():...\n",
"VAR_18 = requests.get(FUNC_2('healthy'))\n",
"VAR_18.raise_for_status()\n",
"return VAR_18.json()\n"
] | [
"def _CheckServerIsHealthyWithCache():...\n",
"def _ServerIsHealthy():...\n",
"response = requests.get(_BuildUri('healthy'))\n",
"response.raise_for_status()\n",
"return response.json()\n"
] | [
0,
0,
7,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"if not GenericRequest.test_success(self):\n",
"return False\n",
"self.get_user_test_info()\n",
"return False\n",
"return True\n"
] | [
"def test_success(self):...\n",
"if not GenericRequest.test_success(self):\n",
"return False\n",
"self.get_user_test_info()\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_17(self, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_15 is None:\n",
"return dict()\n",
"VAR_37 = 0\n",
"VAR_38 = None\n",
"for o in self.products:\n",
"VAR_47 = o.match(VAR_15)\n",
"return VAR_38\n",
"if VAR_47:\n",
"VAR_50 = self.get_wildcard_len(VAR_47.groupdict())\n",
"if ... | [
"def get_wildcards(self, requested_output):...\n",
"\"\"\"docstring\"\"\"\n",
"if requested_output is None:\n",
"return dict()\n",
"bestmatchlen = 0\n",
"bestmatch = None\n",
"for o in self.products:\n",
"match = o.match(requested_output)\n",
"return bestmatch\n",
"if match:\n",
"l = self.get_wi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_0():...\n",
"VAR_1 = config('cuckoo:cuckoo:machinery')\n",
"if config('routing:vpn:enabled'):\n",
"VAR_4 = config('routing:vpn:vpns')\n",
"VAR_4 = []\n",
"return {'machine': config('%s:%s:machines' % (VAR_1, VAR_1)), 'package':\n None, 'priority': 2, 'timeout': config('cuckoo:timeouts:default... | [
"def defaults():...\n",
"machinery = config('cuckoo:cuckoo:machinery')\n",
"if config('routing:vpn:enabled'):\n",
"vpns = config('routing:vpn:vpns')\n",
"vpns = []\n",
"return {'machine': config('%s:%s:machines' % (machinery, machinery)),\n 'package': None, 'priority': 2, 'timeout': config(\n 'cucko... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"return self._user_id\n"
] | [
"def user_id(self):...\n",
"return self._user_id\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_43(self, VAR_21=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = list()\n",
"VAR_21 = VAR_21 or self.get_columns_list()\n",
"for VAR_14 in VAR_21:\n",
"if not self.is_relation(VAR_14):\n",
"return VAR_32\n",
"if hasattr(self.obj, VAR_14):\n",
"if not hasattr(getattr(self.obj, VAR_14), '_... | [
"def get_order_columns_list(self, list_columns=None):...\n",
"\"\"\"docstring\"\"\"\n",
"ret_lst = list()\n",
"list_columns = list_columns or self.get_columns_list()\n",
"for col_name in list_columns:\n",
"if not self.is_relation(col_name):\n",
"return ret_lst\n",
"if hasattr(self.obj, col_name):\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(VAR_4, VAR_1):...\n",
"VAR_38 = 5\n",
"if VAR_4 == 'country_ru' or VAR_4 == 'country_en':\n",
"VAR_52 = users.find_one(VAR_1).language + VAR_4\n",
"VAR_52 = VAR_4\n",
"VAR_39 = VAR_14 + timedelta(minutes=cache_time) < datetime.now(\n ) if VAR_14 else True\n",
"if not VAR_15.get(VAR_52, N... | [
"def function_launcher(item_type, message):...\n",
"cache_time = 5\n",
"if item_type == 'country_ru' or item_type == 'country_en':\n",
"result_id = users.find_one(message).language + item_type\n",
"result_id = item_type\n",
"high_time = when_was_called + timedelta(minutes=cache_time) < datetime.now(\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_21(self, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"for key, value in self.iscsi_ips.items():\n",
"if value['nsp'] == VAR_15:\n",
"return key\n"
] | [
"def _get_ip_using_nsp(self, nsp):...\n",
"\"\"\"docstring\"\"\"\n",
"for key, value in self.iscsi_ips.items():\n",
"if value['nsp'] == nsp:\n",
"return key\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Return'"
] |
[
"@functools.wraps(VAR_0)...\n",
"if not self.request.headers.get('X-XSRF-Token-Request'):\n",
"return VAR_0(self, *VAR_5, **kwargs)\n"
] | [
"@functools.wraps(f)...\n",
"if not self.request.headers.get('X-XSRF-Token-Request'):\n",
"return f(self, *args, **kwargs)\n"
] | [
0,
0,
0
] | [
"Condition",
"Condition",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_30 = VAR_12.rfind(',')\n",
"if VAR_30 > -1:\n",
"return VAR_11[0] % (VAR_12[:VAR_30], VAR_12[VAR_30 + 1:]) + '\\n'\n",
"return VAR_11[1] % VAR_12 + '\\n'\n"
] | [
"@staticmethod...\n",
"i = content.rfind(',')\n",
"if i > -1:\n",
"return cmdTemplate[0] % (content[:i], content[i + 1:]) + '\\n'\n",
"return cmdTemplate[1] % content + '\\n'\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_18(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_24 = list(self.clusters.values())\n",
"for VAR_39 in VAR_24:\n",
"VAR_24.remove(VAR_39)\n",
"VAR_39.master = self.master\n",
"if VAR_39.check_enabled():\n",
"VAR_34 = VAR_39.__class__.__name__\n",
"self.log_debug('Installation matches %s, ch... | [
"def determine_cluster(self):...\n",
"\"\"\"docstring\"\"\"\n",
"checks = list(self.clusters.values())\n",
"for cluster in checks:\n",
"checks.remove(cluster)\n",
"cluster.master = self.master\n",
"if cluster.check_enabled():\n",
"cname = cluster.__class__.__name__\n",
"self.log_debug('Installation ... | [
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_0():...\n",
"VAR_4 = [legacy_api.BuildBucketApi, config_api.ConfigApi, swarmbucket_api.\n SwarmbucketApi]\n",
"VAR_5 = [webapp2.Route('/', CLASS_0), webapp2.Route('/b/<build_id:\\\\d+>',\n CLASS_2), webapp2.Route('/build/<build_id:\\\\d+>', CLASS_3)]\n",
"VAR_5.extend(endpoints_webapp2.api_rou... | [
"def get_frontend_routes():...\n",
"endpoints_services = [legacy_api.BuildBucketApi, config_api.ConfigApi,\n swarmbucket_api.SwarmbucketApi]\n",
"routes = [webapp2.Route('/', MainHandler), webapp2.Route(\n '/b/<build_id:\\\\d+>', BuildRPCHandler), webapp2.Route(\n '/build/<build_id:\\\\d+>', ViewBuildH... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"AugAssign'",
"Return'"
] |
[
"def FUNC_7(self, VAR_1, VAR_9, VAR_10):...\n",
"if VAR_10 > 0:\n",
"VAR_20 = 'string' % (VAR_1, 0, 0)\n",
"self.c.execute(VAR_20)\n",
"VAR_20 = 'string' % (VAR_9, VAR_10, VAR_1)\n",
"self.c.execute(VAR_20)\n",
"self.db.commit()\n"
] | [
"def add_consumption_data_row(self, ts, energy_used, power_used):...\n",
"if power_used > 0:\n",
"query = (\n \"\"\"\n INSERT OR IGNORE INTO Consumption (\n TimeStamp,\n EnergyUsed,\n PowerUsed \n ... | [
0,
0,
4,
0,
4,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"self._tmp_dir = TempDir()\n",
"self.accounts = {}\n"
] | [
"def _initialize(self):...\n",
"self._tmp_dir = TempDir()\n",
"self.accounts = {}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(self, VAR_20, VAR_23):...\n",
"return self._store\n"
] | [
"def new_connection(self, cluster_api, provider):...\n",
"return self._store\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(VAR_17):...\n",
"VAR_35 = os.path.dirname(VAR_17)\n",
"if not os.path.exists(VAR_35):\n",
"os.makedirs(VAR_35)\n"
] | [
"def ensure_dir(file_path):...\n",
"directory = os.path.dirname(file_path)\n",
"if not os.path.exists(directory):\n",
"os.makedirs(directory)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_7(VAR_1, VAR_9=None, **VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_9 is None:\n",
"VAR_9 = {'hours': 4}\n",
"if isinstance(VAR_9, datetime.timedelta):\n",
"if isinstance(VAR_9, dict):\n",
"VAR_7 = datetime.datetime.now()\n",
"VAR_9 = datetime.timedelta(**delta)\n",
"VAR_6 = VAR_7 - V... | [
"def live(conn, delta=None, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if delta is None:\n",
"delta = {'hours': 4}\n",
"if isinstance(delta, datetime.timedelta):\n",
"if isinstance(delta, dict):\n",
"end = datetime.datetime.now()\n",
"delta = datetime.timedelta(**delta)\n",
"start = end - delta\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self, VAR_2, VAR_1, VAR_3):...\n",
"self.cursor.execute('update users set money = money - %s where id = %s' % (\n VAR_3, VAR_2))\n",
"self.cursor.execute('update projects set money = money + %s where id = %s' %\n (VAR_3, VAR_1))\n",
"self.cursor.execute('string' % (VAR_1, VAR_2, VAR_3))\n",
... | [
"def save_accepted_transaction(self, user_id, project_id, money):...\n",
"self.cursor.execute('update users set money = money - %s where id = %s' % (\n money, user_id))\n",
"self.cursor.execute('update projects set money = money + %s where id = %s' %\n (money, project_id))\n",
"self.cursor.execute(\n ... | [
0,
4,
4,
4,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from __future__ import absolute_import\n",
"from mock import MagicMock, patch\n",
"from six.moves.urllib_parse import quote_plus\n",
"from flask import url_for, session\n",
"from invenio.testsuite import make_test_suite, run_test_suite\n",
"from invenio.ext.sqlalchemy import db\n",
"from .helpers impor... | [
"from __future__ import absolute_import\n",
"from mock import MagicMock, patch\n",
"from six.moves.urllib_parse import quote_plus\n",
"from flask import url_for, session\n",
"from invenio.testsuite import make_test_suite, run_test_suite\n",
"from invenio.ext.sqlalchemy import db\n",
"from .helpers impor... | [
0,
0,
5,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign... |
[
"def FUNC_5(VAR_34, VAR_32, VAR_33):...\n",
"print('save weeks')\n",
"VAR_39 = 'meal_planner.db'\n",
"VAR_50 = 'recipes_' + str(VAR_13)\n",
"conn.execute('CREATE TABLE IF NOT EXISTS ' + VAR_50 +\n ' (recipe text, row int, column int)')\n",
"conn.execute('INSERT INTO ' + VAR_50 + ' VALUES (?, ?, ?);', (... | [
"def save_weeks_recipes(recipeName, row, column):...\n",
"print('save weeks')\n",
"database_file = 'meal_planner.db'\n",
"tableName = 'recipes_' + str(weekNumber)\n",
"conn.execute('CREATE TABLE IF NOT EXISTS ' + tableName +\n ' (recipe text, row int, column int)')\n",
"conn.execute('INSERT INTO ' + ta... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = self.session.get(self.login_url)\n",
"VAR_11 = re.findall('_xsrf=([\\\\w|-]+)', VAR_10.headers.get('Set-Cookie'))[0]\n",
"return VAR_11\n"
] | [
"def _get_token(self):...\n",
"\"\"\"docstring\"\"\"\n",
"resp = self.session.get(self.login_url)\n",
"token = re.findall('_xsrf=([\\\\w|-]+)', resp.headers.get('Set-Cookie'))[0]\n",
"return token\n"
] | [
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def ensure_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_1(self, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = VAR_9['package_list']\n",
"VAR_14 = {}\n",
"VAR_15 = {}\n",
"if not VAR_13:\n",
"return VAR_15\n",
"VAR_16 = None\n",
"VAR_17 = None\n",
"if 'repository_list' in VAR_9:\n",
"VAR_17 = VAR_9['repository_list']\n",
"self.cursor... | [
"def process_list(self, data):...\n",
"\"\"\"docstring\"\"\"\n",
"packages_to_process = data['package_list']\n",
"auxiliary_dict = {}\n",
"answer = {}\n",
"if not packages_to_process:\n",
"return answer\n",
"provided_repo_ids = None\n",
"provided_repo_names = None\n",
"if 'repository_list' in data... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"For",
"For",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
... |
[
"@property...\n",
"return base64.b64encode((self.rule.name + ''.join(self.output)).encode('utf-8')\n ).decode('utf-8')\n"
] | [
"@property...\n",
"return base64.b64encode((self.rule.name + ''.join(self.output)).encode('utf-8')\n ).decode('utf-8')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_6(self, VAR_53):...\n",
"if VAR_53:\n",
"self.error()\n",
"VAR_23 = _force_utf8(VAR_53)\n",
"return self.error(errors.USER_DOESNT_EXIST)\n",
"return Account._by_name(VAR_23)\n"
] | [
"def run(self, username):...\n",
"if username:\n",
"self.error()\n",
"name = _force_utf8(username)\n",
"return self.error(errors.USER_DOESNT_EXIST)\n",
"return Account._by_name(name)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Return'"
] |
[
"@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_0(self, VAR_0='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
"def connect(self, database='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2():...\n",
"VAR_3 = {'foo': 'bar'}\n",
"VAR_1 = yaml.dump(VAR_3)\n",
"VAR_2 = load_source(VAR_1)\n",
"assert VAR_2 == VAR_3\n"
] | [
"def test_yaml_string():...\n",
"native = {'foo': 'bar'}\n",
"source = yaml.dump(native)\n",
"result = load_source(source)\n",
"assert result == native\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.