My code uses the commonly used cached_property class from werkzeug. Consider the following snippet:
from werkzeug import cached_property
class SampleClass(object):
@cached_property
def list_prop(self):
return [1, 2]
sample = SampleClass()
for item in sample.list_prop:
print item
I use pylint in my CI process. If I run the pylint not-an-iterable check on this code, it fails even though the code is perfectly fine.
$ pylint --disable=all --enable=not-an-iterable prop.py
************* Module prop
E: 9,12: Non-iterable value sample.list_prop is used in an iterating context (not-an-iterable)
pylint works well when checking the same code with the built-in @property
decorator instead of @cached_property
:
class SampleClass(object):
@property
def list_prop(self):
return [1, 2]
What should I do to help pylint overcome this false positive?