lines
sequencelengths 1
444
| raw_lines
sequencelengths 1
444
| label
sequencelengths 1
444
| type
sequencelengths 1
444
|
---|---|---|---|
[
"def FUNC_22(VAR_10, VAR_11, VAR_12):...\n",
"self.log.info('Resume signal %s recieved', repr((VAR_10, VAR_11, VAR_12)))\n"
] | [
"def resumehandler(interface, method, data):...\n",
"self.log.info('Resume signal %s recieved', repr((interface, method, data)))\n"
] | [
0,
7
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"Navigation._ekfCallback(self, VAR_8)\n",
"self.map_pos = self.transformPoint(self.p, 'odom', 'map')\n",
"self.map_angle = self.transformAngle(self.angle, 'odom', 'map')\n"
] | [
"def _ekfCallback(self, data):...\n",
"\"\"\"docstring\"\"\"\n",
"Navigation._ekfCallback(self, data)\n",
"self.map_pos = self.transformPoint(self.p, 'odom', 'map')\n",
"self.map_angle = self.transformAngle(self.angle, 'odom', 'map')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.norun = True\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.norun = True\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = 2\n",
"VAR_10 = 'string'.format(repo_dir=REPO_DIR, shard_str='/shard_' + self.\n shard if self.shard else '', procs=process_count)\n",
"VAR_7 = BokChoyTestSuite('', num_processes=process_count)\n",
"self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n"
] | [
"def test_verbosity_settings_2_processes(self):...\n",
"\"\"\"docstring\"\"\"\n",
"process_count = 2\n",
"expected_verbosity_string = (\n '--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --processes={procs} --no-color --process-timeout=1200'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else '', procs=process_count))\n",
"suite = BokChoyTestSuite('', num_processes=process_count)\n",
"self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_4):...\n",
"super().__init__(VAR_4)\n"
] | [
"def __init__(self, user):...\n",
"super().__init__(user)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(VAR_13):...\n",
"return os.path.isfile(VAR_13) and os.access(VAR_13, os.X_OK)\n"
] | [
"def is_executable(path):...\n",
"return os.path.isfile(path) and os.access(path, os.X_OK)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(VAR_0):...\n",
"if VAR_0.method == 'POST':\n",
"if 'myfile' in VAR_0.FILES and VAR_0.FILES['myfile'].name:\n",
"return render(VAR_0, 'exercises/file_exercise.html')\n",
"VAR_8 = 'accepted'\n",
"VAR_8 = 'error'\n",
"return render(VAR_0, 'exercises/file_result.html', {'status': VAR_8})\n"
] | [
"def file(request):...\n",
"if request.method == 'POST':\n",
"if 'myfile' in request.FILES and request.FILES['myfile'].name:\n",
"return render(request, 'exercises/file_exercise.html')\n",
"status = 'accepted'\n",
"status = 'error'\n",
"return render(request, 'exercises/file_result.html', {'status': status})\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"VAR_9 = 'CREATE TABLE IF NOT EXISTS {} ({})'.format(VAR_1, VAR_2)\n",
"self.connection.execute(VAR_9)\n",
"self.connection.commit()\n"
] | [
"def create_table(self):...\n",
"stmt = 'CREATE TABLE IF NOT EXISTS {} ({})'.format(tb_name, mapping)\n",
"self.connection.execute(stmt)\n",
"self.connection.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@property...\n",
"return await CLASS_0.sync_filter(VAR_8=self.id, orderings=['-id'])\n"
] | [
"@property...\n",
"return await Comment.sync_filter(post_id=self.id, orderings=['-id'])\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_26(self, VAR_41, VAR_42):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def symlink(self, targetPath, linkPath):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_0(self, VAR_5, VAR_6=None):...\n",
"if VAR_6 is None:\n",
"if VAR_5 == 'campaign':\n",
"if 'timestamp' in VAR_6:\n",
"VAR_6 = self.campaign\n",
"if VAR_5 == 'result':\n",
"VAR_6['timestamp'] = datetime.now()\n",
"if 'id' in VAR_6:\n",
"VAR_6 = self.result\n",
"self.cursor.execute('INSERT INTO log_{} ({}) VALUES ({})'.format(VAR_5, ','\n .join(VAR_6.keys()), ','.join('?' * len(VAR_6))), list(VAR_6.values()))\n",
"VAR_6['id'] = self.cursor.lastrowid\n"
] | [
"def insert(self, table, dictionary=None):...\n",
"if dictionary is None:\n",
"if table == 'campaign':\n",
"if 'timestamp' in dictionary:\n",
"dictionary = self.campaign\n",
"if table == 'result':\n",
"dictionary['timestamp'] = datetime.now()\n",
"if 'id' in dictionary:\n",
"dictionary = self.result\n",
"self.cursor.execute('INSERT INTO log_{} ({}) VALUES ({})'.format(table, ','\n .join(dictionary.keys()), ','.join('?' * len(dictionary))), list(\n dictionary.values()))\n",
"dictionary['id'] = self.cursor.lastrowid\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_8(self):...\n",
"VAR_18 = self.fsNode(True, '', 'System', VAR_29=self)\n",
"VAR_18.sub_items = set()\n",
"VAR_18.parent = None\n",
"self.fs_root = VAR_18\n",
"self.fs_uuid_idx[VAR_18.uuid] = VAR_18\n",
"self.fs_db.execute('string' % (VAR_18.uuid, VAR_18.file_name, VAR_18.owner,\n VAR_18.upload_time))\n",
"return\n"
] | [
"def make_root(self):...\n",
"item = self.fsNode(True, '', 'System', master=self)\n",
"item.sub_items = set()\n",
"item.parent = None\n",
"self.fs_root = item\n",
"self.fs_uuid_idx[item.uuid] = item\n",
"self.fs_db.execute(\n \"INSERT INTO file_system (uuid, file_name, owner, upload_time, sub_folders, sub_files) VALUES ('%s', '%s', '%s', %f, '{}', '{}');\"\n % (item.uuid, item.file_name, item.owner, item.upload_time))\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_13.whitelist()...\n",
"FUNC_2(VAR_1, VAR_2, VAR_3, VAR_0=searchfield, VAR_5=page_length, VAR_4=filters\n )\n",
"VAR_13.response['results'] = FUNC_4(VAR_13.response['values'])\n"
] | [
"@frappe.whitelist()...\n",
"search_widget(doctype, txt, query, searchfield=searchfield, page_length=\n page_length, filters=filters)\n",
"frappe.response['results'] = build_for_autosuggest(frappe.response['values'])\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'"
] |
[
"import vim\n",
"import requests\n",
"import urlparse\n",
"from retries import retries\n",
"from requests_futures.sessions import FuturesSession\n",
"from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor\n",
"from ycm import vimsupport\n",
"from ycm.utils import ToUtf8Json\n",
"from ycm.server.responses import ServerError, UnknownExtraConf\n",
"VAR_0 = {'content-type': 'application/json'}\n",
"VAR_1 = UnsafeThreadPoolExecutor(max_workers=30)\n",
"VAR_2 = 30\n",
"def __init__(self):...\n",
"def FUNC_5(self):...\n",
"def FUNC_6(self):...\n",
"return True\n"
] | [
"import vim\n",
"import requests\n",
"import urlparse\n",
"from retries import retries\n",
"from requests_futures.sessions import FuturesSession\n",
"from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor\n",
"from ycm import vimsupport\n",
"from ycm.utils import ToUtf8Json\n",
"from ycm.server.responses import ServerError, UnknownExtraConf\n",
"_HEADERS = {'content-type': 'application/json'}\n",
"_EXECUTOR = UnsafeThreadPoolExecutor(max_workers=30)\n",
"_DEFAULT_TIMEOUT_SEC = 30\n",
"def __init__(self):...\n",
"def Start(self):...\n",
"def Done(self):...\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"@VAR_3.message_handler(content_types=['document', 'audio', 'document',...\n",
"VAR_10 = VAR_6.from_user.id\n",
"if VAR_6.document != None:\n",
"if VAR_6.document.mime_type in VAR_4:\n",
"if VAR_6.audio != None:\n",
"VAR_20 = VAR_4[VAR_6.document.mime_type]\n",
"VAR_20 = 'U'\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'audio' + str(VAR_6.date), 'A',\n VAR_6.audio.file_size)\n",
"if VAR_6.document != None:\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, VAR_6.document.file_name, VAR_20,\n VAR_6.document.file_size)\n",
"VAR_3.reply_to(VAR_6, 'π')\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'document' + str(VAR_6.date), 'D',\n VAR_6.document.file_size)\n",
"if VAR_6.photo != None:\n",
"FUNC_7(VAR_10, VAR_3)\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'photo' + str(VAR_6.date), 'P',\n VAR_6.photo[0].file_size)\n",
"if VAR_6.video != None:\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'video' + str(VAR_6.date), 'V',\n VAR_6.video.file_size)\n",
"if VAR_6.video_note != None:\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'video_note' + str(VAR_6.date),\n 'V', VAR_6.video_note.file_size)\n",
"if VAR_6.voice != None:\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'voice' + str(VAR_6.date), 'A',\n VAR_6.voice.file_size)\n",
"if VAR_6.contact != None:\n",
"VAR_1[VAR_10].new_file(VAR_6.message_id, 'contact' + str(VAR_6.date), 'D',\n VAR_6.contact.file_size)\n"
] | [
"@bot.message_handler(content_types=['document', 'audio', 'document',...\n",
"telegram_id = message.from_user.id\n",
"if message.document != None:\n",
"if message.document.mime_type in mime_conv:\n",
"if message.audio != None:\n",
"mime = mime_conv[message.document.mime_type]\n",
"mime = 'U'\n",
"explorers[telegram_id].new_file(message.message_id, 'audio' + str(message.\n date), 'A', message.audio.file_size)\n",
"if message.document != None:\n",
"explorers[telegram_id].new_file(message.message_id, message.document.\n file_name, mime, message.document.file_size)\n",
"bot.reply_to(message, 'π')\n",
"explorers[telegram_id].new_file(message.message_id, 'document' + str(\n message.date), 'D', message.document.file_size)\n",
"if message.photo != None:\n",
"send_replacing_message(telegram_id, bot)\n",
"explorers[telegram_id].new_file(message.message_id, 'photo' + str(message.\n date), 'P', message.photo[0].file_size)\n",
"if message.video != None:\n",
"explorers[telegram_id].new_file(message.message_id, 'video' + str(message.\n date), 'V', message.video.file_size)\n",
"if message.video_note != None:\n",
"explorers[telegram_id].new_file(message.message_id, 'video_note' + str(\n message.date), 'V', message.video_note.file_size)\n",
"if message.voice != None:\n",
"explorers[telegram_id].new_file(message.message_id, 'voice' + str(message.\n date), 'A', message.voice.file_size)\n",
"if message.contact != None:\n",
"explorers[telegram_id].new_file(message.message_id, 'contact' + str(message\n .date), 'D', message.contact.file_size)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4,
0,
4,
4,
4,
0,
0,
4,
0,
4,
0,
4,
0,
4,
0,
4
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def __init__(self, VAR_10):...\n",
"VAR_10 = VAR_10.strip()[:-1]\n",
"VAR_30 = VAR_10.find('\\n')\n",
"VAR_36 = VAR_10[:VAR_30].strip()\n",
"VAR_10 = VAR_10[VAR_30 + 1:]\n",
"VAR_41 = ''\n",
"if VAR_36[1] == '!':\n",
"VAR_41 = 'alert'\n",
"VAR_36 = VAR_36[2:]\n",
"def FUNC_2():...\n",
"super(CLASS_5, self).__init__(slideParser.parse(VAR_10, slideLexer), self.\n begin % (VAR_41, VAR_36), self.end % VAR_41)\n",
"CLASS_2.parsingQ.insert(0, FUNC_2)\n"
] | [
"def __init__(self, txt):...\n",
"txt = txt.strip()[:-1]\n",
"i = txt.find('\\n')\n",
"head = txt[:i].strip()\n",
"txt = txt[i + 1:]\n",
"kind = ''\n",
"if head[1] == '!':\n",
"kind = 'alert'\n",
"head = head[2:]\n",
"def innerFunc():...\n",
"super(Box, self).__init__(slideParser.parse(txt, slideLexer), self.begin %\n (kind, head), self.end % kind)\n",
"Slide.parsingQ.insert(0, innerFunc)\n"
] | [
0,
2,
2,
2,
0,
2,
2,
2,
2,
0,
2,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(VAR_2):...\n",
"VAR_12 = VAR_2 + '/solr/possible.conflicts/update?commit=true'\n",
"VAR_14 = {'content-type': 'text/xml'}\n",
"VAR_9 = '<delete><query>id:*</query></delete>'\n",
"VAR_13 = requests.post(VAR_12, VAR_14=headers, VAR_9=data)\n",
"assert VAR_13.status_code == 200\n"
] | [
"def clean_database(solr):...\n",
"url = solr + '/solr/possible.conflicts/update?commit=true'\n",
"headers = {'content-type': 'text/xml'}\n",
"data = '<delete><query>id:*</query></delete>'\n",
"r = requests.post(url, headers=headers, data=data)\n",
"assert r.status_code == 200\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_10(self):...\n",
"if self._IsServerAlive():\n",
"return BaseRequest.PostDataToHandler(BuildRequestData(), 'defined_subcommands')\n",
"return []\n"
] | [
"def GetDefinedSubcommands(self):...\n",
"if self._IsServerAlive():\n",
"return BaseRequest.PostDataToHandler(BuildRequestData(), 'defined_subcommands')\n",
"return []\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
"def RestartServer(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(VAR_4, VAR_3):...\n",
"VAR_17 = argparse.ArgumentParser(VAR_4=prog, usage=USAGE.format(prog))\n",
"VAR_17.add_argument('--nodebug', action='store_true')\n",
"VAR_18 = VAR_17.add_mutually_exclusive_group()\n",
"VAR_18.add_argument('--host')\n",
"VAR_18.add_argument('--server-host')\n",
"VAR_17.add_argument('--port', type=int, required=True)\n",
"VAR_19 = VAR_17.add_mutually_exclusive_group(required=True)\n",
"VAR_19.add_argument('-m', dest='module')\n",
"VAR_19.add_argument('filename', nargs='?')\n",
"VAR_17.add_argument('--single-session', action='store_true')\n",
"VAR_17.add_argument('-V', '--version', action='version')\n",
"VAR_17.version = __version__\n",
"VAR_14 = VAR_17.parse_args(VAR_3)\n",
"VAR_20 = vars(VAR_14)\n",
"VAR_21 = VAR_20.pop('server_host', None)\n",
"VAR_22 = VAR_20.pop('host', None)\n",
"if VAR_21:\n",
"VAR_14.address = Address.as_server(VAR_21, VAR_20.pop('port'))\n",
"if not VAR_22:\n",
"VAR_23 = VAR_20.pop('module')\n",
"if VAR_14.nodebug:\n",
"VAR_14.address = Address.as_client(VAR_22, VAR_20.pop('port'))\n",
"VAR_24 = VAR_20.pop('filename')\n",
"VAR_14.address = Address.as_client(VAR_22, VAR_20.pop('port'))\n",
"VAR_14.address = Address.as_server(VAR_22, VAR_20.pop('port'))\n",
"if VAR_23 is None:\n",
"VAR_14.name = VAR_24\n",
"VAR_14.name = VAR_23\n",
"VAR_14.kind = 'script'\n",
"VAR_14.kind = 'module'\n",
"return VAR_14\n"
] | [
"def _parse_args(prog, argv):...\n",
"parser = argparse.ArgumentParser(prog=prog, usage=USAGE.format(prog))\n",
"parser.add_argument('--nodebug', action='store_true')\n",
"host = parser.add_mutually_exclusive_group()\n",
"host.add_argument('--host')\n",
"host.add_argument('--server-host')\n",
"parser.add_argument('--port', type=int, required=True)\n",
"target = parser.add_mutually_exclusive_group(required=True)\n",
"target.add_argument('-m', dest='module')\n",
"target.add_argument('filename', nargs='?')\n",
"parser.add_argument('--single-session', action='store_true')\n",
"parser.add_argument('-V', '--version', action='version')\n",
"parser.version = __version__\n",
"args = parser.parse_args(argv)\n",
"ns = vars(args)\n",
"serverhost = ns.pop('server_host', None)\n",
"clienthost = ns.pop('host', None)\n",
"if serverhost:\n",
"args.address = Address.as_server(serverhost, ns.pop('port'))\n",
"if not clienthost:\n",
"module = ns.pop('module')\n",
"if args.nodebug:\n",
"args.address = Address.as_client(clienthost, ns.pop('port'))\n",
"filename = ns.pop('filename')\n",
"args.address = Address.as_client(clienthost, ns.pop('port'))\n",
"args.address = Address.as_server(clienthost, ns.pop('port'))\n",
"if module is None:\n",
"args.name = filename\n",
"args.name = module\n",
"args.kind = 'script'\n",
"args.kind = 'module'\n",
"return args\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
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = FUNC_0(VAR_2)\n",
"VAR_7 = FUNC_1(VAR_2)\n",
"VAR_8 = FUNC_3(VAR_2)['id']\n",
"VAR_9 = [VAR_6, VAR_7, VAR_8]\n",
"VAR_1.execute('UPDATE files SET size=%s, age=%s, passes=0 WHERE id=%s;', VAR_9)\n",
"VAR_0.commit()\n",
"return\n"
] | [
"def db_update_file_details(path):...\n",
"\"\"\"docstring\"\"\"\n",
"file_size = get_file_size(path)\n",
"file_age = get_file_age(path)\n",
"file_id = db_get_file_details(path)['id']\n",
"params = [file_size, file_age, file_id]\n",
"cur.execute('UPDATE files SET size=%s, age=%s, passes=0 WHERE id=%s;', params)\n",
"db.commit()\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_24(self, VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_57 = self.getfile(VAR_21, VAR_23=False)\n",
"if VAR_57 == False:\n",
"self.get_path(os.path.dirname(VAR_21)).remove(VAR_57)\n",
"return\n"
] | [
"def remove(self, path):...\n",
"\"\"\"docstring\"\"\"\n",
"p = self.getfile(path, follow_symlinks=False)\n",
"if p == False:\n",
"self.get_path(os.path.dirname(path)).remove(p)\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = []\n",
"for i in range(10):\n",
"VAR_6 = DevInfo()\n",
"client.devices.insert(VAR_3)\n",
"VAR_6.family = PHO_DEV_DIR\n",
"for VAR_6 in VAR_3:\n",
"VAR_6.model = ''\n",
"VAR_7 = client.devices.get(serial=dev.serial)\n",
"client.devices.delete(VAR_7)\n",
"VAR_6.path = '/tmp/test_%d' % randint(0, 1000000)\n",
"for retrieved_dev in VAR_7:\n",
"VAR_6.host = 'localhost'\n",
"self.assertTrue(isinstance(retrieved_dev, VAR_6.__class__))\n",
"VAR_6.serial = '__TEST_MAGIC_%d' % randint(0, 1000000)\n",
"self.assertEqual(retrieved_dev.serial, VAR_6.serial)\n",
"VAR_3.append(VAR_6)\n"
] | [
"def test_getset(self):...\n",
"\"\"\"docstring\"\"\"\n",
"insert_list = []\n",
"for i in range(10):\n",
"dev = DevInfo()\n",
"client.devices.insert(insert_list)\n",
"dev.family = PHO_DEV_DIR\n",
"for dev in insert_list:\n",
"dev.model = ''\n",
"res = client.devices.get(serial=dev.serial)\n",
"client.devices.delete(res)\n",
"dev.path = '/tmp/test_%d' % randint(0, 1000000)\n",
"for retrieved_dev in res:\n",
"dev.host = 'localhost'\n",
"self.assertTrue(isinstance(retrieved_dev, dev.__class__))\n",
"dev.serial = '__TEST_MAGIC_%d' % randint(0, 1000000)\n",
"self.assertEqual(retrieved_dev.serial, dev.serial)\n",
"insert_list.append(dev)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"VAR_5 = None\n",
"VAR_5 = tempfile.NamedTemporaryFile(delete=False)\n",
"if VAR_5:\n",
"VAR_5.close()\n",
"os.remove(VAR_5.name)\n",
"self._mox.StubOutWithMock(url_helper, 'UrlOpen')\n",
"VAR_12 = 'data'\n",
"url_helper.UrlOpen(mox.IgnoreArg(), method='GET').AndReturn(VAR_12)\n",
"self._mox.ReplayAll()\n",
"self.assertTrue(url_helper.DownloadFile(VAR_5.name, 'http://www.fakeurl.com'))\n",
"self.assertEqual(VAR_12, f.read())\n",
"self._mox.VerifyAll()\n"
] | [
"def testDownloadFile(self):...\n",
"local_file = None\n",
"local_file = tempfile.NamedTemporaryFile(delete=False)\n",
"if local_file:\n",
"local_file.close()\n",
"os.remove(local_file.name)\n",
"self._mox.StubOutWithMock(url_helper, 'UrlOpen')\n",
"file_data = 'data'\n",
"url_helper.UrlOpen(mox.IgnoreArg(), method='GET').AndReturn(file_data)\n",
"self._mox.ReplayAll()\n",
"self.assertTrue(url_helper.DownloadFile(local_file.name,\n 'http://www.fakeurl.com'))\n",
"self.assertEqual(file_data, f.read())\n",
"self._mox.VerifyAll()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_21(self, VAR_68):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.docstring = VAR_68\n",
"return VAR_101\n"
] | [
"def docstring(self, string):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.docstring = string\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_18(VAR_37):...\n",
"VAR_37 = VAR_37.replace('[', '')\n",
"VAR_37 = VAR_37.replace(']', '')\n",
"VAR_45, VAR_46 = VAR_37.split(',')\n",
"VAR_37 = '{} - {}'.format(VAR_45, VAR_46)\n",
"return VAR_37\n"
] | [
"def reformat(score):...\n",
"score = score.replace('[', '')\n",
"score = score.replace(']', '')\n",
"win, loss = score.split(',')\n",
"score = '{} - {}'.format(win, loss)\n",
"return score\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"self.run_test_case(self.scenario.create_app())\n"
] | [
"def test_a_create_app(self):...\n",
"self.run_test_case(self.scenario.create_app())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, VAR_1, VAR_5, VAR_6, VAR_4=None):...\n",
"GenericRequest.__init__(self, VAR_1, VAR_4)\n",
"self.url = '%stasks/%s/statements/%s' % (self.base_url, VAR_5, VAR_6)\n",
"self.task_id = VAR_5\n"
] | [
"def __init__(self, browser, task_id, language_code, base_url=None):...\n",
"GenericRequest.__init__(self, browser, base_url)\n",
"self.url = '%stasks/%s/statements/%s' % (self.base_url, task_id, language_code)\n",
"self.task_id = task_id\n"
] | [
0,
0,
5,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(VAR_2):...\n",
"assert VAR_2 == 'hello'\n"
] | [
"def assert_warn(line):...\n",
"assert line == 'hello'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_7(self):...\n",
"VAR_3 = FUNC_1(self.window)\n",
"VAR_16 = []\n",
"for VAR_6 in VAR_3:\n",
"VAR_20 = []\n",
"self.sorted_menu = sorted(VAR_16, key=lambda item: item[1], reverse=True)\n",
"VAR_23 = CLASS_0(VAR_6)\n",
"self.display_menu = []\n",
"VAR_12 = Urtext.meta.NodeMetadata(os.path.join(FUNC_0(self.window), VAR_23.\n filename))\n",
"for VAR_20 in self.sorted_menu:\n",
"VAR_20.append(VAR_12.get_tag('title')[0])\n",
"VAR_22 = [VAR_20[0], VAR_20[1].strftime('<%a., %b. %d, %Y, %I:%M %p>')]\n",
"def FUNC_9(VAR_17):...\n",
"VAR_20.append(Urtext.datestimes.date_from_reverse_date(VAR_23.node_number))\n",
"self.display_menu.append(VAR_22)\n",
"VAR_1 = self.window.active_view()\n",
"VAR_20.append(VAR_12.filename)\n",
"VAR_13 = self.sorted_menu[VAR_17][2]\n",
"VAR_16.append(VAR_20)\n",
"VAR_19 = self.sorted_menu[VAR_17][0]\n",
"VAR_1.run_command('insert', {'characters': VAR_19 + ' -> ' + VAR_23.\n filename + ' | '})\n",
"self.window.show_quick_panel(self.display_menu, FUNC_9)\n"
] | [
"def run(self):...\n",
"files = get_all_files(self.window)\n",
"menu = []\n",
"for filename in files:\n",
"item = []\n",
"self.sorted_menu = sorted(menu, key=lambda item: item[1], reverse=True)\n",
"file_info = UrtextFile(filename)\n",
"self.display_menu = []\n",
"metadata = Urtext.meta.NodeMetadata(os.path.join(get_path(self.window),\n file_info.filename))\n",
"for item in self.sorted_menu:\n",
"item.append(metadata.get_tag('title')[0])\n",
"new_item = [item[0], item[1].strftime('<%a., %b. %d, %Y, %I:%M %p>')]\n",
"def link_to_the_file(index):...\n",
"item.append(Urtext.datestimes.date_from_reverse_date(file_info.node_number))\n",
"self.display_menu.append(new_item)\n",
"view = self.window.active_view()\n",
"item.append(metadata.filename)\n",
"file = self.sorted_menu[index][2]\n",
"menu.append(item)\n",
"title = self.sorted_menu[index][0]\n",
"view.run_command('insert', {'characters': title + ' -> ' + file_info.\n filename + ' | '})\n",
"self.window.show_quick_panel(self.display_menu, link_to_the_file)\n"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_3):...\n",
"time.sleep(1)\n",
"webbrowser.open(VAR_3)\n"
] | [
"def _open_url(url):...\n",
"time.sleep(1)\n",
"webbrowser.open(url)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"\"\"\" Client blueprint used to handle OAuth callbacks. \"\"\"\n",
"from __future__ import absolute_import\n",
"from flask import Blueprint, abort, current_app, url_for, request\n",
"from flask.ext.login import user_logged_out\n",
"from invenio.base.globals import cfg\n",
"from invenio.ext.sslify import ssl_required\n",
"from ..client import oauth, handlers, disconnect_handlers, signup_handlers\n",
"from ..handlers import authorized_default_handler, make_token_getter, make_handler, disconnect_handler, oauth_logout_handler\n",
"VAR_0 = Blueprint('oauthclient', __name__, url_prefix='/oauth',\n static_folder='../static', template_folder='../templates')\n",
"@VAR_0.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if VAR_1 not in oauth.remote_apps:\n",
"@VAR_0.route('/login/<remote_app>/')...\n",
"VAR_4 = oauth.remote_app(VAR_1, **conf['params'])\n",
"VAR_4 = oauth.remote_apps[VAR_1]\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4.tokengetter(make_token_getter(VAR_4))\n",
"if VAR_1 not in oauth.remote_apps:\n",
"handlers.register(VAR_1, VAR_4.authorized_handler(make_handler(conf.get(\n 'authorized_handler', authorized_default_handler), VAR_4)))\n",
"return abort(404)\n",
"VAR_2 = url_for('.authorized', VAR_1=remote_app, next=request.args.get(\n 'next') or request.referrer or None, _external=True)\n",
"disconnect_handlers.register(VAR_1, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), VAR_4, with_response=False))\n",
"return oauth.remote_apps[VAR_1].authorize(callback=callback_url)\n",
"def FUNC_5(VAR_4, *VAR_5, **VAR_6):...\n",
"VAR_7 = conf.get('signup_handler', dict())\n",
"VAR_8 = make_handler(VAR_7.get('info', FUNC_5), VAR_4, with_response=False)\n",
"VAR_9 = make_handler(VAR_7.get('setup', FUNC_5), VAR_4, with_response=False)\n",
"VAR_10 = make_handler(VAR_7.get('view', FUNC_5), VAR_4, with_response=False)\n",
"signup_handlers.register(VAR_1, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n"
] | [
"\"\"\" Client blueprint used to handle OAuth callbacks. \"\"\"\n",
"from __future__ import absolute_import\n",
"from flask import Blueprint, abort, current_app, url_for, request\n",
"from flask.ext.login import user_logged_out\n",
"from invenio.base.globals import cfg\n",
"from invenio.ext.sslify import ssl_required\n",
"from ..client import oauth, handlers, disconnect_handlers, signup_handlers\n",
"from ..handlers import authorized_default_handler, make_token_getter, make_handler, disconnect_handler, oauth_logout_handler\n",
"blueprint = Blueprint('oauthclient', __name__, url_prefix='/oauth',\n static_folder='../static', template_folder='../templates')\n",
"@blueprint.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if remote_app not in oauth.remote_apps:\n",
"@blueprint.route('/login/<remote_app>/')...\n",
"remote = oauth.remote_app(remote_app, **conf['params'])\n",
"remote = oauth.remote_apps[remote_app]\n",
"\"\"\"docstring\"\"\"\n",
"remote.tokengetter(make_token_getter(remote))\n",
"if remote_app not in oauth.remote_apps:\n",
"handlers.register(remote_app, remote.authorized_handler(make_handler(conf.\n get('authorized_handler', authorized_default_handler), remote)))\n",
"return abort(404)\n",
"callback_url = url_for('.authorized', remote_app=remote_app, next=request.\n args.get('next') or request.referrer or None, _external=True)\n",
"disconnect_handlers.register(remote_app, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), remote, with_response=False))\n",
"return oauth.remote_apps[remote_app].authorize(callback=callback_url)\n",
"def dummy_handler(remote, *args, **kargs):...\n",
"signup_handler = conf.get('signup_handler', dict())\n",
"account_info_handler = make_handler(signup_handler.get('info',\n dummy_handler), remote, with_response=False)\n",
"account_setup_handler = make_handler(signup_handler.get('setup',\n dummy_handler), remote, with_response=False)\n",
"account_view_handler = make_handler(signup_handler.get('view',\n dummy_handler), remote, with_response=False)\n",
"signup_handlers.register(remote_app, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n"
] | [
0,
0,
5,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
5,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"For",
"Docstring",
"Expr'",
"Expr'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Docstring",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Return'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self, **VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in VAR_0:\n",
"setattr(self, field_name, VAR_0[field_name])\n",
"VAR_1.pop(-1)\n",
"VAR_2 = self._meta.get_field(field_name)\n",
"VAR_1.extend(['WHERE', 'id', '=', str(self.id)])\n",
"VAR_3 = VAR_2.get_db_prep_save(VAR_0[field_name])\n",
"VAR_1 = ' '.join(VAR_1)\n",
"if isinstance(VAR_3, basestring):\n",
"connection.cursor().execute(VAR_1)\n",
"VAR_3 = \"'%s'\" % VAR_3.encode('utf-8').replace('\\\\', '\\\\\\\\')\n",
"if isinstance(VAR_3, models.Model):\n",
"transaction.commit_unless_managed()\n",
"VAR_1.extend((connection.ops.quote_name(VAR_2.column), '=', VAR_3, ','))\n",
"VAR_3 = str(VAR_3.id)\n",
"if VAR_3 is None:\n",
"VAR_3 = 'NULL'\n",
"VAR_3 = str(VAR_3)\n"
] | [
"def update_fields(self, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"sql = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in kwargs:\n",
"setattr(self, field_name, kwargs[field_name])\n",
"sql.pop(-1)\n",
"field = self._meta.get_field(field_name)\n",
"sql.extend(['WHERE', 'id', '=', str(self.id)])\n",
"value = field.get_db_prep_save(kwargs[field_name])\n",
"sql = ' '.join(sql)\n",
"if isinstance(value, basestring):\n",
"connection.cursor().execute(sql)\n",
"value = \"'%s'\" % value.encode('utf-8').replace('\\\\', '\\\\\\\\')\n",
"if isinstance(value, models.Model):\n",
"transaction.commit_unless_managed()\n",
"sql.extend((connection.ops.quote_name(field.column), '=', value, ','))\n",
"value = str(value.id)\n",
"if value is None:\n",
"value = 'NULL'\n",
"value = str(value)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
4,
4,
4,
0,
4,
4,
4,
4,
4
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = (\n '--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else ''))\n",
"VAR_7 = BokChoyTestSuite('', num_processes=1)\n",
"self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n"
] | [
"def test_verbosity_settings_1_process(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expected_verbosity_string = (\n '--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else ''))\n",
"suite = BokChoyTestSuite('', num_processes=1)\n",
"self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_16):...\n",
"return self.column_flags[self.columns[VAR_16.column()]]\n"
] | [
"def flags(self, index):...\n",
"return self.column_flags[self.columns[index.column()]]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_30(self, VAR_47):...\n",
"VAR_69, VAR_73 = self.put('/mails', VAR_47)\n",
"return VAR_69, VAR_73\n"
] | [
"def put_mail(self, data):...\n",
"res, req = self.put('/mails', data)\n",
"return res, req\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = VAR_5['cve_list']\n",
"VAR_10 = filter(None, VAR_10)\n",
"VAR_11 = {}\n",
"if not VAR_10:\n",
"return VAR_11\n",
"VAR_2 = ['cve.id', 'redhat_url', 'secondary_url', 'cve.name',\n 'severity.name', 'published_date', 'modified_date', 'iava', 'description']\n",
"VAR_12 = 'SELECT %s from cve' % ', '.join(column for column in VAR_2)\n",
"VAR_12 = VAR_12 + ' LEFT JOIN severity ON severity_id = severity.id'\n",
"VAR_12 = VAR_12 + ' WHERE cve.name IN %s'\n",
"self.cursor.execute(VAR_12, [tuple(VAR_10)])\n",
"VAR_13 = self.cursor.fetchall()\n",
"VAR_8 = self.get_cve_cwe_map([VAR_16[VAR_2.index('cve.id')] for VAR_16 in\n VAR_13])\n",
"CLASS_0.cve_cwe_map = VAR_8\n",
"VAR_7 = []\n",
"for VAR_1 in VAR_13:\n",
"VAR_16 = CLASS_0(VAR_1, VAR_2)\n",
"return self.construct_answer(VAR_7)\n",
"VAR_7.append(VAR_16)\n"
] | [
"def process_list(self, data):...\n",
"\"\"\"docstring\"\"\"\n",
"cves_to_process = data['cve_list']\n",
"cves_to_process = filter(None, cves_to_process)\n",
"answer = {}\n",
"if not cves_to_process:\n",
"return answer\n",
"column_names = ['cve.id', 'redhat_url', 'secondary_url', 'cve.name',\n 'severity.name', 'published_date', 'modified_date', 'iava', 'description']\n",
"cve_query = 'SELECT %s from cve' % ', '.join(column for column in column_names)\n",
"cve_query = cve_query + ' LEFT JOIN severity ON severity_id = severity.id'\n",
"cve_query = cve_query + ' WHERE cve.name IN %s'\n",
"self.cursor.execute(cve_query, [tuple(cves_to_process)])\n",
"cves = self.cursor.fetchall()\n",
"cwe_map = self.get_cve_cwe_map([cve[column_names.index('cve.id')] for cve in\n cves])\n",
"CVE.cve_cwe_map = cwe_map\n",
"cve_list = []\n",
"for cve_entry in cves:\n",
"cve = CVE(cve_entry, column_names)\n",
"return self.construct_answer(cve_list)\n",
"cve_list.append(cve)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"@classmethod...\n",
""
] | [
"@classmethod...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def __init__(self, **VAR_4):...\n",
"CLASS_1.__init__(self, **kwargs)\n",
"self.type_filter = None\n"
] | [
"def __init__(self, **kwargs):...\n",
"TriblerContentModel.__init__(self, **kwargs)\n",
"self.type_filter = None\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_35(VAR_40):...\n",
"VAR_68 = VAR_10[VAR_40]\n",
"for pattern, has_argument in VAR_39.items():\n",
"if pattern.match(VAR_68):\n",
"VAR_8.warn(\n \"Zinc argument '{}' is not supported, and is subject to change/removal!\"\n .format(VAR_68))\n",
"return 2 if has_argument else 1\n",
"return 1\n"
] | [
"def validate(idx):...\n",
"arg = args[idx]\n",
"for pattern, has_argument in valid_patterns.items():\n",
"if pattern.match(arg):\n",
"log.warn(\n \"Zinc argument '{}' is not supported, and is subject to change/removal!\"\n .format(arg))\n",
"return 2 if has_argument else 1\n",
"return 1\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_0(*VAR_0, **VAR_1):...\n",
"VAR_2 = requests.Response()\n",
"VAR_2.status_code = 200\n",
"VAR_2._content_consumed = True\n",
"return VAR_2\n"
] | [
"def mock_import_repository_task(*args, **kwargs):...\n",
"resp = requests.Response()\n",
"resp.status_code = 200\n",
"resp._content_consumed = True\n",
"return resp\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(VAR_9, VAR_10):...\n",
"VAR_15 = VAR_9.search_fields and VAR_9.search_fields.split(',') or []\n",
"VAR_16 = [VAR_9.title_field\n ] if VAR_9.title_field and VAR_9.title_field not in VAR_15 else []\n",
"VAR_15 = ['name'] + VAR_15 + VAR_16\n",
"if not VAR_10 in VAR_15:\n",
"VAR_15 = VAR_15 + [VAR_10]\n",
"return VAR_15\n"
] | [
"def get_std_fields_list(meta, key):...\n",
"sflist = meta.search_fields and meta.search_fields.split(',') or []\n",
"title_field = [meta.title_field\n ] if meta.title_field and meta.title_field not in sflist else []\n",
"sflist = ['name'] + sflist + title_field\n",
"if not key in sflist:\n",
"sflist = sflist + [key]\n",
"return sflist\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_3):...\n",
"return Task('nfs/{}'.format(VAR_0), VAR_1, VAR_2, partial(\n serialize_dashboard_exception, include_http_status=True))(VAR_3)\n"
] | [
"def composed_decorator(func):...\n",
"return Task('nfs/{}'.format(name), metadata, wait_for, partial(\n serialize_dashboard_exception, include_http_status=True))(func)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_10, VAR_11):...\n",
"unittest.TestCase.__init__(self, VAR_10)\n",
"self.connection_string = VAR_11\n"
] | [
"def __init__(self, method_name, connection_string):...\n",
"unittest.TestCase.__init__(self, method_name)\n",
"self.connection_string = connection_string\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(VAR_13, VAR_10, VAR_14=0):...\n",
"if VAR_14 == 0:\n",
"VAR_61 = VAR_13[0]\n",
"if len(VAR_13) > 1 and isinstance(VAR_13[1], tuple):\n",
"VAR_13 = VAR_13[1:]\n",
"VAR_61 = VAR_13[0]\n",
"VAR_61 = ''\n",
"VAR_11 = None\n",
"VAR_13 = VAR_13[1:]\n",
"if VAR_61 == 'emptyIfNull' and len(VAR_13) >= 1 and isinstance(VAR_13[0], tuple\n",
"if len(VAR_13) > 1 and isinstance(VAR_13[-1], six.string_types):\n",
"VAR_61 = 'ifNull'\n",
"VAR_36 = True\n",
"VAR_11 = VAR_13[-1]\n",
"VAR_13 = (VAR_13[0] + (CLASS_1(\"''\"),),) + VAR_13[1:]\n",
"for subexpr in VAR_13:\n",
"VAR_13 = VAR_13[:-1]\n",
"if isinstance(subexpr, tuple):\n",
"if VAR_14 == 0 and VAR_11:\n",
"VAR_61 += '(' + FUNC_4(subexpr, VAR_10, VAR_14 + 1) + ')'\n",
"if not VAR_36:\n",
"return FUNC_5(VAR_61, VAR_11, VAR_10)\n",
"return VAR_61\n",
"VAR_36 = False\n",
"VAR_61 += ', '\n",
"if isinstance(subexpr, six.string_types):\n",
"VAR_61 += FUNC_3(subexpr, VAR_10)\n",
"VAR_61 += FUNC_13(subexpr)\n"
] | [
"def complex_column_expr(expr, body, depth=0):...\n",
"if depth == 0:\n",
"ret = expr[0]\n",
"if len(expr) > 1 and isinstance(expr[1], tuple):\n",
"expr = expr[1:]\n",
"ret = expr[0]\n",
"ret = ''\n",
"alias = None\n",
"expr = expr[1:]\n",
"if ret == 'emptyIfNull' and len(expr) >= 1 and isinstance(expr[0], tuple):\n",
"if len(expr) > 1 and isinstance(expr[-1], six.string_types):\n",
"ret = 'ifNull'\n",
"first = True\n",
"alias = expr[-1]\n",
"expr = (expr[0] + (Literal(\"''\"),),) + expr[1:]\n",
"for subexpr in expr:\n",
"expr = expr[:-1]\n",
"if isinstance(subexpr, tuple):\n",
"if depth == 0 and alias:\n",
"ret += '(' + complex_column_expr(subexpr, body, depth + 1) + ')'\n",
"if not first:\n",
"return alias_expr(ret, alias, body)\n",
"return ret\n",
"first = False\n",
"ret += ', '\n",
"if isinstance(subexpr, six.string_types):\n",
"ret += column_expr(subexpr, body)\n",
"ret += escape_literal(subexpr)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"AugAssign'",
"Condition",
"Return'",
"Return'",
"Assign'",
"AugAssign'",
"Condition",
"AugAssign'",
"AugAssign'"
] |
[
"def FUNC_3(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n",
"return [field for field in VAR_6['fields'] if field['name'] not in VAR_20]\n"
] | [
"def enterprise_fields_only(fields):...\n",
"\"\"\"docstring\"\"\"\n",
"enterprise_exclusions = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n",
"return [field for field in fields['fields'] if field['name'] not in\n enterprise_exclusions]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._state\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._state\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@functools.wraps(VAR_3)...\n",
"VAR_23 = VAR_5.pop('timeout', None)\n",
"VAR_24 = eventlet.spawn(VAR_3, self, *VAR_4, **kwargs)\n",
"if VAR_23 is None:\n",
"return VAR_24.wait()\n",
"VAR_36 = eventlet.spawn_after(VAR_23, VAR_24.kill)\n",
"VAR_48 = VAR_24.wait()\n",
"VAR_36.cancel()\n",
"return VAR_48\n"
] | [
"@functools.wraps(f)...\n",
"timeout = kwargs.pop('timeout', None)\n",
"gt = eventlet.spawn(f, self, *args, **kwargs)\n",
"if timeout is None:\n",
"return gt.wait()\n",
"kill_thread = eventlet.spawn_after(timeout, gt.kill)\n",
"res = gt.wait()\n",
"kill_thread.cancel()\n",
"return res\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_9, VAR_10, VAR_6, VAR_14):...\n",
"self.model = VAR_9\n",
"if isinstance(VAR_10, SmartListFilter):\n",
"self.field_name = VAR_10.parameter_name\n",
"self.field_name = VAR_10\n",
"self.model_field = VAR_10\n",
"self.model_field = self.model._meta.get_field(self.field_name)\n",
"self.query_params = VAR_6\n",
"self.object_list = VAR_14\n"
] | [
"def __init__(self, model, field, query_params, object_list):...\n",
"self.model = model\n",
"if isinstance(field, SmartListFilter):\n",
"self.field_name = field.parameter_name\n",
"self.field_name = field\n",
"self.model_field = field\n",
"self.model_field = self.model._meta.get_field(self.field_name)\n",
"self.query_params = query_params\n",
"self.object_list = object_list\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(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'"
] |
[
"def FUNC_15(self, VAR_15, VAR_8):...\n",
"VAR_27, VAR_28 = super().as_sql(VAR_15, VAR_8)\n",
"VAR_27 = '%s::%s' % (VAR_27, self.lhs.output_field.db_type(VAR_8))\n",
"return VAR_27, VAR_28\n"
] | [
"def as_sql(self, qn, connection):...\n",
"sql, params = super().as_sql(qn, connection)\n",
"sql = '%s::%s' % (sql, self.lhs.output_field.db_type(connection))\n",
"return sql, params\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"super(CLASS_0, self).setUp()\n",
"self.mock(net, 'url_open', self._url_open)\n",
"self.mock(net, 'url_read_json', self._url_read_json)\n",
"self.mock(net, 'sleep_before_retry', lambda *VAR_10: None)\n",
"self._lock = threading.Lock()\n",
"self._requests = []\n"
] | [
"def setUp(self):...\n",
"super(TestCase, self).setUp()\n",
"self.mock(net, 'url_open', self._url_open)\n",
"self.mock(net, 'url_read_json', self._url_read_json)\n",
"self.mock(net, 'sleep_before_retry', lambda *_: None)\n",
"self._lock = threading.Lock()\n",
"self._requests = []\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_0):...\n",
"self.config = VAR_0\n",
"self.co2_mult = self.config.get_co2_avoidance_factor()\n",
"self.db = sqlite3.connect(self.config.get_database_path(),\n check_same_thread=False)\n",
"self.c = self.db.cursor()\n",
"self.local_timezone = self.get_local_timezone()\n"
] | [
"def __init__(self, config):...\n",
"self.config = config\n",
"self.co2_mult = self.config.get_co2_avoidance_factor()\n",
"self.db = sqlite3.connect(self.config.get_database_path(),\n check_same_thread=False)\n",
"self.c = self.db.cursor()\n",
"self.local_timezone = self.get_local_timezone()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@api.public...\n",
"FUNC_31(self, 'POST')\n"
] | [
"@api.public...\n",
"record(self, 'POST')\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"VAR_5 = VAR_0['points']\n",
"VAR_6 = copy(VAR_0['points_by_difficulty'])\n",
"def FUNC_2(VAR_7):...\n",
"if isinstance(VAR_7, list):\n",
"VAR_15, VAR_16 = zip(*VAR_7)\n",
"return VAR_5 >= VAR_7\n",
"for i, VAR_21 in enumerate(VAR_15):\n",
"if VAR_2:\n",
"return True\n",
"VAR_17 = VAR_6.get(VAR_21, 0)\n",
"if VAR_6.get(VAR_21, 0) < VAR_16[i]:\n",
"VAR_18 = VAR_16[i]\n",
"return False\n",
"if VAR_17 < VAR_18:\n",
"for j in range(i + 1, len(VAR_15)):\n",
"VAR_19 = VAR_15[j]\n",
"VAR_20 = VAR_6.get(VAR_19, 0)\n",
"if VAR_20 > VAR_18 - VAR_17:\n",
"VAR_6[VAR_19] -= VAR_18 - VAR_17\n",
"VAR_17 += VAR_20\n",
"VAR_6[VAR_21] = VAR_18\n",
"VAR_6[VAR_21] = VAR_17\n",
"VAR_6[VAR_19] = 0\n"
] | [
"def calculate_grade(total_points, point_limits, pad_points):...\n",
"points = total_points['points']\n",
"d_points = copy(total_points['points_by_difficulty'])\n",
"def pass_limit(bound):...\n",
"if isinstance(bound, list):\n",
"ds, ls = zip(*bound)\n",
"return points >= bound\n",
"for i, d in enumerate(ds):\n",
"if pad_points:\n",
"return True\n",
"p = d_points.get(d, 0)\n",
"if d_points.get(d, 0) < ls[i]:\n",
"l = ls[i]\n",
"return False\n",
"if p < l:\n",
"for j in range(i + 1, len(ds)):\n",
"jd = ds[j]\n",
"jp = d_points.get(jd, 0)\n",
"if jp > l - p:\n",
"d_points[jd] -= l - p\n",
"p += jp\n",
"d_points[d] = l\n",
"d_points[d] = p\n",
"d_points[jd] = 0\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_10(self, VAR_14):...\n",
"self.lasttok = None\n",
"self.lastid = None\n",
"self.parser.parse(VAR_14, lexer=self.lexer)\n"
] | [
"def parse(self, expr):...\n",
"self.lasttok = None\n",
"self.lastid = None\n",
"self.parser.parse(expr, lexer=self.lexer)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(VAR_28.size for VAR_28 in self.input)\n",
"return self._inputsize\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(f.size for f in self.input)\n",
"return self._inputsize\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(VAR_7)\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(volume)\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_0, VAR_1):...\n",
"VAR_1.execute(\n 'SELECT max(position) as position from video WHERE playlist_id={playlist_id};'\n .format(VAR_0=playlist_id))\n",
"VAR_9 = VAR_1.fetchone()\n",
"return VAR_9['position']\n"
] | [
"def retrieve_last_video_position(playlist_id, db):...\n",
"db.execute(\n 'SELECT max(position) as position from video WHERE playlist_id={playlist_id};'\n .format(playlist_id=playlist_id))\n",
"row = db.fetchone()\n",
"return row['position']\n"
] | [
0,
4,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Return'"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'GHABLE', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='GABLE', VAR_10=[{'name': '----GABLE'}, {'name':\n 'GHABLE'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'GHABLE', id='1')\n",
"verify_results(client, jwt, query='GABLE', expected=[{'name': '----GABLE'},\n {'name': 'GHABLE'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_7):...\n",
"VAR_8 = self.content\n",
"while VAR_8:\n",
"yield VAR_8[:VAR_7]\n",
"VAR_8 = VAR_8[VAR_7:]\n"
] | [
"def iter_content(self, chunk_size):...\n",
"c = self.content\n",
"while c:\n",
"yield c[:chunk_size]\n",
"c = c[chunk_size:]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'KOLDSMITHS', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='COLDSTREAM', VAR_10=[{'name': '----COLDSTREAM'\n }, {'name': 'KOLDSMITHS'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'KOLDSMITHS', id='1')\n",
"verify_results(client, jwt, query='COLDSTREAM', expected=[{'name':\n '----COLDSTREAM'}, {'name': 'KOLDSMITHS'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"return redirect(flask.url_for('index'))\n"
] | [
"def redirect_to_index(self):...\n",
"return redirect(flask.url_for('index'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@wraps(VAR_55)...\n",
"VAR_70['timer'] = CLASS_2(VAR_25)\n",
"return VAR_55(*VAR_69, **kwargs)\n"
] | [
"@wraps(func)...\n",
"kwargs['timer'] = Timer(name)\n",
"return func(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_24(self, *VAR_71, **VAR_72):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.params = VAR_71, VAR_72\n",
"return VAR_101\n"
] | [
"def params(self, *params, **kwparams):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.params = params, kwparams\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_26(self):...\n",
"self.compilation_ko(\n \"\"\"\nif header :is \"Sender\" \"[email protected]\" {\n discard;\n\n\"\"\")\n"
] | [
"def test_nonclosed_block(self):...\n",
"self.compilation_ko(\n \"\"\"\nif header :is \"Sender\" \"[email protected]\" {\n discard;\n\n\"\"\")\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {}\n",
"for count in range(0, 50):\n",
"if kb.dbms == 'Oracle' and VAR_0.endswith(' FROM DUAL'):\n",
"return None\n",
"VAR_0 = VAR_0[:-len(' FROM DUAL')]\n",
"if count:\n",
"VAR_0 += ', NULL'\n",
"if kb.dbms == 'Oracle':\n",
"VAR_0 += ' FROM DUAL'\n",
"VAR_5 = agent.postfixQuery(VAR_0, VAR_1)\n",
"VAR_6 = agent.payload(newValue=commentedQuery)\n",
"VAR_7 = Request.queryPage(VAR_6)\n",
"if not VAR_7 in VAR_2.keys():\n",
"VAR_2[VAR_7] = 1, VAR_5\n",
"VAR_2[VAR_7] = VAR_2[VAR_7][0] + 1, VAR_5\n",
"if count:\n",
"for element in VAR_2.values():\n",
"if element[0] == 1:\n",
"if kb.injPlace == 'GET':\n",
"VAR_4 = '%s?%s' % (conf.url, VAR_6)\n",
"if kb.injPlace == 'POST':\n",
"return VAR_4\n",
"VAR_4 = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'Cookie':\n",
"VAR_4 += \"\\nPOST:\\t'%s'\\n\" % VAR_6\n",
"VAR_4 = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'User-Agent':\n",
"VAR_4 += \"\\nCookie:\\t'%s'\\n\" % VAR_6\n",
"VAR_4 = \"URL:\\t\\t'%s'\" % conf.url\n",
"VAR_4 += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % VAR_6\n"
] | [
"def __effectiveUnionTest(query, comment):...\n",
"\"\"\"docstring\"\"\"\n",
"resultDict = {}\n",
"for count in range(0, 50):\n",
"if kb.dbms == 'Oracle' and query.endswith(' FROM DUAL'):\n",
"return None\n",
"query = query[:-len(' FROM DUAL')]\n",
"if count:\n",
"query += ', NULL'\n",
"if kb.dbms == 'Oracle':\n",
"query += ' FROM DUAL'\n",
"commentedQuery = agent.postfixQuery(query, comment)\n",
"payload = agent.payload(newValue=commentedQuery)\n",
"newResult = Request.queryPage(payload)\n",
"if not newResult in resultDict.keys():\n",
"resultDict[newResult] = 1, commentedQuery\n",
"resultDict[newResult] = resultDict[newResult][0] + 1, commentedQuery\n",
"if count:\n",
"for element in resultDict.values():\n",
"if element[0] == 1:\n",
"if kb.injPlace == 'GET':\n",
"value = '%s?%s' % (conf.url, payload)\n",
"if kb.injPlace == 'POST':\n",
"return value\n",
"value = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'Cookie':\n",
"value += \"\\nPOST:\\t'%s'\\n\" % payload\n",
"value = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'User-Agent':\n",
"value += \"\\nCookie:\\t'%s'\\n\" % payload\n",
"value = \"URL:\\t\\t'%s'\" % conf.url\n",
"value += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % payload\n"
] | [
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
2,
2,
0,
2,
0,
0,
0,
0,
2,
0,
0,
2,
0,
2
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"AugAssign'"
] |
[
"def FUNC_45(VAR_25, VAR_39):...\n",
"if self.parentfield:\n",
"return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(VAR_25.label), VAR_39)\n",
"return '{}: {}'.format(_(VAR_25.label), VAR_39)\n"
] | [
"def get_msg(df, docname):...\n",
"if self.parentfield:\n",
"return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(df.label), docname)\n",
"return '{}: {}'.format(_(df.label), docname)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_5(VAR_1):...\n",
"VAR_6 = sqlite3.connect('database.db')\n",
"VAR_7 = VAR_6.cursor()\n",
"return VAR_7.execute(\n \"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = '\" + str(\n getTitle(VAR_1)) + \"'\").fetchone()[0]\n"
] | [
"def getSeriesDateFromDatabase(submission):...\n",
"database = sqlite3.connect('database.db')\n",
"cursor = database.cursor()\n",
"return cursor.execute(\n \"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = '\" + str(\n getTitle(submission)) + \"'\").fetchone()[0]\n"
] | [
0,
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"VAR_4 = self.client.get('/no_course/test', follow=True)\n",
"self.assertEqual(VAR_4.status_code, 404)\n",
"VAR_4 = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertTrue(VAR_4.redirect_chain)\n",
"self.assertEqual(VAR_4.status_code, 200)\n",
"self.assertTemplateUsed(VAR_4, 'userprofile/login.html')\n",
"self.client.login(username='testUser', password='testPassword')\n",
"VAR_4 = self.client.get('/no_course/test', follow=True)\n",
"self.assertEqual(VAR_4.status_code, 404)\n",
"VAR_4 = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertEqual(VAR_4.status_code, 200)\n",
"self.assertEqual(VAR_4.context['course'], self.course)\n",
"self.assertEqual(VAR_4.context['instance'], self.current_course_instance)\n",
"self.assertFalse(VAR_4.context['is_assistant'])\n",
"self.assertFalse(VAR_4.context['is_teacher'])\n",
"VAR_4 = self.client.get(self.hidden_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertEqual(VAR_4.status_code, 403)\n"
] | [
"def test_course_views(self):...\n",
"response = self.client.get('/no_course/test', follow=True)\n",
"self.assertEqual(response.status_code, 404)\n",
"response = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertTrue(response.redirect_chain)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertTemplateUsed(response, 'userprofile/login.html')\n",
"self.client.login(username='testUser', password='testPassword')\n",
"response = self.client.get('/no_course/test', follow=True)\n",
"self.assertEqual(response.status_code, 404)\n",
"response = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(response.context['course'], self.course)\n",
"self.assertEqual(response.context['instance'], self.current_course_instance)\n",
"self.assertFalse(response.context['is_assistant'])\n",
"self.assertFalse(response.context['is_teacher'])\n",
"response = self.client.get(self.hidden_course_instance.get_absolute_url(),\n follow=True)\n",
"self.assertEqual(response.status_code, 403)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_14(VAR_0, VAR_13):...\n",
"db.engine.execute('DELETE FROM \"{0}\" WHERE {1}'.format(VAR_0, VAR_13))\n"
] | [
"def delete_rows(table_name, condition):...\n",
"db.engine.execute('DELETE FROM \"{0}\" WHERE {1}'.format(table_name, condition))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_3(VAR_0):...\n",
"VAR_2 = []\n",
"VAR_5 = {}\n",
"VAR_6 = 's.transaction_date' if VAR_0['based_on'\n ] == 'Sales Order' else 's.posting_date'\n",
"VAR_7 = frappe.db.sql('string'.format(VAR_6=date_field, doctype=filters[\n 'based_on']), as_dict=1)\n",
"for d in VAR_7:\n",
"VAR_5.setdefault(d.item_name, d)\n",
"return VAR_5\n"
] | [
"def get_sales_details(filters):...\n",
"data = []\n",
"item_details_map = {}\n",
"date_field = 's.transaction_date' if filters['based_on'\n ] == 'Sales Order' else 's.posting_date'\n",
"sales_data = frappe.db.sql(\n \"\"\"\n\t\tselect s.territory, s.customer, si.item_group, si.item_name, si.qty, {date_field} as last_order_date,\n\t\tDATEDIFF(CURDATE(), {date_field}) as days_since_last_order\n\t\tfrom `tab{doctype}` s, `tab{doctype} Item` si\n\t\twhere s.name = si.parent and s.docstatus = 1\n\t\tgroup by si.name order by days_since_last_order \"\"\"\n .format(date_field=date_field, doctype=filters['based_on']), as_dict=1)\n",
"for d in sales_data:\n",
"item_details_map.setdefault(d.item_name, d)\n",
"return item_details_map\n"
] | [
0,
0,
0,
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"@app.route('/api/commands', methods=['GET'])...\n",
"return commands.to_map()\n"
] | [
"@app.route('/api/commands', methods=['GET'])...\n",
"return commands.to_map()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_9(self, VAR_7):...\n",
"if VAR_7 in self.__dict__:\n"
] | [
"def delete_key(self, key):...\n",
"if key in self.__dict__:\n"
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_14(self):...\n",
"self.compilation_ko(\n \"\"\"\nif address \"From\" :is \"[email protected]\" {\n discard;\n}\n\"\"\")\n"
] | [
"def test_non_ordered_args(self):...\n",
"self.compilation_ko(\n \"\"\"\nif address \"From\" :is \"[email protected]\" {\n discard;\n}\n\"\"\")\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_11(self, VAR_13):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_26 = self.add_argument_group('ParlAI Image Preprocessing Arguments')\n",
"VAR_26.add_argument('--image-size', type=int, default=256, help=\n 'resizing dimension for images')\n",
"VAR_26.add_argument('--image-cropsize', type=int, default=224, help=\n 'crop dimension for images')\n"
] | [
"def add_image_args(self, image_mode):...\n",
"\"\"\"docstring\"\"\"\n",
"parlai = self.add_argument_group('ParlAI Image Preprocessing Arguments')\n",
"parlai.add_argument('--image-size', type=int, default=256, help=\n 'resizing dimension for images')\n",
"parlai.add_argument('--image-cropsize', type=int, default=224, help=\n 'crop dimension for images')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'"
] |
[
"\"\"\"string\"\"\"\n",
"from lib.core.agent import agent\n",
"from lib.core.data import conf\n",
"from lib.core.data import kb\n",
"from lib.core.data import logger\n",
"from lib.core.data import queries\n",
"from lib.core.session import setUnion\n",
"from lib.request.connect import Connect as Request\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {}\n",
"for count in range(0, 50):\n",
"if kb.dbms == 'Oracle' and VAR_0.endswith(' FROM DUAL'):\n",
"return None\n",
"VAR_0 = VAR_0[:-len(' FROM DUAL')]\n",
"if count:\n",
"VAR_0 += ', NULL'\n",
"if kb.dbms == 'Oracle':\n",
"VAR_0 += ' FROM DUAL'\n",
"VAR_5 = agent.postfixQuery(VAR_0, VAR_1)\n",
"VAR_6 = agent.payload(newValue=commentedQuery)\n",
"VAR_7 = Request.queryPage(VAR_6)\n",
"if not VAR_7 in VAR_2.keys():\n",
"VAR_2[VAR_7] = 1, VAR_5\n",
"VAR_2[VAR_7] = VAR_2[VAR_7][0] + 1, VAR_5\n",
"if count:\n",
"for element in VAR_2.values():\n",
"if element[0] == 1:\n",
"if kb.injPlace == 'GET':\n",
"VAR_4 = '%s?%s' % (conf.url, VAR_6)\n",
"if kb.injPlace == 'POST':\n",
"return VAR_4\n",
"VAR_4 = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'Cookie':\n",
"VAR_4 += \"\\nPOST:\\t'%s'\\n\" % VAR_6\n",
"VAR_4 = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'User-Agent':\n",
"VAR_4 += \"\\nCookie:\\t'%s'\\n\" % VAR_6\n",
"VAR_4 = \"URL:\\t\\t'%s'\" % conf.url\n",
"VAR_4 += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % VAR_6\n"
] | [
"\"\"\"\n$Id$\n\nThis file is part of the sqlmap project, http://sqlmap.sourceforge.net.\n\nCopyright (c) 2006-2008 Bernardo Damele A. G. <[email protected]>\n and Daniele Bellucci <[email protected]>\n\nsqlmap is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation version 2 of the License.\n\nsqlmap is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\nFOR A PARTICULAR PURPOSE. See the GNU General Public License for more\ndetails.\n\nYou should have received a copy of the GNU General Public License along\nwith sqlmap; if not, write to the Free Software Foundation, Inc., 51\nFranklin St, Fifth Floor, Boston, MA 02110-1301 USA\n\"\"\"\n",
"from lib.core.agent import agent\n",
"from lib.core.data import conf\n",
"from lib.core.data import kb\n",
"from lib.core.data import logger\n",
"from lib.core.data import queries\n",
"from lib.core.session import setUnion\n",
"from lib.request.connect import Connect as Request\n",
"def __effectiveUnionTest(query, comment):...\n",
"\"\"\"docstring\"\"\"\n",
"resultDict = {}\n",
"for count in range(0, 50):\n",
"if kb.dbms == 'Oracle' and query.endswith(' FROM DUAL'):\n",
"return None\n",
"query = query[:-len(' FROM DUAL')]\n",
"if count:\n",
"query += ', NULL'\n",
"if kb.dbms == 'Oracle':\n",
"query += ' FROM DUAL'\n",
"commentedQuery = agent.postfixQuery(query, comment)\n",
"payload = agent.payload(newValue=commentedQuery)\n",
"newResult = Request.queryPage(payload)\n",
"if not newResult in resultDict.keys():\n",
"resultDict[newResult] = 1, commentedQuery\n",
"resultDict[newResult] = resultDict[newResult][0] + 1, commentedQuery\n",
"if count:\n",
"for element in resultDict.values():\n",
"if element[0] == 1:\n",
"if kb.injPlace == 'GET':\n",
"value = '%s?%s' % (conf.url, payload)\n",
"if kb.injPlace == 'POST':\n",
"return value\n",
"value = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'Cookie':\n",
"value += \"\\nPOST:\\t'%s'\\n\" % payload\n",
"value = \"URL:\\t'%s'\" % conf.url\n",
"if kb.injPlace == 'User-Agent':\n",
"value += \"\\nCookie:\\t'%s'\\n\" % payload\n",
"value = \"URL:\\t\\t'%s'\" % conf.url\n",
"value += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % payload\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
2,
2,
0,
2,
0,
0,
0,
0,
2,
0,
0,
2,
0,
2
] | [
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"AugAssign'"
] |
[
"def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n",
"GenericRequest.__init__(self, VAR_1, VAR_4)\n",
"self.url = self.base_url\n",
"self.username = VAR_2\n",
"self.loggedin = VAR_3\n"
] | [
"def __init__(self, browser, username, loggedin, base_url=None):...\n",
"GenericRequest.__init__(self, browser, base_url)\n",
"self.url = self.base_url\n",
"self.username = username\n",
"self.loggedin = loggedin\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_26(self, VAR_74):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.benchmark = VAR_74\n",
"return VAR_101\n"
] | [
"def benchmark(self, benchmark):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.benchmark = benchmark\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_21(VAR_18, VAR_29, VAR_30=60):...\n",
"VAR_50 = re.compile(\n 'Compiling\\\\.\\\\.\\\\.|Evaluating\\\\.\\\\.\\\\.|Scoring\\\\.\\\\.\\\\.|Evaluated')\n",
"VAR_51 = re.compile('Compilation failed|Evaluated \\\\(|Scored \\\\(')\n",
"VAR_34 = FUNC_0()\n",
"VAR_52 = 0.1\n",
"while VAR_30 > 0:\n",
"VAR_30 -= VAR_52\n",
"VAR_49 = AWSSubmissionViewRequest(VAR_34, VAR_29, base_url=AWS_BASE_URL)\n",
"VAR_49.execute()\n",
"VAR_63 = VAR_49.get_submission_info()\n",
"VAR_64 = VAR_63['status']\n",
"if VAR_51.search(VAR_64):\n",
"return VAR_63\n",
"if VAR_50.search(VAR_64):\n",
"time.sleep(VAR_52)\n"
] | [
"def get_evaluation_result(contest_id, submission_id, timeout=60):...\n",
"WAITING_STATUSES = re.compile(\n 'Compiling\\\\.\\\\.\\\\.|Evaluating\\\\.\\\\.\\\\.|Scoring\\\\.\\\\.\\\\.|Evaluated')\n",
"COMPLETED_STATUS = re.compile('Compilation failed|Evaluated \\\\(|Scored \\\\(')\n",
"browser = get_aws_browser()\n",
"sleep_interval = 0.1\n",
"while timeout > 0:\n",
"timeout -= sleep_interval\n",
"sr = AWSSubmissionViewRequest(browser, submission_id, base_url=AWS_BASE_URL)\n",
"sr.execute()\n",
"result = sr.get_submission_info()\n",
"status = result['status']\n",
"if COMPLETED_STATUS.search(status):\n",
"return result\n",
"if WAITING_STATUSES.search(status):\n",
"time.sleep(sleep_interval)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_0.type in ['FU', 'CO', 'CP']:\n",
"return False\n",
"if VAR_0.all_matched() and not VAR_0.all_extracted():\n",
"return CLASS_1(dg_type=dg.type)\n",
"return False\n"
] | [
"def include_extract_form(dg):...\n",
"\"\"\"docstring\"\"\"\n",
"if not dg.type in ['FU', 'CO', 'CP']:\n",
"return False\n",
"if dg.all_matched() and not dg.all_extracted():\n",
"return ExtractionScriptForm(dg_type=dg.type)\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(self, VAR_4):...\n",
"VAR_11 = 'result/' + self.cate_str + '_attack' + str(self.count) + '.sh'\n",
"f.write(VAR_4)\n"
] | [
"def saveScript(self, script):...\n",
"script_name = 'result/' + self.cate_str + '_attack' + str(self.count) + '.sh'\n",
"f.write(script)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'KOFI', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='COFFI', VAR_10=[{'name': '----COFFI'}, {'name':\n 'KOFI'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'KOFI', id='1')\n",
"verify_results(client, jwt, query='COFFI', expected=[{'name': '----COFFI'},\n {'name': 'KOFI'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n",
"CLASS_3.__init__(self, VAR_18, errors.NO_USER, *VAR_15, **kw)\n"
] | [
"def __init__(self, item, *a, **kw):...\n",
"VRequired.__init__(self, item, errors.NO_USER, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_9(VAR_4, VAR_9, VAR_10):...\n",
"return redirect('/index.html?email=' + VAR_9 + '&hash=' + VAR_10)\n"
] | [
"def confirm(request, email, hashed):...\n",
"return redirect('/index.html?email=' + email + '&hash=' + hashed)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n",
"CLASS_3.__init__(self, VAR_18, errors.BAD_USERNAME, *VAR_15, **kw)\n"
] | [
"def __init__(self, item, *a, **kw):...\n",
"VRequired.__init__(self, item, errors.BAD_USERNAME, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2, VAR_6, VAR_7, VAR_4, VAR_3):...\n",
"if VAR_7:\n",
"VAR_7 = VAR_7 == 'TRUE'\n",
"VAR_7 = None\n",
"setattr(VAR_2, VAR_6, VAR_7)\n"
] | [
"def parse_input(self, report, name, value, request, attribute):...\n",
"if value:\n",
"value = value == 'TRUE'\n",
"value = None\n",
"setattr(report, name, value)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_31(VAR_62):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_84 = 0\n",
"while VAR_62[VAR_84].isdigit():\n",
"VAR_84 += 1\n",
"if VAR_84 > 0:\n",
"return int(VAR_62[:VAR_84])\n",
"return 0\n"
] | [
"def _get_value_kw(kw):...\n",
"\"\"\"docstring\"\"\"\n",
"i = 0\n",
"while kw[i].isdigit():\n",
"i += 1\n",
"if i > 0:\n",
"return int(kw[:i])\n",
"return 0\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n",
"VAR_7 = []\n",
"VAR_8 = self.pool.get('ir.model.data')\n",
"VAR_9 = self.pool.get('account.bank.statement')\n",
"VAR_10 = self.pool.get('account.journal')\n",
"VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n",
"VAR_11 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_11)))\n",
"VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"for journal in VAR_10.browse(VAR_2, VAR_3, VAR_12):\n",
"VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n",
"VAR_13 = self.pool.get('ir.model.data')\n",
"if not VAR_4:\n",
"VAR_14 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n",
"VAR_7.append(VAR_4[0])\n",
"VAR_15 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n",
"if not journal.check_dtls:\n",
"if VAR_14:\n",
"VAR_9.button_confirm_cash(VAR_2, VAR_3, VAR_4, VAR_5)\n",
"VAR_14 = VAR_13.browse(VAR_2, VAR_3, VAR_14, VAR_5=context).res_id\n",
"if VAR_15:\n",
"VAR_15 = VAR_13.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n",
"return {'domain': \"[('id','in',\" + str(VAR_7) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(VAR_14, 'tree'), (\n VAR_15, 'form')], 'type': 'ir.actions.act_window'}\n"
] | [
"def close_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\n",
"statement_obj = self.pool.get('account.bank.statement')\n",
"journal_obj = self.pool.get('account.journal')\n",
"cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n",
"j_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n",
"journal_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"for journal in journal_obj.browse(cr, uid, journal_ids):\n",
"ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n",
"data_obj = self.pool.get('ir.model.data')\n",
"if not ids:\n",
"id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n",
"list_statement.append(ids[0])\n",
"id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n",
"if not journal.check_dtls:\n",
"if id2:\n",
"statement_obj.button_confirm_cash(cr, uid, ids, context)\n",
"id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n",
"if id3:\n",
"id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n",
"return {'domain': \"[('id','in',\" + str(list_statement) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(id2, 'tree'), (id3,\n 'form')], 'type': 'ir.actions.act_window'}\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self, *VAR_5, **VAR_4):...\n",
"if self.run_local:\n",
"return utils.execute(*VAR_5, **kwargs)\n",
"VAR_7 = VAR_4.pop('check_exit_code', None)\n",
"VAR_6 = ' '.join(VAR_5)\n",
"return self._run_ssh(VAR_6, VAR_7)\n"
] | [
"def san_execute(self, *cmd, **kwargs):...\n",
"if self.run_local:\n",
"return utils.execute(*cmd, **kwargs)\n",
"check_exit_code = kwargs.pop('check_exit_code', None)\n",
"command = ' '.join(cmd)\n",
"return self._run_ssh(command, check_exit_code)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_36(self, VAR_20):...\n",
"return ''.join(FUNC_8(VAR_20)) == '*'\n"
] | [
"def is_dummy_password(self, pwd):...\n",
"return ''.join(set(pwd)) == '*'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
"def __str__(self):...\n",
"return self.get_name()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_60(self):...\n",
"self._test_strtype('blob', bytearray(VAR_13), VAR_23(VAR_13))\n"
] | [
"def t(self):...\n",
"self._test_strtype('blob', bytearray(value), len(value))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_12(self, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"\"\"\"string\"\"\"\n",
"def __init__(self, VAR_14, VAR_12):...\n",
"self._splitpath = fs.split_path(VAR_14.path)\n",
"self._targetparam = set(VAR_14.parameters.keys())\n",
"self._lensplitpath = len(self._splitpath)\n",
"self._store = {}\n",
"self._ds = VAR_12\n",
"def FUNC_13(self, VAR_16):...\n",
"return True\n"
] | [
"def get_frontier_contexts(self, targetpath):...\n",
"\"\"\"docstring\"\"\"\n",
"\"\"\"\n \n implementation details:\n set of parameters:\n calculate extra parameters\n calculate missing parameters\n if there are missing parameters, then cull the search\n if there is one extra parameter, then add it to the hits\n if there is zero extra parameters, then continue\n if there is more than one extra parameters, then cull the search\n \n \"\"\"\n",
"def __init__(self, targetctx, client):...\n",
"self._splitpath = fs.split_path(targetctx.path)\n",
"self._targetparam = set(targetctx.parameters.keys())\n",
"self._lensplitpath = len(self._splitpath)\n",
"self._store = {}\n",
"self._ds = client\n",
"def does_intersect_rule(self, rulectx):...\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_24(self, VAR_7, VAR_17):...\n",
"self.common.extend_volume(VAR_7, VAR_17)\n"
] | [
"def extend_volume(self, volume, new_size):...\n",
"self.common.extend_volume(volume, new_size)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_15(self):...\n",
"self._omnicomp.OnFileReadyToParse(None)\n",
"if not self._IsServerAlive():\n",
"self._NotifyUserIfServerCrashed()\n",
"VAR_5 = {}\n",
"self._AddTagsFilesIfNeeded(VAR_5)\n",
"self._AddSyntaxDataIfNeeded(VAR_5)\n",
"self._AddExtraConfDataIfNeeded(VAR_5)\n",
"self._latest_file_parse_request = EventNotification('FileReadyToParse', VAR_5)\n",
"self._latest_file_parse_request.Start()\n"
] | [
"def OnFileReadyToParse(self):...\n",
"self._omnicomp.OnFileReadyToParse(None)\n",
"if not self._IsServerAlive():\n",
"self._NotifyUserIfServerCrashed()\n",
"extra_data = {}\n",
"self._AddTagsFilesIfNeeded(extra_data)\n",
"self._AddSyntaxDataIfNeeded(extra_data)\n",
"self._AddExtraConfDataIfNeeded(extra_data)\n",
"self._latest_file_parse_request = EventNotification('FileReadyToParse',\n extra_data)\n",
"self._latest_file_parse_request.Start()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_4):...\n",
""
] | [
"def _on_headers(self, data):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@handled_slot(bool)...\n",
"VAR_17, VAR_18 = QInputDialog.getDouble(self.window, title='Set Wavelength',\n label='Wavelength (nm): ', value=self.matisse.target_wavelength)\n",
"if VAR_18:\n",
"print(f'Setting wavelength to {VAR_17} nm...')\n",
"self.matisse.set_wavelength(VAR_17)\n"
] | [
"@handled_slot(bool)...\n",
"target_wavelength, success = QInputDialog.getDouble(self.window, title=\n 'Set Wavelength', label='Wavelength (nm): ', value=self.matisse.\n target_wavelength)\n",
"if success:\n",
"print(f'Setting wavelength to {target_wavelength} nm...')\n",
"self.matisse.set_wavelength(target_wavelength)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_4, VAR_1, VAR_2):...\n",
"for action_group in VAR_2._action_groups:\n",
"for VAR_3 in action_group._group_actions:\n",
"if VAR_3.dest == VAR_4:\n",
"return VAR_3\n"
] | [
"def find_action(self, keyword, parsed, parser):...\n",
"for action_group in parser._action_groups:\n",
"for action in action_group._group_actions:\n",
"if action.dest == keyword:\n",
"return action\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"For",
"Condition",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, *VAR_5, **VAR_6):...\n",
"VAR_1 = self.current_user\n",
"VAR_19 = VAR_1.name\n",
"VAR_9 = VAR_1.email\n",
"logging.info('Request: ' + VAR_19 + ' ' + VAR_9)\n",
"self.finish(json.dumps({'user': VAR_19, 'email': VAR_9}))\n"
] | [
"def get(self, dataset, *args, **kwargs):...\n",
"user = self.current_user\n",
"name = user.name\n",
"email = user.email\n",
"logging.info('Request: ' + name + ' ' + email)\n",
"self.finish(json.dumps({'user': name, 'email': email}))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.