Skip to content

Potential fix for code scanning alert no. 13: Module is imported with 'import' and 'import from'#70

Merged
yec-akamai merged 2 commits intomainfrom
alert-autofix-13
Mar 5, 2026
Merged

Potential fix for code scanning alert no. 13: Module is imported with 'import' and 'import from'#70
yec-akamai merged 2 commits intomainfrom
alert-autofix-13

Conversation

@zliang-akamai
Copy link
Copy Markdown
Member

Potential fix for https://github.com/linode/py-metadata/security/code-scanning/13

In general, this warning is fixed by choosing a single import style for a module and removing redundant imports. If specific attributes or classes are imported with from module import Name, then a bare import module is only needed if the module object itself is used (e.g., module.Name or module.some_function()).

For this file, the simplest, behavior‑preserving fix is to remove the unused import linode_metadata on line 7 and keep the explicit imports of MetadataClient, AsyncMetadataClient, ApiError, and MetadataToken. No code in the snippet uses the linode_metadata namespace directly, so this deletion does not change runtime behavior. Concretely, edit test/integration/test_token.py and delete the line import linode_metadata, leaving all other imports and code unchanged. No additional methods, definitions, or imports are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… 'import' and 'import from'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@zliang-akamai zliang-akamai marked this pull request as ready for review February 3, 2026 03:45
@zliang-akamai zliang-akamai requested a review from a team as a code owner February 3, 2026 03:45
@zliang-akamai zliang-akamai requested review from dawiddzhafarov and mgwoj and removed request for a team February 3, 2026 03:45
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yec-akamai yec-akamai merged commit d31e326 into main Mar 5, 2026
13 checks passed
@yec-akamai yec-akamai deleted the alert-autofix-13 branch March 5, 2026 15:50
@yec-akamai yec-akamai added the improvement for improvements in existing functionality in the changelog. label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants