Time blocks of code using a context manager
Project description
🕐 timeblock
Helpful snippet for timing blocks, basically contexttimer with a few tweaks / forked.
pip install timeblock==0.1.0
from timeblock import Timer
with Timer() as timer:
sleep(1)
print(timer.elapsed) # 1s
with Timer(output=True):
sleep(1)
# logger.debug(f"Elapsed time: {timer.elapsed}"
with Timer("sleepy time", output=print):
sleep(1)
# print("sleepy time took {:.3f} seconds".format(timer.elapsed))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timeblock-0.1.0.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file timeblock-0.1.0.tar.gz
.
File metadata
- Download URL: timeblock-0.1.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4150aa4e8cafa6e9e72df31cf2440aa12e0403bb8c7fd8965db7e810397cc3 |
|
MD5 | d3f354faee216940a9b59801ea615fae |
|
BLAKE2b-256 | 3a3fd0614d7e10aa63b6f710514b774c196ab4fa75d6c2d33b6e55ba83df9aef |
File details
Details for the file timeblock-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: timeblock-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4979d2bf55b4dd2d4470eed0caba70e4b47dfe8cbf81e2955e9299ee079a7a1c |
|
MD5 | e3ab7019a22d5c87a2bf2e72b13b15e7 |
|
BLAKE2b-256 | 0f201a951ed013109f29af6e5e1ec2801d61eb9389f32c897accc82653e95c3b |