-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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 sphinx warnings in howto/*
#127084
Conversation
Removed sphinx roles of some classes and methods, as the classes are defined in the sample codes, not in Python. Fixed warnings: ``` howto/descriptor.rst:45: WARNING: py:class reference target not found: Ten [ref.class] howto/descriptor.rst:218: WARNING: py:class reference target not found: Person [ref.class] howto/descriptor.rst:218: WARNING: py:class reference target not found: Person [ref.class] howto/descriptor.rst:256: WARNING: py:class reference target not found: Person [ref.class] howto/descriptor.rst:340: WARNING: py:class reference target not found: Validator [ref.class] howto/descriptor.rst:363: WARNING: py:class reference target not found: Validator [ref.class] howto/descriptor.rst:363: WARNING: py:meth reference target not found: validate [ref.meth] howto/descriptor.rst:372: WARNING: py:class reference target not found: OneOf [ref.class] howto/descriptor.rst:374: WARNING: py:class reference target not found: Number [ref.class] howto/descriptor.rst:378: WARNING: py:class reference target not found: String [ref.class] howto/descriptor.rst:876: WARNING: py:class reference target not found: Field [ref.class] howto/descriptor.rst:1143: WARNING: py:func reference target not found: Property [ref.func] howto/descriptor.rst:1725: WARNING: py:class reference target not found: Object [ref.class] howto/enum.rst:78: WARNING: py:class reference target not found: Weekday [ref.class] howto/enum.rst:90: WARNING: py:class reference target not found: Weekday [ref.class] howto/enum.rst:113: WARNING: py:class reference target not found: Weekday [ref.class] howto/enum.rst:131: WARNING: py:class reference target not found: Weekday [ref.class] howto/enum.rst:576: WARNING: py:class reference target not found: Animal [ref.class] howto/enum.rst:893: WARNING: py:class reference target not found: FloatEnum [ref.class] ```
Doc/howto/descriptor.rst
Outdated
@@ -42,7 +42,7 @@ add new capabilities one by one. | |||
Simple example: A descriptor that returns a constant | |||
---------------------------------------------------- | |||
|
|||
The :class:`Ten` class is a descriptor whose :meth:`__get__` method always | |||
The ``Ten`` class is a descriptor whose :meth:`__get__` method always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep the class
role but add an exclamation mark then we keep the formatting of a class but don't try to resolve the reference, and get no warning:
The ``Ten`` class is a descriptor whose :meth:`__get__` method always | |
The :class:`!Ten` class is a descriptor whose :meth:`!__get__` method always |
Re: https://devguide.python.org/documentation/markup/#roles
Same applies to the others in this PR.
And we can also do it for the example __get__
method here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hugovk Fixed class references by using !
prefix. __get__
is documented in https://docs.python.org/3/reference/datamodel.html#object.__get__ , so I think it is better to fix __get__
to ~object.__get__
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__get__
is documented in docs.python.org/3/reference/datamodel.html#object.get , so I think it is better to fix__get__
to~object.__get__
.
Yes, good idea.
howto/*
howto/*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
(cherry picked from commit 733fe59) Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Sorry, @koyuki7w and @hugovk, I could not cleanly backport this to
|
GH-127287 is a backport of this pull request to the 3.13 branch. |
@koyuki7w Please could you take care of the 3.12 backport? Thanks! |
GH-127311 is a backport of this pull request to the 3.12 branch. |
@hugovk Thanks. Opened 3.12 backport PR. |
Removed sphinx roles of some classes and methods, as the classes are defined in the sample codes, not in Python.
Fixed warnings:
📚 Documentation preview 📚: https://cpython-previews--127084.org.readthedocs.build/