forked from kedder/ofxstatement-sample
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Iniitial commit of sample ofxstatement plugin
- Loading branch information
0 parents
commit bd5baa8
Showing
8 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.pyc | ||
*.swp | ||
develop-eggs | ||
dist | ||
src/*.egg-info | ||
tags | ||
build | ||
eggs | ||
.venv | ||
.project | ||
.pydevproject | ||
*.sublime* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
PYTHON=.venv/bin/python | ||
|
||
all: PYTHON | ||
|
||
PYTHON: setup.py | ||
virtualenv -p python3 --no-site-packages .venv | ||
$(PYTHON) setup.py develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Sample plugin for ofxstatement | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This project provides a boilerplate for custom plugins for ofxstatement. | ||
|
||
`ofxstatement`_ is a tool to convert proprietary bank statement to OFX format, | ||
suitable for importing to GnuCash. Plugin for ofxstatement parses a | ||
particular proprietary bank statement format and produces common data | ||
structure, that is then formatted into an OFX file. | ||
|
||
.. _ofxstatement: https://github.com/kedder/ofxstatement | ||
|
||
|
||
Users of ofxstatement have developed several plugins for their banks. They are | ||
listed on main `ofxstatement`_ site. If your bank is missing, you can develop | ||
your own plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/python3 | ||
"""Setup | ||
""" | ||
from setuptools import find_packages | ||
from distutils.core import setup | ||
|
||
version = "0.0.1" | ||
|
||
with open('README.rst') as f: | ||
long_description = f.read() | ||
|
||
setup(name='ofxstatement-sample', | ||
version=version, | ||
author="Andrey Lebedev", | ||
author_email="[email protected]", | ||
url="https://github.com/kedder/ofxstatement", | ||
description=("Sample plugin for ofxstatement"), | ||
long_description=long_description, | ||
license="GPLv3", | ||
keywords=["ofx", "banking", "statement"], | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Programming Language :: Python :: 3', | ||
'Natural Language :: English', | ||
'Topic :: Office/Business :: Financial :: Accounting', | ||
'Topic :: Utilities', | ||
'Environment :: Console', | ||
'Operating System :: OS Independent', | ||
'License :: OSI Approved :: GNU Affero General Public License v3'], | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
namespace_packages=["ofxstatement", "ofxstatement.plugins"], | ||
entry_points={ | ||
'ofxstatement': | ||
['sample = ofxstatement.plugins.sample:SamplePlugin'] | ||
}, | ||
install_requires=['ofxstatement'], | ||
include_package_data=True, | ||
zip_safe=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from ofxstatement.plugin import Plugin | ||
from ofxstatement.parser import StatementParser | ||
from ofxstatement.statement import StatementLine | ||
|
||
|
||
class SamplePlugin(Plugin): | ||
"""Sample plugin (for developers only) | ||
""" | ||
|
||
def getParser(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() |