Mercurial > louis > ofxstatement-us-hsbc
view src/ofxstatement/plugins/sample.py @ 3:05135d973356
Corrected name of function as it is called from ofxstatement/tool.py
author | Milan Knížek <milankni.git@gmail.com> |
---|---|
date | Wed, 22 Jun 2016 19:59:33 +0200 |
parents | 1f85ed8ed469 |
children |
line wrap: on
line source
from ofxstatement.plugin import Plugin from ofxstatement.parser import StatementParser from ofxstatement.statement import StatementLine class SamplePlugin(Plugin): """Sample plugin (for developers only) """ def get_parser(self, filename): return SampleParser(filename) class SampleParser(StatementParser): def __init__(self, filename): self.filename = filename def parse(self): """Main entry point for parsers super() implementation will call to split_records and parse_record to process the file. """ with open(self.filename, "r") as f: self.input = f return super(SampleParser, self).parse() def split_records(self): """Return iterable object consisting of a line per transaction """ return [] def parse_record(self, line): """Parse given transaction line and return StatementLine object """ return StatementLine()