unimport icon indicating copy to clipboard operation
unimport copied to clipboard

Import after use gets removed

Open tolomea opened this issue 4 years ago • 1 comments
trafficstars

With 0.7.4 and --remove --include-star-import --ignore-init --gitignore

In code like this

def bob():
    print(sys.path)

import sys

The import gets incorrectly removed.

You might reasonably ask why I even had code like this, in larger files my work flow is to just drop imports in the nearest bit of module level scope and let unimport and isort clean it up.

tolomea avatar Mar 10 '21 12:03 tolomea

Unimport is currently using primary analysis methods, this problem will be solved if scope analysis is added.

hakancelikdev avatar Apr 03 '21 11:04 hakancelikdev