Unused submodule imports are left if the top level module is used
Anthchirp opened this issue · comments
Markus Gerstel commented
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.