From 8b1cbf008c784bc7902fe235446aa5b536a3bfbc Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 16:55:22 +0000 Subject: [PATCH 1/2] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in 9ce2191 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- banking/transaction_processing.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/banking/transaction_processing.py b/banking/transaction_processing.py index 21924650b..b383fe632 100644 --- a/banking/transaction_processing.py +++ b/banking/transaction_processing.py @@ -2,6 +2,7 @@ import logging + def deposit(account_id: int, amount: float) -> bool: """ Deposit an amount into an account. @@ -18,13 +19,14 @@ def deposit(account_id: int, amount: float) -> bool: account = get_account_by_id(account_id) if amount < 0: raise ValueError("Amount cannot be negative") - account['balance'] += amount + account["balance"] += amount save_account(account) return True except Exception as e: logging.error(f"Error depositing into account {account_id}: {e}") return False + def withdraw(account_id: int, amount: float) -> bool: """ Withdraw an amount from an account. @@ -41,15 +43,16 @@ def withdraw(account_id: int, amount: float) -> bool: account = get_account_by_id(account_id) if amount < 0: raise ValueError("Amount cannot be negative") - if account['balance'] < amount: + if account["balance"] < amount: raise ValueError("Insufficient balance") - account['balance'] -= amount + account["balance"] -= amount save_account(account) return True except Exception as e: logging.error(f"Error withdrawing from account {account_id}: {e}") return False + def transfer(from_account_id: int, to_account_id: int, amount: float) -> bool: """ Transfer an amount between two accounts. @@ -63,7 +66,9 @@ def transfer(from_account_id: int, to_account_id: int, amount: float) -> bool: bool: True if the transfer was successful, False otherwise. """ try: - logging.info(f"Transferring {amount} from account {from_account_id} to account {to_account_id}") + logging.info( + f"Transferring {amount} from account {from_account_id} to account {to_account_id}" + ) if not withdraw(from_account_id, amount): return False if not deposit(to_account_id, amount): From f0a25d8553e0fb1ccdfc17979461528caddde6de Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 16:59:42 +0000 Subject: [PATCH 2/2] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in 0f9c45c according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: https://github.com/KOSASIH/pi-nexus-autonomous-banking-network/pull/116 --- banking/transaction_processing.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/banking/transaction_processing.py b/banking/transaction_processing.py index e8e38cf00..c377881d0 100644 --- a/banking/transaction_processing.py +++ b/banking/transaction_processing.py @@ -16,10 +16,6 @@ def deposit(account_id: int, amount: float) -> bool: """ - - - - def withdraw(account_id: int, amount: float) -> bool: """ Withdraw an amount from an account. @@ -33,7 +29,6 @@ def withdraw(account_id: int, amount: float) -> bool: """ - def transfer(from_account_id: int, to_account_id: int, amount: float) -> bool: """ Transfer an amount between two accounts. @@ -46,4 +41,3 @@ def transfer(from_account_id: int, to_account_id: int, amount: float) -> bool: Returns: bool: True if the transfer was successful, False otherwise. """ -