Fix MutableMapping overrides (#6352)

This commit is contained in:
Sebastian Rittau
2021-11-21 16:04:40 +01:00
committed by GitHub
parent a6e369906d
commit 5b668419ae
2 changed files with 11 additions and 1 deletions

View File

@@ -1,9 +1,10 @@
from _typeshed import IdentityFunction
from collections.abc import Iterator, Sequence
from typing import Any, Callable, ContextManager, Generic, MutableMapping, TypeVar
from typing import Any, Callable, ContextManager, Generic, MutableMapping, TypeVar, overload
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
@@ -12,6 +13,11 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, key: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...
@overload # type: ignore[override]
def pop(self, key: _KT) -> _VT: ...
@overload
def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ...
def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ...
@property
def maxsize(self) -> float: ...
@property

View File

@@ -102,6 +102,10 @@ google.protobuf.internal.containers.BaseContainer.sort
google.protobuf.internal.containers.Mapping
google.protobuf.internal.containers.MessageMap.__init__
google.protobuf.internal.containers.MessageMap.get
google.protobuf.internal.containers.MutableMapping.__delitem__
google.protobuf.internal.containers.MutableMapping.__setitem__
google.protobuf.internal.containers.MutableMapping.pop
google.protobuf.internal.containers.MutableMapping.setdefault
google.protobuf.internal.containers.RepeatedCompositeFieldContainer.__init__
google.protobuf.internal.containers.RepeatedScalarFieldContainer.__init__
google.protobuf.internal.containers.ScalarMap.__init__