hhatto/autopep8 — pull request #20 by samv (2012-06-06 00:54:51+00:00)
Title: Hey, here's a *very early* hack at getting an E12 fixer to work.

I realize there's a bit of duplicated code; much refactoring is possible. I'll follow this up with a test suite, fixing the glaring bugs, and hope to continue with an implementation of a "pure hanging" line folding technique, which tries to keep the margin as far to the left as possible for each continuation line.

Sam

---
New continuation line errors were added to pep8.py; this is a first hack at
a fixer for them. A new class, Wrapper, is added which will later have
alternate strategies for resolving indention situations (which are
naturally related to long line errors; indenting a line to the requested
level will often push the line past the right margin, tripping E501).

The forward plan is to move the newly added _shorten_line() into Wrapper,
and to investigate alternate line folding strategies.

This change is missing tests, but informal testing on the E12.py in the
pep8 test suite yields a number of correct adjustments, so this start is
therefore marginally useful.