pythonect — Parse and execute Pythonect code
This Python module provides the capability to parse and evaluate a string as Pythonect code
-
pythonect.parse(source)
Parse the source into a directed graph (i.e. networkx.DiGraph)
- Args:
- source: A string representing a Pythonect code.
- Returns:
- A directed graph (i.e. networkx.DiGraph) of Pythonect symbols.
- Raises:
- SyntaxError: An error occurred parsing the code.
-
pythonect.eval(source, globals_={}, locals_={})
Evaluate Pythonect code in the context of globals and locals.
- Args:
- source: A string representing a Pythonect code or a networkx.DiGraph() as
- returned by parse()
globals: A dictionary.
locals: Any mapping.
- Returns:
- The return value is the result of the evaluated code.
- Raises:
- SyntaxError: An error occurred parsing the code.
Questions? Comments?
comments powered by