ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Handle multiple unused submodule imports

Open charliermarsh opened this issue 3 years ago • 3 comments
trafficstars

pylint does this properly, Flake8 does not.

For example, with this:

import multiprocessing.pool
import multiprocessing.process

Flake8 will only mark the second import as unused.

charliermarsh avatar Aug 31 '22 20:08 charliermarsh

I have a question concerning a slightly adjusted example.

import multiprocessing.pool
import multiprocessing.process

z = multiprocessing.pool.ThreadPool()

pylint and flake8 don't see any unused import here. I would argue import multiprocessing.process is.

Update Working on this, PR incoming.

squiddy avatar Nov 09 '22 10:11 squiddy

Would you consider exempting F401 from RUF100 until this is solved?

Even if ruff cannot handle this correctly, it'd be much cleaner if as a developer one could still add the proper noqa on each such unused import simply to indicate to other developers that they are aware of it being unused.

ThiefMaster avatar Nov 14 '23 00:11 ThiefMaster

Will Red knot address this issue?

JonathanPlasse avatar Apr 27 '24 16:04 JonathanPlasse