safe_eval(source)
Evaluate a string containing a Python literal expression without allowing the execution of arbitrary non-literal code.
The string to evaluate.
If the code has invalid Python syntax, or if it contains non-literal code.
Protected string evaluation.
>>> np.safe_eval('1') 1
>>> np.safe_eval('[1, 2, 3]') [1, 2, 3]
>>> np.safe_eval('{"foo": ("bar", 10.0)}') {'foo': ('bar', 10.0)}This example is valid syntax, but raise an exception at execution
>>> np.safe_eval('import os') Traceback (most recent call last): ... SyntaxError: invalid syntaxThis example is valid syntax, but raise an exception at execution
>>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()') Traceback (most recent call last): ... ValueError: malformed node or string: <_ast.Call object at 0x...>See :
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them