This inspection detects import statements that are not used in the code and can be safely removed. Removing unused imports helps to keep the code clean and reduces the risk of name conflicts.
Example:
import os # Unused import
import sys # Used import
from math import pi # Unused import
print(sys.version)
The inspection provides a quick fix to optimize imports, which removes all unused import statements.
Note that some imports might be used indirectly (e.g., for side effects) and should not be removed. You can suppress this inspection for specific imports if they are needed for side effects.