Decorators#

Decorators to avoid repetitive snippets of code.

E.g. safely opening files or logging the state of a function call.

This is not a command line tool.

lyscripts.decorators.assemble_signature(*args, **kwargs) str[source]#

Assemble the signature of the function call.

lyscripts.decorators.log_state(log_level: int = 20) Callable[source]#

Provide a decorator that logs the state of the function execution.

The log message will simply be the function name where underscores are replaced with spaces. The log_level can be set in the decorator call.

lyscripts.decorators.check_input_file_exists(loading_func: Callable) Callable[source]#

Check if the file path provided to the loading_func exists.

lyscripts.decorators.check_output_dir_exists(saving_func: Callable) Callable[source]#

Make sure the parent directory of the saved file exists.