From e9f45f8cdb7391b1d61b33b83c29d703bf2281e3 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:05:33 +0200 Subject: [PATCH] Silence new MyPy errors --- src/validate_pyproject/_tomllib.py | 6 ++++-- src/validate_pyproject/formats.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/validate_pyproject/_tomllib.py b/src/validate_pyproject/_tomllib.py index 25109f9..6b6fb0a 100644 --- a/src/validate_pyproject/_tomllib.py +++ b/src/validate_pyproject/_tomllib.py @@ -7,8 +7,10 @@ from tomli import TOMLDecodeError, loads except ImportError: # pragma: no cover try: - from toml import TomlDecodeError as TOMLDecodeError # type: ignore - from toml import loads # type: ignore + from toml import ( # type: ignore[no-redef,import-untyped] + TomlDecodeError as TOMLDecodeError, + ) + from toml import loads # type: ignore[no-redef] except ImportError as ex: raise ImportError("Please install `tomli` (TOML parser)") from ex diff --git a/src/validate_pyproject/formats.py b/src/validate_pyproject/formats.py index 9f97e39..153b1f0 100644 --- a/src/validate_pyproject/formats.py +++ b/src/validate_pyproject/formats.py @@ -83,7 +83,9 @@ def pep508_identifier(name: str) -> bool: from packaging import requirements as _req except ImportError: # pragma: no cover # let's try setuptools vendored version - from setuptools._vendor.packaging import requirements as _req # type: ignore + from setuptools._vendor.packaging import ( # type: ignore[no-redef] + requirements as _req, + ) def pep508(value: str) -> bool: """See :ref:`PyPA's dependency specifiers `