The Wayback Machine - https://web.archive.org/web/20201206103920/https://github.com/tilezen/python-astformatter
Skip to content
master
Go to file
Code
This branch is 9 commits behind darkfoxprime:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

ASTFormatter

The ASTFormatter class accepts an AST tree and returns a valid source code representation of that tree.

Example Usage

from astformatter import ASTFormatter
import ast

tree = ast.parse(open('modulefile.py'), 'modulefile.py', mode='exec')
src  = ASTFormatter().format(tree, mode='exec')

Bugs

  • Currently, indentation is fixed at 4 spaces.
  • Too many methods are exposed that shouldn't be, in order to properly subclass ast.NodeVisitor.
  • Need to make the statement visitor methods consistent about returning a list of strings; most still just return a string.
  • Code modified to work with 3.x needs cleanup

Latest Changes

version 0.6.2
Add missing newlines for two uses of raise

Copyright

Copyright © 2015-2016 by Johnson Earls. Some rights reserved. See the license for details.

About

The ASTFormatter class accepts an AST tree and returns a valid source code representation of that tree.

Resources

License

Packages

No packages published
You can’t perform that action at this time.