Skip to content

Commit 92c9c6a

Browse files
pythongh-120345: Fix incorrect use of the :class: role with the "()" 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.
1 parent 42b25dd commit 92c9c6a

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Doc/howto/descriptor.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ Invocation from super
787787
---------------------
788788

789789
The logic for super's dotted lookup is in the :meth:`__getattribute__` method for
790-
object returned by :class:`super()`.
790+
object returned by :func:`super`.
791791

792792
A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__``
793793
for the base class ``B`` immediately following ``A`` and then returns

Doc/library/collections.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The class can be used to simulate nested scopes and is useful in templating.
9999
:func:`super` function. A reference to ``d.parents`` is equivalent to:
100100
``ChainMap(*d.maps[1:])``.
101101

102-
Note, the iteration order of a :class:`ChainMap()` is determined by
102+
Note, the iteration order of a :class:`ChainMap` is determined by
103103
scanning the mappings last to first::
104104

105105
>>> baseline = {'music': 'bach', 'art': 'rembrandt'}

Doc/library/datetime.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
21532153

21542154
.. method:: tzinfo.fromutc(dt)
21552155

2156-
This is called from the default :class:`datetime.astimezone()`
2156+
This is called from the default :meth:`datetime.astimezone`
21572157
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
21582158
date and time data are to be viewed as expressing a UTC time. The purpose
21592159
of :meth:`fromutc` is to adjust the date and time data, returning an

Doc/library/fileinput.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Lines are returned with any newlines intact, which means that the last line in
4747
a file may not have one.
4848

4949
You can control how files are opened by providing an opening hook via the
50-
*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
50+
*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The
5151
hook must be a function that takes two arguments, *filename* and *mode*, and
5252
returns an accordingly opened file-like object. If *encoding* and/or *errors*
5353
are specified, they will be passed to the hook as additional keyword arguments.

Doc/tutorial/stdlib2.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Many data structure needs can be met with the built-in list type. However,
293293
sometimes there is a need for alternative implementations with different
294294
performance trade-offs.
295295

296-
The :mod:`array` module provides an :class:`~array.array()` object that is like
296+
The :mod:`array` module provides an :class:`~array.array` object that is like
297297
a list that stores only homogeneous data and stores it more compactly. The
298298
following example shows an array of numbers stored as two byte unsigned binary
299299
numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular
@@ -306,7 +306,7 @@ lists of Python int objects::
306306
>>> a[1:3]
307307
array('H', [10, 700])
308308

309-
The :mod:`collections` module provides a :class:`~collections.deque()` object
309+
The :mod:`collections` module provides a :class:`~collections.deque` object
310310
that is like a list with faster appends and pops from the left side but slower
311311
lookups in the middle. These objects are well suited for implementing queues
312312
and breadth first tree searches::

Doc/whatsnew/2.5.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ attribute of the function object to change this::
17241724
:mod:`ctypes` also provides a wrapper for Python's C API as the
17251725
``ctypes.pythonapi`` object. This object does *not* release the global
17261726
interpreter lock before calling a function, because the lock must be held when
1727-
calling into the interpreter's code. There's a :class:`py_object()` type
1727+
calling into the interpreter's code. There's a :class:`~ctypes.py_object` type
17281728
constructor that will create a :c:expr:`PyObject *` pointer. A simple usage::
17291729

17301730
import ctypes
@@ -1734,7 +1734,7 @@ constructor that will create a :c:expr:`PyObject *` pointer. A simple usage::
17341734
ctypes.py_object("abc"), ctypes.py_object(1))
17351735
# d is now {'abc', 1}.
17361736

1737-
Don't forget to use :class:`py_object()`; if it's omitted you end up with a
1737+
Don't forget to use :func:`~ctypes.py_object`; if it's omitted you end up with a
17381738
segmentation fault.
17391739

17401740
:mod:`ctypes` has been around for a while, but people still write and

Doc/whatsnew/3.12.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ inspect
739739
itertools
740740
---------
741741

742-
* Add :class:`itertools.batched()` for collecting into even-sized
742+
* Add :func:`itertools.batched` for collecting into even-sized
743743
tuples where the last batch may be shorter than the rest.
744744
(Contributed by Raymond Hettinger in :gh:`98363`.)
745745

0 commit comments

Comments
 (0)