From 35773af7473c9ae1927024d599b32874cb4b1b7c Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 13 Sep 2015 19:11:55 +0100 Subject: [PATCH] removed unnecessary exit optimisation (code duplication) --- tqdm/_tqdm.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py index 389d0536..ab78b6f1 100644 --- a/tqdm/_tqdm.py +++ b/tqdm/_tqdm.py @@ -306,8 +306,6 @@ class tqdm(object): else: total = self.total prefix = self.prefix - leave = self.leave - file = self.file ncols = self.ncols mininterval = self.mininterval miniters = self.miniters @@ -337,18 +335,11 @@ class tqdm(object): miniters = max(miniters, delta_it) last_print_n = n last_print_t = cur_t - # Closing the progress bar - # Note: does not call self.close() for speed optimisation. - if leave: - if last_print_n < n: - cur_t = time() - sp(format_meter( - n, total, cur_t-start_t, ncols, - prefix, ascii, unit, unit_scale)) - file.write('\n') - else: - sp('') - file.write('\r') + # Closing the progress bar. + # Update some internal variables for close(). + self.last_print_n = last_print_n + self.n = n + self.close() def update(self, n=1): """