Silence PyLint warning about unused variables for string interpolation

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

One approach to silencing that message is to name or prefix the argument with dummy or _, as in:

import say

def f(_a):
    return say.fmt("The value of 'a' is {_a}")

See here for more info: https://stackoverflow.com/a/10107410/1080804