-
-
Notifications
You must be signed in to change notification settings - Fork 167
self included in list of params for method #220
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
Comments
Oh, that's mysterious!
|
Is it numpydoc, or sphinx version upgrade? The table is probably constructed by sphinx.ext.autosummary, signature mangling is maybe from numpydoc but I don't recall how this works exactly any more... |
Its just a numpydoc upgrade. I am using sphinx 2.0.1 on both. From what I I can figure, you can do... from numpydoc.docscrape_sphinx import get_doc_object
import statsmodels.api as sm
get_doc_objecdt(sm.GLM) and you get the same output for both. That's just an autosummray table with just the method names (no signature/parameters). So that looks right. But the signature is different. I can't really tell how the signature is generated from the code. |
Git bisect has lead me to think the issue is here: |
I can't believe that. Could it be the parent of that commit,
e47b940
??
|
I'm pretty certain that is it. I changed that code back in a development version and it works. I can't seem to figure out how the code works, however... In [1]: import statsmodels.api as sm
In [2]: from numpydoc.docscrape_sphinx import SphinxDocString, get_doc_object
In [3]: import pydoc
In [4]: SphinxDocString(pydoc.getdoc(sm.GLM.fit))
Out[4]: <numpydoc.docscrape_sphinx.SphinxDocString at 0x1204bf630>
In [5]: SphinxDocString(pydoc.getdoc(sm.GLM.fit))['Signature']
Out[5]: ''
In [6]: get_doc_object(sm.GLM.fit)['Signature']
Out[6]: "fit(self, start_params=None, maxiter=100, method='IRLS', tol=1e-08, scale=None, cov_type='nonrobust', cov_kwds=None, use_t=None, full_output=True, disp=False, max_start_irls=3, \\*\\*kwargs)" I don't know why running this way, the "old" way doesn't work. It must be adding the signature before it goes through this. I'm not sure how the |
(my guess is that autodoc is parsing it, and realizing that this is method and dropping the first parameter, then prepending the signature on the docs. Not sure how to setup a test of that, however.) |
Ok, better guess. I think before, this was broken and didn't return signatures when they weren't explicitly stated in the docstring. Then I'm guessing sphinx added the correct one. With the "fix" (that reverts behavior)
|
Ok I think it boils down to this... Before, this whole section got skipped... its not in the inheritance of numpydoc/numpydoc/docscrape.py Lines 564 to 590 in 2fa5256
Now, this runs, and adds the signature that didn't exist before. Because the signature is added, my theory is that autodoc doesn't use its (slightly different) logic to add the signature. |
What a strange interaction. I'm struggling to get my head around it. |
I don't understand how #200 worked really. |
Let me rephrase. It was broken before. #200 "fixed" it. Now Then--and here I haven't looked at sphinx's autodoc--since a signature already exists, autodoc just relies on the provided signature. Before #200, since there was no signature, sphinx's autodoc used its logic to create the signature and its logic was clever enough to drop |
so you think the solution is to adopt autodoc's logic?
|
I guess that would make sense. Either (hard way) duplicate their logic or (easy way) create a Signature only if it already exists in the docstring. Otherwise, just create a Signature of |
I updated #221 to add the functionality I'm thinking about. Let me know if you think this is on the right path. (edit... wrong number) |
Is there a way to fix this for ourselves (besides reverting to 0.8.0)? |
Closed by #221 |
Hello
I'm trying to fix some issues with statsmodels documentation.
One issue that we've uncovered is that numpydoc 0.9.0 (and 0.9.1) includes
self
in the list of params for a method, when it would be preferable if it didn't. That's different than what 0.8.0 did.Screenshot of 0.9.0...
Screenshot of 0.8.0...
Any ideas how to fix?
The text was updated successfully, but these errors were encountered: