pax_global_header00006660000000000000000000000064147211657070014524gustar00rootroot0000000000000052 comment=3f2631ba78e7e25afa85d270191b74772b010514 ofxstatement-0.9.2/000077500000000000000000000000001472116570700142555ustar00rootroot00000000000000ofxstatement-0.9.2/.github/000077500000000000000000000000001472116570700156155ustar00rootroot00000000000000ofxstatement-0.9.2/.github/dependabot.yml000066400000000000000000000002461472116570700204470ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: pip directory: "/" schedule: interval: "weekly" day: "saturday" time: "03:00" open-pull-requests-limit: 10 ofxstatement-0.9.2/.github/workflows/000077500000000000000000000000001472116570700176525ustar00rootroot00000000000000ofxstatement-0.9.2/.github/workflows/test.yml000066400000000000000000000040541472116570700213570ustar00rootroot00000000000000name: ofxstatement on: push: branches: master pull_request: jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install pipenv coveralls pipenv sync --dev - name: Test with pytest run: | pipenv run pytest -v --cov src/ofxstatement - name: Check with mypy run: | pipenv run mypy src - name: Check with black run: | pipenv run black --check setup.py src - name: Coveralls if: ${{ success() }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN}} COVERALLS_PARALLEL: true run: | coveralls --service=github report: needs: test runs-on: ubuntu-latest steps: - name: Set up Python uses: actions/setup-python@v2 - name: Coveralls Finish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN}} run: | pip install coveralls coveralls --service=github --finish integration-test: needs: test runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Build and install wheel run: | python -m pip install --upgrade pip pip install build wheel python -m build pip install dist/*.whl - name: Check some plugins run: | pip install ofxstatement-lithuanian ofxstatement list-plugins | grep swedbank ofxstatement-0.9.2/.gitignore000066400000000000000000000002361472116570700162460ustar00rootroot00000000000000*.pyc *.swp .installed.cfg develop-eggs dist src/ofxstatement.egg-info bin parts tags misc build eggs *.egg .coverage .venv .project .pydevproject *.sublime* ofxstatement-0.9.2/CHANGES.rst000066400000000000000000000061241472116570700160620ustar00rootroot00000000000000Changes ------- 0.9.2 (2024-11-25) ================== - Get rid of build deprecation warnings (#322) - Replace deprecated appdirs with platformdirs (#323) - Switch to importlib.metadata from deprecated pkg_resources for plugin lookup (internal infrastructure update, #262) - Fix invest transactions unit precision (#257) 0.9.1 (2023-09-16) ================== - Make OFX output conform to DTD (#243). 0.9.0 (2023-08-07) ================== - New `-c` (`--config`) option for `convert` command, allows to specify the configuration file to use (#235). - Print the number of transactions in the output (#236). 0.8.0 (2021-09-06) ================== - Support OFX CURRENCY and ORIGCURRENCY in statement lines. This allows plugins to add information about transaction currency to generated OFX statements. - Add `--pretty` flag to `convert` command to produce nicely intented OFX files. 0.7.1 (2020-09-14) ================== - Include PEP-561 marker into source code distribution 0.7.0 (2020-09-13) ================== - Drop support for Python 3.4, 3.5, add support for Python 3.8 - Fixed naive end balance validation (#106) - Modernize development environment (use pipenv, mypy, black) 0.6.5 (2020-06-09) ================== - Added balance checks and improved generation of unique ids (#100, #104) 0.6.4 (2020-03-04) ================== - Fix regression introduced in 0.6.3 - `edit-config` command stopped working. 0.6.3 (2020-02-13) ================== - Fix config editing on Windows 0.6.2 (2020-01-20) ================== - Better `EDITOR` environment variable handling for `edit-config` command - Support Python-3.7 - API: type of StatementLine.date_user (date when user initiated transaction) will not be a string by default. - API: More unique generated transaction ids (when one is not available from the statement file) 0.6.1 (2017-05-07) ================== - Fix installation problem on python-3.5 (#55) 0.6.0 (2016-12-02) ================== - Support for specifying account information for each parsed satatement line and translate it to BANKACCTTO aggregate in OFX. - Command line option to display debugging information (--debug). - Fix config file location for appdirs >= 1.3.0 0.5.0 (2013-11-03) ================== - Plugins are now registered via setuptools' entry-points mechanism. This allows plugins to live in separate eggs and developed independently of ofxstatement itself. Plugins are registered as 'ofxstatement' entry points (#11). - Command line interface changed: ``ofxstatement`` now accepts "action" parameter and few actions were added: * ``ofxstatement convert``: perform conversion to OFX * ``ofxstatement list-plugins``: list available conversion plugins * ``ofxstatement edit-config``: launch default editor to edit configuration file - ``ofxstatement convert`` can be run without any configuration. Plugin name to use is specified using ``-t TYPE`` parameter in this case (#12). - ``StatementLine`` supports more attributes, translated to OFX (#13): * ``refnum`` - translated to ```` in OFX. * ``trntype`` - translated to ```` in OFX. ofxstatement-0.9.2/LICENSE.txt000066400000000000000000001045131472116570700161040ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program 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. This program 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ofxstatement-0.9.2/MANIFEST.in000066400000000000000000000003571472116570700160200ustar00rootroot00000000000000include CHANGES.rst README.rst include src/ofxstatement/plugins/README.txt include src/ofxstatement/py.typed include Pipfile Pipfile.lock include Makefile include pytest.ini graft src/ofxstatement/tests/samples recursive-include doc *.xml ofxstatement-0.9.2/Makefile000066400000000000000000000002761472116570700157220ustar00rootroot00000000000000all: test mypy black PHONY: test test: pytest PHONY: coverage coverage: bin/pytest pytest --cov src/ofxstatement .PHONY: black black: black setup.py src .PHONY: mypy mypy: mypy src ofxstatement-0.9.2/Pipfile000066400000000000000000000006671472116570700156010ustar00rootroot00000000000000[[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] pytest = "*" pytest-cov = "*" black = "*" mypy = "*" exceptiongroup = {markers="python_version < '3.11'"} tomli = {markers="python_version < '3.11'"} [packages] ofxstatement = {editable = true,path = "."} exceptiongroup = "*" importlib_metadata = { markers="python_version < '3.10'"} zipp = { markers="python_version < '3.10'"} platformdirs = "*" ofxstatement-0.9.2/Pipfile.lock000066400000000000000000000412141472116570700165210ustar00rootroot00000000000000{ "_meta": { "hash": { "sha256": "cb8ca6d3c3b7984a4c9e4213648559c64f0f7816a82f0b6d45646fbdc6fff283" }, "pipfile-spec": 6, "requires": {}, "sources": [ { "name": "pypi", "url": "https://pypi.org/simple", "verify_ssl": true } ] }, "default": { "exceptiongroup": { "hashes": [ "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc" ], "index": "pypi", "markers": "python_version >= '3.7'", "version": "==1.2.2" }, "importlib-metadata": { "markers": "python_version < '3.10'", "version": "==3.8" }, "ofxstatement": { "editable": true, "path": "." }, "platformdirs": { "hashes": [ "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907", "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==4.3.6" }, "zipp": { "hashes": [ "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4", "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931" ], "index": "pypi", "markers": "python_version >= '3.9'", "version": "==3.21.0" } }, "develop": { "black": { "hashes": [ "sha256:14b3502784f09ce2443830e3133dacf2c0110d45191ed470ecb04d0f5f6fcb0f", "sha256:17374989640fbca88b6a448129cd1745c5eb8d9547b464f281b251dd00155ccd", "sha256:1c536fcf674217e87b8cc3657b81809d3c085d7bf3ef262ead700da345bfa6ea", "sha256:1cbacacb19e922a1d75ef2b6ccaefcd6e93a2c05ede32f06a21386a04cedb981", "sha256:1f93102e0c5bb3907451063e08b9876dbeac810e7da5a8bfb7aeb5a9ef89066b", "sha256:2cd9c95431d94adc56600710f8813ee27eea544dd118d45896bb734e9d7a0dc7", "sha256:30d2c30dc5139211dda799758559d1b049f7f14c580c409d6ad925b74a4208a8", "sha256:394d4ddc64782e51153eadcaaca95144ac4c35e27ef9b0a42e121ae7e57a9175", "sha256:3bb2b7a1f7b685f85b11fed1ef10f8a9148bceb49853e47a294a3dd963c1dd7d", "sha256:4007b1393d902b48b36958a216c20c4482f601569d19ed1df294a496eb366392", "sha256:5a2221696a8224e335c28816a9d331a6c2ae15a2ee34ec857dcf3e45dbfa99ad", "sha256:63f626344343083322233f175aaf372d326de8436f5928c042639a4afbbf1d3f", "sha256:649fff99a20bd06c6f727d2a27f401331dc0cc861fb69cde910fe95b01b5928f", "sha256:680359d932801c76d2e9c9068d05c6b107f2584b2a5b88831c83962eb9984c1b", "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875", "sha256:b5e39e0fae001df40f95bd8cc36b9165c5e2ea88900167bddf258bacef9bbdc3", "sha256:ccfa1d0cb6200857f1923b602f978386a3a2758a65b52e0950299ea014be6800", "sha256:d37d422772111794b26757c5b55a3eade028aa3fde43121ab7b673d050949d65", "sha256:ddacb691cdcdf77b96f549cf9591701d8db36b2f19519373d60d31746068dbf2", "sha256:e6668650ea4b685440857138e5fe40cde4d652633b1bdffc62933d0db4ed9812", "sha256:f9da3333530dbcecc1be13e69c250ed8dfa67f43c4005fb537bb426e19200d50", "sha256:fe4d6476887de70546212c99ac9bd803d90b42fc4767f058a0baa895013fbb3e" ], "index": "pypi", "markers": "python_version >= '3.9'", "version": "==24.10.0" }, "click": { "hashes": [ "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" ], "markers": "python_version >= '3.7'", "version": "==8.1.7" }, "coverage": { "extras": [ "toml" ], "hashes": [ "sha256:00a1d69c112ff5149cabe60d2e2ee948752c975d95f1e1096742e6077affd376", "sha256:023bf8ee3ec6d35af9c1c6ccc1d18fa69afa1cb29eaac57cb064dbb262a517f9", "sha256:0294ca37f1ba500667b1aef631e48d875ced93ad5e06fa665a3295bdd1d95111", "sha256:06babbb8f4e74b063dbaeb74ad68dfce9186c595a15f11f5d5683f748fa1d172", "sha256:0809082ee480bb8f7416507538243c8863ac74fd8a5d2485c46f0f7499f2b491", "sha256:0b3fb02fe73bed561fa12d279a417b432e5b50fe03e8d663d61b3d5990f29546", "sha256:0b58c672d14f16ed92a48db984612f5ce3836ae7d72cdd161001cc54512571f2", "sha256:0bcd1069e710600e8e4cf27f65c90c7843fa8edfb4520fb0ccb88894cad08b11", "sha256:1032e178b76a4e2b5b32e19d0fd0abbce4b58e77a1ca695820d10e491fa32b08", "sha256:11a223a14e91a4693d2d0755c7a043db43d96a7450b4f356d506c2562c48642c", "sha256:12394842a3a8affa3ba62b0d4ab7e9e210c5e366fbac3e8b2a68636fb19892c2", "sha256:182e6cd5c040cec0a1c8d415a87b67ed01193ed9ad458ee427741c7d8513d963", "sha256:1d5b8007f81b88696d06f7df0cb9af0d3b835fe0c8dbf489bad70b45f0e45613", "sha256:1f76846299ba5c54d12c91d776d9605ae33f8ae2b9d1d3c3703cf2db1a67f2c0", "sha256:27fb4a050aaf18772db513091c9c13f6cb94ed40eacdef8dad8411d92d9992db", "sha256:29155cd511ee058e260db648b6182c419422a0d2e9a4fa44501898cf918866cf", "sha256:29fc0f17b1d3fea332f8001d4558f8214af7f1d87a345f3a133c901d60347c73", "sha256:2b6b4c83d8e8ea79f27ab80778c19bc037759aea298da4b56621f4474ffeb117", "sha256:2fdef0d83a2d08d69b1f2210a93c416d54e14d9eb398f6ab2f0a209433db19e1", "sha256:3c65d37f3a9ebb703e710befdc489a38683a5b152242664b973a7b7b22348a4e", "sha256:4f704f0998911abf728a7783799444fcbbe8261c4a6c166f667937ae6a8aa522", "sha256:51b44306032045b383a7a8a2c13878de375117946d68dcb54308111f39775a25", "sha256:53d202fd109416ce011578f321460795abfe10bb901b883cafd9b3ef851bacfc", "sha256:58809e238a8a12a625c70450b48e8767cff9eb67c62e6154a642b21ddf79baea", "sha256:5915fcdec0e54ee229926868e9b08586376cae1f5faa9bbaf8faf3561b393d52", "sha256:5beb1ee382ad32afe424097de57134175fea3faf847b9af002cc7895be4e2a5a", "sha256:5f8ae553cba74085db385d489c7a792ad66f7f9ba2ee85bfa508aeb84cf0ba07", "sha256:5fbd612f8a091954a0c8dd4c0b571b973487277d26476f8480bfa4b2a65b5d06", "sha256:6bd818b7ea14bc6e1f06e241e8234508b21edf1b242d49831831a9450e2f35fa", "sha256:6f01ba56b1c0e9d149f9ac85a2f999724895229eb36bd997b61e62999e9b0901", "sha256:73d2b73584446e66ee633eaad1a56aad577c077f46c35ca3283cd687b7715b0b", "sha256:7bb92c539a624cf86296dd0c68cd5cc286c9eef2d0c3b8b192b604ce9de20a17", "sha256:8165b796df0bd42e10527a3f493c592ba494f16ef3c8b531288e3d0d72c1f6f0", "sha256:862264b12ebb65ad8d863d51f17758b1684560b66ab02770d4f0baf2ff75da21", "sha256:8902dd6a30173d4ef09954bfcb24b5d7b5190cf14a43170e386979651e09ba19", "sha256:8cf717ee42012be8c0cb205dbbf18ffa9003c4cbf4ad078db47b95e10748eec5", "sha256:8ed9281d1b52628e81393f5eaee24a45cbd64965f41857559c2b7ff19385df51", "sha256:99b41d18e6b2a48ba949418db48159d7a2e81c5cc290fc934b7d2380515bd0e3", "sha256:9cb7fa111d21a6b55cbf633039f7bc2749e74932e3aa7cb7333f675a58a58bf3", "sha256:a181e99301a0ae128493a24cfe5cfb5b488c4e0bf2f8702091473d033494d04f", "sha256:a413a096c4cbac202433c850ee43fa326d2e871b24554da8327b01632673a076", "sha256:a6b1e54712ba3474f34b7ef7a41e65bd9037ad47916ccb1cc78769bae324c01a", "sha256:ade3ca1e5f0ff46b678b66201f7ff477e8fa11fb537f3b55c3f0568fbfe6e718", "sha256:b0ac3d42cb51c4b12df9c5f0dd2f13a4f24f01943627120ec4d293c9181219ba", "sha256:b369ead6527d025a0fe7bd3864e46dbee3aa8f652d48df6174f8d0bac9e26e0e", "sha256:b57b768feb866f44eeed9f46975f3d6406380275c5ddfe22f531a2bf187eda27", "sha256:b8d3a03d9bfcaf5b0141d07a88456bb6a4c3ce55c080712fec8418ef3610230e", "sha256:bc66f0bf1d7730a17430a50163bb264ba9ded56739112368ba985ddaa9c3bd09", "sha256:bf20494da9653f6410213424f5f8ad0ed885e01f7e8e59811f572bdb20b8972e", "sha256:c48167910a8f644671de9f2083a23630fbf7a1cb70ce939440cd3328e0919f70", "sha256:c481b47f6b5845064c65a7bc78bc0860e635a9b055af0df46fdf1c58cebf8e8f", "sha256:c7c8b95bf47db6d19096a5e052ffca0a05f335bc63cef281a6e8fe864d450a72", "sha256:c9b8e184898ed014884ca84c70562b4a82cbc63b044d366fedc68bc2b2f3394a", "sha256:cc8ff50b50ce532de2fa7a7daae9dd12f0a699bfcd47f20945364e5c31799fef", "sha256:d541423cdd416b78626b55f123412fcf979d22a2c39fce251b350de38c15c15b", "sha256:dab4d16dfef34b185032580e2f2f89253d302facba093d5fa9dbe04f569c4f4b", "sha256:dacbc52de979f2823a819571f2e3a350a7e36b8cb7484cdb1e289bceaf35305f", "sha256:df57bdbeffe694e7842092c5e2e0bc80fff7f43379d465f932ef36f027179806", "sha256:ed8fe9189d2beb6edc14d3ad19800626e1d9f2d975e436f84e19efb7fa19469b", "sha256:f3ddf056d3ebcf6ce47bdaf56142af51bb7fad09e4af310241e9db7a3a8022e1", "sha256:f8fe4984b431f8621ca53d9380901f62bfb54ff759a1348cd140490ada7b693c", "sha256:fe439416eb6380de434886b00c859304338f8b19f6f54811984f3420a2e03858" ], "markers": "python_version >= '3.9'", "version": "==7.6.4" }, "exceptiongroup": { "hashes": [ "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14", "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68" ], "index": "pypi", "markers": "python_version >= '3.7'", "version": "==1.2.0" }, "iniconfig": { "hashes": [ "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" ], "markers": "python_version >= '3.7'", "version": "==2.0.0" }, "mypy": { "hashes": [ "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc", "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e", "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f", "sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74", "sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a", "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2", "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b", "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73", "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e", "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d", "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d", "sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6", "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca", "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d", "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5", "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62", "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a", "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc", "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7", "sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb", "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7", "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732", "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80", "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a", "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc", "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2", "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0", "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24", "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7", "sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b", "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372", "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==1.13.0" }, "mypy-extensions": { "hashes": [ "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782" ], "markers": "python_version >= '3.5'", "version": "==1.0.0" }, "packaging": { "hashes": [ "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002", "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124" ], "markers": "python_version >= '3.8'", "version": "==24.1" }, "pathspec": { "hashes": [ "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712" ], "markers": "python_version >= '3.8'", "version": "==0.12.1" }, "platformdirs": { "hashes": [ "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907", "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb" ], "markers": "python_version >= '3.8'", "version": "==4.3.6" }, "pluggy": { "hashes": [ "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669" ], "markers": "python_version >= '3.8'", "version": "==1.5.0" }, "pytest": { "hashes": [ "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181", "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==8.3.3" }, "pytest-cov": { "hashes": [ "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35", "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0" ], "index": "pypi", "markers": "python_version >= '3.9'", "version": "==6.0.0" }, "tomli": { "hashes": [ "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f" ], "index": "pypi", "markers": "python_version < '3.11'", "version": "==2.0.1" }, "typing-extensions": { "hashes": [ "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8" ], "markers": "python_version >= '3.8'", "version": "==4.12.2" } } } ofxstatement-0.9.2/README.rst000066400000000000000000000402741472116570700157530ustar00rootroot00000000000000OFX Statement ------------- .. image:: https://github.com/kedder/ofxstatement/actions/workflows/test.yml/badge.svg?branch=master :target: https://github.com/kedder/ofxstatement/actions/workflows/test.yml .. image:: https://coveralls.io/repos/kedder/ofxstatement/badge.png?branch=master :target: https://coveralls.io/r/kedder/ofxstatement?branch=master .. image:: http://www.mypy-lang.org/static/mypy_badge.svg :target: http://mypy-lang.org/ .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black Ofxstatement is a tool to convert proprietary bank statements to OFX format, suitable for importing into personal accounting systems like GnuCash. This package provides a command line tool to run: ``ofxstatement``. Run ``ofxstatement -h`` for more help. ``ofxstatement`` works under Python 3 and is not compatible with Python 2. Rationale ========= Most internet banking systems are capable of exporting account transactions to some sort of computer readable format, but few support standard data formats, like `OFX`_. On the other hand, personal accounting systems such as `GnuCash`_ support standard formats only, and will probably never support proprietary statement formats of online banking systems. To bridge the gap between them, this ofxstatement tool was created. .. _GnuCash: http://gnucash.org/ .. _OFX: http://en.wikipedia.org/wiki/Open_Financial_Exchange Mode of Operation ================= The ``ofxstatement`` tool is intended to be used in the following workflow: 1. At the end of each month, use your online banking service to export statements from all of your bank accounts in a format known to ofxstatement. 2. Run ``ofxstatement`` on each exported file to convert it to OFX. Shell scripts or a Makefile may help to automate this routine. 3. Import the generated OFX file into your personal accounting system. Installation and Usage ====================== Before using ``ofxstatement``, you have to install a plugin for your bank (or write your own!). Plugins are installed as regular python packages, with easy_install or pip, for example:: $ pip3 install ofxstatement-lithuanian Note that ofxstatement itself will be installed automatically this way. After the installation, the ``ofxstatement`` utility will be available. Users of *Ubuntu* and *Debian* operating systems can install ofxstatement from official package repositories:: $ apt install ofxstatement ofxstatement-plugins You can check that ofxstatement is working by running:: $ ofxstatement list-plugins You should get a list of your installed plugins. After installation, the usage is simple:: $ ofxstatement convert -t bank_statement.csv statement.ofx The resulting ``statement.ofx`` is then ready to be imported into a personal accounting system. Known Plugins ============= There are several user-developed plugins available: ================================= ============================================ Plugin Description ================================= ============================================ `ofxstatement-mt940`_ Swift MT940 statements `ofxstatement-iso20022`_ Generic ISO-20022 format `ofxstatement-paypal`_ PayPal, ``*.csv`` for private accounts `ofxstatement-transferwise`_ Transferwise CSV (international) `ofxstatement-lithuanian`_ Plugins for several banks, operating in Lithuania: Swedbank, Danske and common Lithuanian exchange format - LITAS-ESIS. `ofxstatement-czech`_ Plugin for Poštovní spořitelna (``maxibps``) and banks using GPC format (e.g., FIO banka, module ``gpc``). `ofxstatement-airbankcz`_ Plugin for Air Bank a.s. (Czech Republic) `ofxstatement-raiffeisencz`_ Plugin for Raiffeisenbank a.s. (Czech Republic) `ofxstatement-skippaycz`_ Plugin for Skip Pay s.r.o. (Czech Republic) `ofxstatement-unicreditcz`_ Plugin for UniCredit Bank Czech Republic and Slovakia `ofxstatement-equabankcz`_ Plugin for Equa Bank a.s. (Czech Republic) `ofxstatement-cz-komercni`_ Komerční banka (Czech Republic) `ofxstatement-mbankcz`_ mBank S.A. (Czech Republic) `ofxstatement-partnersbankacz`_ Partners Banka, a.s. (Czech Republic) `ofxstatement-otp`_ Plugin for OTP Bank, operating in Hungary `ofxstatement-bubbas`_ Set of plugins, developed by @bubbas: ``dkb_cc`` and ``lbbamazon``. `banking.statements.osuuspankki`_ Finnish Osuuspankki bank `banking.statements.nordea`_ Nordea bank (at least Finnish branch of it) `ofxstatement-seb`_ SEB (Sweden), it parses Export.xlsx for private accounts `ofxstatement-lansforsakringar`_ Länsförsäkringar (Sweden), it parses Kontoutdrag.xls for private accounts `ofxstatement-be-belfius`_ Belfius (Belgium) `ofxstatement-be-keytrade`_ KeytradeBank (Belgium) `ofxstatement-be-ing`_ ING (Belgium) `ofxstatement-be-kbc`_ KBC (Belgium) `ofxstatement-be-argenta`_ Argenta (Belgium) (by @woutbr) `ofxstatement-be-argenta-nick`_ Argenta (Belgium, also supports french version) (fork by @Nick-DT) `ofxstatement-be-crelan`_ Crelan (Belgium) `ofxstatement-be-triodos`_ Belgian Triodos Bank CSV statements `ofxstatement-be-newb`_ Belgian cooperative bank newB `ofxstatement-be-vdk-fr`_ VDK (Belgium, French statements) `ofxstatement-be-hellobank-fr`_ Hello Bank (Belgium, French statements) `ofxstatement-germany`_ Plugin for several german banks (1822direkt and Postbank at the moment) `ofxstatement-dab`_ DAB Bank (Germany) `ofxstatement-consors`_ Consorsbank (Germany) `ofxstatement-de-triodos`_ German Triodos Bank CSV statements (also works for GLS Bank) `ofxstatement-sp-freiburg`_ Sparkasse Freiburg-Nördlicher Breisgau (Germany) `ofxstatement-de-ing`_ Ing Diba Bank (Germany) `ofxstatement-mastercard-de`_ Mastercard PDF statements (Germany) `ofxstatement-sparkasse-de`_ Sparkasse PDF statements (Germany) `ofxstatement-austrian`_ Plugins for several banks, operating in Austria: Easybank, ING-Diba, Livebank, Raiffeisenbank. `ofxstatement-postfinance`_ Swiss PostFinance (E-Finance Java text based bank/credit statements). `ofxstatement-fineco`_ FinecoBank (Italy) `ofxstatement-intesasp`_ Intesa San Paolo xlsx balance file (Italy) `ofxstatement-chebanca`_ CheBanca! xlsx format (Italy) `ofxstatement-n26`_ N26 Bank (Italy) `ofxstatement-it-banks`_ Widiba and Webank (Italy) `ofxstatement-bancoposta`_ BancoPosta - Poste Italiane (Italy) `ofxstatement-hype`_ Hype - Banca Sella (Italy) `ofxstatement-betterment`_ Betterment (USA) `ofxstatement-us-first-republic`_ First Republic Bank (USA) `ofxstatement-simple`_ Simple (USA, defunct) JSON financial statement format `ofxstatement-mbank-sk`_ MBank.sk (Slovakia) `ofxstatement-latvian`_ Latvian banks `ofxstatement-ee-seb`_ SEB (Estonia), parses proprietary csv file `ofxstatement-ee-swedbank`_ Swedbank (Estonia), parses proprietary csv file `ofxstatement-polish`_ Support for some Polish banks and financial institutions `ofxstatement-russian`_ Support for several Russian banks: Avangard, AlfaBank, Tinkoff, SberBank (both debit and csv), VTB. `ofxstatement-is-arionbanki`_ Arion bank (Iceland) `ofxstatement-revolut`_ Revolut Mastercard `ofxstatement-al_bank`_ Arbejdernes Landsbank (Denmark) `ofxstatement-cd-tmb`_ Trust Merchant Bank (DRC) `ofxstatement-zm-stanbic`_ Stanbic Bank (Zambia) `ofxstatement-dutch`_ Dutch financial institutes like ICSCards and ING `ofxstatement-french`_ French financial institutes like BanquePopulaire `ofxstatement-schwab-json`_ Charles Schwab investment history JSON export `ofxstatement-bbva`_ BBVA (Spain) `ofxstatement-qif`_ Converts Quicken Interchange Format (QIF) formatted bank transaction files `ofxstatement-santander`_ Converts Santander transaction files ================================= ============================================ .. _ofxstatement-lithuanian: https://github.com/kedder/ofxstatement-lithuanian .. _ofxstatement-czech: https://gitlab.com/mcepl/ofxstatement-czech .. _ofxstatement-airbankcz: https://github.com/milankni/ofxstatement-airbankcz .. _ofxstatement-raiffeisencz: https://github.com/milankni/ofxstatement-raiffeisencz .. _ofxstatement-skippaycz: https://github.com/archont00/ofxstatement-skippaycz .. _ofxstatement-unicreditcz: https://github.com/milankni/ofxstatement-unicreditcz .. _ofxstatement-equabankcz: https://github.com/kosciCZ/ofxstatement-equabankcz .. _ofxstatement-mbankcz: https://github.com/SinyaWeo/ofxstatement-mbankcz .. _ofxstatement-partnersbankacz: https://github.com/archont00/ofxstatement-partnersbankacz .. _ofxstatement-otp: https://github.com/abesto/ofxstatement-otp .. _ofxstatement-bubbas: https://github.com/bubbas/ofxstatement-bubbas .. _banking.statements.osuuspankki: https://github.com/koodaamo/banking.statements.osuuspankki .. _banking.statements.nordea: https://github.com/koodaamo/banking.statements.nordea .. _ofxstatement-germany: https://github.com/MirkoDziadzka/ofxstatement-germany .. _ofxstatement-austrian: https://github.com/nblock/ofxstatement-austrian .. _ofxstatement-postfinance: https://pypi.python.org/pypi/ofxstatement-postfinance .. _ofxstatement-mbank-sk: https://github.com/epitheton/ofxstatement-mbank-sk .. _ofxstatement-be-belfius: https://github.com/renardeau/ofxstatement-be-belfius .. _ofxstatement-be-keytrade: https://github.com/Scotchy49/ofxstatement-be-keytrade .. _ofxstatement-be-ing: https://github.com/jbbandos/ofxstatement-be-ing .. _ofxstatement-be-kbc: https://github.com/plenaerts/ofxstatement-be-kbc .. _ofxstatement-be-argenta: https://github.com/woutbr/ofxstatement-be-argenta .. _ofxstatement-be-argenta-nick: https://github.com/Nick-DT/ofxstatement-be-argenta .. _ofxstatement-be-crelan: https://gitlab.com/MagnificentMoustache/ofxstatement-be.crelan .. _ofxstatement-be-newb: https://github.com/SDaron/ofxstatement-be-newb .. _ofxstatement-betterment: https://github.com/cmayes/ofxstatement-betterment .. _ofxstatement-simple: https://github.com/cmayes/ofxstatement-simple .. _ofxstatement-latvian: https://github.com/gintsmurans/ofxstatement-latvian .. _ofxstatement-iso20022: https://github.com/kedder/ofxstatement-iso20022 .. _ofxstatement-seb: https://github.com/gerasiov/ofxstatement-seb .. _ofxstatement-paypal: https://github.com/gerasiov/ofxstatement-paypal .. _ofxstatement-polish: https://github.com/yay6/ofxstatement-polish .. _ofxstatement-russian: https://github.com/gerasiov/ofxstatement-russian .. _ofxstatement-dab: https://github.com/JohannesKlug/ofxstatement-dab .. _ofxstatement-consors: https://github.com/JohannesKlug/ofxstatement-consors .. _ofxstatement-is-arionbanki: https://github.com/Dagur/ofxstatement-is-arionbanki .. _ofxstatement-be-triodos: https://github.com/renardeau/ofxstatement-be-triodos .. _ofxstatement-de-triodos: https://github.com/pianoslum/ofxstatement-de-triodos .. _ofxstatement-lansforsakringar: https://github.com/lbschenkel/ofxstatement-lansforsakringar .. _ofxstatement-revolut: https://github.com/mlaitinen/ofxstatement-revolut .. _ofxstatement-transferwise: https://github.com/kedder/ofxstatement-transferwise .. _ofxstatement-n26: https://github.com/3v1n0/ofxstatement-n26 .. _ofxstatement-sp-freiburg: https://github.com/omarkohl/ofxstatement-sparkasse-freiburg .. _ofxstatement-al_bank: https://github.com/lbschenkel/ofxstatement-al_bank .. _ofxstatement-fineco: https://github.com/frankIT/ofxstatement-fineco .. _ofxstatement-intesasp: https://github.com/Jacotsu/ofxstatement-intesasp .. _ofxstatement-de-ing: https://github.com/fabolhak/ofxstatement-de-ing .. _ofxstatement-germany: https://github.com/MirkoDziadzka/ofxstatement-germany .. _ofxstatement-us-first-republic: https://github.com/medovina/ofxstatement-us-first-republic .. _ofxstatement-cz-komercni: https://github.com/medovina/ofxstatement-cz-komercni .. _ofxstatement-cd-tmb: https://github.com/BIZ4Africa/ofxstatement-cd-tmb .. _ofxstatement-zm-stanbic: https://github.com/BIZ4Africa/ofxstatement-zm-stanbic .. _ofxstatement-dutch: https://github.com/gpaulissen/ofxstatement-dutch .. _ofxstatement-french: https://github.com/gpaulissen/ofxstatement-french .. _ofxstatement-mt940: https://github.com/gpaulissen/ofxstatement-mt940 .. _ofxstatement-it-banks: https://github.com/ecorini/ofxstatement-it-banks .. _ofxstatement-ee-seb: https://github.com/rsi2m/ofxstatement-ee-seb .. _ofxstatement-ee-swedbank: https://github.com/rsi2m/ofxstatement-ee-swedbank .. _ofxstatement-chebanca: https://github.com/3v1n0/ofxstatement-chebanca .. _ofxstatement-mastercard-de: https://github.com/FliegendeWurst/ofxstatement-mastercard-de .. _ofxstatement-sparkasse-de: https://github.com/FliegendeWurst/ofxstatement-sparkasse-de .. _ofxstatement-bancoposta: https://github.com/lorenzogiudici5/ofxstatement-bancoposta .. _ofxstatement-hype: https://github.com/lorenzogiudici5/ofxstatement-hype .. _ofxstatement-schwab-json: https://github.com/edwagner/ofxstatement-schwab-json .. _ofxstatement-bbva: https://github.com/3v1n0/ofxstatement-bbva .. _ofxstatement-qif: https://github.com/robvadai/ofxstatement-qif .. _ofxstatement-santander: https://github.com/robvadai/ofxstatement-santander .. _ofxstatement-be-vdk-fr: https://github.com/Jibuus/ofxstatement-be-vdk-fr .. _ofxstatement-be-hellobank-fr: https://github.com/Jibuus/ofxstatement-be-hellobank-fr Advanced Configuration ====================== While ofxstatement can be used without any configuration, some plugins may accept additional configuration parameters. These parameters can be specified in a configuration file. The configuration file can be edited using the ``edit-config`` command that opens your favorite editor (defined by environment variable EDITOR or else the default for your platform) with the configuration file:: $ ofxstatement edit-config The configuration file format is in the standard .ini format. The configuration is divided into sections that correspond to the ``--type`` command line parameter. Each section must provide a ``plugin`` option that points to one of the registered conversion plugins. Other parameters are plugin specific. A sample configuration file:: [swedbank] plugin = swedbank [danske:usd] plugin = litas-esis charset = cp1257 currency = USD account = LT123456789012345678 Such a configuration will let ofxstatement know about two statement file formats handled by the plugins ``swedbank`` and ``litas-esis``. The ``litas-esis`` plugin will load statements using the ``cp1257`` charset and set a custom currency and account number. This way, GnuCash will automatically associate the generated .ofx file with a particular GnuCash account. To convert the proprietary CSV file ``danske.csv`` into the OFX file ``danske.ofx``, run:: $ ofxstatement -t danske:usd danske.csv danske.ofx Note that configuration parameters are plugin specific. See the plugin documentation for more info. To use a custom configuration file, pass the ``-c`` / ``--config`` option:: $ ofxstatement convert -t pluginname -c /path/to/myconfig.ini input.csv output.ofx Development / Testing ===================== ``ofxstatemnt`` uses `pipenv`_ to manage the development environment and dependencies:: $ pip install pipenv $ git clone https://github.com//ofxstatement.git $ cd ofxstatement $ pipenv sync --dev .. _pipenv: https://github.com/pypa/pipenv And finally run the test suite:: $ pipenv shell $ pytest When satisfied, you may create a pull request. Writing your own Plugin ======================= If the plugin for your bank has not been developed yet (see `Known plugins`_ section above) you can easily write your own, provided you have some knowledge about the Python programming language. There is an `ofxstatement-sample`_ plugin project available that provides sample boilerplate and describes the plugin development process in detail. .. _ofxstatement-sample: https://github.com/kedder/ofxstatement-sample ofxstatement-0.9.2/doc/000077500000000000000000000000001472116570700150225ustar00rootroot00000000000000ofxstatement-0.9.2/doc/ofx_sample_files/000077500000000000000000000000001472116570700203415ustar00rootroot00000000000000ofxstatement-0.9.2/doc/ofx_sample_files/ofx_spec201_invest_transactions_example.xml000066400000000000000000000142511472116570700310120ustar00rootroot00000000000000 0 INFO 19991029101003 ENG 19991029101003 19991029101003 NCH 1001 AAPL TICKER AAPL AAPL MSFT TICKER MSFT MSFT 1002 0 INFO 20210501 USD Your broker name your broker account ID 20210101 20210501 BUY 1234567 20210128 Purchased 3 Apple (AAPL) at USD 138.28, total: USD 414.84, fees USD 1.24, transaction ID: 1234567 AAPL TICKER OTHER OTHER 1.24000 138.28000 3.00000 -416.08000 SELL 234567 20210226 Sold 5 Microsoft (MSFT) at USD 225.63, total: USD 1128.15, fees USD 0.28, transaction ID: 234567 MSFT TICKER OTHER OTHER 0.28000 225.63000 -5.00000 1127.87000 DIV 54321 20210319 Dividends from Microsoft, USD 0.79 MSFT TICKER OTHER OTHER 0.79000 ofxstatement-0.9.2/doc/ofx_sample_files/ofx_spec201_stmtrs_example.xml000066400000000000000000000101361472116570700262440ustar00rootroot00000000000000 0 INFO 19991029101003 ENG 19991029101003 19991029101003 NCH 1001 1001 0 INFO USD 121099999 999988 CHECKING 19991001 19991028 CHECK 19991004 -200.00 00002 1000 ATM 19991020 19991020 -300.00 00003 200.29 199910291120 200.29 199910291120 ofxstatement-0.9.2/pyproject.toml000066400000000000000000000023561472116570700171770ustar00rootroot00000000000000[build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] name = "ofxstatement" version = "0.9.2" authors = [ { name="Andrey Lebedev", email="andrey@lebedev.lt" }, ] 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 = [ "platformdirs", "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] packages = [ "ofxstatement", "ofxstatement.plugins", "ofxstatement.tests", "ofxstatement.tests.samples", ] [tool.setuptools.package-data] ofxstatement = ["tests/samples"] ofxstatement-0.9.2/pytest.ini000066400000000000000000000006131472116570700163060ustar00rootroot00000000000000[pytest] markers = pep8: workaround for https://bitbucket.org/pytest-dev/pytest-pep8/issues/23/ python_files = test_*.py addopts = --cov ofxstatement --cov-report term-missing --no-cov-on-fail --ignore setup.py log_cli = 1 log_cli_level = INFO log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) log_cli_date_format = %Y-%m-%d %H:%M:%S ofxstatement-0.9.2/setup.cfg000066400000000000000000000001231472116570700160720ustar00rootroot00000000000000[options] package_dir = =src packages = find: [options.packages.find] where = src ofxstatement-0.9.2/setup.py000066400000000000000000000000521472116570700157640ustar00rootroot00000000000000from distutils.core import setup setup() ofxstatement-0.9.2/src/000077500000000000000000000000001472116570700150445ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/000077500000000000000000000000001472116570700175655ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/__init__.py000066400000000000000000000000001472116570700216640ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/configuration.py000066400000000000000000000015621472116570700230120ustar00rootroot00000000000000from typing import Optional from collections.abc import MutableMapping import os import configparser import platformdirs from ofxstatement.exceptions import Abort APP_NAME = "ofxstatement" APP_AUTHOR = "ofx" def get_default_location() -> str: cdir = platformdirs.user_config_dir(APP_NAME, APP_AUTHOR) return os.path.join(cdir, "config.ini") def read(location: Optional[str] = None) -> Optional[MutableMapping]: if not location: location = get_default_location() if not os.path.exists(location): return None config = configparser.ConfigParser() config.read(location) return config def get_settings(config, section: str): if not config.has_section(section): raise Abort("No section named %s in config file" % section) opts = config.get_options(section) return zip([(o, config.get(section, o)) for o in opts]) ofxstatement-0.9.2/src/ofxstatement/exceptions.py000066400000000000000000000011041472116570700223140ustar00rootroot00000000000000class Abort(Exception): pass class ParseError(Exception): """Raised by parser to indicate malformed input""" def __init__(self, lineno: int, message: str) -> None: self.lineno = lineno self.message = message class ValidationError(Exception): # pragma: no cover """Raised by parser to indicate validation errors for an object""" def __init__(self, message: str, obj: object) -> None: self.message = message self.obj = obj def __str__(self) -> str: return "message: %s; object:\n%r" % (self.message, self.obj) ofxstatement-0.9.2/src/ofxstatement/ofx.py000066400000000000000000000255571472116570700207510ustar00rootroot00000000000000from typing import Optional, Union from datetime import datetime, date from decimal import Decimal from xml.etree import ElementTree as etree from xml.dom import minidom from ofxstatement.statement import ( Statement, StatementLine, InvestStatementLine, BankAccount, Currency, ) class OfxWriter(object): def __init__(self, statement: Statement) -> None: self.statement = statement self.genTime = datetime.now() self.tb = etree.TreeBuilder() self.default_float_precision = 2 self.invest_transactions_float_precision = 5 def toxml(self, pretty: bool = False) -> str: et = self.buildDocument() encoded = etree.tostring(et.getroot(), "utf-8") encoded = str(encoded, "utf-8") if pretty: dom = minidom.parseString(encoded) encoded = dom.toprettyxml(indent=" ") encoded = encoded.replace('', "").lstrip() header = ( "\n\n" ) return header + encoded def buildDocument(self) -> etree.ElementTree: tb = self.tb tb.start("OFX", {}) self.buildSignon() self.buildTransactionList() tb.end("OFX") return etree.ElementTree(tb.close()) def buildSignon(self) -> None: tb = self.tb tb.start("SIGNONMSGSRSV1", {}) tb.start("SONRS", {}) tb.start("STATUS", {}) self.buildText("CODE", "0") self.buildText("SEVERITY", "INFO") tb.end("STATUS") self.buildDateTime("DTSERVER", self.genTime) self.buildText("LANGUAGE", "ENG") tb.end("SONRS") tb.end("SIGNONMSGSRSV1") def buildTransactionList(self) -> None: if self.statement.lines: self.buildBankTransactionList() if self.statement.invest_lines: self.buildInvestTransactionList() def buildBankTransactionList(self) -> None: tb = self.tb tb.start("BANKMSGSRSV1", {}) tb.start("STMTTRNRS", {}) self.buildText("TRNUID", "0") tb.start("STATUS", {}) self.buildText("CODE", "0") self.buildText("SEVERITY", "INFO") tb.end("STATUS") tb.start("STMTRS", {}) self.buildText("CURDEF", self.statement.currency) tb.start("BANKACCTFROM", {}) self.buildText("BANKID", self.statement.bank_id, False) self.buildText("ACCTID", self.statement.account_id, False) self.buildText("ACCTTYPE", self.statement.account_type) tb.end("BANKACCTFROM") tb.start("BANKTRANLIST", {}) self.buildDate("DTSTART", self.statement.start_date, False) self.buildDate("DTEND", self.statement.end_date, False) for line in self.statement.lines: self.buildBankTransaction(line) tb.end("BANKTRANLIST") tb.start("LEDGERBAL", {}) self.buildAmount("BALAMT", self.statement.end_balance, False) self.buildDateTime("DTASOF", self.statement.end_date, False) tb.end("LEDGERBAL") tb.end("STMTRS") tb.end("STMTTRNRS") tb.end("BANKMSGSRSV1") def buildBankTransaction(self, line: StatementLine) -> None: tb = self.tb tb.start("STMTTRN", {}) self.buildText("TRNTYPE", line.trntype) self.buildDate("DTPOSTED", line.date) self.buildDate("DTUSER", line.date_user) self.buildAmount("TRNAMT", line.amount) self.buildText("FITID", line.id) self.buildText("CHECKNUM", line.check_no) self.buildText("REFNUM", line.refnum) self.buildText("NAME", line.payee) if line.bank_account_to: tb.start("BANKACCTTO", {}) self.buildBankAccount(line.bank_account_to) tb.end("BANKACCTTO") self.buildText("MEMO", line.memo) if line.currency is not None: self.buildCurrency("CURRENCY", line.currency) if line.orig_currency is not None: self.buildCurrency("ORIG_CURRENCY", line.orig_currency) tb.end("STMTTRN") def buildCurrency(self, tag: str, currency: Currency) -> None: self.tb.start(tag, {}) self.buildText("CURSYM", currency.symbol) self.buildAmount("CURRATE", currency.rate) self.tb.end(tag) def buildInvestTransactionList(self) -> None: tb = self.tb tb.start("SECLISTMSGSRSV1", {}) tb.start("SECLIST", {}) # get unqiue tickers for security_id in dict.fromkeys( map(lambda x: x.security_id, self.statement.invest_lines) ): if security_id is None: continue tb.start("STOCKINFO", {}) tb.start("SECINFO", {}) tb.start("SECID", {}) self.buildText("UNIQUEID", security_id) self.buildText("UNIQUEIDTYPE", "TICKER") tb.end("SECID") self.buildText("SECNAME", security_id) self.buildText("TICKER", security_id) tb.end("SECINFO") tb.end("STOCKINFO") tb.end("SECLIST") tb.end("SECLISTMSGSRSV1") tb.start("INVSTMTMSGSRSV1", {}) tb.start("INVSTMTTRNRS", {}) self.buildText("TRNUID", "0") tb.start("STATUS", {}) self.buildText("CODE", "0") self.buildText("SEVERITY", "INFO") tb.end("STATUS") tb.start("INVSTMTRS", {}) self.buildDateTime("DTASOF", self.statement.end_date, False) self.buildText("CURDEF", self.statement.currency) tb.start("INVACCTFROM", {}) self.buildText("BROKERID", self.statement.broker_id, False) self.buildText("ACCTID", self.statement.account_id, False) tb.end("INVACCTFROM") tb.start("INVTRANLIST", {}) self.buildDate("DTSTART", self.statement.start_date, False) self.buildDate("DTEND", self.statement.end_date, False) for line in self.statement.invest_lines: self.buildInvestTransaction(line) tb.end("INVTRANLIST") tb.end("INVSTMTRS") tb.end("INVSTMTTRNRS") tb.end("INVSTMTMSGSRSV1") def buildInvestTransaction(self, line: InvestStatementLine) -> None: # invest transactions must always have trntype if line.trntype is None: return tb = self.tb if line.trntype == "INVBANKTRAN": tb.start(line.trntype, {}) bankTran = StatementLine(line.id, line.date, line.memo, line.amount) bankTran.trntype = line.trntype_detailed self.buildBankTransaction(bankTran) self.buildText("SUBACCTFUND", "OTHER") tb.end(line.trntype) return tran_type_detailed_tag_name = None inner_tran_type_tag_name = None if line.trntype.startswith("BUY"): tran_type_detailed_tag_name = "BUYTYPE" inner_tran_type_tag_name = "INVBUY" elif line.trntype.startswith("SELL"): tran_type_detailed_tag_name = "SELLTYPE" inner_tran_type_tag_name = "INVSELL" elif line.trntype == "TRANSFER": # Transfer transactions don't have details or an envelope tran_type_detailed_tag_name = None inner_tran_type_tag_name = None else: tran_type_detailed_tag_name = "INCOMETYPE" inner_tran_type_tag_name = ( None # income transactions don't have an envelope element ) tb.start(line.trntype, {}) if tran_type_detailed_tag_name: self.buildText(tran_type_detailed_tag_name, line.trntype_detailed, False) if inner_tran_type_tag_name: tb.start(inner_tran_type_tag_name, {}) tb.start("INVTRAN", {}) self.buildText("FITID", line.id) self.buildDate("DTTRADE", line.date, False) self.buildText("MEMO", line.memo) tb.end("INVTRAN") tb.start("SECID", {}) self.buildText("UNIQUEID", line.security_id, False) self.buildText("UNIQUEIDTYPE", "TICKER") tb.end("SECID") self.buildText("SUBACCTSEC", "OTHER") self.buildText("SUBACCTFUND", "OTHER") if line.fees: if line.trntype == "INCOME": self.buildAmount( "WITHHOLDING", line.fees, False, precision=self.invest_transactions_float_precision, ) else: self.buildAmount( "FEES", line.fees, False, precision=self.invest_transactions_float_precision, ) self.buildAmount( "UNITPRICE", line.unit_price, precision=self.invest_transactions_float_precision, ) self.buildAmount( "UNITS", line.units, precision=self.invest_transactions_float_precision, ) self.buildAmount("TOTAL", line.amount) if inner_tran_type_tag_name: tb.end(inner_tran_type_tag_name) tb.end(line.trntype) def buildBankAccount(self, account: BankAccount) -> None: self.buildText("BANKID", account.bank_id) self.buildText("BRANCHID", account.branch_id) self.buildText("ACCTID", account.acct_id) self.buildText("ACCTTYPE", account.acct_type) self.buildText("ACCTKEY", account.acct_key) def buildText(self, tag: str, text: Optional[str], skipEmpty: bool = True) -> None: if not text and skipEmpty: return self.tb.start(tag, {}) self.tb.data(text or "") self.tb.end(tag) def buildDate( self, tag: str, dt: Optional[Union[date, datetime]], skipEmpty: bool = True ) -> None: if not dt and skipEmpty: return if dt is None: self.buildText(tag, "", skipEmpty) else: self.buildText(tag, dt.strftime("%Y%m%d")) def buildDateTime( self, tag: str, dt: Optional[datetime], skipEmpty: bool = True ) -> None: if not dt and skipEmpty: return if dt is None: self.buildText(tag, "", skipEmpty) else: self.buildText(tag, dt.strftime("%Y%m%d%H%M%S")) def buildAmount( self, tag: str, amount: Optional[Decimal], skipEmpty: bool = True, precision: Optional[int] = None, ) -> None: if amount is None and skipEmpty: return if amount is None: self.buildText(tag, "", skipEmpty) else: if precision is None: precision = self.default_float_precision self.buildText(tag, "{0:.{precision}f}".format(amount, precision=precision)) ofxstatement-0.9.2/src/ofxstatement/parser.py000066400000000000000000000065731472116570700214460ustar00rootroot00000000000000from typing import Dict, Optional, Any, Iterable, List, TextIO, TypeVar, Generic from abc import abstractmethod import csv from decimal import Decimal, Decimal as D from datetime import datetime from ofxstatement.statement import Statement, StatementLine LT = TypeVar("LT") class AbstractStatementParser: @abstractmethod def parse(self) -> Statement: """Parse the input and produce the statement object""" class StatementParser(AbstractStatementParser, Generic[LT]): """Abstract statement parser. Defines interface for all parser implementation """ statement: Statement date_format: str = "%Y-%m-%d" cur_record: int = 0 def __init__(self) -> None: self.statement = Statement() def parse(self) -> Statement: """Read and parse statement Return Statement object May raise exceptions.ParseException on malformed input. """ assert hasattr(self, "statement"), "StatementParser.__init__() not called" reader = self.split_records() for line in reader: self.cur_record += 1 if not line: continue stmt_line = self.parse_record(line) if stmt_line: stmt_line.assert_valid() self.statement.lines.append(stmt_line) return self.statement def split_records(self) -> Iterable[LT]: # pragma: no cover """Return iterable object consisting of a line per transaction""" raise NotImplementedError def parse_record(self, line: LT) -> Optional[StatementLine]: # pragma: no cover """Parse given transaction line and return StatementLine object""" raise NotImplementedError def parse_value(self, value: Optional[str], field: str) -> Any: tp = StatementLine.__annotations__.get(field) if value is None: return None if tp in (datetime, Optional[datetime]): return self.parse_datetime(value) elif tp in (Decimal, Optional[Decimal]): return self.parse_decimal(value) else: return value def parse_datetime(self, value: str) -> datetime: return datetime.strptime(value, self.date_format) def parse_float(self, value: str) -> D: # pragma: no cover # compatibility wrapper for old plugins return self.parse_decimal(value) def parse_decimal(self, value: str) -> D: # some plugins pass localised numbers, clean them up return D(value.replace(",", ".").replace(" ", "")) class CsvStatementParser(StatementParser[List[str]]): """Generic csv statement parser""" fin: TextIO # file input stream # 0-based csv column mapping to StatementLine field mappings: Dict[str, int] = {} def __init__(self, fin: TextIO) -> None: super().__init__() self.fin = fin def split_records(self) -> Iterable[List[str]]: return csv.reader(self.fin) def parse_record(self, line: List[str]) -> Optional[StatementLine]: stmt_line = StatementLine() for field, col in self.mappings.items(): if col >= len(line): raise ValueError( "Cannot find column %s in line of %s items " % (col, len(line)) ) rawvalue = line[col] value = self.parse_value(rawvalue, field) setattr(stmt_line, field, value) return stmt_line ofxstatement-0.9.2/src/ofxstatement/plugin.py000066400000000000000000000027271472116570700214450ustar00rootroot00000000000000"""Plugin framework. Plugins are objects that configures and coordinates conversion machinery. """ from typing import List, Tuple, Type from collections.abc import MutableMapping import sys if sys.version_info < (3, 10): from importlib_metadata import entry_points else: from importlib.metadata import entry_points from ofxstatement.ui import UI from ofxstatement.parser import AbstractStatementParser def get_plugin(name: str, ui: UI, settings: MutableMapping) -> "Plugin": plugins = entry_points(name=name) if not plugins: raise PluginNotRegistered(name) if len(plugins) > 1: raise PluginNameConflict(plugins) plugin = plugins[name].load() return plugin(ui, settings) def list_plugins() -> List[Tuple[str, Type["Plugin"]]]: """Return list of all plugin classes registered as a list of tuples: [(name, plugin_class)] """ plugin_eps = entry_points(group="ofxstatement") return sorted((ep.name, ep.load()) for ep in plugin_eps) class PluginNotRegistered(Exception): """Raised on attempt to get plugin, missing from the registry.""" class PluginNameConflict(Exception): """Raised when there are more than one plugins registered with the same name """ class Plugin: ui: UI def __init__(self, ui: UI, settings: MutableMapping) -> None: self.ui = ui self.settings = settings def get_parser(self, filename: str) -> AbstractStatementParser: raise NotImplementedError() ofxstatement-0.9.2/src/ofxstatement/plugins/000077500000000000000000000000001472116570700212465ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/plugins/README.txt000066400000000000000000000001131472116570700227370ustar00rootroot00000000000000Namespace package for ofxstatement plugins Please do not remove this file.ofxstatement-0.9.2/src/ofxstatement/plugins/__init__.py000066400000000000000000000000001472116570700233450ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/py.typed000066400000000000000000000000001472116570700212520ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/statement.py000066400000000000000000000322271472116570700221510ustar00rootroot00000000000000"""Statement model""" from typing import List, Optional from datetime import datetime from decimal import Decimal as D from hashlib import sha1 from pprint import pformat from math import isclose from ofxstatement import exceptions TRANSACTION_TYPES = [ "CREDIT", # Generic credit "DEBIT", # Generic debit "INT", # Interest earned or paid "DIV", # Dividend "FEE", # FI fee "SRVCHG", # Service charge "DEP", # Deposit "ATM", # ATM debit or credit "POS", # Point of sale debit or credit "XFER", # Transfer "CHECK", # Check "PAYMENT", # Electronic payment "CASH", # Cash withdrawal "DIRECTDEP", # Direct deposit "DIRECTDEBIT", # Merchant initiated debit "REPEATPMT", # Repeating payment/standing order "OTHER", # Other ] INVEST_TRANSACTION_TYPES = [ "BUYSTOCK", "BUYDEBT", "INCOME", "INVBANKTRAN", "SELLSTOCK", "SELLDEBT", "TRANSFER", ] INVEST_TRANSACTION_TYPES_DETAILED = [ "BUY", "BUYTOCOVER", # end short sale "SELL", "SELLSHORT", # open short sale "DIV", # only for INCOME "INTEREST", # only for INCOME "CGLONG", # only for INCOME "CGSHORT", # only for INCOME ] INVBANKTRAN_TYPES_DETAILED = [ "INT", "XFER", "DEBIT", "CREDIT", "SRVCHG", "OTHER", ] ACCOUNT_TYPE = [ "CHECKING", # Checking "SAVINGS", # Savings "MONEYMRKT", # Money Market "CREDITLINE", # Line of credit ] # Inspired by "How to print instances of a class using print()?" # on stackoverflow.com class Printable: def __repr__(self) -> str: # pragma: no cover # do not set width to 1 because that makes the output really ugly return "<" + type(self).__name__ + "> " + pformat(vars(self), indent=4) class Statement(Printable): """Statement object containing statement items""" lines: List["StatementLine"] invest_lines: List["InvestStatementLine"] currency: Optional[str] = None bank_id: Optional[str] = None broker_id: Optional[str] = None account_id: Optional[str] = None # Type of account, must be one of ACCOUNT_TYPE account_type: Optional[str] = None start_balance: Optional[D] = None start_date: Optional[datetime] = None end_balance: Optional[D] = None end_date: Optional[datetime] = None def __init__( self, bank_id: Optional[str] = None, account_id: Optional[str] = None, currency: Optional[str] = None, account_type: str = "CHECKING", ) -> None: self.lines = [] self.invest_lines = [] self.bank_id = bank_id self.account_id = account_id self.currency = currency self.account_type = account_type def assert_valid(self) -> None: # pragma: no cover if not (self.start_balance is None or self.end_balance is None): total_amount = sum( [sl.amount for sl in self.lines if sl.amount is not None], D(0) ) msg = ( "Start balance ({0}) plus the total amount ({1}) " "should be equal to the end balance ({2})".format( self.start_balance, total_amount, self.end_balance ) ) if not isclose(self.start_balance + total_amount, self.end_balance): raise exceptions.ValidationError(msg, self) class StatementLine(Printable): """Statement line data.""" id: Optional[str] # Date transaction was posted to account date: Optional[datetime] memo: Optional[str] # Amount of transaction amount: Optional[D] # additional fields payee: Optional[str] # Date user initiated transaction, if known date_user: Optional[datetime] # Check (or other reference) number check_no: Optional[str] # Reference number that uniquely identifies the transaction. Can be used in # addition to or instead of a check_no refnum: Optional[str] # Transaction type, must be one of TRANSACTION_TYPES trntype: Optional[str] = "CHECK" # Optional BankAccount instance bank_account_to: Optional["BankAccount"] = None # Currency this line is expressed in (if different from statement # currency). Available since 0.7.2 currency: Optional["Currency"] = None # Original amount and the original (foreign) currency. Available since 0.7.2 orig_currency: Optional["Currency"] = None def __init__( self, id: Optional[str] = None, date: Optional[datetime] = None, memo: Optional[str] = None, amount: Optional[D] = None, ) -> None: self.id = id self.date = date self.memo = memo self.amount = amount self.date_user = None self.payee = None self.check_no = None self.refnum = None def __str__(self) -> str: # pragma: no cover return """ ID: %s, date: %s, amount: %s, payee: %s memo: %s check no.: %s """ % ( self.id, self.date, self.amount, self.payee, self.memo, self.check_no, ) def assert_valid(self) -> None: """Ensure that fields have valid values""" assert ( self.trntype in TRANSACTION_TYPES ), "trntype %s is not valid, must be one of %s" % ( self.trntype, TRANSACTION_TYPES, ) if self.bank_account_to: self.bank_account_to.assert_valid() assert self.id or self.check_no or self.refnum class Currency(Printable): """CURRENCY and ORIGCURRENCY aggregates from OFX See section 5.2 from OFX spec version 2.2. """ # ISO-4217 3-letter currency identifier symbol: str # Ratio of statement currency to `symbol` currency rate: Optional[D] def __init__(self, symbol: str, rate: Optional[D] = None) -> None: self.symbol = symbol self.rate = rate class InvestStatementLine(Printable): """Invest statement line data.""" id: Optional[str] # Date transaction was posted to account date: Optional[datetime] memo: Optional[str] # ID or ticker of underlying security security_id: Optional[str] # Transaction type, must be one of INVEST_TRANSACTION_TYPES trntype: Optional[str] # More detailed information about transaction, must be one of INVEST_TRANSACTION_TYPES_DETAILED trntype_detailed: Optional[str] # Amount of transaction amount: Optional[D] fees: Optional[D] = None unit_price: Optional[D] = None # required for buy/sell transactions units: Optional[D] = None # required for buy/sell transactions def __init__( self, id: Optional[str] = None, date: Optional[datetime] = None, memo: Optional[str] = None, trntype: Optional[str] = None, trntype_detailed: Optional[str] = None, security_id: Optional[str] = None, amount: Optional[D] = None, ) -> None: self.id = id self.date = date self.memo = memo self.trntype = trntype self.trntype_detailed = trntype_detailed self.security_id = security_id self.amount = amount def __str__(self) -> str: return """ ID: %s, date: %s, trntype: %s, trntype_detailed: %s, security_id: %s, units: %s, unit_price: %s, amount: %s, fees: %s memo: %s """ % ( self.id, self.date, self.trntype, self.trntype_detailed, self.security_id, self.units, self.unit_price, self.amount, self.fees, self.memo, ) def assert_valid(self) -> None: """Ensure that fields have valid values""" assert ( self.trntype in INVEST_TRANSACTION_TYPES ), "trntype %s is not valid, must be one of %s" % ( self.trntype, INVEST_TRANSACTION_TYPES, ) if self.trntype == "INVBANKTRAN": assert self.trntype_detailed in INVBANKTRAN_TYPES_DETAILED, ( "trntype_detailed %s is not valid for INVBANKTRAN, must be one of %s" % ( self.trntype_detailed, INVBANKTRAN_TYPES_DETAILED, ) ) elif self.trntype == "TRANSFER": assert ( self.trntype_detailed is None ), f"trntype_detailed '{self.trntype_detailed}' should be empty for TRANSFERS" else: assert ( self.trntype_detailed in INVEST_TRANSACTION_TYPES_DETAILED ), "trntype_detailed %s is not valid, must be one of %s" % ( self.trntype_detailed, INVEST_TRANSACTION_TYPES_DETAILED, ) assert self.id assert self.date assert self.trntype == "TRANSFER" or self.amount assert self.trntype == "INVBANKTRAN" or self.security_id if self.trntype == "INVBANKTRAN": pass elif self.trntype == "INCOME": assert self.security_id else: assert self.security_id assert self.units assert self.trntype == "TRANSFER" or self.unit_price class BankAccount(Printable): """Structure corresponding to BANKACCTTO and BANKACCTFROM elements from OFX Open Financial Exchange uses the Banking Account aggregate to identify an account at an FI. The aggregate contains enough information to uniquely identify an account for the purposes of statement. """ # Routing and transit number bank_id: str # Bank identifier for international banks branch_id: Optional[str] = None # Account number acct_id: str # Type of account, must be one of ACCOUNT_TYPE acct_type: str # Checksum for international banks acct_key: Optional[str] = None def __init__(self, bank_id: str, acct_id: str, acct_type: str = "CHECKING") -> None: self.bank_id = bank_id self.acct_id = acct_id self.acct_type = acct_type self.branch_id = None self.acct_key = None def assert_valid(self) -> None: assert self.acct_type in ACCOUNT_TYPE, ( "acct_type must be one of %s" % ACCOUNT_TYPE ) def generate_transaction_id(stmt_line: StatementLine) -> str: """Generate pseudo-unique id for given statement line. This function can be used in statement parsers when real transaction id is not available in source statement. """ h = sha1() assert stmt_line.date is not None h.update(stmt_line.date.strftime("%Y-%m-%d %H:%M:%S").encode("utf8")) if stmt_line.memo is not None: h.update(stmt_line.memo.encode("utf8")) if stmt_line.amount is not None: h.update(str(stmt_line.amount).encode("utf8")) return h.hexdigest() def generate_unique_transaction_id(stmt_line: StatementLine, unique_id_set: set) -> str: """ Generate a unique transaction id. A bit of background: the problem with these transaction id's is that they do do not only have to be unique, they also have to stay the same for the same transaction every time you generate the statement. So generating random ids will not work, even though they will be unique, GnuCash or beancount will recognize these transaction as "new" if you happen to generate and import the same statement twice or import two statements with overlapping periods. The function generate_transaction_id() is deterministic, but does not necesserily generate an unique id. Therefore this function improves on it since you can create a really unique id by adding an increment to the generated id (a string) and keep on incrementing till it succeeds. These are the steps: 1) supply a unique id set you want to use for checking uniqueness 2) next you generate an initial id by calling generate_transaction_id() 3) assign the initial id to the current id (id) 4) increment a counter while the current id is a member of the set and add the counter to the initial id and assign that to the current id 5) add the current id to the unique id set 6) return a list of the current id and the counter (if not 0) The counter is returned in order to enable the caller to modify its statement line, for example the memo field. """ # Save the initial id id = initial_id = generate_transaction_id(stmt_line) counter = 0 while id in unique_id_set: counter += 1 id = initial_id + str(counter) unique_id_set.add(id) return id + ("" if counter == 0 else "-" + str(counter)) def recalculate_balance(stmt: Statement) -> None: """Recalculate statement starting and ending dates and balances. When starting balance is not available, it will be assumed to be 0. This function can be used in statement parsers when balance information is not available in source statement. """ total_amount = sum([sl.amount for sl in stmt.lines if sl.amount is not None], D(0)) stmt.start_balance = stmt.start_balance or D(0) stmt.end_balance = stmt.start_balance + total_amount stmt.start_date = min(sl.date for sl in stmt.lines if sl.date is not None) stmt.end_date = max(sl.date for sl in stmt.lines if sl.date is not None) ofxstatement-0.9.2/src/ofxstatement/tests/000077500000000000000000000000001472116570700207275ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/tests/__init__.py000066400000000000000000000000001472116570700230260ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/tests/samples/000077500000000000000000000000001472116570700223735ustar00rootroot00000000000000ofxstatement-0.9.2/src/ofxstatement/tests/samples/config.ini000066400000000000000000000000351472116570700243370ustar00rootroot00000000000000[swedbank] plugin = swedbank ofxstatement-0.9.2/src/ofxstatement/tests/test_configuration.py000066400000000000000000000021011472116570700252010ustar00rootroot00000000000000import os import unittest from ofxstatement import configuration from ofxstatement.exceptions import Abort class ConfigurationTest(unittest.TestCase): def test_configuration(self) -> None: here = os.path.dirname(__file__) cfname = os.path.join(here, "samples", "config.ini") config = configuration.read(cfname) assert config is not None self.assertEqual(config["swedbank"]["plugin"], "swedbank") def test_default_configuration(self) -> None: default_config = configuration.read(configuration.get_default_location()) config = configuration.read() self.assertEqual(config, default_config) def test_missing_configuration(self) -> None: config = configuration.read("missing.ini") self.assertIsNone(config) def test_missing_section(self) -> None: here = os.path.dirname(__file__) cfname = os.path.join(here, "samples", "config.ini") config = configuration.read(cfname) with self.assertRaises(Abort): configuration.get_settings(config, "kawabanga") ofxstatement-0.9.2/src/ofxstatement/tests/test_ofx.py000066400000000000000000000112561472116570700231410ustar00rootroot00000000000000from unittest import TestCase import xml.dom.minidom from decimal import Decimal from datetime import datetime from ofxstatement.statement import Statement, StatementLine, BankAccount, Currency from ofxstatement import ofx SIMPLE_OFX = """ 0 INFO 20120303000000 ENG 0 0 INFO LTL BID ACCID CHECKING CHECK 20120212 15.40 1 Sample 1 CHECK 20120212 25.00 2 SNORAS VNO LT1232 CHECKING Sample 2 USD EUR 3.45 """ def prettyPrint(xmlstr): dom = xml.dom.minidom.parseString(xmlstr) return dom.toprettyxml().replace("\t", " ").replace("", "", "", " ", " ", " ", " 0", " INFO", " ", " 20210903000000", " ENG", " ", " ", "", "", ] assert xml.split("\n") == expected ofxstatement-0.9.2/src/ofxstatement/tests/test_ofx_invest.py000066400000000000000000000203351472116570700245270ustar00rootroot00000000000000from unittest import TestCase import xml.dom.minidom from decimal import Decimal from datetime import datetime from ofxstatement.statement import Statement, InvestStatementLine from ofxstatement import ofx SIMPLE_OFX = """ 0 INFO 20210501000000 ENG AAPL TICKER AAPL AAPL MSFT TICKER MSFT MSFT 0 0 INFO 20210501000000 LTL BROKERID ACCID 20210501 BUY 3 20210101 Sample 3 AAPL TICKER OTHER OTHER 1.24000 138.28000 3.00000 -416.08 SELL 4 20210101 Sample 4 MSFT TICKER OTHER OTHER 0.28000 225.63000 -5.00000 1127.87 DIV 5 20210101 Sample 5 MSFT TICKER OTHER OTHER 0.50000 0.79 INT 20210102 0.45 6 Bank Interest OTHER 7 20210103 Journaled Shares MSFT TICKER OTHER OTHER 225.63000 4.00000 """ def prettyPrint(xmlstr): dom = xml.dom.minidom.parseString(xmlstr) return dom.toprettyxml().replace("\t", " ").replace("