Skip to content

Commit

Permalink
🎨 format
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Jun 16, 2024
1 parent 8a1b0a8 commit 3a649d3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/builtins/plugins/echo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
from arclet.alconna import CommandMeta, namespace
from nonebot.plugin import PluginMetadata, inherit_supported_adapters

from nonebot_plugin_alconna import Command
from nonebot_plugin_alconna.builtins.extensions.reply import ReplyMergeExtension
Expand Down
5 changes: 3 additions & 2 deletions src/nonebot_plugin_alconna/builtins/plugins/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from pathlib import Path

from tarina import lang
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
from nonebot.adapters import Bot
from importlib_metadata import PackageNotFoundError, distribution
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
from arclet.alconna import Args, Field, Option, Alconna, Arparma, CommandMeta, namespace, store_true, command_manager
from nonebot.adapters import Bot

from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, referent, on_alconna

__plugin_meta__ = PluginMetadata(
Expand Down
3 changes: 2 additions & 1 deletion src/nonebot_plugin_alconna/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from weakref import ReferenceType
from typing_extensions import NotRequired
from typing import Union, Generic, Literal, TypeVar, Optional, TypedDict
from weakref import ReferenceType

from pydantic import Field, BaseModel
from arclet.alconna import Empty, Alconna, Arparma
from arclet.alconna.duplication import Duplication
Expand Down
7 changes: 5 additions & 2 deletions src/nonebot_plugin_alconna/rule.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import asyncio
import weakref
import importlib
from typing import Union, Literal, Optional, cast
import weakref

from nonebot.typing import T_State
from tarina import lang, init_spec
from nonebot.matcher import Matcher
Expand Down Expand Up @@ -179,7 +180,9 @@ def __eq__(self, other: object) -> bool:
def __hash__(self) -> int:
return hash(self.command.__hash__())

async def handle(self, cmd: Alconna, bot: Bot, event: Event, state: T_State, msg: UniMessage) -> Union[Arparma, Literal[False]]:
async def handle(
self, cmd: Alconna, bot: Bot, event: Event, state: T_State, msg: UniMessage
) -> Union[Arparma, Literal[False]]:
ctx = await self.executor.context_provider(event, bot, state)
if self.comp_config is None:
return cmd.parse(msg, ctx)
Expand Down
4 changes: 2 additions & 2 deletions src/nonebot_plugin_alconna/uniseg/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from dataclasses import dataclass
from collections.abc import Iterable
from typing_extensions import Self, SupportsIndex
from typing import TYPE_CHECKING, Any, Union, Literal, TypeVar, NoReturn, Optional, overload, Callable
from typing import TYPE_CHECKING, Any, Union, Literal, TypeVar, Callable, NoReturn, Optional, overload

from tarina import lang
from tarina.lang.model import LangItem
from nepattern import parser
from tarina.lang.model import LangItem
from nonebot.exception import FinishedException
from nonebot.internal.adapter import Bot, Event, Message
from nonebot.internal.matcher import current_bot, current_event
Expand Down
6 changes: 5 additions & 1 deletion tests/test_uniseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def test_unimsg():
)

msg1 = UniMessage.at("123").at_channel("456").at_role("789")
assert repr(msg1) == "[At(flag='user', target='123', display=None), At(flag='channel', target='456', display=None), At(flag='role', target='789', display=None)]"
assert repr(msg1) == (
"[At(flag='user', target='123', display=None), "
"At(flag='channel', target='456', display=None), "
"At(flag='role', target='789', display=None)]"
)
assert msg1.filter(At, lambda x: x.flag == "user") == UniMessage.at("123")


Expand Down

0 comments on commit 3a649d3

Please sign in to comment.