Reduce use of deprecated typing aliases (#6358)

This commit is contained in:
Alex Waygood
2021-11-23 09:56:43 +00:00
committed by GitHub
parent 7e836db2f3
commit c685c2d6c6
19 changed files with 64 additions and 61 deletions

View File

@@ -1,6 +1,7 @@
from _typeshed import IdentityFunction
from collections.abc import Iterator, Sequence
from typing import Any, Callable, ContextManager, Generic, MutableMapping, TypeVar, overload
from contextlib import AbstractContextManager
from typing import Any, Callable, Generic, MutableMapping, TypeVar, overload
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
@@ -57,10 +58,10 @@ class TTLCache(Cache[_KT, _VT]):
def expire(self, time: float | None = ...) -> None: ...
def cached(
cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: ContextManager[Any] | None = ...
cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: AbstractContextManager[Any] | None = ...
) -> IdentityFunction: ...
def cachedmethod(
cache: Callable[[Any], MutableMapping[_KT, Any] | None],
key: Callable[..., _KT] = ...,
lock: Callable[[Any], ContextManager[Any]] | None = ...,
lock: Callable[[Any], AbstractContextManager[Any]] | None = ...,
) -> IdentityFunction: ...