lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"async def FUNC_8(self):...\n",
"if not hasattr(self, 'resolved_ref_url'):\n",
"await self.get_resolved_ref()\n",
"return self.resolved_ref_url\n"
] | [
"async def get_resolved_ref_url(self):...\n",
"if not hasattr(self, 'resolved_ref_url'):\n",
"await self.get_resolved_ref()\n",
"return self.resolved_ref_url\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_0):...\n",
"VAR_7 = SimpleUploadedFile('uploaded_file.txt', b'uploaded')\n",
"VAR_8 = VAR_0.post('/', data={'file': uploaded_file})\n",
"S3FileMiddleware(lambda x: None)(VAR_8)\n",
"assert VAR_8.FILES.getlist('file')\n",
"assert VAR_8.FILES.get('file').read() == b'uploaded'\n",
"st... | [
"def test_process_request(self, rf):...\n",
"uploaded_file = SimpleUploadedFile('uploaded_file.txt', b'uploaded')\n",
"request = rf.post('/', data={'file': uploaded_file})\n",
"S3FileMiddleware(lambda x: None)(request)\n",
"assert request.FILES.getlist('file')\n",
"assert request.FILES.get('file').read() ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assert'",
"Assert'",
"Expr'",
"Assign'",
"Expr'",
"Assert'",
"Assert'"
] |
[
"@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",
"print('Mixer Size {}'.format(len(VAR... | [
"@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'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_54 = []\n",
"for VAR_133 in VAR_8.listProjects():\n",
"VAR_54.append({'id': VAR_133.id, 'name': VAR_133.name, 'description': \n VAR_133.description or ''})\n",
"return VAR_54\n"
] | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"rv = []\n",
"for pr in conn.listProjects():\n",
"rv.append({'id': pr.id, 'name': pr.name, 'description': pr.description or ''})\n",
"return rv\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_1: (MutableMapping[str, MappingValue] | None), VAR_2: list[str]...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_1:\n",
"return {}\n",
"VAR_17 = dict(VAR_1)\n",
"for key in VAR_2:\n",
"return VAR_17\n"
] | [
"def remove_keys(_dict: (MutableMapping[str, MappingValue] | None), keys:...\n",
"\"\"\"docstring\"\"\"\n",
"if not _dict:\n",
"return {}\n",
"new = dict(_dict)\n",
"for key in keys:\n",
"return new\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"For",
"Return'"
] |
[
"@timed...\n",
"VAR_13 = super().render()\n",
"if not self.component or not self.component.component_id:\n",
"return VAR_13\n",
"VAR_14 = VAR_13.content.decode('utf-8')\n",
"VAR_15 = self.component.get_frontend_context_variables()\n",
"VAR_16 = orjson.loads(VAR_15)\n",
"VAR_17 = generate_checksum(orjs... | [
"@timed...\n",
"response = super().render()\n",
"if not self.component or not self.component.component_id:\n",
"return response\n",
"content = response.content.decode('utf-8')\n",
"frontend_context_variables = self.component.get_frontend_context_variables()\n",
"frontend_context_variables_dict = orjson.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
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'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
... |
[
"@FUNC_0...\n",
"if self.config.worker.writers.typing == self.get_instance_name():\n",
"return TypingWriterHandler(self)\n",
"return FollowerTypingHandler(self)\n"
] | [
"@cache_in_self...\n",
"if self.config.worker.writers.typing == self.get_instance_name():\n",
"return TypingWriterHandler(self)\n",
"return FollowerTypingHandler(self)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_14(self, VAR_45, VAR_46):...\n",
"VAR_45 = self.rules.list_item.findall(VAR_45)\n",
"VAR_78 = False\n",
"VAR_77 = len(VAR_45)\n",
"for VAR_101 in range(VAR_77):\n",
"VAR_79 = VAR_45[VAR_101][0]\n",
"VAR_94 = len(VAR_79)\n",
"VAR_79 = self.rules.list_bullet.sub('', VAR_79)\n",
"if '\\n ' in... | [
"def _process_list_item(self, cap, bull):...\n",
"cap = self.rules.list_item.findall(cap)\n",
"_next = False\n",
"length = len(cap)\n",
"for i in range(length):\n",
"item = cap[i][0]\n",
"space = len(item)\n",
"item = self.rules.list_bullet.sub('', item)\n",
"if '\\n ' in item:\n",
"space = space ... | [
0,
0,
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'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'... |
[
"async def FUNC_12(self, VAR_3: str, VAR_18: str, VAR_4: str, VAR_13: int,...\n",
"VAR_34 = await self.media_storage.ensure_media_is_in_local_cache(FileInfo(\n VAR_3, VAR_18, VAR_17=False))\n",
"VAR_12 = Thumbnailer(VAR_34)\n",
"VAR_0.warning(\n 'Unable to generate a thumbnail for remote media %s from %... | [
"async def generate_remote_exact_thumbnail(self, server_name: str, file_id:...\n",
"input_path = await self.media_storage.ensure_media_is_in_local_cache(FileInfo\n (server_name, file_id, url_cache=False))\n",
"thumbnailer = Thumbnailer(input_path)\n",
"logger.warning(\n 'Unable to generate a thumbnail f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(VAR_23=None):...\n",
"if hasattr(VAR_1, 'conf'):\n",
"return VAR_1.conf\n",
"return VAR_1.conf\n"
] | [
"def get_conf(site=None):...\n",
"if hasattr(local, 'conf'):\n",
"return local.conf\n",
"return local.conf\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = 'http://www.example.com'\n",
"self.assertEqual(format_value(VAR_5),\n '<a href=\"http://www.example.com\">http://www.example.com</a>')\n"
] | [
"def test_format_value_string_hyperlink(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = 'http://www.example.com'\n",
"self.assertEqual(format_value(url),\n '<a href=\"http://www.example.com\">http://www.example.com</a>')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(self) ->SynapseRequest:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_33 = self.reactor.tcpClients\n",
"self.assertEqual(len(VAR_33), 1)\n",
"VAR_34, VAR_35, VAR_36, VAR_37, VAR_38 = VAR_33.pop(0)\n",
"self.assertEqual(VAR_34, '1.2.3.4')\n",
"self.assertEqual(VAR_35, 8765)\n",
"VAR_39 = VAR_36.bu... | [
"def handle_http_replication_attempt(self) ->SynapseRequest:...\n",
"\"\"\"docstring\"\"\"\n",
"clients = self.reactor.tcpClients\n",
"self.assertEqual(len(clients), 1)\n",
"host, port, client_factory, _timeout, _bindAddress = clients.pop(0)\n",
"self.assertEqual(host, '1.2.3.4')\n",
"self.assertEqual(p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(self, *, VAR_4: str) ->Set[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = super().get_imports(VAR_4=prefix)\n",
"VAR_8.update({\n f'from {VAR_4}.{self.reference.module_name} import {self.reference.class_name}'\n , 'from typing import Dict', 'from typing import cast'})\n",
"return VAR_8\n... | [
"def get_imports(self, *, prefix: str) ->Set[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"imports = super().get_imports(prefix=prefix)\n",
"imports.update({\n f'from {prefix}.{self.reference.module_name} import {self.reference.class_name}'\n , 'from typing import Dict', 'from typing import cast'})\n",
"re... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_52(VAR_21, VAR_27, VAR_28):...\n",
"for extension in VAR_27:\n",
"VAR_21 = VAR_21.filter(db.Books.data.any(db.Data.format == extension))\n",
"for extension in VAR_28:\n",
"VAR_21 = VAR_21.filter(not_(db.Books.data.any(db.Data.format == extension)))\n",
"return VAR_21\n"
] | [
"def adv_search_extension(q, include_extension_inputs, exclude_extension_inputs...\n",
"for extension in include_extension_inputs:\n",
"q = q.filter(db.Books.data.any(db.Data.format == extension))\n",
"for extension in exclude_extension_inputs:\n",
"q = q.filter(not_(db.Books.data.any(db.Data.format == exte... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_170(VAR_332, VAR_212, VAR_101=VAR_101):...\n",
"VAR_212 = VAR_332.select(VAR_175=(0, 1)).first()\n",
"VAR_101(VAR_101.wiki_tag.wiki_page == VAR_212.id).delete()\n",
"for VAR_440 in (VAR_212.tags or []):\n",
"VAR_440 = VAR_440.strip().lower()\n",
"if VAR_440:\n",
"VAR_101.wiki_tag.insert(VAR_14... | [
"def update_tags_update(dbset, page, db=db):...\n",
"page = dbset.select(limitby=(0, 1)).first()\n",
"db(db.wiki_tag.wiki_page == page.id).delete()\n",
"for tag in (page.tags or []):\n",
"tag = tag.strip().lower()\n",
"if tag:\n",
"db.wiki_tag.insert(name=tag, wiki_page=page.id)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Condition",
"Expr'"
] |
[
"async def FUNC_2(self, VAR_10: str, VAR_11: str, VAR_12: str, VAR_13: bool=...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_57, VAR_58 = await self.federation_client.get_room_state_ids(VAR_10,\n VAR_11, VAR_12=event_id)\n",
"VAR_59 = set(VAR_57 + VAR_58)\n",
"if VAR_13:\n",
"VAR_59.add(VAR_12)\n",
"VAR_60 = ... | [
"async def _get_state_for_room(self, destination: str, room_id: str,...\n",
"\"\"\"docstring\"\"\"\n",
"state_event_ids, auth_event_ids = (await self.federation_client.\n get_room_state_ids(destination, room_id, event_id=event_id))\n",
"desired_events = set(state_event_ids + auth_event_ids)\n",
"if inclu... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'"
] |
[
"def __init__(self, *VAR_13):...\n",
"self.mappings = VAR_13\n"
] | [
"def __init__(self, *ms):...\n",
"self.mappings = ms\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_15(self):...\n",
"VAR_22 = 'long test header,' * 20\n",
"VAR_23 = '<br> ' + ', <br>'.join(VAR_22.split(','))\n",
"assert break_long_headers(VAR_22) == VAR_23\n"
] | [
"def test_break_long_lines(self):...\n",
"header = 'long test header,' * 20\n",
"expected_header = '<br> ' + ', <br>'.join(header.split(','))\n",
"assert break_long_headers(header) == expected_header\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def __call__(self, VAR_4, VAR_5):...\n",
"VAR_4['swift.cache'] = self.memcache\n",
"return self.app(VAR_4, VAR_5)\n"
] | [
"def __call__(self, env, start_response):...\n",
"env['swift.cache'] = self.memcache\n",
"return self.app(env, start_response)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_47(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_93 = self.contents_manager.info_string() + '\\n'\n",
"VAR_93 += '%d active kernels \\n' % len(self.kernel_manager._kernels)\n",
"return VAR_93 + 'The Jupyter Notebook is running at: %s' % self.display_url\n"
] | [
"def notebook_info(self):...\n",
"\"\"\"docstring\"\"\"\n",
"info = self.contents_manager.info_string() + '\\n'\n",
"info += '%d active kernels \\n' % len(self.kernel_manager._kernels)\n",
"return info + 'The Jupyter Notebook is running at: %s' % self.display_url\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AugAssign'",
"Return'"
] |
[
"def FUNC_18(self, VAR_26: str, *, VAR_29: Optional[Type[Any]]=None, VAR_13:...\n",
"return self.api_route(VAR_26=path, VAR_29=response_model, VAR_13=\n status_code, VAR_30=tags, VAR_31=dependencies, VAR_32=summary, VAR_33=\n description, VAR_34=response_description, VAR_35=responses, VAR_36=\n deprecate... | [
"def patch(self, path: str, *, response_model: Optional[Type[Any]]=None,...\n",
"return self.api_route(path=path, response_model=response_model, status_code\n =status_code, tags=tags, dependencies=dependencies, summary=summary,\n description=description, response_description=response_description,\n respo... | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"import logging\n",
"import requests\n",
"from flask import redirect, url_for, Blueprint, flash, request, session\n",
"from flask_oauthlib.client import OAuth\n",
"from redash import models, settings\n",
"from redash.authentication import create_and_login_user, logout_and_redirect_to_index, get_next_path\... | [
"import logging\n",
"import requests\n",
"from flask import redirect, url_for, Blueprint, flash, request, session\n",
"from flask_oauthlib.client import OAuth\n",
"from redash import models, settings\n",
"from redash.authentication import create_and_login_user, logout_and_redirect_to_index, get_next_path\... | [
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
0,
4,
4,
4
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"@login_required...\n",
"return VAR_13(*VAR_41, **kwargs)\n"
] | [
"@login_required...\n",
"return func(*args, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate(''), None)\n"
] | [
"def test_empty_path_expression_implicit(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate(''), None)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_16(self, *VAR_40, **VAR_7):...\n",
"if not self.last_updated:\n",
"self.last_updated = timezone.now()\n",
"return super(CLASS_13, self).save(*VAR_40, **kwargs)\n"
] | [
"def save(self, *args, **kwargs):...\n",
"if not self.last_updated:\n",
"self.last_updated = timezone.now()\n",
"return super(KBItem, self).save(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"from django.contrib import messages\n",
"from django.contrib.auth import views as django_views\n",
"from django.urls import reverse\n",
"from django.shortcuts import redirect, render, get_object_or_404\n",
"from django.utils.translation import gettext as _\n",
"from django.contrib.auth import get_user_mo... | [
"from django.contrib import messages\n",
"from django.contrib.auth import views as django_views\n",
"from django.urls import reverse\n",
"from django.shortcuts import redirect, render, get_object_or_404\n",
"from django.utils.translation import gettext as _\n",
"from django.contrib.auth import get_user_mo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Ass... |
[
"def FUNC_11(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"if '.' in VAR_1:\n",
"VAR_3 = VAR_25.get_attr(VAR_1)\n",
"VAR_3 = globals()[VAR_1]\n",
"VAR_25.log('method:' + VAR_1)\n",
"return VAR_3\n"
] | [
"def get_attr(cmd):...\n",
"\"\"\"docstring\"\"\"\n",
"if '.' in cmd:\n",
"method = frappe.get_attr(cmd)\n",
"method = globals()[cmd]\n",
"frappe.log('method:' + cmd)\n",
"return method\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_14(self, VAR_2):...\n",
"VAR_2.config.from_mapping({'MY_KEY': '/my-key'})\n",
"assert url_for('MY_KEY') == '/my-key'\n"
] | [
"def test_it_works_with_config_keys_returning_path(self, app):...\n",
"app.config.from_mapping({'MY_KEY': '/my-key'})\n",
"assert url_for('MY_KEY') == '/my-key'\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assert'"
] |
[
"@VAR_2.route('/admin/config', methods=['GET'])...\n",
"return render_title_template('config_edit.html', config=config, provider=\n oauthblueprints, VAR_1=feature_support, title=_(u'Basic Configuration'),\n page='config')\n"
] | [
"@admi.route('/admin/config', methods=['GET'])...\n",
"return render_title_template('config_edit.html', config=config, provider=\n oauthblueprints, feature_support=feature_support, title=_(\n u'Basic Configuration'), page='config')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_17(self, VAR_19, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = FUNC_1(VAR_2)\n",
"VAR_30 = VAR_2.session\n",
"VAR_2 = VAR_2.GET\n",
"VAR_31 = settings.SECURE\n",
"VAR_0.debug('Is SSL? %s' % VAR_31)\n",
"VAR_5 = VAR_30.get('connector', None)\n",
"VAR_0.debug('Connector: %s' % VAR_5)\n... | [
"def get_authenticated_connection(self, server_id, request):...\n",
"\"\"\"docstring\"\"\"\n",
"userip = get_client_ip(request)\n",
"session = request.session\n",
"request = request.GET\n",
"is_secure = settings.SECURE\n",
"logger.debug('Is SSL? %s' % is_secure)\n",
"connector = session.get('connector... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
... |
[
"def FUNC_10(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_31 = '0123456789abcdefghijklmnopqrstuvwxyz'\n",
"VAR_32 = 0\n",
"if VAR_23 < 0:\n",
"if not six.PY3:\n",
"if not isinstance(VAR_23, six.integer_types):\n",
"while True:\n",
"if VAR_23 > sys.maxint:\n",
"VAR_32 += 1\n",
"if VAR_23 < 36 ... | [
"def int_to_base36(i):...\n",
"\"\"\"docstring\"\"\"\n",
"digits = '0123456789abcdefghijklmnopqrstuvwxyz'\n",
"factor = 0\n",
"if i < 0:\n",
"if not six.PY3:\n",
"if not isinstance(i, six.integer_types):\n",
"while True:\n",
"if i > sys.maxint:\n",
"factor += 1\n",
"if i < 36 ** factor:\n",
"f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"AugAssign'"
] |
[
"@CLASS_4('log')...\n",
"\"\"\"docstring\"\"\"\n",
"if log.ram_handler is None:\n",
"VAR_38 = None\n",
"VAR_37 = QUrlQuery(VAR_3).queryItemValue('level')\n",
"VAR_20 = jinja.render('log.html', title='log', content=html_log)\n",
"if not VAR_37:\n",
"return 'text/html', VAR_20\n",
"VAR_37 = 'vdebug'\n... | [
"@add_handler('log')...\n",
"\"\"\"docstring\"\"\"\n",
"if log.ram_handler is None:\n",
"html_log = None\n",
"level = QUrlQuery(url).queryItemValue('level')\n",
"src = jinja.render('log.html', title='log', content=html_log)\n",
"if not level:\n",
"return 'text/html', src\n",
"level = 'vdebug'\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_15(VAR_0, VAR_1: FlaskClient):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.delete('/logout')\n",
"VAR_8 = VAR_1.get('/', follow_redirects=True)\n",
"assert request.path == '/login'\n"
] | [
"def test_logging_out(test_app, client: FlaskClient):...\n",
"\"\"\"docstring\"\"\"\n",
"client.delete('/logout')\n",
"resp = client.get('/', follow_redirects=True)\n",
"assert request.path == '/login'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assert'"
] |
[
"def FUNC_10(self, VAR_0, VAR_13):...\n",
"VAR_31 = VAR_0 / 'foo'\n",
"VAR_32 = VAR_0 / 'bar'\n",
"VAR_31.ensure(dir=True)\n",
"VAR_32.ensure(dir=True)\n",
"VAR_25 = VAR_13(str(VAR_0))\n",
"assert VAR_25.parent\n",
"assert not VAR_25.files\n",
"VAR_28 = self.Item(FUNC_1(VAR_31), VAR_31.relto(VAR_0))... | [
"def test_dirs(self, tmpdir, parser):...\n",
"foo_dir = tmpdir / 'foo'\n",
"bar_dir = tmpdir / 'bar'\n",
"foo_dir.ensure(dir=True)\n",
"bar_dir.ensure(dir=True)\n",
"parsed = parser(str(tmpdir))\n",
"assert parsed.parent\n",
"assert not parsed.files\n",
"foo_item = self.Item(_file_url(foo_dir), foo_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_29(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_62 = '\\n'.join(['Usage example:',\n 'To freeze a SavedModel in preparation for tfcompile:',\n '$saved_model_cli freeze_model \\\\', ' --dir /tmp/saved_model \\\\',\n ' --tag_set serve \\\\', ' --output_prefix /tmp/saved_model_xla_aot']... | [
"def add_freeze_model_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"compile_msg = '\\n'.join(['Usage example:',\n 'To freeze a SavedModel in preparation for tfcompile:',\n '$saved_model_cli freeze_model \\\\', ' --dir /tmp/saved_model \\\\',\n ' --tag_set serve \\\\', ' --output_prefi... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_66(self, VAR_36='Comment', VAR_37=None, VAR_38=None, VAR_39=None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = frappe.get_doc({'doctype': 'Comment', 'comment_type': VAR_36,\n 'comment_email': VAR_38 or frappe.session.user, 'comment_by': VAR_41,\n 'reference_doctype': self.doctype, 'reference_name... | [
"def add_comment(self, comment_type='Comment', text=None, comment_email=None,...\n",
"\"\"\"docstring\"\"\"\n",
"out = frappe.get_doc({'doctype': 'Comment', 'comment_type': comment_type,\n 'comment_email': comment_email or frappe.session.user, 'comment_by':\n comment_by, 'reference_doctype': self.doctype,... | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('d/b'), 'b')\n"
] | [
"def test_evaluate_simple_path_dict_key_string_value(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('d/b'), 'b')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_14(VAR_21: Text) ->bool:...\n",
"return VAR_21 is not None and VAR_21.strip() != ''\n"
] | [
"def is_valid(input: Text) ->bool:...\n",
"return input is not None and input.strip() != ''\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_137(self):...\n",
"if not self.auth.user:\n",
"return False\n",
"VAR_167 = self.settings.groups\n",
"return 'wiki_editor' in VAR_167\n"
] | [
"def can_manage(self):...\n",
"if not self.auth.user:\n",
"return False\n",
"groups = self.settings.groups\n",
"return 'wiki_editor' in groups\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_174(VAR_212):...\n",
"if VAR_212.render:\n",
"if VAR_212.render in self.settings.render.keys():\n",
"VAR_472 = self.markmin_render\n",
"VAR_472 = self.settings.render[VAR_212.render]\n",
"VAR_472 = getattr(self, '%s_render' % VAR_212.render)\n",
"return VAR_472(VAR_212)\n"
] | [
"def custom_render(page):...\n",
"if page.render:\n",
"if page.render in self.settings.render.keys():\n",
"my_render = self.markmin_render\n",
"my_render = self.settings.render[page.render]\n",
"my_render = getattr(self, '%s_render' % page.render)\n",
"return my_render(page)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_15(VAR_24):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_24.strip('\"').replace('\\\\\"', '\"').replace('\\\\\\\\', '\\\\'\n ) if VAR_24 else VAR_24\n"
] | [
"def unquote_etag(etag):...\n",
"\"\"\"docstring\"\"\"\n",
"return etag.strip('\"').replace('\\\\\"', '\"').replace('\\\\\\\\', '\\\\'\n ) if etag else etag\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_6(self, VAR_8='test', *VAR_9, **VAR_10):...\n",
"return self._getTargetClass()(*VAR_9, VAR_8=id, **kw)\n"
] | [
"def _makeOne(self, id='test', *args, **kw):...\n",
"return self._getTargetClass()(*args, id=id, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_10(self, VAR_23: str, VAR_16: Optional[QueryParams]=None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = {b'Accept': [b'application/json']}\n",
"if VAR_24:\n",
"VAR_46.update(VAR_24)\n",
"VAR_47 = await self.get_raw(VAR_23, VAR_16, VAR_24=headers)\n",
"return json_decoder.decode(VAR_47.deco... | [
"async def get_json(self, uri: str, args: Optional[QueryParams]=None,...\n",
"\"\"\"docstring\"\"\"\n",
"actual_headers = {b'Accept': [b'application/json']}\n",
"if headers:\n",
"actual_headers.update(headers)\n",
"body = await self.get_raw(uri, args, headers=headers)\n",
"return json_decoder.decode(bod... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('d/?blank'), 'blank')\n"
] | [
"def test_evaluate_dict_with_key_from_expansion(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('d/?blank'), 'blank')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"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.GET.get(VAR_209, VAR_199) == VAR_199... | [
"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['parameters']) > 0:\n",
"if request.GE... | [
0,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'"
] |
[
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(),...\n",
"self.write_var.assign(VAR_44 + self.var)\n",
"return {'res': self.write_var}\n"
] | [
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(),...\n",
"self.write_var.assign(x + self.var)\n",
"return {'res': self.write_var}\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/get_updater_status', methods=['GET', 'POST'])...\n",
"VAR_90 = {}\n",
"if VAR_1['updater']:\n",
"if request.method == 'POST':\n",
"return ''\n",
"VAR_98 = request.form.to_dict()\n",
"if request.method == 'GET':\n",
"if 'start' in VAR_98 and VAR_98['start'] == 'True':\n",
"VAR_90['sta... | [
"@admi.route('/get_updater_status', methods=['GET', 'POST'])...\n",
"status = {}\n",
"if feature_support['updater']:\n",
"if request.method == 'POST':\n",
"return ''\n",
"commit = request.form.to_dict()\n",
"if request.method == 'GET':\n",
"if 'start' in commit and commit['start'] == 'True':\n",
"st... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_8(self):...\n",
"VAR_6 = self.get_app()\n",
"assert VAR_6, 'Please initialize your application into Flask-RBAC.'\n",
"assert self._role_model, 'Please set role model before authenticate.'\n",
"assert self._user_model, 'Please set user model before authenticate.'\n",
"VAR_10 = VAR_15\n",
"if no... | [
"def _authenticate(self):...\n",
"app = self.get_app()\n",
"assert app, 'Please initialize your application into Flask-RBAC.'\n",
"assert self._role_model, 'Please set role model before authenticate.'\n",
"assert self._user_model, 'Please set user model before authenticate.'\n",
"user = current_user\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"self.fields = VAR_2\n"
] | [
"def __init__(self, fields):...\n",
"self.fields = fields\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __init__(self, *VAR_6, **VAR_7):...\n",
"VAR_7['auto_id'] = 'id_replace_%s'\n",
"super().__init__(*VAR_6, **kwargs)\n",
"self.helper = FormHelper(self)\n",
"self.helper.form_tag = False\n",
"self.helper.layout = Layout(SearchField('q'), Field('search'), Field(\n 'replacement'), Div(template='snipp... | [
"def __init__(self, *args, **kwargs):...\n",
"kwargs['auto_id'] = 'id_replace_%s'\n",
"super().__init__(*args, **kwargs)\n",
"self.helper = FormHelper(self)\n",
"self.helper.form_tag = False\n",
"self.helper.layout = Layout(SearchField('q'), Field('search'), Field(\n 'replacement'), Div(template='snipp... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_41(self, VAR_21=0):...\n",
"VAR_22 = 'dummy'\n",
"if not VAR_21:\n",
"VAR_22 = 'http://server/' + VAR_22\n",
"return VAR_22\n"
] | [
"def absolute_url(self, relative=0):...\n",
"url = 'dummy'\n",
"if not relative:\n",
"url = 'http://server/' + url\n",
"return url\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import render, redirect, get_object_or_404\n",
"from django.urls import reverse\n",
"from spirit.core.utils.views import is_post, post_data, is_ajax\n",
"from spirit.core.utils import json_response\n",
"from spirit.comme... | [
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import render, redirect, get_object_or_404\n",
"from django.urls import reverse\n",
"from spirit.core.utils.views import is_post, post_data, is_ajax\n",
"from spirit.core.utils import json_response\n",
"from spirit.comme... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = signedjson.key.generate_signing_key(1)\n",
"async def FUNC_25(VAR_23):...\n",
"self.assertEqual(VAR_23, {'server1': {FUNC_0(VAR_20): 1500}})\n",
"return {'server1': {FUNC_0(VAR_20): FetchKeyResult(get_verify_key(VAR_20), \n 800)}}\n"
] | [
"def test_verify_json_falls_back_to_other_fetchers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"key1 = signedjson.key.generate_signing_key(1)\n",
"async def get_keys1(keys_to_fetch):...\n",
"self.assertEqual(keys_to_fetch, {'server1': {get_key_id(key1): 1500}})\n",
"return {'server1': {get_key_id(key1): Fetc... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AsyncFunctionDef'",
"Expr'",
"Return'"
] |
[
"def __bool__(self):...\n",
"return self.field.empty_label is not None or bool(self.queryset)\n"
] | [
"def __bool__(self):...\n",
"return self.field.empty_label is not None or bool(self.queryset)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_23, VAR_24=None, VAR_25=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(VAR_1, 'initialised', None):\n",
"return\n",
"if not VAR_24:\n",
"VAR_24 = '.'\n",
"VAR_1.error_log = []\n",
"VAR_1.message_log = []\n",
"VAR_1.debug_log = []\n",
"VAR_1.realtime_log = []\n",
"VAR_1.fla... | [
"def init(site, sites_path=None, new_site=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(local, 'initialised', None):\n",
"return\n",
"if not sites_path:\n",
"sites_path = '.'\n",
"local.error_log = []\n",
"local.message_log = []\n",
"local.debug_log = []\n",
"local.realtime_log = []\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
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assig... |
[
"def FUNC_21(self):...\n",
"self._original_modified = self.modified\n",
"self.modified = now()\n",
"self.modified_by = frappe.session.user\n",
"if not self.creation:\n",
"self.creation = self.modified\n",
"if not self.owner:\n",
"self.owner = self.modified_by\n",
"for VAR_21 in self.get_all_children... | [
"def set_user_and_timestamp(self):...\n",
"self._original_modified = self.modified\n",
"self.modified = now()\n",
"self.modified_by = frappe.session.user\n",
"if not self.creation:\n",
"self.creation = self.modified\n",
"if not self.owner:\n",
"self.owner = self.modified_by\n",
"for d in self.get_al... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_42(self):...\n",
"VAR_254 = self.table_user()\n",
"VAR_260 = self.settings.login_userfield or ('username' if self.settings.\n login_userfield or 'username' in VAR_254.fields else 'email')\n",
"VAR_261 = self.settings.password_field\n",
"return Storage({'table_user': VAR_254, 'userfield': VAR_26... | [
"def _get_login_settings(self):...\n",
"table_user = self.table_user()\n",
"userfield = self.settings.login_userfield or ('username' if self.settings.\n login_userfield or 'username' in table_user.fields else 'email')\n",
"passfield = self.settings.password_field\n",
"return Storage({'table_user': table_... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"\"\"\"Utilities for interacting with Identity Servers\"\"\"\n",
"import logging\n",
"import urllib.parse\n",
"from typing import Awaitable, Callable, Dict, List, Optional, Tuple\n",
"from synapse.api.errors import CodeMessageException, Codes, HttpResponseException, SynapseError\n",
"from synapse.config.e... | [
"\"\"\"Utilities for interacting with Identity Servers\"\"\"\n",
"import logging\n",
"import urllib.parse\n",
"from typing import Awaitable, Callable, Dict, List, Optional, Tuple\n",
"from synapse.api.errors import CodeMessageException, Codes, HttpResponseException, SynapseError\n",
"from synapse.config.e... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_161():...\n",
"return URL.verify(VAR_263.request, user_signature=True, VAR_151=hash_vars,\n VAR_152=True)\n"
] | [
"def verify():...\n",
"return URL.verify(current.request, user_signature=True, hash_vars=hash_vars,\n hash_extension=True)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_50():...\n",
"if MULTI_USER_MODE:\n",
"if not db(db.auth_user).count():\n",
"return dict(VAR_26=T('Disabled'))\n",
"auth.settings.registration_requires_approval = False\n",
"return dict(VAR_26=auth())\n"
] | [
"def user():...\n",
"if MULTI_USER_MODE:\n",
"if not db(db.auth_user).count():\n",
"return dict(form=T('Disabled'))\n",
"auth.settings.registration_requires_approval = False\n",
"return dict(form=auth())\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"@login_required...\n",
"VAR_6 = yt_paginate(TopicNotification.objects.for_access(VAR_0.user).\n with_related_data(), per_page=config.topics_per_page, page_number=\n request.GET.get('page', 1))\n",
"return render(VAR_0=request, template_name=\n 'spirit/topic/notification/index.html', context={'notifica... | [
"@login_required...\n",
"notifications = yt_paginate(TopicNotification.objects.for_access(request.\n user).with_related_data(), per_page=config.topics_per_page, page_number\n =request.GET.get('page', 1))\n",
"return render(request=request, template_name=\n 'spirit/topic/notification/index.html', contex... | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_6():...\n",
"from frappe.database import get_db\n",
"VAR_10 = VAR_1.conf.db_name\n",
"VAR_151 = VAR_1.conf.db_password\n",
"if VAR_1.conf.different_credentials_for_replica:\n",
"VAR_10 = VAR_1.conf.replica_db_name\n",
"VAR_1.replica_db = get_db(host=local.conf.replica_host, VAR_10=user,\n V... | [
"def connect_replica():...\n",
"from frappe.database import get_db\n",
"user = local.conf.db_name\n",
"password = local.conf.db_password\n",
"if local.conf.different_credentials_for_replica:\n",
"user = local.conf.replica_db_name\n",
"local.replica_db = get_db(host=local.conf.replica_host, user=user, pa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_3(VAR_13):...\n",
"VAR_30 = VAR_13.split('_')\n",
"VAR_31 = VAR_30[0]\n",
"VAR_24 = int(VAR_30[1])\n",
"VAR_25 = 0.1\n",
"if VAR_31 == 'r':\n",
"VAR_24 = None\n",
"if len(VAR_30) > 2:\n",
"VAR_25 = float(VAR_30[2])\n",
"return VAR_24, round(VAR_25, 4)\n"
] | [
"def decode_params(params):...\n",
"keywords = params.split('_')\n",
"m_type = keywords[0]\n",
"seed = int(keywords[1])\n",
"percentage = 0.1\n",
"if m_type == 'r':\n",
"seed = None\n",
"if len(keywords) > 2:\n",
"percentage = float(keywords[2])\n",
"return seed, round(percentage, 4)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@wraps(VAR_14)...\n",
"VAR_112 = None\n",
"if 'X-Access-Token' in request.headers:\n",
"VAR_112 = request.headers['X-Access-Token']\n",
"if not VAR_112:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"VAR_13 = jwt.decode(VAR_112, VAR_0.config['SECRET_KEY'], algorithms=[... | [
"@wraps(f)...\n",
"token = None\n",
"if 'X-Access-Token' in request.headers:\n",
"token = request.headers['X-Access-Token']\n",
"if not token:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"data = jwt.decode(token, gui.config['SECRET_KEY'], algorithms=['HS256'])\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_69(self):...\n",
"return self.is_logged_in() and 'impersonator' in VAR_263.session.auth\n"
] | [
"def is_impersonating(self):...\n",
"return self.is_logged_in() and 'impersonator' in current.session.auth\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_3=None):...\n",
"VAR_29 = [CLASS_1, CLASS_2]\n",
"forms.MultiWidget.__init__(self, VAR_29, VAR_3)\n"
] | [
"def __init__(self, attrs=None):...\n",
"widgets = [AdminDateWidget, AdminTimeWidget]\n",
"forms.MultiWidget.__init__(self, widgets, attrs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@VAR_1.route('/logout')...\n",
"return render_template('/login.html')\n"
] | [
"@app.route('/logout')...\n",
"return render_template('/login.html')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_41(self):...\n",
"self.helper.join(self.room_id, user=self.second_user_id, VAR_52=self.second_tok\n )\n",
"VAR_12 = 'hello'\n",
"VAR_22, VAR_23 = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/leave'.format(self.room_id), VAR_19={\n 'reason': reason}, VAR_16=self.second_tok)\n",
... | [
"def test_leave_reason(self):...\n",
"self.helper.join(self.room_id, user=self.second_user_id, tok=self.second_tok)\n",
"reason = 'hello'\n",
"request, channel = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/leave'.format(self.room_id), content={\n 'reason': reason}, access_token=self.second_... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_5(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = saved_model_utils.read_saved_model(VAR_2).meta_graphs\n",
"VAR_29 = False\n",
"for VAR_4 in VAR_28:\n",
"VAR_29 |= VAR_4.HasField('object_graph_def')\n",
"if not VAR_29:\n",
"return\n",
"VAR_61 = load.load(VAR_2)\n",
"print(\"\"\"\nDe... | [
"def _show_defined_functions(saved_model_dir):...\n",
"\"\"\"docstring\"\"\"\n",
"meta_graphs = saved_model_utils.read_saved_model(saved_model_dir).meta_graphs\n",
"has_object_graph_def = False\n",
"for meta_graph_def in meta_graphs:\n",
"has_object_graph_def |= meta_graph_def.HasField('object_graph_def')... | [
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"For",
"AugAssign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"Condi... |
[
"def FUNC_3(VAR_6: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = None\n",
"while VAR_8 != VAR_6:\n",
"VAR_8 = VAR_6\n",
"return VAR_6\n",
"VAR_9 = VAR_6.lower().find('<script')\n",
"if VAR_9 == -1:\n",
"VAR_10 = VAR_6.lower().find('</script')\n",
"if VAR_10 == -1:\n",
"VAR_6 = VAR_6[0:V... | [
"def strip_scripts(ht: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"prev = None\n",
"while prev != ht:\n",
"prev = ht\n",
"return ht\n",
"x = ht.lower().find('<script')\n",
"if x == -1:\n",
"y = ht.lower().find('</script')\n",
"if y == -1:\n",
"ht = ht[0:x] + ht[y + 9:]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return VAR_45 + 2\n"
] | [
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return x + 2\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = ''\n",
"for field in VAR_1:\n",
"VAR_6 += \"{ name: '%s', \" % field.name\n",
"return '[ %s ]' % VAR_6[:-1]\n",
"if field.is_hidden:\n",
"VAR_6 += 'hidden: true, '\n",
"VAR_6 += \"label: '%s', \" % field.label_tag(field.label + ':')\n",
... | [
"@register.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"s = ''\n",
"for field in form:\n",
"s += \"{ name: '%s', \" % field.name\n",
"return '[ %s ]' % s[:-1]\n",
"if field.is_hidden:\n",
"s += 'hidden: true, '\n",
"s += \"label: '%s', \" % field.label_tag(field.label + ':')\n",
"s += \"widget: '... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"For",
"AugAssign'",
"Return'",
"Condition",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'"
] |
[
"def FUNC_16(VAR_10, VAR_11, VAR_20=None, VAR_17=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = FUNC_5(VAR_10.url_without_fragment)\n",
"if FUNC_11(VAR_10):\n",
"if os.path.isdir(VAR_11):\n",
"if VAR_17:\n",
"rmtree(VAR_11)\n",
"shutil.copytree(VAR_47, VAR_11, symlinks=True)\n",
"VAR_17.check_ag... | [
"def unpack_file_url(link, location, download_dir=None, hashes=None):...\n",
"\"\"\"docstring\"\"\"\n",
"link_path = url_to_path(link.url_without_fragment)\n",
"if is_dir_url(link):\n",
"if os.path.isdir(location):\n",
"if hashes:\n",
"rmtree(location)\n",
"shutil.copytree(link_path, location, symlink... | [
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'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_3(self, VAR_6):...\n",
"VAR_10 = [{'bucket': self.bucket_name}, ['starts-with', '$key', str(self.\n upload_folder)], {'success_action_status': '201'}]\n",
"if VAR_6 and ',' not in VAR_6:\n",
"VAR_12, VAR_13 = VAR_6.split('/', 1)\n",
"VAR_10.append(['starts-with', '$Content-Type', ''])\n",
"if... | [
"def get_conditions(self, accept):...\n",
"conditions = [{'bucket': self.bucket_name}, ['starts-with', '$key', str(\n self.upload_folder)], {'success_action_status': '201'}]\n",
"if accept and ',' not in accept:\n",
"top_type, sub_type = accept.split('/', 1)\n",
"conditions.append(['starts-with', '$Conte... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_18(VAR_0, VAR_1: FlaskClient):...\n",
"VAR_8 = VAR_1.get('/?path=nonexistent_dir', follow_redirects=True)\n",
"assert b'Directory does not exist.' in VAR_8.data\n"
] | [
"def test_visiting_nonexistent_dir_fails(test_app, client: FlaskClient):...\n",
"resp = client.get('/?path=nonexistent_dir', follow_redirects=True)\n",
"assert b'Directory does not exist.' in resp.data\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'"
] |
[
"def FUNC_89(*VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils.formatters\n",
"return frappe.utils.formatters.format_value(*VAR_79, **kwargs)\n"
] | [
"def format(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils.formatters\n",
"return frappe.utils.formatters.format_value(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"@VAR_2.route('/ajax/emailstat')...\n",
"VAR_51 = WorkerThread.getInstance().tasks\n",
"return jsonify(render_task_status(VAR_51))\n"
] | [
"@web.route('/ajax/emailstat')...\n",
"tasks = WorkerThread.getInstance().tasks\n",
"return jsonify(render_task_status(tasks))\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_9, *VAR_6, **VAR_7):...\n",
"super().__init__(VAR_9, *VAR_6, **kwargs)\n",
"self.fields['lang'].choices = [('', _('Please choose'))] + self.fields['lang'\n ].choices\n"
] | [
"def __init__(self, component, *args, **kwargs):...\n",
"super().__init__(component, *args, **kwargs)\n",
"self.fields['lang'].choices = [('', _('Please choose'))] + self.fields['lang'\n ].choices\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_10(VAR_14, VAR_15, VAR_16, VAR_17, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = User.objects.create_user(VAR_15, VAR_14, VAR_18)\n",
"VAR_53 = Registration()\n",
"VAR_53.register(VAR_19)\n",
"VAR_54 = UserProfile(VAR_19=user)\n",
"VAR_54.name = VAR_16\n",
"VAR_54.country = VAR_17\n",... | [
"def create_user_and_user_profile(email, username, name, country, password):...\n",
"\"\"\"docstring\"\"\"\n",
"user = User.objects.create_user(username, email, password)\n",
"reg = Registration()\n",
"reg.register(user)\n",
"profile = UserProfile(user=user)\n",
"profile.name = name\n",
"profile.count... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"VAR_26 = np.array([[1], [2]])\n",
"VAR_27 = np.array(range(5))\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_31, VAR_53=x0, VAR_54=x1)\n",
"VAR_20 = 'x=' + VAR_31 + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_string(VAR_20, '', '')\n... | [
"def testInputParserErrorWrongName(self):...\n",
"x0 = np.array([[1], [2]])\n",
"x1 = np.array(range(5))\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0, b=x1)\n",
"input_str = 'x=' + input_path + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_strin... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_17(self, *VAR_40, **VAR_7):...\n",
"VAR_29 = self.permission_name\n",
"super(CLASS_1, self).delete(*VAR_40, **kwargs)\n",
"if VAR_29:\n",
"VAR_164 = Permission.objects.get(codename=permission_name[9:])\n",
"VAR_164.delete()\n"
] | [
"def delete(self, *args, **kwargs):...\n",
"permission_name = self.permission_name\n",
"super(Queue, self).delete(*args, **kwargs)\n",
"if permission_name:\n",
"p = Permission.objects.get(codename=permission_name[9:])\n",
"p.delete()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_28(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.session.user == 'Administrator':\n",
"return\n",
"VAR_55 = False\n",
"VAR_56 = self.meta.fields.copy()\n",
"for table_field in self.meta.get_table_fields():\n",
"VAR_56 += frappe.get_meta(table_field.options).fields or []\n",
"for VAR_... | [
"def apply_fieldlevel_read_permissions(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.session.user == 'Administrator':\n",
"return\n",
"has_higher_permlevel = False\n",
"all_fields = self.meta.fields.copy()\n",
"for table_field in self.meta.get_table_fields():\n",
"all_fields += frappe.get_meta(t... | [
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",
"Return'",
"Assign'",
"Assign'",
"For",
"AugAssign'",
"For",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"For",
"Condition",
"For",
"Expr'",
"For",
"Condition",
"For",
"Expr'"
] |
[
"def FUNC_6(VAR_8):...\n",
"if 'HTTP_ACCEPT_LANGUAGE' not in VAR_8.META:\n",
"return False\n",
"VAR_21 = VAR_8.META.get('HTTP_USER_AGENT', None)\n",
"if VAR_21 is None:\n",
"return False\n",
"if VAR_5.match(VAR_21, re.IGNORECASE):\n",
"return False\n",
"if VAR_7.match(VAR_21):\n",
"return True\n",... | [
"def not_a_robot_request(request):...\n",
"if 'HTTP_ACCEPT_LANGUAGE' not in request.META:\n",
"return False\n",
"user_agent = request.META.get('HTTP_USER_AGENT', None)\n",
"if user_agent is None:\n",
"return False\n",
"if BOT_REGEX.match(user_agent, re.IGNORECASE):\n",
"return False\n",
"if MOBILE_R... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
""
] | [
"def _get_default_layout(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_3(self) ->bool:...\n",
"return True\n"
] | [
"def hasDirectory(self) ->bool:...\n",
"return True\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = [('login', [], {}), ('logout', [], {}), ('password_change', [], {}\n ), ('password_change_done', [], {}), ('password_reset', [], {}), (\n 'password_reset_done', [], {}), ('password_reset_confirm', [], {\n 'uidb64': 'aaaaaaa', 'token': '1111... | [
"def test_named_urls(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expected_named_urls = [('login', [], {}), ('logout', [], {}), (\n 'password_change', [], {}), ('password_change_done', [], {}), (\n 'password_reset', [], {}), ('password_reset_done', [], {}), (\n 'password_reset_confirm', [], {'uidb64': 'aa... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_118():...\n",
"VAR_14 = CLASS_6()\n",
"VAR_194.acquire()\n",
"VAR_195.acquire()\n",
"VAR_14.x = 7\n",
"VAR_194.release()\n",
"VAR_195.release()\n"
] | [
"def f():...\n",
"c = PluginManager()\n",
"lock1.acquire()\n",
"lock2.acquire()\n",
"c.x = 7\n",
"lock1.release()\n",
"lock2.release()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(*, VAR_0: Client, VAR_3: BodyUploadFileTestsUploadPost, VAR_4:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = '{}/tests/upload'.format(VAR_0.base_url)\n",
"VAR_12: Dict[str, Any] = VAR_0.get_headers()\n",
"if VAR_4 is not None:\n",
"VAR_12['keep-alive'] = VAR_4\n",
"VAR_8 = httpx.post(VAR_6=url,... | [
"def upload_file_tests_upload_post(*, client: Client, multipart_data:...\n",
"\"\"\"docstring\"\"\"\n",
"url = '{}/tests/upload'.format(client.base_url)\n",
"headers: Dict[str, Any] = client.get_headers()\n",
"if keep_alive is not None:\n",
"headers['keep-alive'] = keep_alive\n",
"response = httpx.post(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"AnnAssign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_165(VAR_215, VAR_224):...\n",
"return serializers.json({'version': '1.1', 'id': VAR_215, 'result': VAR_224,\n 'error': None})\n"
] | [
"def return_response(id, result):...\n",
"return serializers.json({'version': '1.1', 'id': id, 'result': result,\n 'error': None})\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"assert controller_name(CLASS_14) == 'role_view_controller'\n"
] | [
"def test_it_only_strips_one_suffix(self):...\n",
"assert controller_name(RoleViewControllerResource) == 'role_view_controller'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_11):...\n",
"self.user_id = self.register_user('test', 'test')\n",
"self.tok = self.login('test', 'test')\n",
"self.room_id = self.helper.create_room_as(self.user_id, VAR_52=self.tok)\n"
] | [
"def prepare(self, reactor, clock, homeserver):...\n",
"self.user_id = self.register_user('test', 'test')\n",
"self.tok = self.login('test', 'test')\n",
"self.room_id = self.helper.create_room_as(self.user_id, tok=self.tok)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_6(VAR_0, VAR_1):...\n",
"return FUNC_0(VAR_0=request, VAR_1=pk, VAR_2='is_pinned', VAR_3=False,\n VAR_4=Comment.UNPINNED, VAR_5=_('The topic has been unpinned'))\n"
] | [
"def unpin(request, pk):...\n",
"return _moderate(request=request, pk=pk, field_name='is_pinned', to_value=\n False, action=Comment.UNPINNED, message=_('The topic has been unpinned'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(VAR_14: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return unicodedata.normalize('NFC', os.path.basename(VAR_14))\n"
] | [
"def basename(file_path: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return unicodedata.normalize('NFC', os.path.basename(file_path))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_4(self) ->Sequence[GeneratorError]:...\n",
"\"\"\"docstring\"\"\"\n",
"print(f'Generating {self.project_name}')\n",
"self.project_dir.mkdir()\n",
"return [GeneratorError(detail=\n 'Directory already exists. Delete it or use the update command.')]\n",
"self._create_package()\n",
"self._build... | [
"def build(self) ->Sequence[GeneratorError]:...\n",
"\"\"\"docstring\"\"\"\n",
"print(f'Generating {self.project_name}')\n",
"self.project_dir.mkdir()\n",
"return [GeneratorError(detail=\n 'Directory already exists. Delete it or use the update command.')]\n",
"self._create_package()\n",
"self._build_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_87(VAR_62):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.modules import get_doctype_module, get_module_path\n",
"VAR_43 = os.path.join(FUNC_58(get_doctype_module(VAR_62)), 'doctype',\n FUNC_56(VAR_62), 'test_records.json')\n",
"if os.path.exists(VAR_43):\n",
"return json.loads(f.read())\n",... | [
"def get_test_records(doctype):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.modules import get_doctype_module, get_module_path\n",
"path = os.path.join(get_module_path(get_doctype_module(doctype)), 'doctype',\n scrub(doctype), 'test_records.json')\n",
"if os.path.exists(path):\n",
"return json.loads... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"self.assertFormfield(models.Member, 'email', widgets.AdminEmailInputWidget)\n"
] | [
"def testEmailField(self):...\n",
"self.assertFormfield(models.Member, 'email', widgets.AdminEmailInputWidget)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_10, VAR_23, VAR_20):...\n",
"VAR_13 = super().value_from_datadict(VAR_10, VAR_23, VAR_20)\n",
"if isinstance(VAR_13, str):\n",
"return json.loads(VAR_13)\n",
"return VAR_13\n"
] | [
"def value_from_datadict(self, data, files, name):...\n",
"value = super().value_from_datadict(data, files, name)\n",
"if isinstance(value, str):\n",
"return json.loads(value)\n",
"return value\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_30(self, VAR_28, VAR_29, VAR_12):...\n",
"if VAR_29 == 'public':\n",
"VAR_103 = type(VAR_12) == bool and type(VAR_28) == int\n",
"if VAR_103:\n",
"return self.playlistdb.setPublic(VAR_15=self.getUserId(), VAR_28=plid,\n VAR_24=value)\n"
] | [
"def api_changeplaylist(self, plid, attribute, value):...\n",
"if attribute == 'public':\n",
"is_valid = type(value) == bool and type(plid) == int\n",
"if is_valid:\n",
"return self.playlistdb.setPublic(userid=self.getUserId(), plid=plid, public\n =value)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_69(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._get_canonical_alias(VAR_17=404)\n",
"self._set_canonical_alias({'alias': self.alias})\n",
"VAR_61 = self._get_canonical_alias()\n",
"self.assertEqual(VAR_61, {'alias': self.alias})\n",
"self._set_canonical_alias({})\n",
"VAR_61 = self._get_c... | [
"def test_canonical_alias(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._get_canonical_alias(expected_code=404)\n",
"self._set_canonical_alias({'alias': self.alias})\n",
"res = self._get_canonical_alias()\n",
"self.assertEqual(res, {'alias': self.alias})\n",
"self._set_canonical_alias({})\n",
"res = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def __call__(self, VAR_10, VAR_13, VAR_14, VAR_12):...\n",
"VAR_11 = VAR_13.get('request')\n",
"if VAR_12:\n",
"VAR_10 = self.traverse(VAR_10, VAR_11, VAR_12)\n",
"if VAR_14 is False:\n",
"return VAR_10\n",
"if getattr(VAR_10, '__call__', VAR_0) is not VAR_0 or callable(VAR_10):\n",
"VAR_10 = render(... | [
"def __call__(self, base, econtext, call, path_items):...\n",
"request = econtext.get('request')\n",
"if path_items:\n",
"base = self.traverse(base, request, path_items)\n",
"if call is False:\n",
"return base\n",
"if getattr(base, '__call__', _marker) is not _marker or callable(base):\n",
"base = ren... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.