From ef1e7ca6d2c637bf43db44dae936cb9ee4dedc01 Mon Sep 17 00:00:00 2001 From: Alan De Smet <alan.desmet@ssec.wisc.edu> Date: Fri, 30 Jul 2021 11:33:09 -0500 Subject: [PATCH] Add DownloadStatistics.__str__ Provides a summary of itself --- csppfetch/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/csppfetch/__init__.py b/csppfetch/__init__.py index 3d041db..f787572 100644 --- a/csppfetch/__init__.py +++ b/csppfetch/__init__.py @@ -105,6 +105,14 @@ class DownloadStatistics: self.deleted_files = 0 self.deleted_size = 0 + def __str__(self): + return (f"Downloaded {self.downloaded_files} files " + f"totalling {self.downloaded_size} bytes. " + f"Pulled {self.cache_hits} files from cache, " + f"saving {self.cache_size} bytes of download. " + f"Deleted {self.deleted_files} files, " + f"freeing {self.deleted_size} bytes of space. " + ) def download_successful(state, dst, size, download_stats): -- GitLab