4 from typing import Callable
9 with timer.Timer() as t:
13 print(f'That took {walltime}s.')
16 def __init__(self) -> None:
20 def __enter__(self) -> Callable[[], float]:
21 self.start = time.perf_counter()
23 return lambda: self.end - self.start
25 def __exit__(self, *args) -> bool:
26 self.end = time.perf_counter()
27 return None # don't suppress exceptions