I have the following line in my header:
import config.logging_settings
This actually changes my python logging settings, but pylint thinks it is an unused import. I do not want to remove unused-import
warnings in general so is it possible to just ignore this one specific line?
I wouldn't mind having a .pylintrc
for this project so answers changing a config file will be accepted.
Otherwise, something like this will also be appreciated:
import config.logging_settings # pylint: disable-this-line-in-some-way
That was simple and is specific for that line.
As sthenault kindly pointed out, you can and should use the more readable form:
I believe what you're looking for is...
Note the double space before the comment to avoid hitting other formatting warnings.
Also, depending on your IDE (if you're using one), there's probably an option to add the correct ignore rule (eg in eclipse pressing Ctrl1 while the cursor is over the warning will auto-suggest
@UnusedImport
Pylint message control is documented in the Pylint manual:
You can use the message code or the symbolic names.
The manual also has an example.
There is a wiki that documents all pylint messages and their codes.
Checkout the files in https://github.com/PyCQA/pylint/tree/master/pylint/checkers. I haven't found a better way to obtain the error name from a message than either Ctrl+F-ing those files or using the Github search feature:
If the message is "No name ... in module ...", use the search:
Or, to get less results:
Github will show you:
You can then do: