Skip to content

group_by_package errors when packages start with import #2135

@glasnt

Description

@glasnt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions