@@ -52,12 +52,12 @@ def set_verbosity(value):
52
52
verbose = value
53
53
54
54
55
- def create_pbar (ptext , plength , ** kwargs ):
55
+ def create_pbar (ptext , plength , ljust = 35 , ** kwargs ):
56
56
""" Create a global progress bar if global verbose is True
57
57
"""
58
58
global pbar , verbose
59
59
if verbose and plength > 0 :
60
- jtext = str (ptext ).ljust (35 )
60
+ jtext = str (ptext ).ljust (ljust )
61
61
if pbar2 :
62
62
pbar = ProgressBar (widgets = [Style .RESET_ALL + Fore .YELLOW + jtext ,
63
63
Percentage (), Bar (), ETA ()],
@@ -79,13 +79,13 @@ def update_pbar(index, **kwargs):
79
79
pmax = pbar .max_value
80
80
else :
81
81
pmax = pbar .maxval
82
- if index = = pmax :
82
+ if index > = pmax :
83
83
pbar .finish ()
84
84
print_nocr (Fore .RESET )
85
85
pbar = None
86
86
87
87
88
- def download_url (res , text = '' ):
88
+ def download_url (res , text = '' , ljust = 35 ):
89
89
""" Display a progress bar to download the request content if verbose is
90
90
True. Otherwise, just return the request content
91
91
"""
@@ -94,7 +94,7 @@ def download_url(res, text=''):
94
94
content_length = res .headers .get ('content-length' )
95
95
if content_length :
96
96
clen = int (content_length )
97
- create_pbar (text , clen )
97
+ create_pbar (text , clen , ljust )
98
98
chunk_size = 16384
99
99
i = 0
100
100
data = b''
0 commit comments