Skip to content

Commit d05bf63

Browse files
committed
gh-105812: Make use of the Sphinx deco role in documentation, part final
1 parent ed67875 commit d05bf63

26 files changed

+64
-63
lines changed

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requ
954954
special recursion handling. In addition to protecting the stack,
955955
:c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The
956956
following two functions facilitate this functionality. Effectively,
957-
these are the C equivalent to :func:`reprlib.recursive_repr`.
957+
these are the C equivalent to :deco:`reprlib.recursive_repr`.
958958
959959
.. c:function:: int Py_ReprEnter(PyObject *object)
960960

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Pending removal in Python 3.15
9292
Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``
9393
to create a TypedDict with zero field.
9494

95-
* The :func:`!typing.no_type_check_decorator` decorator function
95+
* The :deco:`!typing.no_type_check_decorator` decorator function
9696
has been deprecated since Python 3.13.
9797
After eight years in the :mod:`typing` module,
9898
it has yet to be supported by any major type checker.

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ Glossary
622622
determined by the dispatch algorithm.
623623

624624
See also the :term:`single dispatch` glossary entry, the
625-
:func:`functools.singledispatch` decorator, and :pep:`443`.
625+
:deco:`functools.singledispatch` decorator, and :pep:`443`.
626626

627627
generic type
628628
A :term:`type` that can be parameterized; typically a

Doc/howto/annotations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ on an arbitrary object ``o``:
154154
as the ``globals``, and ``dict(vars(o))`` as the ``locals``,
155155
when calling :func:`eval`.
156156
* If ``o`` is a wrapped callable using :func:`functools.update_wrapper`,
157-
:func:`functools.wraps`, or :func:`functools.partial`, iteratively
157+
:deco:`functools.wraps`, or :func:`functools.partial`, iteratively
158158
unwrap it by accessing either ``o.__wrapped__`` or ``o.func`` as
159159
appropriate, until you have found the root unwrapped function.
160160
* If ``o`` is a callable (but not a class), use

Doc/howto/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ to use the standard :func:`repr`.
509509

510510
.. note::
511511

512-
Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum`
512+
Adding :deco:`~dataclasses.dataclass` decorator to :class:`Enum`
513513
and its subclasses is not supported. It will not raise any errors,
514514
but it will produce very strange results at runtime, such as members
515515
being equal to each other::

Doc/howto/sorting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Odds and Ends
375375
:meth:`~object.__lt__` is not implemented (see :func:`object.__lt__`
376376
for details on the mechanics). To avoid surprises, :pep:`8`
377377
recommends that all six comparison methods be implemented.
378-
The :func:`~functools.total_ordering` decorator is provided to make that
378+
The :deco:`~functools.total_ordering` decorator is provided to make that
379379
task easier.
380380

381381
* Key functions need not depend directly on the objects being sorted. A key

Doc/library/abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ The :mod:`!abc` module also supports the following legacy decorators:
283283
.. decorator:: abstractproperty
284284

285285
.. deprecated:: 3.3
286-
It is now possible to use :deco:`property`, :meth:`property.getter`,
287-
:meth:`property.setter` and :meth:`property.deleter` with
286+
It is now possible to use :deco:`property`, :deco:`property.getter`,
287+
:deco:`property.setter` and :deco:`property.deleter` with
288288
:deco:`abstractmethod`, making this decorator redundant.
289289

290290
A subclass of the built-in :class:`property`, indicating an abstract

Doc/library/contextlib.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Functions and classes provided:
9292
it creates can be used as decorators as well as in :keyword:`with` statements.
9393
When used as a decorator, a new generator instance is implicitly created on
9494
each function call (this allows the otherwise "one-shot" context managers
95-
created by :func:`contextmanager` to meet the requirement that context
95+
created by :deco:`contextmanager` to meet the requirement that context
9696
managers support multiple invocations in order to be used as decorators).
9797

9898
.. versionchanged:: 3.2
@@ -101,7 +101,7 @@ Functions and classes provided:
101101

102102
.. decorator:: asynccontextmanager
103103

104-
Similar to :func:`~contextlib.contextmanager`, but creates an
104+
Similar to :deco:`~contextlib.contextmanager`, but creates an
105105
:ref:`asynchronous context manager <async-context-managers>`.
106106

107107
This function is a :term:`decorator` that can be used to define a factory
@@ -128,7 +128,7 @@ Functions and classes provided:
128128

129129
.. versionadded:: 3.7
130130

131-
Context managers defined with :func:`asynccontextmanager` can be used
131+
Context managers defined with :deco:`asynccontextmanager` can be used
132132
either as decorators or with :keyword:`async with` statements::
133133

134134
import time
@@ -148,11 +148,11 @@ Functions and classes provided:
148148

149149
When used as a decorator, a new generator instance is implicitly created on
150150
each function call. This allows the otherwise "one-shot" context managers
151-
created by :func:`asynccontextmanager` to meet the requirement that context
151+
created by :deco:`asynccontextmanager` to meet the requirement that context
152152
managers support multiple invocations in order to be used as decorators.
153153

154154
.. versionchanged:: 3.10
155-
Async context managers created with :func:`asynccontextmanager` can
155+
Async context managers created with :deco:`asynccontextmanager` can
156156
be used as decorators.
157157

158158

@@ -399,7 +399,7 @@ Functions and classes provided:
399399
``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional
400400
exception handling even when used as a decorator.
401401

402-
``ContextDecorator`` is used by :func:`contextmanager`, so you get this
402+
``ContextDecorator`` is used by :deco:`contextmanager`, so you get this
403403
functionality automatically.
404404

405405
Example of ``ContextDecorator``::
@@ -653,7 +653,7 @@ Functions and classes provided:
653653

654654
Similar to :meth:`ExitStack.close` but properly handles awaitables.
655655

656-
Continuing the example for :func:`asynccontextmanager`::
656+
Continuing the example for :deco:`asynccontextmanager`::
657657

658658
async with AsyncExitStack() as stack:
659659
connections = [await stack.enter_async_context(get_connection())
@@ -911,7 +911,7 @@ Files are an example of effectively single use context managers, since
911911
the first :keyword:`with` statement will close the file, preventing any
912912
further IO operations using that file object.
913913

914-
Context managers created using :func:`contextmanager` are also single use
914+
Context managers created using :deco:`contextmanager` are also single use
915915
context managers, and will complain about the underlying generator failing
916916
to yield if an attempt is made to use them a second time::
917917

Doc/library/test.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ The :mod:`test.support` module defines the following functions:
714714
.. decorator:: anticipate_failure(condition)
715715

716716
A decorator to conditionally mark tests with
717-
:func:`unittest.expectedFailure`. Any use of this decorator should
717+
:deco:`unittest.expectedFailure`. Any use of this decorator should
718718
have an associated comment identifying the relevant tracker issue.
719719

720720

Doc/library/typing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,7 @@ types.
25012501
func(C()) # Passes static type check
25022502

25032503
See :pep:`544` for more details. Protocol classes decorated with
2504-
:func:`runtime_checkable` (described later) act as simple-minded runtime
2504+
:deco:`runtime_checkable` (described later) act as simple-minded runtime
25052505
protocols that check only the presence of given attributes, ignoring their
25062506
type signatures. Protocol classes without this decorator cannot be used
25072507
as the second argument to :func:`isinstance` or :func:`issubclass`.
@@ -2548,7 +2548,7 @@ types.
25482548

25492549
.. note::
25502550

2551-
:func:`!runtime_checkable` will check only the presence of the required
2551+
:deco:`!runtime_checkable` will check only the presence of the required
25522552
methods or attributes, not their type signatures or types.
25532553
For example, :class:`ssl.SSLObject`
25542554
is a class, therefore it passes an :func:`issubclass`
@@ -3005,7 +3005,7 @@ Functions and decorators
30053005
Decorator to mark an object as providing
30063006
:func:`dataclass <dataclasses.dataclass>`-like behavior.
30073007

3008-
``dataclass_transform`` may be used to
3008+
``@dataclass_transform`` may be used to
30093009
decorate a class, metaclass, or a function that is itself a decorator.
30103010
The presence of ``@dataclass_transform()`` tells a static type checker that the
30113011
decorated object performs runtime "magic" that
@@ -3060,7 +3060,7 @@ Functions and decorators
30603060
``kw_only``, and ``slots``. It must be possible for the value of these
30613061
arguments (``True`` or ``False``) to be statically evaluated.
30623062

3063-
The arguments to the ``dataclass_transform`` decorator can be used to
3063+
The arguments to the ``@dataclass_transform`` decorator can be used to
30643064
customize the default behaviors of the decorated class, metaclass, or
30653065
function:
30663066

@@ -3124,8 +3124,8 @@ Functions and decorators
31243124
keyword-only. If ``True``, the field will be keyword-only. If
31253125
``False``, it will not be keyword-only. If unspecified, the value of
31263126
the ``kw_only`` parameter on the object decorated with
3127-
``dataclass_transform`` will be used, or if that is unspecified, the
3128-
value of ``kw_only_default`` on ``dataclass_transform`` will be used.
3127+
``@dataclass_transform`` will be used, or if that is unspecified, the
3128+
value of ``kw_only_default`` on ``@dataclass_transform`` will be used.
31293129
* - ``alias``
31303130
- Provides an alternative name for the field. This alternative
31313131
name is used in the synthesized ``__init__`` method.

0 commit comments

Comments
 (0)