autoDocstring
autoDocstring copied to clipboard
Argument with Literal strings type hint badly formatted
Describe the bug A clear and concise description of what the bug is.
When passing a Literal type hint containing strings, the docstring badly writes the quotation marks.
Instead of bar : Literal["A", "B"]
I get bar : Literal["A", "B"]
Instead of bar : Literal['A', 'B']
I get bar : Literal['A', 'B']
Versions (please complete the following information):
- autoDocstring Version: v0.6.1
- Operating System: Win10
- Vscode Version: 1.67.2
Original Code (with line to generate on):
from typing import Literal
def foo(bar: Literal["A", "B"]):
# generate on this line
return bar
Expected Result:
def foo(bar: Literal["A", "B"]):
"""_summary_
_extended_summary_
Parameters
----------
bar : Literal["A", "B"]
_description_
Returns
-------
_type_
_description_
"""
return bar
Actual Result:
def foo(bar: Literal["A", "B"]):
"""_summary_
_extended_summary_
Parameters
----------
bar : Literal["A", "B"]
_description_
Returns
-------
_type_
_description_
"""
return bar
Debug log:
Set autoDocstring.logLevel
to "Debug", recreate the bug, and then copy the debug logs from the autoDocstring
output channel.
[INFO 12:08:11.420] Generating Docstring at line: 8
[INFO 12:08:11.423] Docstring generated:
"""${1:_summary_}
${2:_extended_summary_}
Parameters
----------
bar : ${3:Literal["A", "B"]}
${4:_description_}
Returns
-------
${5:_type_}
${6:_description_}
"""
[INFO 12:08:11.423] Inserting at position: 8 0
[INFO 12:08:11.442] Successfully inserted docstring