Module to augment and analize python ast nodes.
This module uses the python ast moduel exclusivly not the depricated compiler.ast.
Pretty print an ast node.
Parameters: |
|
---|
To print a short ast you may want to use:
node = ast.parse(source)
print_ast(node, indent='', newline='')
Returns a string representing the ast.
Parameters: |
|
---|
Generate executable python source code from an ast node.
Parameters: |
|
---|
Returns: | a string containing executable python source code from an ast node. |
---|---|
Parameters: |
|
Return a set of symbols in node that are assigned.
Parameters: | node – ast node |
---|---|
Returns: | set of strings. |
Return a set of symbols in node that are used.
Parameters: | node – ast node |
---|---|
Returns: | set of strings. |
Group outputs into contitional and stable :param node: ast node
Returns: | tuple of (contitional, stable) |
---|
Group lhs and rhs into contitional, stable and undefined :param node: ast node
Returns: | tuple of (contitional_lhs, stable_lhs),(contitional_rhs, stable_rhs), undefined |
---|
Returns all symbols defined in an ast node.
if ctx_types is given, then restrict the symbols to ones with that context.
Parameters: |
|
---|
Create a dependency graph from an ast node.
Parameters: |
|
---|---|
Returns: | a tuple of (graph, undefined) |