-
-
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
Recognize new-style attrs decorators in too-few-public-methods check #9346
Recognize new-style attrs decorators in too-few-public-methods check #9346
Conversation
Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (pylint-dev#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes pylint-dev#9345.
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #9346 +/- ##
=======================================
Coverage 95.81% 95.81%
=======================================
Files 173 173
Lines 18767 18771 +4
=======================================
+ Hits 17981 17985 +4
Misses 786 786
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit 86f4378 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
β¦9346) Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes #9345. (cherry picked from commit c032181)
β¦9346) (#9596) Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes #9345. (cherry picked from commit c032181) Co-authored-by: akirchhoff-modular <[email protected]>
Type of Changes
Description
Beginning with attrs 21.1.0, the recommended way to use attrs is through
import attrs
and usingattrs.define
/attrs.frozen
, notimport attr
andattr.s
orattr.attrs
. Pylint does understandattr.attrs
(#2988), but new-style uses of attrs are not understood to be data class decorators.Modify
_is_exempt_from_public_methods
to recognizeattrs.define
andattrs.frozen
in a similar way as is currently done withdataclasses.dataclass
.Closes #9345