diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2483882..8d13b3a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,19 +7,19 @@ ci: autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" repos: - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 6.0.0 hooks: - id: isort stages: [pre-commit] - repo: https://github.com/psf/black - rev: 24.10.0 + rev: 25.1.0 hooks: - id: black stages: [pre-commit] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.4 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/src/nonebot_plugin_alconna/pattern.py b/src/nonebot_plugin_alconna/pattern.py index 9f88071..9767464 100644 --- a/src/nonebot_plugin_alconna/pattern.py +++ b/src/nonebot_plugin_alconna/pattern.py @@ -124,14 +124,14 @@ def converter(self, _seg: Segment): @deprecated("Use `select().first` instead.") def select_first( - seg: Union[type[segment.TS], BasePattern[segment.TS, Segment, Any]] + seg: Union[type[segment.TS], BasePattern[segment.TS, Segment, Any]], ) -> BasePattern[segment.TS, Segment, Literal[MatchMode.TYPE_CONVERT]]: return select(seg).first @deprecated("Use `select().last` instead.") def select_last( - seg: Union[type[segment.TS], BasePattern[segment.TS, Segment, Any]] + seg: Union[type[segment.TS], BasePattern[segment.TS, Segment, Any]], ) -> BasePattern[segment.TS, Segment, Literal[MatchMode.TYPE_CONVERT]]: return select(seg).last diff --git a/src/nonebot_plugin_alconna/uniseg/exporter.py b/src/nonebot_plugin_alconna/uniseg/exporter.py index d085605..ca072e4 100644 --- a/src/nonebot_plugin_alconna/uniseg/exporter.py +++ b/src/nonebot_plugin_alconna/uniseg/exporter.py @@ -103,19 +103,19 @@ async def _auto_fallback(seg: Segment, bot: Union[Bot, None]): @overload def export( - func: Callable[[Any, TS, Union[Bot, None]], Awaitable[TMS]] + func: Callable[[Any, TS, Union[Bot, None]], Awaitable[TMS]], ) -> Callable[[Any, TS, Union[Bot, None]], Awaitable[TMS]]: ... @overload def export( - func: Callable[[Any, TS, Union[Bot, None]], Awaitable[list[TMS]]] + func: Callable[[Any, TS, Union[Bot, None]], Awaitable[list[TMS]]], ) -> Callable[[Any, TS, Union[Bot, None]], Awaitable[list[TMS]]]: ... @overload def export( - func: Callable[[Any, TS, Union[Bot, None]], Awaitable[Union[TMS, list[TMS]]]] + func: Callable[[Any, TS, Union[Bot, None]], Awaitable[Union[TMS, list[TMS]]]], ) -> Callable[[Any, TS, Union[Bot, None]], Awaitable[Union[TMS, list[TMS]]]]: ... @@ -124,7 +124,7 @@ def export( Callable[[Any, TS, Union[Bot, None]], Awaitable[TMS]], Callable[[Any, TS, Union[Bot, None]], Awaitable[list[TMS]]], Callable[[Any, TS, Union[Bot, None]], Awaitable[Union[TMS, list[TMS]]]], - ] + ], ): sig = inspect.signature(func) func.__export_target__ = sig.parameters["seg"].annotation diff --git a/src/nonebot_plugin_alconna/uniseg/segment.py b/src/nonebot_plugin_alconna/uniseg/segment.py index 4b76e70..86da02c 100644 --- a/src/nonebot_plugin_alconna/uniseg/segment.py +++ b/src/nonebot_plugin_alconna/uniseg/segment.py @@ -1038,7 +1038,7 @@ def _handler( ["MessageExporter", TS, Union[Bot, None], Union[bool, FallbackStrategy]], Awaitable[list[MessageSegment]], ], - ] + ], ): cls.EXPORTERS[custom_type] = func # type: ignore return func diff --git a/tests/test_buttons.py b/tests/test_buttons.py index 38061d6..a521106 100644 --- a/tests/test_buttons.py +++ b/tests/test_buttons.py @@ -95,7 +95,9 @@ async def _(row: int): ) async with app.test_matcher(matcher) as ctx: - from nonebot.adapters.qq.models import Action + from nonebot.adapters.qq.models import ( + Action, + ) from nonebot.adapters.qq.models import Button as QQButton from nonebot.adapters.qq import Bot, Adapter, Message, MessageSegment from nonebot.adapters.qq.models import ( diff --git a/tests/test_qq.py b/tests/test_qq.py index 48bb351..1d8c839 100644 --- a/tests/test_qq.py +++ b/tests/test_qq.py @@ -4,7 +4,9 @@ from nonebug import App from arclet.alconna import Args, Alconna from nonebot import on_message, get_adapter -from nonebot.adapters.qq.models import Action +from nonebot.adapters.qq.models import ( + Action, +) from nonebot.adapters.qq.models import Button as QQButton from nonebot.adapters.qq import Bot, Adapter, Message, MessageSegment from nonebot.adapters.qq.models import (