The say module brings string interpolation to Python, like this:
import say
def f(a):
return say.fmt("The value of 'a' is {a}")
However, PyLint complains that the variable 'a' is never used. This is a problem because my code uses say.fmt extensively. How can I silence this warning?
Yes, you can silence pylint warnings.
Here is one way:
import say
def f(a):
# pylint: disable=unused-argument
return say.fmt("The value of 'a' is {a}")
Alternatively, you can create a config file and add these lines to it:
[MESSAGES CONTROL]
disable=unused-argument
Reference:
- https://pylint.readthedocs.io/en/latest/faq.html#is-it-possible-to-locally-disable-a-particular-message
- https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options
所有评论(0)