-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Adds length_sort_straight option #1373
Adds length_sort_straight option #1373
Conversation
def test_length_sort_section() -> None: | ||
"""Test setting isort to sort on length instead of alphabetically for a specific section.""" | ||
test_input = ( | ||
"import medium_sizeeeeeeeeeeeeee\n" | ||
"import shortie\n" | ||
"import datetime\n" |
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.
Fixed this test as os
and sys
sort the same in both alphabetical and length sort mode. Added datetime
that would be first in alphabetical, but last in length sort mode.
Codecov Report
@@ Coverage Diff @@
## develop #1373 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 36 36
Lines 2475 2477 +2
=========================================
+ Hits 2475 2477 +2 |
This looks like a great solution to me! Simple, effective, and solves the ask completely. Thank you! |
Looks great to me too[*], thank you! [*] With a blank line between the straights and the froms. |
@warsaw to get a blank line between the two this can be combined with the lines-between-types option in isort 5.4.0+: Example based on above:
|
It's exactly what I want. I'm ecstatic! Here's my
You rock @timothycrosley Thank you! |
Does this look OK as a solution to resolve #1232?
Added a new option that length sorts just the straight imports. It is
off
by default.See it in action below with the examples of the OP: