Clean up PyFlakes warnings in 1.7.

In order to keep things clean, I've gone through the PyFlakes warnings
found in 1.7 and fixed them up. These fixes match the fixes done in
2.0, and shouldn't be too painful to merge.