I am using a metaclass in my code, and the code works. (Using a metaclass, it sets the attribute test_attr to "Success!" on object creation.) When I run pylint on this code, however, it displays errors in Test.test, saying that test_attr is not defined.
class MyMeta(type):
def __new__(mcs, name, bases, attrs):
attrs["test_attr"] = "Success!"
return super().__new__(mcs, name, bases, attrs)
class Test(metaclass=MyMeta):
def test(self):
return self.test_attr
What should I do to satisfy pylint? Is there a configuration option to fix this? Is there something about my code that I should fix?