Improve contextvars.Context not to use Any where possible (#6942)

This commit is contained in:
Nikita Sobolev
2022-01-18 01:56:04 +03:00
committed by GitHub
parent 18d746b6b0
commit 61d876e4ea

View File

@@ -38,11 +38,11 @@ def copy_context() -> Context: ...
class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...
@overload
def get(self, __key: ContextVar[Any]) -> Any | None: ...
def get(self, __key: ContextVar[_T]) -> _T | None: ...
@overload
def get(self, __key: ContextVar[Any], __default: Any | None) -> Any: ...
def get(self, __key: ContextVar[_T], __default: _D) -> _T | _D: ...
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
def copy(self) -> Context: ...
def __getitem__(self, key: ContextVar[Any]) -> Any: ...
def __getitem__(self, key: ContextVar[_T]) -> _T: ...
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
def __len__(self) -> int: ...