from __future__ import annotations from dataclasses import dataclass from datetime import date from typing import Iterable @dataclass class ExpenseRow: use_date: date description: str amount: int note: str source: str source_hash: str class CSVParserBase: source: str = '' def detect(self, header_line: str) -> bool: raise NotImplementedError def parse(self, lines: Iterable[str]) -> list[ExpenseRow]: raise NotImplementedError