wuttjamaican.progress

Progress Indicators

class wuttjamaican.progress.ConsoleProgress(*args, **kwargs)[source]

Provides a console-based progress bar.

This is a subclass of ProgressBase.

Simple usage is like:

from wuttjamaican.progress import ConsoleProgress

def action(obj, i):
    print(obj)

items = [1, 2, 3, 4, 5]

app = config.get_app()
app.progress_loop(action, items, ConsoleProgress,
                  message="printing items")

See also progress_loop().

class wuttjamaican.progress.ProgressBase(message, maximum)[source]

Base class for progress indicators.

This is only a base class, and should not be used directly. For simple console use, see ConsoleProgress.

Progress indicators are created via factory from various places in the code. The factory is called with (message, maximum) args and it must return a progress instance with these methods:

Code may call update() several times while its operation continues; it then ultimately should call finish().

See also wuttjamaican.util.progress_loop() and wuttjamaican.app.AppHandler.progress_loop() for a way to do these things automatically from code.

Parameters:
  • message – Info message to be displayed along with the progress bar.

  • maximum – Max progress value.

finish()[source]

Wrap things up for the progress display etc.

update(value)[source]

Update the current progress value.

Parameters:

value – New progress value to be displayed.