PyCQA / modernize

Modernizes Python code for eventual Python 3 migration. Built on top of fissix (a fork of lib2to3)
https://modernize.readthedocs.org/
Other
353 stars 51 forks source link

Import statements should be placed after the shebang. #123

Closed jeremyh closed 9 years ago

jeremyh commented 9 years ago

Addresses issue #18

Imports are also placed after any comments (such as copyright notices), to be consistent with the existing import placement in files with module docstrings.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.03%) to 95.67% when pulling 2b1755be282eddcf3ade27b214742d2639080f3a on jeremyh:master into 8b21240bec41e1290cc1e3766e453ec850315161 on python-modernize:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.02%) to 95.66% when pulling aa290248be10967315f00f81c41b2c3aac7700e3 on jeremyh:master into 8b21240bec41e1290cc1e3766e453ec850315161 on python-modernize:master.

jeremyh commented 9 years ago

Pushed a further simplification: always place imports after comments and whitespace. This makes import handling consistent whether or not there's a docstring, shebang or copyright header.

daira commented 9 years ago

Thanks for working on this! Reviewing now.

daira commented 9 years ago

Excellent, that is a lot simpler than I thought it would need to be :+1: