Skip to content

Commit

Permalink
Upgrade mypy to 0.940 (#1466)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Mueller <[email protected]>
  • Loading branch information
DanielNoord and cdce8p authored Mar 12, 2022
1 parent 58e1976 commit 7557b39
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/unittest_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
)
Expand All @@ -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
"""
)
Expand All @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions tests/unittest_nodes_lineno.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 7557b39

Please sign in to comment.