From 119f2a33cfe08125ee6725da5726e66faecc235e Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Tue, 7 Nov 2023 11:14:59 +0000 Subject: [PATCH] Refresh the progress bars on exit Because we don't update the progress bars on every iteration, it is possible that we finish without the bars reaching 100%, specially in very small files. The progress bars normally dissapear so this is not much of a problem, but in Jypiter notebooks the output may linger, making it a bit confusing. To avoid this problem, emit a last refresh on exit that updates the status of the progress bars to 100%. Signed-off-by: Pablo Galindo --- src/memray/_memray.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/memray/_memray.pyx b/src/memray/_memray.pyx index f961cf699e..eb74474bf7 100644 --- a/src/memray/_memray.pyx +++ b/src/memray/_memray.pyx @@ -808,6 +808,7 @@ cdef class ProgressIndicator: def __exit__(self, type, value, traceback): if not self._report_progress: return + self._context_manager.update(self._task, completed=self._cumulative_num_processed) return self._context_manager.__exit__(type, value, traceback) cdef bool _time_for_refresh(self):