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

usort incorrectly treats flatten_dict as a 1st party import #245

Open
sknaumov opened this issue Mar 17, 2023 · 1 comment
Open

usort incorrectly treats flatten_dict as a 1st party import #245

sknaumov opened this issue Mar 17, 2023 · 1 comment
Assignees

Comments

@sknaumov
Copy link

Hello. I have a pylint warning after applying usort formatting:

C0411: third party import "from flatten_dict import flatten, unflatten" should be placed before "import common as cmn" (wrong-import-order)

Unfortunately, usort treats flatten_dict as a first-party dependency.

Also I've noticed that usort always separates system imports from others with an empty line, but for some reason doesn't enforce an empty line between 3rd party and 1st party imports - which seems to be an inconsistency.

@amyreese amyreese self-assigned this Mar 23, 2023
@amyreese
Copy link
Member

Is there a public repo that I can repro this against? Alternately, can you run usort list-imports --debug <path/to/file.py> and share a paste of the results? That should show each import detected, along with the inferred category for each one, to make sure usort is doing what you think it's doing.

Also I've noticed that usort always separates system imports from others with an empty line, but for some reason doesn't enforce an empty line between 3rd party and 1st party imports - which seems to be an inconsistency.

Can you try running again with the 1.1.0b1 beta release? I believe that has more consistent normalization of blank lines between sections, but would like to confirm that. A repro we can test against would also be helpful.

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

No branches or pull requests

2 participants