Reputation: 123
At my current work we have an enviroment py file contains the following imports:
from core.entities import *
from core.entities.hdr import *
from core.entities.scanner import *
However, all of these imports are seen as "unused" by the ide (Pycharm) and we sometimes experience someone making a commit where these have been removed by the IDE in the process. Is there a way to mark unused imports as not being unused?
Upvotes: 12
Views: 2978
Reputation: 195
You can also use from core.entities import * # noqa
that will do the same as # noinspection PyUnresolvedReferences
in PyCharm.
Upvotes: 4
Reputation: 562
Try checking in the "Reformat File" dialog (Ctrl+Alt+Shift+L), uncheck "Optimize imports", if already checked.
Alternatively, you can add `PyUnresolvedReferences':
# noinspection PyUnresolvedReferences
import A
# noinspection PyUnresolvedReferences
import B
Although there are some reported issues with the reference, https://youtrack.jetbrains.com/issue/PY-19837 .
Upvotes: 18