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,4 +1,4 @@
|
||||
from typing import TypeVar, Union
|
||||
from typing import TypeVar
|
||||
|
||||
from nonebot.adapters import Bot
|
||||
|
||||
@@ -28,7 +28,7 @@ async def sub_bot(b: FooBot) -> FooBot:
|
||||
class BarBot(Bot): ...
|
||||
|
||||
|
||||
async def union_bot(b: Union[FooBot, BarBot]) -> Union[FooBot, BarBot]:
|
||||
async def union_bot(b: FooBot | BarBot) -> FooBot | BarBot:
|
||||
return b
|
||||
|
||||
|
||||
@@ -46,4 +46,4 @@ async def generic_bot_none(b: CB) -> CB:
|
||||
return b
|
||||
|
||||
|
||||
async def not_bot(b: Union[int, Bot]): ...
|
||||
async def not_bot(b: int | Bot): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import TypeVar, Union
|
||||
from typing import TypeVar
|
||||
|
||||
from nonebot.adapters import Event, Message
|
||||
from nonebot.params import EventMessage, EventPlainText, EventToMe, EventType
|
||||
@@ -29,7 +29,7 @@ async def sub_event(e: FooEvent) -> FooEvent:
|
||||
class BarEvent(Event): ...
|
||||
|
||||
|
||||
async def union_event(e: Union[FooEvent, BarEvent]) -> Union[FooEvent, BarEvent]:
|
||||
async def union_event(e: FooEvent | BarEvent) -> FooEvent | BarEvent:
|
||||
return e
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ async def generic_event_none(e: CE) -> CE:
|
||||
return e
|
||||
|
||||
|
||||
async def not_event(e: Union[int, Event]): ...
|
||||
async def not_event(e: int | Event): ...
|
||||
|
||||
|
||||
async def event_type(t: str = EventType()) -> str:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from typing import Union
|
||||
|
||||
|
||||
async def exc(e: Exception, x: Union[ValueError, TypeError]) -> Exception:
|
||||
async def exc(e: Exception, x: ValueError | TypeError) -> Exception:
|
||||
assert e == x
|
||||
return e
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, TypeVar, Union
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from nonebot.adapters import Event
|
||||
from nonebot.matcher import Matcher
|
||||
@@ -36,8 +36,8 @@ class BarMatcher(Matcher): ...
|
||||
|
||||
|
||||
async def union_matcher(
|
||||
m: Union[FooMatcher, BarMatcher],
|
||||
) -> Union[FooMatcher, BarMatcher]:
|
||||
m: FooMatcher | BarMatcher,
|
||||
) -> FooMatcher | BarMatcher:
|
||||
return m
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ async def generic_matcher_none(m: CM) -> CM:
|
||||
return m
|
||||
|
||||
|
||||
async def not_matcher(m: Union[int, Matcher]): ...
|
||||
async def not_matcher(m: int | Matcher): ...
|
||||
|
||||
|
||||
async def receive(e: Event = Received("test")) -> Event:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Optional
|
||||
|
||||
from nonebot.adapters import Bot, Event, Message
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.params import Arg, Depends
|
||||
@@ -12,11 +10,11 @@ def dependency():
|
||||
|
||||
async def complex_priority(
|
||||
sub: int = Depends(dependency),
|
||||
bot: Optional[Bot] = None,
|
||||
event: Optional[Event] = None,
|
||||
bot: Bot | None = None,
|
||||
event: Event | None = None,
|
||||
state: T_State = {},
|
||||
matcher: Optional[Matcher] = None,
|
||||
matcher: Matcher | None = None,
|
||||
arg: Message = Arg(),
|
||||
exception: Optional[Exception] = None,
|
||||
exception: Exception | None = None,
|
||||
default: int = 1,
|
||||
): ...
|
||||
|
||||
Reference in New Issue
Block a user