@@ -773,31 +773,37 @@ def __delattr__(cls, attr):
773
773
super ().__delattr__ (attr )
774
774
775
775
def __dir__ (cls ):
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 )
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
+
801
807
802
808
def __getitem__ (cls , name ):
803
809
"""
0 commit comments