Skip to content

⬆️ auto update by pre-commit hooks #520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

@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 == {}:

Check warning on line 47 in nonebot_plugin_tetris_stats/games/__init__.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/games/__init__.py#L47

Added line #L47 was not covered by tests
await matcher.finish(
(f'{matches.error_info!r}\n' if matches.error_info is not None else '')
+ f'输入"{matches.header_result} --help"查看帮助'
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/tetrio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
'SoloSuccessModel',
'SummariesModel',
'Zen',
'ZenSuccessModel',
'Zenith',
'ZenithEx',
'ZenithSuccessModel',
'ZenSuccessModel',
]
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/tetrio/constant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from re import compile
from re import compile # noqa: A004
from typing import Literal

from yarl import URL
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/top/constant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from re import compile
from re import compile # noqa: A004
from typing import Literal

from yarl import URL
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/tos/constant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from re import compile
from re import compile # noqa: A004
from typing import Literal

from yarl import URL
Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_tetris_stats/utils/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -87,7 +87,7 @@

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:

Check warning on line 90 in nonebot_plugin_tetris_stats/utils/host.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/utils/host.py#L90

Added line #L90 was not covered by tests
await file.write(data)


Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/utils/screenshot.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions nonebot_plugin_tetris_stats/utils/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,7 +46,7 @@
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)
Expand Down Expand Up @@ -76,7 +76,7 @@
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:

Check warning on line 79 in nonebot_plugin_tetris_stats/utils/templates.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/utils/templates.py#L79

Added line #L79 was not covered by tests
while True:
chunk = await file.read(65535)
if not chunk:
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ select = [
]
ignore = [
"E501", # 过长的行由 ruff format 处理, 剩余的都是字符串
"ANN101", # 由 type checker 自动推断
"ANN102", # 由 type checker 自动推断
"ANN202", # 向 NoneBot 注册的函数
"TRY003",
"COM812", # 强制尾随逗号
Expand Down
Loading