You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some modules my organization uses have classes with all-uppercase names for devices with acronym names. Unfortunately, this causes them to look like constants in the eyes of PEP8 and therefore isort rules. For example: (both BeckhoffAxis and IMS are classes)
Expected sort:
from .epics_motorimportBeckhoffAxis, IMS
Current sort:
from .epics_motorimportIMS, BeckhoffAxis
I ran a few other tests, and as far as I can tell, isort is reading IMS as a constant and therefore moving it to the front of the list. I saw that this can be turned off using the order_by_type setting but we want this left on so that other types that we import are sorted separately.
Would it be possible to either:
Support known_type settings like known_class similar to how the known_{section} settings are used?
Have the type detected from the source file instead of by the name? (I understand why this option is tricky and can lead to other issues, but maybe just as an option when dealing with local imports?)
The text was updated successfully, but these errors were encountered:
The second option is unlikely to ever be supported because of how much magic that would require. However, I think the first is a great idea and would happily accept a pull request that supported it.
Related to #1259, I think at least updating the docs to state that it's not actually ordering by type, but really it's using case-sensitivity, would help explain what's going on.
Some modules my organization uses have classes with all-uppercase names for devices with acronym names. Unfortunately, this causes them to look like constants in the eyes of PEP8 and therefore
isort
rules. For example: (bothBeckhoffAxis
andIMS
are classes)Expected sort:
Current sort:
I ran a few other tests, and as far as I can tell,
isort
is readingIMS
as a constant and therefore moving it to the front of the list. I saw that this can be turned off using theorder_by_type
setting but we want this left on so that other types that we import are sorted separately.Would it be possible to either:
known_class
similar to how the known_{section} settings are used?The text was updated successfully, but these errors were encountered: