Skip to content

Commit

Permalink
🚨 auto fix by pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Feb 4, 2025
1 parent 81d50c7 commit 939e119
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/nonebot_plugin_alconna/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/nonebot_plugin_alconna/uniseg/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]]: ...


Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/uniseg/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/test_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion tests/test_qq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 939e119

Please sign in to comment.