With this PR #14574, the previous Mapping annotation for the internal mapping attribute of KeysView seems to have been changed to a Viewable protocol:
# Suitable for dictionary view objectsclassViewable(Protocol[_T_co]):
def__len__(self) ->int: ...
def__iter__(self) ->Iterator[_T_co]: ...
I was comparing this against CPython's collections.abc
classKeysView(MappingView, Set):
__slots__= ()
@classmethoddef_from_iterable(cls, it):
returnset(it)
def__contains__(self, key):
returnkeyinself._mappingdef__iter__(self):
yieldfromself._mapping
and it appears that self._mapping has now lost the __contains__ (which was previously guaranteed by Mapping). Wanted to raise it here.
With this PR #14574, the previous
Mappingannotation for the internal mapping attribute ofKeysViewseems to have been changed to aViewableprotocol:I was comparing this against CPython's collections.abc
and it appears that
self._mappinghas now lost the__contains__(which was previously guaranteed byMapping). Wanted to raise it here.