( additional_text: str = '', )
| 27 | |
| 28 | |
| 29 | def time_execution_async( |
| 30 | additional_text: str = '', |
| 31 | ) -> Callable[[Callable[P, Coroutine[Any, Any, R]]], Callable[P, Coroutine[Any, Any, R]]]: |
| 32 | def decorator(func: Callable[P, Coroutine[Any, Any, R]]) -> Callable[P, Coroutine[Any, Any, R]]: |
| 33 | @wraps(func) |
| 34 | async def wrapper(*args: P.args, **kwargs: P.kwargs) -> R: |
| 35 | start_time = time.time() |
| 36 | result = await func(*args, **kwargs) |
| 37 | execution_time = time.time() - start_time |
| 38 | logger.debug(f'{additional_text} Execution time: {execution_time:.2f} seconds') |
| 39 | return result |
| 40 | |
| 41 | return wrapper |
| 42 | |
| 43 | return decorator |
| 44 | |
| 45 | |
| 46 | def singleton(cls): |
nothing calls this directly
no outgoing calls
no test coverage detected