Skip to content

Commit

Permalink
refactor __IN_NOTES_INDEX to __IN_LEN as last idx
Browse files Browse the repository at this point in the history
  • Loading branch information
topherbuckley committed Apr 15, 2023
1 parent 30a4005 commit 6f5464a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dali/plugin/input/csv/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6f5464a

Please sign in to comment.