mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 00:31:14 +00:00
🎨 change typing for formatter
This commit is contained in:
@ -8,19 +8,19 @@
|
||||
import abc
|
||||
import asyncio
|
||||
from copy import deepcopy
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from functools import partial
|
||||
from typing import (Any, Dict, Generic, Iterable, List, Mapping, Optional, Set,
|
||||
Tuple, Type, TypeVar, Union)
|
||||
from typing_extensions import Protocol
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from typing import (Any, Set, List, Dict, Type, Tuple, Union, TypeVar, Mapping,
|
||||
Generic, Optional, Iterable)
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from nonebot.config import Config
|
||||
from nonebot.drivers import Driver, HTTPConnection, HTTPResponse
|
||||
from nonebot.log import logger
|
||||
from nonebot.typing import T_CalledAPIHook, T_CallingAPIHook
|
||||
from nonebot.config import Config
|
||||
from nonebot.utils import DataclassEncoder
|
||||
from nonebot.typing import T_CallingAPIHook, T_CalledAPIHook
|
||||
from nonebot.drivers import Driver, HTTPConnection, HTTPResponse
|
||||
|
||||
from ._formatter import MessageFormatter
|
||||
|
||||
@ -332,7 +332,9 @@ class Message(List[TMS], abc.ABC):
|
||||
self.extend(self._construct(message))
|
||||
|
||||
@classmethod
|
||||
def template(cls: Type[TM], format_string: str) -> MessageFormatter[TM]:
|
||||
def template(
|
||||
cls: Type[TM],
|
||||
format_string: str) -> MessageFormatter[TM, TMS]: # type: ignore
|
||||
return MessageFormatter(cls, format_string)
|
||||
|
||||
@classmethod
|
||||
|
Reference in New Issue
Block a user