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 hashes)