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
| Name | Type | Required | |
|---|---|---|---|
cls | type[Any] | The class to be inspected. | |
exclude_private | bool | A flag. If specified, will not return the attributes that starts with the "_" prefix. |
Yields
| Name | Type | |
|---|---|---|
v_1 | str | The name of the member. |
v_2 | Any | The attribute value of the member. |