pypet/utils/decorators.py
def manual_run(turn_into_run=True, store_meta_data=True, clean_up=True):
    """Can be used to decorate a function as a manual run function.

    This can be helpful if you want the run functionality without using an environment.

    :param turn_into_run:

        If the trajectory should become a `single run` with more specialized functionality
        during a single run.

    :param store_meta_data:

        If meta-data like runtime should be automatically stored

    :param clean_up:

        If all data added during the single run should be removed, only works
        if ``turn_into_run=True``.

    """
    def wrapper(func):
        @functools.wraps(func)
        def new_func(traj, *args, **kwargs):
            do_wrap = not traj._run_by_environment
            if do_wrap:
                traj.f_start_run(turn_into_run=turn_into_run)
            result = func(traj, *args, **kwargs)
            if do_wrap:
                traj.f_finalize_run(store_meta_data=store_meta_data,
                                    clean_up=clean_up)
            return result

        return new_func

    return wrapper
def manual_run(turn_into_run=True, store_meta_data=True, clean_up=True):
    def wrapper(func):
        @functools.wraps(func)
        def new_func(traj, *args, **kwargs):
            do_wrap = not traj._run_by_environment
            if do_wrap:
                traj.f_start_run(turn_into_run=turn_into_run)
            result = func(traj, *args, **kwargs)
            if do_wrap:
                traj.f_finalize_run(store_meta_data=store_meta_data,
                                    clean_up=clean_up)
            return result

        return new_func

    return wrapper
def manual_run ( turn_into_run = True , store_meta_data = True , clean_up = True ) : def wrapper ( func ) : @ functools . wraps ( func ) def new_func ( traj , * args , * * kwargs ) : do_wrap = not traj . _run_by_environment if do_wrap : traj . f_start_run ( turn_into_run = turn_into_run ) result = func ( traj , * args , * * kwargs ) if do_wrap : traj . f_finalize_run ( store_meta_data = store_meta_data , clean_up = clean_up ) return result return new_func return wrapper
Can be used to decorate a function as a manual run function.

    This can be helpful if you want the run functionality without using an environment.

    :param turn_into_run:

        If the trajectory should become a `single run` with more specialized functionality
        during a single run.

    :param store_meta_data:

        If meta-data like runtime should be automatically stored

    :param clean_up:

        If all data added during the single run should be removed, only works
        if ``turn_into_run=True``.
Can be used to decorate a function as a manual run function .