INNER CODE UNIT · Python

guard_against_rio_run

rio-labs/rio · rio/app.py:79

def guard_against_rio_run(func: t.Callable[P, R]) -> t.Callable[P, R]:
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        if rio.global_state.launched_via_rio_run:
            raise RuntimeError(
                f"`App.{func.__name__}` conflicts with `rio run`. Either delete"
                f' that line, or move it behind a `if __name__ == "__main__":`'
                f" guard."
            )

        return func(*args, **kwargs)

    return wrapper


@t.final
class App:
    """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…