objwatch.wrappers package

Submodules

objwatch.wrappers.abc_wrapper module

class objwatch.wrappers.abc_wrapper.ABCWrapper[source]

Bases: ABC

Abstract base class for function wrappers to extend tracing and logging functionality.

abstract wrap_call(func_name: str, frame: FrameType) str[source]

Process and format the function call information.

Args:

func_name (str): Name of the function being called. frame (FrameType): The current stack frame.

Returns:

str: Formatted call message.

abstract wrap_return(func_name: str, result: Any) str[source]

Process and format the function return information.

Args:

func_name (str): Name of the function returning. result (Any): The result returned by the function.

Returns:

str: Formatted return message.

wrap_upd(old_value: Any, current_value: Any) Tuple[str, str][source]

Process and format the update information of a variable.

Args:

old_value (Any): The old value of the variable. current_value (Any): The new value of the variable.

Returns:

Tuple[str, str]: Formatted old and new values.

objwatch.wrappers.base_wrapper module

class objwatch.wrappers.base_wrapper.BaseWrapper[source]

Bases: ABCWrapper

BaseWrapper implements the ABCWrapper abstract methods to provide basic logging functionality.

wrap_call(func_name: str, frame: FrameType) str[source]

Format the function call information.

Args:

func_name (str): Name of the function being called. frame (FrameType): The current stack frame.

Returns:

str: Formatted call message.

wrap_return(func_name: str, result: Any) str[source]

Format the function return information.

Args:

func_name (str): Name of the function returning. result (Any): The result returned by the function.

Returns:

str: Formatted return message.

wrap_upd(old_value: Any, current_value: Any) Tuple[str, str][source]

Format the update information of a variable.

Args:

old_value (Any): The old value of the variable. current_value (Any): The new value of the variable.

Returns:

Tuple[str, str]: Formatted old and new values.

objwatch.wrappers.cpu_memory_wrapper module

objwatch.wrappers.tensor_shape_wrapper module

objwatch.wrappers.torch_memory_wrapper module

Module contents