Lib Timer

Manages time.

class idpconfgen.libs.libtimer.ProgressBar(total, prefix='', suffix='', decimals=1, bar_length=20)[source]

Contextualize a Progress Bar.

Parameters:
  • total (int convertable) – The total number o iteractions expected.

  • prefix (str) – Some prefix to enhance readability.

  • suffix (str) – Some suffix to enhance readability.

  • decimals (int-convertable) – The demicals to show in percentage. Defaults to 1.

  • bar_length (int, float, -convertable) – The length of the bar. If not provided (None), uses 20.

  • Thanks to for the initial template function

  • https (//dev.to/natamacm/progressbar-in-python-a3n)

Examples

>>> with ProgressBar(5000, suffix='frames') as PB:
>>>     for i in trajectory:
>>>         # do something
>>>         PB.increment()
increment()[source]

Print next progress bar increment.

class idpconfgen.libs.libtimer.ProgressCounter(suffix='Running operations', **kwargs)[source]

Represent progression via a counter.

increment()[source]

Increment counter by one.

Represent progression in terminal.

class idpconfgen.libs.libtimer.ProgressFake(*args, **kwargs)[source]

Simulate the interface of ProgressBar but does nothing.

Used in servers where ProgressBar makes no sense.

increment()[source]

Simulate ProgressBar interface.

Does nothing.

class idpconfgen.libs.libtimer.ProgressWatcher(items, *args, **kwargs)[source]

Construct a Progress Watcher context.

idpconfgen.libs.libtimer.record_time(process_name='', *args, **kwargs)[source]

Record time of function execution.

Use as decorator.

idpconfgen.libs.libtimer.timeme(func, *args, **kwargs)[source]

Log the time taken to run a function.