fix some docstring crashes (#1593)

Allow removing some trailing whitespace
This commit is contained in:
Jelle Zijlstra 2020-08-13 16:40:45 -07:00 committed by GitHub
parent 8842c5ffa8
commit 5e1f620af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -6063,7 +6063,7 @@ def _stringify_ast(
and field == "value"
and isinstance(value, str)
):
normalized = re.sub(r" *\n[ \t]+", "\n ", value).strip()
normalized = re.sub(r" *\n[ \t]*", "\n", value).strip()
else:
normalized = value
yield f"{' ' * (depth+2)}{normalized!r}, # {value.__class__.__name__}"

View File

@ -46,7 +46,7 @@ def zort():
def poit():
"""
Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet.
Consectetur adipiscing elit:
- sed do eiusmod tempor incididunt ut labore
@ -58,6 +58,14 @@ def poit():
pass
def under_indent():
"""
These lines are indented in a way that does not
make sense.
"""
pass
def over_indent():
"""
This has a shallow indent
@ -136,6 +144,14 @@ def poit():
pass
def under_indent():
"""
These lines are indented in a way that does not
make sense.
"""
pass
def over_indent():
"""
This has a shallow indent