-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
New feature: isort should move module-level-dunders to the correct place #1980
Comments
Hi! Is there any further progress? |
In the course of working on this feature I've encountered an example which would defy the PEP8 instructions. This example is actually within isort:
PEP8 says to move version up above the import, but it in fact depends on the import! I'm not sure what the guidance would be here, I can do some research, but I would expect not to change anything in this case. It would be a bit difficult to detect correctly though. |
Given the resolution of python/peps#2971 (comment) I think there are two options here:
I like 2 best for simplicity, but either option is going to require detecting if a dunder assignment relies on an import statement, which may be challenging. |
I can see in a related issue #711 dunders were at least prevented from moving. However, according to PEP8, dunders should come after future imports but before the other import block.
This is correct according to PEP8
This is incorrect
But currently isort does not move the dunders. I propose this is implemented to correctly align with PEP8.
Related pylint issue pylint-dev/pylint#5471
The text was updated successfully, but these errors were encountered: