autoDocstring
autoDocstring copied to clipboard
Partial forward references in return type causes parameter/args section to be blank
Describe the bug If the return type has a nested forward reference (e.g. -> Iterable["ForwardRef"]), then the whole parameters/args block and return block in the docstring will be omitted. Note: If the whole return type is made a forward reference (e.g. -> "Iterable[ForwardRef]"), or if the partial forward ref is only on a function argument then this does not occur.
Versions (please complete the following information):
- autoDocstring Version: v0.6.1
- Operating System: Windows 10 x64
- Vscode Version: 1.73.0
Original Code (with line to generate on):
from typing import Iterable
def test_func(value: "str") -> Iterable["str"]:
# generate on this line
pass
Expected Result:
def test_func(value: "str") -> "Iterable[str]":
"""_summary_
Parameters
----------
value : str
_description_
Returns
-------
Iterable[str]
_description_
"""
pass
Actual Result:
def test_func(value: "str") -> Iterable["str"]:
"""_summary_
"""
pass
Debug log:
Set autoDocstring.logLevel to "Debug", recreate the bug, and then copy the debug logs from the autoDocstring output channel.
[INFO 09:27:50.018] Generating Docstring at line: 3
[INFO 09:27:50.022] Docstring generated:
"""${1:_summary_}
"""
[INFO 09:27:50.022] Inserting at position: 3 0
[INFO 09:27:50.050] Successfully inserted docstring
Stack trace:
If an error was reported by autoDocstring please copy the stack trace from the autoDocstring output channel.
Additional context Add any other context about the problem here.