Skip to content

Commit 4c4d560

Browse files
committed
Add typeguards to __contains__ methods
1 parent 843c1fd commit 4c4d560

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/typing.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ class Sequence(Reversible[_T_co], Collection[_T_co]):
665665
# Mixin methods
666666
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
667667
def count(self, value: Any, /) -> int: ...
668-
def __contains__(self, value: object, /) -> bool: ...
668+
def __contains__(self, value: object, /) -> TypeGuard[_T_co]: ...
669669
def __iter__(self) -> Iterator[_T_co]: ...
670670
def __reversed__(self) -> Iterator[_T_co]: ...
671671

@@ -791,7 +791,7 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
791791
def items(self) -> ItemsView[_KT, _VT_co]: ...
792792
def keys(self) -> KeysView[_KT]: ...
793793
def values(self) -> ValuesView[_VT_co]: ...
794-
def __contains__(self, key: object, /) -> bool: ...
794+
def __contains__(self, key: object, /) -> TypeGuard[_KT]: ...
795795
def __eq__(self, other: object, /) -> bool: ...
796796

797797
class MutableMapping(Mapping[_KT, _VT]):

0 commit comments

Comments
 (0)