<s> from . progbar import ProgBar <EOL> from . progpercent import ProgPercent <EOL> def generator_factory ( mother_class ) : <EOL> def generator_progress ( iteritem , iterations = None , * args , ** kw ) : <EOL> if iterations is None : <EOL> iterations = len ( iteritem ) <EOL> assert iterations <EOL> mbar = mother_class ( iterations , * args , ** kw ) <EOL> for item in iteritem : <EOL> yield item <EOL> mbar . update ( ) <EOL> return generator_progress <EOL> prog_percent = generator_factory ( ProgPercent ) <EOL> prog_bar = generator_factory ( ProgBar ) </s>
