Skip to content

Commit 2ae894b

Browse files
authored
[Enum] Fix typos in the documentation (GH-99960)
1 parent 72ec518 commit 2ae894b

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

Doc/library/enum.rst

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Data Types
194194

195195
.. method:: EnumType.__getitem__(cls, name)
196196

197-
Returns the Enum member in *cls* matching *name*, or raises an :exc:`KeyError`::
197+
Returns the Enum member in *cls* matching *name*, or raises a :exc:`KeyError`::
198198

199199
>>> Color['BLUE']
200200
<Color.BLUE: 3>
@@ -241,7 +241,7 @@ Data Types
241241

242242
.. note:: Enum member values
243243

244-
Member values can be anything: :class:`int`, :class:`str`, etc.. If
244+
Member values can be anything: :class:`int`, :class:`str`, etc. If
245245
the exact value is unimportant you may use :class:`auto` instances and an
246246
appropriate value will be chosen for you. See :class:`auto` for the
247247
details.
@@ -255,7 +255,7 @@ Data Types
255255
names will also be removed from the completed enumeration. See
256256
:ref:`TimePeriod <enum-time-period>` for an example.
257257

258-
.. method:: Enum.__call__(cls, value, names=None, \*, module=None, qualname=None, type=None, start=1, boundary=None)
258+
.. method:: Enum.__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
259259

260260
This method is called in two different ways:
261261

@@ -272,8 +272,8 @@ Data Types
272272
:module: The name of the module the new Enum is created in.
273273
:qualname: The actual location in the module where this Enum can be found.
274274
:type: A mix-in type for the new Enum.
275-
:start: The first integer value for the Enum (used by :class:`auto`)
276-
:boundary: How to handle out-of-range values from bit operations (:class:`Flag` only)
275+
:start: The first integer value for the Enum (used by :class:`auto`).
276+
:boundary: How to handle out-of-range values from bit operations (:class:`Flag` only).
277277

278278
.. method:: Enum.__dir__(self)
279279

@@ -315,7 +315,7 @@ Data Types
315315
>>> PowersOfThree.SECOND.value
316316
6
317317

318-
.. method:: Enum.__init_subclass__(cls, \**kwds)
318+
.. method:: Enum.__init_subclass__(cls, **kwds)
319319

320320
A *classmethod* that is used to further configure subsequent subclasses.
321321
By default, does nothing.
@@ -373,7 +373,7 @@ Data Types
373373
.. method:: Enum.__format__(self)
374374

375375
Returns the string used for *format()* and *f-string* calls. By default,
376-
returns :meth:`__str__` returns, but can be overridden::
376+
returns :meth:`__str__` return value, but can be overridden::
377377

378378
>>> class OtherStyle(Enum):
379379
... ALTERNATE = auto()
@@ -552,11 +552,11 @@ Data Types
552552
Using :class:`auto` with :class:`Flag` results in integers that are powers
553553
of two, starting with ``1``.
554554

555-
.. versionchanged:: 3.11 The *repr()* of zero-valued flags has changed. It
555+
.. versionchanged:: 3.11 The *repr()* of zero-valued flags has changed. It
556556
is now::
557557

558-
>>> Color(0) # doctest: +SKIP
559-
<Color: 0>
558+
>>> Color(0) # doctest: +SKIP
559+
<Color: 0>
560560

561561
.. class:: IntFlag
562562

@@ -600,7 +600,7 @@ Data Types
600600
*replacement of existing constants* use-case. :meth:`~object.__format__` was
601601
already :meth:`!int.__format__` for that same reason.
602602

603-
Inversion of a :class:`!IntFlag` now returns a positive value that is the
603+
Inversion of an :class:`!IntFlag` now returns a positive value that is the
604604
union of all flags not in the given flag, rather than a negative value.
605605
This matches the existing :class:`Flag` behavior.
606606

@@ -612,7 +612,7 @@ Data Types
612612
* :meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`
613613
* :meth:`!str.__str__` for :class:`StrEnum`
614614

615-
Inherit from :class:`!ReprEnum` to keep the :class:`str() <str> / :func:`format`
615+
Inherit from :class:`!ReprEnum` to keep the :class:`str() <str>` / :func:`format`
616616
of the mixed-in data type instead of using the
617617
:class:`Enum`-default :meth:`str() <Enum.__str__>`.
618618

@@ -658,7 +658,7 @@ Data Types
658658
.. attribute:: NAMED_FLAGS
659659

660660
Ensure that any flag groups/masks contain only named flags -- useful when
661-
values are specified instead of being generated by :func:`auto`
661+
values are specified instead of being generated by :func:`auto`::
662662

663663
>>> from enum import Flag, verify, NAMED_FLAGS
664664
>>> @verify(NAMED_FLAGS)
@@ -885,23 +885,23 @@ Notes
885885

886886
:class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`
887887

888-
These three enum types are designed to be drop-in replacements for existing
889-
integer- and string-based values; as such, they have extra limitations:
888+
These three enum types are designed to be drop-in replacements for existing
889+
integer- and string-based values; as such, they have extra limitations:
890890

891-
- ``__str__`` uses the value and not the name of the enum member
891+
- ``__str__`` uses the value and not the name of the enum member
892892

893-
- ``__format__``, because it uses ``__str__``, will also use the value of
894-
the enum member instead of its name
893+
- ``__format__``, because it uses ``__str__``, will also use the value of
894+
the enum member instead of its name
895895

896-
If you do not need/want those limitations, you can either create your own
897-
base class by mixing in the ``int`` or ``str`` type yourself::
896+
If you do not need/want those limitations, you can either create your own
897+
base class by mixing in the ``int`` or ``str`` type yourself::
898898

899-
>>> from enum import Enum
900-
>>> class MyIntEnum(int, Enum):
901-
... pass
899+
>>> from enum import Enum
900+
>>> class MyIntEnum(int, Enum):
901+
... pass
902902

903903
or you can reassign the appropriate :meth:`str`, etc., in your enum::
904904

905-
>>> from enum import IntEnum
906-
>>> class MyIntEnum(IntEnum):
907-
... __str__ = IntEnum.__str__
905+
>>> from enum import IntEnum
906+
>>> class MyIntEnum(IntEnum):
907+
... __str__ = IntEnum.__str__

0 commit comments

Comments
 (0)