(func)
| 1 | import time |
| 2 | |
| 3 | def timer(func): |
| 4 | def wrapper(*args, **kwargs): |
| 5 | start = time.time() |
| 6 | result = func(*args, **kwargs) |
| 7 | end = time.time() |
| 8 | print(f"{func.__name__} took {end - start:.4f}s") |
| 9 | return result |
| 10 | return wrapper |
| 11 | |
| 12 | @timer |
| 13 | def heavy_computation(n): |
nothing calls this directly
no outgoing calls
no test coverage detected