Unused imports
Reports unused import statements in Python code.
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.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
-PyUnresolvedReferences- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Example:
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.
Inspection ID: PyUnusedImportsInspection
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: | |
Can be installed with plugin: | Python Community Edition, 252.26661.0 |