utils.inspect module

utils.inspect.find_caller(depth: int = 1) tuple[str, str, int][源代码]

获取调用者信息

参数:

depth (int, optional) -- 调用深度. Defaults to 1.

返回:

(文件名, 调用者名称, 调用处行数)

返回类型:

tuple[str, str, int]

utils.inspect.module_filepath(filepath: str)[源代码]

模块格式的路径,path.to.module.file

utils.inspect.wrapped_info(source: Callable | type)[源代码]

装饰器获取被装饰函数或类的信息

参数:

source (Callable | type) -- 被装饰函数或类

返回:

(文件名, 函数名)

返回类型:

tuple[str, str]