support no-member and type inference for attrs classes?
Currently it seems that the attrs plugin only aims to avoid false warnings.
I'd like it to also support detection of nonexistent members (no-member), and be able to use available member type information.
I don't observe that astroid does either of these currently, and the plugin tests are limited to "does a Factory dict attribute infer as Unknown".
Would you be able to submit a patch? While I agree that makes sense, it's not something we can prioritize now, but having a PR from a contributor would definitely improve the attrs support.
correction: no-member works (it's no different than plain class attributes)
and I guess before wanting type annotations to work for attrs classes, it should work on plain classes:
class Test:
def foo(self): pass
class AttribClass:
x: int
o = Test()
o2: Test
obj = AttribClass()
assert obj.x
assert obj.y # "Instance of 'AttribClass' has no 'y' member"
assert obj.o.foo2() # "Instance of 'Test' has no 'foo2' member"
assert obj.o2.foo2() # expected error
Here's a test case for this issue that demonstrates the problem: https://github.com/PyCQA/astroid/pull/750