module documentation

Constant folding of expressions. This is an implementation of expression node evaluation. The function serves as an alternative to ast.literal_eval(). For example, 4 + 5 can be constant folded into 9.

Function ast_node_eval Undocumented
Function constant_folding Undocumented
Function src_to_node Undocumented
Function tests Undocumented
Constant BUILT_IN_FUNCTIONS Undocumented
Constant CONST_TYPES Undocumented
Constant MATH_FUNCTIONS Undocumented
Type Alias ConstantValue Undocumented
Variable BinOps Undocumented
Variable ops Undocumented
Variable UnaryOps Undocumented
Function _eval Undocumented
def ast_node_eval(node): (source)

Undocumented

def constant_folding(ast_expr): (source)

Undocumented

def src_to_node(src): (source)

Undocumented

def tests(): (source)

Undocumented

BUILT_IN_FUNCTIONS = (source)

Undocumented

Value
[x for x in dir(builtins) if not '__' in x]
CONST_TYPES = (source)

Undocumented

Value
(int, bool, float, str)
MATH_FUNCTIONS = (source)

Undocumented

Value
[x for x in dir(math) if not '__' in x]
ConstantValue = (source)

Undocumented

Value
Union[int, bool, float, str]

Undocumented

Undocumented

UnaryOps = (source)

Undocumented

def _eval(expr): (source)

Undocumented