Method
Method ¶
Bases: Function
The Method class represents a method of a class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
Callable
|
The method to be inspected. |
required |
cls
|
type
|
The class to which the method belongs. |
required |
skip_self
|
bool
|
Whether to skip the self parameter. |
True
|
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the method. |
docstring |
str
|
The docstring of the method. |
has_docstring |
bool
|
Whether the method has a docstring. |
description |
str
|
The description part of the method's docstring. |
params |
list[Parameter]
|
A list of parameters of the method. |
dict |
dict
|
A dictionary representation of the method's attributes. |
is_static |
bool
|
Whether the method is static. |
is_classmethod |
bool
|
Whether the method is a classmethod. |
is_property |
bool
|
Whether the method is a property. |
is_private |
bool
|
Whether the method is private. |
is_protected |
bool
|
Whether the method is protected. |
is_public |
bool
|
Whether the method is public. |
is_inherited |
bool
|
Whether the method is inherited. |
Source code in objinspect/method.py
class_instance
property
¶
The instance to which this method is bound, or None if unbound.
is_private
property
¶
is_private: bool
Whether the method is private (double underscore prefix, excluding dunders).
MethodFilter ¶
MethodFilter(init: bool = True, public: bool = True, inherited: bool = True, static_methods: bool = True, protected: bool = False, private: bool = False, classmethod: bool = False)
Source code in objinspect/method.py
check ¶
split_args_kwargs ¶
split_args_kwargs(func_args: dict[str, RuntimeValue], func: Function | Method) -> tuple[tuple[RuntimeValue, ...], dict[str, RuntimeValue]]
Split the arguments passed to a function into positional and keyword arguments.