From 83a9cc773c5e93ab2454cb6fbf6f219f71b2776a Mon Sep 17 00:00:00 2001 From: Abdelaziz Elrashed Date: Sun, 30 Jun 2024 12:25:05 +0300 Subject: [PATCH] =?UTF-8?q?=D8=A5=D8=B6=D8=A7=D9=81=D8=A9=20=D8=AA=D9=88?= =?UTF-8?q?=D8=AB=D9=8A=D9=82=20=D8=B9=D8=AF=D8=AF=20=D9=85=D9=86=20=D8=A7?= =?UTF-8?q?=D9=84=D8=A7=D8=B3=D8=AA=D8=AB=D9=86=D8=A7=D8=A1=D8=A7=D8=AA=20?= =?UTF-8?q?=D9=81=D9=8A=20=D8=A8=D8=B9=D8=B6=20=D8=A7=D9=84=D8=AF=D9=88?= =?UTF-8?q?=D8=A7=D9=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zakat/zakat_tracker.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zakat/zakat_tracker.py b/zakat/zakat_tracker.py index 423a513..89ca067 100644 --- a/zakat/zakat_tracker.py +++ b/zakat/zakat_tracker.py @@ -575,6 +575,7 @@ def track(self, value: float = 0, desc: str = '', account: str = 1, logging: boo This function creates a new account if it doesn't exist, logs the transaction if logging is True, and updates the account's balance and box. Raises: + ValueError: The log transaction happened again in the same nanosecond time. ValueError: The box transaction happened again in the same nanosecond time. """ if created is None: @@ -646,7 +647,7 @@ def _log(self, value: float, desc: str = '', account: str = 1, created: int = No It also creates a step in the history of the transaction. Raises: - ValueError: The box transaction happened again in the same nanosecond time. + ValueError: The log transaction happened again in the same nanosecond time. """ if created is None: created = self.time() @@ -655,7 +656,7 @@ def _log(self, value: float, desc: str = '', account: str = 1, created: int = No if debug: print('create-log', created) if self.log_exists(account, created): - raise ValueError(f"The box transaction happened again in the same nanosecond time({created}).") + raise ValueError(f"The log transaction happened again in the same nanosecond time({created}).") if debug: print('created-log', created) self._vault['account'][account]['log'][created] = { @@ -904,6 +905,7 @@ def sub(self, x: float, desc: str = '', account: str = 1, created: int = None, d Raises: ValueError: The box transaction happened again in the same nanosecond time. + ValueError: The log transaction happened again in the same nanosecond time. """ if x < 0: return tuple() @@ -966,6 +968,7 @@ def transfer(self, amount: int, from_account: str, to_account: str, desc: str = Raises: ValueError: The box transaction happened again in the same nanosecond time. + ValueError: The log transaction happened again in the same nanosecond time. """ if amount <= 0: return [] @@ -1305,8 +1308,8 @@ def import_csv(self, path: str = 'file.csv') -> tuple: The function reads the CSV file, checks for duplicate transactions, and creates the transactions in the system. """ - cache = [] - tmp = "tmp" + cache: list[int] = [] + tmp: str = "tmp" try: with open(tmp, "rb") as f: cache = pickle.load(f)