Skip to content

Commit c98fd4a

Browse files
committed
chore(mypy): use newly available unused-ignore error code
1 parent a550de2 commit c98fd4a

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

deptry/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _get_stdlib_modules() -> frozenset[str]:
177177
if sys.version_info[:2] >= (3, 10):
178178
return sys.stdlib_module_names
179179

180-
try: # type: ignore[unreachable]
180+
try: # type: ignore[unreachable, unused-ignore]
181181
return STDLIBS_PYTHON[f"{sys.version_info[0]}{sys.version_info[1]}"]
182182
except KeyError as e:
183183
raise UnsupportedPythonVersionError((sys.version_info[0], sys.version_info[1])) from e

pyproject.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ warn_unreachable = true
9292
pretty = true
9393
show_error_codes = true
9494

95-
# Ignore warnings for unused ignores because of https://github.com/python/mypy/issues/8823.
96-
# In some Python versions, we can end up with backport modules being untyped, while they are typed on others.
97-
[[tool.mypy.overrides]]
98-
module = [
99-
"deptry.core",
100-
"scripts.generate_stdlibs",
101-
"tests.unit.test_core",
102-
]
103-
warn_unused_ignores = false
104-
10595
[tool.deptry]
10696
extend_exclude = [
10797
"docs",

scripts/generate_stdlibs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def write_stdlibs_file(stdlib_python: dict[str, list[str]]) -> None:
9191
)
9292

9393
with OUTPUT_PATH.open("w+") as stdlib_file:
94-
stdlib_file.write(ast.unparse(node)) # type: ignore[attr-defined]
94+
stdlib_file.write(ast.unparse(node)) # type: ignore[attr-defined, unused-ignore]
9595

9696

9797
if __name__ == "__main__":

tests/unit/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test__get_stdlib_packages_without_stdlib_module_names() -> None:
105105

106106
@pytest.mark.skipif(sys.version_info < (3, 10), reason="only Python >= 3.10 has sys.stdlib_module_names")
107107
def test__get_stdlib_packages_with_stdlib_module_names() -> None:
108-
assert Core._get_stdlib_modules() == sys.stdlib_module_names # type: ignore[attr-defined]
108+
assert Core._get_stdlib_modules() == sys.stdlib_module_names # type: ignore[attr-defined, unused-ignore]
109109

110110

111111
@pytest.mark.parametrize(
@@ -123,7 +123,7 @@ def test__get_stdlib_packages_with_stdlib_module_names() -> None:
123123
def test__get_stdlib_packages_with_stdlib_module_names_future_version(version_info: tuple[int | str, ...]) -> None:
124124
"""Test that future versions of Python not yet tested on the CI will also work."""
125125
with mock.patch("sys.version_info", (sys.version_info[0], sys.version_info[1] + 1, 0)):
126-
assert Core._get_stdlib_modules() == sys.stdlib_module_names # type: ignore[attr-defined]
126+
assert Core._get_stdlib_modules() == sys.stdlib_module_names # type: ignore[attr-defined, unused-ignore]
127127

128128

129129
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)