Custom timer for your Python coding pleasure
Project description
code_timer
Simple python timer to use for single lines of code, or entire functions/classes
New Features!
- codetimer logger allowing you to set the streaming level or hide the logging entirely
- Ability to use
code_timer.Timer
as a class, context manager, decorator - Ability to use separate
code_timer.timer
decorator
Basic Usage
You can use code_timer.Timer
in several different ways:
-
As a class:
t = Timer(name="class") t.start() # Do something t.stop()
-
As a context manager:
with Timer(name="context manager"): # Do something
-
As a decorator:
@Timer(name="decorator") def stuff(): # Do something
You can also use the function defined decorator code_timer.timer
.
-
Without braces
@timer def your_func(): # Do something
-
With braces
@timer(name="my_timer") def your_func(): # Do something
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
code_timer-1.1.2.tar.gz
(4.2 kB
view details)
File details
Details for the file code_timer-1.1.2.tar.gz
.
File metadata
- Download URL: code_timer-1.1.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec5705a628a0b718af7bb5555dafef3997df038cd5a3de44ef5529c5eac86870 |
|
MD5 | 4854621a52e80b19535f06fced9819ed |
|
BLAKE2b-256 | 18163809f2588edc5d0bcb8f0b7a7b779aef7434b3f0a4d8e86ebea3755fe487 |