yat
Yet Another Timer for Python code.
pip install yat
Usage
Decorator
import time
from yat import YAT
@YAT()
def decorate_timer():
time.sleep(1)
decorate_timer()
# Output: decorate_timer (example.py:7) took 1.00000 seconds to run.
Context Manager
import time
from yat import YAT
def context_timer():
with YAT():
time.sleep(1)
context_timer()
# Output: context_timer (example.py:7) took 1.00000 seconds to run.
Other (Custom Message)
import time
from yat import YAT
with YAT("a message"):
time.sleep(1)
# Output: a message (example.py:5) took 1.00000 seconds to run.