Steps to reproduce
In some contexts, Pylint issues a false positive with an attrs class with only a type annotation (see PEP 526. If we add the attribute via the astroid brain_attrs then this fixes the issue. (I'm not sure if this is a duplicate of #724 ). This is supported at runtime with the newer attrs decorators.
# pylint: disable=missing-docstring,too-few-public-methods,unnecessary-lambda-assignment
import attrs # pylint: disable=import-error
@attrs.define
class AttrsCls:
x: int
ac = AttrsCls(1)
ac.x += 1
Current behavior
regression_xxxx_attrs_no_member.py:13: [E1101(no-member), ] Instance of 'AttrsCls' has no 'x' member
Expected behavior
No error