Open ma-sadeghi opened 4 years ago
We use docrep library to pull sections of the docstrings of the parent class.
This could be the issue here. Could you expand a bit more on how you do that?
Here's how docrep
works. In this example, the "Parameters" section of do_more
method is inherited from do_something
method as they're identical. I'm copying from the documentation of docrep
package:
In [4]: import docrep
In [5]: docstrings = docrep.DocstringProcessor()
In [6]: @docstrings.get_sectionsf('do_something')
...: @docstrings.dedent
...: def do_something(a, b):
...: """
...: Add two numbers
...:
...: Parameters
...: ----------
...: a: int
...: The first number
...: b: int
...: The second number
...:
...: Returns
...: -------
...: int
...: `a` + `b`"""
...: return a + b
...:
In [7]: @docstrings.dedent
...: def do_more(*args, **kwargs):
...: """
...: Add two numbers and multiply it by 2
...:
...: Parameters
...: ----------
...: %(do_something.parameters)s
...:
...: Returns
...: -------
...: int
...: (`a` + `b`) * 2"""
...: return do_something(*args, **kwargs) * 2
...:
In [8]: help(do_more)
Help on function do_more in module __main__:
do_more(*args, **kwargs)
Add two numbers and multiply it by 2
Parameters
----------
a: int
The first number
b: int
The second number
Returns
-------
int
(`a` + `b`) * 2
I see. Unfortunately this is not something we can solve here. We'll try to solve it in the upstream project we rely on to get docstrings in the editor, but I can't promise a short term solution.
@ccordoba12 Thanks. Just a quick question: how is it that the IPython console gets it right? I assume a different tool is used there?
how is it that the IPython console gets it right? I assume a different tool is used there?
Yes, that's right. The editor and the IPython console used different ways to introspect code.
Description
What steps will reproduce the problem?
When pressing Ctrl+I from the editor on a class, the Help tab doesn't get rendered properly, whereas doing the same thing from IPython console seems to work fine. Here are some pictures:
From the editor: From IPython console:
And here's the docstrings of the
FickianDiffusion
class:We use
docrep
library to pull sections of the docstrings of the parent class.Versions
Dependencies