gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)

_gnv_ --> _generate_next_value_
This commit is contained in:
Ethan Furman 2023-04-03 17:47:40 -07:00 committed by GitHub
parent c71756fa65
commit 810d365b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -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
...

View File

@ -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.