Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14f52e1

Browse files
authored
gh-110679: Improved markup in enum.rst (GH-110747)
1 parent 0db2517 commit 14f52e1

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Doc/library/enum.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ 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__`,
168+
``EnumType`` is responsible for setting the correct :meth:`!__repr__`,
169169
: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.
@@ -406,7 +406,7 @@ Data Types
406406

407407
.. class:: IntEnum
408408

409-
*IntEnum* is the same as *Enum*, but its members are also integers and can be
409+
*IntEnum* is the same as :class:`Enum`, but its members are also integers and can be
410410
used anywhere that an integer can be used. If any integer operation is performed
411411
with an *IntEnum* member, the resulting value loses its enumeration status.
412412

@@ -437,7 +437,7 @@ Data Types
437437

438438
.. class:: StrEnum
439439

440-
*StrEnum* is the same as *Enum*, but its members are also strings and can be used
440+
``StrEnum`` is the same as :class:`Enum`, but its members are also strings and can be used
441441
in most of the same places that a string can be used. The result of any string
442442
operation performed on or with a *StrEnum* member is not part of the enumeration.
443443

@@ -576,7 +576,7 @@ Data Types
576576

577577
.. class:: IntFlag
578578

579-
*IntFlag* is the same as *Flag*, but its members are also integers and can be
579+
``IntFlag`` is the same as :class:`Flag`, but its members are also integers and can be
580580
used anywhere that an integer can be used.
581581

582582
>>> from enum import IntFlag, auto
@@ -596,12 +596,12 @@ Data Types
596596
>>> Color.RED + 2
597597
3
598598

599-
If a *Flag* operation is performed with an *IntFlag* member and:
599+
If a :class:`Flag` operation is performed with an *IntFlag* member and:
600600

601601
* the result is a valid *IntFlag*: an *IntFlag* is returned
602-
* the result is not a valid *IntFlag*: the result depends on the *FlagBoundary* setting
602+
* the result is not a valid *IntFlag*: the result depends on the :class:`FlagBoundary` setting
603603

604-
The *repr()* of unnamed zero-valued flags has changed. It is now:
604+
The :func:`repr()` of unnamed zero-valued flags has changed. It is now:
605605

606606
>>> Color(0)
607607
<Color: 0>
@@ -697,7 +697,7 @@ Data Types
697697

698698
.. class:: FlagBoundary
699699

700-
*FlagBoundary* controls how out-of-range values are handled in *Flag* and its
700+
``FlagBoundary`` controls how out-of-range values are handled in :class:`Flag` and its
701701
subclasses.
702702

703703
.. attribute:: STRICT
@@ -720,7 +720,7 @@ Data Types
720720

721721
.. attribute:: CONFORM
722722

723-
Out-of-range values have invalid values removed, leaving a valid *Flag*
723+
Out-of-range values have invalid values removed, leaving a valid :class:`Flag`
724724
value::
725725

726726
>>> from enum import Flag, CONFORM, auto
@@ -734,7 +734,7 @@ Data Types
734734

735735
.. attribute:: EJECT
736736

737-
Out-of-range values lose their *Flag* membership and revert to :class:`int`.
737+
Out-of-range values lose their :class:`Flag` membership and revert to :class:`int`.
738738

739739
>>> from enum import Flag, EJECT, auto
740740
>>> class EjectFlag(Flag, boundary=EJECT):
@@ -747,7 +747,7 @@ Data Types
747747

748748
.. attribute:: KEEP
749749

750-
Out-of-range values are kept, and the *Flag* membership is kept.
750+
Out-of-range values are kept, and the :class:`Flag` membership is kept.
751751
This is the default for :class:`IntFlag`::
752752

753753
>>> from enum import Flag, KEEP, auto
@@ -809,10 +809,10 @@ Utilities and Decorators
809809
.. class:: auto
810810

811811
*auto* can be used in place of a value. If used, the *Enum* machinery will
812-
call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
813-
For *Enum* and *IntEnum* that appropriate value will be the last value plus
814-
one; for *Flag* and *IntFlag* it will be the first power-of-two greater
815-
than the highest value; for *StrEnum* it will be the lower-cased version of
812+
call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
813+
For :class:`Enum` and :class:`IntEnum` that appropriate value will be the last value plus
814+
one; for :class:`Flag` and :class:`IntFlag` it will be the first power-of-two greater
815+
than the highest value; for :class:`StrEnum` it will be the lower-cased version of
816816
the member's name. Care must be taken if mixing *auto()* with manually
817817
specified values.
818818

0 commit comments

Comments
 (0)