使用attrs 包似乎会导致 PyLint 出现错误:
import attr
@attr.s(slots=True)
class Foo:
d = attr.ib(attr.Factory(dict), type=dict)
f = Foo()
print('bar' in f.d)
print(f.d.items())
PyLint 抱怨以下错误消息(不相关的已删除):
E: 9,15: Value 'f.d' doesn't support membership test (unsupported-membership-test)
E: 10, 6: Instance of '_CountingAttr' has no 'items' member (no-member)
有没有一种直接的方法可以让 attrs 与 pylint 一起正常工作?