pimlico.utils.progress module

class pimlico.utils.progress.ProgressBarIter(iterable, title=None)[source]

Bases: object

class pimlico.utils.progress.SafeProgressBar(maxval=None, widgets=None, term_width=None, poll=1, left_justify=True, fd=<open file '<stderr>', mode 'w'>)[source]

Bases: progressbar.ProgressBar

Override basic progress bar to wrap update() method with a couple of extra features.

  1. You don’t need to call start() – it will be called when the first update is received. This is good for processes that have a bit of a start-up lag, or where starting to iterate might generate some other output.
  2. An error is not raised if you update with a value higher than maxval. It’s the most annoying thing ever if you run a long process and the whole thing fails near the end because you slightly miscalculated maxval.
increment()[source]
update(value=None)[source]
pimlico.utils.progress.get_progress_bar(maxval, counter=False, title=None, start=True)[source]

Simple utility to build a standard progress bar, so I don’t have to think about this each time I need one. Starts the progress bar immediately.

start is no longer used, included only for backwards compatibility.

pimlico.utils.progress.slice_progress(iterable, num_items, title=None)[source]