mirror of
https://github.com/nonebot/nonebot2.git
synced 2026-02-26 20:54:44 +00:00
💥 Remove: 移除 Python 3.9 支持 (#3860)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from collections.abc import Iterable, Mapping
|
||||
from typing import Optional, Union
|
||||
from typing_extensions import override
|
||||
|
||||
from pydantic import create_model
|
||||
@@ -60,7 +59,7 @@ class FakeMessage(Message[FakeMessageSegment]):
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def _construct(msg: Union[str, Iterable[Mapping]]):
|
||||
def _construct(msg: str | Iterable[Mapping]):
|
||||
if isinstance(msg, str):
|
||||
yield FakeMessageSegment.text(msg)
|
||||
else:
|
||||
@@ -69,21 +68,19 @@ class FakeMessage(Message[FakeMessageSegment]):
|
||||
return
|
||||
|
||||
@override
|
||||
def __add__(
|
||||
self, other: Union[str, FakeMessageSegment, Iterable[FakeMessageSegment]]
|
||||
):
|
||||
def __add__(self, other: str | FakeMessageSegment | Iterable[FakeMessageSegment]):
|
||||
other = escape_text(other) if isinstance(other, str) else other
|
||||
return super().__add__(other)
|
||||
|
||||
|
||||
def make_fake_event(
|
||||
_base: Optional[type[Event]] = None,
|
||||
_base: type[Event] | None = None,
|
||||
_type: str = "message",
|
||||
_name: str = "test",
|
||||
_description: str = "test",
|
||||
_user_id: Optional[str] = "test",
|
||||
_session_id: Optional[str] = "test",
|
||||
_message: Optional[Message] = None,
|
||||
_user_id: str | None = "test",
|
||||
_session_id: str | None = "test",
|
||||
_message: Message | None = None,
|
||||
_to_me: bool = True,
|
||||
**fields,
|
||||
) -> type[Event]:
|
||||
|
||||
Reference in New Issue
Block a user