Use basedpyright refactor
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
from typing import Annotated, Optional
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Request, UploadFile
|
||||
from fastapi.params import File, Form, Param
|
||||
from fastapi.responses import HTMLResponse
|
||||
from folkugat_web.api import router
|
||||
from folkugat_web.config import db
|
||||
from folkugat_web.fragments import tema, temes
|
||||
from folkugat_web.model import temes as model
|
||||
from folkugat_web.services import auth, files
|
||||
@@ -78,7 +77,7 @@ def set_lyric(
|
||||
lyric: Annotated[str, Form()],
|
||||
):
|
||||
new_lyric = model.Lyrics(id=lyric_id, title=title, content=lyric.strip())
|
||||
temes_w.update_lyric(tema_id=tema_id, lyric_id=lyric_id, lyric=new_lyric)
|
||||
_ = temes_w.update_lyric(tema_id=tema_id, lyric_id=lyric_id, lyric=new_lyric)
|
||||
return tema.lyric(request=request, logged_in=logged_in, tema_id=tema_id, lyric_id=lyric_id)
|
||||
|
||||
|
||||
@@ -105,7 +104,7 @@ def delete_lyric(
|
||||
tema_id: int,
|
||||
lyric_id: int,
|
||||
):
|
||||
temes_w.delete_lyric(tema_id=tema_id, lyric_id=lyric_id)
|
||||
_ = temes_w.delete_lyric(tema_id=tema_id, lyric_id=lyric_id)
|
||||
return HTMLResponse()
|
||||
|
||||
|
||||
@@ -121,9 +120,9 @@ async def set_link(
|
||||
tema_id: int,
|
||||
link_id: int,
|
||||
content_type: Annotated[model.ContentType, Form()],
|
||||
title: Annotated[Optional[str], Form()] = None,
|
||||
url: Annotated[Optional[str], Form()] = None,
|
||||
upload_file: Annotated[Optional[UploadFile], File()] = None,
|
||||
title: Annotated[str | None, Form()] = None,
|
||||
url: Annotated[str | None, Form()] = None,
|
||||
upload_file: Annotated[UploadFile | None, File()] = None,
|
||||
):
|
||||
if upload_file:
|
||||
url = await files.store_file(tema_id=tema_id, upload_file=upload_file)
|
||||
@@ -136,7 +135,7 @@ async def set_link(
|
||||
url=url or '',
|
||||
title=title or '',
|
||||
)
|
||||
new_tema = temes_w.update_link(tema_id=tema_id, link_id=link_id, link=new_link)
|
||||
_ = temes_w.update_link(tema_id=tema_id, link_id=link_id, link=new_link)
|
||||
return tema.link(request=request, logged_in=logged_in, tema_id=tema_id, link_id=link_id)
|
||||
|
||||
|
||||
@@ -164,7 +163,7 @@ def delete_link(
|
||||
tema_id: int,
|
||||
link_id: int,
|
||||
):
|
||||
temes_w.delete_link(tema_id=tema_id, link_id=link_id)
|
||||
_tema = temes_w.delete_link(tema_id=tema_id, link_id=link_id)
|
||||
return HTMLResponse(
|
||||
headers={
|
||||
"HX-Trigger": f"reload-tema-{tema_id}-score"
|
||||
@@ -219,7 +218,7 @@ def set_property(
|
||||
value: Annotated[str, Form()],
|
||||
):
|
||||
new_property = model.Property(id=property_id, field=field, value=value.strip())
|
||||
temes_w.update_property(tema_id=tema_id, property_id=property_id, prop=new_property)
|
||||
_ = temes_w.update_property(tema_id=tema_id, property_id=property_id, prop=new_property)
|
||||
return tema.property_(request=request, logged_in=logged_in, tema_id=tema_id, property_id=property_id)
|
||||
|
||||
|
||||
@@ -243,7 +242,7 @@ def add_property(
|
||||
|
||||
@router.delete("/api/tema/{tema_id}/property/{property_id}")
|
||||
def delete_property(_: auth.RequireLogin, tema_id: int, property_id: int):
|
||||
temes_w.delete_property(tema_id=tema_id, property_id=property_id)
|
||||
_tema = temes_w.delete_property(tema_id=tema_id, property_id=property_id)
|
||||
return HTMLResponse()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user