-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: change getargspec -> signature #12325
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
Conversation
Change signature in compat to be able to return defaults, varargs, kwargs Closes #12171
@@ -71,7 +71,30 @@ def bytes_to_str(b, encoding=None): | |||
return b.decode(encoding or 'utf-8') | |||
|
|||
def signature(f): | |||
return list(inspect.signature(f).parameters.keys()) | |||
from collections import namedtuple | |||
sig = inspect.signature(f) |
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.
where did you get all this from? is it already defined somewhere we can just import it?
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.
I've borrowed it from django/django#4846
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.
can you add a refernce to that django issue here (and comment that we copied directly)
I've almost messed up committing to the master, but I've tried to make everything clear. Regarding the changes: the signature in the compat was needed to return defaults, varargs, kwargs in the decarators.py.
was returning ['a','b'] and ['a','b','args','kwargs'] in Python 2 and Python 3, respectively. Now
returns ['a','b'] in both Python 2 and 3. |
@@ -71,7 +71,30 @@ def bytes_to_str(b, encoding=None): | |||
return b.decode(encoding or 'utf-8') | |||
|
|||
def signature(f): | |||
return list(inspect.signature(f).parameters.keys()) | |||
from collections import namedtuple |
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.
put the import at the top of the file
small changes. ping when green. |
@jreback added reference to Django issue (does it suffice?) and put import at the top. |
@troglotit thanks! |
Change signature in compat to be able to return defaults, varargs,
kwargs
Closes #12171