comparison src/ofxstatement/plugins/sample.py @ 0:1f85ed8ed469

Iniitial commit of sample ofxstatement plugin
author Andrey Lebedev <andrey@lebedev.lt>
date Sat, 02 Nov 2013 14:26:03 +0200
parents
children 05135d973356
comparison
equal deleted inserted replaced
-1:000000000000 0:1f85ed8ed469
1 from ofxstatement.plugin import Plugin
2 from ofxstatement.parser import StatementParser
3 from ofxstatement.statement import StatementLine
4
5
6 class SamplePlugin(Plugin):
7 """Sample plugin (for developers only)
8 """
9
10 def getParser(self, filename):
11 return SampleParser(filename)
12
13
14 class SampleParser(StatementParser):
15 def __init__(self, filename):
16 self.filename = filename
17
18 def parse(self):
19 """Main entry point for parsers
20
21 super() implementation will call to split_records and parse_record to
22 process the file.
23 """
24 with open(self.filename, "r") as f:
25 self.input = f
26 return super(SampleParser, self).parse()
27
28 def split_records(self):
29 """Return iterable object consisting of a line per transaction
30 """
31 return []
32
33 def parse_record(self, line):
34 """Parse given transaction line and return StatementLine object
35 """
36 return StatementLine()