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
4 changes: 2 additions & 2 deletions alicebot/adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
Callable,
Generic,
Optional,
TypeVar,
Union,
final,
overload,
)
from typing_extensions import TypeVar

import structlog

Expand All @@ -36,7 +36,7 @@
__import__("pkg_resources").declare_namespace(__name__)


_EventT = TypeVar("_EventT", bound="Event[Any]")
_EventT = TypeVar("_EventT", bound="Event[Any]", default="Event[Any]")


class Adapter(Generic[EventT, ConfigT], ABC):
Expand Down
2 changes: 1 addition & 1 deletion alicebot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ async def get(
func: Optional[Callable[[EventT], Union[bool, Awaitable[bool]]]] = None,
*,
event_type: type[EventT],
adapter_type: Optional[type[AdapterT]] = None,
adapter_type: Optional[type[Adapter[Any, Any]]] = None,
max_try_times: Optional[int] = None,
timeout: Optional[Union[int, float]] = None,
) -> EventT: ...
Expand Down
9 changes: 5 additions & 4 deletions alicebot/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# ruff: noqa: A005

from collections.abc import Awaitable
from typing import TYPE_CHECKING, Callable, Optional, TypeVar
from typing import TYPE_CHECKING, Callable, Optional
from typing_extensions import TypeVar

from alicebot.message import BuildMessageType, MessageSegmentT, MessageT

Expand All @@ -33,11 +34,11 @@
"StateT",
]

StateT = TypeVar("StateT")
EventT = TypeVar("EventT", bound="Event[Any]")
EventT = TypeVar("EventT", bound="Event[Any]", default="Event[Any]")
StateT = TypeVar("StateT", default=None)
ConfigT = TypeVar("ConfigT", bound=Optional["ConfigModel"], default=None)
PluginT = TypeVar("PluginT", bound="Plugin[Any, Any, Any]")
AdapterT = TypeVar("AdapterT", bound="Adapter[Any, Any]")
ConfigT = TypeVar("ConfigT", bound=Optional["ConfigModel"])

BotHook = Callable[["Bot"], Awaitable[None]]
AdapterHook = Callable[["Adapter[Any, Any]"], Awaitable[None]]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"aiohttp>=3.8.0,<4.0.0",
"structlog>=25.1.0,<26.0.0",
"rich>=13.7.0,<14.0.0",
"typing-extensions>=4.5.0",
"typing-extensions>=4.12.0,<5.0.0",
"anyio>=4.4.0,<5.0.0",
]

Expand Down
Loading