Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused submodule imports are left if the top level module is used #282

Open
Anthchirp opened this issue Oct 4, 2023 · 0 comments
Open
Labels

Comments

@Anthchirp
Copy link

from __future__ import annotations

import os
import os.path

print(os)

running autoflake 2.2.1 with
--in-place --remove-all-unused-imports --expand-star-imports --remove-duplicate-keys --remove-unused-variables

Expected result:

from __future__ import annotations

import os

print(os)

Actual result:

from __future__ import annotations

import os
import os.path

print(os)

With removed print(os) this works as expected - both imports are removed.
Giving the import its own symbol (ie. import os.path as op) also works as expected, and the line is removed.

@fsouza fsouza added the bug label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants