Skip to content
Snippets Groups Projects
Commit 9024e4e9 authored by Mathieu Beligon's avatar Mathieu Beligon
Browse files

[utils] (timeit)

parent a5bca86e
No related branches found
No related tags found
No related merge requests found
from datetime import datetime
from functools import wraps
from typing import Callable
def create_time_id() -> str:
return datetime.now().strftime("%Y%m%d_%H%M%S")
def time_it(f: Callable):
@wraps(f)
def _f(*args, **kwargs):
t = datetime.now()
rv = f(*args, **kwargs)
print(f"{f.__name__} took {datetime.now() - t}")
return rv
return _f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment