Skip to content

Commit 01d3a59

Browse files
authored
Update enum.py Trim trailing whitespace and fix formatting in enum.py
- Remove trailing spaces to satisfy lint/pre-commit checks - The code itself is not chnaged it is just the issue of the test
1 parent d7f1af9 commit 01d3a59

File tree

1 file changed

+25
-31
lines changed

1 file changed

+25
-31
lines changed

Lib/enum.py

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -773,37 +773,31 @@ def __delattr__(cls, attr):
773773
super().__delattr__(attr)
774774

775775
def __dir__(cls):
776-
interesting = set([
777-
'__class__', '__contains__', '__doc__', '__getitem__',
778-
'__iter__', '__len__', '__members__', '__module__',
779-
'__name__', '__qualname__',
780-
]
781-
+ cls._member_names_
782-
)
783-
784-
if cls._new_member_ is not object.__new__:
785-
interesting.add('__new__')
786-
if cls.__init_subclass__ is not object.__init_subclass__:
787-
interesting.add('__init_subclass__')
788-
789-
# SGP: Include documented public _sunder_ helpers defined on the Enum class.
790-
# SGP: This makes them discoverable via dir(Enum) so rlcompleter can surface
791-
# SGP: them in REPL completions. (rlcompleter drives dotted-name completion
792-
# SGP: from dir(); _add_alias_/_add_value_alias_ are supported _sunder_ APIs.)
793-
for _n in ("_add_alias_", "_add_value_alias_"):
794-
if _n in cls.__dict__:
795-
interesting.add(_n)
796-
797-
if cls._member_type_ is object:
798-
return sorted(interesting)
799-
else:
800-
# return whatever mixed-in data type has
801-
# SGP: union the mixin's dir() with 'interesting'
802-
return sorted(set(dir(cls._member_type_)) | interesting)
803-
804-
805-
806-
776+
interesting = set([
777+
'__class__', '__contains__', '__doc__', '__getitem__',
778+
'__iter__', '__len__', '__members__', '__module__',
779+
'__name__', '__qualname__',
780+
] + cls._member_names_)
781+
782+
if cls._new_member_ is not object.__new__:
783+
interesting.add('__new__')
784+
if cls.__init_subclass__ is not object.__init_subclass__:
785+
interesting.add('__init_subclass__')
786+
787+
# SGP: Include documented public _sunder_ helpers defined on the Enum class.
788+
# SGP: This makes them discoverable via dir(Enum) so rlcompleter can surface
789+
# SGP: them in REPL completions. (rlcompleter drives dotted-name completion
790+
# SGP: from dir(); _add_alias_/_add_value_alias_ are supported _sunder_ APIs.)
791+
for _n in ("_add_alias_", "_add_value_alias_"):
792+
if _n in cls.__dict__:
793+
interesting.add(_n)
794+
795+
if cls._member_type_ is object:
796+
return sorted(interesting)
797+
else:
798+
# return whatever mixed-in data type has
799+
# SGP: union the mixin's dir() with 'interesting'
800+
return sorted(set(dir(cls._member_type_)) | interesting)
807801

808802
def __getitem__(cls, name):
809803
"""

0 commit comments

Comments
 (0)