Spaces:
Sleeping
Sleeping
File size: 329 Bytes
e3af2b1 |
1 2 3 4 5 6 7 8 9 10 11 |
from contextlib import wraps as _wraps
from time import time as _time
def runtime(func):
@_wraps(func)
def wrapper(*args, **kwargs):
before = _time()
(ret:=func(*args, **kwargs))
print(f'function "{func.__name__}" took {_time() - before} seconds.')
return ret
return wrapper |