File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 16
16
17
17
Copyright 2014 by G.Grieco
18
18
"""
19
-
19
+ import sys
20
+ import time
20
21
import gzip
21
22
import subprocess
22
23
import pickle
23
24
import csv
24
25
import random
25
26
27
+
28
+ def update_progress (progress ):
29
+ barLength = 30 # Modify this to change the length of the progress bar
30
+ status = ""
31
+ if isinstance (progress , int ):
32
+ progress = float (progress )
33
+ if not isinstance (progress , float ):
34
+ progress = 0
35
+ status = "error: progress var must be float\r \n "
36
+ if progress < 0 :
37
+ progress = 0
38
+ status = "Halt...\r \n "
39
+ if progress >= 1 :
40
+ progress = 1
41
+ status = "Done...\r \n "
42
+ block = int (round (barLength * progress ))
43
+ text = "\r Percent: [{0}] {1}% {2}" .format ( "#" * block + "-" * (barLength - block ), progress * 100 , status )
44
+ sys .stdout .write (text )
45
+ sys .stdout .flush ()
46
+
26
47
def file_len (fname ):
27
48
28
49
if ".gz" in fname :
You can’t perform that action at this time.
0 commit comments