Skip to main content

get_members_defined_in_enum

FunctionSource

(v_1: str, v_2: Any) in get_members_defined_in_enum(cls: type[Any], exclude_private: bool = True)

Get all members (attributes) defined in an enum class.

inspect.getmembers does not work on enum.Enum. This method is a fallback option when the methods and properties need to be detected from enum class.

Arguments

Requires

NameTypeRequired
Description
clstype[Any]The class to be inspected.
exclude_privateboolA flag. If specified, will not return the attributes that starts with the "_" prefix.

Yields

NameType
Description
v_1strThe name of the member.
v_2AnyThe attribute value of the member.