From 5b9d787da6bd5eb8a3bdb3e9f955409cfc0c1a48 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 30 Dec 2024 18:44:53 -0500 Subject: [PATCH] Remove Unused "type: ignore" comments --- setuptools/__init__.py | 2 +- setuptools/command/install.py | 3 +-- setuptools/command/sdist.py | 6 ++---- setuptools/tests/test_build_ext.py | 2 ++ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index dd4c1ee3f1..7f0e00c9f7 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -221,7 +221,7 @@ def reinitialize_command( ) -> _Command: cmd = _Command.reinitialize_command(self, command, reinit_subcommands) vars(cmd).update(kw) - return cmd # pyright: ignore[reportReturnType] # pypa/distutils#307 + return cmd @abstractmethod def initialize_options(self) -> None: diff --git a/setuptools/command/install.py b/setuptools/command/install.py index 25e898ac2b..741b140c70 100644 --- a/setuptools/command/install.py +++ b/setuptools/command/install.py @@ -180,5 +180,4 @@ def do_egg_install(self) -> None: # XXX Python 3.1 doesn't see _nc if this is inside the class install.sub_commands = [ cmd for cmd in orig.install.sub_commands if cmd[0] not in install._nc -] + install.new_commands # type: ignore[operator] -# TODO: Type sub_commands/new_commands to avoid variance issues in pypa/distutils (like python/typeshed#11951) +] + install.new_commands diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 9e9025f1d1..64e866c96b 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -50,12 +50,10 @@ class sdist(orig.sdist): ] distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution - # TODO: Mark class-level mutables as ClassVars in pypa/distutils (like python/typeshed#12403) - negative_opt: ClassVar[dict[str, str]] = {} # type: ignore[misc] + negative_opt: ClassVar[dict[str, str]] = {} README_EXTENSIONS = ['', '.rst', '.txt', '.md'] - # TODO: Mark some class-level tuples as as not fixed-length pypa/distutils (like python/typeshed#12403) - READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS) # type: ignore[assignment] + READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS) def run(self) -> None: self.run_command('egg_info') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index d107a272e1..5ce96a66f7 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os import sys from importlib.util import cache_from_source as _compiled_file_name