@@ -235,16 +235,30 @@ Data Types
235235 >>> len(Color)
236236 3
237237
238+ .. attribute :: EnumType.__members__
239+
240+ Returns a mapping of every enum name to its member, including aliases
241+
238242 .. method :: EnumType.__reversed__(cls)
239243
240244 Returns each member in *cls * in reverse definition order::
241245
242246 >>> list(reversed(Color))
243247 [<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]
244248
249+ .. method :: EnumType._add_alias_
250+
251+ Adds a new name as an alias to an existing member. Raises a
252+ :exc: `NameError ` if the name is already assigned to a different member.
253+
254+ .. method :: EnumType._add_value_alias_
255+
256+ Adds a new value as an alias to an existing member. Raises a
257+ :exc: `ValueError ` if the value is already linked with a different member.
258+
245259 .. versionadded :: 3.11
246260
247- Before 3.11 ``enum `` used ``EnumMeta `` type , which is kept as an alias.
261+ Before 3.11 ``EnumType `` was called ``EnumMeta ``, which is still available as an alias.
248262
249263
250264.. class :: Enum
@@ -323,7 +337,7 @@ Data Types
323337 >>> PowersOfThree.SECOND.value
324338 9
325339
326- .. method :: Enum.__init_subclass__(cls, **kwds)
340+ .. method :: Enum.__init_subclass__(cls, \ **kwds)
327341
328342 A *classmethod * that is used to further configure subsequent subclasses.
329343 By default, does nothing.
@@ -549,7 +563,7 @@ Data Types
549563
550564 .. method :: __invert__(self):
551565
552- Returns all the flags in *type(self) * that are not in self::
566+ Returns all the flags in *type(self) * that are not in * self * ::
553567
554568 >>> ~white
555569 <Color: 0>
@@ -769,37 +783,41 @@ Supported ``__dunder__`` names
769783:attr: `~EnumType.__members__ ` is a read-only ordered mapping of ``member_name ``:``member ``
770784items. It is only available on the class.
771785
772- :meth: `~object.__new__ `, if specified, must create and return the enum members; it is
773- also a very good idea to set the member's :attr: `!_value_ ` appropriately. Once
774- all the members are created it is no longer used.
786+ :meth: `~object.__new__ `, if specified, must create and return the enum members;
787+ it is also a very good idea to set the member's :attr: `!_value_ ` appropriately.
788+ Once all the members are created it is no longer used.
775789
776790
777791Supported ``_sunder_ `` names
778792""""""""""""""""""""""""""""
779793
780- - ``_name_ `` -- name of the member
781- - ``_value_ `` -- value of the member; can be set / modified in ``__new__ ``
782-
783- - ``_missing_ `` -- a lookup function used when a value is not found; may be
784- overridden
785- - ``_ignore_ `` -- a list of names, either as a :class: `list ` or a :class: `str `,
786- that will not be transformed into members, and will be removed from the final
787- class
788- - ``_order_ `` -- used in Python 2/3 code to ensure member order is consistent
789- (class attribute, removed during class creation)
790- - ``_generate_next_value_ `` -- used to get an appropriate value for an enum
791- member; may be overridden
794+ - :meth: `~EnumType._add_alias_ ` -- adds a new name as an alias to an existing
795+ member.
796+ - :meth: `~EnumType._add_value_alias_ ` -- adds a new value as an alias to an
797+ existing member.
798+ - :attr: `~Enum._name_ ` -- name of the member
799+ - :attr: `~Enum._value_ ` -- value of the member; can be set in ``__new__ ``
800+ - :meth: `~Enum._missing_ ` -- a lookup function used when a value is not found;
801+ may be overridden
802+ - :attr: `~Enum._ignore_ ` -- a list of names, either as a :class: `list ` or a
803+ :class: `str `, that will not be transformed into members, and will be removed
804+ from the final class
805+ - :attr: `~Enum._order_ ` -- used in Python 2/3 code to ensure member order is
806+ consistent (class attribute, removed during class creation)
807+ - :meth: `~Enum._generate_next_value_ ` -- used to get an appropriate value for
808+ an enum member; may be overridden
792809
793810 .. note ::
794811
795- For standard :class: `Enum ` classes the next value chosen is the last value seen
796- incremented by one.
812+ For standard :class: `Enum ` classes the next value chosen is the highest
813+ value seen incremented by one.
797814
798815 For :class: `Flag ` classes the next value chosen will be the next highest
799- power-of-two, regardless of the last value seen .
816+ power-of-two.
800817
801818.. versionadded :: 3.6 ``_missing_``, ``_order_``, ``_generate_next_value_``
802819.. versionadded :: 3.7 ``_ignore_``
820+ .. versionadded :: 3.13 ``_add_alias_``, ``_add_value_alias_``
803821
804822---------------
805823
0 commit comments