[Enum] Fix typos in the documentation (GH-99960)

(cherry picked from commit 2ae894b6d1)

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-12-05 21:46:48 -08:00 committed by GitHub
parent b2ff0f761d
commit 05031ee1f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -201,7 +201,7 @@ Data Types
.. method:: EnumType.__getitem__(cls, name) .. method:: EnumType.__getitem__(cls, name)
Returns the Enum member in *cls* matching *name*, or raises an :exc:`KeyError`:: Returns the Enum member in *cls* matching *name*, or raises a :exc:`KeyError`::
>>> Color['BLUE'] >>> Color['BLUE']
<Color.BLUE: 3> <Color.BLUE: 3>
@ -248,7 +248,7 @@ Data Types
.. note:: Enum member values .. note:: Enum member values
Member values can be anything: :class:`int`, :class:`str`, etc.. If Member values can be anything: :class:`int`, :class:`str`, etc. If
the exact value is unimportant you may use :class:`auto` instances and an the exact value is unimportant you may use :class:`auto` instances and an
appropriate value will be chosen for you. See :class:`auto` for the appropriate value will be chosen for you. See :class:`auto` for the
details. details.
@ -262,7 +262,7 @@ Data Types
names will also be removed from the completed enumeration. See names will also be removed from the completed enumeration. See
:ref:`TimePeriod <enum-time-period>` for an example. :ref:`TimePeriod <enum-time-period>` for an example.
.. method:: Enum.__call__(cls, value, names=None, \*, module=None, qualname=None, type=None, start=1, boundary=None) .. method:: Enum.__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
This method is called in two different ways: This method is called in two different ways:
@ -279,8 +279,8 @@ Data Types
:module: The name of the module the new Enum is created in. :module: The name of the module the new Enum is created in.
:qualname: The actual location in the module where this Enum can be found. :qualname: The actual location in the module where this Enum can be found.
:type: A mix-in type for the new Enum. :type: A mix-in type for the new Enum.
:start: The first integer value for the Enum (used by :class:`auto`) :start: The first integer value for the Enum (used by :class:`auto`).
:boundary: How to handle out-of-range values from bit operations (:class:`Flag` only) :boundary: How to handle out-of-range values from bit operations (:class:`Flag` only).
.. method:: Enum.__dir__(self) .. method:: Enum.__dir__(self)
@ -322,7 +322,7 @@ Data Types
>>> PowersOfThree.SECOND.value >>> PowersOfThree.SECOND.value
6 6
.. method:: Enum.__init_subclass__(cls, \**kwds) .. method:: Enum.__init_subclass__(cls, **kwds)
A *classmethod* that is used to further configure subsequent subclasses. A *classmethod* that is used to further configure subsequent subclasses.
By default, does nothing. By default, does nothing.
@ -380,7 +380,7 @@ Data Types
.. method:: Enum.__format__(self) .. method:: Enum.__format__(self)
Returns the string used for *format()* and *f-string* calls. By default, Returns the string used for *format()* and *f-string* calls. By default,
returns :meth:`__str__` returns, but can be overridden:: returns :meth:`__str__` return value, but can be overridden::
>>> class OtherStyle(Enum): >>> class OtherStyle(Enum):
... ALTERNATE = auto() ... ALTERNATE = auto()
@ -607,7 +607,7 @@ Data Types
*replacement of existing constants* use-case. :meth:`~object.__format__` was *replacement of existing constants* use-case. :meth:`~object.__format__` was
already :meth:`!int.__format__` for that same reason. already :meth:`!int.__format__` for that same reason.
Inversion of a :class:`!IntFlag` now returns a positive value that is the Inversion of an :class:`!IntFlag` now returns a positive value that is the
union of all flags not in the given flag, rather than a negative value. union of all flags not in the given flag, rather than a negative value.
This matches the existing :class:`Flag` behavior. This matches the existing :class:`Flag` behavior.
@ -619,7 +619,7 @@ Data Types
* :meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag` * :meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`
* :meth:`!str.__str__` for :class:`StrEnum` * :meth:`!str.__str__` for :class:`StrEnum`
Inherit from :class:`!ReprEnum` to keep the :class:`str() <str> / :func:`format` Inherit from :class:`!ReprEnum` to keep the :class:`str() <str>` / :func:`format`
of the mixed-in data type instead of using the of the mixed-in data type instead of using the
:class:`Enum`-default :meth:`str() <Enum.__str__>`. :class:`Enum`-default :meth:`str() <Enum.__str__>`.
@ -665,7 +665,7 @@ Data Types
.. attribute:: NAMED_FLAGS .. attribute:: NAMED_FLAGS
Ensure that any flag groups/masks contain only named flags -- useful when Ensure that any flag groups/masks contain only named flags -- useful when
values are specified instead of being generated by :func:`auto` values are specified instead of being generated by :func:`auto`::
>>> from enum import Flag, verify, NAMED_FLAGS >>> from enum import Flag, verify, NAMED_FLAGS
>>> @verify(NAMED_FLAGS) >>> @verify(NAMED_FLAGS)