Skip to content

Commit 3aa1174

Browse files
committed
fix: mypy strict cleanup after core v1.5.2/v1.5.3
- Add pydantic.mypy plugin to resolve false call-arg errors on Pydantic models - Use BaseDocumentGenerator[InvoiceDocument] generic (core v1.5.3) - Remove 3 stale type: ignore[misc] comments on BRInvoiceLine, BRInvoice, NFSeDocument
1 parent 90537ad commit 3aa1174

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ python_version = "3.11"
8484
strict = true
8585
warn_return_any = true
8686
warn_unused_configs = true
87+
plugins = ["pydantic.mypy"]
8788

8889
[[tool.mypy.overrides]]
8990
module = ["mcp_einvoicing_core", "mcp_einvoicing_core.*"]

src/mcp_nfe_br/models/invoice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class BRGrupoIBSCBSTot(BaseModel):
357357
cbs: BRGrupoCBSTot | None = Field(default=None, description="Grupo total da CBS (W50)")
358358

359359

360-
class BRInvoiceLine(InvoiceLineItem): # type: ignore[misc]
360+
class BRInvoiceLine(InvoiceLineItem):
361361
"""NF-e/NFC-e invoice line (Grupo I — Produtos e Serviços).
362362
363363
Brazil has no single VAT; ``vat_rate``/``vat_exemption_code`` from
@@ -508,7 +508,7 @@ class BRInvoiceLine(InvoiceLineItem): # type: ignore[misc]
508508
)
509509

510510

511-
class BRInvoice(InvoiceDocument): # type: ignore[misc]
511+
class BRInvoice(InvoiceDocument):
512512
"""NF-e / NFC-e document (Grupo B — Identificação da Nota Fiscal eletrônica).
513513
514514
Extends ``InvoiceDocument`` with the fields required by the NF-e/NFC-e

src/mcp_nfe_br/models/nfse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ class NFSeValores(BaseModel):
405405
)
406406

407407

408-
class NFSeDocument(InvoiceDocument): # type: ignore[misc]
408+
class NFSeDocument(InvoiceDocument):
409409
"""NFS-e Nacional DPS document model.
410410
411411
Extends ``InvoiceDocument`` for the Declaração de Prestação de Serviços (DPS)

src/mcp_nfe_br/standards/nfe_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ def _ide_block(invoice: BRInvoice, *, cnf: str, cdv: str) -> str:
718718
return xml_element("ide", "".join(parts), unsafe=True)
719719

720720

721-
class NFeGenerator(BaseDocumentGenerator):
721+
class NFeGenerator(BaseDocumentGenerator[InvoiceDocument]):
722722
"""Generates unsigned NF-e/NFC-e (modelo 55/65, schema 4.00) XML."""
723723

724724
def get_format_name(self) -> str:

src/mcp_nfe_br/standards/nfse_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def _build_valores(v: NFSeValores) -> str:
216216
return _wrap("valores", v_serv_prest + trib)
217217

218218

219-
class NFSeGenerator(BaseDocumentGenerator):
219+
class NFSeGenerator(BaseDocumentGenerator[InvoiceDocument]):
220220
"""Generates unsigned DPS XML for NFS-e Nacional (ADN), schema v1.01.
221221
222222
Returns the XML string. The caller must sign with ``br__sign_nfse``

0 commit comments

Comments
 (0)