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.1
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.1.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file timeblock-0.1.1.tar.gz
.
File metadata
- Download URL: timeblock-0.1.1.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 | 644b71ca58f6324a90cd867554b2cab6e78e614e4c02e2ced1c4731b6ef147df |
|
MD5 | 6277c2e5c05112545e97ac6d5c0578b7 |
|
BLAKE2b-256 | c7f9288c9ddd2acaca3ad80ec384f7db0fde550348e02d9c3177692511e8afb2 |
File details
Details for the file timeblock-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: timeblock-0.1.1-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 | b8c29038664c3b09200bf6ad2fe34413909677c480263f8a73febde9976a42a5 |
|
MD5 | 677415678ccb454c5b87d2db74e65ac9 |
|
BLAKE2b-256 | b5689a1e4051e3f7b0fe043f81a22d2156aff069e2f869ac1b5687a565af7c1d |