From 6553b98778a8dff7915e8ace3512dfc3fb529589 Mon Sep 17 00:00:00 2001 From: Benjamin Dornel Date: Fri, 15 Nov 2024 23:09:19 +0800 Subject: [PATCH] refactor(banks): rename auto_polarity to transaction_auto_polarity --- src/monopoly/banks/bank_of_america/boa.py | 2 +- src/monopoly/banks/chase/chase.py | 2 +- src/monopoly/config.py | 4 ++-- src/monopoly/statements/base.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/monopoly/banks/bank_of_america/boa.py b/src/monopoly/banks/bank_of_america/boa.py index d0353af2..2bf54743 100644 --- a/src/monopoly/banks/bank_of_america/boa.py +++ b/src/monopoly/banks/bank_of_america/boa.py @@ -23,7 +23,7 @@ class BankOfAmerica(BankBase): transaction_pattern=CreditTransactionPatterns.BANK_OF_AMERICA, multiline_transactions=True, safety_check=False, - auto_polarity=False, + transaction_auto_polarity=False, ) identifiers = [ diff --git a/src/monopoly/banks/chase/chase.py b/src/monopoly/banks/chase/chase.py index 7ed2446a..5b459818 100644 --- a/src/monopoly/banks/chase/chase.py +++ b/src/monopoly/banks/chase/chase.py @@ -21,7 +21,7 @@ class Chase(BankBase): header_pattern=regex(r"(.*Transaction.*Merchant Name .*\$ Amount)"), transaction_pattern=CreditTransactionPatterns.CHASE, multiline_transactions=True, - auto_polarity=False, + transaction_auto_polarity=False, ) identifiers = [ diff --git a/src/monopoly/config.py b/src/monopoly/config.py index 28d9c8ec..7d133b31 100644 --- a/src/monopoly/config.py +++ b/src/monopoly/config.py @@ -47,7 +47,7 @@ class StatementConfig: number of spaces will be ignored. For example, if `transaction_bound` = 32: "01 NOV BALANCE B/F 190.77" (will be ignored) "01 NOV YA KUN KAYA TOAST 12.00 " (will be kept) - - `auto_polarity` controls whether transaction amounts are set as negative. + - `transaction_auto_polarity` controls whether transaction amounts are set as negative. or positive if they have 'CR' or '+' as a suffix. Enabled by default. If enabled, only 'CR' or '+' will make a transaction positive. Disabled by default. - `safety_check` controls whether the safety check for banks. Use @@ -65,7 +65,7 @@ class StatementConfig: transaction_bound: Optional[int] = None prev_balance_pattern: Optional[Pattern[str] | RegexEnum] = None safety_check: bool = True - auto_polarity: bool = True + transaction_auto_polarity: bool = True @dataclass diff --git a/src/monopoly/statements/base.py b/src/monopoly/statements/base.py index 7be74b5b..20f475ff 100644 --- a/src/monopoly/statements/base.py +++ b/src/monopoly/statements/base.py @@ -90,7 +90,7 @@ def get_transactions(self) -> list[Transaction] | None: ) transaction = Transaction( **processed_match.groupdict, - auto_polarity=self.config.auto_polarity, + auto_polarity=self.config.transaction_auto_polarity, ) transactions.append(transaction)