decorators ¤
Functions:
-
only_after_first_prompt
–Decorator to prevent a function from running before the first prompt was displayed.
-
suppress_errors
–Decorator to make a function return a fallback value when it would otherwise error.
Attributes:
-
first_prompt
– -
P
– -
T
– -
K
–
only_after_first_prompt ¤
only_after_first_prompt(
value_before: T | None = None,
) -> Callable[[Callable[P, T]], Callable[P, T | 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 ¤
suppress_errors(
fallback: K = None, should_warn: bool = True
) -> Callable[[Callable[P, T]], Callable[P, T | K]]
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.