Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…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 fd4163d 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
  • Loading branch information
deepsource-autofix[bot] authored May 10, 2024
1 parent fd4163d commit 8660b46
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions transaction_processing/transaction_routing.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
class TransactionRouter:
def __init__(self):
self.routing_rules = {
'domestic': {
'regex': r'^\d{10}$',
'message': 'Invalid account number format. Please enter a 10-digit account number.'
"domestic": {
"regex": r"^\d{10}$",
"message": "Invalid account number format. Please enter a 10-digit account number.",
},
"international": {
"regex": r"^\d{12}$",
"message": "Invalid account number format. Please enter a 12-digit account number.",
},
'international': {
'regex': r'^\d{12}$',
'message': 'Invalid account number format. Please enter a 12-digit account number.'
}
}

def route_transaction(self, transaction):
for rule in self.routing_rules:
if re.match(self.routing_rules[rule]['regex'], transaction['account_number']):
if re.match(
self.routing_rules[rule]["regex"], transaction["account_number"]
):
return rule
raise ValueError('Invalid account number format.')
raise ValueError("Invalid account number format.")

0 comments on commit 8660b46

Please sign in to comment.