[diffoscope] 03/04: - fix

Ximin Luo infinity0 at debian.org
Fri May 26 16:55:55 CEST 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch experimental
in repository diffoscope.

commit d9ad1005b1f8c3d8d3ee5308a384985fc9b6fd2a
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri May 26 15:26:29 2017 +0200

    - fix
---
 diffoscope/progress.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/diffoscope/progress.py b/diffoscope/progress.py
index 803bdd5..38b7a29 100644
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -119,8 +119,8 @@ class ProgressManager(object):
 class Progress(object):
     def __init__(self, total=None):
         self.done = []
-        self.current_steps = 0
-        self.current_child_steps_done = 0
+        self.current_steps = None
+        self.current_child_steps_done = None
         if total:
             self.total = total
         else:
@@ -160,19 +160,20 @@ class Progress(object):
         return all_done, int(float(self.total) / own_done * all_done)
 
     def is_active(self):
-        return self.current_steps
+        return self.current_steps is not None
 
     def maybe_end(self, msg=""):
         if self.is_active():
             self.done += [(self.current_steps, self.current_child_steps_done)]
-            self.current_steps = 0
-            self.current_child_steps_done = 0
+            self.current_steps = None
+            self.current_child_steps_done = None
             ProgressManager().update(msg)
 
     def begin_step(self, step, msg=""):
-        assert step > 0
+        assert step is not None
         self.maybe_end(msg)
         self.current_steps = step
+        self.current_child_steps_done = 0
 
     def child_done(self, total):
         self.current_child_steps_done += total

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list