开发者

How can I get Eclipse / PyDev to ignore alternatives to cls?

开发者 https://www.devze.com 2023-01-13 19:11 出处:网络
I have inherited some code that uses klass instead of PyDev\'s preferred cls: def func(klass): # do something that doesn\'t reference klass

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 classmethods, but that doesnt seem to be the case here.

0

精彩评论

暂无评论...
验证码 换一张
取 消