Timer#

class scikitplot.utils._time.Timer(message='', *, precision=3, logging_level='info', verbose=False)[source]#

Lightweight ⏱ timing context manager with logger support.

Examples

>>> from scikitplot.utils._time import Timer
>>> with Timer("Building Annoy index...", verbose=True):
...     build_index()
>>> import scikitplot.utils as sp
>>> with sp.Timer(verbose=True, logging_level="debug"):
...     sp.PathNamer()
>>> with sp.Timer(logging_level="debug"):
...     sp.PathNamer().make_filename()
>>> with sp.Timer(logging_level="info"):
...     sp.PathNamer().make_path()
>>> with sp.Timer(logging_level="warn"):
...     sp.make_path()
>>> with sp.Timer(logging_level="warning"):
...     sp.make_path()
>>> with sp.Timer(logging_level="exception"):
...     sp.make_path()
>>> with sp.Timer(logging_level="error"):
...     sp.make_path()
>>> with sp.Timer(logging_level="fatal"):
...     sp.make_path()
>>> with sp.Timer(logging_level="critical"):
...     sp.make_path()
Parameters:
  • message (str)

  • precision (int)

  • logging_level (str)

  • verbose (bool)