Beispiel #1
0
 def __init__(self, num=1, quiet=False):
     self.status_code_counter = defaultdict(list)
     self.errors = []
     self.total_time = None
     if num is not None:
         self._progress_bar = AnimatedProgressBar(end=num, width=65)
     else:
         self._progress_bar = None
     self.quiet = quiet
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        super(AnimatedProgressBar, self).__init__(*args, **kwargs)
        self.stdout = kwargs.get('stdout', sys.stdout)

    def show_progress(self):
        if hasattr(self.stdout, 'isatty') and self.stdout.isatty():
            self.stdout.write('\r')
        else:
            self.stdout.write('\n')
        self.stdout.write(str(self))
        self.stdout.flush()


if __name__ == '__main__':
    p = AnimatedProgressBar(end=100, width=80)

    while True:
        p + 5
        p.show_progress()
        time.sleep(0.1)
        if p.progress == 100:
            break
    print # new line


########NEW FILE########
__FILENAME__ = test_boom
import unittest2 as unittest
import subprocess
import sys