Skip to content

Decorators

K = TypeVar('K') module-attribute

P = ParamSpec('P') module-attribute

T = TypeVar('T') module-attribute

first_prompt = False module-attribute

only_after_first_prompt(value_before=None)

Decorator to prevent a function from running before the first prompt was displayed. The 'value_before' parameter can be used to specify the value that is returned if the function is called before the first prompt was displayed.

suppress_errors(fallback=None, should_warn=True)

Decorator to make a function return a fallback value when it would otherwise error. The 'fallback' parameter can be used to specify the fallback value. If the 'should_warn' parameter is set, a warning will be printed whenever an error is suppressed.