X-Git-Url: https://git.openstreetmap.org/osqa.git/blobdiff_plain/77c34a5005c5e159e7795c985888162b88609d5d..0f2d00f9d7d5d28149707f66c719b28edfe51aed:/forum/migrations/__init__.py diff --git a/forum/migrations/__init__.py b/forum/migrations/__init__.py index e69de29..01fd2df 100644 --- a/forum/migrations/__init__.py +++ b/forum/migrations/__init__.py @@ -0,0 +1,16 @@ +import sys + +class ProgressBar(object): + def __init__(self, full): + self.full = full + self.count = 0 + + self.print_bar(0) + + def print_bar(self, progress): + sys.stdout.write("[%s%s] %d%%\r" % ('=' * progress, ' ' * (100 - progress), progress)) + sys.stdout.flush() + + def update(self): + self.count += 1 + self.print_bar(int((float(self.count) / float(self.full)) * 100)) \ No newline at end of file