]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/migrations/__init__.py
make {% comments %} template tag decoratable and add ability to attach additional...
[osqa.git] / forum / migrations / __init__.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..99b09c177aa3061a349be187daa5a4c0aa59e6fd 100644 (file)
@@ -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