Mercurial > louis > ofxstatement-us-hsbc
view src/ofxstatement/plugins/us_hsbc/record.py @ 9:28548158a325 default tip
Some minor improvements/fixes
This will eventually evolve to something more generic, since I have re-used the
same design, and some of the parts here, to write a plugin for Charles Schwab.
author | Louis Opter <louis@opter.org> |
---|---|
date | Thu, 09 Mar 2017 22:55:02 -0800 |
parents | 829eb62755b0 |
children |
line wrap: on
line source
# Copyright (c) 2016, Louis Opter <louis@opter.org> # # This file is part of ofxstatement-us-hsbc. # # ofxstatement-us-hsbc is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # ofxstatement-us-hsbc is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import enum import os from typing import List class CsvIndexes(enum.Enum): STATUS = 0 DATE = 1 ORIGINAL_DESCRIPTION = 2 SPLIT_TYPE = 3 CATEGORY = 4 CURRENCY = 5 AMOUNT = 6 USER_DESCRIPTION = 7 MEMO = 8 CLASSIFICATION = 9 SIMPLE_DESCRIPTION = 10 class Record: status: str = None date: str = None original_description: str = None split_type: str = None category: str = None currency: str = None amount: str = None user_description: str = None memo: str = None classification: str = None account_name: str = None simple_description: str = None def __init__(self, line: List[str]) -> None: for index in CsvIndexes: setattr(self, index.name.lower(), line[index.value].strip()) def __repr__(self) -> str: linesep = "{} ".format(os.linesep) return "<{}({}{}) object at 0x{:x}>".format( self.__class__.__name__, linesep, ",{}".format(linesep).join( "{}={}".format(attrname, getattr(self, attrname.lower())) for attrname in map(lambda idx: idx.name.lower(), CsvIndexes) ), id(self), )