Skip to content
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

gh-101100: Fix most Sphinx nitpicks in the glossary and stdtypes.rst #112757

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Dec 5, 2023

This doesn't get rid of all the Sphinx warnings in either file (there are some tricky ones in both that I'd rather defer for now), but it gets rid of most in both.


📚 Documentation preview 📚: https://cpython-previews--112757.org.readthedocs.build/

Comment on lines +5241 to +5242
The :meth:`!__or__` method for type objects was added to support the syntax
``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may
Copy link
Member Author

Choose a reason for hiding this comment

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

I considered linking to https://docs.python.org/3/reference/datamodel.html#object.__or__, but the data model only discusses implementing __or__ in the context of emulating numeric types, and that's pretty distinct to the purpose of type.__or__

@@ -383,7 +385,7 @@ Glossary

file object
An object exposing a file-oriented API (with methods such as
:meth:`read()` or :meth:`write()`) to an underlying resource. Depending
:meth:`!read` or :meth:`!write`) to an underlying resource. Depending
Copy link
Member

Choose a reason for hiding this comment

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

It can refer to io.BaseIO.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure there's anything we could specifically link to for either method. io.IOBase does not have read() or write() as abstract methods, so neither IOBase.read nor IOBase.write is explicitly documented currently.

https://docs.python.org/3/library/io.html#io.IOBase

Here's all the IOBase docs say on read and write:

Even though IOBase does not declare read() or write() because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise a ValueError (or UnsupportedOperation) when operations they do not support are called.

Specific subclasses of IOBase implement versions of read and write that either only work with raw binary streams or only work with text streams

Copy link
Member

Choose a reason for hiding this comment

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

Well, and there is a reason to not declare them there. But there are many other references to read and write. It would be nice to have the general interface of them be documented somewhere. It is a different issue.

@@ -383,7 +385,7 @@ Glossary

file object
An object exposing a file-oriented API (with methods such as
:meth:`read()` or :meth:`write()`) to an underlying resource. Depending
:meth:`!read` or :meth:`!write`) to an underlying resource. Depending
Copy link
Member

Choose a reason for hiding this comment

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

Well, and there is a reason to not declare them there. But there are many other references to read and write. It would be nice to have the general interface of them be documented somewhere. It is a different issue.

@AlexWaygood AlexWaygood merged commit e3f670e into python:main Dec 6, 2023
25 checks passed
@AlexWaygood AlexWaygood deleted the sphinx-glossary-stdtypes branch December 6, 2023 08:44
@miss-islington-app
Copy link

Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 6, 2023
…es.rst` (pythonGH-112757)

(cherry picked from commit e3f670e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 6, 2023

GH-112789 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Dec 6, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 6, 2023
…es.rst` (pythonGH-112757)

(cherry picked from commit e3f670e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 6, 2023

GH-112790 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Dec 6, 2023
AlexWaygood added a commit that referenced this pull request Dec 6, 2023
…pes.rst` (GH-112757) (#112789)

gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (GH-112757)
(cherry picked from commit e3f670e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
AlexWaygood added a commit that referenced this pull request Dec 6, 2023
…pes.rst` (GH-112757) (#112790)

gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (GH-112757)
(cherry picked from commit e3f670e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants