You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom dataclass-like decorators (marked with dataclass_transform) exhibit issues similar to ones described in #4899, #7884 etc.
Whenever a dataclass "container" property is declared as field(default_factory=list|dict|etc...), pylint argues that particular methods and operations aren't applicable/available for this property.
Below example will produce 4 distinct pylint errors. The only way to resolve them is to remove = field(...) declarations.
************* Module attrcheck.issue
issue.py:26:8: E1101: Instance of 'Field' has no 'append' member (no-member)
issue.py:27:8: E1137: 'self.spots' does not support item assignment (unsupported-assignment-operation)
issue.py:36:21: E1101: Instance of 'Field' has no 'items' member (no-member)
issue.py:37:26: E1135: Value 'parking.parked_vehicles' doesn't support membership test (unsupported-membership-test)------------------------------------------------------------------Your code has been rated at 2.31/10 (previous run: 2.31/10, +0.00)
Expected behavior
$ pylint issue.py
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Browsed a bit more and I see that this issue more or less duplicates #7437.
IMO this issue has proper "run and drive" example code that reproduces the issue.
Will leave open for maintainers to decide.
Bug description
Custom
dataclass
-like decorators (marked withdataclass_transform
) exhibit issues similar to ones described in #4899, #7884 etc.Whenever a
dataclass
"container" property is declared asfield(default_factory=list|dict|etc...)
,pylint
argues that particular methods and operations aren't applicable/available for this property.Below example will produce 4 distinct
pylint
errors. The only way to resolve them is to remove= field(...)
declarations.Configuration
No response
Command used
Pylint output
Expected behavior
$ pylint issue.py
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Pylint version
OS / Environment
Archlinux 6.4.1-zen2-1-zen
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: