42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
|
From cb90bbc8671aa25e23e55341745cc2682547e5f0 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Thu, 7 Dec 2017 11:17:03 +0100
|
||
|
Subject: [PATCH 2/4] virtinst: python3: avoid comparison of None and int
|
||
|
|
||
|
This avoids the following error in python3:
|
||
|
|
||
|
File "/usr/share/virt-manager/virtinst/progress.py", line 249, in _do_update
|
||
|
ave_dl = format_number(self.re.average_rate())
|
||
|
File "/usr/share/virt-manager/virtinst/progress.py", line 481, in format_number
|
||
|
while number > thresh and depth < max_depth:
|
||
|
TypeError: '>' not supported between instances of 'NoneType' and 'int'
|
||
|
---
|
||
|
virtinst/progress.py | 4 ++--
|
||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/virtinst/progress.py b/virtinst/progress.py
|
||
|
index e07591a14fa0..eef3f7613506 100644
|
||
|
--- a/virtinst/progress.py
|
||
|
+++ b/virtinst/progress.py
|
||
|
@@ -339,7 +339,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()
|
||
|
@@ -351,7 +351,7 @@ class RateEstimator:
|
||
|
# if we just started this file, all bets are off
|
||
|
self.last_update_time = now
|
||
|
self.last_amount_read = amount_read
|
||
|
- self.ave_rate = None
|
||
|
+ self.ave_rate = 0
|
||
|
return
|
||
|
|
||
|
#print 'times', now, self.last_update_time
|
||
|
--
|
||
|
2.15.1
|
||
|
|