lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_48():...\n",
"VAR_84 = False\n",
"VAR_16 = request.form.to_dict()\n",
"VAR_21 = None\n",
"VAR_16['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', VAR_16[\n 'config_calibre_dir'], flags=re.IGNORECASE)\n",
"VAR_84, VAR_85 = FUNC_47()\n",
"ub.session.rollback()\n",
"VAR_107 ... | [
"def _db_configuration_update_helper():...\n",
"db_change = False\n",
"to_save = request.form.to_dict()\n",
"gdrive_error = None\n",
"to_save['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', to_save\n ['config_calibre_dir'], flags=re.IGNORECASE)\n",
"db_change, db_valid = _db_simulate_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"import asyncio\n",
"import logging\n",
"import os\n",
"import pickle\n",
"import tarfile\n",
"import tempfile\n",
"import warnings\n",
"import zipfile\n",
"import re\n",
"from asyncio import AbstractEventLoop\n",
"from io import BytesIO as IOReader\n",
"from pathlib import Path\n",
"from ty... | [
"import asyncio\n",
"import logging\n",
"import os\n",
"import pickle\n",
"import tarfile\n",
"import tempfile\n",
"import warnings\n",
"import zipfile\n",
"import re\n",
"from asyncio import AbstractEventLoop\n",
"from io import BytesIO as IOReader\n",
"from pathlib import Path\n",
"from ty... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Condition",
"ImportFrom'",
"FunctionDef'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"As... |
[
"@FUNC_0...\n",
"return EventClientSerializer(self)\n"
] | [
"@cache_in_self...\n",
"return EventClientSerializer(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"self.register_user('user_admin', 'pass', admin=True)\n",
"VAR_8 = self.login('user_admin', 'pass')\n",
"VAR_27 = self.register_user('user_nonadmin', 'pass', admin=False)\n",
"VAR_22 = self.login('user_nonadmin', 'pass')\n",
"VAR_29 = self.helper.upload_media(self.upload_resourc... | [
"def test_quarantine_all_media_by_user(self):...\n",
"self.register_user('user_admin', 'pass', admin=True)\n",
"admin_user_tok = self.login('user_admin', 'pass')\n",
"non_admin_user = self.register_user('user_nonadmin', 'pass', admin=False)\n",
"non_admin_user_tok = self.login('user_nonadmin', 'pass')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_43 = FUNC_14(VAR_20)\n",
"for VAR_71, example_list in VAR_43.items():\n",
"if not isinstance(example_list, list):\n",
"return VAR_43\n",
"VAR_43[VAR_71] = [FUNC_16(VAR_45) for VAR_45 in example_list]\n"
] | [
"def preprocess_input_examples_arg_string(input_examples_str):...\n",
"\"\"\"docstring\"\"\"\n",
"input_dict = preprocess_input_exprs_arg_string(input_examples_str)\n",
"for input_key, example_list in input_dict.items():\n",
"if not isinstance(example_list, list):\n",
"return input_dict\n",
"input_dict[... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_31(VAR_37, VAR_38):...\n",
"if VAR_37[1].get('_key', None) == 'plugin_corewizard_acl':\n",
"return f'0:{to_unicode(VAR_37[0])}'\n",
"if VAR_37[1].get('mandatory', False):\n",
"return f'1:{to_unicode(VAR_37[0])}'\n",
"return f'2:{to_unicode(VAR_37[0])}'\n"
] | [
"def wizard_key_extractor(d, k):...\n",
"if d[1].get('_key', None) == 'plugin_corewizard_acl':\n",
"return f'0:{to_unicode(d[0])}'\n",
"if d[1].get('mandatory', False):\n",
"return f'1:{to_unicode(d[0])}'\n",
"return f'2:{to_unicode(d[0])}'\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_29(self, VAR_76=None):...\n",
"super(CLASS_3, self).parse_command_line(VAR_76)\n",
"if self.extra_args:\n",
"VAR_101 = self.extra_args[0]\n",
"VAR_102 = os.path.abspath(VAR_101)\n",
"self.argv.remove(VAR_101)\n",
"if not os.path.exists(VAR_102):\n",
"self.log.critical('No such file or direct... | [
"def parse_command_line(self, argv=None):...\n",
"super(NotebookApp, self).parse_command_line(argv)\n",
"if self.extra_args:\n",
"arg0 = self.extra_args[0]\n",
"f = os.path.abspath(arg0)\n",
"self.argv.remove(arg0)\n",
"if not os.path.exists(f):\n",
"self.log.critical('No such file or directory: %s', ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def __init__(self, *VAR_0, **VAR_1):...\n",
"VAR_1.setdefault('label_suffix', '')\n",
"self.user = VAR_1.pop('user', None)\n",
"self.page = VAR_1.pop('page', None)\n",
"super().__init__(*VAR_0, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"kwargs.setdefault('label_suffix', '')\n",
"self.user = kwargs.pop('user', None)\n",
"self.page = kwargs.pop('page', None)\n",
"super().__init__(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)\n"
] | [
"def testDateTimeField(self):...\n",
"self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_16(self):...\n",
"VAR_27 = np.array([[1], [2]])\n",
"VAR_32 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_32, VAR_54=x0)\n",
"VAR_21 = 'x=' + VAR_32 + '[a];y=' + VAR_32\n",
"VAR_31 = saved_model_cli.load_inputs_from_input_arg_string(VAR_21, '', '')\n",
"self.assertTrue(np.... | [
"def testInputParserNPZ(self):...\n",
"x0 = np.array([[1], [2]])\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0)\n",
"input_str = 'x=' + input_path + '[a];y=' + input_path\n",
"feed_dict = saved_model_cli.load_inputs_from_input_arg_string(input_str, '', ''\... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertTrue(VAR_5.evaluate('x | not:exists:x'))\n"
] | [
"def test_hybrid_with_compound_expression_int_value(self):...\n",
"ec = self._makeContext()\n",
"self.assertTrue(ec.evaluate('x | not:exists:x'))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@VAR_2.route('/admin')...\n",
"abort(403)\n"
] | [
"@admi.route('/admin')...\n",
"abort(403)\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_39(VAR_33, VAR_34, VAR_101=None):...\n",
"if callable(VAR_64):\n",
"if VAR_34 and not isinstance(VAR_34, str):\n",
"VAR_143 = VAR_64()\n",
"VAR_0.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (VAR_8))\n",
"from werkzeug.http import http_date\n",
"... | [
"def compute_etag(files, lastmodified, additional=None):...\n",
"if callable(custom_etag):\n",
"if lastmodified and not isinstance(lastmodified, str):\n",
"etag = custom_etag()\n",
"_logger.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (key))\n",
"from werkze... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"ImportFrom'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Import'",
"Return'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_7(**VAR_12: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if g.ledger.fava_options.use_external_editor:\n",
"return f\"beancount://{VAR_12.get('file_path')}\" + f\"?lineno={VAR_12.get('line', 1)}\"\n",
"return FUNC_6('report', VAR_19='editor', **kwargs)\n"
] | [
"def url_for_source(**kwargs: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if g.ledger.fava_options.use_external_editor:\n",
"return f\"beancount://{kwargs.get('file_path')}\" + f\"?lineno={kwargs.get('line', 1)}\"\n",
"return url_for('report', report_name='editor', **kwargs)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_8, VAR_9, VAR_4):...\n",
"return 1\n"
] | [
"def checkPermission(self, permission, object, context):...\n",
"return 1\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(VAR_4, VAR_5, VAR_6):...\n",
"VAR_10 = []\n",
"for inp_element in VAR_6:\n",
"VAR_82 = False\n",
"return VAR_10\n",
"for c_elements in VAR_4:\n",
"if VAR_5 == 'languages':\n",
"if not VAR_82:\n",
"VAR_101 = c_elements.lang_code\n",
"if VAR_5 == 'custom':\n",
"VAR_10.append(inp_elemen... | [
"def search_objects_add(db_book_object, db_type, input_elements):...\n",
"add_elements = []\n",
"for inp_element in input_elements:\n",
"found = False\n",
"return add_elements\n",
"for c_elements in db_book_object:\n",
"if db_type == 'languages':\n",
"if not found:\n",
"type_elements = c_elements.la... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"For",
"Condition",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_33(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_44 = np.array([[1], [2]])\n",
"VAR_45 = np.zeros((6, 3))\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'testRunCommandNewOutdir_inputs.npz'\n )\n",
"VAR_41 = os.path.join(te... | [
"def testRunCommandWithDebuggerEnabled(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"x = np.array([[1], [2]])\n",
"x_notused = np.zeros((6, 3))\n",
"input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandNewOutdir_in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_17(VAR_21, VAR_16):...\n",
"VAR_59 = [VAR_21.strip()]\n",
"VAR_59 = [x for x in VAR_59 if x != '']\n",
"return FUNC_7(VAR_59, VAR_16.series, db.Series, calibre_db.session, 'series')\n"
] | [
"def edit_book_series(series, book):...\n",
"input_series = [series.strip()]\n",
"input_series = [x for x in input_series if x != '']\n",
"return modify_database_object(input_series, book.series, db.Series,\n calibre_db.session, 'series')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_25(self, VAR_19, VAR_20, VAR_21) ->int:...\n",
"\"\"\"docstring\"\"\"\n",
"for sub in self._subscribers:\n",
"sub.send(['message', VAR_20, VAR_21])\n",
"return len(self._subscribers)\n"
] | [
"def publish(self, conn, channel, msg) ->int:...\n",
"\"\"\"docstring\"\"\"\n",
"for sub in self._subscribers:\n",
"sub.send(['message', channel, msg])\n",
"return len(self._subscribers)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Expr'",
"Return'"
] |
[
"@login_required...\n",
"VAR_6 = None\n",
"if VAR_2:\n",
"VAR_16 = get_object_or_404(VAR_0, VAR_5=user_id)\n",
"VAR_7 = VAR_1.user\n",
"VAR_6 = {'users': [VAR_16.st.nickname]}\n",
"VAR_8 = TopicForPrivateForm(VAR_7=user, data=post_data(request))\n",
"VAR_9 = CommentForm(VAR_7=user, data=post_data(requ... | [
"@login_required...\n",
"initial = None\n",
"if user_id:\n",
"user_to = get_object_or_404(User, pk=user_id)\n",
"user = request.user\n",
"initial = {'users': [user_to.st.nickname]}\n",
"tform = TopicForPrivateForm(user=user, data=post_data(request))\n",
"cform = CommentForm(user=user, data=post_data(r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"import configparser\n",
"from flask import Flask, render_template, session, request, flash, redirect, url_for, Response, abort, jsonify, send_file\n",
"import socket\n",
"import os\n",
"import random\n",
"import copy\n",
"from flask_sqlalchemy import SQLAlchemy, Model\n",
"import gspread\n",
"from ... | [
"import configparser\n",
"from flask import Flask, render_template, session, request, flash, redirect, url_for, Response, abort, jsonify, send_file\n",
"import socket\n",
"import os\n",
"import random\n",
"import copy\n",
"from flask_sqlalchemy import SQLAlchemy, Model\n",
"import gspread\n",
"from ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"As... |
[
"def __init__(self):...\n",
"self.cookies = {}\n",
"self.redirected = False\n",
"self.status = '200'\n",
"self.headers = {}\n"
] | [
"def __init__(self):...\n",
"self.cookies = {}\n",
"self.redirected = False\n",
"self.status = '200'\n",
"self.headers = {}\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_11(self):...\n",
"VAR_29 = self.helper.create_room_as(self.user_id)\n",
"VAR_22, VAR_23 = self.make_request('GET', '/rooms/%s/members' % VAR_29)\n",
"self.assertEquals(200, VAR_23.code, msg=channel.result['body'])\n"
] | [
"def test_get_member_list(self):...\n",
"room_id = self.helper.create_room_as(self.user_id)\n",
"request, channel = self.make_request('GET', '/rooms/%s/members' % room_id)\n",
"self.assertEquals(200, channel.code, msg=channel.result['body'])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(VAR_0):...\n",
"VAR_8 = VAR_0.MagicMock()\n",
"VAR_10 = VAR_0.patch('openapi_python_client._get_project_for_url_or_path',\n return_value=project)\n",
"VAR_6 = VAR_0.MagicMock()\n",
"VAR_7 = VAR_0.MagicMock()\n",
"from openapi_python_client import update_existing_client\n",
"VAR_11 = updat... | [
"def test_update_existing_client(mocker):...\n",
"project = mocker.MagicMock()\n",
"_get_project_for_url_or_path = mocker.patch(\n 'openapi_python_client._get_project_for_url_or_path', return_value=project)\n",
"url = mocker.MagicMock()\n",
"path = mocker.MagicMock()\n",
"from openapi_python_client imp... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Expr'",
"Assert'"
] |
[
"def FUNC_1(VAR_8, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_8.user.has_perm('translation.add', VAR_9):\n",
"if VAR_8.user.has_perm('translation.add_more', VAR_9):\n",
"return CLASS_26\n",
"return CLASS_27\n"
] | [
"def get_new_language_form(request, component):...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.user.has_perm('translation.add', component):\n",
"if request.user.has_perm('translation.add_more', component):\n",
"return NewLanguageOwnerForm\n",
"return NewLanguageForm\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_173(VAR_445):...\n",
"return A(VAR_445, _href=URL(args='_search', vars=dict(q=t)))\n"
] | [
"def link(t):...\n",
"return A(t, _href=URL(args='_search', vars=dict(q=t)))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self, VAR_5, VAR_10, VAR_11=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = self._s3_create(VAR_5, VAR_10)\n",
"return VAR_9\n"
] | [
"def create(self, context, metadata, data=None):...\n",
"\"\"\"docstring\"\"\"\n",
"image = self._s3_create(context, metadata)\n",
"return image\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"from openapi_python_client.parser.properties import Property\n",
"VAR_4 = Property(VAR_5='test', VAR_26=True, default=None)\n",
"VAR_4._type_string = 'TestType'\n",
"assert VAR_4.get_type_string() == 'TestType'\n",
"VAR_4.required = False\n",
"assert VAR_4.get_type_string() ==... | [
"def test_get_type_string(self):...\n",
"from openapi_python_client.parser.properties import Property\n",
"p = Property(name='test', required=True, default=None)\n",
"p._type_string = 'TestType'\n",
"assert p.get_type_string() == 'TestType'\n",
"p.required = False\n",
"assert p.get_type_string() == 'Opt... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"def FUNC_77():...\n",
"return '/rooms/%s/send/m.room.message/mid%s' % (self.created_rmid, str(next\n (VAR_25)))\n"
] | [
"def send_msg_path():...\n",
"return '/rooms/%s/send/m.room.message/mid%s' % (self.created_rmid, str(next\n (seq)))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self, VAR_44):...\n",
"\"\"\"docstring\"\"\"\n",
"self.tokens.append({'type': 'heading', 'level': 1 if VAR_44.group(2) == '='\n else 2, 'text': VAR_44.group(1)})\n"
] | [
"def parse_lheading(self, m):...\n",
"\"\"\"docstring\"\"\"\n",
"self.tokens.append({'type': 'heading', 'level': 1 if m.group(2) == '=' else\n 2, 'text': m.group(1)})\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"assert join('/', 'foo', None, 'bar', '', 'baz') == '/foo/bar/baz'\n"
] | [
"def test_it_works_with_partially_valid_input(self):...\n",
"assert join('/', 'foo', None, 'bar', '', 'baz') == '/foo/bar/baz'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_184 = VAR_2.GET.get('format', None)\n",
"if VAR_184 is not None:\n",
"VAR_191 = VAR_350('download_as')\n",
"VAR_191 = VAR_350('archived_files')\n",
"VAR_303 = 'Export_as_%s' % VAR_184\n",
"VAR_303 = 'OriginalFileDownload'\n",
"VAR_185 = VAR_2... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"format = request.GET.get('format', None)\n",
"if format is not None:\n",
"download_url = reverse('download_as')\n",
"download_url = reverse('archived_files')\n",
"zipName = 'Export_as_%s' % format\n",
"zipName = 'OriginalFileDownload'\n",
"target... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition"... |
[
"def __init__(self, *VAR_6, **VAR_7):...\n",
"VAR_7['auto_id'] = 'id_zipcreate_%s'\n",
"super().__init__(*VAR_6, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"kwargs['auto_id'] = 'id_zipcreate_%s'\n",
"super().__init__(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(VAR_1):...\n",
"VAR_12 = VAR_1.bind\n",
"FUNC_6(VAR_12, VAR_1)\n",
"FUNC_7(VAR_12, VAR_1)\n",
"FUNC_10(VAR_12, VAR_1)\n",
"FUNC_11(VAR_12, VAR_1)\n",
"FUNC_9(VAR_12, VAR_1)\n",
"VAR_89 = False\n",
"conn.execute('ALTER TABLE user ADD column `sidebar_view` Integer DEFAULT 1')\n",
"if VA... | [
"def migrate_Database(session):...\n",
"engine = session.bind\n",
"add_missing_tables(engine, session)\n",
"migrate_registration_table(engine, session)\n",
"migrate_readBook(engine, session)\n",
"migrate_remoteAuthToken(engine, session)\n",
"migrate_shelfs(engine, session)\n",
"create = False\n",
"c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"def FUNC_65(self, VAR_13, VAR_74):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_64 = (\n '<sup class=\"footnote-ref\" id=\"fnref-%s\"><a href=\"#fn-%s\">%d</a></sup>' %\n (VAR_19(VAR_13), VAR_19(VAR_13), VAR_74))\n",
"return VAR_64\n"
] | [
"def footnote_ref(self, key, index):...\n",
"\"\"\"docstring\"\"\"\n",
"html = (\n '<sup class=\"footnote-ref\" id=\"fnref-%s\"><a href=\"#fn-%s\">%d</a></sup>' %\n (escape(key), escape(key), index))\n",
"return html\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_4(VAR_18, VAR_19=0):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_18, MultiValueDict):\n",
"VAR_18 = VAR_18.lists()\n",
"if hasattr(VAR_18, 'items'):\n",
"return urllib_parse.urlencode([(force_str(k), [force_str(VAR_23) for VAR_23 in\n v] if isinstance(v, (list, tuple)) else force_str... | [
"def urlencode(query, doseq=0):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(query, MultiValueDict):\n",
"query = query.lists()\n",
"if hasattr(query, 'items'):\n",
"return urllib_parse.urlencode([(force_str(k), [force_str(i) for i in v] if\n isinstance(v, (list, tuple)) else force_str(v)) for k, v... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'"
] |
[
"from __future__ import absolute_import\n",
"import cgi\n",
"import email.utils\n",
"import json\n",
"import logging\n",
"import mimetypes\n",
"import os\n",
"import platform\n",
"import re\n",
"import shutil\n",
"import sys\n",
"from pip._vendor import requests, urllib3\n",
"from pip._vendo... | [
"from __future__ import absolute_import\n",
"import cgi\n",
"import email.utils\n",
"import json\n",
"import logging\n",
"import mimetypes\n",
"import os\n",
"import platform\n",
"import re\n",
"import shutil\n",
"import sys\n",
"from pip._vendor import requests, urllib3\n",
"from pip._vendo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
... |
[
"def FUNC_18(VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_22.all:\n",
"FUNC_8(VAR_22.dir)\n",
"if VAR_22.tag_set is None:\n",
"FUNC_0(VAR_22.dir)\n",
"if VAR_22.signature_def is None:\n",
"FUNC_1(VAR_22.dir, VAR_22.tag_set)\n",
"FUNC_4(VAR_22.dir, VAR_22.tag_set, VAR_22.signature_def)\n"
] | [
"def show(args):...\n",
"\"\"\"docstring\"\"\"\n",
"if args.all:\n",
"_show_all(args.dir)\n",
"if args.tag_set is None:\n",
"_show_tag_sets(args.dir)\n",
"if args.signature_def is None:\n",
"_show_signature_def_map_keys(args.dir, args.tag_set)\n",
"_show_inputs_outputs(args.dir, args.tag_set, args.s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"async def FUNC_7(self, VAR_3: str, VAR_4: str) ->Tuple[Optional[Responder],...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = await self.store.get_cached_remote_media(VAR_3, VAR_4)\n",
"if VAR_28:\n",
"VAR_18 = VAR_28['filesystem_id']\n",
"VAR_28 = await self._download_remote_file(VAR_3, VAR_4)\n",
"VAR_28 =... | [
"async def _get_remote_media_impl(self, server_name: str, media_id: str...\n",
"\"\"\"docstring\"\"\"\n",
"media_info = await self.store.get_cached_remote_media(server_name, media_id)\n",
"if media_info:\n",
"file_id = media_info['filesystem_id']\n",
"media_info = await self._download_remote_file(server_n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_58(VAR_21: str, VAR_22: str, **VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_76 = f\"http://localhost:{VAR_0.config['INTERNAL_PORT']}\"\n",
"if VAR_22 not in ['get', 'post', 'put', 'delete']:\n",
"VAR_77 = getattr(requests, VAR_22)(VAR_76 + VAR_21, **kwargs)\n",
"if VAR_77.status_code != 200:\... | [
"def query_internal_api(route: str, method: str, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"INTERNAL_URL = f\"http://localhost:{gui.config['INTERNAL_PORT']}\"\n",
"if method not in ['get', 'post', 'put', 'delete']:\n",
"res = getattr(requests, method)(INTERNAL_URL + route, **kwargs)\n",
"if res.status_... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'"
] |
[
"def __repr__(self):...\n",
"return '<Download %r' % self.book_id\n"
] | [
"def __repr__(self):...\n",
"return '<Download %r' % self.book_id\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_13(VAR_30):...\n",
"VAR_33 = VAR_30.group(1)\n",
"if VAR_33.startswith('0x'):\n",
"VAR_36 = int(VAR_33, 16)\n",
"if VAR_33.startswith('0') and '.' not in VAR_33:\n",
"VAR_13 = complex(VAR_36)\n",
"VAR_36 = float(VAR_33)\n",
"VAR_36 = int(VAR_33, 8)\n",
"VAR_36 = int(VAR_33)\n",
"if VAR_1... | [
"def handleMatch(m):...\n",
"s = m.group(1)\n",
"if s.startswith('0x'):\n",
"i = int(s, 16)\n",
"if s.startswith('0') and '.' not in s:\n",
"x = complex(i)\n",
"i = float(s)\n",
"i = int(s, 8)\n",
"i = int(s)\n",
"if x.imag == 0:\n",
"x = x.real\n",
"return str(x)\n",
"return '%.16f' % x\n"
... | [
0,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_9(self, VAR_13: str) ->bool:...\n",
"return VAR_13.split(':', 1)[1] == self.hostname\n"
] | [
"def is_mine_id(self, string: str) ->bool:...\n",
"return string.split(':', 1)[1] == self.hostname\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self, VAR_9, VAR_10, **VAR_4):...\n",
"self.layout.move_row_to_index(VAR_9, VAR_10)\n",
"self.save_layout()\n"
] | [
"def dispatch_move_row_to_index(self, from_y, to_y, **kwargs):...\n",
"self.layout.move_row_to_index(from_y, to_y)\n",
"self.save_layout()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('x | python:1+1'), 2)\n"
] | [
"def test_hybrid_with_python_expression_int_value(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('x | python:1+1'), 2)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@VAR_2.route('/read/<int:book_id>/<book_format>')...\n",
"VAR_95 = calibre_db.get_filtered_book(VAR_5)\n",
"if not VAR_95:\n",
"flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n",
"VAR_99 = None\n",
"VAR_3.debug(\n u'Oops! S... | [
"@web.route('/read/<int:book_id>/<book_format>')...\n",
"book = calibre_db.get_filtered_book(book_id)\n",
"if not book:\n",
"flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n",
"bookmark = None\n",
"log.debug(\n u'Oops! Selec... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"For",
"Return'",
"Condition",
"For",
"Assign'",
"... |
[
"def FUNC_56(VAR_99):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_99.replace(' ', '_').replace('-', '_').lower()\n"
] | [
"def scrub(txt):...\n",
"\"\"\"docstring\"\"\"\n",
"return txt.replace(' ', '_').replace('-', '_').lower()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_19 = get_student_from_identifier(VAR_9.GET.get('unique_student_identifier')\n )\n",
"VAR_126 = reverse('student_progress', VAR_3={'course_id': course_id.\n to_deprecated_str... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"user = get_student_from_identifier(request.GET.get('unique_student_identifier')\n )\n",
"progress_url = reverse('student_progress', kwargs={'course_id': course_id.\n to_de... | [
0,
0,
0,
3,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"self.acl.exempt(VAR_4.__name__)\n",
"return VAR_4\n"
] | [
"def exempt(self, view_func):...\n",
"\"\"\"docstring\"\"\"\n",
"self.acl.exempt(view_func.__name__)\n",
"return view_func\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, VAR_3, VAR_4):...\n",
"self.reactor.advance(1000)\n"
] | [
"def prepare(self, reactor, clock, hs):...\n",
"self.reactor.advance(1000)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_0(VAR_1) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = VAR_1.server_name\n",
"VAR_42, VAR_43, VAR_44 = await VAR_1.key_ready\n",
"VAR_3 = VAR_1.json_object\n",
"verify_signed_json(VAR_3, VAR_2, VAR_44)\n",
"VAR_0.debug('Error verifying signature for %s:%s:%s with key %s: %s', VAR_2,... | [
"async def _handle_key_deferred(verify_request) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"server_name = verify_request.server_name\n",
"_, key_id, verify_key = await verify_request.key_ready\n",
"json_object = verify_request.json_object\n",
"verify_signed_json(json_object, server_name, verify_key)\n",
... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_32(VAR_87):...\n",
"VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n"
] | [
"def hash_update(value):...\n",
"hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_29(VAR_0, VAR_1):...\n",
"VAR_17 = VAR_0.config['THEME_CONF']['use_theme_dark']\n",
"VAR_8 = VAR_1.post('/config', data={'submit': True,\n 'THEME_CONF-use_theme_dark': not dark_theme})\n",
"assert VAR_0.config['THEME_CONF']['use_theme_dark'] == (not VAR_17)\n"
] | [
"def test_post_updated_config(test_app, client):...\n",
"dark_theme = test_app.config['THEME_CONF']['use_theme_dark']\n",
"resp = client.post('/config', data={'submit': True,\n 'THEME_CONF-use_theme_dark': not dark_theme})\n",
"assert test_app.config['THEME_CONF']['use_theme_dark'] == (not dark_theme)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_15(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.get_success(self.state_handler.get_current_state(self.room_id,\n EventTypes.CanonicalAlias, ''))\n"
] | [
"def _get_canonical_alias(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.get_success(self.state_handler.get_current_state(self.room_id,\n EventTypes.CanonicalAlias, ''))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_2(self, VAR_3, VAR_4, VAR_5, VAR_6=None, VAR_7={}):...\n",
"VAR_12 = {'membership': VAR_5}\n",
"VAR_12.update(VAR_7)\n",
"VAR_13 = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Member, 'sender': VAR_4.to_string(), 'state_key':\n VAR_4.to_string(), 'room_id... | [
"def inject_room_member(self, room, user, membership, replaces_state=None,...\n",
"content = {'membership': membership}\n",
"content.update(extra_content)\n",
"builder = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Member, 'sender': user.to_string(), 'state_key':\n ... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"\"\"\"\nA few checks to make sure the environment is sane\n\"\"\"\n",
"from __future__ import absolute_import\n",
"import os\n",
"import re\n",
"import sys\n",
"import stat\n",
"import errno\n",
"import socket\n",
"import logging\n",
"import win32file\n",
"import resource\n",
"from salt.log i... | [
"\"\"\"\nA few checks to make sure the environment is sane\n\"\"\"\n",
"from __future__ import absolute_import\n",
"import os\n",
"import re\n",
"import sys\n",
"import stat\n",
"import errno\n",
"import socket\n",
"import logging\n",
"import win32file\n",
"import resource\n",
"from salt.log i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Assign'",
"FunctionDef'",
"Docstring",
"Import'",
"Return'",
"Assign'",
"Assign'"... |
[
"def FUNC_116(VAR_129):...\n",
"def FUNC_121(*VAR_79, **VAR_42):...\n",
"if VAR_13.read_from_replica:\n",
"FUNC_6()\n",
"VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n",
"if VAR_1 and hasattr(VAR_1, 'primary_db'):\n",
"return VAR_225\n",
"VAR_1.db.close()\n",
"VAR_1.db = VAR_1.primary_db\n"... | [
"def innfn(fn):...\n",
"def wrapper_fn(*args, **kwargs):...\n",
"if conf.read_from_replica:\n",
"connect_replica()\n",
"retval = fn(*args, **get_newargs(fn, kwargs))\n",
"if local and hasattr(local, 'primary_db'):\n",
"return retval\n",
"local.db.close()\n",
"local.db = local.primary_db\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_16(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_45 = example_pb2.Example()\n",
"for feature_name, feature_list in VAR_21.items():\n",
"if not isinstance(feature_list, list):\n",
"return VAR_45.SerializeToString()\n",
"if isinstance(feature_list[0], float):\n",
"VAR_45.features.feature[fea... | [
"def _create_example_string(example_dict):...\n",
"\"\"\"docstring\"\"\"\n",
"example = example_pb2.Example()\n",
"for feature_name, feature_list in example_dict.items():\n",
"if not isinstance(feature_list, list):\n",
"return example.SerializeToString()\n",
"if isinstance(feature_list[0], float):\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"@login_required()...\n",
""
] | [
"@login_required()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_82(VAR_62, *VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.db_query\n",
"return frappe.model.db_query.DatabaseQuery(VAR_62).execute(None, *VAR_79,\n **kwargs)\n"
] | [
"def get_list(doctype, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.db_query\n",
"return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **\n kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"def FUNC_37():...\n",
"if callable(VAR_63):\n",
"VAR_33 = FUNC_21()\n",
"VAR_33 = VAR_63()\n",
"VAR_0.exception('Error while trying to retrieve tracked files for plugin {}'\n .format(VAR_8))\n",
"VAR_33 += FUNC_22()\n",
"if VAR_33:\n",
"VAR_33 += FUNC_23(g.locale.language if g.locale else 'en', 'm... | [
"def collect_files():...\n",
"if callable(custom_files):\n",
"files = _get_all_templates()\n",
"files = custom_files()\n",
"_logger.exception('Error while trying to retrieve tracked files for plugin {}'\n .format(key))\n",
"files += _get_all_assets()\n",
"if files:\n",
"files += _get_all_translatio... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"AugAssign'",
"Condition",
"AugAssign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"AugAssign'"
] |
[
"def FUNC_10(self):...\n",
"VAR_5 = self.get_credits('html')\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertHTMLEqual(VAR_5.content.decode(), 'string')\n"
] | [
"def test_credits_view_html(self):...\n",
"response = self.get_credits('html')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertHTMLEqual(response.content.decode(),\n \"\"\"<table>\n<tr>\n<th>Czech</th>\n<td><ul><li><a href=\"mailto:weblate@example.org\">Weblate Test</a> (1)</li></ul></td>\... | [
0,
0,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def __init__(self):...\n",
"self.auth_token = hexlify(os.urandom(4)).decode('utf-8')\n",
"self.expiration = datetime.datetime.now() + datetime.timedelta(minutes=10)\n"
] | [
"def __init__(self):...\n",
"self.auth_token = hexlify(os.urandom(4)).decode('utf-8')\n",
"self.expiration = datetime.datetime.now() + datetime.timedelta(minutes=10)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"@app.route('/dataobj/<int:dataobj_id>')...\n",
"VAR_12 = data.get_item(VAR_1)\n",
"VAR_13 = lambda x: (x['title'], x['id'])\n",
"VAR_14 = list(map(VAR_13, data.get_items(structured=False, load_content=False))\n )\n",
"if not VAR_12:\n",
"flash('Data could not be found!', 'error')\n",
"if request.arg... | [
"@app.route('/dataobj/<int:dataobj_id>')...\n",
"dataobj = data.get_item(dataobj_id)\n",
"get_title_id_pairs = lambda x: (x['title'], x['id'])\n",
"titles = list(map(get_title_id_pairs, data.get_items(structured=False,\n load_content=False)))\n",
"if not dataobj:\n",
"flash('Data could not be found!', ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"R... |
[
"def __init__(self, VAR_24, VAR_25):...\n",
"self.hs = VAR_24\n",
"self.signing_key = VAR_24.signing_key\n",
"self.server_name = VAR_24.hostname\n",
"VAR_48 = VAR_24.get_reactor()\n",
"VAR_49 = IPBlacklistingResolver(VAR_48, None, VAR_24.config.\n federation_ip_range_blacklist)\n",
"def __getattr__(V... | [
"def __init__(self, hs, tls_client_options_factory):...\n",
"self.hs = hs\n",
"self.signing_key = hs.signing_key\n",
"self.server_name = hs.hostname\n",
"real_reactor = hs.get_reactor()\n",
"nameResolver = IPBlacklistingResolver(real_reactor, None, hs.config.\n federation_ip_range_blacklist)\n",
"def... | [
0,
0,
0,
0,
4,
4,
0,
4,
4,
4
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_4(VAR_12, VAR_7):...\n",
"if VAR_12:\n",
"VAR_12 = VAR_12.replace('[id]', str(VAR_7.vars.id))\n",
"return URL(VAR_12)\n",
"if VAR_12[0] == '/' or VAR_12[:4] == 'http':\n",
"return VAR_12\n"
] | [
"def replace_id(url, form):...\n",
"if url:\n",
"url = url.replace('[id]', str(form.vars.id))\n",
"return URL(url)\n",
"if url[0] == '/' or url[:4] == 'http':\n",
"return url\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_37(self, VAR_1=None, VAR_2=None):...\n",
"if VAR_1 is None:\n",
"VAR_1 = self._makeEngine()\n",
"if VAR_2 is None:\n",
"VAR_2 = {}\n",
"return self._getTargetClass()(VAR_1, VAR_2)\n"
] | [
"def _makeOne(self, engine=None, contexts=None):...\n",
"if engine is None:\n",
"engine = self._makeEngine()\n",
"if contexts is None:\n",
"contexts = {}\n",
"return self._getTargetClass()(engine, contexts)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/full-print',...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_95 = FUNC_58(f'/internal/jobs/{VAR_9}/subjobs/{VAR_11}/full-print', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_95)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/full-print',...\n",
"\"\"\"docstring\"\"\"\n",
"full_print_info = query_internal_api(\n f'/internal/jobs/{job_id}/subjobs/{subjob_id}/full-print', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(full_... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_14(VAR_14):...\n",
"VAR_32 = calibre_db.session.query(db.Custom_Columns).filter(db.\n Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n",
"VAR_16 = calibre_db.get_filtered_book(VAR_14, allow_show_archived=True)\n",
"if not VAR_16:\n",
"flash(_(\n u'Oops! Selected book title is unavai... | [
"def render_edit_book(book_id):...\n",
"cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.\n datatype.notin_(db.cc_exceptions)).all()\n",
"book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n",
"if not book:\n",
"flash(_(\n u'Oops! Selected book title is una... | [
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Expr'",
"For",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"For",
"For",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"E... |
[
"def __init__(self, VAR_4, VAR_17: Unit, *VAR_6, **VAR_7):...\n",
"if VAR_17 is not None:\n",
"VAR_7['initial'] = {'checksum': VAR_17.checksum, 'contentsum':\n hash_to_checksum(VAR_17.content_hash), 'translationsum':\n hash_to_checksum(VAR_17.get_target_hash()), 'target': VAR_17, 'fuzzy':\n VAR_17.fuzz... | [
"def __init__(self, user, unit: Unit, *args, **kwargs):...\n",
"if unit is not None:\n",
"kwargs['initial'] = {'checksum': unit.checksum, 'contentsum':\n hash_to_checksum(unit.content_hash), 'translationsum': hash_to_checksum\n (unit.get_target_hash()), 'target': unit, 'fuzzy': unit.fuzzy, 'review':\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
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
... |
[
"@CLASS_4('gpl')...\n",
"\"\"\"docstring\"\"\"\n",
"return 'text/html', utils.read_file('html/license.html')\n"
] | [
"@add_handler('gpl')...\n",
"\"\"\"docstring\"\"\"\n",
"return 'text/html', utils.read_file('html/license.html')\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_20(VAR_0, VAR_1: FlaskClient):...\n",
"VAR_8 = VAR_1.post('/folders/delete', data={'dir_name': 'testing'})\n",
"assert VAR_8.status_code == 404\n"
] | [
"def test_deleting_nonexisting_folder_fails(test_app, client: FlaskClient):...\n",
"resp = client.post('/folders/delete', data={'dir_name': 'testing'})\n",
"assert resp.status_code == 404\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_154 = FUNC_42(VAR_2, VAR_5)\n",
"VAR_114 = FUNC_43(VAR_2)\n",
"VAR_155 = sum([len(VAR_114[types]) for types in VAR_114])\n",
"VAR_104 = None\n",
"VAR_163 = VAR_5.getEventContext().userId\n",
"VAR_164 = []\n",
"for obs in VAR_154.values():\n",... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"oids = getObjects(request, conn)\n",
"selected = getIds(request)\n",
"obj_count = sum([len(selected[types]) for types in selected])\n",
"manager = None\n",
"self_id = conn.getEventContext().userId\n",
"tags = []\n",
"for obs in oids.values():\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"For",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"... |
[
"def FUNC_45(self):...\n",
"return json.dumps(audiotranscode.getDecoders())\n"
] | [
"def api_getdecoders(self):...\n",
"return json.dumps(audiotranscode.getDecoders())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_7.route('/base/<baseidx>/mixers/<mixeridx>/keywords/<params>')...\n",
"VAR_17 = FUNC_4(VAR_10, VAR_14)\n",
"VAR_21 = int((VAR_11 - 1) * (1.0 / VAR_12) * len(VAR_17))\n",
"VAR_22 = int(VAR_11 * (1.0 / VAR_12) * len(VAR_17))\n",
"VAR_17 = VAR_17[VAR_21:VAR_22]\n",
"VAR_8.info('Mixer Size {}'.format(le... | [
"@scope_blueprint.route('/base/<baseidx>/mixers/<mixeridx>/keywords/<params>')...\n",
"mixer_list = get_mixer_list(mixeridx, classes)\n",
"start_idx = int((index - 1) * (1.0 / total) * len(mixer_list))\n",
"end_idx = int(index * (1.0 / total) * len(mixer_list))\n",
"mixer_list = mixer_list[start_idx:end_idx... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_19(VAR_7):...\n",
"if VAR_7 is None:\n",
"return\n",
"return self.get_image_id(VAR_5, VAR_7)\n",
"return self._create_image_id(VAR_5, VAR_7)\n"
] | [
"def _find_or_create(image_uuid):...\n",
"if image_uuid is None:\n",
"return\n",
"return self.get_image_id(context, image_uuid)\n",
"return self._create_image_id(context, image_uuid)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def test___post_init__(self, VAR_1):...\n",
"VAR_5 = VAR_1.MagicMock()\n",
"VAR_6 = VAR_1.patch('openapi_python_client.utils.snake_case')\n",
"VAR_17 = VAR_1.MagicMock(class_name='MyTestEnum')\n",
"VAR_18 = VAR_1.MagicMock(class_name='Deduped')\n",
"VAR_19 = VAR_1.patch(f'{VAR_0}.Reference.from_ref', sid... | [
"def test___post_init__(self, mocker):...\n",
"name = mocker.MagicMock()\n",
"snake_case = mocker.patch('openapi_python_client.utils.snake_case')\n",
"fake_reference = mocker.MagicMock(class_name='MyTestEnum')\n",
"deduped_reference = mocker.MagicMock(class_name='Deduped')\n",
"from_ref = mocker.patch(f'{... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Expr'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
... |
[
"def FUNC_9(self, VAR_3, VAR_4):...\n",
"VAR_4['choices'] = map(lambda x: (x.strip(), x.strip()), VAR_3.choices.\n split(','))\n",
"return django.forms.ChoiceField(widget=django.forms.RadioSelect, **options)\n"
] | [
"def create_radio_field(self, field, options):...\n",
"options['choices'] = map(lambda x: (x.strip(), x.strip()), field.choices.\n split(','))\n",
"return django.forms.ChoiceField(widget=django.forms.RadioSelect, **options)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"from synapse.handlers.saml_handler import SamlHandler\n",
"return SamlHandler(self)\n"
] | [
"@cache_in_self...\n",
"from synapse.handlers.saml_handler import SamlHandler\n",
"return SamlHandler(self)\n"
] | [
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_9(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return saved_model_utils.get_meta_graph_def(VAR_2, VAR_3)\n"
] | [
"def get_meta_graph_def(saved_model_dir, tag_set):...\n",
"\"\"\"docstring\"\"\"\n",
"return saved_model_utils.get_meta_graph_def(saved_model_dir, tag_set)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_10(VAR_18: Text) ->VAR_1:...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_18 or not os.path.exists(VAR_18):\n",
"return {}\n",
"VAR_59 = os.path.join(VAR_18, VAR_2)\n",
"if os.path.isfile(VAR_59):\n",
"return rasa.shared.utils.io.read_json_file(VAR_59)\n",
"return {}\n"
] | [
"def fingerprint_from_path(model_path: Text) ->Fingerprint:...\n",
"\"\"\"docstring\"\"\"\n",
"if not model_path or not os.path.exists(model_path):\n",
"return {}\n",
"fingerprint_path = os.path.join(model_path, FINGERPRINT_FILE_PATH)\n",
"if os.path.isfile(fingerprint_path):\n",
"return rasa.shared.uti... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_78(VAR_133, VAR_134, VAR_135):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils\n",
"return frappe.utils.compare(VAR_133, VAR_134, VAR_135)\n"
] | [
"def compare(val1, condition, val2):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils\n",
"return frappe.utils.compare(val1, condition, val2)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"def FUNC_32(VAR_87):...\n",
"VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n"
] | [
"def hash_update(value):...\n",
"hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_38(VAR_47):...\n",
"return VAR_47\n"
] | [
"def fake_wrapper_session(sess):...\n",
"return sess\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_75 = VAR_9.GET.get('csv', 'false')\n",
"VAR_68 = ['course_id', 'mode', 'total_issued_certificate', 'report_run_date']\n",
"VAR_76 = [('course_id', _('CourseID')), ('mode', _('Certificate Ty... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"csv_required = request.GET.get('csv', 'false')\n",
"query_features = ['course_id', 'mode', 'total_issued_certificate',\n 'report_run_date']\n",
"query_features_names = [('course_id', ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_3(VAR_13):...\n",
"if isinstance(VAR_13, complex) or VAR_13 < 0:\n",
"return cmath.sqrt(VAR_13)\n",
"return math.sqrt(VAR_13)\n"
] | [
"def _sqrt(x):...\n",
"if isinstance(x, complex) or x < 0:\n",
"return cmath.sqrt(x)\n",
"return math.sqrt(x)\n"
] | [
0,
5,
5,
5
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(VAR_12: Text) ->Type['Validator']:...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_14(VAR_21: Text) ->bool:...\n",
"return VAR_21 is not None and VAR_21.strip() != ''\n"
] | [
"def not_empty_validator(error_message: Text) ->Type['Validator']:...\n",
"\"\"\"docstring\"\"\"\n",
"def is_valid(input: Text) ->bool:...\n",
"return input is not None and input.strip() != ''\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self):...\n",
"VAR_3 = self.client.post('/password_reset/custom_redirect/named/', {'email':\n 'staffmember@example.com'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/password_reset/')\n"
] | [
"def test_reset_custom_redirect_named(self):...\n",
"response = self.client.post('/password_reset/custom_redirect/named/', {\n 'email': 'staffmember@example.com'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/password_reset/')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17():...\n",
"VAR_180 = []\n",
"for msg_out in VAR_1.message_log:\n",
"VAR_180.append(json.loads(msg_out))\n",
"return VAR_180\n"
] | [
"def get_message_log():...\n",
"log = []\n",
"for msg_out in local.message_log:\n",
"log.append(json.loads(msg_out))\n",
"return log\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_36(self, *VAR_9, **VAR_13):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def _HTTP(self, *a, **b):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_18():...\n",
"if len(VAR_1.message_log) > 0:\n",
"VAR_1.message_log = VAR_1.message_log[:-1]\n"
] | [
"def clear_last_message():...\n",
"if len(local.message_log) > 0:\n",
"local.message_log = local.message_log[:-1]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'"
] |
[
"def FUNC_2(self, VAR_5, *VAR_6, **VAR_4):...\n",
"if not could_edit(VAR_5):\n",
"self._populate_vars()\n",
"if self.default_layout:\n",
"self.view_config.save_default_placeholder_layout(self.placeholder_name,\n self.default_layout)\n",
"return super(CLASS_0, self).dispatch(VAR_5, *VAR_6, **kwargs)\n",... | [
"def dispatch(self, request, *args, **kwargs):...\n",
"if not could_edit(request):\n",
"self._populate_vars()\n",
"if self.default_layout:\n",
"self.view_config.save_default_placeholder_layout(self.placeholder_name,\n self.default_layout)\n",
"return super(EditorView, self).dispatch(request, *args, **k... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@FUNC_4...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"certs_api.generate_example_certificates(VAR_38)\n",
"return redirect(FUNC_65(VAR_38, VAR_39='certificates'))\n"
] | [
"@require_global_staff...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"certs_api.generate_example_certificates(course_key)\n",
"return redirect(_instructor_dash_url(course_key, section='certificates'))\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"VAR_32 = '/rooms/%s/state/m.room.member/%s' % (self.room_id, self.user_id)\n",
"VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '{}')\n",
"self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n",
"VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '{\"_name\":\"bo\"}'... | [
"def test_invalid_puts(self):...\n",
"path = '/rooms/%s/state/m.room.member/%s' % (self.room_id, self.user_id)\n",
"request, channel = self.make_request('PUT', path, '{}')\n",
"self.assertEquals(400, channel.code, msg=channel.result['body'])\n",
"request, channel = self.make_request('PUT', path, '{\"_name\"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"Model with callable polymorphic functions specified.\"\"\"\n",
"@def_function.function...\n",
"if VAR_55:\n",
"return VAR_53 + VAR_54\n",
"return VAR_53 * VAR_54\n"
] | [
"def testShowAllWithFunctions(self):...\n",
"\"\"\"Model with callable polymorphic functions specified.\"\"\"\n",
"@def_function.function...\n",
"if c:\n",
"return a + b\n",
"return a * b\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_2):...\n",
"VAR_4 = VAR_2.META.get('HTTP_X_FORWARDED_FOR')\n",
"if VAR_4:\n",
"VAR_25 = VAR_4.split(',')[-1].strip()\n",
"VAR_25 = VAR_2.META.get('REMOTE_ADDR')\n",
"return VAR_25\n"
] | [
"def get_client_ip(request):...\n",
"x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')\n",
"if x_forwarded_for:\n",
"ip = x_forwarded_for.split(',')[-1].strip()\n",
"ip = request.META.get('REMOTE_ADDR')\n",
"return ip\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self, VAR_3, VAR_4):...\n",
"VAR_4['choices'] = [(x.strip(), x.strip()) for x in VAR_3.choices.split(',')]\n",
"VAR_4['initial'] = [x.strip() for x in VAR_3.default_value.split(',')]\n",
"return django.forms.MultipleChoiceField(widget=django.forms.\n CheckboxSelectMultiple, **options)\n"
] | [
"def create_checkboxes_field(self, field, options):...\n",
"options['choices'] = [(x.strip(), x.strip()) for x in field.choices.split(',')]\n",
"options['initial'] = [x.strip() for x in field.default_value.split(',')]\n",
"return django.forms.MultipleChoiceField(widget=django.forms.\n CheckboxSelectMultipl... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"async def FUNC_7(self, VAR_14, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = defaultdict(dict)\n",
"for VAR_1 in VAR_15:\n",
"assert not VAR_1.key_ready.called\n",
"VAR_26 = await VAR_14.get_keys(VAR_28)\n",
"VAR_47 = VAR_28[VAR_1.server_name]\n",
"VAR_29 = []\n",
"for VAR_43 in VAR_1.key_id... | [
"async def _attempt_key_fetches_with_fetcher(self, fetcher, remaining_requests):...\n",
"\"\"\"docstring\"\"\"\n",
"missing_keys = defaultdict(dict)\n",
"for verify_request in remaining_requests:\n",
"assert not verify_request.key_ready.called\n",
"results = await fetcher.get_keys(missing_keys)\n",
"key... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"For",
"Assert'",
"Assign'",
"Assign'",
"Assign'",
"For",
"For",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_46(self, VAR_137=2, VAR_138=False):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_101, VAR_153 = self.db, self.table_cas()\n",
"VAR_263.response.headers['Content-Type'] = 'text'\n",
"VAR_264 = VAR_56.vars.ticket\n",
"VAR_265 = 'renew' in VAR_56.vars\n",
"VAR_266 = VAR_153(VAR_264=ticket)\n",
"VA... | [
"def cas_validate(self, version=2, proxy=False):...\n",
"request = current.request\n",
"db, table = self.db, self.table_cas()\n",
"current.response.headers['Content-Type'] = 'text'\n",
"ticket = request.vars.ticket\n",
"renew = 'renew' in request.vars\n",
"row = table(ticket=ticket)\n",
"success = Fal... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_9(self):...\n",
"return '{user}-{repo}'.format(user='Rick', repo='Morty')\n"
] | [
"def get_build_slug(self):...\n",
"return '{user}-{repo}'.format(user='Rick', repo='Morty')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.