-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Preserve trailing inline comments on import-from statements #12498
Conversation
7100ca0
to
6d9d4bc
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PYI052 | 9 | 0 | 9 | 0 | 0 |
PLW0642 | 8 | 8 | 0 | 0 | 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
18 18 | MyClient, | ||
19 |- MyMgmtClient, | ||
20 |- # some comment | ||
19 |+ MyMgmtClient, # some comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna fix this before merging (the comment should stay on its own line).
86fe6f9
to
0c98f14
Compare
0c98f14
to
2ddf82b
Compare
Summary
Right now, in the isort comment model, there's nowhere for trailing comments on the statement to go, as in:
If the comment is on the alias, we do preserve it, because we attach it to the alias, as in:
Similarly, if the comment is trailing on an import statement (non-
from
), we again attach it to the alias, because it can't be parenthesized, as in:This PR adds logic to track and preserve those trailing comments.
We also no longer drop several other comments, like:
Closes #12487.