🔧 修改 basedpyright 配置 (#573)

* 🔧 修改 basedpyright 配置

* 🚨 auto fix by pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
呵呵です
2025-12-25 22:32:25 +08:00
committed by GitHub
parent a4ffb6bbc6
commit fcecf5a01f
16 changed files with 43 additions and 35 deletions

View File

@@ -1,12 +1,17 @@
from typing_extensions import override
class TetrisStatsError(Exception):
"""所有 TetrisStats 发生的异常基类"""
def __init__(self, message: str = ''):
self.message = message
@override
def __str__(self) -> str:
return self.message
@override
def __repr__(self) -> str:
return self.message

View File

@@ -20,7 +20,11 @@ from .templates import TEMPLATES_DIR
if TYPE_CHECKING:
from pydantic import IPvAnyAddress
app: FastAPI = get_app()
app = get_app()
if not isinstance(app, FastAPI):
msg = '本插件需要 FastAPI 驱动器才能运行'
raise RuntimeError(msg) # noqa: TRY004
driver = get_driver()
@@ -28,10 +32,6 @@ global_config = driver.config
BASE_URL = URL('https://tetr.io/user-content/')
if not isinstance(app, FastAPI):
msg = '本插件需要 FastAPI 驱动器才能运行'
raise RuntimeError(msg) # noqa: TRY004
NOT_FOUND = HTMLResponse('404 Not Found', status_code=status.HTTP_404_NOT_FOUND)

View File

@@ -1,4 +1,4 @@
from abc import abstractmethod
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Literal
@@ -8,7 +8,7 @@ from strenum import StrEnum
from ...typedefs import Lang, Number
class Base(BaseModel):
class Base(BaseModel, ABC):
@property
@abstractmethod
def path(self) -> str:

View File

@@ -1,3 +1,4 @@
from abc import ABC
from datetime import datetime
from typing import Literal
@@ -61,7 +62,7 @@ class Statistic(BaseModel):
finesse: Finesse
class Record(Base):
class Record(Base, ABC):
type: Literal['best', 'personal_best', 'recent', 'disputed']
user: User