Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Lib/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def _is_sunder(name):
return (
len(name) > 2 and
name[0] == name[-1] == '_' and
name[1:2] != '_' and
name[-2:-1] != '_'
name[1] != '_' and
name[-2] != '_'
)

def _is_internal_class(cls_name, obj):
Expand All @@ -81,7 +81,6 @@ def _is_private(cls_name, name):
if (
len(name) > pat_len
and name.startswith(pattern)
and name[pat_len:pat_len+1] != ['_']
and (name[-1] != '_' or name[-2] != '_')
):
return True
Expand Down Expand Up @@ -156,7 +155,6 @@ def _dedent(text):
Like textwrap.dedent. Rewritten because we cannot import textwrap.
"""
lines = text.split('\n')
blanks = 0
for i, ch in enumerate(lines[0]):
if ch != ' ':
break
Expand Down Expand Up @@ -1639,7 +1637,7 @@ def _simple_enum(etype=Enum, *, boundary=None, use_args=None):
Class decorator that converts a normal class into an :class:`Enum`. No
safety checks are done, and some advanced behavior (such as
:func:`__init_subclass__`) is not available. Enum creation can be faster
using :func:`simple_enum`.
using :func:`_simple_enum`.

>>> from enum import Enum, _simple_enum
>>> @_simple_enum(Enum)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class TestHelpers(unittest.TestCase):

sunder_names = '_bad_', '_good_', '_what_ho_'
dunder_names = '__mal__', '__bien__', '__que_que__'
private_names = '_MyEnum__private', '_MyEnum__still_private'
private_names = '_MyEnum__private', '_MyEnum__still_private', '_MyEnum___triple_private'
private_and_sunder_names = '_MyEnum__private_', '_MyEnum__also_private_'
random_names = 'okay', '_semi_private', '_weird__', '_MyEnum__'

Expand Down