pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Attributes set in metaclass reported `no-member`

Open jourdanrodrigues opened this issue 5 years ago • 2 comments

Question

This was the simplest snippet I could create to reproduce my issue. The aloha attribute is reported as no-member.

class ParentMetaclass(type):
    def __init__(cls, what, bases=None, attrs=None):
        super().__init__(what, bases, attrs)

        cls.aloha = 'test'


class Parent(metaclass=ParentMetaclass):
    def handle(self):
        raise NotImplementedError


class Test(Parent):
    def handle(self) -> None:
        return self.aloha  # false positive [no-member]

I noticed there are some other issues related, but they either don't address the question or they are a slightly different issue.

jourdanrodrigues avatar Jan 11 '20 02:01 jourdanrodrigues

Any news about this?

v-giacomini-nabla avatar Jan 12 '24 16:01 v-giacomini-nabla

There's a branch with a regression tests; https://github.com/pylint-dev/pylint/compare/issue-3339. The whole activity is always going to be in the issue (unless we fixed it in a duplicate without realizing).

Pierre-Sassoulas avatar Jan 12 '24 23:01 Pierre-Sassoulas