From 17fadcfe521e5cf6875008d9a103c5b7579f6b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Thu, 9 Jun 2022 17:32:00 +0200 Subject: [PATCH] Ignore only specific mypy errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nikola Forró --- .pre-commit-config.yaml | 3 ++- specfile/__init__.py | 4 ++-- specfile/sources.py | 15 +++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322701ba..1c6b790e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,7 +47,8 @@ repos: rev: v0.960 hooks: - id: mypy - args: [--no-strict-optional, --ignore-missing-imports] + args: + [--show-error-codes, --no-strict-optional, --ignore-missing-imports] additional_dependencies: [types-pkg_resources, types-requests, types-python-dateutil] - repo: https://github.com/packit/pre-commit-hooks diff --git a/specfile/__init__.py b/specfile/__init__.py index 4e1ac716..e49b4c0d 100644 --- a/specfile/__init__.py +++ b/specfile/__init__.py @@ -10,8 +10,8 @@ try: from importlib.metadata import PackageNotFoundError, distribution except ImportError: - from importlib_metadata import PackageNotFoundError # type: ignore - from importlib_metadata import distribution # type: ignore + from importlib_metadata import PackageNotFoundError # type: ignore[no-redef] + from importlib_metadata import distribution # type: ignore[no-redef] try: __version__ = distribution(__name__).version diff --git a/specfile/sources.py b/specfile/sources.py index 217e8d57..ca1d13f8 100644 --- a/specfile/sources.py +++ b/specfile/sources.py @@ -17,30 +17,29 @@ class Source(ABC): """Class that represents a source.""" - @property # type: ignore + @property @abstractmethod def number(self) -> int: """Source number.""" ... - @property # type: ignore + @property @abstractmethod def location(self) -> str: """Literal location of the source as stored in the spec file.""" ... - @location.setter # type: ignore - @abstractmethod + @location.setter def location(self, value: str) -> None: ... - @property # type: ignore + @property @abstractmethod def expanded_location(self) -> str: """Location of the source after expanding macros.""" ... - @property # type: ignore + @property @abstractmethod def filename(self) -> str: """Literal filename of the source.""" @@ -52,13 +51,13 @@ def remote(self) -> bool: url = urllib.parse.urlsplit(self.expanded_location) return all((url.scheme, url.netloc)) - @property # type: ignore + @property @abstractmethod def expanded_filename(self) -> str: """Filename of the source after expanding macros.""" ... - @property # type: ignore + @property @abstractmethod def comments(self) -> Comments: """List of comments associated with the source."""