mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 Improve unnecessary parens after 'not' keyword
This commit is contained in:
parent
f3fe7139f7
commit
e37a4fb777
@ -182,7 +182,7 @@ class TemplatePreviewer(BaseService, load=application_config.webserver.enable an
|
||||
@self.web_app.get("/preview/{path:path}")
|
||||
async def preview_template(path: str, key: Optional[str] = None): # pylint: disable=W0612
|
||||
# 如果是 /preview/ 开头的静态文件,直接返回内容。比如使用相对链接 ../ 引入的静态资源
|
||||
if not (path.endswith(".html") ^ path.endswith(".jinja2")):
|
||||
if not path.endswith((".html", ".jinja2")):
|
||||
full_path = self.template_service.template_dir / path
|
||||
if not full_path.is_file():
|
||||
raise HTTPException(status_code=404, detail=f"Template '{path}' not found")
|
||||
|
@ -89,7 +89,9 @@ async def update_metadata_from_github(overwrite: bool = True):
|
||||
text_map_json_data = {}
|
||||
async with client.stream("GET", text_map_url) as response:
|
||||
async for line in response.aiter_lines():
|
||||
if (string_id := (splits := line.split(":"))[0].strip(' "')) in string_ids:
|
||||
splits = line.split(":")
|
||||
string_id = splits[0].strip(' "')
|
||||
if string_id in string_ids:
|
||||
text_map_json_data[string_id] = splits[1].strip('\n ,"')
|
||||
string_ids.remove(string_id)
|
||||
if not string_ids:
|
||||
|
Loading…
Reference in New Issue
Block a user