5 """ProgressBar class holds the options of the progress bar. 7 start State from which start the progress. For example, if start is 8 5 and the end is 10, the progress of this state is 50% 9 end State in which the progress has terminated. 11 fill String to use for "filled" used to represent the progress 12 blank String to use for "filled" used to represent remaining space. 16 def __init__(self, process=" ", start=0, end=10, width=12, fill='=', blank='.', format='running %(process)s [%(fill)s%(blank)s] %(progress)s%%
', incremental=True): 26 self.step = 100 / float(width) 40 fill = progressed * self.
fill 43 return self.
format % {
'process': proc,
'fill': fill,
'blank': blank,
'progress': int(self.
progress)}
48 return float(increment * 100) / self.
end 59 """Resets the current progress to the start point""" 65 """Extends ProgressBar to allow you to use it straighforward on a script. 66 Accepts an extra keyword argument named `stdout` (by default use sys.stdout) 67 and may be any file-object to which send the progress status. 70 super(AnimatedProgressBar, self).
__init__(*args, **kwargs)
71 self.
stdout = kwargs.get(
'stdout', sys.stdout)
78 if hasattr(self.
stdout,
'isatty')
and self.
stdout.isatty():
82 self.
stdout.write(str(self))
86 if __name__ ==
'__main__':
def _get_progress(self, increment)
def __init__(self, args, kwargs)
def __add__(self, increment)
def __init__(self, process=" ", start=0, end=10, width=12, fill='=', blank='.', format='running %(process) s [%(fill) s%(blank) s] %(progress) s%%', incremental=True)