Skip to content

Commit e039d53

Browse files
miss-islingtonsobolevnCAM-Gerlach
authored
[3.11] gh-101100: [Enum] Fix sphinx warnings in docs (GH-101122) (#101173)
(cherry picked from commit 9e025d3) Co-authored-by: Nikita Sobolev <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 5e1c4ac commit e039d53

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

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

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

429429

430430
.. class:: StrEnum
@@ -753,11 +753,11 @@ Data Types
753753
Supported ``__dunder__`` names
754754
""""""""""""""""""""""""""""""
755755

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

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

763763

@@ -796,7 +796,7 @@ Utilities and Decorators
796796
.. class:: auto
797797

798798
*auto* can be used in place of a value. If used, the *Enum* machinery will
799-
call an *Enum*'s :meth:`_generate_next_value_` to get an appropriate value.
799+
call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
800800
For *Enum* and *IntEnum* that appropriate value will be the last value plus
801801
one; for *Flag* and *IntFlag* it will be the first power-of-two greater
802802
than the highest value; for *StrEnum* it will be the lower-cased version of
@@ -839,7 +839,7 @@ Utilities and Decorators
839839
.. decorator:: unique
840840

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

845845
>>> from enum import Enum, unique

0 commit comments

Comments
 (0)