mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
⬆️ auto update by pre-commit hooks (#520)
* ⬆️ 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) * 🚨 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 <wallfjjd@gmail.com>
This commit is contained in:
committed by
GitHub
parent
82befd631e
commit
a116f9901c
@@ -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.7.3
|
rev: v0.8.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ async def _(matcher: Matcher, account: MessageFormatError):
|
|||||||
|
|
||||||
@alc.handle()
|
@alc.handle()
|
||||||
async def _(matcher: Matcher, matches: AlcMatches):
|
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(
|
await matcher.finish(
|
||||||
(f'{matches.error_info!r}\n' if matches.error_info is not None else '')
|
(f'{matches.error_info!r}\n' if matches.error_info is not None else '')
|
||||||
+ f'输入"{matches.header_result} --help"查看帮助'
|
+ f'输入"{matches.header_result} --help"查看帮助'
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ command = Subcommand(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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)
|
main_command.add(command)
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ __all__ = [
|
|||||||
'SoloSuccessModel',
|
'SoloSuccessModel',
|
||||||
'SummariesModel',
|
'SummariesModel',
|
||||||
'Zen',
|
'Zen',
|
||||||
|
'ZenSuccessModel',
|
||||||
'Zenith',
|
'Zenith',
|
||||||
'ZenithEx',
|
'ZenithEx',
|
||||||
'ZenithSuccessModel',
|
'ZenithSuccessModel',
|
||||||
'ZenSuccessModel',
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from re import compile
|
from re import compile # noqa: A004
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ async def _() -> None:
|
|||||||
await get_tetra_league_data()
|
await get_tetra_league_data()
|
||||||
|
|
||||||
|
|
||||||
from . import all, detail # noqa: E402
|
from . import all, detail # noqa: A004, E402
|
||||||
|
|
||||||
base_command.add(command)
|
base_command.add(command)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from re import compile
|
from re import compile # noqa: A004
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from re import compile
|
from re import compile # noqa: A004
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from ipaddress import IPv4Address, IPv6Address
|
|||||||
from pathlib import Path as FilePath
|
from pathlib import Path as FilePath
|
||||||
from typing import TYPE_CHECKING, ClassVar, Literal
|
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 import BackgroundTasks, FastAPI, Path, status
|
||||||
from fastapi.responses import FileResponse, HTMLResponse, Response
|
from fastapi.responses import FileResponse, HTMLResponse, Response
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
@@ -87,7 +87,7 @@ async def _(
|
|||||||
|
|
||||||
async def write_cache(path: FilePath, data: bytes) -> None:
|
async def write_cache(path: FilePath, data: bytes) -> None:
|
||||||
path.parent.mkdir(parents=True, exist_ok=True)
|
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)
|
await file.write(data)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 ..config.config import config
|
||||||
from .browser import BrowserManager
|
from .browser import BrowserManager
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from shutil import rmtree
|
|||||||
from time import time_ns
|
from time import time_ns
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from aiofiles import open
|
from aiofiles import open as aopen
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
from nonebot import get_driver
|
from nonebot import get_driver
|
||||||
from nonebot.log import logger
|
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',
|
f'https://github.com/A-Minos/tetris-stats-templates/releases/download/{tag}/dist.zip',
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
) as response,
|
) as response,
|
||||||
open(path, 'wb') as file,
|
aopen(path, 'wb') as file,
|
||||||
):
|
):
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
progress.update(task_id, total=int(response.headers.get('content-length', 0)) or None)
|
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():
|
if not file_path.is_file():
|
||||||
logger.error(f'{file_path.name} 不存在或不是文件')
|
logger.error(f'{file_path.name} 不存在或不是文件')
|
||||||
return False
|
return False
|
||||||
async with open(file_path, 'rb') as file:
|
async with aopen(file_path, 'rb') as file:
|
||||||
while True:
|
while True:
|
||||||
chunk = await file.read(65535)
|
chunk = await file.read(65535)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ select = [
|
|||||||
]
|
]
|
||||||
ignore = [
|
ignore = [
|
||||||
"E501", # 过长的行由 ruff format 处理, 剩余的都是字符串
|
"E501", # 过长的行由 ruff format 处理, 剩余的都是字符串
|
||||||
"ANN101", # 由 type checker 自动推断
|
|
||||||
"ANN102", # 由 type checker 自动推断
|
|
||||||
"ANN202", # 向 NoneBot 注册的函数
|
"ANN202", # 向 NoneBot 注册的函数
|
||||||
"TRY003",
|
"TRY003",
|
||||||
"COM812", # 强制尾随逗号
|
"COM812", # 强制尾随逗号
|
||||||
|
|||||||
Reference in New Issue
Block a user