From 939e119a635484fde9086d9679a174772eb527ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:47:30 +0000 Subject: [PATCH] :rotating_light: auto fix by pre-commit hooks --- src/nonebot_plugin_alconna/pattern.py | 4 ++-- src/nonebot_plugin_alconna/uniseg/exporter.py | 8 ++++---- src/nonebot_plugin_alconna/uniseg/segment.py | 2 +- tests/test_buttons.py | 4 +++- tests/test_qq.py | 4 +++- 5 files changed, 13 insertions(+), 9 deletions(-) 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 (