From 08482045d8dfbd1aaf6b3e090efd209ded1a3788 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Fri, 26 Jan 2024 19:13:24 +0100 Subject: [PATCH] [IMP] account_ebics: pre-commit auto fixes --- account_ebics/__manifest__.py | 2 +- account_ebics/migrations/13.0.1.1/post-migration.py | 1 - account_ebics/migrations/13.0.1.3/post-migration.py | 4 +--- account_ebics/migrations/13.0.1.3/pre-migration.py | 12 +++--------- account_ebics/models/ebics_file.py | 4 ++-- account_ebics/models/ebics_userid.py | 8 ++++---- account_ebics/pyproject.toml | 3 +++ account_ebics/wizards/ebics_xfer.py | 10 +++++----- 8 files changed, 19 insertions(+), 25 deletions(-) create mode 100644 account_ebics/pyproject.toml diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index eba4c4c..1187e4e 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -6,7 +6,7 @@ "version": "16.0.1.9.0", "license": "LGPL-3", "author": "Noviat", - "website": "https://www.noviat.com/", + "website": "https://www.noviat.com", "category": "Accounting & Finance", "depends": ["account"], "data": [ diff --git a/account_ebics/migrations/13.0.1.1/post-migration.py b/account_ebics/migrations/13.0.1.1/post-migration.py index c1ef5d4..ad8f969 100644 --- a/account_ebics/migrations/13.0.1.1/post-migration.py +++ b/account_ebics/migrations/13.0.1.1/post-migration.py @@ -8,7 +8,6 @@ from openupgradelib import openupgrade # pylint: disable=W7936 @openupgrade.migrate() def migrate(env, version): - _ebics_config_upgrade(env, version) _noupdate_changes(env, version) diff --git a/account_ebics/migrations/13.0.1.3/post-migration.py b/account_ebics/migrations/13.0.1.3/post-migration.py index 6c0dd75..97f0878 100644 --- a/account_ebics/migrations/13.0.1.3/post-migration.py +++ b/account_ebics/migrations/13.0.1.3/post-migration.py @@ -27,9 +27,7 @@ def _update_file_format(cr, ff): """ SELECT res_id FROM ir_model_data WHERE module='account_ebics' AND name='{}' - """.format( - ff["xml_id_name"] - ) + """.format(ff["xml_id_name"]) ) res = cr.fetchone() if res: diff --git a/account_ebics/migrations/13.0.1.3/pre-migration.py b/account_ebics/migrations/13.0.1.3/pre-migration.py index 04212cd..89fcc86 100644 --- a/account_ebics/migrations/13.0.1.3/pre-migration.py +++ b/account_ebics/migrations/13.0.1.3/pre-migration.py @@ -57,9 +57,7 @@ def _update_file_format(cr, ff): """ SELECT id, res_id FROM ir_model_data WHERE module='account_ebics' AND name='{}' - """.format( - ff["old_xml_id_name"] - ) + """.format(ff["old_xml_id_name"]) ) res = cr.fetchone() if res: @@ -67,15 +65,11 @@ def _update_file_format(cr, ff): UPDATE ir_model_data SET name='{new_xml_id_name}' WHERE id={xml_id}; - """.format( - new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0] - ) + """.format(new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0]) if ff.get("new_name"): query += """ UPDATE ebics_file_format SET name='{new_name}' WHERE id={ff_id}; - """.format( - new_name=ff["new_name"], ff_id=res[1] - ) + """.format(new_name=ff["new_name"], ff_id=res[1]) cr.execute(query) # pylint: disable=E8103 diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 1861866..fc78cb2 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -549,7 +549,7 @@ class EbicsFile(models.Model): "054": "Ntfctn", } camt_tag = variant_tags[camt_variant] - stmts = root[0].findall("ns:{}".format(camt_tag), ns) + stmts = root[0].findall(f"ns:{camt_tag}", ns) for i, stmt in enumerate(stmts): acc_number = sanitize_account_number( stmt.xpath( @@ -572,7 +572,7 @@ class EbicsFile(models.Model): root_new = deepcopy(root) entries = False - for j, el in enumerate(root_new[0].findall("ns:{}".format(camt_tag), ns)): + for j, el in enumerate(root_new[0].findall(f"ns:{camt_tag}", ns)): if j != i: el.getparent().remove(el) else: diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index beca448..17d5b77 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -437,7 +437,7 @@ class EbicsUserID(models.Model): err_msg = _("EBICS version mismatch.") + "\n" err_msg += _("Versions supported by your bank:") for k in supported_versions: - err_msg += "\n{}: {} ".format(k, supported_versions[k]) + err_msg += f"\n{k}: {supported_versions[k]} " raise UserError(err_msg) if ebics_version == "H003": bank._order_number = self.ebics_config_id._get_order_number() @@ -464,13 +464,13 @@ class EbicsUserID(models.Model): e = exc_info() error = _("EBICS Functional Error:") error += "\n" - error += "{} (code: {})".format(e[1].message, e[1].code) + error += f"{e[1].message} (code: {e[1].code})" raise UserError(error) from err except EbicsTechnicalError as err: e = exc_info() error = _("EBICS Technical Error:") error += "\n" - error += "{} (code: {})".format(e[1].message, e[1].code) + error += f"{e[1].message} (code: {e[1].code})" raise UserError(error) from err # Send the public authentication and encryption keys to the bank. @@ -549,7 +549,7 @@ class EbicsUserID(models.Model): e = exc_info() error = _("EBICS Functional Error:") error += "\n" - error += "{} (code: {})".format(e[1].message, e[1].code) + error += f"{e[1].message} (code: {e[1].code})" raise UserError(error) from err except Exception as err: exctype, value = exc_info()[:2] diff --git a/account_ebics/pyproject.toml b/account_ebics/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/account_ebics/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 921d8da..44746ac 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -259,7 +259,7 @@ class EbicsXfer(models.TransientModel): order_type=df.order_type, ) self.note += "\n" - self.note += "{} (code: {})".format(e[1].message, e[1].code) + self.note += f"{e[1].message} (code: {e[1].code})" except EbicsTechnicalError: err_cnt += 1 e = exc_info() @@ -271,7 +271,7 @@ class EbicsXfer(models.TransientModel): order_type=df.order_type, ) self.note += "\n" - self.note += "{} (code: {})".format(e[1].message, e[1].code) + self.note += f"{e[1].message} (code: {e[1].code})" except EbicsVerificationError: err_cnt += 1 self.note += "\n" @@ -341,7 +341,7 @@ class EbicsXfer(models.TransientModel): self.ensure_one() module = __name__.split("addons.")[1].split(".")[0] act = self.env["ir.actions.act_window"]._for_xml_id( - "{}.ebics_file_action_download".format(module) + f"{module}.ebics_file_action_download" ) act["domain"] = [("id", "in", self._context["ebics_file_ids"])] return act @@ -416,13 +416,13 @@ class EbicsXfer(models.TransientModel): self.note += "\n" self.note += _("EBICS Functional Error:") self.note += "\n" - self.note += "{} (code: {})".format(e[1].message, e[1].code) + self.note += f"{e[1].message} (code: {e[1].code})" except EbicsTechnicalError: e = exc_info() self.note += "\n" self.note += _("EBICS Technical Error:") self.note += "\n" - self.note += "{} (code: {})".format(e[1].message, e[1].code) + self.note += f"{e[1].message} (code: {e[1].code})" except EbicsVerificationError: self.note += "\n" self.note += _("EBICS Verification Error:")