把typevar这堆改回去(

This commit is contained in:
shenjack 2024-06-10 16:46:07 +08:00
parent fca6b38972
commit fc60e5ad18
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 19 additions and 4 deletions

View File

@ -1,5 +1,13 @@
from ica_typing import IcaNewMessage, IcaClient from typing import TYPE_CHECKING, TypeVar
from ica_typing import TailchatReciveMessage, TailchatClient
if TYPE_CHECKING:
from ica_typing import IcaNewMessage, IcaClient
from ica_typing import TailchatReciveMessage, TailchatClient
else:
IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient")
TailchatReciveMessage = TypeVar("TailchatReciveMessage")
TailchatClient = TypeVar("TailchatClient")
def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None: def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
if not (msg.is_from_self or msg.is_reply): if not (msg.is_from_self or msg.is_reply):

View File

@ -4,9 +4,16 @@ import subprocess
from pathlib import Path from pathlib import Path
from ica_typing import IcaNewMessage, IcaClient, ConfigData from typing import TYPE_CHECKING, TypeVar
CONFIG_DATA: ConfigData if TYPE_CHECKING:
from ica_typing import IcaNewMessage, IcaClient, ConfigData
CONFIG_DATA: ConfigData
else:
CONFIG_DATA = None # type: ignore
IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient")
_version_ = "0.4.2" _version_ = "0.4.2"