summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Breuer <jbreuer@suse.de>2020-04-01 11:58:34 +0200
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>2020-04-02 21:15:43 -0400
commit16013708da1307b80f5cdd45cdb18c28ac51340d (patch)
tree21e0acf6b356ad4fbdc08cd2259906ec7ff1ad9b
parentd357aebb37d824808cb1279a54a5b14f80060a64 (diff)
downloadurlgrabber-16013708da1307b80f5cdd45cdb18c28ac51340d.tar.gz
Fix for TextMeter as progress_option
Type errors would prevent TextMeter from being used as a progess_option. This commit fixes this with a type cast and an initialization of a variable as int. Fixes #24
-rw-r--r--urlgrabber/progress.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/urlgrabber/progress.py b/urlgrabber/progress.py
index 5b4c450..fd18adb 100644
--- a/urlgrabber/progress.py
+++ b/urlgrabber/progress.py
@@ -220,7 +220,7 @@ def text_meter_total_size(size, downloaded=0):
#
def _term_add_bar(tl, bar_max_length, pc):
- blen = bar_max_length
+ blen = int(bar_max_length)
bar = '='*int(blen * pc)
if (blen * pc) - int(blen * pc) >= 0.5:
bar += '-'
@@ -644,7 +644,7 @@ class RateEstimator:
self.start_time = now
self.last_update_time = now
self.last_amount_read = 0
- self.ave_rate = None
+ self.ave_rate = 0
def update(self, amount_read, now=None):
if now is None: now = time.time()