When I'm using attrs
library to create class, docstring in PyCharm shows a linting error unresolved attribute reference.
On the other hand when I create class normally with __init__
method. It shows no such error.
I can't figure out this error is generated due to attrs
or PyCharm because attrs
by default has all necessary stubs for mypy type checking. While using attrs
, I could not find any linting errors so far except for this time in the docstrings.
import attr
@attr.s
class UsingAttrs:
"""
class created using attrs shows linting error.
Attributes
----------
attribute_with_attr : str
"""
attribute_with_attr: str = attr.ib(default='some_string_value')
class NotUsingAttrs:
"""
class created normally does not show linting error.
Attributes
----------
attribute_without_attr : str
"""
attribute_without_attr: str
def __init__(self, param='some string value'):
self.attribute_without_attr = param
Linting error is shown in the image attached below --
Any help would be appreciated.