Skip to content

Commit

Permalink
added progress bar code
Browse files Browse the repository at this point in the history
  • Loading branch information
gaa-cifasis committed Oct 19, 2015
1 parent 3d1cf7d commit e88028b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion vdiscover/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,34 @@
Copyright 2014 by G.Grieco
"""

import sys
import time
import gzip
import subprocess
import pickle
import csv
import random


def update_progress(progress):
barLength = 30 # Modify this to change the length of the progress bar
status = ""
if isinstance(progress, int):
progress = float(progress)
if not isinstance(progress, float):
progress = 0
status = "error: progress var must be float\r\n"
if progress < 0:
progress = 0
status = "Halt...\r\n"
if progress >= 1:
progress = 1
status = "Done...\r\n"
block = int(round(barLength*progress))
text = "\rPercent: [{0}] {1}% {2}".format( "#"*block + "-"*(barLength-block), progress*100, status)
sys.stdout.write(text)
sys.stdout.flush()

def file_len(fname):

if ".gz" in fname:
Expand Down

0 comments on commit e88028b

Please sign in to comment.