timer
module¶
Largely this module was simply practice on writing decorators.
Might need to review logging best practices. I don’t want the logger from this module to emit anything, but it seems tedious to place that burden on any module that imports from here.
-
timer
(func)[source][source]¶ Print the runtime of the decorated function.
Utilizes
time.perf_counter
.Todo
Begin using the
timeit
module.There are more specialized ways of profiling things in other modules; however, this works for a rough estimate.
- Parameters
func (function) – Function to profile
- Returns
value – Output of function
time.perf_counter()
.- Return type
-
class
ArgReparser
(func)[source][source]¶ Bases:
object
Class decorator that echoes out the arguments a function was called with.
-
time_dir
(directory=None)[source][source]¶ How long does it take to exec(compile(file)) every file in the startup dir?
-
class
LineWatcher
[source][source]¶ Bases:
object
Class that implements a basic timer.
Registers the
start
andstop
methods with the IPython events API.
-
load_ipython_extension
(ip=None, line_watcher=None)[source][source]¶ Initialize a
LineWatcher
and register start and stop with IPython.