Module src.jsonid.helpers

Code helperrs.

Functions

def timeit(func)
Expand source code
def timeit(func):
    """Decorator to output the time taken for a function"""

    async def wrapper(*args, **kwargs):
        start = time.perf_counter()
        result = await func(*args, **kwargs)
        end = time.perf_counter()
        elapsed = end - start
        func_name = _function_name(str(func))
        # pylint: disable=W1203
        logger.debug(f"Time taken: {elapsed:.6f} seconds ({func_name}())")
        return result

    return wrapper

Decorator to output the time taken for a function