pythonwrench.inspect module¶
- pythonwrench.inspect.get_argnames(fn: Callable) list[str][source]¶
Get arguments names of a method, function or callable object. This function does not return the ‘self’ argument for methods.
-
pythonwrench.inspect.get_current_fn_name(*, default: T =
'') str | T[source]¶ Get caller function name.
-
pythonwrench.inspect.get_fullname(x: Any, *, inst_suffix: str =
'(...)') str[source]¶ Returns the classname of an object with parent modules.
- Args:
obj: Object to scan. inst_suffix: Suffix appended to the classname in case the object is an instance of a class.
Examples¶
>>> get_fullname([0, 1, 2]) ... 'builtins.list(...)' >>> get_fullname(1.0) ... 'builtins.float(...)' >>> class A: def f(self): return 0 >>> a = A() >>> get_fullname(a) ... '__main__.A(...)' >>> get_fullname(A) ... '__main__.A' >>> get_fullname(a.f) ... '__main__.A.f' >>> get_fullname(A.f) ... '__main__.A.f'