mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

IPython shows decorator argument list instead of function argument list

Open haribharadwaj opened this issue 12 years ago • 9 comments

This appears to be related to Issue #215. The argument list still shows the generic (args, *kwargs) from the decorator..Though the doctring tends to have enough information, it would be nice to see the original list of arguments from the function to know which parameters are the kwargs, and which are positional args and what the defaults may be. Is that something easily achieved?

This also affects automodule/autoclass outputs in the doc.

haribharadwaj avatar Dec 06 '13 23:12 haribharadwaj

This is a known issue. There's definitely a way to fix it, I think using 'wraps' from functools.... +1 for a PR / FIX

dengemann avatar Dec 06 '13 23:12 dengemann

It doesn't seem like wraps from functools has anything obvious for parameter list. Perhaps this had to do with function objects not having any convenient attributes for parameter list like they do with name or doc ?

haribharadwaj avatar Dec 07 '13 01:12 haribharadwaj

Have your tried this?

http://stackoverflow.com/questions/3687046/python-sphinx-autodoc-and-decorated-members On Dec 6, 2013 5:55 PM, "Hari Bhradwaj" [email protected] wrote:

It doesn't seem like wraps from functools has anything obvious for parameter list. Perhaps this had to do with function objects not having any convenient attributes for parameter list like they do with name or doc?

— Reply to this email directly or view it on GitHubhttps://github.com/mne-tools/mne-python/issues/963#issuecomment-30044702 .

larsoner avatar Dec 07 '13 17:12 larsoner

+1 for fixing this. The problem happens also in sphinx cf.

http://martinos.org/mne/generated/mne.read_forward_solution.html#mne.read_forward_solution

agramfort avatar Dec 07 '13 18:12 agramfort

Looks like the decorator package would work!.. I'll issue a PR in a bit.

haribharadwaj avatar Dec 07 '13 18:12 haribharadwaj

Just issued a PR.. Both IPython and spyder's "object inspector" seem to see the right signature and docstrings now. Any ideas on how to write test for this specificallly?

haribharadwaj avatar Dec 09 '13 04:12 haribharadwaj

I think visual inspection of the docs should suffice here. On Dec 8, 2013 8:06 PM, "Hari Bhradwaj" [email protected] wrote:

Just issued a PR.. Both IPython and spyder's "object inspector" seem to see the right signature and docstrings now. Any ideas on how to write test for this specificallly?

— Reply to this email directly or view it on GitHubhttps://github.com/mne-tools/mne-python/issues/963#issuecomment-30104480 .

larsoner avatar Dec 09 '13 04:12 larsoner

Oops.. Travis CI build failed as it couldn't import the decorator module.. Will work on defaults..

haribharadwaj avatar Dec 09 '13 04:12 haribharadwaj

All set with PR #967 being merged.

haribharadwaj avatar Dec 09 '13 15:12 haribharadwaj