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 th开发者_运维技巧inks 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?
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.
精彩评论