Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def nodes_of_class(
) -> Iterator[T_Nodes]:
...

def nodes_of_class( # type: ignore # mypy doesn't correctly recognize the overloads
def nodes_of_class( # type: ignore[misc] # mypy doesn't correctly recognize the overloads
self,
klass: Union[
Type[T_Nodes],
Expand Down
4 changes: 2 additions & 2 deletions astroid/rebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def visit_extslice(
) -> nodes.Tuple:
"""visit an ExtSlice node by returning a fresh instance of Tuple"""
newnode = nodes.Tuple(ctx=Context.Load, parent=parent)
newnode.postinit([self.visit(dim, newnode) for dim in node.dims]) # type: ignore
newnode.postinit([self.visit(dim, newnode) for dim in node.dims]) # type: ignore[attr-defined]
return newnode

@overload
Expand Down Expand Up @@ -1434,7 +1434,7 @@ def visit_namedexpr(self, node: "ast.NamedExpr", parent: NodeNG) -> nodes.NamedE
# Not used in Python 3.9+.
def visit_index(self, node: "ast.Index", parent: nodes.Subscript) -> NodeNG:
"""visit a Index node by returning a fresh instance of NodeNG"""
return self.visit(node.value, parent) # type: ignore
return self.visit(node.value, parent) # type: ignore[attr-defined]

def visit_keyword(self, node: "ast.keyword", parent: NodeNG) -> nodes.Keyword:
"""visit a Keyword node by returning a fresh instance of it"""
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ skip_glob = tests/testdata

[mypy]
scripts_are_modules = True
no_implicit_optional = True
warn_redundant_casts = True
show_error_codes = True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉


[mypy-setuptools]
ignore_missing_imports = True
Expand Down
12 changes: 6 additions & 6 deletions tests/unittest_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_assigned_stmts_match_mapping():
pass
"""
)
match_mapping: nodes.MatchMapping = assign_stmts.pattern # type: ignore
match_mapping: nodes.MatchMapping = assign_stmts.pattern # type: ignore[union-attr]
assert match_mapping.rest
assigned = next(match_mapping.rest.assigned_stmts())
assert assigned == Uninferable
Expand All @@ -316,7 +316,7 @@ def test_assigned_stmts_match_star():
pass
"""
)
match_sequence: nodes.MatchSequence = assign_stmts.pattern # type: ignore
match_sequence: nodes.MatchSequence = assign_stmts.pattern # type: ignore[union-attr]
match_star = match_sequence.patterns[2]
assert isinstance(match_star, nodes.MatchStar) and match_star.name
assigned = next(match_star.name.assigned_stmts())
Expand All @@ -337,10 +337,10 @@ def test_assigned_stmts_match_as():
pass
"""
)
subject: nodes.Const = assign_stmts[0].subject # type: ignore
match_or: nodes.MatchOr = assign_stmts[1].pattern # type: ignore
match_as_with_pattern: nodes.MatchAs = assign_stmts[2].pattern # type: ignore
match_as: nodes.MatchAs = assign_stmts[3].pattern # type: ignore
subject: nodes.Const = assign_stmts[0].subject # type: ignore[index, union-attr]
match_or: nodes.MatchOr = assign_stmts[1].pattern # type: ignore[index, union-attr]
match_as_with_pattern: nodes.MatchAs = assign_stmts[2].pattern # type: ignore[index, union-attr]
match_as: nodes.MatchAs = assign_stmts[3].pattern # type: ignore[index, union-attr]
Comment thread
DanielNoord marked this conversation as resolved.
Outdated

match_or_1 = match_or.patterns[1]
assert isinstance(match_or_1, nodes.MatchAs) and match_or_1.name
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def d(self):


class Whatever:
a = property(lambda x: x, lambda x: x) # type: ignore
a = property(lambda x: x, lambda x: x) # type: ignore[misc]


def test_ancestor_looking_up_redefined_function() -> None:
Expand Down