Skip to content

Commit

Permalink
Fix annotations for statement method
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jan 28, 2024
1 parent a82d9d9 commit 144cb73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

if TYPE_CHECKING:
from astroid import nodes
from astroid.nodes import _base_nodes


# Types for 'NodeNG.nodes_of_class()'
Expand Down Expand Up @@ -278,7 +279,7 @@ def parent_of(self, node) -> bool:
"""
return any(self is parent for parent in node.node_ancestors())

def statement(self, *, future: Literal[None, True] = None) -> nodes.Statement:
def statement(self, *, future: Literal[None, True] = None) -> _base_nodes.Statement:
"""The first parent node, including self, marked as statement node.
:raises StatementMissing: If self has no parent attribute.
Expand All @@ -290,7 +291,7 @@ def statement(self, *, future: Literal[None, True] = None) -> nodes.Statement:
stacklevel=2,
)
if self.is_statement:
return cast("nodes.Statement", self)
return cast("_base_nodes.Statement", self)
if not self.parent:
raise StatementMissing(target=self)
return self.parent.statement()
Expand Down

0 comments on commit 144cb73

Please sign in to comment.