Skip to content

Commit

Permalink
Improve placement logic to ensure it takes into account the case wher…
Browse files Browse the repository at this point in the history
…e known leads to non existant section
  • Loading branch information
timothycrosley committed Sep 30, 2020
1 parent ec78bf3 commit 5765527
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion isort/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _known_pattern(name: str, config: Config) -> Optional[Tuple[str, str]]:
module_names_to_check = (".".join(parts[:first_k]) for first_k in range(len(parts), 0, -1))
for module_name_to_check in module_names_to_check:
for pattern, placement in config.known_patterns:
if pattern.match(module_name_to_check):
if placement in config.sections and pattern.match(module_name_to_check):
return (placement, f"Matched configured known pattern {pattern}")

return None
Expand Down

0 comments on commit 5765527

Please sign in to comment.