From 17168bf6c5a18785981af4d097142aabf1f4c19a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 17:02:15 +0000 Subject: [PATCH] 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 d3a2509 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):