AnnAssign¶
- class astroid.nodes.AnnAssign(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
AssignTypeNode
,Statement
Class representing an
ast.AnnAssign
node.An
AnnAssign
is an assignment with a type annotation.>>> import astroid >>> node = astroid.extract_node('variable: List[int] = range(10)') >>> node <AnnAssign l.1 at 0x7effe1d4c630>
- assigned_stmts(node: node_classes.AssignedStmtsPossibleNode = None, context: InferenceContext | None = None, assign_path: list[int] | None = None) Any ¶
Returns the assigned statement (non inferred) according to the assignment type. See astroid/protocols.py for actual implementation.