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.0.tar.gz
(4.1 kB
view details)
File details
Details for the file code_timer-1.1.0.tar.gz
.
File metadata
- Download URL: code_timer-1.1.0.tar.gz
- Upload date:
- Size: 4.1 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 | e74b0889da9eb0cab70bbf4497b1481d036b779baf089badf914fd8fa7c6251b |
|
MD5 | a5fe39dc9733b97f8be95055e524abfa |
|
BLAKE2b-256 | 421bab6fc40bd778de04adc26bfe9a21940ff08c43ec68f1a7276af04d787632 |