You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems this has been fixed in this repo, but on the version from PyPi does not include this fix. I was able to install from source to resolve the issue.
I'm trying to convert docstrings from reST to Google format but the output is broken in functions with type annotations.
Example input file foo.py
fromtypingimportTuple, Optional# With type annotations (Broken)deffoo(bar: int, baz: Tuple[int, str], qux: Optional[int] =None) ->str:
""" Main description. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis molestie neque ac dolor hendrerit molestie. Integer eu placerat nisl. Ut vel tellus sem. Nunc ornare ultrices quam, at venenatis est blandit sed. :param bar: does a bar :type bar: int :param baz: does a baz :type baz: Tuple[int, str] :param qux: does a qux :type qux: Optional[int] :returns: hello world :rtype: str """return"Hello world"# No type annotations (working)defbar(bar, baz, qux=None) ->str:
""" Main description. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis molestie neque ac dolor hendrerit molestie. Integer eu placerat nisl. Ut vel tellus sem. Nunc ornare ultrices quam, at venenatis est blandit sed. :param bar: does a bar :type bar: int :param baz: does a baz :type baz: Tuple[int, str] :param qux: does a qux :type qux: Optional[int] :returns: hello world :rtype: str """return"Hello world"
Then, we run the command
pyment -i reST -o google -w foo.py
and we get the resulting file:
fromtypingimportTuple, Optional# With type annotations (Broken)deffoo(bar: int, baz: Tuple[int, str], qux: Optional[int] =None) ->str:
"""Main description. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis molestie neque ac dolor hendrerit molestie. Integer eu placerat nisl. Ut vel tellus sem. Nunc ornare ultrices quam, at venenatis est blandit sed. Args: bar(int): does a bar baz(Tuple[int, str]): does a baz qux(Optional[int]): does a qux bar: int: baz: Tuple[int: str]: qux: Optional[int]: (Default value = None) Returns: str: hello world """return"Hello world"# No type annotations (working)defbar(bar, baz, qux=None) ->str:
"""Main description. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis molestie neque ac dolor hendrerit molestie. Integer eu placerat nisl. Ut vel tellus sem. Nunc ornare ultrices quam, at venenatis est blandit sed. Args: bar(int): does a bar baz(Tuple[int, str]): does a baz qux(Optional[int], optional): does a qux (Default value = None) Returns: str: hello world """return"Hello world"
In the resulting file the type annotated function has extra lines added for each parameter. Additionally, the default value is placed on the extraneous line.
The text was updated successfully, but these errors were encountered:
Edit:
It seems this has been fixed in this repo, but on the version from PyPi does not include this fix. I was able to install from source to resolve the issue.
I'm trying to convert docstrings from reST to Google format but the output is broken in functions with type annotations.
Example input file
foo.py
Then, we run the command
pyment -i reST -o google -w foo.py
and we get the resulting file:
In the resulting file the type annotated function has extra lines added for each parameter. Additionally, the default value is placed on the extraneous line.
The text was updated successfully, but these errors were encountered: