I use PyCharm and have the following file structure:
/common
config.py
glob.py
variable.py
main.py
My glob.py
is simple as this:
# noinspection PyUnresolvedReferences
import common.config as cfg
# noinspection PyUnresolvedReferences
import common.variable as var
My main.py
can do something like this:
import common.glob as glob
print(glob.cfg.MY_CONSTANT)
print(glob.var.my_var)
The problem (or rather minor inconvenience) is that PyCharm complains about my glob.py
imports not being used. That's not really true, because main.py
is using them. Thus, I suppress the inspection with the comment lines # noinspection PyUnresolvedReferences
.
Is it possible to effectively ignore the inspection for the whole file with a single comment?
Please avoid answers about doing this through the settings, what I'm looking for is how to make better use of these # noinspection
rules