-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix issue with get_type_hints(cls.__init__) and refactor #760
Conversation
We totally can switch to exec. It was only removed by your boss in #87 because it’s a bit ugly re: Python 2. If it helps you in any way: feel free to re-introduce it! |
After reading a bunch of docs I think we can leave well enough alone and keep going with compile/eval. Unless @glyph has strong opinions about it now. So do we think having the correct "globals" on every method is necessary? If so I can factor out the eval/compile into a helper. |
I don’t think that any other method changes it’s signature based on the attributes. However, I think I’d prefer a nice and documented function anyways if it’s not too much trouble! |
Right. The only other uses of compile/eval are are hash, the cmp methods and the Attributes class creator, which don't have annotations. I'll try to make a helper anyway just to keep them together. |
So since codecov is once again giving us a hard time, I've run it manually and got this missing coverage:
Any chance of fixing it? 😇 |
38ec825
to
e622de4
Compare
My pleasure. |
Thank you so much! |
This fixes #593
I factored out the call to eval(compile... and added a generic
_make_method
method to remove repeated code.Pull Request Check List
This is just a friendly reminder about the most common mistakes. Please make sure that you tick all boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!
If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing left to do. If your pull request is a documentation fix or a trivial typo, feel free to delete the whole thing.
.pyi
).tests/typing_example.py
.docs/api.rst
by hand.@attr.s()
have to be added by hand too.versionadded
,versionchanged
, ordeprecated
directives. Find the appropriate next version in our__init__.py
file..rst
files is written using semantic newlines.changelog.d
.If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!