Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ class AbstractSet(Collection[_T_co]):
def __contains__(self, x: object) -> bool: ...
def _hash(self) -> int: ...
# Mixin methods
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> AbstractSet[_S]: ...
Comment on lines +707 to +708
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> AbstractSet[_S]: ...
if not TYPE_CHECKING:
# this method exists on collections.abc.Set, but since it is not
# supported by builtins.set, we exclude it from static typing
# see: cpython/issues/144557 and typeshed/issues/15298
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> AbstractSet[_S]: ...

def __le__(self, other: AbstractSet[Any]) -> bool: ...
def __lt__(self, other: AbstractSet[Any]) -> bool: ...
def __gt__(self, other: AbstractSet[Any]) -> bool: ...
Expand Down Expand Up @@ -736,6 +738,8 @@ class MappingView(Sized):

class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):
def __init__(self, mapping: SupportsGetItemViewable[_KT_co, _VT_co]) -> None: ... # undocumented
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...
Comment on lines +741 to +742
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...
if not TYPE_CHECKING:
# this method exists on collections.abc.ItemsView, but since it is not
# supported by dict_items, we exclude it from static typing
# see: cpython/issues/144557 and typeshed/issues/15298
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...

def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, item: tuple[object, object]) -> bool: ... # type: ignore[override]
Expand All @@ -749,6 +753,8 @@ class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co,

class KeysView(MappingView, AbstractSet[_KT_co]):
def __init__(self, mapping: Viewable[_KT_co]) -> None: ... # undocumented
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...
Comment on lines +756 to +757
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...
if not TYPE_CHECKING:
# this method exists on collections.abc.KeysView, but since it is not
# supported by dict_keys, we exclude it from static typing
# see: cpython/issues/144557 and typeshed/issues/15298
@classmethod
def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ...

def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ...
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, key: object) -> bool: ...
Expand Down