lines
listlengths
1
444
raw_lines
listlengths
1
444
label
listlengths
1
444
type
listlengths
1
444
[ "def FUNC_2(VAR_1, VAR_2=1, VAR_3=False, VAR_4=[]):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = VAR_1.data_group.type\n", "VAR_18, VAR_19 = get_extracted_models(VAR_17)\n", "VAR_20 = hasattr(VAR_1, 'extractedtext')\n", "def FUNC_3(VAR_21, VAR_22, VAR_23=BaseInlineFormSet, VAR_24=forms.ModelForm,...\n", ...
[ "def create_detail_formset(document, extra=1, can_delete=False, exclude=[]):...\n", "\"\"\"docstring\"\"\"\n", "group_type = document.data_group.type\n", "parent, child = get_extracted_models(group_type)\n", "extracted = hasattr(document, 'extractedtext')\n", "def make_formset(parent_model, model, formset...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def __call__(self, VAR_44):...\n", "self.p = VAR_44\n", "self.log = VAR_44.log\n", "self.inter_sleep = VAR_44.inter_sleep\n", "self.running = VAR_44.running\n", "self.p.sig_sock.setsockopt(zmq.SUBSCRIBE, b'WipeManager')\n", "self.p.wz.set_sig_handler(b'WipeManager', b'passthrough', self.send_passthroug...
[ "def __call__(self, parent):...\n", "self.p = parent\n", "self.log = parent.log\n", "self.inter_sleep = parent.inter_sleep\n", "self.running = parent.running\n", "self.p.sig_sock.setsockopt(zmq.SUBSCRIBE, b'WipeManager')\n", "self.p.wz.set_sig_handler(b'WipeManager', b'passthrough', self.send_passthroug...
[ 0, 0, 0, 0, 0, 0, 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'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", ...
[ "def FUNC_23(self, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = self.common._cli_run('showvlun -a -showcols Port', None)\n", "VAR_36 = {}\n", "for VAR_15 in VAR_16:\n", "VAR_36[VAR_15] = 0\n", "VAR_37 = None\n", "if VAR_35:\n", "VAR_35 = VAR_35[1:]\n", "return VAR_37\n", "for line in VAR...
[ "def _get_least_used_nsp(self, nspss):...\n", "\"\"\"docstring\"\"\"\n", "result = self.common._cli_run('showvlun -a -showcols Port', None)\n", "nsp_counts = {}\n", "for nsp in nspss:\n", "nsp_counts[nsp] = 0\n", "current_least_used_nsp = None\n", "if result:\n", "result = result[1:]\n", "return c...
[ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "For", "Assign'", "Assign'", "Condition", "For", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_1(VAR_2, VAR_4):...\n", "VAR_8 = VAR_4.connect()\n", "VAR_9 = VAR_8.cursor()\n", "VAR_12 = 'string'.format(VAR_2)\n", "VAR_9.execute(VAR_12)\n", "VAR_13 = VAR_9.fetchall()\n", "return VAR_13\n" ]
[ "def getCalendarList(username, sqlInstance):...\n", "conn = sqlInstance.connect()\n", "cursor = conn.cursor()\n", "getCalendarDetails = (\n \"SELECT DISTINCT Calendars.calendarId, Calendars.name, Calendars.day FROM Users, Calendars, TimeSlots WHERE Calendars.calendarId = TimeSlots.calendarId AND (Calendars...
[ 0, 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_13():...\n", "\"\"\"docstring\"\"\"\n", "log.info('Stopping worker(s)')\n", "for pid in VAR_20:\n", "if pid is not None:\n", "os.kill(pid, VAR_7.SIGTERM)\n" ]
[ "def kill_children():...\n", "\"\"\"docstring\"\"\"\n", "log.info('Stopping worker(s)')\n", "for pid in child_pids:\n", "if pid is not None:\n", "os.kill(pid, signal.SIGTERM)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "For", "Condition", "Expr'" ]
[ "def FUNC_19(self):...\n", "VAR_7, VAR_12 = self.make_xsrf_handling_app()\n", "self.mock_get_current_identity(model.Identity(model.IDENTITY_USER,\n 'a@example.com'))\n", "VAR_17 = VAR_7.get('/request').body\n", "self.mock_get_current_identity(model.Identity(model.IDENTITY_USER,\n 'b@example.com'))\n",...
[ "def test_xsrf_token_identity_matters(self):...\n", "app, calls = self.make_xsrf_handling_app()\n", "self.mock_get_current_identity(model.Identity(model.IDENTITY_USER,\n 'a@example.com'))\n", "token = app.get('/request').body\n", "self.mock_get_current_identity(model.Identity(model.IDENTITY_USER,\n 'b...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_11(self):...\n", "return u'Nullable({})'.format(self.inner_type.for_schema())\n" ]
[ "def for_schema(self):...\n", "return u'Nullable({})'.format(self.inner_type.for_schema())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self, VAR_4={}):...\n", "self.connection.request(self.verb, self.path, VAR_4=headers)\n", "return self.connection.getresponse()\n" ]
[ "def run(self, headers={}):...\n", "self.connection.request(self.verb, self.path, headers=headers)\n", "return self.connection.getresponse()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "import sys\n", "import tkinter as tk\n", "import Controller as dbc\n", "from PIL import Image, ImageTk\n", "from tkinter import font\n", "def __init__(self):...\n", "tk.Tk.__init__(self)\n", "self.title('Raspi-Telxon')\n", "self.titleFont = font.Font(family='Helvetica', size=24)\n", "self.itemFon...
[ "import sys\n", "import tkinter as tk\n", "import Controller as dbc\n", "from PIL import Image, ImageTk\n", "from tkinter import font\n", "def __init__(self):...\n", "tk.Tk.__init__(self)\n", "self.title('Raspi-Telxon')\n", "self.titleFont = font.Font(family='Helvetica', size=24)\n", "self.itemFon...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Ass...
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "VAR_0 = [('exercise', '0022_auto_20160906_1401'), ('notification',\n '0001_initial')]\n", "VAR_1 = [migrations.AddField(model_name='notification', name='submission',\n field=models.ForeignKey(to='exercise.Submiss...
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "dependencies = [('exercise', '0022_auto_20160906_1401'), ('notification',\n '0001_initial')]\n", "operations = [migrations.AddField(model_name='notification', name=\n 'submission', field=models.ForeignKey(to='exe...
[ 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'" ]
[ "def __init__(self, *VAR_2):...\n", "self._path = VAR_2\n" ]
[ "def __init__(self, *path):...\n", "self._path = path\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_6(self, VAR_19):...\n", "return VAR_19 if VAR_19 and self.measure.match(VAR_19) else ''\n" ]
[ "def run(self, value):...\n", "return value if value and self.measure.match(value) else ''\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n" ]
[ "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 7, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "from itertools import chain\n", "from datetime import datetime\n", "from model_utils.managers import InheritanceManager\n", "from django.db import models\n", "from django.core.exceptions import ValidationError\n", "from django import forms\n", "from django.urls import reverse\n", "from .common_info i...
[ "from itertools import chain\n", "from datetime import datetime\n", "from model_utils.managers import InheritanceManager\n", "from django.db import models\n", "from django.core.exceptions import ValidationError\n", "from django import forms\n", "from django.urls import reverse\n", "from .common_info i...
[ 6, 6, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "from flask import request\n", "from flask_jwt_extended import jwt_required\n", "from flask_restplus import Namespace, Resource, fields\n", "from utilities import database_utilities\n", "VAR_0 = Namespace('admins', description='Information relating to system admins'\n )\n", "def FUNC_0(self):...\n", ...
[ "from flask import request\n", "from flask_jwt_extended import jwt_required\n", "from flask_restplus import Namespace, Resource, fields\n", "from utilities import database_utilities\n", "api = Namespace('admins', description='Information relating to system admins')\n", "def get(self):...\n", "\"\"\"docs...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_7(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_30 = False\n", "for rec in self:\n", "VAR_27 = rec._next_states()\n", "VAR_31 = self.env['crapo.transition'].search([('from_state', '=', VAR_30.id\n ), ('to_state', '=', VAR_9)], limit=1)\n", "if rec.state.id == VAR_9:\n", "return VAR...
[ "def _get_transition(self, target_state_id):...\n", "\"\"\"docstring\"\"\"\n", "current_state = False\n", "for rec in self:\n", "next_states = rec._next_states()\n", "transition = self.env['crapo.transition'].search([('from_state', '=',\n current_state.id), ('to_state', '=', target_state_id)], limit=1)...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Condition", "Condition", "Assign'" ]
[ "def FUNC_16(VAR_0, VAR_5, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "VAR_23 = pd.read_sql_table(VAR_0, db.engine)\n", "print('EQUAL FREQUENCY DISCRETIZATION FAILED:\\n' + str(e))\n", "VAR_25 = len(VAR_23[VAR_5])\n", "VAR_26 = VAR_25 // VAR_14\n", "VAR_27 = list(VAR_23[VAR_5].sort_values())\n", "VAR_...
[ "def discretize_eq_freq(table_name, attr, intervals):...\n", "\"\"\"docstring\"\"\"\n", "df = pd.read_sql_table(table_name, db.engine)\n", "print('EQUAL FREQUENCY DISCRETIZATION FAILED:\\n' + str(e))\n", "attr_length = len(df[attr])\n", "elements_per_interval = attr_length // intervals\n", "sorted_data ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Condition", "AugAssign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(VAR_2, VAR_3):...\n", "VAR_2.browser = webdriver.PhantomJS()\n", "VAR_2.browser.set_window_size(1280, 1024)\n", "VAR_2.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S)\n", "VAR_2.browser.set_page_load_timeout(60)\n", "VAR_2.browser.get(HOMEPAGE_URL)\n" ]
[ "def before_feature(context, feature):...\n", "context.browser = webdriver.PhantomJS()\n", "context.browser.set_window_size(1280, 1024)\n", "context.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S)\n", "context.browser.set_page_load_timeout(60)\n", "context.browser.get(HOMEPAGE_URL)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@wraps(VAR_1)...\n", "VAR_17 = make_response(VAR_1(*VAR_6, **kwargs))\n", "VAR_17.headers['Last-Modified'] = datetime.now()\n", "VAR_17.headers['Cache-Control'\n ] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'\n", "VAR_17.headers['Pragma'] = 'no-cache'\n", "VAR_17.heade...
[ "@wraps(view)...\n", "response = make_response(view(*args, **kwargs))\n", "response.headers['Last-Modified'] = datetime.now()\n", "response.headers['Cache-Control'\n ] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'\n", "response.headers['Pragma'] = 'no-cache'\n", "respons...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_31():...\n", "yield self._bin_path\n", "if self._is_jdk:\n", "yield os.path.join(self.home, 'jre', 'bin')\n" ]
[ "def bin_paths():...\n", "yield self._bin_path\n", "if self._is_jdk:\n", "yield os.path.join(self.home, 'jre', 'bin')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_3(VAR_0, VAR_4, VAR_5):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute(\n \"\"\"\n UPDATE quests\n SET completed = '%s'\...
[ "def complete_quest(pg_connection, quest_id, completion):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(\n \"\"\"\n UPDATE quests\n SET...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self, VAR_8, VAR_9, VAR_10, VAR_5, VAR_11):...\n", "VAR_14 = 'string'.format(VAR_8, VAR_9, VAR_10, VAR_5, VAR_11)\n", "self.cur.execute(VAR_14)\n", "self.conn.commit()\n" ]
[ "def create_event(self, title, start_time, time_zone, server_id, description):...\n", "sql = (\n \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n \"\"\"\n .format(title, start_time, time_zone, serve...
[ 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_15(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = BokChoyTestSuite('', num_processes=2, verbosity=3)\n", "BokChoyTestSuite.verbosity_processes_string(VAR_7)\n" ]
[ "def test_invalid_verbosity_and_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "suite = BokChoyTestSuite('', num_processes=2, verbosity=3)\n", "BokChoyTestSuite.verbosity_processes_string(suite)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_4(VAR_0, VAR_6):...\n", "VAR_7 = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "VAR_8 = VAR_7.cursor()\n", "VAR_8.execute(VAR_6)\n", "VAR_9 = list(VAR_8.fetchall())\n", "VAR_8.close()...
[ "def retrieve_quest_data(pg_connection, query):...\n", "conn = psycopg2.connect(dbname=pg_connection['database'], user=\n pg_connection['user'], password=pg_connection['password'], host=\n pg_connection['host'])\n", "cur = conn.cursor()\n", "cur.execute(query)\n", "results = list(cur.fetchall())\n", ...
[ 0, 0, 0, 4, 4, 0, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_14(self):...\n", "return self._get_ancestors().values()\n" ]
[ "def get_ancestors(self):...\n", "return self._get_ancestors().values()\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "@data(('9981', 'B0046A36-3F1C-11E9-9A87-005056AA6F11', 0, 0, 0), ('9982',...\n", "VAR_13 = {'sender': 'Alex Roy <Alex.Roy@dilfo.com>', 'subject':\n 'DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`', 'date':\n 'Tue, 7 May 2019 17:34:17 +0000', 'content':\n f'job_number={VAR_6}string{VAR_7}\\r\\n'}\n", "V...
[ "@data(('9981', 'B0046A36-3F1C-11E9-9A87-005056AA6F11', 0, 0, 0), ('9982',...\n", "email_obj = {'sender': 'Alex Roy <Alex.Roy@dilfo.com>', 'subject':\n 'DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`', 'date':\n 'Tue, 7 May 2019 17:34:17 +0000', 'content':\n f'job_number={job_number}&title=TEST_ENTRY&city...
[ 0, 0, 4, 0, 0, 4, 0, 0, 4, 4, 4, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Condition", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_14 = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "VAR_21 = [utils.PathToPythonInterpreter(), FUNC_0(), '--port={0}'.format(\n VAR_14), '--options_f...
[ "def _SetupServer(self):...\n", "server_port = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "args = [utils.PathToPythonInterpreter(), _PathToServerScript(),\n '--port={0}'.format(...
[ 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_2(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = FUNC_1(VAR_1)\n", "json.dump(VAR_4, sys.stdout, indent=2)\n" ]
[ "def dump_yml_filedir(root_dir):...\n", "\"\"\"docstring\"\"\"\n", "result = load_yml_filedir(root_dir)\n", "json.dump(result, sys.stdout, indent=2)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_13, VAR_14='tests'):...\n", "\"\"\"docstring\"\"\"\n", "self._logger.csv(VAR_13 + '_mappose', ['X', 'Y', 'yaw'], [self.map_pos.x,\n self.map_pos.y, self.map_angle], VAR_14=folder)\n" ]
[ "def csvLogMap(self, test_name, folder='tests'):...\n", "\"\"\"docstring\"\"\"\n", "self._logger.csv(test_name + '_mappose', ['X', 'Y', 'yaw'], [self.map_pos.x,\n self.map_pos.y, self.map_angle], folder=folder)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_18(self):...\n", "return FUNC_18.dumps(self.properties())\n" ]
[ "def json(self):...\n", "return json.dumps(self.properties())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_2.request.method == 'GET':\n", "VAR_6 = VAR_2.request.session.get_csrf_token()\n", "if VAR_2.request.cookies.get('XSRF-TOKEN') != VAR_6:\n", "VAR_2.response.set_cookie(VAR_0, VAR_6)\n" ]
[ "def on_GET_request_setup_csrf_cookie(ev):...\n", "\"\"\"docstring\"\"\"\n", "if ev.request.method == 'GET':\n", "token = ev.request.session.get_csrf_token()\n", "if ev.request.cookies.get('XSRF-TOKEN') != token:\n", "ev.response.set_cookie(COOKIE_NAME, token)\n" ]
[ 0, 0, 0, 0, 0, 5 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Expr'" ]
[ "import psycopg2\n", "from pyMetricServer.config import *\n", "import time\n", "VAR_0 = psycopg2.connect(host=DATABASE_HOST, port=DATABASE_PORT, user=\n DATABASE_USER, password=DATABASE_PASS, VAR_0=DATABASE_NAME)\n", "VAR_1 = VAR_0.cursor()\n", "VAR_1.execute('string')\n", "VAR_1.execute('string')\n"...
[ "import psycopg2\n", "from pyMetricServer.config import *\n", "import time\n", "database = psycopg2.connect(host=DATABASE_HOST, port=DATABASE_PORT, user=\n DATABASE_USER, password=DATABASE_PASS, database=DATABASE_NAME)\n", "cursor = database.cursor()\n", "cursor.execute(\n 'CREATE TABLE IF NOT EXIST...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "Import'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Condition", "Expr'", "AugAssign'", "Condition", "Expr'", "AugAs...
[ "def FUNC_7(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = (KeyError, ValueError, TypeError, AttributeError, SQLAlchemyError,\n DokomoError)\n", "if isinstance(VAR_5, tornado.web.HTTPError):\n", "VAR_33 = exc.HttpError(VAR_5.log_message)\n", "if isinstance(VAR_5, VAR_13):\n", "VAR_33.statu...
[ "def handle_error(self, err):...\n", "\"\"\"docstring\"\"\"\n", "understood = (KeyError, ValueError, TypeError, AttributeError,\n SQLAlchemyError, DokomoError)\n", "if isinstance(err, tornado.web.HTTPError):\n", "restless_error = exc.HttpError(err.log_message)\n", "if isinstance(err, understood):\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_2(VAR_0, VAR_1):...\n", "VAR_5 = frappe.session.user\n", "VAR_6 = get_leave_allocation_records(VAR_0.to_date)\n", "VAR_7 = get_leave_allocation_records(VAR_0.from_date)\n", "VAR_8 = frappe.get_all('Employee', VAR_0={'status': 'Active', 'company':\n filters.company}, fields=['name', 'employee_na...
[ "def get_data(filters, leave_types):...\n", "user = frappe.session.user\n", "allocation_records_based_on_to_date = get_leave_allocation_records(filters.\n to_date)\n", "allocation_records_based_on_from_date = get_leave_allocation_records(filters\n .from_date)\n", "active_employees = frappe.get_all('Em...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Assign'", "For", "Assign'", "Expr'", "Assign'", "Assign'", "AugAssign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return set(VAR_28 for VAR_28 in self.input if not VAR_28.exists and not \n VAR_28 in self.subworkflow_input)\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return set(f for f in self.input if not f.exists and not f in self.\n subworkflow_input)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = True if VAR_0.find(':') != -1 else False\n", "if VAR_0[-4:] == '.rpm':\n", "VAR_0 = VAR_0[:-4]\n", "VAR_2 = VAR_0.rfind('.')\n", "VAR_3 = VAR_0[VAR_2 + 1:]\n", "VAR_4 = VAR_0[:VAR_2].rfind('-')\n", "VAR_5 = VAR_0[VAR_4 + 1:VAR_2]\n", "...
[ "def split_filename(filename):...\n", "\"\"\"docstring\"\"\"\n", "is_epoch = True if filename.find(':') != -1 else False\n", "if filename[-4:] == '.rpm':\n", "filename = filename[:-4]\n", "arch_index = filename.rfind('.')\n", "arch = filename[arch_index + 1:]\n", "rel_index = filename[:arch_index].rfi...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "from __future__ import unicode_literals\n", "from django.conf import settings\n", "from django.conf.urls import include\n", "from django.conf.urls import patterns\n", "from django.conf.urls import url\n", "from api import routers\n", "from api import views\n", "VAR_0 = route...
[ "\"\"\"\nRESTful URL patterns and routing for the Deis API app.\n\n\nApplications\n============\n\n.. http:get:: /api/apps/(string:id)/\n\n Retrieve a :class:`~api.models.App` by its `id`.\n\n.. http:delete:: /api/apps/(string:id)/\n\n Destroy a :class:`~api.models.App` by its `id`.\n\n.. http:get:: /api/apps/\n\...
[ 5, 0, 0, 0, 0, 0, 0, 0, 0, 5 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'" ]
[ "@user_passes_test(user_is_superuser)...\n", "VAR_8 = Project.objects.all()\n", "for VAR_17 in VAR_8:\n", "create_testcases_celery.delay(VAR_17.id)\n", "return redirect('testcases:testcases')\n" ]
[ "@user_passes_test(user_is_superuser)...\n", "projects = Project.objects.all()\n", "for project in projects:\n", "create_testcases_celery.delay(project.id)\n", "return redirect('testcases:testcases')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_11(self):...\n", "VAR_20 = []\n", "VAR_18 = threading.Event()\n", "self.mock(VAR_18, 'wait', self.fail)\n", "self.mock(bot_main, 'run_manifest', self.fail)\n", "self.mock(bot_main, 'update_bot', lambda *VAR_24: VAR_20.append(VAR_24))\n", "self.expected_requests([(\n 'https://localhost:1/aut...
[ "def test_poll_server_update(self):...\n", "update = []\n", "bit = threading.Event()\n", "self.mock(bit, 'wait', self.fail)\n", "self.mock(bot_main, 'run_manifest', self.fail)\n", "self.mock(bot_main, 'update_bot', lambda *args: update.append(args))\n", "self.expected_requests([(\n 'https://localhost...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def __new__(VAR_10, VAR_11, VAR_12, VAR_13):...\n", "for VAR_47 in webapp2.WSGIApplication.allowed_methods:\n", "VAR_48 = VAR_13.get(VAR_47.lower())\n", "return type.__new__(VAR_10, VAR_11, VAR_12, VAR_13)\n", "if VAR_48 and not api.is_decorated(VAR_48):\n" ]
[ "def __new__(mcs, name, bases, attributes):...\n", "for method in webapp2.WSGIApplication.allowed_methods:\n", "func = attributes.get(method.lower())\n", "return type.__new__(mcs, name, bases, attributes)\n", "if func and not api.is_decorated(func):\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Return'", "Condition" ]
[ "def FUNC_8(self):...\n", "self._WriteHeader('text/html', VAR_22=404)\n", "self.wfile.write('<html><body>%s not found</body></html>' % self.path)\n" ]
[ "def _DoNotFound(self):...\n", "self._WriteHeader('text/html', status_code=404)\n", "self.wfile.write('<html><body>%s not found</body></html>' % self.path)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_2(self, VAR_5):...\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n" ]
[ "def start_debugging(self, launchcfg):...\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Assert'" ]
[ "def __init__(self, VAR_0=None):...\n", "super(CLASS_0, self).__init__()\n", "if VAR_0:\n", "self._init_graph(VAR_0)\n" ]
[ "def __init__(self, workflow_job=None):...\n", "super(WorkflowDAG, self).__init__()\n", "if workflow_job:\n", "self._init_graph(workflow_job)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Expr'" ]
[ "def __missing__(self, VAR_30):...\n", "VAR_66 = self[VAR_30] = VAR_31(*VAR_30)\n", "return VAR_66\n" ]
[ "def __missing__(self, key):...\n", "ret = self[key] = f(*key)\n", "return ret\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_4(self):...\n", "if hasattr(self, 'extractedcpcat'):\n", "return self.extractedcpcat\n", "return self\n" ]
[ "def pull_out_cp(self):...\n", "if hasattr(self, 'extractedcpcat'):\n", "return self.extractedcpcat\n", "return self\n" ]
[ 0, 6, 6, 6 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_12(VAR_7):...\n", "@wraps(VAR_7)...\n", "if not app.config.get('USE_AUTH'):\n", "return VAR_7(*VAR_9, **kwargs)\n", "FUNC_0()\n", "return VAR_7(*VAR_9, **kwargs)\n", "logging.warning('require_logout(): calling log_out()')\n", "VAR_16 = VAR_1.log_out()\n", "if VAR_16.headers.get('Location')...
[ "def require_logout_for_goodbye(f):...\n", "@wraps(f)...\n", "if not app.config.get('USE_AUTH'):\n", "return f(*args, **kwargs)\n", "get_logged_in_user()\n", "return f(*args, **kwargs)\n", "logging.warning('require_logout(): calling log_out()')\n", "resp = user_mod.log_out()\n", "if resp.headers.get...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "Expr'", "Return'", "Expr'", "Assign'", "For", "Return'", "Return'" ]
[ "def FUNC_5(VAR_2, VAR_6):...\n", "for _privilege in VAR_0[VAR_2]:\n", "if fnmatch.fnmatch(VAR_6, _privilege):\n", "return False\n", "return True\n" ]
[ "def user_type_has_privilege(user_type, privilege):...\n", "for _privilege in PRIVILEGES[user_type]:\n", "if fnmatch.fnmatch(privilege, _privilege):\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Return'", "Return'" ]
[ "@staticmethod...\n", "" ]
[ "@staticmethod...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_2(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['clusterName'] = VAR_8\n", "VAR_5['searchDepth'] = '1'\n", "VAR_5['verbose'] = '0'\n", "VAR_18 = self._cliq_run_xml('getClusterInfo', VAR_5)\n", "return VAR_18\n" ]
[ "def _cliq_get_cluster_info(self, cluster_name):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['clusterName'] = cluster_name\n", "cliq_args['searchDepth'] = '1'\n", "cliq_args['verbose'] = '0'\n", "result_xml = self._cliq_run_xml('getClusterInfo', cliq_args)\n", "return result_xml\n...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "return list(self)\n" ]
[ "@property...\n", "return list(self)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_0(VAR_6):...\n", "VAR_10 = VAR_6.find('http:')\n", "VAR_11 = VAR_6.find('https:')\n", "if VAR_11 == -1:\n", "if VAR_10 == -1:\n", "if VAR_10 == -1:\n", "return None\n", "return VAR_6[VAR_10:]\n", "return VAR_6[VAR_11:]\n", "return VAR_6[min(VAR_10, VAR_11):]\n" ]
[ "def ParseURL(s):...\n", "http_idx = s.find('http:')\n", "https_idx = s.find('https:')\n", "if https_idx == -1:\n", "if http_idx == -1:\n", "if http_idx == -1:\n", "return None\n", "return s[http_idx:]\n", "return s[https_idx:]\n", "return s[min(http_idx, https_idx):]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Return'", "Return'", "Return'", "Return'" ]
[ "def FUNC_24(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_25(VAR_10):...\n", "self.events_requests.remove(VAR_9)\n", "self.events_requests.append(VAR_9)\n", "VAR_9.notifyFinish().addCallbacks(FUNC_25, FUNC_25)\n", "VAR_9.write(json.dumps({'type': 'events_start', 'event': {'tribler_started':...
[ "def render_GET(self, request):...\n", "\"\"\"docstring\"\"\"\n", "def on_request_finished(_):...\n", "self.events_requests.remove(request)\n", "self.events_requests.append(request)\n", "request.notifyFinish().addCallbacks(on_request_finished, on_request_finished)\n", "request.write(json.dumps({'type': ...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def __init__(self, *VAR_2, **VAR_3):...\n", "super(CLASS_0, self).__init__(*VAR_2, **kwargs)\n", "self.cluster_vip = None\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "super(HpSanISCSIDriver, self).__init__(*args, **kwargs)\n", "self.cluster_vip = None\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "def FUNC_7(self):...\n", "return self.data\n" ]
[ "def to_json(self):...\n", "return self.data\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = VAR_0[:]\n", "VAR_11.extend([(Allow, user.login, ('view_company', 'edit_company',\n 'view.file', 'list_customers', 'add_customer', 'list_projects',\n 'add_project', 'list_estimations', 'list_invoices',\n 'edit_commercial_handling', 'list_...
[ "def get_company_acl(self):...\n", "\"\"\"docstring\"\"\"\n", "acl = DEFAULT_PERM[:]\n", "acl.extend([(Allow, user.login, ('view_company', 'edit_company',\n 'view.file', 'list_customers', 'add_customer', 'list_projects',\n 'add_project', 'list_estimations', 'list_invoices',\n 'edit_commercial_handlin...
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_9(self, VAR_9, VAR_10):...\n", "if self._IsServerAlive():\n", "return FUNC_9(VAR_9, VAR_10)\n" ]
[ "def SendCommandRequest(self, arguments, completer):...\n", "if self._IsServerAlive():\n", "return SendCommandRequest(arguments, completer)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "def FUNC_1(self):...\n", "return 'load statement for task %s (%s)' % (self.task_id, self.url)\n" ]
[ "def describe(self):...\n", "return 'load statement for task %s (%s)' % (self.task_id, self.url)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_7(self, VAR_12, VAR_13):...\n", "self._credentials[VAR_12] = VAR_13\n" ]
[ "def add_user(self, username, password):...\n", "self._credentials[username] = password\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_6(VAR_12, VAR_3, VAR_4=-1):...\n", "VAR_7 = VAR_12[0]\n", "VAR_24 = VAR_12[1]\n", "if not VAR_24:\n", "return VAR_24\n", "if VAR_7 == -2 ** 255 and VAR_24 == -1:\n", "return -2 ** 255\n", "return copysign(abs(VAR_7 / VAR_24), VAR_7 / VAR_24)\n" ]
[ "def signedDiv(params, symbols, symId=-1):...\n", "x = params[0]\n", "y = params[1]\n", "if not y:\n", "return y\n", "if x == -2 ** 255 and y == -1:\n", "return -2 ** 255\n", "return copysign(abs(x / y), x / y)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(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", "VAR_5 = '/api/apps/{}/perms'.format(VAR_8)\n", "VAR_7 = {'username': 'autotest-2'}\n", "VA...
[ "def test_list(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", "url = '/api/apps/{}/perms'.format(app_id)\n", "body = {'username': 'autotest...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "from flaskext.mysql import MySQL\n", "def FUNC_0(VAR_0, VAR_1, VAR_2):...\n", "VAR_3 = VAR_2.connect()\n", "VAR_4 = VAR_3.cursor()\n", "VAR_5 = \"SELECT * FROM Users WHERE userEmail = '{0}'\".format(VAR_0)\n", "VAR_4.execute(VAR_5)\n", "VAR_6 = VAR_4.fetchone()\n", "if VAR_6 is not None:\n", "retur...
[ "from flaskext.mysql import MySQL\n", "def registerUser(username, password, sqlHandle):...\n", "conn = sqlHandle.connect()\n", "cursor = conn.cursor()\n", "userCheckQuery = \"SELECT * FROM Users WHERE userEmail = '{0}'\".format(username)\n", "cursor.execute(userCheckQuery)\n", "result = cursor.fetchone(...
[ 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0 ]
[ "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "@wraps(VAR_55)...\n", "def FUNC_27(VAR_6):...\n", "if callable(VAR_6):\n", "return VAR_6()\n", "if request.method == 'POST':\n", "return VAR_55(*VAR_69, **kwargs)\n", "VAR_10 = json.loads(request.data)\n", "VAR_54 = {'error': {'type': 'schema', 'message': str(e)}, 'schema': VAR_24}\n", "schemas.val...
[ "@wraps(func)...\n", "def default_encode(value):...\n", "if callable(value):\n", "return value()\n", "if request.method == 'POST':\n", "return func(*args, **kwargs)\n", "body = json.loads(request.data)\n", "result = {'error': {'type': 'schema', 'message': str(e)}, 'schema': schema}\n", "schemas.vali...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Condition", "Expr'" ]
[ "@memoized_property...\n", "return self.get_options().native_source_extensions\n" ]
[ "@memoized_property...\n", "return self.get_options().native_source_extensions\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@jwt_required...\n", "if VAR_5:\n", "VAR_7 = Table.filter_by(email=None, VAR_5=user_id)\n", "VAR_8 = {'results': Table.query(), 'status': 'success'}\n", "if len(VAR_7) < 1:\n", "return jsonify(VAR_8), 200\n", "VAR_8 = {'results': 'User not found', 'status': 'fail'}\n", "VAR_8 = {'results': VAR_7, 'st...
[ "@jwt_required...\n", "if user_id:\n", "user = Table.filter_by(email=None, user_id=user_id)\n", "response_object = {'results': Table.query(), 'status': 'success'}\n", "if len(user) < 1:\n", "return jsonify(response_object), 200\n", "response_object = {'results': 'User not found', 'status': 'fail'}\n", ...
[ 0, 0, 4, 4, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Return'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "if self._parsed_content_packages:\n", "return self._parsed_content_packages\n", "VAR_6 = self.config.get(self.section, 'content_packages')\n", "VAR_5 = []\n", "for VAR_7 in VAR_6.split(','):\n", "VAR_7 = VAR_7.strip()\n", "self._parsed_content_packages =...
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "if self._parsed_content_packages:\n", "return self._parsed_content_packages\n", "value = self.config.get(self.section, 'content_packages')\n", "res = []\n", "for this in value.split(','):\n", "this = this.strip()\n", "self._parsed_content_packages = res\...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Return'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_7(*VAR_15, **VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_0(VAR_1, *VAR_15, **kwargs)\n" ]
[ "def new_object(*args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "return cls(name, *args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "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 augmentDatabaseArgs(self, args, pool=False):...\n", "if not args.get('database'):\n", "args['database'] = '%s.db' % self._model.sqlDatabaseName()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'" ]
[ "def FUNC_25(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_57 = self.getfile(VAR_21, VAR_23=False)\n", "if VAR_57 == False:\n", "if not VAR_57[VAR_6] & FUNC_30.S_IFLNK:\n", "return VAR_57[VAR_9]\n" ]
[ "def readlink(self, path):...\n", "\"\"\"docstring\"\"\"\n", "p = self.getfile(path, follow_symlinks=False)\n", "if p == False:\n", "if not p[A_MODE] & stat.S_IFLNK:\n", "return p[A_TARGET]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Condition", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.meta.iptc_keys\n" ]
[ "def get_meta_used(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.meta.iptc_keys\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_1(self, VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = subprocess.Popen(VAR_0, VAR_1=subprocess.PIPE, VAR_2=subprocess.\n PIPE, shell=True)\n", "VAR_4, VAR_15 = VAR_14.communicate()\n", "VAR_16 = VAR_14.returncode\n", "logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', VAR_0, VAR_...
[ "def _exec_cmd(self, cmd):...\n", "\"\"\"docstring\"\"\"\n", "proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n shell=True)\n", "out, err = proc.communicate()\n", "ret = proc.returncode\n", "logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out, err, ret)\n", ...
[ 0, 0, 2, 0, 0, 2, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'" ]
[ "def FUNC_38(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n", "self.check_example('subprocess_shell.py', VAR_2)\n" ]
[ "def test_subprocess_shell(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n", "self.check_example('subprocess_shell.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "return self.config['runtime.gallery_dir']\n" ]
[ "def get_base_path(self):...\n", "return self.config['runtime.gallery_dir']\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@validate(VUser(), VAR_0=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', VAR_27=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tzof...
[ "@validate(VUser(), meetup=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', content=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tz...
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_18 = self.common.create_volume_from_snapshot(VAR_6, VAR_8)\n", "self.common.client_logout()\n", "return {'metadata': VAR_18}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "import os.path\n", "import re\n", "import motor.motor_tornado\n", "from argon2 import PasswordHasher\n", "from pymongo import MongoClient\n", "import random\n", "import tornado.httpserver\n", "import tornado.ioloop\n", "import tornado.options\n", "import tornado.web\n", "import pymongo\n", "f...
[ "import os.path\n", "import re\n", "import motor.motor_tornado\n", "from argon2 import PasswordHasher\n", "from pymongo import MongoClient\n", "import random\n", "import tornado.httpserver\n", "import tornado.ioloop\n", "import tornado.options\n", "import tornado.web\n", "import pymongo\n", "f...
[ 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Expr'", "Expr'", "FunctionDef'", "Return'" ]
[ "def FUNC_13(VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_41 = str(VAR_10) + SECRET_KEY\n", "VAR_35 = hashlib.sha256()\n", "VAR_35.update(VAR_41.encode('utf-8'))\n", "VAR_35 = VAR_35.digest()\n", "VAR_42 = base64.b64encode(VAR_35).decode('utf-8')\n", "return VAR_42\n" ]
[ "def csrf_hash(csrf):...\n", "\"\"\"docstring\"\"\"\n", "enc = str(csrf) + SECRET_KEY\n", "m = hashlib.sha256()\n", "m.update(enc.encode('utf-8'))\n", "m = m.digest()\n", "encrypted_csrf = base64.b64encode(m).decode('utf-8')\n", "return encrypted_csrf\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_40(self):...\n", "self.compilation_ko(\"\"\"\nif (true) {\n\n}\n\"\"\")\n" ]
[ "def test_misplaced_parenthesis(self):...\n", "self.compilation_ko(\"\"\"\nif (true) {\n\n}\n\"\"\")\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@staticmethod...\n", "return mongo.db.analysis.find_one({'info.id': int(VAR_1)}, sort=[('_id',\n pymongo.DESCENDING)])\n" ]
[ "@staticmethod...\n", "return mongo.db.analysis.find_one({'info.id': int(task_id)}, sort=[('_id',\n pymongo.DESCENDING)])\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_5(self, VAR_8, VAR_6):...\n", "self.command(VAR_8, VAR_6, 'Error halting DUT', False)\n", "db.log_event('Information', 'Debugger', 'Halt DUT')\n" ]
[ "def halt_dut(self, halt_command, expected_output):...\n", "self.command(halt_command, expected_output, 'Error halting DUT', False)\n", "db.log_event('Information', 'Debugger', 'Halt DUT')\n" ]
[ 0, 0, 2 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "@VAR_1.route('/unique_ingredients/<cuisine_id>')...\n", "VAR_0.info('GET find_unique_ingredients_from_cuisine query')\n", "if VAR_9 in VAR_5:\n", "VAR_29, VAR_30 = VAR_5[VAR_9]\n", "VAR_33 = int(VAR_9)\n", "VAR_0.error(\n 'Error translating cuisine_id to int in find_unique_ingredients_from_cuisine, pa...
[ "@app.route('/unique_ingredients/<cuisine_id>')...\n", "logger.info('GET find_unique_ingredients_from_cuisine query')\n", "if cuisine_id in unique_ingredients_cache:\n", "insert_time, data = unique_ingredients_cache[cuisine_id]\n", "cuisine_id_int = int(cuisine_id)\n", "logger.error(\n 'Error translati...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Return'", "Assign'", "Return'" ]
[ "def FUNC_37(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'LOW': 1, 'MEDIUM': 10, 'HIGH': 7}, 'CONFIDENCE': {\n 'LOW': 0, 'MEDIUM': 11, 'HIGH': 7}}\n", "self.check_example('ssl-insecure-version.py', VAR_2)\n" ]
[ "def test_ssl_insecure_version(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'LOW': 1, 'MEDIUM': 10, 'HIGH': 7}, 'CONFIDENCE': {\n 'LOW': 0, 'MEDIUM': 11, 'HIGH': 7}}\n", "self.check_example('ssl-insecure-version.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_0(self, VAR_3):...\n", "VAR_4 = super().value_from_object(VAR_3)\n", "return self.to_python(VAR_4)\n" ]
[ "def value_from_object(self, obj):...\n", "value = super().value_from_object(obj)\n", "return self.to_python(value)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_14, VAR_2, VAR_3='text', VAR_4=bconfig....\n", "\"\"\"docstring\"\"\"\n", "VAR_0.info('Analyzing keywords for local file %s.' % VAR_14)\n", "VAR_15 = extractor.text_lines_from_local_file(VAR_14)\n", "return FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5=\n spires, VAR_...
[ "def get_keywords_from_local_file(local_file, taxonomy_name, output_mode=...\n", "\"\"\"docstring\"\"\"\n", "log.info('Analyzing keywords for local file %s.' % local_file)\n", "text_lines = extractor.text_lines_from_local_file(local_file)\n", "return get_keywords_from_text(text_lines, taxonomy_name, output_...
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_10(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = time.time()\n", "tournament.check_version((2, 4))\n", "VAR_9 = time.time()\n", "VAR_10 = round(VAR_9 - VAR_8, 1)\n", "self.assertEqual(VAR_10, 3.0)\n" ]
[ "def test_wait_time(self):...\n", "\"\"\"docstring\"\"\"\n", "start = time.time()\n", "tournament.check_version((2, 4))\n", "end = time.time()\n", "count = round(end - start, 1)\n", "self.assertEqual(count, 3.0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_1(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_4.__dict__\n" ]
[ "def serialize_to_json(object):...\n", "\"\"\"docstring\"\"\"\n", "return object.__dict__\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@web.authenticated...\n", "self.get(VAR_1, VAR_2=False)\n" ]
[ "@web.authenticated...\n", "self.get(path, include_body=False)\n" ]
[ 0, 5 ]
[ "Condition", "Expr'" ]
[ "def FUNC_16(VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "VAR_30 = VAR_19(VAR_16, 'dynamic')\n", "VAR_31 = [VAR_30] if FUNC_10(VAR_30) else VAR_30\n", "for VAR_3 in VAR_31:\n", "VAR_52 = list(VAR_5.finditer(VAR_3))\n", "return VAR_30\n", "for VAR_29 in VAR_52:\n", "if VAR_29.group('constraint'):\n" ]
[ "def dynamic(value):...\n", "\"\"\"docstring\"\"\"\n", "annotated = flag(value, 'dynamic')\n", "tocheck = [annotated] if not_iterable(annotated) else annotated\n", "for file in tocheck:\n", "matches = list(_wildcard_regex.finditer(file))\n", "return annotated\n", "for match in matches:\n", "if match...
[ 0, 0, 7, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Assign'", "Return'", "For", "Condition" ]
[ "def FUNC_4(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = CLASS_1(VAR_0)\n", "VAR_29, VAR_30 = VAR_28.get()\n", "VAR_31 = VAR_0.GET.get('tags')\n", "VAR_32 = VAR_0.GET.get('a')\n", "if VAR_32:\n", "VAR_75 = CLASS_2(VAR_30=obj, VAR_41=q_tag)\n", "VAR_33 = VAR_30.tag.all().order_by('pk')\n", "...
[ "def tags(request):...\n", "\"\"\"docstring\"\"\"\n", "tag_objects = _TagObjects(request)\n", "template_name, obj = tag_objects.get()\n", "q_tag = request.GET.get('tags')\n", "q_action = request.GET.get('a')\n", "if q_action:\n", "tag_actions = _TagActions(obj=obj, tag_name=q_tag)\n", "all_tags = ob...
[ 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'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_5(self):...\n", "\"\"\"docstring\"\"\"\n", "self.read = True\n", "db.session.commit()\n" ]
[ "def mark_as_read(self):...\n", "\"\"\"docstring\"\"\"\n", "self.read = True\n", "db.session.commit()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_10(self):...\n", "if self._hosts_cache is None:\n", "self._hosts_cache = self._get_hosts()\n", "return self._hosts_cache\n" ]
[ "def get_hosts(self):...\n", "if self._hosts_cache is None:\n", "self._hosts_cache = self._get_hosts()\n", "return self._hosts_cache\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_15 = []\n", "VAR_14 = datetime.now(timezone(timedelta(hours=+9), 'JST'))\n", "VAR_14 = VAR_14.replace(hour=0, minute=0, second=0, microsecond=0)\n", "for day in range(30)[::-1]:\n", "VAR_25 = VAR_14 - timedelta(days=day)\n", "return VAR_15\n", "VAR_26 = VAR_25.strftime('...
[ "def thirty_day_labels(self):...\n", "labels = []\n", "today = datetime.now(timezone(timedelta(hours=+9), 'JST'))\n", "today = today.replace(hour=0, minute=0, second=0, microsecond=0)\n", "for day in range(30)[::-1]:\n", "date = today - timedelta(days=day)\n", "return labels\n", "label = date.strftime...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_30(self):...\n", "VAR_44 = Tag.objects.get(name=self.tag_name)\n", "self.obj.remove_tag(VAR_44)\n" ]
[ "def remove(self):...\n", "tag = Tag.objects.get(name=self.tag_name)\n", "self.obj.remove_tag(tag)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_8(self, VAR_14):...\n", "" ]
[ "def is_file(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self, VAR_5, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_5 not in ('strings', 'files'):\n", "VAR_0.error(\"Bad parameter '%s' for submit_type\", VAR_5)\n", "VAR_13 = Folders.create_temp()\n", "return False\n", "VAR_14 = {'data': [], 'errors': []}\n", "if VAR_5 == 'strings':\n", "fo...
[ "def pre(self, submit_type, data):...\n", "\"\"\"docstring\"\"\"\n", "if submit_type not in ('strings', 'files'):\n", "log.error(\"Bad parameter '%s' for submit_type\", submit_type)\n", "path_tmp = Folders.create_temp()\n", "return False\n", "submit_data = {'data': [], 'errors': []}\n", "if submit_typ...
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "For", "Condition", "Expr'", "For", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_32(self, VAR_32, VAR_29):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_32)\n", "if VAR_24 == False:\n", "return\n", "if VAR_24[VAR_2] != VAR_13:\n", "return\n", "VAR_24[VAR_5] = VAR_29\n" ]
[ "def update_size(self, filename, size):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(filename)\n", "if f == False:\n", "return\n", "if f[A_TYPE] != T_FILE:\n", "return\n", "f[A_SIZE] = size\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_28(self):...\n", "self.compilation_ko('require [];')\n" ]
[ "def test_empty_string_list(self):...\n", "self.compilation_ko('require [];')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@validate(VUser(), VAR_0=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', VAR_27=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tzof...
[ "@validate(VUser(), meetup=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', content=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tz...
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_6(self, VAR_23):...\n", "VAR_82 = CLASS_46.run(self, VAR_23)\n", "if not VAR_82 or not hasattr(VAR_82, 'email') or not VAR_82.email:\n", "return self.error(errors.NO_EMAIL_FOR_USER)\n", "return VAR_82\n" ]
[ "def run(self, name):...\n", "user = VExistingUname.run(self, name)\n", "if not user or not hasattr(user, 'email') or not user.email:\n", "return self.error(errors.NO_EMAIL_FOR_USER)\n", "return user\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Expr'" ]