(method)
return runnable
Decorator function to mark methods in Acquisition classes which require running setup if indicated by _needs_setup
    :param method: acquisition method
Decorator function to mark methods in Acquisition classes which require running setup if indicated by _needs_setup
    :param method: acquisition method
Decorator function to mark methods in Acquisition classes which require running setup if indicated by _needs_setup : param method : acquisition method
def setup_required(method):
    """
    Decorator function to mark methods in Acquisition classes which require running setup if indicated by _needs_setup
    :param method: acquisition method
    """
    @wraps(method)
    def runnable(instance, *args, **kwargs):
        assert isinstance(instance, Acquisition)
        hp = instance.highest_parent
        if hp._needs_setup:
            # Avoid infinite loops, caused by setup() somehow invoking the evaluate on another acquisition
            # e.g. through feasible_data_index.
            hp._needs_setup = False

            # 1 - optimize
            hp._optimize_models()

            # 2 - setup
            hp._setup()
        results = method(instance, *args, **kwargs)
        return results

    return runnable
def setup_required ( method ) : @ wraps ( method ) def runnable ( instance , * args , * * kwargs ) : assert isinstance ( instance , Acquisition ) hp = instance . highest_parent if hp . _needs_setup : # Avoid infinite loops, caused by setup() somehow invoking the evaluate on another acquisition # e.g. through feasible_data_index. hp . _needs_setup = False # 1 - optimize hp . _optimize_models ( ) # 2 - setup hp . _setup ( ) results = method ( instance , * args , * * kwargs ) return results return runnable