⬆️ auto update by pre-commit hooks (#548)

* ⬆️ auto update by pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.12.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.12.3)

* 🚨 auto fix by pre-commit hooks

* ⬆️ Upgrade dependency ruff to v0.12.4

* 🚨 修复 lint 警告

* 🚨 添加一个 noqa(

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 呵呵です <51957264+shoucandanghehe@users.noreply.github.com>
Co-authored-by: shoucandanghehe <wallfjjd@gmail.com>
This commit is contained in:
pre-commit-ci[bot]
2025-07-17 21:49:16 +00:00
committed by GitHub
parent 11bc486420
commit b82053be11
10 changed files with 29 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ depends_on: str | Sequence[str] | None = None
def migrate_old_data() -> None: # noqa: C901
from json import dumps, loads
from json import dumps, loads # noqa: PLC0415
Base = automap_base() # noqa: N806
Base.prepare(autoload_with=op.get_bind())

View File

@@ -28,7 +28,7 @@ def upgrade(name: str = '') -> None:
return
if op.get_bind().dialect.name == 'postgresql':
return
from json import dumps, loads
from json import dumps, loads # noqa: PLC0415
Base = automap_base() # noqa: N806
connection = op.get_bind()
@@ -54,7 +54,7 @@ def downgrade(name: str = '') -> None:
return
if op.get_bind().dialect.name == 'postgresql':
return
from json import dumps, loads
from json import dumps, loads # noqa: PLC0415
Base = automap_base() # noqa: N806
connection = op.get_bind()

View File

@@ -45,7 +45,10 @@ def data_migrate() -> None:
return
try:
from nonebot_session_to_uninfo import check_tables, get_id_map # type: ignore[import-untyped]
from nonebot_session_to_uninfo import ( # type: ignore[import-untyped] # noqa: PLC0415
check_tables,
get_id_map,
)
except ImportError as err:
msg = '请安装 `nonebot-session-to-uninfo` 以迁移数据'
raise ValueError(msg) from err

View File

@@ -31,9 +31,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
if op.get_bind().dialect.name == 'postgresql':
return
from nonebot.compat import PYDANTIC_V2, type_validate_json
from pydantic import BaseModel, ValidationError
from rich.progress import (
from nonebot.compat import PYDANTIC_V2, type_validate_json # noqa: PLC0415
from pydantic import BaseModel, ValidationError # noqa: PLC0415
from rich.progress import ( # noqa: PLC0415
BarColumn,
MofNCompleteColumn,
Progress,
@@ -60,14 +60,14 @@ def upgrade(name: str = '') -> None: # noqa: C901
logger.info('空表, 跳过')
return
from nonebot_plugin_tetris_stats.version import __version__
from nonebot_plugin_tetris_stats.version import __version__ # noqa: PLC0415
if __version__ != '1.0.3':
msg = '本迁移需要1.0.3版本, 请先锁定版本至1.0.3版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot_plugin_tetris_stats.game_data_processor.schemas import ( # type: ignore[import-untyped]
from nonebot_plugin_tetris_stats.game_data_processor.schemas import ( # type: ignore[import-untyped] # noqa: PLC0415
BaseProcessedData,
)

View File

@@ -29,9 +29,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
if op.get_bind().dialect.name == 'postgresql':
return
from nonebot.compat import type_validate_json
from pydantic import ValidationError
from rich.progress import (
from nonebot.compat import type_validate_json # noqa: PLC0415
from pydantic import ValidationError # noqa: PLC0415
from rich.progress import ( # noqa: PLC0415
BarColumn,
MofNCompleteColumn,
Progress,
@@ -39,9 +39,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
TextColumn,
TimeRemainingColumn,
)
from sqlalchemy import select
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import select # noqa: PLC0415
from sqlalchemy.ext.automap import automap_base # noqa: PLC0415
from sqlalchemy.orm import Session # noqa: PLC0415
with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op:
batch_op.add_column(sa.Column('user_unique_identifier', sa.String(length=32), nullable=True))
@@ -60,13 +60,15 @@ def upgrade(name: str = '') -> None: # noqa: C901
if count == 0:
logger.info('空表, 跳过')
else:
from nonebot_plugin_tetris_stats.version import __version__
from nonebot_plugin_tetris_stats.version import __version__ # noqa: PLC0415
if __version__ != '1.0.4':
msg = '本迁移需要1.0.4版本, 请先锁定版本至1.0.4版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot_plugin_tetris_stats.game_data_processor.schemas import BaseUser # type: ignore[import-untyped]
from nonebot_plugin_tetris_stats.game_data_processor.schemas import ( # type: ignore[import-untyped] # noqa: PLC0415
BaseUser,
)
models: list[type[BaseUser]] = BaseUser.__subclasses__()