Various code cleanup patches

Since the last round of PEP8 fixes some time ago, lots of stuff have crept back in. The patches here are a start cleaning things up again, mostly EOL and EOF whitespace for now.