-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive: Field has no items() member #2600
Comments
Thanks for creating an issue @kazaamjt Pylint currently does not fully understand |
Note: of course same behavior with |
While dataclasses are not supported, is there a way to disable certain checks on dataclasses only, using pylintrc? |
You can try |
Hi, @dataclass
class Case:
"""Case class (group Item)"""
name: str
irr: float = 0
items: List[Item] = field(default_factory=lambda: [])
def add_item(self, item: Item) -> None:
"""Add an item to the item list."""
self.items.append(item) With the version 2.10.2, pylint returns: E1101: Instance of 'Field' has no 'append' member (no-member) Thanks |
Hi @yellowhat, could you open a new issue, please ? |
Steps to reproduce
Current behavior
Pylint reports:
"Instance of 'Field' has no 'items' member"
Expected behavior
No error, because the field is a Dict and thus does have the items() member.
(Pylint thinks it's just a Field, but it's the default factory returns a dict)
pylint --version output
pylint 2.1.1
astroid 2.0.4
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
(I also tested with "pip install pylint astroid --pre -U", which resulted in the same thing)
The text was updated successfully, but these errors were encountered: