AugAssign#

class astroid.nodes.AugAssign(op: str, lineno: int, col_offset: int, parent: NodeNG, *, end_lineno: int | None, end_col_offset: int | None)[source]#

Bases: AssignTypeNode, OperatorNode, Statement

Class representing an ast.AugAssign node.

An AugAssign is an assignment paired with an operator.

>>> import astroid
>>> node = astroid.extract_node('variable += 1')
>>> node
<AugAssign l.1 at 0x7effe1db4d68>
assigned_stmts(**kwargs: _P.kwargs) Generator[InferenceResult, None, None]#

Returns the assigned statement (non inferred) according to the assignment type. See astroid/protocols.py for actual implementation.

get_children()[source]#

Get the child nodes below this node.

op#

The operator that is being combined with the assignment.

This includes the equals sign.

postinit(target: Name | Attribute | Subscript, value: NodeNG) None[source]#
target: Name | Attribute | Subscript#

What is being assigned to.

type_errors(context: InferenceContext | None = None)[source]#

Get a list of type errors which can occur during inference.

Each TypeError is represented by a BadBinaryOperationMessage , which holds the original exception.

Returns:

The list of possible type errors.

Return type:

list(BadBinaryOperationMessage)

value: NodeNG#

The value being assigned to the variable.