get_members_defined_in_class
FunctionSource
(v_1: str, v_2: Any) in get_members_defined_in_class(cls: type[Any], exclude_private: bool = True)
Get all members (attributes) defined in a class.
Different from inspect.getmembers, this method will exclude the attributes defined in the base 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. |