Skip to content

Commit 7557b39

Browse files
DanielNoordcdce8p
andauthored
Upgrade mypy to 0.940 (#1466)
Co-authored-by: Marc Mueller <[email protected]>
1 parent 58e1976 commit 7557b39

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ repos:
7070
]
7171
exclude: tests/testdata|conf.py
7272
- repo: https://github.com/pre-commit/mirrors-mypy
73-
rev: v0.931
73+
rev: v0.940
7474
hooks:
7575
- id: mypy
7676
name: mypy

requirements_test_pre_commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ pylint==2.12.2
33
isort==5.10.1
44
flake8==4.0.1
55
flake8-typing-imports==1.12.0
6-
mypy==0.931
6+
mypy==0.940

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ scripts_are_modules = True
7070
no_implicit_optional = True
7171
warn_redundant_casts = True
7272
show_error_codes = True
73+
enable_error_code = ignore-without-code
7374

7475
[mypy-setuptools]
7576
ignore_missing_imports = True

tests/unittest_nodes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ def test_type_comments_with() -> None:
11951195
"""
11961196
with a as b: # type: int
11971197
pass
1198-
with a as b: # type: ignore
1198+
with a as b: # type: ignore[name-defined]
11991199
pass
12001200
"""
12011201
)
@@ -1212,7 +1212,7 @@ def test_type_comments_for() -> None:
12121212
"""
12131213
for a, b in [1, 2, 3]: # type: List[int]
12141214
pass
1215-
for a, b in [1, 2, 3]: # type: ignore
1215+
for a, b in [1, 2, 3]: # type: ignore[name-defined]
12161216
pass
12171217
"""
12181218
)
@@ -1229,7 +1229,7 @@ def test_type_coments_assign() -> None:
12291229
module = builder.parse(
12301230
"""
12311231
a, b = [1, 2, 3] # type: List[int]
1232-
a, b = [1, 2, 3] # type: ignore
1232+
a, b = [1, 2, 3] # type: ignore[name-defined]
12331233
"""
12341234
)
12351235
node = module.body[0]

tests/unittest_nodes_lineno.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ def test_end_lineno_comprehension() -> None:
11571157
c1 = ast_nodes[0]
11581158
assert isinstance(c1, nodes.ListComp)
11591159
assert isinstance(c1.elt, nodes.Name)
1160-
assert isinstance(c1.generators[0], nodes.Comprehension) # type: ignore
1160+
assert isinstance(c1.generators[0], nodes.Comprehension) # type: ignore[index]
11611161
assert (c1.lineno, c1.col_offset) == (1, 0)
11621162
assert (c1.end_lineno, c1.end_col_offset) == (1, 16)
11631163
assert (c1.elt.lineno, c1.elt.col_offset) == (1, 1)
@@ -1166,7 +1166,7 @@ def test_end_lineno_comprehension() -> None:
11661166
c2 = ast_nodes[1]
11671167
assert isinstance(c2, nodes.SetComp)
11681168
assert isinstance(c2.elt, nodes.Name)
1169-
assert isinstance(c2.generators[0], nodes.Comprehension) # type: ignore
1169+
assert isinstance(c2.generators[0], nodes.Comprehension) # type: ignore[index]
11701170
assert (c2.lineno, c2.col_offset) == (2, 0)
11711171
assert (c2.end_lineno, c2.end_col_offset) == (2, 16)
11721172
assert (c2.elt.lineno, c2.elt.col_offset) == (2, 1)
@@ -1176,7 +1176,7 @@ def test_end_lineno_comprehension() -> None:
11761176
assert isinstance(c3, nodes.DictComp)
11771177
assert isinstance(c3.key, nodes.Name)
11781178
assert isinstance(c3.value, nodes.Name)
1179-
assert isinstance(c3.generators[0], nodes.Comprehension) # type: ignore
1179+
assert isinstance(c3.generators[0], nodes.Comprehension) # type: ignore[index]
11801180
assert (c3.lineno, c3.col_offset) == (3, 0)
11811181
assert (c3.end_lineno, c3.end_col_offset) == (3, 22)
11821182
assert (c3.key.lineno, c3.key.col_offset) == (3, 1)
@@ -1187,7 +1187,7 @@ def test_end_lineno_comprehension() -> None:
11871187
c4 = ast_nodes[3]
11881188
assert isinstance(c4, nodes.GeneratorExp)
11891189
assert isinstance(c4.elt, nodes.Name)
1190-
assert isinstance(c4.generators[0], nodes.Comprehension) # type: ignore
1190+
assert isinstance(c4.generators[0], nodes.Comprehension) # type: ignore[index]
11911191
assert (c4.lineno, c4.col_offset) == (4, 0)
11921192
assert (c4.end_lineno, c4.end_col_offset) == (4, 16)
11931193
assert (c4.elt.lineno, c4.elt.col_offset) == (4, 1)

0 commit comments

Comments
 (0)