-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add InvestStatmentLine as possible return from parse_record to fix typing check errors. #263
base: master
Are you sure you want to change the base?
Changes from all commits
d75b085
498485b
f7af059
1e2abea
214bb9c
d506798
8dc6085
0942bbd
c581777
f8b4275
ac317a7
a852d23
777f662
338a9f6
280bc40
54db7c4
8f8008d
1944606
05e2699
86560e7
cfd9002
78cba7e
8c1112c
15f8c23
c659d45
273ca39
f7e5b1f
fd8f502
5de9b51
f0dd25c
4e4e716
44a0c18
6d93bcf
0be6f56
651fce2
0bdfa59
831f6e9
cb9f7d9
6a6cf3d
3b6e19c
9688f8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "ofxstatement" | ||
version = "0.9.2.dev0" | ||
authors = [ | ||
{ name="Andrey Lebedev", email="[email protected]" }, | ||
] | ||
description = "Tool to convert proprietary bank statement to OFX format, suitable for importing to GnuCash" | ||
readme = "README.rst" | ||
requires-python = ">=3.9" | ||
license = { file="LICENSE.txt" } | ||
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 General Public License v3 (GPLv3)", | ||
] | ||
keywords = ["ofx", "banking", "statement"] | ||
dependencies = [ | ||
"appdirs>=1.3.0", | ||
"importlib_metadata>=3.8;python_version<'3.10'", | ||
"zipp;python_version<'3.10'" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/kedder/ofxstatement" | ||
|
||
[project.scripts] | ||
ofxstatement = "ofxstatement.tool:run" | ||
|
||
[tool.setuptools.package-data] | ||
ofxstatement = ["tests/samples"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,10 @@ | ||
[metadata] | ||
name = ofxstatement | ||
version = 0.9.2.dev0 | ||
description = Tool to convert proprietary bank statement to OFX format, suitable for importing to GnuCash | ||
long_description = file: README.rst | ||
long_description_content_type = text/x-rst | ||
url = https://github.com/kedder/ofxstatement | ||
author = Andrey Lebedev | ||
author_email = [email protected] | ||
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 General Public License v3 (GPLv3) | ||
keywords = ofx banking statement | ||
project_urls = | ||
|
||
[options] | ||
package_dir = =src | ||
packages = find: | ||
python_requires = >=3.8, <4 | ||
install_requires = | ||
appdirs>=1.3.0 | ||
importlib_metadata>=3.8;python_version<'3.10' | ||
data_files = | ||
namespace_packages = | ||
ofxstatement | ||
ofxstatement.plugins | ||
|
||
|
||
[options.packages.find] | ||
where = src | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
ofxstatement=ofxstatement.tool:run | ||
|
||
[options.extras_require] | ||
dev = | ||
black | ||
mypy | ||
test = | ||
mock | ||
pytest | ||
pytest-coverage | ||
|
||
[mypy] | ||
ignore_missing_imports = True | ||
|
||
[pycodestyle] | ||
max-line-length=88 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__("pkg_resources").declare_namespace(__name__) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
from typing import Dict, Optional, Any, Iterable, List, TextIO, TypeVar, Generic | ||
from typing import Dict, Optional, Any, Iterable, List, TextIO, TypeVar, Generic, Union | ||
from abc import abstractmethod | ||
import csv | ||
from decimal import Decimal, Decimal as D | ||
from datetime import datetime | ||
|
||
from ofxstatement.statement import Statement, StatementLine | ||
from ofxstatement.statement import Statement, StatementLine, InvestStatementLine | ||
|
||
LT = TypeVar("LT") | ||
|
||
|
@@ -46,7 +46,7 @@ def parse(self) -> Statement: | |
stmt_line = self.parse_record(line) | ||
if stmt_line: | ||
stmt_line.assert_valid() | ||
self.statement.lines.append(stmt_line) | ||
self.statement.lines.append(stmt_line) # type: ignore | ||
return self.statement | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This FWICT, class Statement(Printable):
lines: List["StatementLine"]
invest_lines: List["InvestStatementLine"] Plugins that parse investment statement are supposed to add lines to Someone who added That said, I think Then, in
This way users can override one of the And we won't need these shameful What do you think? |
||
|
||
def split_records(self) -> Iterable[LT]: # pragma: no cover | ||
|
@@ -57,6 +57,12 @@ def parse_record(self, line: LT) -> Optional[StatementLine]: # pragma: no cover | |
"""Parse given transaction line and return StatementLine object""" | ||
raise NotImplementedError | ||
|
||
def parse_invest_record( | ||
self, line: LT | ||
) -> Optional[InvestStatementLine]: # pragma: no cover | ||
"""Parse given investement transaction line and return InvetStatementLine object""" | ||
raise NotImplementedError | ||
|
||
def parse_value(self, value: Optional[str], field: str) -> Any: | ||
tp = StatementLine.__annotations__.get(field) | ||
if value is None: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__("pkg_resources").declare_namespace(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, something is messed up. This shouldn't be part of the diff. Can you rebase on master or merge it into your branch?