diff options
-rw-r--r-- | isort/parse.py | 28 | ||||
-rw-r--r-- | tests/unit/test_isort.py | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/isort/parse.py b/isort/parse.py index 0bb963b1..714e39ab 100644 --- a/isort/parse.py +++ b/isort/parse.py @@ -432,21 +432,21 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte if type_of_import == "from": import_from = just_imports.pop(0) - for import_name in just_imports: - placed_module = finder(f"{import_from}.{import_name}") - if config.verbose and not config.only_modified: - print(f"from-type place_module for {import_from} returned {placed_module}") + placed_module = finder(import_from) + if config.verbose and not config.only_modified: + print(f"from-type place_module for {import_from} returned {placed_module}") - elif config.verbose: - verbose_output.append( - f"from-type place_module for {import_from} returned {placed_module}" - ) - if placed_module == "": - warn( - f"could not place module {import_from} of line {line} --" - " Do you need to define a default section?" - ) - root = imports[placed_module][type_of_import] # type: ignore + elif config.verbose: + verbose_output.append( + f"from-type place_module for {import_from} returned {placed_module}" + ) + if placed_module == "": + warn( + f"could not place module {import_from} of line {line} --" + " Do you need to define a default section?" + ) + root = imports[placed_module][type_of_import] # type: ignore + for import_name in just_imports: associated_comment = nested_comments.get(import_name) if associated_comment: categorized_comments["nested"].setdefault(import_from, {})[ diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py index 62b99231..7a02884b 100644 --- a/tests/unit/test_isort.py +++ b/tests/unit/test_isort.py @@ -1038,8 +1038,8 @@ def test_forced_separate() -> None: "from django.core.urlresolvers import reverse\n" "from django.db import models\n" "from django.db.models.fields import FieldDoesNotExist\n" - "\n" "from django.utils import six\n" + "\n" "from django.utils.deprecation import RenameMethodsBase\n" "from django.utils.encoding import force_str, force_text\n" "from django.utils.http import urlencode\n" |