From 6c07799e200cdce3cf6619c06b63af3ed30267c2 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 18 Nov 2021 19:06:40 +0100 Subject: [PATCH] Run pre-commit --- .gitignore | 2 +- README.md | 2 +- ofx_processor/main.py | 2 +- ofx_processor/processors/ce.py | 2 +- ofx_processor/processors/revolut.py | 2 +- pyproject.toml | 6 ++++++ tests/samples/bpvf_expected.json | 2 +- tests/samples/bpvf_transactions.json | 2 +- tests/samples/ce.ofx | 2 +- tests/samples/ce_expected.json | 2 +- tests/samples/ce_transactions.json | 2 +- tests/samples/lcl_expected.json | 2 +- tests/samples/lcl_transactions.json | 2 +- tests/samples/revolut_transactions.json | 4 ++-- tests/test_end_to_end.py | 9 ++++++--- tests/test_revolut_processor.py | 2 +- 16 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index d8d7a7e..5fd1ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -225,4 +225,4 @@ dmypy.json # End of https://www.gitignore.io/api/osx,pycharm,python -.idea \ No newline at end of file +.idea diff --git a/README.md b/README.md index 345b240..6cc9602 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,4 @@ The file passed in parameter will be deleted unless specified (`--keep` option o ## Versions -This project follows [Semantic Versioning](https://semver.org/). \ No newline at end of file +This project follows [Semantic Versioning](https://semver.org/). diff --git a/ofx_processor/main.py b/ofx_processor/main.py index e109bbc..ebf620f 100644 --- a/ofx_processor/main.py +++ b/ofx_processor/main.py @@ -1,7 +1,7 @@ import click from ofx_processor.utils import ynab -from ofx_processor.utils.utils import discover_processors, OrderedGroup +from ofx_processor.utils.utils import OrderedGroup, discover_processors CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) diff --git a/ofx_processor/processors/ce.py b/ofx_processor/processors/ce.py index 23b6f61..469334c 100644 --- a/ofx_processor/processors/ce.py +++ b/ofx_processor/processors/ce.py @@ -1,6 +1,6 @@ import re -from ofx_processor.utils.base_ofx import OfxBaseProcessor, OfxBaseLine +from ofx_processor.utils.base_ofx import OfxBaseLine, OfxBaseProcessor class CeLine(OfxBaseLine): diff --git a/ofx_processor/processors/revolut.py b/ofx_processor/processors/revolut.py index 6cb2de7..503ecb0 100644 --- a/ofx_processor/processors/revolut.py +++ b/ofx_processor/processors/revolut.py @@ -5,7 +5,7 @@ import sys import click import dateparser -from ofx_processor.utils.base_processor import BaseProcessor, BaseLine +from ofx_processor.utils.base_processor import BaseLine, BaseProcessor def _amount_str_to_float(amount: str): diff --git a/pyproject.toml b/pyproject.toml index ab41716..b2bb5e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,12 @@ pre-commit = "^2.15.0" [tool.poetry.scripts] ynab = 'ofx_processor.main:cli' +[tool.black] +target-version = ['py38'] + +[tool.isort] +profile = "black" + [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" diff --git a/tests/samples/bpvf_expected.json b/tests/samples/bpvf_expected.json index 01eb781..b3f8727 100644 --- a/tests/samples/bpvf_expected.json +++ b/tests/samples/bpvf_expected.json @@ -118,4 +118,4 @@ "memo": "VIREMENT DE PERSON 6", "import_id": "YNAB:8600:2020-02-17:1" } -] \ No newline at end of file +] diff --git a/tests/samples/bpvf_transactions.json b/tests/samples/bpvf_transactions.json index 0c53caf..c1b7125 100644 --- a/tests/samples/bpvf_transactions.json +++ b/tests/samples/bpvf_transactions.json @@ -154,4 +154,4 @@ "cleared": "cleared" } ] -} \ No newline at end of file +} diff --git a/tests/samples/ce.ofx b/tests/samples/ce.ofx index d5d41c4..4ef03a7 100644 --- a/tests/samples/ce.ofx +++ b/tests/samples/ce.ofx @@ -94,4 +94,4 @@ NEWFILEUID:NONE - \ No newline at end of file + diff --git a/tests/samples/ce_expected.json b/tests/samples/ce_expected.json index 28751ab..1bc6c8a 100644 --- a/tests/samples/ce_expected.json +++ b/tests/samples/ce_expected.json @@ -41,4 +41,4 @@ "memo": "_", "import_id": "YNAB:14490:2020-02-24:1" } -] \ No newline at end of file +] diff --git a/tests/samples/ce_transactions.json b/tests/samples/ce_transactions.json index ea1d2de..71e8153 100644 --- a/tests/samples/ce_transactions.json +++ b/tests/samples/ce_transactions.json @@ -55,4 +55,4 @@ "cleared": "cleared" } ] -} \ No newline at end of file +} diff --git a/tests/samples/lcl_expected.json b/tests/samples/lcl_expected.json index 54c68f6..1877c7e 100644 --- a/tests/samples/lcl_expected.json +++ b/tests/samples/lcl_expected.json @@ -20,4 +20,4 @@ "memo": "CHQ 1234567", "import_id": "YNAB:-42000:2020-07-21:1" } -] \ No newline at end of file +] diff --git a/tests/samples/lcl_transactions.json b/tests/samples/lcl_transactions.json index 526a2fe..aed44dc 100644 --- a/tests/samples/lcl_transactions.json +++ b/tests/samples/lcl_transactions.json @@ -28,4 +28,4 @@ "cleared": "cleared" } ] -} \ No newline at end of file +} diff --git a/tests/samples/revolut_transactions.json b/tests/samples/revolut_transactions.json index 6c80dbb..064e675 100644 --- a/tests/samples/revolut_transactions.json +++ b/tests/samples/revolut_transactions.json @@ -76,7 +76,7 @@ "date": "2020-01-05", "amount": -123680, "payee_name": "Company 1", - "memo": "Shopping - FX-rate €1 = US$1,1158", + "memo": "Shopping - FX-rate \u20ac1\u2008=\u2008US$1,1158", "import_id": "YNAB:-123680:2020-01-05:1", "account_id": "", "cleared": "cleared" @@ -91,4 +91,4 @@ "cleared": "cleared" } ] -} \ No newline at end of file +} diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index c61dfef..9741f96 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -7,8 +7,7 @@ from unittest.mock import call from click.testing import CliRunner -from ofx_processor.utils import utils -from ofx_processor.utils import ynab +from ofx_processor.utils import utils, ynab from ofx_processor.utils.ynab import config @@ -77,7 +76,11 @@ class ConfigTestCase(unittest.TestCase): self.cli, ["revolut", "tests/samples/revolut.csv", "--keep"] ) expected_filename = ynab.get_config_file_name() - self.assertIn("Error while parsing config file", result.output, f"config_file: {name}") + self.assertIn( + "Error while parsing config file", + result.output, + f"config_file: {name}", + ) edit.assert_called_with(filename=expected_filename) @mock.patch("ofx_processor.utils.ynab.DEFAULT_CONFIG_FILENAME", "file.ini") diff --git a/tests/test_revolut_processor.py b/tests/test_revolut_processor.py index 5760a7e..1feefc3 100644 --- a/tests/test_revolut_processor.py +++ b/tests/test_revolut_processor.py @@ -3,9 +3,9 @@ import json import unittest from ofx_processor.processors.revolut import ( - _amount_str_to_float, RevolutLine, RevolutProcessor, + _amount_str_to_float, )