mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Fix false positive with calling .register() on KeysView subclass (#9348)
* Revert "`Collection` is `Sized` (#8977)" This reverts commit5bbba5d008. * Revert "typing: remove metaclass from Sized (#9058)" This reverts commita3ce512095. * Add regression test for issue 9296.
This commit is contained in:
@@ -325,7 +325,7 @@ class SupportsRound(Protocol[_T_co]):
|
||||
def __round__(self, __ndigits: int) -> _T_co: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Sized(Protocol):
|
||||
class Sized(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -452,7 +452,10 @@ class Container(Protocol[_T_co]):
|
||||
def __contains__(self, __x: object) -> bool: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ...
|
||||
class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user