From a116f9901c5fc22a0465c9931d8b83ea9b56d394 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:23:19 +0800 Subject: [PATCH 1/4] :arrow_up: auto update by pre-commit hooks (#520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :arrow_up: auto update by pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.3 → v0.8.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.3...v0.8.1) * :rotating_light: auto fix by pre-commit hooks * 🚨 fix ruff --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: shoucandanghehe --- .pre-commit-config.yaml | 2 +- nonebot_plugin_tetris_stats/games/__init__.py | 2 +- nonebot_plugin_tetris_stats/games/tetrio/__init__.py | 2 +- .../games/tetrio/api/schemas/summaries/__init__.py | 2 +- nonebot_plugin_tetris_stats/games/tetrio/constant.py | 2 +- nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py | 2 +- nonebot_plugin_tetris_stats/games/top/constant.py | 2 +- nonebot_plugin_tetris_stats/games/tos/constant.py | 2 +- nonebot_plugin_tetris_stats/utils/host.py | 4 ++-- nonebot_plugin_tetris_stats/utils/screenshot.py | 2 +- nonebot_plugin_tetris_stats/utils/templates.py | 6 +++--- pyproject.toml | 2 -- 12 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f210292c..9829b945 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks' repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.3 + rev: v0.8.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/nonebot_plugin_tetris_stats/games/__init__.py b/nonebot_plugin_tetris_stats/games/__init__.py index f64cfadc..7f5ed9bd 100644 --- a/nonebot_plugin_tetris_stats/games/__init__.py +++ b/nonebot_plugin_tetris_stats/games/__init__.py @@ -44,7 +44,7 @@ async def _(matcher: Matcher, account: MessageFormatError): @alc.handle() async def _(matcher: Matcher, matches: AlcMatches): - if matches.head_matched and matches.options != {} or matches.main_args == {}: + if (matches.head_matched and matches.options != {}) or matches.main_args == {}: await matcher.finish( (f'{matches.error_info!r}\n' if matches.error_info is not None else '') + f'输入"{matches.header_result} --help"查看帮助' diff --git a/nonebot_plugin_tetris_stats/games/tetrio/__init__.py b/nonebot_plugin_tetris_stats/games/tetrio/__init__.py index 079b81e9..16e23fa9 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/__init__.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/__init__.py @@ -23,7 +23,7 @@ def get_player(user_id_or_name: str) -> Player | MessageFormatError: ) -from . import bind, config, list, query, rank, record # noqa: E402 +from . import bind, config, list, query, rank, record # noqa: A004, E402 main_command.add(command) diff --git a/nonebot_plugin_tetris_stats/games/tetrio/api/schemas/summaries/__init__.py b/nonebot_plugin_tetris_stats/games/tetrio/api/schemas/summaries/__init__.py index 8a8f1002..0f608df1 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/api/schemas/summaries/__init__.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/api/schemas/summaries/__init__.py @@ -14,8 +14,8 @@ 'SoloSuccessModel', 'SummariesModel', 'Zen', + 'ZenSuccessModel', 'Zenith', 'ZenithEx', 'ZenithSuccessModel', - 'ZenSuccessModel', ] diff --git a/nonebot_plugin_tetris_stats/games/tetrio/constant.py b/nonebot_plugin_tetris_stats/games/tetrio/constant.py index beb48c74..e7b0297a 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/constant.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/constant.py @@ -1,4 +1,4 @@ -from re import compile +from re import compile # noqa: A004 from typing import Literal from yarl import URL diff --git a/nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py b/nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py index 57fa95ed..5cd5fb9f 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py @@ -146,7 +146,7 @@ async def _() -> None: await get_tetra_league_data() -from . import all, detail # noqa: E402 +from . import all, detail # noqa: A004, E402 base_command.add(command) diff --git a/nonebot_plugin_tetris_stats/games/top/constant.py b/nonebot_plugin_tetris_stats/games/top/constant.py index baa1a009..cec463d1 100644 --- a/nonebot_plugin_tetris_stats/games/top/constant.py +++ b/nonebot_plugin_tetris_stats/games/top/constant.py @@ -1,4 +1,4 @@ -from re import compile +from re import compile # noqa: A004 from typing import Literal from yarl import URL diff --git a/nonebot_plugin_tetris_stats/games/tos/constant.py b/nonebot_plugin_tetris_stats/games/tos/constant.py index 47830a65..3ecdaba1 100644 --- a/nonebot_plugin_tetris_stats/games/tos/constant.py +++ b/nonebot_plugin_tetris_stats/games/tos/constant.py @@ -1,4 +1,4 @@ -from re import compile +from re import compile # noqa: A004 from typing import Literal from yarl import URL diff --git a/nonebot_plugin_tetris_stats/utils/host.py b/nonebot_plugin_tetris_stats/utils/host.py index 1af1097a..572edbcf 100644 --- a/nonebot_plugin_tetris_stats/utils/host.py +++ b/nonebot_plugin_tetris_stats/utils/host.py @@ -4,7 +4,7 @@ from pathlib import Path as FilePath from typing import TYPE_CHECKING, ClassVar, Literal -from aiofiles import open +from aiofiles import open as aopen from fastapi import BackgroundTasks, FastAPI, Path, status from fastapi.responses import FileResponse, HTMLResponse, Response from fastapi.staticfiles import StaticFiles @@ -87,7 +87,7 @@ async def _( async def write_cache(path: FilePath, data: bytes) -> None: path.parent.mkdir(parents=True, exist_ok=True) - async with open(path, 'wb') as file: + async with aopen(path, 'wb') as file: await file.write(data) diff --git a/nonebot_plugin_tetris_stats/utils/screenshot.py b/nonebot_plugin_tetris_stats/utils/screenshot.py index ee7a672d..52029d55 100644 --- a/nonebot_plugin_tetris_stats/utils/screenshot.py +++ b/nonebot_plugin_tetris_stats/utils/screenshot.py @@ -1,4 +1,4 @@ -from playwright.async_api import BrowserContext, TimeoutError, ViewportSize +from playwright.async_api import BrowserContext, TimeoutError, ViewportSize # noqa: A004 from ..config.config import config from .browser import BrowserManager diff --git a/nonebot_plugin_tetris_stats/utils/templates.py b/nonebot_plugin_tetris_stats/utils/templates.py index ce1ab061..d1694054 100644 --- a/nonebot_plugin_tetris_stats/utils/templates.py +++ b/nonebot_plugin_tetris_stats/utils/templates.py @@ -5,7 +5,7 @@ from time import time_ns from zipfile import ZipFile -from aiofiles import open +from aiofiles import open as aopen from httpx import AsyncClient from nonebot import get_driver from nonebot.log import logger @@ -46,7 +46,7 @@ async def download_templates(tag: str) -> Path: f'https://github.com/A-Minos/tetris-stats-templates/releases/download/{tag}/dist.zip', follow_redirects=True, ) as response, - open(path, 'wb') as file, + aopen(path, 'wb') as file, ): response.raise_for_status() progress.update(task_id, total=int(response.headers.get('content-length', 0)) or None) @@ -76,7 +76,7 @@ async def check_hash(hash_file_path: Path) -> bool: if not file_path.is_file(): logger.error(f'{file_path.name} 不存在或不是文件') return False - async with open(file_path, 'rb') as file: + async with aopen(file_path, 'rb') as file: while True: chunk = await file.read(65535) if not chunk: diff --git a/pyproject.toml b/pyproject.toml index d4b4a864..e3632417 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,8 +132,6 @@ select = [ ] ignore = [ "E501", # 过长的行由 ruff format 处理, 剩余的都是字符串 - "ANN101", # 由 type checker 自动推断 - "ANN102", # 由 type checker 自动推断 "ANN202", # 向 NoneBot 注册的函数 "TRY003", "COM812", # 强制尾随逗号 From 25b0d2bcdcce35a0cc8134dc321ccc1571f1fef1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:25:13 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20astral-sh/se?= =?UTF-8?q?tup-uv=20action=20to=20v4=20(#521)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/Release.yml | 2 +- .github/workflows/Test.yml | 2 +- .github/workflows/TypeCheck.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index fc56414d..e8a5ae38 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v3 + - uses: astral-sh/setup-uv@v4 name: Setup UV with: enable-cache: true diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 10afc8dd..99752468 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v4 - name: Setup uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: enable-cache: true cache-suffix: ${{ env.PYTHON_VERSION }}_${{ env.OS }} diff --git a/.github/workflows/TypeCheck.yml b/.github/workflows/TypeCheck.yml index 1139d565..9087f9e6 100644 --- a/.github/workflows/TypeCheck.yml +++ b/.github/workflows/TypeCheck.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v3 + - uses: astral-sh/setup-uv@v4 name: Setup UV with: enable-cache: true From 23f412b4f4a1d183acc037085e6fd65eddb4d556 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:27:03 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20dependency?= =?UTF-8?q?=20prettier=20to=20v3.4.1=20(#522)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db4ba54c..73810cc9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,18 +5,20 @@ settings: excludeLinksFromLockfile: false importers: + .: devDependencies: prettier: specifier: ^3.3.3 - version: 3.3.3 + version: 3.4.1 packages: - prettier@3.3.3: - resolution: - { integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== } - engines: { node: '>=14' } + + prettier@3.4.1: + resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} + engines: {node: '>=14'} hasBin: true snapshots: - prettier@3.3.3: {} + + prettier@3.4.1: {} From 96f5d4559d8ab736854d0deedd7da76f9ff4b478 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 02:59:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20dependency?= =?UTF-8?q?=20prettier=20to=20v3.4.2=20(#523)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73810cc9..a433424f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,15 +10,15 @@ importers: devDependencies: prettier: specifier: ^3.3.3 - version: 3.4.1 + version: 3.4.2 packages: - prettier@3.4.1: - resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} engines: {node: '>=14'} hasBin: true snapshots: - prettier@3.4.1: {} + prettier@3.4.2: {}