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
I would like to format my docstrings to have a max line length, but these line breaks should not be present after parsing. This is the behaviour of other docstring parsers, as well as markup formats like markdown or rst. A line break should be present if there are 2 newlines.
For example:
from docstring_parser import parse
docstring = """
short description
Long description that can span multiple lines. This is test sentence 1. This is test sentence 2. I do not want a
line break in this sentence.
Parameters:
param_1: Description of param_1. This is test sentence 1. This is test sentence 2. This is test sentence 3. I
do not want a line break in this sentence.
"""
parsed = parse(docstring)
print("Long description:")
print(repr(parsed.long_description))
print("Parameters:")
for param in parsed.params:
print(repr(param.description))
gives the output:
Long description:
'Long description that can span multiple lines. This is test sentence 1. This is test sentence 2. I do not want a \nline break in this sentence.'
Parameters:
'Description of param_1. This is test sentence 1. This is test sentence 2. This is test sentence 3. I\ndo not want a line break in this sentence. '
(note that I use repr to make it clear that the newlines are present)
The text was updated successfully, but these errors were encountered:
I would like to format my docstrings to have a max line length, but these line breaks should not be present after parsing. This is the behaviour of other docstring parsers, as well as markup formats like markdown or rst. A line break should be present if there are 2 newlines.
For example:
gives the output:
(note that I use
repr
to make it clear that the newlines are present)The text was updated successfully, but these errors were encountered: