lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_41():...\n",
"\"\"\"docstring\"\"\"\n",
"if request.vars and not request.vars.token == session.token:\n",
"redirect(URL('logout'))\n",
"VAR_5 = None\n",
"if VAR_5:\n",
"redirect(request.vars.sender)\n",
"VAR_3 = FUNC_5(VAR_10=request.vars.location.split('/')[0])\n",
"VAR_68 = dict(VAR_5=fi... | [
"def upload_file():...\n",
"\"\"\"docstring\"\"\"\n",
"if request.vars and not request.vars.token == session.token:\n",
"redirect(URL('logout'))\n",
"filename = None\n",
"if filename:\n",
"redirect(request.vars.sender)\n",
"app = get_app(name=request.vars.location.split('/')[0])\n",
"d = dict(filena... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"Aug... |
[
"def FUNC_32(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.run(VAR_10)\n"
] | [
"def testRunCommandInputNotGivenError(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"args = self.parser.parse_args(['run', '--dir', base_path, '--tag_set',\n 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.r... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_39(self, VAR_44):...\n",
"return self.renderer.linebreak()\n"
] | [
"def output_linebreak(self, m):...\n",
"return self.renderer.linebreak()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@property...\n",
"return [Line(i, line) for i, line in enumerate(self.rawLines, 1)]\n"
] | [
"@property...\n",
"return [Line(i, line) for i, line in enumerate(self.rawLines, 1)]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_2.route('/ajax/listbooks')...\n",
"VAR_79 = int(request.args.get('offset') or 0)\n",
"VAR_19 = int(request.args.get('limit') or config.config_books_per_page)\n",
"VAR_80 = request.args.get('search')\n",
"VAR_7 = request.args.get('sort', 'id')\n",
"VAR_10 = request.args.get('order', '').lower()\n",
... | [
"@web.route('/ajax/listbooks')...\n",
"off = int(request.args.get('offset') or 0)\n",
"limit = int(request.args.get('limit') or config.config_books_per_page)\n",
"search = request.args.get('search')\n",
"sort = request.args.get('sort', 'id')\n",
"order = request.args.get('order', '').lower()\n",
"state ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
... |
[
"def FUNC_84(VAR_1):...\n",
"def FUNC_83(*VAR_2, **VAR_3):...\n",
"VAR_9 = VAR_2[0]\n",
"VAR_193 = {'error': 'Missing required query parameter(s)', 'parameters': [],\n 'info': {}}\n",
"for VAR_209, extra in VAR_47:\n",
"VAR_199 = object()\n",
"if len(VAR_193['parameters']) > 0:\n",
"if VAR_9.POST.g... | [
"def decorator(func):...\n",
"def wrapped(*args, **kwargs):...\n",
"request = args[0]\n",
"error_response_data = {'error': 'Missing required query parameter(s)',\n 'parameters': [], 'info': {}}\n",
"for param, extra in required_params:\n",
"default = object()\n",
"if len(error_response_data['paramete... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_32(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import DefaultUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provideUtility\n",
"p... | [
"def testDefaultResolver(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import DefaultUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provideUtil... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"Model with a callable concrete function.\"\"\"\n",
"def __init__(self):...\n",
"VAR_56 = def_function.function(self.multiply, input_signature=[tensor_spec.\n TensorSpec(shape=(), dtype=dtypes.float32), tensor_spec.TensorSpec(\n shape=(), dtype=dtypes.float32)])\n",
"se... | [
"def testShowAllWithPureConcreteFunction(self):...\n",
"\"\"\"Model with a callable concrete function.\"\"\"\n",
"def __init__(self):...\n",
"function = def_function.function(self.multiply, input_signature=[\n tensor_spec.TensorSpec(shape=(), dtype=dtypes.float32), tensor_spec.\n TensorSpec(shape=(), dt... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_31(self):...\n",
"VAR_27 = widgets.FilteredSelectMultiple('test', True)\n",
"self.assertHTMLEqual(conditional_escape(VAR_27.render('test', 'test')), \n 'string' % VAR_0())\n"
] | [
"def test_stacked_render(self):...\n",
"w = widgets.FilteredSelectMultiple('test', True)\n",
"self.assertHTMLEqual(conditional_escape(w.render('test', 'test')), \n \"\"\"<select multiple=\"multiple\" name=\"test\" class=\"selectfilterstacked\">\n</select><script type=\"text/javascript\">addEvent(window, \"lo... | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/%s/summary', VAR_30)\n",
"return self.client.get_json(VAR_5=destination, VAR_2=path, VAR_3={\n 'requester_user_id': requester_user_id}, VAR_15=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/groups/%s/summary', group_id)\n",
"return self.client.get_json(destination=destination, path=path, args={\n 'requester_user_id': requester_user_id}, ignore_backoff=True)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"if os.path.exists(self.cookie_secret_file):\n",
"return VAR_102.read()\n",
"VAR_46 = base64.encodestring(os.urandom(1024))\n",
"self._write_cookie_secret_file(VAR_46)\n",
"return VAR_46\n"
] | [
"def _cookie_secret_default(self):...\n",
"if os.path.exists(self.cookie_secret_file):\n",
"return f.read()\n",
"secret = base64.encodestring(os.urandom(1024))\n",
"self._write_cookie_secret_file(secret)\n",
"return secret\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_2: str) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_30 = 'Bearer %s' % VAR_2\n",
"VAR_30.encode('ascii')\n",
"return [VAR_30]\n"
] | [
"def create_id_access_token_header(id_access_token: str) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"bearer_token = 'Bearer %s' % id_access_token\n",
"bearer_token.encode('ascii')\n",
"return [bearer_token]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"@log_function...\n",
"VAR_2 = FUNC_2('/send_leave/%s/%s', VAR_6, VAR_7)\n",
"VAR_37 = await self.client.put_json(VAR_5=destination, VAR_2=path, VAR_39=\n content, VAR_15=True)\n",
"return VAR_37\n"
] | [
"@log_function...\n",
"path = _create_v2_path('/send_leave/%s/%s', room_id, event_id)\n",
"response = await self.client.put_json(destination=destination, path=path,\n data=content, ignore_backoff=True)\n",
"return response\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self, VAR_0, VAR_1):...\n",
"self.headers[VAR_0] = VAR_1\n"
] | [
"def setHeader(self, name, value):...\n",
"self.headers[name] = value\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_0():...\n",
"VAR_1['ebook converter'] = _(converter.get_calibre_version())\n",
"VAR_1['unrar'] = _(converter.get_unrar_version())\n",
"VAR_1['kepubify'] = _(converter.get_kepubify_version())\n",
"return VAR_1\n"
] | [
"def collect_stats():...\n",
"_VERSIONS['ebook converter'] = _(converter.get_calibre_version())\n",
"_VERSIONS['unrar'] = _(converter.get_unrar_version())\n",
"_VERSIONS['kepubify'] = _(converter.get_kepubify_version())\n",
"return _VERSIONS\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_10 = self.parser.parse_args(['show', '--dir', VAR_9])\n",
"saved_model_cli.show(VAR_10)\n",
"VAR_11 = out.getvalue().strip()\n",
"VAR_12 = \"\"\"The given SavedModel contains the ... | [
"def testShowCommandTags(self):...\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"self.parser = saved_model_cli.create_parser()\n",
"args = self.parser.parse_args(['show', '--dir', base_path])\n",
"saved_model_cli.show(args)\n",
"output = out.getvalue().strip()\n",
"exp_out = \"\"\"The g... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(VAR_7, VAR_10, VAR_11):...\n",
"VAR_18 = get_object_or_404(VAR_0, VAR_10=pk)\n",
"VAR_19 = UserActivationTokenGenerator()\n",
"if VAR_19.is_valid(VAR_18, VAR_11):\n",
"VAR_18.st.is_verified = True\n",
"return redirect(reverse(settings.LOGIN_URL))\n",
"VAR_18.is_active = True\n",
"VAR_18.sa... | [
"def registration_activation(request, pk, token):...\n",
"user = get_object_or_404(User, pk=pk)\n",
"activation = UserActivationTokenGenerator()\n",
"if activation.is_valid(user, token):\n",
"user.st.is_verified = True\n",
"return redirect(reverse(settings.LOGIN_URL))\n",
"user.is_active = True\n",
"u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17():...\n",
"VAR_3 = FUNC_5()\n",
"VAR_46 = FORM.confirm(T('Uninstall'), {T('Cancel'): URL('site')})\n",
"VAR_46['_id'] = 'confirm_form'\n",
"VAR_46['_class'] = 'well'\n",
"for VAR_126 in VAR_46.components:\n",
"VAR_126['_class'] = 'btn'\n",
"if VAR_46.accepted:\n",
"if MULTI_USER_MODE:\n... | [
"def uninstall():...\n",
"app = get_app()\n",
"dialog = FORM.confirm(T('Uninstall'), {T('Cancel'): URL('site')})\n",
"dialog['_id'] = 'confirm_form'\n",
"dialog['_class'] = 'well'\n",
"for component in dialog.components:\n",
"component['_class'] = 'btn'\n",
"if dialog.accepted:\n",
"if MULTI_USER_MO... | [
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'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = VAR_4 or dict(six.iteritems(self.request.POST))\n",
"VAR_6 = self.get_command_handler(VAR_3)\n",
"if not self.ajax:\n",
"VAR_5 = self.postprocess_response(VAR_3, VAR_4, VAR_5)\n",
"if not VAR_6 or not callable(VAR_6):\n",
... | [
"def handle(self, command, kwargs=None):...\n",
"\"\"\"docstring\"\"\"\n",
"kwargs = kwargs or dict(six.iteritems(self.request.POST))\n",
"handler = self.get_command_handler(command)\n",
"if not self.ajax:\n",
"response = self.postprocess_response(command, kwargs, response)\n",
"if not handler or not ca... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Return'",
"Assign'",
"Assign'"
] |
[
"@unittest.override_config({'rc_joins': {'local': {'per_second': 0.5,...\n",
"\"\"\"docstring\"\"\"\n",
"for i in range(3):\n",
"self.helper.create_room_as(self.user_id)\n",
"self.helper.create_room_as(self.user_id, VAR_9=429)\n"
] | [
"@unittest.override_config({'rc_joins': {'local': {'per_second': 0.5,...\n",
"\"\"\"docstring\"\"\"\n",
"for i in range(3):\n",
"self.helper.create_room_as(self.user_id)\n",
"self.helper.create_room_as(self.user_id, expect_code=429)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"For",
"Expr'",
"Expr'"
] |
[
"@self.appbuilder.sm.oid.loginhandler...\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"VAR_10 = LoginForm_oid()\n",
"if VAR_10.validate_on_submit():\n",
"VAR_53['remember_me'] = VAR_10.remember_me.data\n",
"return self.render_templat... | [
"@self.appbuilder.sm.oid.loginhandler...\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"form = LoginForm_oid()\n",
"if form.validate_on_submit():\n",
"session['remember_me'] = form.remember_me.data\n",
"return self.render_template(sel... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_5(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"\"\"\" Features: This dialog can... \"\"\"\n",
"\"\"\" - list attachments in a drop down list \"\"\"\n",
"\"\"\" - list attachments also for a different page than the current one \"\"\"\n",
"\"\"\" - create new attachment \"\"\"\n",
"VAR_16 = VAR_0.... | [
"def attachment_dialog(request):...\n",
"\"\"\"docstring\"\"\"\n",
"\"\"\" Features: This dialog can... \"\"\"\n",
"\"\"\" - list attachments in a drop down list \"\"\"\n",
"\"\"\" - list attachments also for a different page than the current one \"\"\"\n",
"\"\"\" - create new attachment \"\"\"\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
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr... |
[
"def FUNC_2(VAR_4, VAR_5):...\n",
"if VAR_4.is_public:\n",
"return True\n",
"VAR_9 = VAR_5['email']\n",
"VAR_10 = VAR_9.split('@')[-1]\n",
"if VAR_10 in VAR_4.google_apps_domains:\n",
"return True\n",
"if VAR_4.has_user(VAR_9) == 1:\n",
"return True\n",
"return False\n"
] | [
"def verify_profile(org, profile):...\n",
"if org.is_public:\n",
"return True\n",
"email = profile['email']\n",
"domain = email.split('@')[-1]\n",
"if domain in org.google_apps_domains:\n",
"return True\n",
"if org.has_user(email) == 1:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"import email.mime.multipart\n",
"import email.utils\n",
"import logging\n",
"import urllib.parse\n",
"from email.mime.multipart import MIMEMultipart\n",
"from email.mime.text import MIMEText\n",
"from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, TypeVar\n",
"import bleach\n",
"... | [
"import email.mime.multipart\n",
"import email.utils\n",
"import logging\n",
"import urllib.parse\n",
"from email.mime.multipart import MIMEMultipart\n",
"from email.mime.text import MIMEText\n",
"from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, TypeVar\n",
"import bleach\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,
0,
0,
0... | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"ImportFrom'",
"A... |
[
"@VAR_2.route('/get_tags_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Tags, request.args.get('q'), tag_filter=\n tags_filters())\n"
] | [
"@web.route('/get_tags_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Tags, request.args.get('q'), tag_filter=\n tags_filters())\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@classmethod...\n",
"if VAR_4 is None:\n",
"os.stat(VAR_4)\n",
"return VAR_15.abspath(VAR_4)\n"
] | [
"@classmethod...\n",
"if file_path is None:\n",
"os.stat(file_path)\n",
"return cls.abspath(file_path)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_9(VAR_25):...\n",
"return VAR_25[:-1] if VAR_25.endswith('_') else VAR_25\n"
] | [
"def norm(k):...\n",
"return k[:-1] if k.endswith('_') else k\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"from django.core.exceptions import ValidationError\n",
"from shuup.utils.django_compat import force_text\n",
"\"\"\" User-visible exception. \"\"\"\n",
"VAR_1 = property(lambda self: self.args[0] if self.args else None)\n",
"def __init__(self, VAR_1, VAR_2=None):...\n",
"super(CLASS_0, self).__init__(VAR... | [
"from django.core.exceptions import ValidationError\n",
"from shuup.utils.django_compat import force_text\n",
"\"\"\" User-visible exception. \"\"\"\n",
"message = property(lambda self: self.args[0] if self.args else None)\n",
"def __init__(self, message, title=None):...\n",
"super(Problem, self).__init__... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Expr'",
"Return'"
] |
[
"@FUNC_4...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_148 = VAR_9.POST.get('certificates-enabled', 'false') == 'true'\n",
"certs_api.set_cert_generation_enabled(VAR_38, VAR_148)\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",
"is_enabled = request.POST.get('certificates-enabled', 'false') == 'true'\n",
"certs_api.set_cert_generation_enabled(course_key, is_enabled)\n",
"return redirect(_instructor_dash_url(course_key, sec... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_19(self, VAR_6, VAR_8, VAR_10=False):...\n",
"VAR_13, VAR_15 = [], []\n",
"VAR_25 = frappe.desk.query_report.run(self.name, VAR_6=filters, VAR_8=user,\n VAR_10=ignore_prepared_report)\n",
"for d in VAR_25.get('columns'):\n",
"if isinstance(d, dict):\n",
"VAR_15 += VAR_25.get('result')\n",
"... | [
"def run_query_report(self, filters, user, ignore_prepared_report=False):...\n",
"columns, result = [], []\n",
"data = frappe.desk.query_report.run(self.name, filters=filters, user=user,\n ignore_prepared_report=ignore_prepared_report)\n",
"for d in data.get('columns'):\n",
"if isinstance(d, dict):\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def __init__(self, *, VAR_41: str='', VAR_30: Optional[List[str]]=None,...\n",
"super().__init__(VAR_43=routes, VAR_44=redirect_slashes, VAR_45=default,\n VAR_47=on_startup, VAR_48=on_shutdown)\n",
"if VAR_41:\n",
"assert VAR_41.startswith('/'), \"A path prefix must start with '/'\"\n",
"self.prefix = V... | [
"def __init__(self, *, prefix: str='', tags: Optional[List[str]]=None,...\n",
"super().__init__(routes=routes, redirect_slashes=redirect_slashes, default=\n default, on_startup=on_startup, on_shutdown=on_shutdown)\n",
"if prefix:\n",
"assert prefix.startswith('/'), \"A path prefix must start with '/'\"\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Condition",
"Assert'",
"Assign'",
"Assert'",
"AnnAssign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_2(VAR_2, *VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_0(FEDERATION_V2_PREFIX, VAR_2, *VAR_3)\n"
] | [
"def _create_v2_path(path, *args):...\n",
"\"\"\"docstring\"\"\"\n",
"return _create_path(FEDERATION_V2_PREFIX, path, *args)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_74(self, VAR_90=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.requires(True, VAR_90=otherwise)\n"
] | [
"def requires_login(self, otherwise=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.requires(True, otherwise=otherwise)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_22(VAR_0, VAR_1: FlaskClient, VAR_2, VAR_4):...\n",
"VAR_0.config['SEARCH_CONF']['enabled'] = 1\n",
"VAR_0.config['SEARCH_CONF']['engine'] = 'ripgrep'\n",
"VAR_8 = VAR_1.put(f'/api/dataobjs/{VAR_2.id}', json={'content':\n f'[[{bookmark_fixture.title}|{bookmark_fixture.id}]]'})\n",
"assert VAR_8... | [
"def test_backlinks_are_saved(test_app, client: FlaskClient, note_fixture,...\n",
"test_app.config['SEARCH_CONF']['enabled'] = 1\n",
"test_app.config['SEARCH_CONF']['engine'] = 'ripgrep'\n",
"resp = client.put(f'/api/dataobjs/{note_fixture.id}', json={'content':\n f'[[{bookmark_fixture.title}|{bookmark_fix... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'"
] |
[
"@VAR_0.route('/<path:path>', methods=['PUT'])...\n",
""
] | [
"@app.route('/<path:path>', methods=['PUT'])...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_14(VAR_19, VAR_11, VAR_10):...\n",
"VAR_54 = True\n",
"VAR_55 = os.path.join(VAR_11, VAR_10.filename)\n",
"if os.path.exists(VAR_55):\n",
"VAR_86 = ask_path_exists(\n 'The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort' %\n display_path(VAR_55), ('i', 'w', 'b', 'a'))\n",
"if VAR_54:\... | [
"def _copy_file(filename, location, link):...\n",
"copy = True\n",
"download_location = os.path.join(location, link.filename)\n",
"if os.path.exists(download_location):\n",
"response = ask_path_exists(\n 'The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort' %\n display_path(download_location), ('... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_29():...\n",
"logging.set_verbosity(logging.INFO)\n",
"VAR_60 = FUNC_28()\n",
"VAR_20 = VAR_60.parse_args()\n",
"if not hasattr(VAR_20, 'func'):\n",
"VAR_60.error('too few arguments')\n",
"VAR_20.func(VAR_20)\n"
] | [
"def main():...\n",
"logging.set_verbosity(logging.INFO)\n",
"parser = create_parser()\n",
"args = parser.parse_args()\n",
"if not hasattr(args, 'func'):\n",
"parser.error('too few arguments')\n",
"args.func(args)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"async def FUNC_10(self, VAR_22, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = await self.federation_client.send_invite(VAR_10=target_host, VAR_11\n =event.room_id, VAR_12=event.event_id, VAR_6=event)\n",
"return VAR_6\n"
] | [
"async def send_invite(self, target_host, event):...\n",
"\"\"\"docstring\"\"\"\n",
"pdu = await self.federation_client.send_invite(destination=target_host,\n room_id=event.room_id, event_id=event.event_id, pdu=event)\n",
"return pdu\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_15(self, VAR_13, VAR_14):...\n",
"VAR_62 = self.useroptions.forUser(self.getUserId())\n",
"VAR_62.setOption(VAR_13, VAR_14)\n",
"return 'success'\n"
] | [
"def api_setuseroption(self, optionkey, optionval):...\n",
"uo = self.useroptions.forUser(self.getUserId())\n",
"uo.setOption(optionkey, optionval)\n",
"return 'success'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self, VAR_0, VAR_1, VAR_3):...\n",
"self.store = VAR_3.get_datastore()\n",
"self.handler = VAR_3.get_directory_handler()\n",
"self.state_handler = VAR_3.get_state_handler()\n",
"self.admin_user = self.register_user('admin', 'pass', admin=True)\n",
"self.admin_user_tok = self.login('admin', 'pa... | [
"def prepare(self, reactor, clock, hs):...\n",
"self.store = hs.get_datastore()\n",
"self.handler = hs.get_directory_handler()\n",
"self.state_handler = hs.get_state_handler()\n",
"self.admin_user = self.register_user('admin', 'pass', admin=True)\n",
"self.admin_user_tok = self.login('admin', 'pass')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"instructor_task.api.submit_export_ora2_data(VAR_9, VAR_38)\n",
"VAR_196 = _('string')\n",
"VAR_172 = _('The ORA data report is being generated.')\n",
"return JsonResp... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"instructor_task.api.submit_export_ora2_data(request, course_key)\n",
"already_running_status = _(\n \"An ORA data report generation task is already in progress.... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"self.mock_federation.make_query.return_value = make_awaitable({\n 'displayname': 'Alice'})\n",
"VAR_3 = yield defer.ensureDeferred(self.handler.get_displayname(self.alice))\n",
"self.assertEquals(VAR_3, 'Alice')\n",
"self.mock_federation.make_query.assert_called_with(desti... | [
"@defer.inlineCallbacks...\n",
"self.mock_federation.make_query.return_value = make_awaitable({\n 'displayname': 'Alice'})\n",
"displayname = yield defer.ensureDeferred(self.handler.get_displayname(self.\n alice))\n",
"self.assertEquals(displayname, 'Alice')\n",
"self.mock_federation.make_query.assert... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_27(VAR_8, VAR_60, VAR_10=None, VAR_11=None, VAR_7=None):...\n",
"if VAR_10 is None and VAR_11 is None or g.locale is None:\n",
"return VAR_60\n",
"VAR_37 = FUNC_1(VAR_8, VAR_10=data, VAR_11=additional_request_data)\n",
"def FUNC_35():...\n",
"return FUNC_0(VAR_6=request.url_root, VAR_7=additiona... | [
"def get_preemptively_cached_view(key, view, data=None,...\n",
"if data is None and additional_request_data is None or g.locale is None:\n",
"return view\n",
"d = _preemptive_data(key, data=data, additional_request_data=\n additional_request_data)\n",
"def unless():...\n",
"return _preemptive_unless(ba... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"@wraps(VAR_3)...\n",
"if VAR_62.role_admin():\n",
"return VAR_3(*VAR_30, **kwargs)\n",
"abort(403)\n"
] | [
"@wraps(f)...\n",
"if current_user.role_admin():\n",
"return f(*args, **kwargs)\n",
"abort(403)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'"
] |
[
"async def FUNC_13(self, VAR_26):...\n",
"\"\"\"docstring\"\"\"\n",
"for p, VAR_5 in VAR_26:\n",
"VAR_0.info(\n 'Processing queued PDU %s which was received while we were joining %s',\n p.event_id, p.room_id)\n",
"VAR_0.warning('Error handling queued PDU %s from %s: %s', p.event_id, VAR_5,\n VAR_17... | [
"async def _handle_queued_pdus(self, room_queue):...\n",
"\"\"\"docstring\"\"\"\n",
"for p, origin in room_queue:\n",
"logger.info(\n 'Processing queued PDU %s which was received while we were joining %s',\n p.event_id, p.room_id)\n",
"logger.warning('Error handling queued PDU %s from %s: %s', p.event... | [
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0, VAR_1='or'):...\n",
"VAR_0 = list(VAR_0)\n",
"if len(VAR_0) == 1:\n",
"return VAR_0[0]\n",
"if len(VAR_0) == 2:\n",
"return '{0} {2} {1}'.format(VAR_0[0], VAR_0[1], VAR_1)\n",
"return '{0}, {2} {1}'.format(', '.join(VAR_0[:-1]), VAR_0[-1], VAR_1)\n"
] | [
"def englishFromList(items, conjunction='or'):...\n",
"items = list(items)\n",
"if len(items) == 1:\n",
"return items[0]\n",
"if len(items) == 2:\n",
"return '{0} {2} {1}'.format(items[0], items[1], conjunction)\n",
"return '{0}, {2} {1}'.format(', '.join(items[:-1]), items[-1], conjunction)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"@log_function...\n",
"VAR_2 = FUNC_1('/invite/%s/%s', VAR_6, VAR_7)\n",
"VAR_37 = await self.client.put_json(VAR_5=destination, VAR_2=path, VAR_39=\n content, VAR_15=True)\n",
"return VAR_37\n"
] | [
"@log_function...\n",
"path = _create_v1_path('/invite/%s/%s', room_id, event_id)\n",
"response = await self.client.put_json(destination=destination, path=path,\n data=content, ignore_backoff=True)\n",
"return response\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"return {stream.NAME: stream(self) for stream in STREAMS_MAP.values()}\n"
] | [
"@cache_in_self...\n",
"return {stream.NAME: stream(self) for stream in STREAMS_MAP.values()}\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_16(self, VAR_29, VAR_30, VAR_31, VAR_32=False, VAR_33=None, VAR_34...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_3 + '\\n\\n'.join(dedent(VAR_78) for VAR_78 in self.invoke_all(\n 'generate_config_section', VAR_29=config_dir_path, VAR_30=data_dir_path,\n VAR_31=server_name, VAR_32=generate_secret... | [
"def generate_config(self, config_dir_path, data_dir_path, server_name,...\n",
"\"\"\"docstring\"\"\"\n",
"return CONFIG_FILE_HEADER + '\\n\\n'.join(dedent(conf) for conf in self.\n invoke_all('generate_config_section', config_dir_path=config_dir_path,\n data_dir_path=data_dir_path, server_name=server_nam... | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_30(self):...\n",
"return URL(VAR_11=current.request.args, VAR_96=current.request.get_vars)\n"
] | [
"def here(self):...\n",
"return URL(args=current.request.args, vars=current.request.get_vars)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"VAR_24 = b'{\"msgtype\":\"m.text\",\"body\":\"hello\"}'\n",
"VAR_25 = iter(range(100))\n",
"def FUNC_77():...\n",
"return '/rooms/%s/send/m.room.message/mid%s' % (self.created_rmid, str(next\n (VAR_25)))\n"
] | [
"def test_can_do_action(self):...\n",
"msg_content = b'{\"msgtype\":\"m.text\",\"body\":\"hello\"}'\n",
"seq = iter(range(100))\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,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_26(self):...\n",
"VAR_5 = {'org.matrix.labels': ['#fun']}\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='m.room.message', room_id=\n '!secretbase:unknown', content={EventContentFields.LABELS: ['#fun']})\n",
"self.assertTrue(Filter(VAR_5).check(VAR_6))\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='... | [
"def test_filter_labels(self):...\n",
"definition = {'org.matrix.labels': ['#fun']}\n",
"event = MockEvent(sender='@foo:bar', type='m.room.message', room_id=\n '!secretbase:unknown', content={EventContentFields.LABELS: ['#fun']})\n",
"self.assertTrue(Filter(definition).check(event))\n",
"event = MockEven... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = saved_model_utils.get_saved_model_tag_sets(VAR_2)\n",
"for VAR_3 in sorted(VAR_22):\n",
"print(\n \"\"\"\nMetaGraphDef with tag-set: '%s' contains the following SignatureDefs:\"\"\"\n % ', '.join(VAR_3))\n",
"FUNC_5(VAR_2)\n",
"VAR_3... | [
"def _show_all(saved_model_dir):...\n",
"\"\"\"docstring\"\"\"\n",
"tag_sets = saved_model_utils.get_saved_model_tag_sets(saved_model_dir)\n",
"for tag_set in sorted(tag_sets):\n",
"print(\n \"\"\"\nMetaGraphDef with tag-set: '%s' contains the following SignatureDefs:\"\"\"\n % ', '.join(tag_set))\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_5():...\n",
"return FUNC_4('login_view_ticketlist')\n"
] | [
"def login_view_ticketlist_default():...\n",
"return get_default_setting('login_view_ticketlist')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_62(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self._blitzcon.getUser().firstName or self.getName()\n"
] | [
"def getFirstName(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self._blitzcon.getUser().firstName or self.getName()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@property...\n",
"return self.is_active\n"
] | [
"@property...\n",
"return self.is_active\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_165(VAR_215, VAR_224):...\n",
"if not VAR_399:\n",
"return None\n",
"return serializers.json({'jsonrpc': '2.0', 'id': VAR_215, 'result': VAR_224})\n"
] | [
"def return_response(id, result):...\n",
"if not must_respond:\n",
"return None\n",
"return serializers.json({'jsonrpc': '2.0', 'id': id, 'result': result})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_40(self):...\n",
"if self.flags.ignore_links or self._action == 'cancel':\n",
"return\n",
"VAR_63, VAR_64 = self.get_invalid_links()\n",
"for VAR_21 in self.get_all_children():\n",
"VAR_86 = VAR_21.get_invalid_links(is_submittable=self.meta.is_submittable)\n",
"if VAR_63:\n",
"VAR_63.extend(... | [
"def _validate_links(self):...\n",
"if self.flags.ignore_links or self._action == 'cancel':\n",
"return\n",
"invalid_links, cancelled_links = self.get_invalid_links()\n",
"for d in self.get_all_children():\n",
"result = d.get_invalid_links(is_submittable=self.meta.is_submittable)\n",
"if invalid_links:\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_5):...\n",
"VAR_8 = self.service.detail(VAR_5, sort_dir='asc')\n",
"return self._translate_uuids_to_ids(VAR_5, VAR_8)\n"
] | [
"def detail(self, context):...\n",
"images = self.service.detail(context, sort_dir='asc')\n",
"return self._translate_uuids_to_ids(context, images)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH]\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH]\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"self.run_command('jsdeps')\n",
"VAR_48 = os.environ.copy()\n",
"VAR_48['PATH'] = VAR_13\n",
"FUNC_8()\n",
"for src, dst in zip(self.sources, self.targets):\n",
"FUNC_5(self.distribution)\n",
"FUNC_7(['lessc', '--source-map', '--include-path=%s' % pipes.quote(VAR_12),\n sr... | [
"def run(self):...\n",
"self.run_command('jsdeps')\n",
"env = os.environ.copy()\n",
"env['PATH'] = npm_path\n",
"patch_out_bootstrap_bw_print()\n",
"for src, dst in zip(self.sources, self.targets):\n",
"update_package_data(self.distribution)\n",
"run(['lessc', '--source-map', '--include-path=%s' % pip... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"import logging\n",
"from mock import Mock\n",
"from twisted.internet import defer\n",
"from synapse.rest import admin\n",
"from synapse.rest.client.v1 import login, room\n",
"from tests.replication._base import BaseMultiWorkerStreamTestCase\n",
"VAR_0 = logging.getLogger(__name__)\n",
"\"\"\"Checks p... | [
"import logging\n",
"from mock import Mock\n",
"from twisted.internet import defer\n",
"from synapse.rest import admin\n",
"from synapse.rest.client.v1 import login, room\n",
"from tests.replication._base import BaseMultiWorkerStreamTestCase\n",
"logger = logging.getLogger(__name__)\n",
"\"\"\"Checks ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_62(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_254 = self.table_user()\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"VAR_139 = VAR_263.session\n",
"VAR_232 = (self.settings.retrieve_password_captcha or self.sett... | [
"def request_reset_password(self, next=DEFAULT, onvalidation=DEFAULT,...\n",
"\"\"\"docstring\"\"\"\n",
"table_user = self.table_user()\n",
"request = current.request\n",
"response = current.response\n",
"session = current.session\n",
"captcha = (self.settings.retrieve_password_captcha or self.settings.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Conditio... |
[
"def FUNC_20(VAR_2, *VAR_23, **VAR_24):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = VAR_21(VAR_2, *VAR_23, **kwargs)\n",
"if isinstance(VAR_22, HttpResponseBase):\n",
"return VAR_22\n",
"VAR_37 = 'template' in VAR_22 and VAR_22['template'] or None\n",
"VAR_37 = VAR_24.get('template', VAR_37)\n",
"VAR_... | [
"def wrapper(request, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"context = f(request, *args, **kwargs)\n",
"if isinstance(context, HttpResponseBase):\n",
"return context\n",
"template = 'template' in context and context['template'] or None\n",
"template = kwargs.get('template', template)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_14():...\n",
"VAR_23.component_instance.json_args = VAR_34\n",
"VAR_23.component_instance.special_args.extend(VAR_21)\n"
] | [
"def marshall_element_args():...\n",
"element.component_instance.json_args = serialized_json_args\n",
"element.component_instance.special_args.extend(special_args)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.expect_outgoing_key_request(self.hs.hostname, self.hs_signing_key)\n",
"VAR_21 = 'ed25519:%s' % (self.hs_signing_key.version,)\n",
"VAR_22 = PerspectivesKeyFetcher(self.hs2)\n",
"VAR_23 = VAR_22.get_keys({self.hs.hostname: {VAR_21: 1000}})\n",
"... | [
"def test_get_notary_keyserver_key(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.expect_outgoing_key_request(self.hs.hostname, self.hs_signing_key)\n",
"keyid = 'ed25519:%s' % (self.hs_signing_key.version,)\n",
"fetcher = PerspectivesKeyFetcher(self.hs2)\n",
"d = fetcher.get_keys({self.hs.hostname: {keyi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Expr'"
] |
[
"def FUNC_45(self):...\n",
"if self.user and not self.user.email:\n"
] | [
"def clean(self):...\n",
"if self.user and not self.user.email:\n"
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_84(self=self, VAR_148=VAR_148, VAR_149=VAR_149, VAR_150=VAR_150):...\n",
"return self.has_permission(VAR_148, VAR_149, VAR_150)\n"
] | [
"def has_permission(self=self, name=name, table_name=table_name, record_id=...\n",
"return self.has_permission(name, table_name, record_id)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(VAR_0: Reference, VAR_1: str='') ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return f'from {VAR_1}.{VAR_0.module_name} import {VAR_0.class_name}'\n"
] | [
"def import_string_from_reference(reference: Reference, prefix: str='') ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return f'from {prefix}.{reference.module_name} import {reference.class_name}'\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_58(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.helper.send(self.room_id, 'message 1', VAR_52=self.tok)\n",
"self.helper.send(self.room_id, 'message 2', VAR_52=self.tok)\n",
"VAR_55 = self.helper.send(self.room_id, 'message 3', VAR_52=self.tok)[\n 'event_id']\n",
"self.helper.send(self.room... | [
"def test_erased_sender(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.helper.send(self.room_id, 'message 1', tok=self.tok)\n",
"self.helper.send(self.room_id, 'message 2', tok=self.tok)\n",
"event_id = self.helper.send(self.room_id, 'message 3', tok=self.tok)['event_id'\n ]\n",
"self.helper.send(self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"As... |
[
"def __init__(self, VAR_112):...\n",
"\"\"\"docstring\"\"\"\n",
"self.s = FUNC_45(CODE(VAR_112).xml())\n"
] | [
"def __init__(self, text):...\n",
"\"\"\"docstring\"\"\"\n",
"self.s = make_links(CODE(text).xml())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_10(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_36 = saved_model_utils.get_meta_graph_def(VAR_2, VAR_3)\n",
"return VAR_36.signature_def\n"
] | [
"def get_signature_def_map(saved_model_dir, tag_set):...\n",
"\"\"\"docstring\"\"\"\n",
"meta_graph = saved_model_utils.get_meta_graph_def(saved_model_dir, tag_set)\n",
"return meta_graph.signature_def\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_26(self, VAR_14, VAR_43=None):...\n",
"self.tokens = self.block(VAR_14, VAR_43)\n",
"self.tokens.reverse()\n",
"self.inline.setup(self.block.def_links, self.block.def_footnotes)\n",
"VAR_87 = self.renderer.placeholder()\n",
"while self.pop():\n",
"VAR_87 += self.tok()\n",
"return VAR_87\n"
] | [
"def output(self, text, rules=None):...\n",
"self.tokens = self.block(text, rules)\n",
"self.tokens.reverse()\n",
"self.inline.setup(self.block.def_links, self.block.def_footnotes)\n",
"out = self.renderer.placeholder()\n",
"while self.pop():\n",
"out += self.tok()\n",
"return out\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_4(VAR_9, VAR_8, VAR_10):...\n",
"return '<object id=\"{}\" src=\"{}\" />'.format(url_for('.get_object_id', VAR_9\n =start, VAR_8=span, VAR_10=video), url_for('.get_object', VAR_9=start,\n VAR_8=span, VAR_10=video))\n"
] | [
"def _get_object_element(start, span, video):...\n",
"return '<object id=\"{}\" src=\"{}\" />'.format(url_for('.get_object_id', start\n =start, span=span, video=video), url_for('.get_object', start=start,\n span=span, video=video))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('one'), 1)\n"
] | [
"def test_evaluate_simple_path_binding(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('one'), 1)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_80 = to_bytes(VAR_80, 'ascii', 'ignore')\n",
"return base64.urlsafe_b64decode(VAR_80 + b'=' * (-len(VAR_80) % 4))\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"string = to_bytes(string, 'ascii', 'ignore')\n",
"return base64.urlsafe_b64decode(string + b'=' * (-len(string) % 4))\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"@login_required(isAdmin=True)...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2.method == 'POST':\n",
"VAR_8.setGroupNameForSession('system')\n",
"VAR_244 = {'url': reverse('webgateway_su', VAR_116=[user]), 'submit': \n 'Do you want to su to %s' % VAR_38}\n",
"VAR_175 = VAR_2.session['connector']\n",
"VAR... | [
"@login_required(isAdmin=True)...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"conn.setGroupNameForSession('system')\n",
"context = {'url': reverse('webgateway_su', args=[user]), 'submit': \n 'Do you want to su to %s' % user}\n",
"connector = request.session['connector']\n",
"tem... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"import datetime\n",
"import logging\n",
"import re\n",
"from flask import abort, current_app, flash, g, redirect, request, session, url_for\n",
"from flask_babel import lazy_gettext\n",
"from flask_login import login_user, logout_user\n",
"import jwt\n",
"from werkzeug.security import generate_passwo... | [
"import datetime\n",
"import logging\n",
"import re\n",
"from flask import abort, current_app, flash, g, redirect, request, session, url_for\n",
"from flask_babel import lazy_gettext\n",
"from flask_login import login_user, logout_user\n",
"import jwt\n",
"from werkzeug.security import generate_passwo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
[
"def FUNC_65(VAR_6):...\n",
"return reverse('webgateway_render_thumbnail', VAR_116=(iid,))\n"
] | [
"def urlprefix(iid):...\n",
"return reverse('webgateway_render_thumbnail', args=(iid,))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('d/_'), 'under')\n"
] | [
"def test_evaluate_dict_key_as_underscore(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('d/_'), 'under')\n"
] | [
0,
0,
1
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"VAR_30 = []\n",
"for VAR_33 in current_app.config.get('ACTIVE_PROVIDERS'):\n",
"VAR_33 = VAR_33.lower()\n",
"return VAR_30\n",
"if VAR_33 == 'ping':\n",
"VAR_30.append({'name': current_app.config.get('PING_NAME'), 'url':\n current_app.config.get('PING_REDIRECT_URI'), 'redir... | [
"def get(self):...\n",
"active_providers = []\n",
"for provider in current_app.config.get('ACTIVE_PROVIDERS'):\n",
"provider = provider.lower()\n",
"return active_providers\n",
"if provider == 'ping':\n",
"active_providers.append({'name': current_app.config.get('PING_NAME'), 'url':\n current_app.conf... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"async def FUNC_2(*, VAR_0: Client, VAR_5: AModel) ->Union[None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = '{}/tests/json_body'.format(VAR_0.base_url)\n",
"VAR_12: Dict[str, Any] = VAR_0.get_headers()\n",
"VAR_8 = VAR_5.to_dict()\n",
"VAR_11 = await _client.post(VAR_6=url, VAR_12=headers, json=json_json_... | [
"async def json_body_tests_json_body_post(*, client: Client, json_body: AModel...\n",
"\"\"\"docstring\"\"\"\n",
"url = '{}/tests/json_body'.format(client.base_url)\n",
"headers: Dict[str, Any] = client.get_headers()\n",
"json_json_body = json_body.to_dict()\n",
"response = await _client.post(url=url, hea... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"AnnAssign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"async def FUNC_18(VAR_24):...\n",
"VAR_65 = await self.store.get_current_state_ids(VAR_24)\n",
"VAR_40[VAR_24] = VAR_65\n"
] | [
"async def _fetch_room_state(room_id):...\n",
"room_state = await self.store.get_current_state_ids(room_id)\n",
"state_by_room[room_id] = room_state\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_25(VAR_46, VAR_47=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_16.headers.get(VAR_46, VAR_47)\n"
] | [
"def get_request_header(key, default=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return request.headers.get(key, default)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53.session.save()\n",
"VAR_40 = VAR_53.serving.request.hooks['before_finalize']\n",
"VAR_41 = VAR_53.lib.sessions.save\n",
"VAR_40[:] = [h for h in VAR_40 if h.callback is not VAR_41]\n"
] | [
"def _save_and_release_session():...\n",
"\"\"\"docstring\"\"\"\n",
"cherrypy.session.save()\n",
"hooks = cherrypy.serving.request.hooks['before_finalize']\n",
"forbidden = cherrypy.lib.sessions.save\n",
"hooks[:] = [h for h in hooks if h.callback is not forbidden]\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_17(VAR_16, VAR_17, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = {}\n",
"VAR_43 = FUNC_13(VAR_16)\n",
"VAR_44 = FUNC_14(VAR_17)\n",
"VAR_45 = FUNC_15(VAR_18)\n",
"for VAR_71, (filename, variable_name) in VAR_43.items():\n",
"VAR_70 = np.load(file_io.FileIO(filename, mode='rb'), allow_... | [
"def load_inputs_from_input_arg_string(inputs_str, input_exprs_str,...\n",
"\"\"\"docstring\"\"\"\n",
"tensor_key_feed_dict = {}\n",
"inputs = preprocess_inputs_arg_string(inputs_str)\n",
"input_exprs = preprocess_input_exprs_arg_string(input_exprs_str)\n",
"input_examples = preprocess_input_examples_arg_... | [
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Condition",
"For",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"As... |
[
"async def FUNC_4(self, VAR_10: MatrixFederationRequest, VAR_26: bool=False,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = await self._send_request(VAR_10, **send_request_args)\n",
"if not VAR_26:\n",
"return VAR_11\n",
"if VAR_13.code != 400 or VAR_13.to_synapse_error().errcode != 'M_UNRECOGNIZED':\n",
"... | [
"async def _send_request_with_optional_trailing_slash(self, request:...\n",
"\"\"\"docstring\"\"\"\n",
"response = await self._send_request(request, **send_request_args)\n",
"if not try_trailing_slash_on_400:\n",
"return response\n",
"if e.code != 400 or e.to_synapse_error().errcode != 'M_UNRECOGNIZED':\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Assign'"
] |
[
"@FUNC_0...\n",
"if self.config.worker_app:\n",
"return WorkerServerNoticesSender(self)\n",
"return ServerNoticesSender(self)\n"
] | [
"@cache_in_self...\n",
"if self.config.worker_app:\n",
"return WorkerServerNoticesSender(self)\n",
"return ServerNoticesSender(self)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"self.hs.config.enable_set_avatar_url = False\n",
"yield defer.ensureDeferred(self.store.set_profile_avatar_url(self.frank.\n localpart, 'http://my.server/me.png'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_avatar_url(self.frank.localpart... | [
"@defer.inlineCallbacks...\n",
"self.hs.config.enable_set_avatar_url = False\n",
"yield defer.ensureDeferred(self.store.set_profile_avatar_url(self.frank.\n localpart, 'http://my.server/me.png'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_avatar_url(self.frank.localpart... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"@login_required...\n",
"VAR_2 = get_object_or_404(Comment, pk=comment_id)\n",
"VAR_3 = FlagForm(user=request.user, VAR_2=comment, data=post_data(request))\n",
"if is_post(VAR_0) and VAR_3.is_valid():\n",
"VAR_3.save()\n",
"return render(VAR_0=request, template_name=\n 'spirit/comment/flag/create.html'... | [
"@login_required...\n",
"comment = get_object_or_404(Comment, pk=comment_id)\n",
"form = FlagForm(user=request.user, comment=comment, data=post_data(request))\n",
"if is_post(request) and form.is_valid():\n",
"form.save()\n",
"return render(request=request, template_name=\n 'spirit/comment/flag/create.... | [
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_23(self):...\n",
"VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'users':\n {'create': coreapi.Link(url='/users/', action='post', fields=[]),\n 'list': coreapi.Link(url='/users/', action='get', fields=[]), 'read':\n coreapi.Link(url='/users/{id}/', action='get', fields=[corea... | [
"def test_default_actions(self):...\n",
"schema = coreapi.Document(url='', title='Example API', content={'users': {\n 'create': coreapi.Link(url='/users/', action='post', fields=[]), 'list':\n coreapi.Link(url='/users/', action='get', fields=[]), 'read': coreapi.\n Link(url='/users/{id}/', action='get', ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_2(self):...\n",
"return CLASS_2(self.worker_hs)\n"
] | [
"def _build_replication_data_handler(self):...\n",
"return TestReplicationDataHandler(self.worker_hs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(self, VAR_7='read', VAR_8=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.has_permission(VAR_7):\n",
"self.raise_no_permission_to(VAR_8 or VAR_7)\n"
] | [
"def check_permission(self, permtype='read', permlevel=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.has_permission(permtype):\n",
"self.raise_no_permission_to(permlevel or permtype)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"@VAR_0.route('/stats')...\n",
"VAR_4 = calibre_db.session.query(db.Books).count()\n",
"VAR_5 = calibre_db.session.query(db.Authors).count()\n",
"VAR_6 = calibre_db.session.query(db.Tags).count()\n",
"VAR_7 = calibre_db.session.query(db.Series).count()\n",
"return render_title_template('stats.html', bookc... | [
"@about.route('/stats')...\n",
"counter = calibre_db.session.query(db.Books).count()\n",
"authors = calibre_db.session.query(db.Authors).count()\n",
"categorys = calibre_db.session.query(db.Tags).count()\n",
"series = calibre_db.session.query(db.Series).count()\n",
"return render_title_template('stats.htm... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_38(self, VAR_44):...\n",
"VAR_14 = VAR_44.group(2)\n",
"return self.renderer.codespan(VAR_14)\n"
] | [
"def output_code(self, m):...\n",
"text = m.group(2)\n",
"return self.renderer.codespan(text)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_21(self, VAR_1):...\n",
"VAR_5 = VAR_1.MagicMock()\n",
"VAR_26 = VAR_1.MagicMock()\n",
"VAR_23 = oai.Schema.construct(type='string', schema_format='date-time')\n",
"VAR_36 = VAR_1.patch(f'{VAR_0}.DateTimeProperty')\n",
"from openapi_python_client.parser.properties import _string_based_property\n... | [
"def test__string_based_property_datetime_format(self, mocker):...\n",
"name = mocker.MagicMock()\n",
"required = mocker.MagicMock()\n",
"data = oai.Schema.construct(type='string', schema_format='date-time')\n",
"DateTimeProperty = mocker.patch(f'{MODULE_NAME}.DateTimeProperty')\n",
"from openapi_python_c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assert'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._private:\n",
"VAR_36 = objreg.get('ram-cookie-jar')\n",
"VAR_36 = objreg.get('cookie-jar')\n",
"self.setCookieJar(VAR_36)\n",
"VAR_26 = QCoreApplication.instance()\n",
"VAR_36.setParent(VAR_26)\n"
] | [
"def _set_cookiejar(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._private:\n",
"cookie_jar = objreg.get('ram-cookie-jar')\n",
"cookie_jar = objreg.get('cookie-jar')\n",
"self.setCookieJar(cookie_jar)\n",
"app = QCoreApplication.instance()\n",
"cookie_jar.setParent(app)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(VAR_11, VAR_12, VAR_5):...\n",
"if VAR_5 == 'custom':\n",
"if VAR_11.value != VAR_12:\n",
"if VAR_5 == 'languages':\n",
"VAR_11.value = VAR_12\n",
"return VAR_11\n",
"if VAR_11.lang_code != VAR_12:\n",
"if VAR_5 == 'series':\n",
"VAR_11.lang_code = VAR_12\n",
"if VAR_11.name != VAR_12:... | [
"def create_objects_for_addition(db_element, add_element, db_type):...\n",
"if db_type == 'custom':\n",
"if db_element.value != add_element:\n",
"if db_type == 'languages':\n",
"db_element.value = add_element\n",
"return db_element\n",
"if db_element.lang_code != add_element:\n",
"if db_type == 'serie... | [
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",
"Condition",
"Assign'",
"Return'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_30(self, VAR_22='write'):...\n",
"if not hasattr(self, '_has_access_to'):\n",
"self._has_access_to = {}\n",
"self._has_access_to[VAR_22] = []\n",
"VAR_59 = frappe.get_roles()\n",
"for perm in self.get_permissions():\n",
"if perm.role in VAR_59 and perm.get(VAR_22):\n",
"return self._has_acce... | [
"def get_permlevel_access(self, permission_type='write'):...\n",
"if not hasattr(self, '_has_access_to'):\n",
"self._has_access_to = {}\n",
"self._has_access_to[permission_type] = []\n",
"roles = frappe.get_roles()\n",
"for perm in self.get_permissions():\n",
"if perm.role in roles and perm.get(permissi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Expr'"
] |
[
"@utils.skip_qt511...\n",
"if not VAR_4.config.webengine:\n",
"pytest.skip()\n",
"VAR_11 = ['--temp-basedir', '--enable-webengine-inspector'] + FUNC_0(VAR_4.\n config)\n",
"VAR_6.start(VAR_11)\n",
"VAR_18 = VAR_6.wait_for(message=\n 'Remote debugging server started successfully. Try pointing a Chrom... | [
"@utils.skip_qt511...\n",
"if not request.config.webengine:\n",
"pytest.skip()\n",
"args = ['--temp-basedir', '--enable-webengine-inspector'] + _base_args(request\n .config)\n",
"quteproc_new.start(args)\n",
"line = quteproc_new.wait_for(message=\n 'Remote debugging server started successfully. Try ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"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.