sdk/src/mlnotify/hooks.py
def base_patch_func(*args, __original_func: Callable, __before: Callable, __after: Callable, **kwargs) -> Any:
    """When patching a method, this function will run instead.

    Args:
        __original_func: The original function before the patch
        __before: The function to run before the original function
        __after: The function to run after the original function
        *args: positional args passed for the original function
        **kwargs: keyword args passed for the original function

    Returns:
        result: The original function's result
    """
    logger.debug("Running patched func", args, kwargs)

    try:
        __before()
    except Exception:
        logger.debug("Failed to run hook function (before)", exc_info=True)

    res = __original_func(*args, **kwargs)

    try:
        __after()
    except Exception:
        logger.debug("Failed to run hook function (after)", exc_info=True)

    return res
When patching a method, this function will run instead.

    Args:
        __original_func: The original function before the patch
        __before: The function to run before the original function
        __after: The function to run after the original function
        *args: positional args passed for the original function
        **kwargs: keyword args passed for the original function

    Returns:
        result: The original function's result
    
When patching a method, this function will run instead.
When patching a method this function will run instead .
def base_patch_func(*args, __original_func: Callable, __before: Callable, __after: Callable, **kwargs) -> Any:
    logger.debug("Running patched func", args, kwargs)
    try:
        __before()
    except Exception:
        logger.debug("Failed to run hook function (before)", exc_info=True)
    res = __original_func(*args, **kwargs)
    try:
        __after()
    except Exception:
        logger.debug("Failed to run hook function (after)", exc_info=True)
    return res
def base_patch_func ( * args , __original_func : Callable , __before : Callable , __after : Callable , ** kwargs ) -> Any : logger . debug ( "Running patched func" , args , kwargs ) try : __before ( ) except Exception : logger . debug ( "Failed to run hook function (before)" , exc_info = True ) res = __original_func ( * args , ** kwargs ) try : __after ( ) except Exception : logger . debug ( "Failed to run hook function (after)" , exc_info = True ) return res
When patching a method, this function will run instead.
When patching a method this function will run instead .
"""When patching a method, this function will run instead.

    Args:
        __original_func: The original function before the patch
        __before: The function to run before the original function
        __after: The function to run after the original function
        *args: positional args passed for the original function
        **kwargs: keyword args passed for the original function

    Returns:
        result: The original function's result
    """
The original function's result
The original function ' s result
result
__original_func
Callable
The original function before the patch
The original function before the patch
__before
Callable
The function to run before the original function
The function to run before the original function
__after
Callable
The function to run after the original function
The function to run after the original function
*args
positional args passed for the original function
positional args passed for the original function
**kwargs
keyword args passed for the original function
keyword args passed for the original function