gfw.common.decorators#
Module that contains simple function decorators.
Functions
Decorator generator function to log the number of items that are being iterated. |
|
Decorator to measure execution time of a function. |
- counter(items, logger=<Logger gfw.common.decorators (WARNING)>, message='{count}')[source]#
Decorator generator function to log the number of items that are being iterated.
This is particularly useful when you have a generator, you want to know its size but you don’t control the function that is going to iterate it.
- timing(f, quiet=False, logger=<Logger gfw.common.decorators (WARNING)>, decimals=4)[source]#
Decorator to measure execution time of a function.
- Parameters:
- Returns:
A wrapper around the original callable that returns a 2D tuple with:
Whatever the original callable returns.
The elapsed time.
- Return type:
Callable