sdk/src/mlnotify/hooks.py
def patch(destination: Any, name: str, before: Callable, after: Callable) -> None:
    """This function patches the destination.name function and replaces it with the base_patch_func.

    Args:
        destination: The class/dict to patch
        name: The function name to be replaced
        before: The function to run before the original function
        after: The function to run after the original function
    """
    original_func: Callable = gorilla.get_attribute(destination, name)

    partial_type: Union[Type[partial], Type[partialmethod]] = partialmethod if inspect.isclass(destination) else partial

    patch_func = partial_type(base_patch_func, __original_func=original_func, __before=before, __after=after)
    patch = gorilla.Patch(destination, name, patch_func, settings=GORILLA_SETTINGS)
    gorilla.apply(patch)
This function patches the destination.name function and replaces it with the base_patch_func.

    Args:
        destination: The class/dict to patch
        name: The function name to be replaced
        before: The function to run before the original function
        after: The function to run after the original function
    
This function patches the destination.name function and replaces it with the base_patch_func.
This function patches the destination . name function and replaces it with the base_patch_func .
def patch(destination: Any, name: str, before: Callable, after: Callable) -> None:
    original_func: Callable = gorilla.get_attribute(destination, name)
    partial_type: Union[Type[partial], Type[partialmethod]] = partialmethod if inspect.isclass(destination) else partial
    patch_func = partial_type(base_patch_func, __original_func=original_func, __before=before, __after=after)
    patch = gorilla.Patch(destination, name, patch_func, settings=GORILLA_SETTINGS)
    gorilla.apply(patch)
def patch ( destination : Any , name : str , before : Callable , after : Callable ) -> None : original_func : Callable = gorilla . get_attribute ( destination , name ) partial_type : Union [ Type [ partial ] , Type [ partialmethod ] ] = partialmethod if inspect . isclass ( destination ) else partial patch_func = partial_type ( base_patch_func , __original_func = original_func , __before = before , __after = after ) patch = gorilla . Patch ( destination , name , patch_func , settings = GORILLA_SETTINGS ) gorilla . apply ( patch )
This function patches the destination.name function and replaces it with the base_patch_func.
This function patches the destination . name function and replaces it with the base_patch_func .
"""This function patches the destination.name function and replaces it with the base_patch_func.

    Args:
        destination: The class/dict to patch
        name: The function name to be replaced
        before: The function to run before the original function
        after: The function to run after the original function
    """
destination
Any
The class/dict to patch
The class / dict to patch
name
str
The function name to be replaced
The function name to be replaced
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