mirror of https://github.com/python/cpython
gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)
_gnv_ --> _generate_next_value_
This commit is contained in:
parent
c71756fa65
commit
810d365b5e
|
@ -284,6 +284,7 @@ The values are chosen by :func:`_generate_next_value_`, which can be
|
|||
overridden::
|
||||
|
||||
>>> class AutoName(Enum):
|
||||
... @staticmethod
|
||||
... def _generate_next_value_(name, start, count, last_values):
|
||||
... return name
|
||||
...
|
||||
|
|
|
@ -1146,6 +1146,7 @@ class Enum(metaclass=EnumType):
|
|||
def __init__(self, *args, **kwds):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
"""
|
||||
Generate the next value when not given.
|
||||
|
@ -1288,6 +1289,7 @@ class StrEnum(str, ReprEnum):
|
|||
member._value_ = value
|
||||
return member
|
||||
|
||||
@staticmethod
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
"""
|
||||
Return the lower-cased version of the member name.
|
||||
|
@ -1337,6 +1339,7 @@ class Flag(Enum, boundary=CONFORM):
|
|||
|
||||
_numeric_repr_ = repr
|
||||
|
||||
@staticmethod
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
"""
|
||||
Generate the next value when not given.
|
||||
|
|
Loading…
Reference in New Issue