Skip to content

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

Closed
wants to merge 2 commits into from
Closed

CLN: change getargspec -> signature #12325

wants to merge 2 commits into from

Conversation

troglotit
Copy link
Contributor

Change signature in compat to be able to return defaults, varargs,
kwargs

Closes #12171

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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)

@troglotit
Copy link
Contributor Author

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.

def foo(a,b=2,*args,**kwargs):
    pass

signature(foo)

was returning ['a','b'] and ['a','b','args','kwargs'] in Python 2 and Python 3, respectively.

Now

def foo(a,b=2,*args,**kwargs):
    pass

signature(foo).args

returns ['a','b'] in both Python 2 and 3.

@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label Feb 15, 2016
@@ -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
Copy link
Contributor

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

@jreback jreback added this to the 0.18.0 milestone Feb 15, 2016
@jreback
Copy link
Contributor

jreback commented Feb 15, 2016

small changes. ping when green.

@troglotit
Copy link
Contributor Author

@jreback added reference to Django issue (does it suffice?) and put import at the top.

@jreback jreback closed this in 5d1857c Feb 17, 2016
@jreback
Copy link
Contributor

jreback commented Feb 17, 2016

@troglotit thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants