Skip to content

Remove unused type: ignore comments#9801

Merged
JelleZijlstra merged 1 commit intopython:mainfrom
AlexWaygood:unused-ignores-2
Feb 23, 2023
Merged

Remove unused type: ignore comments#9801
JelleZijlstra merged 1 commit intopython:mainfrom
AlexWaygood:unused-ignores-2

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

Looks like there may also be a bunch of unused type: ignore comments in our openpyxl and SQLAlchemy, but there's large open PRs for both of those at the moment, and I don't want to create unnecessary merge conflicts.

Found by applying this diff to my local clone of mypy and then running mypy_test.py with the --warn-unused-ignores option added

diff --git a/mypy/errors.py b/mypy/errors.py
index 2c2c1e5ca..df06d3656 100644
--- a/mypy/errors.py
+++ b/mypy/errors.py
@@ -626,10 +626,7 @@ class Errors:
                 self.has_blockers.remove(path)

     def generate_unused_ignore_errors(self, file: str) -> None:
-        if (
-            is_typeshed_file(self.options.abs_custom_typeshed_dir if self.options else None, file)
-            or file in self.ignored_files
-        ):
+        if file in self.ignored_files:
             return
         ignored_lines = self.ignored_lines[file]
         used_ignored_lines = self.used_ignored_lines[file]

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 6ba28ae into python:main Feb 23, 2023
@AlexWaygood AlexWaygood deleted the unused-ignores-2 branch February 23, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants