Skip to content

Commit c094f18

Browse files
authored
commit 5
1 parent e59db18 commit c094f18

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

stdlib/typing.pyi

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,10 @@ _FT = TypeVar("_FT", bound=Callable[..., Any] | type)
411411

412412
# These type variables are used by the container types.
413413
_S = TypeVar("_S")
414-
_KT = TypeVar("_KT") # Key type.
414+
_KT = TypeVar("_KT", bound=Hashable) # Key type.
415415
_VT = TypeVar("_VT") # Value type.
416416
_T_co = TypeVar("_T_co", covariant=True) # Any type covariant containers.
417-
_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers.
417+
_KT_co = TypeVar("_KT_co", bound=Hashable, covariant=True) # Key type covariant containers.
418418
_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
419419
_TC = TypeVar("_TC", bound=type[object])
420420

@@ -713,37 +713,37 @@ class MutableSequence(Sequence[_T]):
713713
def remove(self, value: _T, /) -> None: ...
714714
def __iadd__(self, values: Iterable[_T], /) -> typing_extensions.Self: ...
715715

716-
class AbstractSet(Collection[_T_co]):
716+
class AbstractSet(Collection[_KT_co]):
717717
@abstractmethod
718718
def __contains__(self, x: object, /) -> bool: ...
719719
def _hash(self) -> int: ...
720720
# Mixin methods
721721
@classmethod
722-
def _from_iterable(cls, it: Iterable[_S], /) -> AbstractSet[_S]: ...
723-
def __le__(self, other: AbstractSet[Any], /) -> bool: ...
724-
def __lt__(self, other: AbstractSet[Any], /) -> bool: ...
725-
def __gt__(self, other: AbstractSet[Any], /) -> bool: ...
726-
def __ge__(self, other: AbstractSet[Any], /) -> bool: ...
727-
def __and__(self, other: AbstractSet[Any], /) -> AbstractSet[_T_co]: ...
728-
def __or__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ...
729-
def __sub__(self, other: AbstractSet[Any], /) -> AbstractSet[_T_co]: ...
730-
def __xor__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ...
722+
def _from_iterable(cls, it: Iterable[_KT_co], /) -> AbstractSet[_KT_co]: ...
723+
def __le__(self, other: AbstractSet[Hashable], /) -> bool: ...
724+
def __lt__(self, other: AbstractSet[Hashable], /) -> bool: ...
725+
def __gt__(self, other: AbstractSet[Hashable], /) -> bool: ...
726+
def __ge__(self, other: AbstractSet[Hashable], /) -> bool: ...
727+
def __and__(self, other: AbstractSet[Hashable], /) -> AbstractSet[_KT_co]: ...
728+
def __or__(self, other: AbstractSet[_KT], /) -> AbstractSet[_KT_co | _KT]: ...
729+
def __sub__(self, other: AbstractSet[Hashable], /) -> AbstractSet[_T_co]: ...
730+
def __xor__(self, other: AbstractSet[_KT], /) -> AbstractSet[_KT_co | _KT]: ...
731731
def __eq__(self, other: object, /) -> bool: ...
732-
def isdisjoint(self, other: Iterable[Any], /) -> bool: ...
732+
def isdisjoint(self, other: Iterable[Hashable], /) -> bool: ...
733733

734-
class MutableSet(AbstractSet[_T]):
734+
class MutableSet(AbstractSet[_KT]):
735735
@abstractmethod
736-
def add(self, value: _T, /) -> None: ...
736+
def add(self, value: _KT, /) -> None: ...
737737
@abstractmethod
738-
def discard(self, value: _T, /) -> None: ...
738+
def discard(self, value: _KT, /) -> None: ...
739739
# Mixin methods
740740
def clear(self) -> None: ...
741-
def pop(self) -> _T: ...
742-
def remove(self, value: _T, /) -> None: ...
743-
def __ior__(self, it: AbstractSet[_T], /) -> typing_extensions.Self: ... # type: ignore[override,misc]
744-
def __iand__(self, it: AbstractSet[Any], /) -> typing_extensions.Self: ...
745-
def __ixor__(self, it: AbstractSet[_T], /) -> typing_extensions.Self: ... # type: ignore[override,misc]
746-
def __isub__(self, it: AbstractSet[Any], /) -> typing_extensions.Self: ...
741+
def pop(self) -> _KT: ...
742+
def remove(self, value: _KT, /) -> None: ...
743+
def __ior__(self, it: AbstractSet[_KT], /) -> typing_extensions.Self: ... # type: ignore[override,misc]
744+
def __iand__(self, it: AbstractSet[Hashable], /) -> typing_extensions.Self: ...
745+
def __ixor__(self, it: AbstractSet[_KT], /) -> typing_extensions.Self: ... # type: ignore[override,misc]
746+
def __isub__(self, it: AbstractSet[Hashable], /) -> typing_extensions.Self: ...
747747

748748
class MappingView(Sized):
749749
__slots__ = ("_mapping",)

0 commit comments

Comments
 (0)