Tune: better formatting

This commit is contained in:
Philippe Tillet
2015-08-28 14:36:09 -04:00
parent 1e77703f7f
commit beb32f8412
4 changed files with 8 additions and 4 deletions

View File

@@ -45,7 +45,9 @@ class ProgressBar:
def set_prefix(self, prefix):
self.prefix = prefix
sys.stdout.write("{0}: [{1}] {2: >3}%".format(prefix.ljust(17), ' '*self.length, 0))
sys.stdout.flush()
def set_finished(self):
sys.stdout.write("\n")
@@ -57,7 +59,7 @@ class ProgressBar:
xformat = ','.join(map(str,map(int, x)))
yformat = int(y)
percentformat = int(round(percent * 100))
sys.stdout.write(("\r" + self.prefix.ljust(10) + ": [{0}] {1: >3}% [{2} " + self.metric_name + "] ({3})").format(hashes + spaces, percentformat, yformat, xformat))
sys.stdout.write(("\r{0}: [{1}] {2: >3}% [{3} {4}] ({5})").format(self.prefix.ljust(17), hashes + spaces, percentformat, yformat, self.metric_name, xformat))
sys.stdout.flush()
if __name__ == "__main__":