diff --git a/pyproject.toml b/pyproject.toml index 6fdf73d..bfe5e75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = 'zakat' -version = '0.2.93' +version = '0.2.94' authors = [ { name='Abdelaziz Elrashed Elshaikh Mohamed', email='aeemh.sdn@gmail.com' }, ] diff --git a/setup.py b/setup.py index fd96b27..127439a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='zakat', - version='0.2.93', + version='0.2.94', description='A Python Library for Islamic Financial Management.', author='Abdelaziz Elrashed Elshaikh Mohamed', author_email='aeemh.sdn@gmail.com', diff --git a/zakat/zakat_tracker.py b/zakat/zakat_tracker.py index 81ddedf..2852ed3 100644 --- a/zakat/zakat_tracker.py +++ b/zakat/zakat_tracker.py @@ -220,7 +220,7 @@ def Version() -> str: Returns: str: The current version of the software. """ - return '0.2.93' + return '0.2.94' @staticmethod def ZakatCut(x: float) -> float: @@ -563,7 +563,23 @@ def vault(self) -> dict: """ return self._vault.copy() - def stats(self) -> dict[str, tuple]: + def stats_init(self) -> dict[str, tuple[int, str]]: + """ + Initialize and return a dictionary containing initial statistics for the ZakatTracker instance. + + The dictionary contains two keys: 'database' and 'ram'. Each key maps to a tuple containing two elements: + - The initial size of the respective statistic in bytes (int). + - The initial size of the respective statistic in a human-readable format (str). + + Returns: + dict[str, tuple]: A dictionary with initial statistics for the ZakatTracker instance. + """ + return { + 'database': (0, '0'), + 'ram': (0, '0'), + } + + def stats(self, ignore_ram: bool = True) -> dict[str, tuple[int, str]]: """ Calculates and returns statistics about the object's data storage. @@ -572,6 +588,9 @@ def stats(self) -> dict[str, tuple]: Both sizes are reported in bytes and in a human-readable format (e.g., KB, MB). + Parameters: + ignore_ram (bool): Whether to ignore the RAM size. Default is True + Returns: dict[str, tuple]: A dictionary containing the following statistics: @@ -589,7 +608,7 @@ def stats(self) -> dict[str, tuple]: >>> print(stats['ram']) (12345, '12.1 KB') """ - ram_size = self.get_dict_size(self.vault()) + ram_size = 0.0 if ignore_ram else self.get_dict_size(self.vault()) file_size = os.path.getsize(self.path()) return { 'database': (file_size, self.human_readable_size(file_size)),