Skip to content

Commit

Permalink
Merge pull request #2136 from glasnt/fix/issue-2135
Browse files Browse the repository at this point in the history
fix: correct group by package tokenization
  • Loading branch information
staticdev authored Jan 15, 2025
2 parents baf1112 + 3d0efc1 commit 3cc44e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion isort/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def section_key(line: str, config: Config) -> str:
if match: # pragma: no cover - regex always matches if line starts with "from ."
line = f"from {' '.join(match.groups())}"
if config.group_by_package and line.strip().startswith("from"):
line = line.split(" import", 1)[0]
line = line.split(" import ", 1)[0]

if config.lexicographical:
line = _import_line_intro_re.sub("", _import_line_midline_import_re.sub(".", line))
Expand Down
1 change: 1 addition & 0 deletions tests/unit/profiles/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_google_code_snippet_shared_example():
google_isort_test(
"""from a import z
from a.b import c
from a.b import import_me
"""
)

Expand Down

0 comments on commit 3cc44e8

Please sign in to comment.