mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
[Enum] fix typo (GH-94158)
This commit is contained in:
parent
5b6e5762ca
commit
b4e0d6124a
1 changed files with 8 additions and 8 deletions
16
Lib/enum.py
16
Lib/enum.py
|
@ -1205,21 +1205,21 @@ class Enum(metaclass=EnumType):
|
||||||
def __init__(self, *args, **kwds):
|
def __init__(self, *args, **kwds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _generate_next_value_(name, start, count, last_value):
|
def _generate_next_value_(name, start, count, last_values):
|
||||||
"""
|
"""
|
||||||
Generate the next value when not given.
|
Generate the next value when not given.
|
||||||
|
|
||||||
name: the name of the member
|
name: the name of the member
|
||||||
start: the initial start value or None
|
start: the initial start value or None
|
||||||
count: the number of existing members
|
count: the number of existing members
|
||||||
last_value: the list of values assigned
|
last_values: the list of values assigned
|
||||||
"""
|
"""
|
||||||
if not last_value:
|
if not last_values:
|
||||||
return start
|
return start
|
||||||
try:
|
try:
|
||||||
last = last_value[-1]
|
last = last_values[-1]
|
||||||
last_value.sort()
|
last_values.sort()
|
||||||
if last == last_value[-1]:
|
if last == last_values[-1]:
|
||||||
# no difference between old and new methods
|
# no difference between old and new methods
|
||||||
return last + 1
|
return last + 1
|
||||||
else:
|
else:
|
||||||
|
@ -1233,7 +1233,7 @@ class Enum(metaclass=EnumType):
|
||||||
DeprecationWarning,
|
DeprecationWarning,
|
||||||
stacklevel=3,
|
stacklevel=3,
|
||||||
)
|
)
|
||||||
for v in last_value:
|
for v in last_values:
|
||||||
try:
|
try:
|
||||||
return v + 1
|
return v + 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
@ -1389,7 +1389,7 @@ class Flag(Enum, boundary=STRICT):
|
||||||
name: the name of the member
|
name: the name of the member
|
||||||
start: the initial start value or None
|
start: the initial start value or None
|
||||||
count: the number of existing members
|
count: the number of existing members
|
||||||
last_value: the last value assigned or None
|
last_values: the last value assigned or None
|
||||||
"""
|
"""
|
||||||
if not count:
|
if not count:
|
||||||
return start if start is not None else 1
|
return start if start is not None else 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue