mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-02-03 18:45:32 +08:00
⬆️ 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:
committed by
GitHub
parent
11bc486420
commit
b82053be11
@@ -7,7 +7,7 @@ ci:
|
|||||||
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
|
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.11.13
|
rev: v0.12.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ depends_on: str | Sequence[str] | None = None
|
|||||||
|
|
||||||
|
|
||||||
def migrate_old_data() -> None: # noqa: C901
|
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 = automap_base() # noqa: N806
|
||||||
Base.prepare(autoload_with=op.get_bind())
|
Base.prepare(autoload_with=op.get_bind())
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def upgrade(name: str = '') -> None:
|
|||||||
return
|
return
|
||||||
if op.get_bind().dialect.name == 'postgresql':
|
if op.get_bind().dialect.name == 'postgresql':
|
||||||
return
|
return
|
||||||
from json import dumps, loads
|
from json import dumps, loads # noqa: PLC0415
|
||||||
|
|
||||||
Base = automap_base() # noqa: N806
|
Base = automap_base() # noqa: N806
|
||||||
connection = op.get_bind()
|
connection = op.get_bind()
|
||||||
@@ -54,7 +54,7 @@ def downgrade(name: str = '') -> None:
|
|||||||
return
|
return
|
||||||
if op.get_bind().dialect.name == 'postgresql':
|
if op.get_bind().dialect.name == 'postgresql':
|
||||||
return
|
return
|
||||||
from json import dumps, loads
|
from json import dumps, loads # noqa: PLC0415
|
||||||
|
|
||||||
Base = automap_base() # noqa: N806
|
Base = automap_base() # noqa: N806
|
||||||
connection = op.get_bind()
|
connection = op.get_bind()
|
||||||
|
|||||||
@@ -45,7 +45,10 @@ def data_migrate() -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
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:
|
except ImportError as err:
|
||||||
msg = '请安装 `nonebot-session-to-uninfo` 以迁移数据'
|
msg = '请安装 `nonebot-session-to-uninfo` 以迁移数据'
|
||||||
raise ValueError(msg) from err
|
raise ValueError(msg) from err
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
|
|||||||
if op.get_bind().dialect.name == 'postgresql':
|
if op.get_bind().dialect.name == 'postgresql':
|
||||||
return
|
return
|
||||||
|
|
||||||
from nonebot.compat import PYDANTIC_V2, type_validate_json
|
from nonebot.compat import PYDANTIC_V2, type_validate_json # noqa: PLC0415
|
||||||
from pydantic import BaseModel, ValidationError
|
from pydantic import BaseModel, ValidationError # noqa: PLC0415
|
||||||
from rich.progress import (
|
from rich.progress import ( # noqa: PLC0415
|
||||||
BarColumn,
|
BarColumn,
|
||||||
MofNCompleteColumn,
|
MofNCompleteColumn,
|
||||||
Progress,
|
Progress,
|
||||||
@@ -60,14 +60,14 @@ def upgrade(name: str = '') -> None: # noqa: C901
|
|||||||
logger.info('空表, 跳过')
|
logger.info('空表, 跳过')
|
||||||
return
|
return
|
||||||
|
|
||||||
from nonebot_plugin_tetris_stats.version import __version__
|
from nonebot_plugin_tetris_stats.version import __version__ # noqa: PLC0415
|
||||||
|
|
||||||
if __version__ != '1.0.3':
|
if __version__ != '1.0.3':
|
||||||
msg = '本迁移需要1.0.3版本, 请先锁定版本至1.0.3版本再执行本迁移'
|
msg = '本迁移需要1.0.3版本, 请先锁定版本至1.0.3版本再执行本迁移'
|
||||||
logger.critical(msg)
|
logger.critical(msg)
|
||||||
raise RuntimeError(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,
|
BaseProcessedData,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
|
|||||||
if op.get_bind().dialect.name == 'postgresql':
|
if op.get_bind().dialect.name == 'postgresql':
|
||||||
return
|
return
|
||||||
|
|
||||||
from nonebot.compat import type_validate_json
|
from nonebot.compat import type_validate_json # noqa: PLC0415
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError # noqa: PLC0415
|
||||||
from rich.progress import (
|
from rich.progress import ( # noqa: PLC0415
|
||||||
BarColumn,
|
BarColumn,
|
||||||
MofNCompleteColumn,
|
MofNCompleteColumn,
|
||||||
Progress,
|
Progress,
|
||||||
@@ -39,9 +39,9 @@ def upgrade(name: str = '') -> None: # noqa: C901
|
|||||||
TextColumn,
|
TextColumn,
|
||||||
TimeRemainingColumn,
|
TimeRemainingColumn,
|
||||||
)
|
)
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select # noqa: PLC0415
|
||||||
from sqlalchemy.ext.automap import automap_base
|
from sqlalchemy.ext.automap import automap_base # noqa: PLC0415
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session # noqa: PLC0415
|
||||||
|
|
||||||
with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op:
|
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))
|
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:
|
if count == 0:
|
||||||
logger.info('空表, 跳过')
|
logger.info('空表, 跳过')
|
||||||
else:
|
else:
|
||||||
from nonebot_plugin_tetris_stats.version import __version__
|
from nonebot_plugin_tetris_stats.version import __version__ # noqa: PLC0415
|
||||||
|
|
||||||
if __version__ != '1.0.4':
|
if __version__ != '1.0.4':
|
||||||
msg = '本迁移需要1.0.4版本, 请先锁定版本至1.0.4版本再执行本迁移'
|
msg = '本迁移需要1.0.4版本, 请先锁定版本至1.0.4版本再执行本迁移'
|
||||||
logger.critical(msg)
|
logger.critical(msg)
|
||||||
raise RuntimeError(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__()
|
models: list[type[BaseUser]] = BaseUser.__subclasses__()
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,5 @@ class BaseUser(BaseModel, ABC, Generic[T]):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def unique_identifier(self) -> str:
|
def unique_identifier(self) -> str:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
__hash__ = BaseModel.__hash__
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# This file is @generated by tarina.lang CLI tool
|
# This file is @generated by tarina.lang CLI tool
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
|
||||||
# ruff: noqa: E402, F401, PLC0414
|
# ruff: noqa: E402
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ class Piece(Enum):
|
|||||||
)
|
)
|
||||||
|
|
||||||
I5 = (
|
I5 = (
|
||||||
(True, True, True, True, True), # fmt: skip
|
(True, True, True, True, True),
|
||||||
)
|
) # fmt: skip
|
||||||
|
|
||||||
V = (
|
V = (
|
||||||
(True, False, False),
|
(True, False, False),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from tests.fake_event import FakeGroupMessageEvent
|
|||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_invalid_name(app: App) -> None:
|
async def test_invalid_name(app: App) -> None:
|
||||||
from nonebot_plugin_tetris_stats.games import alc
|
from nonebot_plugin_tetris_stats.games import alc # noqa: PLC0415
|
||||||
|
|
||||||
raw_message = 'tstats tetrio bind 芜湖'
|
raw_message = 'tstats tetrio bind 芜湖'
|
||||||
message = Message(raw_message)
|
message = Message(raw_message)
|
||||||
|
|||||||
Reference in New Issue
Block a user