From 6f5464a6127afd68264804630e4634d2a22c3383 Mon Sep 17 00:00:00 2001 From: Christopher Buckley Date: Sat, 15 Apr 2023 14:04:09 +0900 Subject: [PATCH] refactor __IN_NOTES_INDEX to __IN_LEN as last idx --- src/dali/plugin/input/csv/manual.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dali/plugin/input/csv/manual.py b/src/dali/plugin/input/csv/manual.py index b61c790e..3b5e9b1d 100644 --- a/src/dali/plugin/input/csv/manual.py +++ b/src/dali/plugin/input/csv/manual.py @@ -53,6 +53,7 @@ class InputPlugin(AbstractInputPlugin): __IN_FIAT_FEE_INDEX: int = 11 __IN_NOTES_INDEX: int = 12 __IN_FIAT_TICKER: int = 13 + __IN_LEN = __IN_FIAT_TICKER __OUT_UNIQUE_ID_INDEX: int = 0 __OUT_TIMESTAMP_INDEX: int = 1 @@ -120,15 +121,15 @@ def _load_in_file(self, transactions: List[AbstractTransaction]) -> None: raw_data: str = ",".join(line).strip() if not header_found: # let user know there is not enough columns - if len(line) - 1 < self.__IN_NOTES_INDEX: - raise ValueError(f"Not enough columns: the {self.__in_csv_file} CSV must contain {self.__IN_NOTES_INDEX} columns.") + if len(line) - 1 < self.__IN_LEN: + raise ValueError(f"Not enough columns: the {self.__in_csv_file} CSV must contain {self.__IN_LEN} columns.") # Skip header line header_found = True self.__logger.debug("Header: %s", ";".join(line)) continue - if raw_data.startswith("," * self.__IN_NOTES_INDEX): + if raw_data.startswith("," * self.__IN_LEN): # Skip empty lines continue