pimlico.utils.progress module¶
-
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.
-
get_open_progress_bar
(title=None)[source]¶ Builds a standard progress bar for the case where the total length (max value) is not known, i.e. an open-ended progress bar.
-
class
SafeProgressBar
(maxval=None, widgets=None, term_width=None, poll=1, left_justify=True, fd=None)[source]¶ Bases:
progressbar.progressbar.ProgressBar
Override basic progress bar to wrap update() method with a couple of extra features.
- 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.
- 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.
-
class
DummyFileDescriptor
[source]¶ Bases:
future.types.newobject.newobject
Passed in to ProgressBar instead of a file descriptor (e.g. stderr) to ensure that nothing gets output.
-
class
NonOutputtingProgressBar
(*args, **kwargs)[source]¶ Bases:
pimlico.utils.progress.SafeProgressBar
Behaves like ProgressBar, but doesn’t output anything.
-
class
LittleOutputtingProgressBar
(*args, **kwargs)[source]¶ Bases:
pimlico.utils.progress.SafeProgressBar
Behaves like ProgressBar, but doesn’t output much. Instead of constantly redrawing the progress bar line, it outputs a simple progress message every time it hits the next 10% mark.
If running on a terminal, this will update the line, as with a normal progress bar. If piping to a file, this will just print a new line occasionally, so won’t fill up your file with thousands of progress updates.