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

Incorrect use of the :class: role with the "()" suffix #120345

Closed
serhiy-storchaka opened this issue Jun 11, 2024 · 2 comments
Closed

Incorrect use of the :class: role with the "()" suffix #120345

serhiy-storchaka opened this issue Jun 11, 2024 · 2 comments
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes docs Documentation in the Doc dir

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jun 11, 2024

There are several uses of the :class: role with the name followed by ().

Doc/tutorial/stdlib2.rst:296:The :mod:`array` module provides an :class:`~array.array()` object that is like
Doc/tutorial/stdlib2.rst:309:The :mod:`collections` module provides a :class:`~collections.deque()` object
Doc/whatsnew/2.5.rst:1727:calling into the interpreter's code.   There's a :class:`py_object()` type
Doc/whatsnew/2.5.rst:1737:Don't forget to use :class:`py_object()`; if it's omitted you end  up with a
Doc/whatsnew/3.12.rst:742:* Add :class:`itertools.batched()` for collecting into even-sized
Doc/howto/descriptor.rst:790:object returned by :class:`super()`.
Doc/library/datetime.rst:2156:   This is called from the default :class:`datetime.astimezone()`
Doc/library/fileinput.rst:50:*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
Doc/library/collections.rst:102:    Note, the iteration order of a :class:`ChainMap()` is determined by

This is incorrect. If we refer to a class as a type, we should not add () to the name. If we refer to it as a callable, we can use the :func: role instead (which adds () automatically). In one place :class: was improperly used for not a class at all.

Linked PRs

@serhiy-storchaka serhiy-storchaka added docs Documentation in the Doc dir 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jun 11, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 11, 2024
…suffix

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
serhiy-storchaka added a commit that referenced this issue Jun 12, 2024
…GH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 12, 2024
…suffix (pythonGH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
(cherry picked from commit 92c9c6a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 12, 2024
…suffix (pythonGH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
(cherry picked from commit 92c9c6a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Jun 12, 2024
… suffix (GH-120347) (GH-120412)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
(cherry picked from commit 92c9c6a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Jun 12, 2024
… suffix (GH-120347) (GH-120411)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
(cherry picked from commit 92c9c6a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@hugovk
Copy link
Member

hugovk commented Jun 12, 2024

Is this something that could be suggested for https://github.com/sphinx-contrib/sphinx-lint?

And can this issue be closed?

@serhiy-storchaka
Copy link
Member Author

Among more than 9000 :class: references there were only 9 with such kind of error. About 1 error in 2 years. And now they are fixed.

If you add a check in the linter, it will run in vain two years before catching the next error.

mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
…suffix (pythonGH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
…suffix (pythonGH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
…suffix (pythonGH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants