Skip to content

initialized_client_verification

Client verification.

Functions:

Name Description
initialized_client_verification

Check if the client is initialized. Used as a decorator.

initialized_client_verification(func: Callable[__PT, __RT]) -> Callable[__PT, __RT] #

Check if the client is initialized. Used as a decorator.

Source code in src/xpdeep/utils/initialized_client_verification.py
def initialized_client_verification(func: Callable[__PT, __RT]) -> Callable[__PT, __RT]:
    """Check if the client is initialized. Used as a decorator."""

    @wraps(func)
    def wrapper(*args: __PT.args, **kwargs: __PT.kwargs) -> __RT:
        try:
            ClientFactory.CURRENT.get()
        except LookupError as err:
            msg = "Client factory is not ready, call `xpdeep.init`"
            raise RuntimeError(msg) from err

        return func(*args, **kwargs)

    return wrapper