Skip to content

Commit 9560e0d

Browse files
authored
gh-101100: Fix Sphinx nitpicks in library/abc.rst (#112703)
1 parent 6ca9d3e commit 9560e0d

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

Doc/library/abc.rst

+21-21
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The :mod:`collections` module has some concrete classes that derive from
2121
ABCs; these can, of course, be further derived. In addition, the
2222
:mod:`collections.abc` submodule has some ABCs that can be used to test whether
2323
a class or instance provides a particular interface, for example, if it is
24-
:term:`hashable` or if it is a mapping.
24+
:term:`hashable` or if it is a :term:`mapping`.
2525

2626

2727
This module provides the metaclass :class:`ABCMeta` for defining ABCs and
@@ -30,19 +30,19 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
3030
.. class:: ABC
3131

3232
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
33-
an abstract base class can be created by simply deriving from :class:`ABC`
33+
an abstract base class can be created by simply deriving from :class:`!ABC`
3434
avoiding sometimes confusing metaclass usage, for example::
3535

3636
from abc import ABC
3737

3838
class MyABC(ABC):
3939
pass
4040

41-
Note that the type of :class:`ABC` is still :class:`ABCMeta`, therefore
42-
inheriting from :class:`ABC` requires the usual precautions regarding
41+
Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore
42+
inheriting from :class:`!ABC` requires the usual precautions regarding
4343
metaclass usage, as multiple inheritance may lead to metaclass conflicts.
4444
One may also define an abstract base class by passing the metaclass
45-
keyword and using :class:`ABCMeta` directly, for example::
45+
keyword and using :class:`!ABCMeta` directly, for example::
4646

4747
from abc import ABCMeta
4848

@@ -65,7 +65,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
6565
implementations defined by the registering ABC be callable (not even via
6666
:func:`super`). [#]_
6767

68-
Classes created with a metaclass of :class:`ABCMeta` have the following method:
68+
Classes created with a metaclass of :class:`!ABCMeta` have the following method:
6969

7070
.. method:: register(subclass)
7171

@@ -86,7 +86,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
8686
Returns the registered subclass, to allow usage as a class decorator.
8787

8888
.. versionchanged:: 3.4
89-
To detect calls to :meth:`register`, you can use the
89+
To detect calls to :meth:`!register`, you can use the
9090
:func:`get_cache_token` function.
9191

9292
You can also override this method in an abstract base class:
@@ -96,10 +96,10 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
9696
(Must be defined as a class method.)
9797

9898
Check whether *subclass* is considered a subclass of this ABC. This means
99-
that you can customize the behavior of ``issubclass`` further without the
99+
that you can customize the behavior of :func:`issubclass` further without the
100100
need to call :meth:`register` on every class you want to consider a
101101
subclass of the ABC. (This class method is called from the
102-
:meth:`__subclasscheck__` method of the ABC.)
102+
:meth:`~class.__subclasscheck__` method of the ABC.)
103103

104104
This method should return ``True``, ``False`` or ``NotImplemented``. If
105105
it returns ``True``, the *subclass* is considered a subclass of this ABC.
@@ -142,7 +142,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
142142

143143
The ABC ``MyIterable`` defines the standard iterable method,
144144
:meth:`~iterator.__iter__`, as an abstract method. The implementation given
145-
here can still be called from subclasses. The :meth:`get_iterator` method
145+
here can still be called from subclasses. The :meth:`!get_iterator` method
146146
is also part of the ``MyIterable`` abstract base class, but it does not have
147147
to be overridden in non-abstract derived classes.
148148

@@ -153,34 +153,34 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
153153

154154
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
155155
even though it does not define an :meth:`~iterator.__iter__` method (it uses
156-
the old-style iterable protocol, defined in terms of :meth:`__len__` and
156+
the old-style iterable protocol, defined in terms of :meth:`~object.__len__` and
157157
:meth:`~object.__getitem__`). Note that this will not make ``get_iterator``
158158
available as a method of ``Foo``, so it is provided separately.
159159

160160

161161

162162

163-
The :mod:`abc` module also provides the following decorator:
163+
The :mod:`!abc` module also provides the following decorator:
164164

165165
.. decorator:: abstractmethod
166166

167167
A decorator indicating abstract methods.
168168

169169
Using this decorator requires that the class's metaclass is :class:`ABCMeta`
170170
or is derived from it. A class that has a metaclass derived from
171-
:class:`ABCMeta` cannot be instantiated unless all of its abstract methods
171+
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
172172
and properties are overridden. The abstract methods can be called using any
173-
of the normal 'super' call mechanisms. :func:`abstractmethod` may be used
173+
of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used
174174
to declare abstract methods for properties and descriptors.
175175

176176
Dynamically adding abstract methods to a class, or attempting to modify the
177177
abstraction status of a method or class once it is created, are only
178178
supported using the :func:`update_abstractmethods` function. The
179-
:func:`abstractmethod` only affects subclasses derived using regular
180-
inheritance; "virtual subclasses" registered with the ABC's :meth:`register`
181-
method are not affected.
179+
:func:`!abstractmethod` only affects subclasses derived using regular
180+
inheritance; "virtual subclasses" registered with the ABC's
181+
:meth:`~ABCMeta.register` method are not affected.
182182

183-
When :func:`abstractmethod` is applied in combination with other method
183+
When :func:`!abstractmethod` is applied in combination with other method
184184
descriptors, it should be applied as the innermost decorator, as shown in
185185
the following usage examples::
186186

@@ -216,7 +216,7 @@ The :mod:`abc` module also provides the following decorator:
216216

217217
In order to correctly interoperate with the abstract base class machinery,
218218
the descriptor must identify itself as abstract using
219-
:attr:`__isabstractmethod__`. In general, this attribute should be ``True``
219+
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
220220
if any of the methods used to compose the descriptor are abstract. For
221221
example, Python's built-in :class:`property` does the equivalent of::
222222

@@ -236,7 +236,7 @@ The :mod:`abc` module also provides the following decorator:
236236
super-call in a framework that uses cooperative
237237
multiple-inheritance.
238238

239-
The :mod:`abc` module also supports the following legacy decorators:
239+
The :mod:`!abc` module also supports the following legacy decorators:
240240

241241
.. decorator:: abstractclassmethod
242242

@@ -323,7 +323,7 @@ The :mod:`abc` module also supports the following legacy decorators:
323323
...
324324

325325

326-
The :mod:`abc` module also provides the following functions:
326+
The :mod:`!abc` module also provides the following functions:
327327

328328
.. function:: get_cache_token()
329329

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Doc/howto/enum.rst
2626
Doc/howto/isolating-extensions.rst
2727
Doc/howto/logging.rst
2828
Doc/howto/urllib2.rst
29-
Doc/library/abc.rst
3029
Doc/library/ast.rst
3130
Doc/library/asyncio-extending.rst
3231
Doc/library/asyncio-policy.rst

0 commit comments

Comments
 (0)