Feature: 添加遗漏的类型标注 (#2856)

This commit is contained in:
Ju4tCode
2024-08-06 14:19:17 +08:00
committed by GitHub
parent 976c1cd8e0
commit c97a780645
5 changed files with 36 additions and 36 deletions

View File

@ -76,7 +76,7 @@ T = TypeVar("T")
current_bot: ContextVar[Bot] = ContextVar("current_bot")
current_event: ContextVar[Event] = ContextVar("current_event")
current_matcher: ContextVar["Matcher"] = ContextVar("current_matcher")
current_handler: ContextVar[Dependent] = ContextVar("current_handler")
current_handler: ContextVar[Dependent[Any]] = ContextVar("current_handler")
@dataclass

View File

@ -102,7 +102,7 @@ class DependParam(Param):
"""
def __init__(
self, *args, dependent: Dependent, use_cache: bool, **kwargs: Any
self, *args, dependent: Dependent[Any], use_cache: bool, **kwargs: Any
) -> None:
super().__init__(*args, **kwargs)
self.dependent = dependent
@ -114,7 +114,7 @@ class DependParam(Param):
@classmethod
def _from_field(
cls,
sub_dependent: Dependent,
sub_dependent: Dependent[Any],
use_cache: bool,
validate: Union[bool, PydanticFieldInfo],
) -> Self:
@ -190,7 +190,7 @@ class DependParam(Param):
use_cache: bool = self.use_cache
dependency_cache = {} if dependency_cache is None else dependency_cache
sub_dependent: Dependent = self.dependent
sub_dependent = self.dependent
call = cast(Callable[..., Any], sub_dependent.call)
# solve sub dependency with current cache