-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Add __module__ and __qualname__ to methods, fix __name__ #316
Conversation
Codecov Report
@@ Coverage Diff @@
## master #316 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 9 9
Lines 745 756 +11
Branches 156 157 +1
=====================================
+ Hits 745 756 +11
Continue to review full report at Codecov.
|
It looks good and thanks for solving this! However, I don't know enough about attrs to fully assess its workability from reading the diff. I suppose that if the dunders are created like expected (and like the tests ensure), this would allow me to fix Stewori/pytypes#18 (not out of the box though, because of Note 1: In Note 2: Consider if also |
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.
Thank you!
src/attr/_make.py
Outdated
|
||
return self | ||
|
||
def _add_method_dunders(self, meth): | ||
""" | ||
Add __module__ and __qualname__ to a method *method*. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Excellent point. :D I wonder, if the class hasn't those attributes, is it better to leave them gone or to set them to None? The later sounds cleaner but like something that might mask subtle bugs. Is there any precedent? I’ve chosen to leave it off for now. Turns out, testing that behaviour is harder than it sounds. :)
I’m not sure I 100% follow here. Do you want me to set co_filename or to use it? The generated methods do have it but since they’re not in actual files, it’s set to something like |
Regarding |
Fixes #309
Does this look good to you @Stewori?