Pydev 显示 @staticmethod 重新实现的错误
我想创建一个执行特定任务的 python 装饰器,但也执行 @staticmethod 的操作。我已经完成了这个,但是使用 PyDev,它告诉我用法不正确,因为该方法没有 self 参数。
我的简化实现如下:
class Service(object):
def __init__(self, f):
self.f = f
def __get__(self, obj, objtype=None):
return self.f
用法是:
class Environment:
@Service
def getConfig(input):
return 50
当我运行这个 python 程序时,一切运行良好,但 PyDev 认为这是一个错误。是否有一些简单的方法可以在 pydev 中禁用检查此类错误,同时保留其其余功能?
I have wanted to create a python decorator that performs a particular task, but also does what @staticmethod does. I have accomplished this, but using PyDev, it tells me that the usage is incorrect, because the method does not have the self parameter.
My simplified implementation is below:
class Service(object):
def __init__(self, f):
self.f = f
def __get__(self, obj, objtype=None):
return self.f
and the usage is:
class Environment:
@Service
def getConfig(input):
return 50
When I run this python program, everything runs well, but PyDev thinks it's an error. Is there some easy way to disable checking for this type of error in pydev, while keeping the rest of its functionality present?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像往常一样,在任何人回答之前就发现了它。
但如果将来有人想知道:
Window >首选项>派德夫编辑>代码分析>其他
此窗口是不言自明的。
As usual, found it before anybody could answer.
But if anybody in the future wants to know:
Window > Preferences > Pydev > Editor > Code Analysis > Others
This window is self-explanatory.