From b646a812f7f7ed80f271e19f90e693b67ac8cead Mon Sep 17 00:00:00 2001 From: Patrick Ruckstuhl Date: Thu, 12 Oct 2023 10:53:11 +0000 Subject: [PATCH] Support multiple config files --- docs/importers.rst | 14 +++++++------- src/tariochbctools/importers/bitst/importer.py | 2 +- .../importers/blockchain/importer.py | 2 +- src/tariochbctools/importers/ibkr/importer.py | 2 +- src/tariochbctools/importers/nordigen/importer.py | 2 +- src/tariochbctools/importers/schedule/importer.py | 2 +- .../importers/transferwise/importer.py | 2 +- src/tariochbctools/importers/truelayer/importer.py | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/importers.rst b/docs/importers.rst index b501cce..3d04179 100644 --- a/docs/importers.rst +++ b/docs/importers.rst @@ -9,7 +9,7 @@ Bitstamp Import transactions from `Bitstamp `__ -Create a file called bitstamp.yaml in your import location (e.g. downloads folder). +Create a file called (or ending with) bitstamp.yaml in your import location (e.g. downloads folder). .. code-block:: yaml @@ -115,7 +115,7 @@ You can then create an import config for beancount, or add Wise to your existing CONFIG = [twimp.Importer()] -Create a file called transferwise.yaml in your import location (e.g. download folder). +Create a file called (or ending with) transferwise.yaml in your import location (e.g. download folder). .. code-block:: yaml @@ -149,7 +149,7 @@ You need to create a dev account and see their documentation about how to get a CONFIG = [tlimp.Importer()] -Create a file called truelayer.yaml in your import location (e.g. download folder). +Create a file called (or ending with) truelayer.yaml in your import location (e.g. download folder). .. code-block:: yaml @@ -193,7 +193,7 @@ all be listed in the end. CONFIG = [nordimp.Importer()] -Create a file called nordigen.yaml in your import location (e.g. download folder). +Create a file called (or ending with) nordigen.yaml in your import location (e.g. download folder). .. code-block:: yaml @@ -222,7 +222,7 @@ Interactivebrokers Import dividends and buys from `Interactive Brokers `__ -Create a file called ibkr.yaml in your import location (e.g. downloads folder). +Create a file called (or ending with) ibkr.yaml in your import location (e.g. downloads folder). .. code-block:: yaml @@ -260,7 +260,7 @@ Schedule Generate scheduled transactions. -Define a file called schedule.yaml in your import location (e.g. downloads folder). That describes the schedule transactions. They will be added each month at the end of the month. +Define a file called (or ending with) schedule.yaml in your import location (e.g. downloads folder). That describes the schedule transactions. They will be added each month at the end of the month. .. code-block:: yaml @@ -299,7 +299,7 @@ Blockchain Import transactions from Blockchain -Create a file called blockchain.yaml in your import location (e.g. downloads folder). +Create a file called (or ending with) blockchain.yaml in your import location (e.g. downloads folder). .. code-block:: yaml diff --git a/src/tariochbctools/importers/bitst/importer.py b/src/tariochbctools/importers/bitst/importer.py index 6030bcf..d8b009b 100644 --- a/src/tariochbctools/importers/bitst/importer.py +++ b/src/tariochbctools/importers/bitst/importer.py @@ -16,7 +16,7 @@ class Importer(importer.ImporterProtocol): """An importer for Bitstamp.""" def identify(self, file): - return "bitstamp.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("bitstamp.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/blockchain/importer.py b/src/tariochbctools/importers/blockchain/importer.py index 59a9a61..1e9f138 100644 --- a/src/tariochbctools/importers/blockchain/importer.py +++ b/src/tariochbctools/importers/blockchain/importer.py @@ -13,7 +13,7 @@ class Importer(importer.ImporterProtocol): """An importer for Blockchain data.""" def identify(self, file): - return "blockchain.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("blockchain.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/ibkr/importer.py b/src/tariochbctools/importers/ibkr/importer.py index e0b525e..1c46a14 100644 --- a/src/tariochbctools/importers/ibkr/importer.py +++ b/src/tariochbctools/importers/ibkr/importer.py @@ -17,7 +17,7 @@ class Importer(importer.ImporterProtocol): """An importer for Interactive Broker using the flex query service.""" def identify(self, file): - return "ibkr.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("ibkr.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/nordigen/importer.py b/src/tariochbctools/importers/nordigen/importer.py index 95673f9..4ad7f10 100644 --- a/src/tariochbctools/importers/nordigen/importer.py +++ b/src/tariochbctools/importers/nordigen/importer.py @@ -16,7 +16,7 @@ class Importer(importer.ImporterProtocol): """An importer for Nordigen API (e.g. for Revolut).""" def identify(self, file): - return "nordigen.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("nordigen.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/schedule/importer.py b/src/tariochbctools/importers/schedule/importer.py index 41695e2..6fa9ea9 100644 --- a/src/tariochbctools/importers/schedule/importer.py +++ b/src/tariochbctools/importers/schedule/importer.py @@ -12,7 +12,7 @@ class Importer(importer.ImporterProtocol): """An importer for Scheduled/Recurring Transactions.""" def identify(self, file): - return "schedule.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("schedule.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/transferwise/importer.py b/src/tariochbctools/importers/transferwise/importer.py index b22b31b..007d0b0 100644 --- a/src/tariochbctools/importers/transferwise/importer.py +++ b/src/tariochbctools/importers/transferwise/importer.py @@ -21,7 +21,7 @@ class Importer(importer.ImporterProtocol): """An importer for Transferwise using the API.""" def identify(self, file): - return "transferwise.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("transferwise.yaml") def file_account(self, file): return "" diff --git a/src/tariochbctools/importers/truelayer/importer.py b/src/tariochbctools/importers/truelayer/importer.py index 1eae6dc..daa5974 100644 --- a/src/tariochbctools/importers/truelayer/importer.py +++ b/src/tariochbctools/importers/truelayer/importer.py @@ -52,7 +52,7 @@ def _configure(self, file, existing_entries): raise KeyError("At least one of `account` or `accounts` must be specified") def identify(self, file): - return "truelayer.yaml" == path.basename(file.name) + return path.basename(file.name).endswith("truelayer.yaml") def file_account(self, file): return ""