CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
_timer.py20 linesDownload Raw Back to rich
1"""2Timer context manager, only used in debug.3 4"""5 6from time import time7 8import contextlib9from typing import Generator10 11 12@contextlib.contextmanager13def timer(subject: str = "time") -> Generator[None, None, None]:14    """print the elapsed time. (only used in debugging)"""15    start = time()16    yield17    elapsed = time() - start18    elapsed_ms = elapsed * 100019    print(f"{subject} elapsed {elapsed_ms:.1f}ms")20 
Aluode/PerceptionLabPortable · CoolFace