7

Using the attrs package seems to cause errors with 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 complains with the following error messages (irrelevant removed):

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)

Is there a direct way how to make attrs sanely work with pylint?

devilevil
  • 81
  • 4
  • I was unable to reproduce this behavior (I used Python 3.6, `pylint` 1.8.1, `attrs` 17.3.0 on MacOS). – asherbret Dec 26 '17 at 11:31
  • Forgot important part - there needs to be passed "slots=True" to decorator attr.s. Original post edited. – devilevil Dec 26 '17 at 17:31
  • 3
    It seems you've run across a [known bug](https://github.com/PyCQA/pylint/issues/1694) in `pylint`. TL;DR: `pylint` currently doesn't support custom decorators. – asherbret Dec 27 '17 at 07:52

0 Answers0