How can I get Eclipse / PyDev to ignore alternatives to cls?
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开发者_StackOverflow社区 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 klass
to that list and you should be all set.
The only unused name Pydev doesn't warn about is _
.
cls
is the name used for the first argument in classmethod
s, but that doesnt seem to be the case here.
精彩评论