💥 Remove: 移除 Python 3.9 支持 (#3860)

This commit is contained in:
呵呵です
2026-02-18 00:11:36 +08:00
committed by GitHub
parent f719a6b41b
commit 63cde5da77
56 changed files with 603 additions and 1144 deletions

View File

@@ -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]: