-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-101100: Fix sphinx warnings in Doc/library/functools.rst
#136424
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 Doc/library/functools.rst
#136424
Conversation
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.
It would be nice to add index entries and anchors for cache_info
, cache_clear
and register
. You can use :no-typesetting:
for this. For example:
.. method:: cache_info()
:no-typesetting:
Check if this generates a nice index entry.
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.
Thank you for your response.
Please move the definitions immediately above the paragraph that defines the corresponding method. The references can be made inert, e.g. :meth:`!clear_cache`
, because it doesn't make sense to add a link to the same paragraph now.
Also, I think that it is better to add a prefix, e.g. .. method:: functools.cache_info()
. So the index will contain "cache_info() (functools.lru_cache method)" instead of "cache_info() (in module functools)".
We need to add also an index entry for property.setter
, etc, but this is a different issue.
Thank you very much for teaching me this! I update the prefix and move the definitions to the paragraph that defines the corresponding method, also subpress the referrences.
+1, I think we can add index in later issues. |
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.
Please move also .. method:: register()
and add a prefix to it.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Thanks, I will fix it soon. |
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Done, Thanks! |
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.
LGTM. 👍
Thank you for your contribution @LamentXU123.
Thanks @LamentXU123 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…thonGH-136424) Add index entries and anchors for cache_info, cache_clear and register. (cherry picked from commit 252e2f7) Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Sorry, @LamentXU123 and @serhiy-storchaka, I could not cleanly backport this to
|
GH-136552 is a backport of this pull request to the 3.14 branch. |
…rst (pythonGH-136424) Add index entries and anchors for cache_info, cache_clear and register. (cherry picked from commit 252e2f7) Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
GH-136554 is a backport of this pull request to the 3.13 branch. |
…thonGH-136424) Add index entries and anchors for cache_info, cache_clear and register.
before:
This PR fix them all, I will explain all my changes:
link toCreate an index entries and anchor ofcache_info
andcache_clear
are subpressed. Same to the formar subpressed linkcache_parameters
cache_info
andcache_clear
__lt__
,__le__
,__gt__
,__ge__
,__eq__
are magic methods ofobject
. So It's changed to~object.__lt__
, etc.~abc.abstractmethod
register
is actually a function of generic function.Since we don't get a doc about it., the link is supressed.Create an index entries and anchor ofregister
example
is an example function. The link is supressed.Thanks!
The doc preview of this PR on this library: https://cpython-previews--136424.org.readthedocs.build/en/136424/library/functools.html
📚 Documentation preview 📚: https://cpython-previews--136424.org.readthedocs.build/