Skip to content

Commit

Permalink
Fixed remove_summary and remove_newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
rwb27 committed Jul 22, 2021
1 parent 674d09f commit f6ba74e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/labthings/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def get_docstring(obj: Any, remove_newlines=True, remove_summary=False) -> str:
ds = obj.__doc__
if not ds:
return ""
if remove_newlines:
stripped = [line.strip() for line in ds.splitlines() if line]
return " ".join(stripped).replace("\n", " ").replace("\r", "")
if remove_summary:
lines = ds.splitlines()
if len(lines) > 2 and lines[1].strip() == "":
ds = "\n".join(lines[2:])
if remove_newlines:
stripped = [line.strip() for line in ds.splitlines() if line]
return " ".join(stripped).replace("\n", " ").replace("\r", "")
return inspect.cleandoc(ds) # Strip spurious indentation/newlines


Expand Down

0 comments on commit f6ba74e

Please sign in to comment.