Closed jakekaplan closed 3 years ago
Hello @jakekaplan, thank you very much for your contribution!
Do you have an example of a docstring that would lack this context previously? Just for reference :slightly_smiling_face:
Hi @pawamoy!
My use case was something like below:
class MyClass:
"""
This is my class.
Args:
num: this is a number.
"""
def __init__(num: int = 1):
...
I noticed that the defaults wouldn't populate for Classes unless i explicitly wrote them into the docstring. For methods this pattern was fine and the signature was used as a backup. Passing the context down allowed the signature to be used for Classes as well.
Please let me know if this is sufficient! And thank you for a great tool!
Thank you, that's exacty what I needed to fully understand the PR :slightly_smiling_face: Then it's all good, merging!
@pawamoy thanks so much!
Just wondering, will this change make it's way into mkdocstrings?
Yes of course :) I'll release a new version soon
The full context was not being passed to
parse_docstring
. This was not allowingClass
signatures to be passed down for extra context and instead would only rely on the class docstring itself.