lines
sequencelengths
1
383
raw_lines
sequencelengths
1
383
label
sequencelengths
1
383
type
sequencelengths
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", "storage.save('tmp/s3file/s3_file.txt', ContentFile(b's3file'))\n", "VAR_8 = VAR_0.post('/', data={'file':\n 'custom/location/tmp/s3file/s3_file.txt', 's3file': 'file'})\n", "S3FileMiddleware(lambda x: None)(VAR_8)\n", "assert VAR_8.FILES.getlist('file')\n", "assert VAR_8.FILES.get('file').read() == b's3file'\n" ]
[ "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() == b'uploaded'\n", "storage.save('tmp/s3file/s3_file.txt', ContentFile(b's3file'))\n", "request = rf.post('/', data={'file':\n 'custom/location/tmp/s3file/s3_file.txt', 's3file': 'file'})\n", "S3FileMiddleware(lambda x: None)(request)\n", "assert request.FILES.getlist('file')\n", "assert request.FILES.get('file').read() == b's3file'\n" ]
[ 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_17)))\n", "sys.stdout.flush()\n", "return FUNC_2(VAR_9, VAR_13, VAR_17, VAR_15, VAR_16)\n" ]
[ "@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]\n", "print('Mixer Size {}'.format(len(mixer_list)))\n", "sys.stdout.flush()\n", "return get_scope(baseidx, params, mixer_list, start, limit)\n" ]
[ 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(orjson.dumps(VAR_16))\n", "VAR_1 = BeautifulSoup(VAR_14, features='html.parser')\n", "VAR_18 = FUNC_0(VAR_1)\n", "VAR_18['unicorn:id'] = self.component.component_id\n", "VAR_18['unicorn:name'] = self.component.component_name\n", "VAR_18['unicorn:key'] = self.component.component_key\n", "VAR_18['unicorn:checksum'] = VAR_17\n", "VAR_19 = generate_checksum(CLASS_1._desoupify(VAR_1))\n", "if self.init_js:\n", "VAR_21 = {'id': self.component.component_id, 'name': self.component.\n component_name, 'key': self.component.component_key, 'data': orjson.\n loads(VAR_15), 'calls': self.component.calls, 'hash': VAR_19}\n", "VAR_20 = CLASS_1._desoupify(VAR_1)\n", "VAR_21 = orjson.dumps(VAR_21).decode('utf-8')\n", "VAR_20 = mark_safe(VAR_20)\n", "VAR_22 = f'unicorn:data:{self.component.component_id}'\n", "self.component.rendered(VAR_20)\n", "VAR_23 = (\n f\"Unicorn.componentInit(JSON.parse(document.getElementById('{VAR_22}').textContent));\"\n )\n", "VAR_13.content = VAR_20\n", "VAR_24 = VAR_1.new_tag('script')\n", "return VAR_13\n", "VAR_24['type'] = 'application/json'\n", "VAR_24['id'] = VAR_22\n", "VAR_24.string = sanitize_html(VAR_21)\n", "if self.component.parent:\n", "self.component._init_script = VAR_23\n", "VAR_25 = []\n", "self.component._json_tag = VAR_24\n", "VAR_25.append(VAR_24)\n", "for child in self.component.children:\n", "VAR_23 = f'{VAR_23} {child._init_script}'\n", "VAR_26 = VAR_1.new_tag('script')\n", "VAR_25.append(child._json_tag)\n", "VAR_26['type'] = 'module'\n", "VAR_26.string = f'string{VAR_23} }}'\n", "VAR_18.insert_after(VAR_26)\n", "for t in VAR_25:\n", "VAR_18.insert_after(t)\n" ]
[ "@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.loads(frontend_context_variables)\n", "checksum = generate_checksum(orjson.dumps(frontend_context_variables_dict))\n", "soup = BeautifulSoup(content, features='html.parser')\n", "root_element = get_root_element(soup)\n", "root_element['unicorn:id'] = self.component.component_id\n", "root_element['unicorn:name'] = self.component.component_name\n", "root_element['unicorn:key'] = self.component.component_key\n", "root_element['unicorn:checksum'] = checksum\n", "hash = generate_checksum(UnicornTemplateResponse._desoupify(soup))\n", "if self.init_js:\n", "init = {'id': self.component.component_id, 'name': self.component.\n component_name, 'key': self.component.component_key, 'data': orjson.\n loads(frontend_context_variables), 'calls': self.component.calls,\n 'hash': hash}\n", "rendered_template = UnicornTemplateResponse._desoupify(soup)\n", "init = orjson.dumps(init).decode('utf-8')\n", "rendered_template = mark_safe(rendered_template)\n", "json_element_id = f'unicorn:data:{self.component.component_id}'\n", "self.component.rendered(rendered_template)\n", "init_script = (\n f\"Unicorn.componentInit(JSON.parse(document.getElementById('{json_element_id}').textContent));\"\n )\n", "response.content = rendered_template\n", "json_tag = soup.new_tag('script')\n", "return response\n", "json_tag['type'] = 'application/json'\n", "json_tag['id'] = json_element_id\n", "json_tag.string = sanitize_html(init)\n", "if self.component.parent:\n", "self.component._init_script = init_script\n", "json_tags = []\n", "self.component._json_tag = json_tag\n", "json_tags.append(json_tag)\n", "for child in self.component.children:\n", "init_script = f'{init_script} {child._init_script}'\n", "script_tag = soup.new_tag('script')\n", "json_tags.append(child._json_tag)\n", "script_tag['type'] = 'module'\n", "script_tag.string = (\n f\"if (typeof Unicorn === 'undefined') {{ console.error('Unicorn is missing. Do you need {{% load unicorn %}} or {{% unicorn_scripts %}}?') }} else {{ {init_script} }}\"\n )\n", "root_element.insert_after(script_tag)\n", "for t in json_tags:\n", "root_element.insert_after(t)\n" ]
[ 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'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "For", "Expr'" ]
[ "@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 VAR_79:\n", "VAR_94 = VAR_94 - len(VAR_79)\n", "VAR_95 = VAR_78\n", "VAR_21 = re.compile('^ {1,%d}' % VAR_94, VAR_71=re.M)\n", "if not VAR_95 and re.search('\\\\n\\\\n(?!\\\\s*$)', VAR_79):\n", "VAR_79 = VAR_21.sub('', VAR_79)\n", "VAR_95 = True\n", "VAR_96 = len(VAR_79)\n", "if VAR_101 != VAR_77 - 1 and VAR_96:\n", "VAR_78 = VAR_79[VAR_96 - 1] == '\\n'\n", "if VAR_95:\n", "if not VAR_95:\n", "VAR_89 = 'loose_item_start'\n", "VAR_89 = 'list_item_start'\n", "VAR_95 = VAR_78\n", "self.tokens.append({'type': VAR_89})\n", "self.parse(VAR_79, self.list_rules)\n", "self.tokens.append({'type': 'list_item_end'})\n" ]
[ "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 - len(item)\n", "loose = _next\n", "pattern = re.compile('^ {1,%d}' % space, flags=re.M)\n", "if not loose and re.search('\\\\n\\\\n(?!\\\\s*$)', item):\n", "item = pattern.sub('', item)\n", "loose = True\n", "rest = len(item)\n", "if i != length - 1 and rest:\n", "_next = item[rest - 1] == '\\n'\n", "if loose:\n", "if not loose:\n", "t = 'loose_item_start'\n", "t = 'list_item_start'\n", "loose = _next\n", "self.tokens.append({'type': t})\n", "self.parse(item, self.list_rules)\n", "self.tokens.append({'type': 'list_item_end'})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "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 %s using a method of %s and type of %s: %s'\n , VAR_4, VAR_3, VAR_15, VAR_16, e)\n", "VAR_35 = await defer_to_thread(self.hs.get_reactor(), self.\n _generate_thumbnail, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16)\n", "return None\n", "if VAR_35:\n", "return None\n", "VAR_26 = FileInfo(VAR_3=server_name, VAR_18=file_id, thumbnail=True,\n thumbnail_width=t_width, thumbnail_height=t_height, thumbnail_method=\n t_method, thumbnail_type=t_type)\n", "VAR_35.close()\n", "VAR_0.info('Stored thumbnail in file %r', VAR_52)\n", "VAR_52 = await self.media_storage.store_file(VAR_35, VAR_26)\n", "VAR_46 = os.path.getsize(VAR_52)\n", "await self.store.store_remote_media_thumbnail(VAR_3, VAR_4, VAR_18, VAR_13,\n VAR_14, VAR_16, VAR_15, VAR_46)\n", "return VAR_52\n" ]
[ "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 for remote media %s from %s using a method of %s and type of %s: %s'\n , media_id, server_name, t_method, t_type, e)\n", "t_byte_source = await defer_to_thread(self.hs.get_reactor(), self.\n _generate_thumbnail, thumbnailer, t_width, t_height, t_method, t_type)\n", "return None\n", "if t_byte_source:\n", "return None\n", "file_info = FileInfo(server_name=server_name, file_id=file_id, thumbnail=\n True, thumbnail_width=t_width, thumbnail_height=t_height,\n thumbnail_method=t_method, thumbnail_type=t_type)\n", "t_byte_source.close()\n", "logger.info('Stored thumbnail in file %r', output_path)\n", "output_path = await self.media_storage.store_file(t_byte_source, file_info)\n", "t_len = os.path.getsize(output_path)\n", "await self.store.store_remote_media_thumbnail(server_name, media_id,\n file_id, t_width, t_height, t_type, t_method, t_len)\n", "return output_path\n" ]
[ 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.buildProtocol(None)\n", "VAR_40 = CLASS_3()\n", "VAR_20 = CLASS_4(self.reactor)\n", "VAR_20.requestFactory = VAR_40\n", "VAR_20.site = self.site\n", "VAR_41 = FakeTransport(VAR_20, self.reactor, VAR_39)\n", "VAR_39.makeConnection(VAR_41)\n", "VAR_42 = FakeTransport(VAR_39, self.reactor, VAR_20)\n", "VAR_20.makeConnection(VAR_42)\n", "self.reactor.advance(0)\n", "VAR_42.loseConnection()\n", "VAR_41.loseConnection()\n", "return VAR_40.request\n" ]
[ "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(port, 8765)\n", "client_protocol = client_factory.buildProtocol(None)\n", "request_factory = OneShotRequestFactory()\n", "channel = _PushHTTPChannel(self.reactor)\n", "channel.requestFactory = request_factory\n", "channel.site = self.site\n", "client_to_server_transport = FakeTransport(channel, self.reactor,\n client_protocol)\n", "client_protocol.makeConnection(client_to_server_transport)\n", "server_to_client_transport = FakeTransport(client_protocol, self.reactor,\n channel)\n", "channel.makeConnection(server_to_client_transport)\n", "self.reactor.advance(0)\n", "server_to_client_transport.loseConnection()\n", "client_to_server_transport.loseConnection()\n", "return request_factory.request\n" ]
[ 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", "return imports\n" ]
[ 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 == extension)))\n", "return q\n" ]
[ 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_148=tag, wiki_page=page.id)\n" ]
[ "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 = await self._get_events_from_store_or_dest(VAR_10, VAR_11, VAR_59)\n", "VAR_61 = VAR_59 - VAR_60.keys()\n", "if VAR_61:\n", "VAR_0.warning('Failed to fetch missing state/auth events for %s %s', VAR_12,\n VAR_61)\n", "VAR_62 = [VAR_60[VAR_160] for VAR_160 in VAR_57 if VAR_160 in VAR_60]\n", "if VAR_13:\n", "VAR_154 = VAR_60.get(VAR_12)\n", "VAR_63 = [VAR_60[VAR_160] for VAR_160 in VAR_58 if VAR_160 in VAR_60]\n", "if not VAR_154:\n", "VAR_63.sort(VAR_144=lambda e: e.depth)\n", "if VAR_154.is_state() and VAR_154.rejected_reason is None:\n", "return VAR_62, VAR_63\n", "VAR_62.append(VAR_154)\n" ]
[ "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 include_event_in_state:\n", "desired_events.add(event_id)\n", "event_map = await self._get_events_from_store_or_dest(destination, room_id,\n desired_events)\n", "failed_to_fetch = desired_events - event_map.keys()\n", "if failed_to_fetch:\n", "logger.warning('Failed to fetch missing state/auth events for %s %s',\n event_id, failed_to_fetch)\n", "remote_state = [event_map[e_id] for e_id in state_event_ids if e_id in\n event_map]\n", "if include_event_in_state:\n", "remote_event = event_map.get(event_id)\n", "auth_chain = [event_map[e_id] for e_id in auth_event_ids if e_id in event_map]\n", "if not remote_event:\n", "auth_chain.sort(key=lambda e: e.depth)\n", "if remote_event.is_state() and remote_event.rejected_reason is None:\n", "return remote_state, auth_chain\n", "remote_state.append(remote_event)\n" ]
[ 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 deprecated, VAR_37=['PATCH'], VAR_38=operation_id, VAR_16=\n response_model_include, VAR_17=response_model_exclude, VAR_18=\n response_model_by_alias, VAR_19=response_model_exclude_unset, VAR_20=\n response_model_exclude_defaults, VAR_21=response_model_exclude_none,\n VAR_39=include_in_schema, VAR_14=response_class, VAR_28=name, VAR_40=\n callbacks)\n" ]
[ "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 responses=responses, deprecated=deprecated, methods=['PATCH'],\n operation_id=operation_id, response_model_include=\n response_model_include, response_model_exclude=response_model_exclude,\n response_model_by_alias=response_model_by_alias,\n response_model_exclude_unset=response_model_exclude_unset,\n response_model_exclude_defaults=response_model_exclude_defaults,\n response_model_exclude_none=response_model_exclude_none,\n include_in_schema=include_in_schema, response_class=response_class,\n name=name, callbacks=callbacks)\n" ]
[ 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\n", "from redash.authentication.org_resolving import current_org\n", "VAR_0 = logging.getLogger('google_oauth')\n", "VAR_1 = OAuth()\n", "VAR_2 = Blueprint('google_oauth', __name__)\n", "def FUNC_0():...\n", "if 'google' not in VAR_1.remote_apps:\n", "VAR_1.remote_app('google', base_url='https://www.google.com/accounts/',\n authorize_url=\n 'https://accounts.google.com/o/oauth2/auth?prompt=select_account+consent',\n request_token_url=None, request_token_params={'scope':\n 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'\n }, access_token_url='https://accounts.google.com/o/oauth2/token',\n access_token_method='POST', consumer_key=settings.GOOGLE_CLIENT_ID,\n consumer_secret=settings.GOOGLE_CLIENT_SECRET)\n", "return VAR_1.google\n" ]
[ "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\n", "from redash.authentication.org_resolving import current_org\n", "logger = logging.getLogger('google_oauth')\n", "oauth = OAuth()\n", "blueprint = Blueprint('google_oauth', __name__)\n", "def google_remote_app():...\n", "if 'google' not in oauth.remote_apps:\n", "oauth.remote_app('google', base_url='https://www.google.com/accounts/',\n authorize_url=\n 'https://accounts.google.com/o/oauth2/auth?prompt=select_account+consent',\n request_token_url=None, request_token_params={'scope':\n 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'\n }, access_token_url='https://accounts.google.com/o/oauth2/token',\n access_token_method='POST', consumer_key=settings.GOOGLE_CLIENT_ID,\n consumer_secret=settings.GOOGLE_CLIENT_SECRET)\n", "return oauth.google\n" ]
[ 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_model\n", "from django.urls import reverse_lazy\n", "from spirit.core.conf import settings\n", "from spirit.core.utils.views import is_post, post_data\n", "from spirit.core.utils.ratelimit.decorators import ratelimit\n", "from spirit.user.utils.email import send_activation_email\n", "from spirit.user.utils.tokens import UserActivationTokenGenerator\n", "from .forms import RegistrationForm, LoginForm, ResendActivationForm, CustomPasswordResetForm\n", "VAR_0 = get_user_model()\n", "VAR_12 = 'spirit/user/auth/password_reset_form.html'\n", "VAR_13 = 'spirit/user/auth/password_reset_email.html'\n", "VAR_14 = 'spirit/user/auth/password_reset_subject.txt'\n", "VAR_15 = reverse_lazy('spirit:user:auth:password-reset-done')\n", "VAR_16 = CustomPasswordResetForm\n", "VAR_12 = 'spirit/user/auth/password_reset_confirm.html'\n", "VAR_15 = reverse_lazy('spirit:user:auth:password-reset-complete')\n", "VAR_12 = 'spirit/user/auth/password_reset_complete.html'\n", "VAR_12 = 'spirit/user/auth/password_reset_done.html'\n", "VAR_12 = 'spirit/user/auth/login.html'\n", "VAR_1 = CLASS_4.as_view()\n", "VAR_2 = django_views.LogoutView.as_view()\n", "VAR_3 = CLASS_0.as_view()\n", "VAR_4 = CLASS_1.as_view()\n", "VAR_5 = CLASS_2.as_view()\n", "VAR_6 = CLASS_3.as_view()\n", "@ratelimit(field='username', rate='5/5m')...\n", "if VAR_7.user.is_authenticated:\n", "return redirect(VAR_7.GET.get('next', VAR_7.user.st.get_absolute_url()))\n", "if VAR_7.method == 'POST' and VAR_7.is_limited():\n", "return redirect(VAR_7.get_full_path())\n", "return VAR_1(VAR_7, authentication_form=LoginForm, **kwargs)\n" ]
[ "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_model\n", "from django.urls import reverse_lazy\n", "from spirit.core.conf import settings\n", "from spirit.core.utils.views import is_post, post_data\n", "from spirit.core.utils.ratelimit.decorators import ratelimit\n", "from spirit.user.utils.email import send_activation_email\n", "from spirit.user.utils.tokens import UserActivationTokenGenerator\n", "from .forms import RegistrationForm, LoginForm, ResendActivationForm, CustomPasswordResetForm\n", "User = get_user_model()\n", "template_name = 'spirit/user/auth/password_reset_form.html'\n", "email_template_name = 'spirit/user/auth/password_reset_email.html'\n", "subject_template_name = 'spirit/user/auth/password_reset_subject.txt'\n", "success_url = reverse_lazy('spirit:user:auth:password-reset-done')\n", "form_class = CustomPasswordResetForm\n", "template_name = 'spirit/user/auth/password_reset_confirm.html'\n", "success_url = reverse_lazy('spirit:user:auth:password-reset-complete')\n", "template_name = 'spirit/user/auth/password_reset_complete.html'\n", "template_name = 'spirit/user/auth/password_reset_done.html'\n", "template_name = 'spirit/user/auth/login.html'\n", "_login_view = _CustomLoginView.as_view()\n", "_logout_view = django_views.LogoutView.as_view()\n", "_password_reset_view = _CustomPasswordResetView.as_view()\n", "custom_password_reset_confirm = _CustomPasswordResetConfirmView.as_view()\n", "custom_password_reset_complete = _CustomPasswordResetCompleteView.as_view()\n", "custom_password_reset_done = _CustomPasswordResetDoneView.as_view()\n", "@ratelimit(field='username', rate='5/5m')...\n", "if request.user.is_authenticated:\n", "return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n", "if request.method == 'POST' and request.is_limited():\n", "return redirect(request.get_full_path())\n", "return _login_view(request, authentication_form=LoginForm, **kwargs)\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, 4, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "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", "if VAR_19 is None:\n", "if VAR_5 is not None:\n", "VAR_35 = VAR_2['bsession']\n", "VAR_0.debug('Have OMERO session key %s, attempting to join...' % VAR_35)\n", "VAR_32 = None\n", "VAR_19 = VAR_5.server_id\n", "VAR_19 = VAR_2['server']\n", "VAR_0.debug('No Server ID available.')\n", "VAR_5 = Connector(VAR_19, VAR_31)\n", "VAR_5.user_id = None\n", "VAR_33 = None\n", "return None\n", "VAR_5.omero_session_key = VAR_35\n", "VAR_32 = VAR_2['username']\n", "if VAR_5 is None:\n", "if VAR_32 is not None and VAR_33 is not None:\n", "VAR_27 = VAR_5.join_connection(self.useragent, VAR_29)\n", "VAR_33 = VAR_2['password']\n", "VAR_0.debug('No username or password in request, exiting.')\n", "VAR_0.debug('Creating connection with username and password...')\n", "VAR_0.debug('Django session connector: %r' % VAR_5)\n", "VAR_30['connector'] = VAR_5\n", "return None\n", "VAR_5 = Connector(VAR_19, VAR_31)\n", "if VAR_5 is not None:\n", "return VAR_27\n", "VAR_27 = VAR_5.create_connection(self.useragent, VAR_32, VAR_33, VAR_29=userip)\n", "VAR_27 = VAR_5.join_connection(self.useragent, VAR_29)\n", "VAR_30['connector'] = VAR_5\n", "VAR_30['connector'] = VAR_5\n", "if VAR_27 is not None:\n", "return None\n", "return VAR_27\n", "VAR_0.debug('Connector valid, session successfully joined.')\n", "VAR_0.debug('Connector is no longer valid, destroying...')\n", "return VAR_27\n", "return None\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', None)\n", "logger.debug('Connector: %s' % connector)\n", "if server_id is None:\n", "if connector is not None:\n", "omero_session_key = request['bsession']\n", "logger.debug('Have OMERO session key %s, attempting to join...' %\n omero_session_key)\n", "username = None\n", "server_id = connector.server_id\n", "server_id = request['server']\n", "logger.debug('No Server ID available.')\n", "connector = Connector(server_id, is_secure)\n", "connector.user_id = None\n", "password = None\n", "return None\n", "connector.omero_session_key = omero_session_key\n", "username = request['username']\n", "if connector is None:\n", "if username is not None and password is not None:\n", "connection = connector.join_connection(self.useragent, userip)\n", "password = request['password']\n", "logger.debug('No username or password in request, exiting.')\n", "logger.debug('Creating connection with username and password...')\n", "logger.debug('Django session connector: %r' % connector)\n", "session['connector'] = connector\n", "return None\n", "connector = Connector(server_id, is_secure)\n", "if connector is not None:\n", "return connection\n", "connection = connector.create_connection(self.useragent, username, password,\n userip=userip)\n", "connection = connector.join_connection(self.useragent, userip)\n", "session['connector'] = connector\n", "session['connector'] = connector\n", "if connection is not None:\n", "return None\n", "return connection\n", "logger.debug('Connector valid, session successfully joined.')\n", "logger.debug('Connector is no longer valid, destroying...')\n", "return connection\n", "return None\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 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Return'", "Expr'", "Expr'", "Return'", "Return'" ]
[ "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 ** VAR_32:\n", "VAR_32 -= 1\n", "VAR_33 = []\n", "while VAR_32 >= 0:\n", "VAR_46 = 36 ** VAR_32\n", "return ''.join(VAR_33)\n", "VAR_33.append(VAR_31[VAR_23 // VAR_46])\n", "VAR_23 = VAR_23 % VAR_46\n", "VAR_32 -= 1\n" ]
[ "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", "factor -= 1\n", "base36 = []\n", "while factor >= 0:\n", "j = 36 ** factor\n", "return ''.join(base36)\n", "base36.append(digits[i // j])\n", "i = i % j\n", "factor -= 1\n" ]
[ 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", "VAR_38 = log.ram_handler.dump_log(html=True, VAR_37=level)\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", "html_log = log.ram_handler.dump_log(html=True, level=level)\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))\n", "VAR_29 = self.Item(FUNC_1(VAR_32), VAR_32.relto(VAR_0))\n", "assert VAR_25.folders == [VAR_29, VAR_28]\n" ]
[ "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_dir.relto(tmpdir))\n", "bar_item = self.Item(_file_url(bar_dir), bar_dir.relto(tmpdir))\n", "assert parsed.folders == [bar_item, foo_item]\n" ]
[ 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'])\n", "VAR_24 = VAR_23.add_parser('freeze_model', description=compile_msg,\n formatter_class=argparse.RawTextHelpFormatter)\n", "FUNC_28(VAR_24)\n", "VAR_24.set_defaults(func=freeze_model)\n" ]
[ "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_prefix /tmp/saved_model_xla_aot'])\n", "parser_compile = subparsers.add_parser('freeze_model', description=\n compile_msg, formatter_class=argparse.RawTextHelpFormatter)\n", "_parse_common_freeze_and_aot(parser_compile)\n", "parser_compile.set_defaults(func=freeze_model)\n" ]
[ 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': self.name,\n 'content': VAR_37 or VAR_36, 'link_doctype': VAR_39, 'link_name': VAR_40}\n ).insert(VAR_11=True)\n", "return VAR_66\n" ]
[ "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, 'reference_name': self.\n name, 'content': text or comment_type, 'link_doctype': link_doctype,\n 'link_name': link_name}).insert(ignore_permissions=True)\n", "return out\n" ]
[ 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.decode('utf-8'))\n" ]
[ "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(body.decode('utf-8'))\n" ]
[ 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:\n", "return JsonResponse(VAR_193, status=400)\n", "return VAR_1(*VAR_2, **kwargs)\n", "VAR_193['parameters'].append(VAR_209)\n", "VAR_193['info'][VAR_209] = extra\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['parameters']) > 0:\n", "if request.GET.get(param, default) == default:\n", "return JsonResponse(error_response_data, status=400)\n", "return func(*args, **kwargs)\n", "error_response_data['parameters'].append(param)\n", "error_response_data['info'][param] = extra\n" ]
[ 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['status'] = updater_thread.get_update_status()\n", "VAR_90['status'] = 11\n", "return json.dumps(VAR_90)\n", "VAR_130 = {'1': _(u'Requesting update package'), '2': _(\n u'Downloading update package'), '3': _(u'Unzipping update package'),\n '4': _(u'Replacing files'), '5': _(u'Database connections are closed'),\n '6': _(u'Stopping server'), '7': _(\n u'Update finished, please press okay and reload page'), '8': _(\n u'Update failed:') + u' ' + _(u'HTTP Error'), '9': _(u'Update failed:') +\n u' ' + _(u'Connection error'), '10': _(u'Update failed:') + u' ' + _(\n u'Timeout while establishing connection'), '11': _(u'Update failed:') +\n u' ' + _(u'General error'), '12': _(u'Update failed:') + u' ' + _(\n u'Update file could not be saved in temp dir'), '13': _(\n u'Update failed:') + u' ' + _(u'Files could not be replaced during update')\n }\n", "if VAR_90['status'] == -1:\n", "VAR_90['text'] = VAR_130\n", "VAR_90['status'] = 7\n", "updater_thread.status = 0\n", "updater_thread.resume()\n", "VAR_90['status'] = updater_thread.get_update_status()\n" ]
[ "@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", "status['status'] = updater_thread.get_update_status()\n", "status['status'] = 11\n", "return json.dumps(status)\n", "text = {'1': _(u'Requesting update package'), '2': _(\n u'Downloading update package'), '3': _(u'Unzipping update package'),\n '4': _(u'Replacing files'), '5': _(u'Database connections are closed'),\n '6': _(u'Stopping server'), '7': _(\n u'Update finished, please press okay and reload page'), '8': _(\n u'Update failed:') + u' ' + _(u'HTTP Error'), '9': _(u'Update failed:') +\n u' ' + _(u'Connection error'), '10': _(u'Update failed:') + u' ' + _(\n u'Timeout while establishing connection'), '11': _(u'Update failed:') +\n u' ' + _(u'General error'), '12': _(u'Update failed:') + u' ' + _(\n u'Update file could not be saved in temp dir'), '13': _(\n u'Update failed:') + u' ' + _(u'Files could not be replaced during update')\n }\n", "if status['status'] == -1:\n", "status['text'] = text\n", "status['status'] = 7\n", "updater_thread.status = 0\n", "updater_thread.resume()\n", "status['status'] = updater_thread.get_update_status()\n" ]
[ 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 not isinstance(VAR_10._get_current_object(), self._user_model\n", "VAR_9 = request.endpoint\n", "VAR_2 = VAR_6.view_functions.get(VAR_9, None)\n", "if not VAR_2:\n", "abort(404)\n", "VAR_1 = request.method\n", "if not hasattr(VAR_10, 'get_roles'):\n", "VAR_12 = [anonymous]\n", "VAR_12 = VAR_10.get_roles()\n", "VAR_19 = self._check_permission(VAR_12, VAR_1, VAR_2)\n", "if not VAR_19:\n", "return self._deny_hook(VAR_2=resource)\n" ]
[ "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", "if not isinstance(user._get_current_object(), self._user_model\n", "endpoint = request.endpoint\n", "resource = app.view_functions.get(endpoint, None)\n", "if not resource:\n", "abort(404)\n", "method = request.method\n", "if not hasattr(user, 'get_roles'):\n", "roles = [anonymous]\n", "roles = user.get_roles()\n", "permit = self._check_permission(roles, method, resource)\n", "if not permit:\n", "return self._deny_hook(resource=resource)\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='snippets/replace-help.html'))\n" ]
[ "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='snippets/replace-help.html'))\n" ]
[ 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.comment.models import Comment\n", "from .models import CommentLike\n", "from .forms import LikeForm\n", "@login_required...\n", "VAR_3 = get_object_or_404(Comment.objects.exclude(user=request.user), VAR_2\n =comment_id)\n", "VAR_4 = LikeForm(user=request.user, VAR_3=comment, data=post_data(request))\n", "if is_post(VAR_0) and VAR_4.is_valid():\n", "VAR_5 = VAR_4.save()\n", "return render(VAR_0=request, template_name=\n 'spirit/comment/like/create.html', context={'form': form, 'comment':\n comment})\n", "VAR_5.comment.increase_likes_count()\n", "if is_ajax(VAR_0):\n", "return json_response({'url_delete': VAR_5.get_delete_url()})\n", "return redirect(VAR_0.POST.get('next', VAR_3.get_absolute_url()))\n" ]
[ "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.comment.models import Comment\n", "from .models import CommentLike\n", "from .forms import LikeForm\n", "@login_required...\n", "comment = get_object_or_404(Comment.objects.exclude(user=request.user), pk=\n comment_id)\n", "form = LikeForm(user=request.user, comment=comment, data=post_data(request))\n", "if is_post(request) and form.is_valid():\n", "like = form.save()\n", "return render(request=request, template_name=\n 'spirit/comment/like/create.html', context={'form': form, 'comment':\n comment})\n", "like.comment.increase_likes_count()\n", "if is_ajax(request):\n", "return json_response({'url_delete': like.get_delete_url()})\n", "return redirect(request.POST.get('next', comment.get_absolute_url()))\n" ]
[ 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): FetchKeyResult(get_verify_key(key1), \n 800)}}\n" ]
[ 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.flags = CLASS_0({'currently_saving': [], 'redirect_location': '',\n 'in_install_db': False, 'in_install_app': False, 'in_import': False,\n 'in_test': False, 'mute_messages': False, 'ignore_links': False,\n 'mute_emails': False, 'has_dataurl': False, 'new_site': VAR_25})\n", "VAR_1.rollback_observers = []\n", "VAR_1.before_commit = []\n", "VAR_1.test_objects = {}\n", "VAR_1.site = VAR_23\n", "VAR_1.sites_path = VAR_24\n", "VAR_1.site_path = os.path.join(VAR_24, VAR_23)\n", "VAR_1.all_apps = None\n", "VAR_1.request_ip = None\n", "VAR_1.response = CLASS_0({'docs': []})\n", "VAR_1.task_id = None\n", "VAR_1.conf = CLASS_0(FUNC_7())\n", "VAR_1.lang = VAR_1.conf.lang or 'en'\n", "VAR_1.lang_full_dict = None\n", "VAR_1.module_app = None\n", "VAR_1.app_modules = None\n", "VAR_1.system_settings = CLASS_0()\n", "VAR_1.user = None\n", "VAR_1.user_perms = None\n", "VAR_1.session = None\n", "VAR_1.role_permissions = {}\n", "VAR_1.valid_columns = {}\n", "VAR_1.new_doc_templates = {}\n", "VAR_1.link_count = {}\n", "VAR_1.jenv = None\n", "VAR_1.jloader = None\n", "VAR_1.cache = {}\n", "VAR_1.document_cache = {}\n", "VAR_1.meta_cache = {}\n", "VAR_1.form_dict = CLASS_0()\n", "VAR_1.session = CLASS_0()\n", "VAR_1.dev_server = os.environ.get('DEV_SERVER', False)\n", "FUNC_68()\n", "VAR_1.initialised = True\n" ]
[ "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", "local.flags = _dict({'currently_saving': [], 'redirect_location': '',\n 'in_install_db': False, 'in_install_app': False, 'in_import': False,\n 'in_test': False, 'mute_messages': False, 'ignore_links': False,\n 'mute_emails': False, 'has_dataurl': False, 'new_site': new_site})\n", "local.rollback_observers = []\n", "local.before_commit = []\n", "local.test_objects = {}\n", "local.site = site\n", "local.sites_path = sites_path\n", "local.site_path = os.path.join(sites_path, site)\n", "local.all_apps = None\n", "local.request_ip = None\n", "local.response = _dict({'docs': []})\n", "local.task_id = None\n", "local.conf = _dict(get_site_config())\n", "local.lang = local.conf.lang or 'en'\n", "local.lang_full_dict = None\n", "local.module_app = None\n", "local.app_modules = None\n", "local.system_settings = _dict()\n", "local.user = None\n", "local.user_perms = None\n", "local.session = None\n", "local.role_permissions = {}\n", "local.valid_columns = {}\n", "local.new_doc_templates = {}\n", "local.link_count = {}\n", "local.jenv = None\n", "local.jloader = None\n", "local.cache = {}\n", "local.document_cache = {}\n", "local.meta_cache = {}\n", "local.form_dict = _dict()\n", "local.session = _dict()\n", "local.dev_server = os.environ.get('DEV_SERVER', False)\n", "setup_module_map()\n", "local.initialised = True\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'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "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():\n", "VAR_21.modified = self.modified\n", "frappe.flags.currently_saving.append((self.doctype, self.name))\n", "VAR_21.modified_by = self.modified_by\n", "if not VAR_21.owner:\n", "VAR_21.owner = self.owner\n", "if not VAR_21.creation:\n", "VAR_21.creation = self.creation\n" ]
[ "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_all_children():\n", "d.modified = self.modified\n", "frappe.flags.currently_saving.append((self.doctype, self.name))\n", "d.modified_by = self.modified_by\n", "if not d.owner:\n", "d.owner = self.owner\n", "if not d.creation:\n", "d.creation = self.creation\n" ]
[ 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_260, 'passfield':\n VAR_261})\n" ]
[ "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_user, 'userfield': userfield,\n 'passfield': passfield})\n" ]
[ 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.emailconfig import ThreepidBehaviour\n", "from synapse.http import RequestTimedOutError\n", "from synapse.http.client import SimpleHttpClient\n", "from synapse.types import JsonDict, Requester\n", "from synapse.util import json_decoder\n", "from synapse.util.hash import sha256_and_url_safe_base64\n", "from synapse.util.stringutils import assert_valid_client_secret, random_string\n", "from ._base import BaseHandler\n", "VAR_0 = logging.getLogger(__name__)\n", "VAR_1 = 'https://'\n", "def __init__(self, VAR_3):...\n", "super().__init__(VAR_3)\n", "self.http_client = SimpleHttpClient(VAR_3)\n", "self.blacklisting_http_client = SimpleHttpClient(VAR_3, ip_blacklist=hs.\n config.federation_ip_range_blacklist)\n", "self.federation_http_client = VAR_3.get_http_client()\n", "self.hs = VAR_3\n", "async def FUNC_1(self, VAR_4: str, VAR_5: Dict[str, str]) ->Optional[JsonDict]:...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = VAR_5.get('client_secret') or VAR_5.get('clientSecret')\n", "if not VAR_6:\n", "assert_valid_client_secret(VAR_6)\n", "VAR_33 = VAR_5.get('sid')\n", "if not VAR_33:\n", "VAR_34 = {'sid': VAR_33, 'client_secret': VAR_6}\n", "VAR_35 = VAR_4 + '/_matrix/identity/api/v1/3pid/getValidated3pid'\n", "VAR_46 = await self.http_client.get_json(VAR_35, VAR_34)\n", "VAR_0.info('%s returned %i for threepid validation for: %s', VAR_4, e.code,\n VAR_5)\n", "if 'medium' in VAR_46:\n", "return None\n", "return VAR_46\n", "VAR_0.info('%s reported non-validated threepid: %s', VAR_4, VAR_5)\n", "return None\n" ]
[ "\"\"\"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.emailconfig import ThreepidBehaviour\n", "from synapse.http import RequestTimedOutError\n", "from synapse.http.client import SimpleHttpClient\n", "from synapse.types import JsonDict, Requester\n", "from synapse.util import json_decoder\n", "from synapse.util.hash import sha256_and_url_safe_base64\n", "from synapse.util.stringutils import assert_valid_client_secret, random_string\n", "from ._base import BaseHandler\n", "logger = logging.getLogger(__name__)\n", "id_server_scheme = 'https://'\n", "def __init__(self, hs):...\n", "super().__init__(hs)\n", "self.http_client = SimpleHttpClient(hs)\n", "self.blacklisting_http_client = SimpleHttpClient(hs, ip_blacklist=hs.config\n .federation_ip_range_blacklist)\n", "self.federation_http_client = hs.get_http_client()\n", "self.hs = hs\n", "async def threepid_from_creds(self, id_server: str, creds: Dict[str, str]...\n", "\"\"\"docstring\"\"\"\n", "client_secret = creds.get('client_secret') or creds.get('clientSecret')\n", "if not client_secret:\n", "assert_valid_client_secret(client_secret)\n", "session_id = creds.get('sid')\n", "if not session_id:\n", "query_params = {'sid': session_id, 'client_secret': client_secret}\n", "url = id_server + '/_matrix/identity/api/v1/3pid/getValidated3pid'\n", "data = await self.http_client.get_json(url, query_params)\n", "logger.info('%s returned %i for threepid validation for: %s', id_server, e.\n code, creds)\n", "if 'medium' in data:\n", "return None\n", "return data\n", "logger.info('%s reported non-validated threepid: %s', id_server, creds)\n", "return None\n" ]
[ 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'", "AsyncFunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Return'", "Expr'", "Return'" ]
[ "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={'notifications':\n notifications})\n" ]
[ "@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', context={'notifications':\n notifications})\n" ]
[ 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 VAR_151=password)\n", "VAR_151 = VAR_1.conf.replica_db_password\n", "VAR_1.primary_db = VAR_1.db\n", "VAR_1.db = VAR_1.replica_db\n" ]
[ "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, password\n =password)\n", "password = local.conf.replica_db_password\n", "local.primary_db = local.db\n", "local.db = local.replica_db\n" ]
[ 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=['HS256'])\n", "return jsonify({'success': False, 'message': 'Token is expired'}), 401\n", "return VAR_14(VAR_15, *VAR_25, **kwargs)\n", "VAR_15 = CLASS_0.query.filter_by(VAR_36=data['public_id']).first()\n", "if VAR_15 is None:\n", "return jsonify({'success': False, 'message': 'Token is old. Please renew'}\n ), 401\n" ]
[ "@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", "return jsonify({'success': False, 'message': 'Token is expired'}), 401\n", "return f(current_api_user, *args, **kwargs)\n", "current_api_user = User.query.filter_by(public_id=data['public_id']).first()\n", "if current_api_user is None:\n", "return jsonify({'success': False, 'message': 'Token is old. Please renew'}\n ), 401\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", "self.assertEqual(VAR_23.code, 200, VAR_23.result)\n", "self._check_for_reason(VAR_12)\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_tok)\n", "self.assertEqual(channel.code, 200, channel.result)\n", "self._check_for_reason(reason)\n" ]
[ 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(\"\"\"\nDefined Functions:\"\"\", VAR_32='')\n", "VAR_30 = save._AugmentedGraphView(VAR_61).list_functions(VAR_61)\n", "VAR_30 = sorted(VAR_30.items(), key=lambda x: x[0])\n", "for name, function in VAR_30:\n", "print(\"\"\"\n Function Name: '%s'\"\"\" % name)\n", "VAR_62 = []\n", "if isinstance(function, defun.ConcreteFunction):\n", "VAR_62.append(function)\n", "if isinstance(function, def_function.Function):\n", "VAR_62.extend(function._list_all_concrete_functions_for_serialization())\n", "VAR_62 = sorted(VAR_62, key=lambda x: x.name)\n", "for index, concrete_function in enumerate(VAR_62, 1):\n", "VAR_20, VAR_76 = None, None\n", "if concrete_function.structured_input_signature:\n", "VAR_20, VAR_76 = concrete_function.structured_input_signature\n", "if concrete_function._arg_keywords:\n", "if VAR_20:\n", "VAR_20 = concrete_function._arg_keywords\n", "print(' Option #%d' % index)\n", "if VAR_76:\n", "print(' Callable with:')\n", "FUNC_6(VAR_76, 'Named Argument', VAR_6=4)\n", "FUNC_6(VAR_20, VAR_6=4)\n" ]
[ "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')\n", "if not has_object_graph_def:\n", "return\n", "trackable_object = load.load(saved_model_dir)\n", "print(\"\"\"\nDefined Functions:\"\"\", end='')\n", "functions = save._AugmentedGraphView(trackable_object).list_functions(\n trackable_object)\n", "functions = sorted(functions.items(), key=lambda x: x[0])\n", "for name, function in functions:\n", "print(\"\"\"\n Function Name: '%s'\"\"\" % name)\n", "concrete_functions = []\n", "if isinstance(function, defun.ConcreteFunction):\n", "concrete_functions.append(function)\n", "if isinstance(function, def_function.Function):\n", "concrete_functions.extend(function.\n _list_all_concrete_functions_for_serialization())\n", "concrete_functions = sorted(concrete_functions, key=lambda x: x.name)\n", "for index, concrete_function in enumerate(concrete_functions, 1):\n", "args, kwargs = None, None\n", "if concrete_function.structured_input_signature:\n", "args, kwargs = concrete_function.structured_input_signature\n", "if concrete_function._arg_keywords:\n", "if args:\n", "args = concrete_function._arg_keywords\n", "print(' Option #%d' % index)\n", "if kwargs:\n", "print(' Callable with:')\n", "_print_args(kwargs, 'Named Argument', indent=4)\n", "_print_args(args, indent=4)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "AugAssign'", "Condition", "Return'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "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:VAR_9] + VAR_6[VAR_10 + 9:]\n" ]
[ "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", "VAR_6 += \"widget: '%s' },\" % six.text_type(field)\n", "if field.field.required:\n", "VAR_6 += 'required: true, '\n", "if field.field.help_text:\n", "VAR_6 += \"help_text: '%s', \" % field.field.help_text\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: '%s' },\" % six.text_type(field)\n", "if field.field.required:\n", "s += 'required: true, '\n", "if field.field.help_text:\n", "s += \"help_text: '%s', \" % field.field.help_text\n" ]
[ 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_against_path(VAR_47)\n", "VAR_56 = None\n", "if VAR_20:\n", "if VAR_20:\n", "VAR_1.info('Link is a directory, ignoring download_dir')\n", "return\n", "VAR_56 = FUNC_19(VAR_10, VAR_20, VAR_17)\n", "if VAR_56:\n", "VAR_87 = VAR_56\n", "VAR_87 = VAR_47\n", "VAR_57 = mimetypes.guess_type(VAR_87)[0]\n", "unpack_file(VAR_87, VAR_11, VAR_57, VAR_10)\n", "if VAR_20 and not VAR_56:\n", "FUNC_14(VAR_87, VAR_20, VAR_10)\n" ]
[ "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, symlinks=True)\n", "hashes.check_against_path(link_path)\n", "already_downloaded_path = None\n", "if download_dir:\n", "if download_dir:\n", "logger.info('Link is a directory, ignoring download_dir')\n", "return\n", "already_downloaded_path = _check_download_dir(link, download_dir, hashes)\n", "if already_downloaded_path:\n", "from_path = already_downloaded_path\n", "from_path = link_path\n", "content_type = mimetypes.guess_type(from_path)[0]\n", "unpack_file(from_path, location, content_type, link)\n", "if download_dir and not already_downloaded_path:\n", "_copy_file(from_path, download_dir, link)\n" ]
[ 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 VAR_13 == '*':\n", "return VAR_10\n", "VAR_10.append(['starts-with', '$Content-Type', '%s/' % VAR_12])\n", "VAR_10.append({'Content-Type': VAR_6})\n" ]
[ "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', '$Content-Type', ''])\n", "if sub_type == '*':\n", "return conditions\n", "conditions.append(['starts-with', '$Content-Type', '%s/' % top_type])\n", "conditions.append({'Content-Type': accept})\n" ]
[ 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", "VAR_54.save()\n", "return VAR_19\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.country = country\n", "profile.save()\n", "return user\n" ]
[ 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_string(input_str, '', '')\n" ]
[ 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_19 in VAR_56:\n", "if VAR_19.permlevel > 0:\n", "if not VAR_55:\n", "VAR_55 = True\n", "return\n", "VAR_57 = self.get_permlevel_access('read')\n", "for VAR_19 in self.meta.fields:\n", "if VAR_19.permlevel and not VAR_19.permlevel in VAR_57:\n", "for table_field in self.meta.get_table_fields():\n", "self.set(VAR_19.fieldname, None)\n", "for VAR_19 in (frappe.get_meta(table_field.options).fields or []):\n", "if VAR_19.permlevel and not VAR_19.permlevel in VAR_57:\n", "for child in (self.get(table_field.fieldname) or []):\n", "child.set(VAR_19.fieldname, None)\n" ]
[ "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(table_field.options).fields or []\n", "for df in all_fields:\n", "if df.permlevel > 0:\n", "if not has_higher_permlevel:\n", "has_higher_permlevel = True\n", "return\n", "has_access_to = self.get_permlevel_access('read')\n", "for df in self.meta.fields:\n", "if df.permlevel and not df.permlevel in has_access_to:\n", "for table_field in self.meta.get_table_fields():\n", "self.set(df.fieldname, None)\n", "for df in (frappe.get_meta(table_field.options).fields or []):\n", "if df.permlevel and not df.permlevel in has_access_to:\n", "for child in (self.get(table_field.fieldname) or []):\n", "child.set(df.fieldname, None)\n" ]
[ 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", "if VAR_6.search(VAR_21):\n", "return True\n", "return False\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_REGEX.match(user_agent):\n", "return True\n", "if BROWSER_REGEX.search(user_agent):\n", "return True\n", "return False\n" ]
[ 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-aaaaa'}), (\n 'password_reset_complete', [], {})]\n", "for name, args, kwargs in VAR_12:\n", "reverse(name, args=args, kwargs=kwargs)\n", "self.fail(\"Reversal of url named '%s' failed with NoReverseMatch\" % name)\n" ]
[ "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': 'aaaaaaa', 'token':\n '1111-aaaaa'}), ('password_reset_complete', [], {})]\n", "for name, args, kwargs in expected_named_urls:\n", "reverse(name, args=args, kwargs=kwargs)\n", "self.fail(\"Reversal of url named '%s' failed with NoReverseMatch\" % name)\n" ]
[ 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, VAR_12=headers, files=multipart_data.to_dict())\n", "if VAR_8.status_code == 200:\n", "return None\n", "if VAR_8.status_code == 422:\n", "return HTTPValidationError.from_dict(cast(Dict[str, Any], VAR_8.json()))\n" ]
[ "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(url=url, headers=headers, files=multipart_data.to_dict())\n", "if response.status_code == 200:\n", "return None\n", "if response.status_code == 422:\n", "return HTTPValidationError.from_dict(cast(Dict[str, Any], response.json()))\n" ]
[ 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_metadata()\n", "self._build_models()\n", "self._build_api()\n", "self._reformat()\n", "return self._get_errors()\n" ]
[ "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_metadata()\n", "self._build_models()\n", "self._build_api()\n", "self._reformat()\n", "return self._get_errors()\n" ]
[ 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", "return []\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(f.read())\n", "return []\n" ]
[ 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_canonical_alias()\n", "self.assertEqual(VAR_61, {})\n" ]
[ "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 = self._get_canonical_alias()\n", "self.assertEqual(res, {})\n" ]
[ 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(VAR_10, VAR_13)\n", "return VAR_10\n" ]
[ "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 = render(base, econtext)\n", "return base\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'" ]