-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(isort): comply with isort when sorting sub-package modules
e.g. packages named "foo.bar" additionally make sure `__future__` imports are always sorted at the very top. Issue #3059
- Loading branch information
Showing
13 changed files
with
169 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
import sys | ||
import numpy as np | ||
import os | ||
import foo.bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ort/snapshots/ruff__rules__isort__tests__separate_first_party_imports.py_firty_party.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
source: crates/ruff/src/rules/isort/mod.rs | ||
expression: diagnostics | ||
--- | ||
- kind: | ||
UnsortedImports: ~ | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 13 | ||
column: 0 | ||
fix: | ||
content: "import os\nimport sys\n\nimport baz\nimport foo.bar\nimport numpy as np\nfrom foo.bar import blah, blub\n\nimport foo\nimport foo.bar.baz\nimport leading_prefix\nfrom foo import bar, baz\nfrom foo.bar.baz import something\nfrom leading_prefix import Class\n" | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 13 | ||
column: 0 | ||
parent: ~ | ||
|
22 changes: 22 additions & 0 deletions
22
...es/isort/snapshots/ruff__rules__isort__tests__separate_future_imports.py_firty_party.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
source: crates/ruff/src/rules/isort/mod.rs | ||
expression: diagnostics | ||
--- | ||
- kind: | ||
UnsortedImports: ~ | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 4 | ||
column: 0 | ||
fix: | ||
content: "from __future__ import annotations\n\nimport os\nimport sys\n" | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 4 | ||
column: 0 | ||
parent: ~ | ||
|
22 changes: 22 additions & 0 deletions
22
...rt/snapshots/ruff__rules__isort__tests__separate_local_folder_imports.py_firty_party.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
source: crates/ruff/src/rules/isort/mod.rs | ||
expression: diagnostics | ||
--- | ||
- kind: | ||
UnsortedImports: ~ | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 6 | ||
column: 0 | ||
fix: | ||
content: "import os\nimport sys\n\nimport ruff\n\nimport leading_prefix\n\nfrom . import leading_prefix\n" | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 6 | ||
column: 0 | ||
parent: ~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ort/snapshots/ruff__rules__isort__tests__separate_third_party_imports.py_firty_party.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
source: crates/ruff/src/rules/isort/mod.rs | ||
expression: diagnostics | ||
--- | ||
- kind: | ||
UnsortedImports: ~ | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 6 | ||
column: 0 | ||
fix: | ||
content: "import os\nimport sys\n\nimport foo.bar\nimport numpy as np\nimport pandas as pd\n" | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 6 | ||
column: 0 | ||
parent: ~ | ||
|