ProgressBar¶
- class odl.util.testutils.ProgressBar(text='progress', *njobs)[source]¶
Bases:
object
A simple command-line progress bar.
Usage:
>>> progress = ProgressBar('Reading data', 10)
- Reading data: [ ] Starting
>>> progress.update(4) #halfway, zero indexing
Reading data: [############### ] 50.0%
Multi-indices, from slowest to fastest:
>>> progress = ProgressBar('Reading data', 10, 10)
- Reading data: [ ] Starting
>>> progress.update(9, 8)
Reading data: [############################# ] 99.0%
Supports simply calling update, which moves the counter forward:
>>> progress = ProgressBar('Reading data', 10, 10)
- Reading data: [ ] Starting
>>> progress.update()
Reading data: [ ] 1.0%
Methods
start
()Print the initial bar.
update
(*indices)Update the bar according to
indices
.