stouputils.decorators package#

This module provides decorators for various purposes:

  • @measure_time - Measure the execution time of a function and print it with the given print function

  • @handle_error - Handle an error with different log levels

  • @timeout - Raise an exception if the function runs longer than the specified timeout

  • @retry - Retry a function when specific exceptions are raised, with configurable delay and max attempts

  • @simple_cache - Easy cache function with parameter caching method

  • @abstract - Mark a function as abstract, using LogLevels for error handling

  • @deprecated - Mark a function as deprecated, using LogLevels for warning handling

  • @silent - Make a function silent (disable stdout, and stderr if specified) (alternative to stouputils.ctx.Muffle)

stouputils decorators examples stouputils decorators examples

Submodules#