astunparse · PyPI
pypi.org › project › astunparseDec 22, 2019 · unparse will return the source code for an AST. It is pretty feature-complete, and round-trips the stdlib, and is compatible with Python 2.7 and Python 3.4. Running python -m astunparse will print the round-tripped source for any python files given as argument. Download the file for your platform.
astunparse · PyPI
https://pypi.org/project/astunparse22.12.2019 · An AST unparser for Python. This is a factored out version of unparse found in the Python source distribution; under Demo/parser in Python 2 and under Tools/parser in Python 3.. Basic example: import inspect import ast import astunparse # get back the source code astunparse.unparse(ast.parse(inspect.getsource(ast))) # get a pretty-printed dump of the AST …