module documentation

Part of the astor library for Python AST manipulation. License: 3-clause BSD Copyright (c) 2015 Patrick Maupin Pretty-print source -- post-process for the decompiler The goals of the initial cut of this engine are: 1) Do a passable, if not PEP8, job of line-wrapping. 2) Serve as an example of an interface to the decompiler for anybody who wants to do a better job. :)

Function add_parens Attempt to add parentheses around the line in order to make it splittable.
Function count Undocumented
Function delimiter_groups Split a line into alternating groups. The first group cannot have a line feed inserted, the next one can, etc.
Function get_assign_groups Split a line into groups by assignment (including augmented assignment)
Function pretty_source Prettify the source.
Function split_group Split a group into two subgroups. The first will be appended to the current line, the second will start the new line.
Function split_lines Split inputs according to lines. If a line is short enough, just yield it. Otherwise, fix it.
Function wrap_line We have a line that is too long, so we're going to try to wrap it.
Variable begin_delim Undocumented
Variable end_delim Undocumented
Variable ops Undocumented
Variable statements Undocumented
def add_parens(line, maxline, indent, statements=statements, count=count): (source)

Attempt to add parentheses around the line in order to make it splittable.

def count(group, slen=str.__len__): (source)

Undocumented

def delimiter_groups(line, begin_delim=begin_delim, end_delim=end_delim): (source)

Split a line into alternating groups. The first group cannot have a line feed inserted, the next one can, etc.

def get_assign_groups(line, ops=ops): (source)

Split a line into groups by assignment (including augmented assignment)

def pretty_source(source): (source)

Prettify the source.

def split_group(source, pos, maxline): (source)

Split a group into two subgroups. The first will be appended to the current line, the second will start the new line. Note that the first group must always contain at least one item. The original group may be destroyed.

def split_lines(source, maxline=79): (source)

Split inputs according to lines. If a line is short enough, just yield it. Otherwise, fix it.

def wrap_line(line, maxline=79, result=[], count=count): (source)

We have a line that is too long, so we're going to try to wrap it.

begin_delim = (source)

Undocumented

end_delim = (source)

Undocumented

Undocumented

statements = (source)

Undocumented