Skip to content
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
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