Skip to content

Commit 9e025d3

Browse files
gh-101100: [Enum] Fix sphinx warnings in docs (GH-101122)
* gh-101100: [Enum] Fix sphinx warnings in Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent f30c940 commit 9e025d3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Doc/library/enum.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ are not normal Python classes. See
5252

5353
.. note:: Nomenclature
5454

55-
- The class :class:`Color` is an *enumeration* (or *enum*)
56-
- The attributes :attr:`Color.RED`, :attr:`Color.GREEN`, etc., are
55+
- The class :class:`!Color` is an *enumeration* (or *enum*)
56+
- The attributes :attr:`!Color.RED`, :attr:`!Color.GREEN`, etc., are
5757
*enumeration members* (or *members*) and are functionally constants.
5858
- The enum members have *names* and *values* (the name of
59-
:attr:`Color.RED` is ``RED``, the value of :attr:`Color.BLUE` is
59+
:attr:`!Color.RED` is ``RED``, the value of :attr:`!Color.BLUE` is
6060
``3``, etc.)
6161

6262
---------------
@@ -165,8 +165,8 @@ Data Types
165165
to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`
166166
for details.
167167

168-
*EnumType* is responsible for setting the correct :meth:`__repr__`,
169-
:meth:`__str__`, :meth:`__format__`, and :meth:`__reduce__` methods on the
168+
*EnumType* is responsible for setting the correct :meth:`!__repr__`,
169+
:meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the
170170
final *enum*, as well as creating the enum members, properly handling
171171
duplicates, providing iteration over the enum class, etc.
172172

@@ -424,9 +424,9 @@ Data Types
424424
Using :class:`auto` with :class:`IntEnum` results in integers of increasing
425425
value, starting with ``1``.
426426

427-
.. versionchanged:: 3.11 :meth:`__str__` is now :func:`int.__str__` to
427+
.. versionchanged:: 3.11 :meth:`~object.__str__` is now :meth:`!int.__str__` to
428428
better support the *replacement of existing constants* use-case.
429-
:meth:`__format__` was already :func:`int.__format__` for that same reason.
429+
:meth:`~object.__format__` was already :meth:`!int.__format__` for that same reason.
430430

431431

432432
.. class:: StrEnum
@@ -761,11 +761,11 @@ Data Types
761761
Supported ``__dunder__`` names
762762
""""""""""""""""""""""""""""""
763763

764-
:attr:`__members__` is a read-only ordered mapping of ``member_name``:``member``
764+
:attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member``
765765
items. It is only available on the class.
766766

767-
:meth:`__new__`, if specified, must create and return the enum members; it is
768-
also a very good idea to set the member's :attr:`_value_` appropriately. Once
767+
:meth:`~object.__new__`, if specified, must create and return the enum members; it is
768+
also a very good idea to set the member's :attr:`!_value_` appropriately. Once
769769
all the members are created it is no longer used.
770770

771771

@@ -804,7 +804,7 @@ Utilities and Decorators
804804
.. class:: auto
805805

806806
*auto* can be used in place of a value. If used, the *Enum* machinery will
807-
call an *Enum*'s :meth:`_generate_next_value_` to get an appropriate value.
807+
call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
808808
For *Enum* and *IntEnum* that appropriate value will be the last value plus
809809
one; for *Flag* and *IntFlag* it will be the first power-of-two greater
810810
than the highest value; for *StrEnum* it will be the lower-cased version of
@@ -847,7 +847,7 @@ Utilities and Decorators
847847
.. decorator:: unique
848848

849849
A :keyword:`class` decorator specifically for enumerations. It searches an
850-
enumeration's :attr:`__members__`, gathering any aliases it finds; if any are
850+
enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; if any are
851851
found :exc:`ValueError` is raised with the details::
852852

853853
>>> from enum import Enum, unique

0 commit comments

Comments
 (0)