]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/migrations/__init__.py
Handle redirects and other responses in parameter decorators.
[osqa.git] / forum / migrations / __init__.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..01fd2df0f351f7385e6d5dc5d599dc3c224ab78e 100644 (file)
@@ -0,0 +1,16 @@
+import sys\r
+\r
+class ProgressBar(object):\r
+    def __init__(self, full):\r
+        self.full = full\r
+        self.count = 0\r
+\r
+        self.print_bar(0)\r
+\r
+    def print_bar(self, progress):\r
+        sys.stdout.write("[%s%s] %d%%\r" % ('=' * progress, ' ' * (100 - progress), progress))\r
+        sys.stdout.flush()\r
+\r
+    def update(self):\r
+        self.count += 1\r
+        self.print_bar(int((float(self.count) / float(self.full)) * 100))
\ No newline at end of file