UnaryOp#
- class astroid.nodes.UnaryOp(op: str, lineno: int, col_offset: int, parent: NodeNG, *, end_lineno: int | None, end_col_offset: int | None)[source]#
Bases:
OperatorNode
Class representing an
ast.UnaryOp
node.>>> import astroid >>> node = astroid.extract_node('-5') >>> node <UnaryOp l.1 at 0x7f23b2e4e198>
- op#
The operator.
- type_errors(context: InferenceContext | None = None)[source]#
Get a list of type errors which can occur during inference.
Each TypeError is represented by a
BadUnaryOperationMessage
, which holds the original exception.- Returns:
The list of possible type errors.
- Return type:
list(BadUnaryOperationMessage)