class documentation
class op_util: (source)
This class provides data and functions for mapping AST nodes to symbols and precedences.
Class |
|
Undocumented |
Class Method | get |
Given an AST node object, returns the precedence. |
Class Method | get |
Given an AST node object, returns a string containing the symbol. |
@classmethod
def get_op_precedence(cls, obj:
def get_op_precedence(cls, obj:
ast.AST
, precedence_data: dict[ type[ ast.AST] | None, int]
= _precedence_data, type: Callable[ [ object], type[ Any]]
= type) -> int
:
(source)
¶
Given an AST node object, returns the precedence.
Raises | |
KeyError | If the node is not explicitely supported by this function. This is a very legacy piece of code, all calls to get_op_precedence should be guarded in a try:... except KeyError:... statement. |
@classmethod
def get_op_symbol(cls, obj:
def get_op_symbol(cls, obj:
ast.operator | ast.boolop | ast.cmpop | ast.unaryop
, fmt: str
= '%s', symbol_data: dict[ type[ ast.AST] | None, str]
= _symbol_data, type: Callable[ [ object], type[ Any]]
= type) -> str
:
(source)
¶
Given an AST node object, returns a string containing the symbol.