From 25af1d72f39202483957e1859486e6fd730eaa9e Mon Sep 17 00:00:00 2001 From: Quique Porta Date: Thu, 7 May 2026 10:33:25 +0200 Subject: [PATCH] Fix type annotations and bump mypy python_version for mypy 2.0 mypy 2.0 dropped support for python_version 3.9 in [mypy] config and flagged two empty-dict definitions as missing annotations, which broke the tox -e mypy CI job for any new commit. * Bump python_version in setup.cfg from 3.9 to 3.10. * Annotate _soap_clients in stdnum/util.py. * Annotate _country_modules in stdnum/eu/vat.py, which also resolves the no-any-return warning in _get_cc_module. --- setup.cfg | 2 +- stdnum/eu/vat.py | 2 +- stdnum/util.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2bff8c77..dcf85b3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -52,6 +52,6 @@ known_third_party = xlrd [mypy] -python_version = 3.9 +python_version = 3.10 strict = True warn_unreachable = True diff --git a/stdnum/eu/vat.py b/stdnum/eu/vat.py index 6c2e5a26..3083fb6d 100644 --- a/stdnum/eu/vat.py +++ b/stdnum/eu/vat.py @@ -56,7 +56,7 @@ country code of gr while for VAT purposes el is used instead. For Northern Ireland numbers are prefixed with xi of United Kingdom numbers.""" -_country_modules = dict() +_country_modules: dict[str, NumberValidationModule | None] = {} vies_wsdl = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl' """The WSDL URL of the VAT Information Exchange System (VIES).""" diff --git a/stdnum/util.py b/stdnum/util.py index bd5d1056..aaaee91c 100644 --- a/stdnum/util.py +++ b/stdnum/util.py @@ -256,7 +256,7 @@ def get_cc_module(cc: str, name: str) -> NumberValidationModule | None: # this is a cache of SOAP clients -_soap_clients = {} +_soap_clients: dict[tuple[str, float, bool | str], Any] = {} def _get_zeep_soap_client(