Skip to content

Commit

Permalink
test: silence some new mypy errors
Browse files Browse the repository at this point in the history
I'm not sure why these are happening with the new mypy, but trying to
narrow the type `ast.AST` to `ast.stmt` caused even more problems and I
can't be bothered.
  • Loading branch information
nedbat committed Jul 20, 2024
1 parent 35d1fbe commit 694cd6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions coverage/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class NodeList(ast.AST):
"""
def __init__(self, body: Sequence[ast.AST]) -> None:
self.body = body
self.lineno = body[0].lineno
self.lineno = body[0].lineno # type: ignore[attr-defined]

# TODO: Shouldn't the cause messages join with "and" instead of "or"?

Expand Down Expand Up @@ -824,7 +824,7 @@ def line_for_node(self, node: ast.AST) -> TLineNo:
if handler is not None:
return handler(node)
else:
return node.lineno
return node.lineno # type: ignore[attr-defined, no-any-return]

# First lines: _line__*
#
Expand Down Expand Up @@ -1020,10 +1020,10 @@ def _missing__While(self, node: ast.While) -> ast.AST | None:
if not body_nodes:
return None
# Make a synthetic While-true node.
new_while = ast.While()
new_while.lineno = body_nodes.lineno
new_while.test = ast.Name()
new_while.test.lineno = body_nodes.lineno
new_while = ast.While() # type: ignore[call-arg]
new_while.lineno = body_nodes.lineno # type: ignore[attr-defined]
new_while.test = ast.Name() # type: ignore[call-arg]
new_while.test.lineno = body_nodes.lineno # type: ignore[attr-defined]
new_while.test.id = "True"
assert hasattr(body_nodes, "body")
new_while.body = body_nodes.body
Expand Down

0 comments on commit 694cd6e

Please sign in to comment.