From 01a98d1c1d40dfa5a040bd5234b90ab17caaca02 Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 12:44:47 -0300 Subject: [PATCH 1/6] [REF] l10n_br_fiscal: IOError is an alias for OSError, necessary for the new version of pre-commit. --- l10n_br_fiscal/models/document_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_fiscal/models/document_event.py b/l10n_br_fiscal/models/document_event.py index d613ce041e9f..363b5f977b6f 100644 --- a/l10n_br_fiscal/models/document_event.py +++ b/l10n_br_fiscal/models/document_event.py @@ -235,7 +235,7 @@ def _save_event_2disk(self, arquivo, file_name): if not os.path.exists(save_dir): os.makedirs(save_dir) f = open(file_path, "w") - except IOError as e: + except OSError as e: raise UserError( _("Erro!"), _( From 9bf4f96bf2de38d63c58cb9b05f5115a4367db2b Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 12:48:28 -0300 Subject: [PATCH 2/6] [REF] l10n_br_fiscal: Import not being use, necessary for the new version of pre-commit. --- l10n_br_fiscal/models/subsequent_document.py | 1 - l10n_br_fiscal/models/subsequent_operation.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/l10n_br_fiscal/models/subsequent_document.py b/l10n_br_fiscal/models/subsequent_document.py index 58b7c6dd3515..9b93b03d351a 100644 --- a/l10n_br_fiscal/models/subsequent_document.py +++ b/l10n_br_fiscal/models/subsequent_document.py @@ -3,7 +3,6 @@ # License AGPL-3 or later (http://www.gnu.org/licenses/agpl) # -from __future__ import division, print_function, unicode_literals from odoo import api, fields, models diff --git a/l10n_br_fiscal/models/subsequent_operation.py b/l10n_br_fiscal/models/subsequent_operation.py index c4864d6a1f6d..4e3835f9232e 100644 --- a/l10n_br_fiscal/models/subsequent_operation.py +++ b/l10n_br_fiscal/models/subsequent_operation.py @@ -2,8 +2,6 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from __future__ import division, print_function, unicode_literals - from odoo import fields, models from ..constants.fiscal import SITUACAO_EDOC From ac6d232f59b78c7c7552cbdfc3ba2626b5f4a9ec Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 12:53:45 -0300 Subject: [PATCH 3/6] [REF] l10n_br_fiscal: W8150 odoo-addons-relative-import Same Odoo module absolute import, should use relative import with . , necessary for the new version of pre-commit. --- l10n_br_fiscal/wizards/document_import_wizard_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_fiscal/wizards/document_import_wizard_mixin.py b/l10n_br_fiscal/wizards/document_import_wizard_mixin.py index 42427006d95d..f8c9009ae896 100644 --- a/l10n_br_fiscal/wizards/document_import_wizard_mixin.py +++ b/l10n_br_fiscal/wizards/document_import_wizard_mixin.py @@ -3,7 +3,7 @@ from odoo import fields, models -from odoo.addons.l10n_br_fiscal.constants.fiscal import FISCAL_IN_OUT_ALL +from ..constants.fiscal import FISCAL_IN_OUT_ALL class DocumentImportWizardMixin(models.TransientModel): From 0c21c7f002d0cb14f91b4119f877ec071e438e86 Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 13:00:50 -0300 Subject: [PATCH 4/6] [REF] l10n_br_fiscal_dfe: Unnecessary parameter, necessary for the new version of pre-commit. --- l10n_br_fiscal_dfe/tests/test_dfe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_fiscal_dfe/tests/test_dfe.py b/l10n_br_fiscal_dfe/tests/test_dfe.py index 6c5e27351455..659886b38b10 100644 --- a/l10n_br_fiscal_dfe/tests/test_dfe.py +++ b/l10n_br_fiscal_dfe/tests/test_dfe.py @@ -20,7 +20,7 @@ response_rejeicao = """21.4.0589Rejeicao: Numero do NSU informado superior ao maior NSU da base de dados doAmbiente Nacional2022-04-04T11:54:49-03:00000000000000000000000000000000""" -class FakeRetorno(object): +class FakeRetorno: def __init__(self, text, status_code=200): self.text = text self.content = text.encode("utf-8") From e32472bb35201f7cd1de54e04ed08c4bc5e4780f Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 13:04:11 -0300 Subject: [PATCH 5/6] [REF] l10n_br_ie_search: Unnecessary parameter, necessary for the new version of pre-commit. --- l10n_br_ie_search/tests/test_sefaz.py | 2 +- l10n_br_ie_search/tests/test_sintegra.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_ie_search/tests/test_sefaz.py b/l10n_br_ie_search/tests/test_sefaz.py index ad1467ab68cd..7fa8f7dde941 100644 --- a/l10n_br_ie_search/tests/test_sefaz.py +++ b/l10n_br_ie_search/tests/test_sefaz.py @@ -12,7 +12,7 @@ from odoo.tools.misc import format_date -class FakeRetorno(object): +class FakeRetorno: __slots__ = "text", "ok" diff --git a/l10n_br_ie_search/tests/test_sintegra.py b/l10n_br_ie_search/tests/test_sintegra.py index 1d19c5f6f003..8fa5d867b477 100644 --- a/l10n_br_ie_search/tests/test_sintegra.py +++ b/l10n_br_ie_search/tests/test_sintegra.py @@ -10,7 +10,7 @@ _logger = logging.getLogger(__name__) -class FakeRetorno(object): +class FakeRetorno: __slots__ = "text", "status_code" def json(self): From 784cda61d714bd00f0c4303e5482ca6ff787820c Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Thu, 26 Oct 2023 13:09:27 -0300 Subject: [PATCH 6/6] [REF] l10n_br_nfe: Unnecessary parameter, necessary for the new version of pre-commit. --- l10n_br_nfe/tests/test_nfce.py | 2 +- l10n_br_nfe/tests/test_nfe_mde.py | 2 +- l10n_br_nfe/tests/test_nfe_webservices.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/l10n_br_nfe/tests/test_nfce.py b/l10n_br_nfe/tests/test_nfce.py index f906ce753784..09107069f056 100644 --- a/l10n_br_nfe/tests/test_nfce.py +++ b/l10n_br_nfe/tests/test_nfce.py @@ -38,7 +38,7 @@ response_contingency = """24.0.0108Rejeição: Duplicidade de NF-e332023-08-08T10:30:00-03:001234567890123451""" -class FakeRetorno(object): +class FakeRetorno: def __init__(self, text): self.text = text self.content = text.encode("utf-8") diff --git a/l10n_br_nfe/tests/test_nfe_mde.py b/l10n_br_nfe/tests/test_nfe_mde.py index 822873c651a5..245a7e7c63e5 100644 --- a/l10n_br_nfe/tests/test_nfe_mde.py +++ b/l10n_br_nfe/tests/test_nfe_mde.py @@ -27,7 +27,7 @@ response_operacao_nao_realizada = """2SVRS2023052515551352SVRS202305251555135Teste Operação não Realizada.31201010588201000105550010038421171838422178210240Operacao nao Realizada registrada1815830540001292023-07-10T10:00:00-03:00""" -class FakeRetorno(object): +class FakeRetorno: def __init__(self, text, status_code=200): self.text = text self.content = text.encode("utf-8") diff --git a/l10n_br_nfe/tests/test_nfe_webservices.py b/l10n_br_nfe/tests/test_nfe_webservices.py index 975f333eaa76..0c4cff6675d9 100644 --- a/l10n_br_nfe/tests/test_nfe_webservices.py +++ b/l10n_br_nfe/tests/test_nfe_webservices.py @@ -53,7 +53,7 @@ def is_libreoffice_command_available(): return False -class FakeRetorno(object): +class FakeRetorno: def __init__(self, text): self.text = text self.content = text.encode("utf-8")