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

Skip to content

Commit 05031ee

Browse files
[Enum] Fix typos in the documentation (GH-99960)
(cherry picked from commit 2ae894b) Co-authored-by: Géry Ogam <[email protected]>
1 parent b2ff0f7 commit 05031ee

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
@@ -201,7 +201,7 @@ Data Types
201201

202202
.. method:: EnumType.__getitem__(cls, name)
203203

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

206206
>>> Color['BLUE']
207207
<Color.BLUE: 3>
@@ -248,7 +248,7 @@ Data Types
248248

249249
.. note:: Enum member values
250250

251-
Member values can be anything: :class:`int`, :class:`str`, etc.. If
251+
Member values can be anything: :class:`int`, :class:`str`, etc. If
252252
the exact value is unimportant you may use :class:`auto` instances and an
253253
appropriate value will be chosen for you. See :class:`auto` for the
254254
details.
@@ -262,7 +262,7 @@ Data Types
262262
names will also be removed from the completed enumeration. See
263263
:ref:`TimePeriod <enum-time-period>` for an example.
264264

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

267267
This method is called in two different ways:
268268

@@ -279,8 +279,8 @@ Data Types
279279
:module: The name of the module the new Enum is created in.
280280
:qualname: The actual location in the module where this Enum can be found.
281281
:type: A mix-in type for the new Enum.
282-
:start: The first integer value for the Enum (used by :class:`auto`)
283-
:boundary: How to handle out-of-range values from bit operations (:class:`Flag` only)
282+
:start: The first integer value for the Enum (used by :class:`auto`).
283+
:boundary: How to handle out-of-range values from bit operations (:class:`Flag` only).
284284

285285
.. method:: Enum.__dir__(self)
286286

@@ -322,7 +322,7 @@ Data Types
322322
>>> PowersOfThree.SECOND.value
323323
6
324324

325-
.. method:: Enum.__init_subclass__(cls, \**kwds)
325+
.. method:: Enum.__init_subclass__(cls, **kwds)
326326

327327
A *classmethod* that is used to further configure subsequent subclasses.
328328
By default, does nothing.
@@ -380,7 +380,7 @@ Data Types
380380
.. method:: Enum.__format__(self)
381381

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

385385
>>> class OtherStyle(Enum):
386386
... ALTERNATE = auto()
@@ -559,11 +559,11 @@ Data Types
559559
Using :class:`auto` with :class:`Flag` results in integers that are powers
560560
of two, starting with ``1``.
561561

562-
.. versionchanged:: 3.11 The *repr()* of zero-valued flags has changed. It
562+
.. versionchanged:: 3.11 The *repr()* of zero-valued flags has changed. It
563563
is now::
564564

565-
>>> Color(0) # doctest: +SKIP
566-
<Color: 0>
565+
>>> Color(0) # doctest: +SKIP
566+
<Color: 0>
567567

568568
.. class:: IntFlag
569569

@@ -607,7 +607,7 @@ Data Types
607607
*replacement of existing constants* use-case. :meth:`~object.__format__` was
608608
already :meth:`!int.__format__` for that same reason.
609609

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

@@ -619,7 +619,7 @@ Data Types
619619
* :meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`
620620
* :meth:`!str.__str__` for :class:`StrEnum`
621621

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

@@ -665,7 +665,7 @@ Data Types
665665
.. attribute:: NAMED_FLAGS
666666

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

670670
>>> from enum import Flag, verify, NAMED_FLAGS
671671
>>> @verify(NAMED_FLAGS)
@@ -897,23 +897,23 @@ Notes
897897

898898
:class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`
899899

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

903-
- ``__str__`` uses the value and not the name of the enum member
903+
- ``__str__`` uses the value and not the name of the enum member
904904

905-
- ``__format__``, because it uses ``__str__``, will also use the value of
906-
the enum member instead of its name
905+
- ``__format__``, because it uses ``__str__``, will also use the value of
906+
the enum member instead of its name
907907

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

911-
>>> from enum import Enum
912-
>>> class MyIntEnum(int, Enum):
913-
... pass
911+
>>> from enum import Enum
912+
>>> class MyIntEnum(int, Enum):
913+
... pass
914914

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

917-
>>> from enum import IntEnum
918-
>>> class MyIntEnum(IntEnum):
919-
... __str__ = IntEnum.__str__
917+
>>> from enum import IntEnum
918+
>>> class MyIntEnum(IntEnum):
919+
... __str__ = IntEnum.__str__

0 commit comments

Comments
 (0)