From 7557b396327c775a423b74788fa4685138b1b324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Sat, 12 Mar 2022 10:28:53 +0100 Subject: [PATCH] Upgrade mypy to 0.940 (#1466) Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- requirements_test_pre_commit.txt | 2 +- setup.cfg | 1 + tests/unittest_nodes.py | 6 +++--- tests/unittest_nodes_lineno.py | 8 ++++---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c615ebaa68..ea5689e204 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,7 +70,7 @@ repos: ] exclude: tests/testdata|conf.py - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.931 + rev: v0.940 hooks: - id: mypy name: mypy diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 10a7487887..0a04109e9f 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -3,4 +3,4 @@ pylint==2.12.2 isort==5.10.1 flake8==4.0.1 flake8-typing-imports==1.12.0 -mypy==0.931 +mypy==0.940 diff --git a/setup.cfg b/setup.cfg index 7fd722613d..e30d844d86 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,6 +70,7 @@ scripts_are_modules = True no_implicit_optional = True warn_redundant_casts = True show_error_codes = True +enable_error_code = ignore-without-code [mypy-setuptools] ignore_missing_imports = True diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 4c11cf054d..0268c27de6 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -1195,7 +1195,7 @@ def test_type_comments_with() -> None: """ with a as b: # type: int pass - with a as b: # type: ignore + with a as b: # type: ignore[name-defined] pass """ ) @@ -1212,7 +1212,7 @@ def test_type_comments_for() -> None: """ for a, b in [1, 2, 3]: # type: List[int] pass - for a, b in [1, 2, 3]: # type: ignore + for a, b in [1, 2, 3]: # type: ignore[name-defined] pass """ ) @@ -1229,7 +1229,7 @@ def test_type_coments_assign() -> None: module = builder.parse( """ a, b = [1, 2, 3] # type: List[int] - a, b = [1, 2, 3] # type: ignore + a, b = [1, 2, 3] # type: ignore[name-defined] """ ) node = module.body[0] diff --git a/tests/unittest_nodes_lineno.py b/tests/unittest_nodes_lineno.py index 630cd862c0..c1c089ac07 100644 --- a/tests/unittest_nodes_lineno.py +++ b/tests/unittest_nodes_lineno.py @@ -1157,7 +1157,7 @@ def test_end_lineno_comprehension() -> None: c1 = ast_nodes[0] assert isinstance(c1, nodes.ListComp) assert isinstance(c1.elt, nodes.Name) - assert isinstance(c1.generators[0], nodes.Comprehension) # type: ignore + assert isinstance(c1.generators[0], nodes.Comprehension) # type: ignore[index] assert (c1.lineno, c1.col_offset) == (1, 0) assert (c1.end_lineno, c1.end_col_offset) == (1, 16) assert (c1.elt.lineno, c1.elt.col_offset) == (1, 1) @@ -1166,7 +1166,7 @@ def test_end_lineno_comprehension() -> None: c2 = ast_nodes[1] assert isinstance(c2, nodes.SetComp) assert isinstance(c2.elt, nodes.Name) - assert isinstance(c2.generators[0], nodes.Comprehension) # type: ignore + assert isinstance(c2.generators[0], nodes.Comprehension) # type: ignore[index] assert (c2.lineno, c2.col_offset) == (2, 0) assert (c2.end_lineno, c2.end_col_offset) == (2, 16) assert (c2.elt.lineno, c2.elt.col_offset) == (2, 1) @@ -1176,7 +1176,7 @@ def test_end_lineno_comprehension() -> None: assert isinstance(c3, nodes.DictComp) assert isinstance(c3.key, nodes.Name) assert isinstance(c3.value, nodes.Name) - assert isinstance(c3.generators[0], nodes.Comprehension) # type: ignore + assert isinstance(c3.generators[0], nodes.Comprehension) # type: ignore[index] assert (c3.lineno, c3.col_offset) == (3, 0) assert (c3.end_lineno, c3.end_col_offset) == (3, 22) assert (c3.key.lineno, c3.key.col_offset) == (3, 1) @@ -1187,7 +1187,7 @@ def test_end_lineno_comprehension() -> None: c4 = ast_nodes[3] assert isinstance(c4, nodes.GeneratorExp) assert isinstance(c4.elt, nodes.Name) - assert isinstance(c4.generators[0], nodes.Comprehension) # type: ignore + assert isinstance(c4.generators[0], nodes.Comprehension) # type: ignore[index] assert (c4.lineno, c4.col_offset) == (4, 0) assert (c4.end_lineno, c4.end_col_offset) == (4, 16) assert (c4.elt.lineno, c4.elt.col_offset) == (4, 1)