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.

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

Process and format the function call information.

Parameters:
  • func_name (str) – Name of the function being called.

  • frame (FrameType) – The current stack frame.

Returns:

Formatted call message.

Return type:

str

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

Process and format the function return information.

Parameters:
  • func_name (str) – Name of the function returning.

  • result (Any) – The result returned by the function.

Returns:

Formatted return message.

Return type:

str

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

Process and format the update information of a variable.

Parameters:
  • old_value (Any) – The old value of the variable.

  • current_value (Any) – The new value of the variable.

Returns:

Formatted old and new values.

Return type:

Tuple[str, str]

_extract_args_kwargs(frame: FrameType) Tuple[List[Any], dict][source]

Extract positional and keyword arguments from the current frame.

Parameters:

frame (FrameType) – The current stack frame.

Returns:

Lists of positional and keyword arguments.

Return type:

Tuple[List[Any], dict]

_format_args_kwargs(args: List[Any], kwargs: dict) str[source]

Format positional and keyword arguments into a string.

Parameters:
  • args (List[Any]) – List of positional arguments.

  • kwargs (dict) – Dictionary of keyword arguments.

Returns:

Formatted arguments string.

Return type:

str

_format_value(value: Any, is_return: bool = False) str[source]

Format a value into a string.

Parameters:
  • value (Any) – The value to format.

  • is_return (bool) – Flag indicating if the value is a return value.

Returns:

Formatted value string.

Return type:

str

_format_return(result: Any) str[source]

Format the return value of a function.

Parameters:

result (Any) – The result returned by the function.

Returns:

Formatted return message.

Return type:

str

_abc_impl = <_abc._abc_data object>