isort
isort copied to clipboard
group_by_package errors when packages start with `import`
group_by_package
is a configuration only used by the google
profile, but it introduces a pathway in section_key
where from
imports are further filtered.
The current tokenization logic for this works for most cases, except where the imported module starts with import
.
Failure case: applying isort --profile google
yielded the following diff:
--- a/kms/snippets/snippets_test.py
+++ b/kms/snippets/snippets_test.py
from encrypt_symmetric import encrypt_symmetric
+from import_manually_wrapped_key import import_manually_wrapped_key
from generate_random_bytes import generate_random_bytes
from get_key_labels import get_key_labels
from get_key_version_attestation import get_key_version_attestation
@@ -65,7 +67,6 @@ from get_public_key_jwk import get_public_key_jwk
from iam_add_member import iam_add_member
from iam_get_policy import iam_get_policy
from iam_remove_member import iam_remove_member
-from import_manually_wrapped_key import import_manually_wrapped_key
from quickstart import quickstart
The import of import_manually_wrapped_key
was erroneously moved.
Patch and tests incoming.
ref https://github.com/PyCQA/isort/issues/1486 https://github.com/PyCQA/isort/commit/b583c12d8218bf499b5063b2a3fe657a6b2b2a3b#diff-153ebbc261312b467290ff2b9bf2d722dfb3e41c2db70aa60c8128ad66bd05cd