Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont strip as comments #179

Merged
merged 2 commits into from
Sep 18, 2014

Conversation

dandavison
Copy link

See #125

This PR contains test cases and fixes for a bug relating to inline comments on import ... as ... lines.

Examples of the incorrect behavior are (all invocations of isort are with default options, i.e. isort -d $file):

Example 1

from a import b as bb  # b comment
from a import c as cc  # c comment

On 3.9.0 this has its comments stripped; with this PR it is left unchanged.

Example 2

from a import b as bb  # b comment
from a import c as cc  # c comment
from a import d

was being converted to (branch develop 3.9.0)

from a import b as bb
from a import c as cc
from a import d  # b comment; c comment

with this PR it is left unchanged.

Note that there is an option 'combine_as_imports' but it is not (AIUI) exposed to the user in the command line API. If that option is set to True by manually editing isort/settings.py, we do get the desired output for these examples (one of the test cases confirms this).

from a import b as bb, c as cc  # b comment; c comment
from a import b as bb, c as cc, d  # b comment; c comment

timothycrosley added a commit that referenced this pull request Sep 18, 2014
@timothycrosley timothycrosley merged commit a8dd054 into PyCQA:develop Sep 18, 2014
@timothycrosley
Copy link
Member

This looks great! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants