8000 gh-98500: Fix typing docs for `*View` classes by sobolevn · Pull Request #98511 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-98500: Fix typing docs for *View classes #98511

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Changes from 1 commit
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
Next Next commit
gh-98500: Fix typing docs for *View classes
  • Loading branch information
sobolevn committed Oct 21, 2022
commit b51d6183826330689fc9294833f10c285bbb1f8e
8 changes: 4 additions & 4 deletions Doc/library/typing.rst
Original file line number D 8000 iff line number Diff line change
Expand Up @@ -2096,15 +2096,15 @@ Corresponding to collections in :mod:`collections.abc`
:class:`collections.abc.Container` now supports ``[]``. See :pep:`585`
and :ref:`types-genericalias`.

.. class:: ItemsView(MappingView, Generic[KT_co, VT_co])
.. class:: ItemsView(MappingView, AbstractSet[tuple[KT_co, VT_co]], Generic[KT_co, VT_co])
Copy link
Member

Choose a reason for hiding this comment

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

Generic is redundant as a base class, because there is a generic base. Other classes nearby don't list Generic as an explicit base, so these ones shouldn't either.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I feel like the fact that so many typeshed classes do this in the stubs is something of a legacy thing (though some may prefer it for added explicitness).

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!


A generic version of :class:`collections.abc.ItemsView`.

.. deprecated:: 3.9
:class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585`
and :ref:`types-genericalias`.

.. class:: KeysView(MappingView[KT_co], AbstractSet[KT_co])
.. class:: KeysView(MappingView, AbstractSet[KT_co], Generic[KT_co])

A generic version of :class:`collections.abc.KeysView`.

Expand All @@ -2124,7 +2124,7 @@ Corresponding to collections in :mod:`collections.abc`
:class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585`
and :ref:`types-genericalias`.

.. class:: MappingView(Sized, Iterable[T_co])
.. class:: MappingView(Sized)

A generic version of :class:`collections.abc.MappingView`.

Expand Down Expand Up @@ -2164,7 +2164,7 @@ Corresponding to collections in :mod:`collections.abc`
:class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585`
and :ref:`types-genericalias`.

.. class:: ValuesView(MappingView[VT_co])
.. class:: ValuesView(MappingView, Collection[_VT_co], Generic[_VT_co])

A generic version of :class:`collections.abc.ValuesView`.

Expand Down
0