PyCQA / autoflake

Removes unused imports and unused variables as reported by pyflakes

Home Page:https://pypi.org/project/autoflake/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Anthchirp opened this issue · comments

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.