I have inherited some code that uses klass instead of PyDev’s preferred cls:
def func(klass):
# do something that doesn't reference klass
return True
PyDev issues a warning that there is an unused parameter klass, which it wouldn’t do if we used the parameter cls.
Is there an easy way to let PyDev know that klass is the same thing as cls?
If you’re using PyDev’s built-in code analysis, go to Preferences > Pydev > Editor > Code Analysis, and switch to the ‘Unused’ tab. At the bottom is a text field containing a list of variable names to ignore if unused. Add
klassto that list and you should be all set.