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.0.4
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.0.4.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file timeblock-0.0.4.tar.gz
.
File metadata
- Download URL: timeblock-0.0.4.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 | b7133baa75d9c8788516dcf4aec00acf916ff76199356ebe2708a251108ee085 |
|
MD5 | d4457e4a72581a66fe208d17ac3b3b1d |
|
BLAKE2b-256 | 3986bf577cf9b090b37e0408535d2128daa4f02425215a192d8ac1d0004c5e5b |
File details
Details for the file timeblock-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: timeblock-0.0.4-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 | b9e0b7b64e73c2daba5a0ce14794cfd80595aad0b25574360d14a475fd5c00fd |
|
MD5 | 018753ad88ae04df73a7ef845ed6804b |
|
BLAKE2b-256 | 259e4917e36b629df8725433ce77db7743118d65501a34844791c4da64906b55 |