app/src/k8s/__init__.py
def check_resource(predicate: Predicate, fn: Callable, *args, **kwargs) -> bool:
    """Retrieves a k8s API resource, applies predicate to it and returns result.

    Args:
        predicate:
            A function accepting the resource fetched by fn, should return
            a bool.
        fn: Kubernetes API function.
        *args: Arguments for fn.
        **kwargs: Keyword arguments for fn.

    Returns:
        Whether the fetched resource satisfies the given predicate.
    """
    result = fn(*args, **kwargs)
    retval = predicate(result)
    try:
        log.debug(f"Checking {result.kind} "
                  f"{result.metadata.namespace}/{result.metadata.name}: "
                  f"{predicate.__name__}? {retval}")
    except AttributeError:  # debug print only works for k8s resources
        pass
    return retval
Retrieves a k8s API resource, applies predicate to it and returns result.

    Args:
        predicate:
            A function accepting the resource fetched by fn, should return
            a bool.
        fn: Kubernetes API function.
        *args: Arguments for fn.
        **kwargs: Keyword arguments for fn.

    Returns:
        Whether the fetched resource satisfies the given predicate.
    
Retrieves a k8s API resource, applies predicate to it and returns result.
Retrieves a k8s API resource applies predicate to it and returns result .
def check_resource(predicate: Predicate, fn: Callable, *args, **kwargs) -> bool:
    result = fn(*args, **kwargs)
    retval = predicate(result)
    try:
        log.debug(f"Checking {result.kind} "
                  f"{result.metadata.namespace}/{result.metadata.name}: "
                  f"{predicate.__name__}? {retval}")
    except AttributeError:  
        pass
    return retval
def check_resource ( predicate : Predicate , fn : Callable , * args , ** kwargs ) -> bool : result = fn ( * args , ** kwargs ) retval = predicate ( result ) try : log . debug ( f"Checking {result.kind} " f"{result.metadata.namespace}/{result.metadata.name}: " f"{predicate.__name__}? {retval}" ) except AttributeError : pass return retval
Retrieves a k8s API resource, applies predicate to it and returns result.
Retrieves a k8s API resource applies predicate to it and returns result .
"""Retrieves a k8s API resource, applies predicate to it and returns result.

    Args:
        predicate:
            A function accepting the resource fetched by fn, should return
            a bool.
        fn: Kubernetes API function.
        *args: Arguments for fn.
        **kwargs: Keyword arguments for fn.

    Returns:
        Whether the fetched resource satisfies the given predicate.
    """ # debug print only works for k8s resources
Whether the fetched resource satisfies the given predicate.
Whether the fetched resource satisfies the given predicate .
predicate
Predicate
A function accepting the resource fetched by fn, should return
a bool.
A function accepting the resource fetched by fn should return a bool .
fn
Callable
Kubernetes API function.
Kubernetes API function .
*args
Arguments for fn.
Arguments for fn .
**kwargs
Keyword arguments for fn.
Keyword arguments for fn .