How to use the pyprind.progbar.ProgBar function in PyPrind

To help you get started, we’ve selected a few PyPrind examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rasbt / pyprind / pyprind / generator_factory.py View on Github external
from .progpercent import ProgPercent


def generator_factory(mother_class):
    def generator_progress(iteritem, iterations=None, *args, **kw):
        if iterations is None:
            iterations = len(iteritem)
        assert iterations
        mbar = mother_class(iterations, *args, **kw)
        for item in iteritem:
            yield item
            mbar.update()
    return generator_progress

prog_percent = generator_factory(ProgPercent)
prog_bar = generator_factory(ProgBar)