From 73483838c9cb15044da7a6a4b64f593b54e38eb1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 30 Jan 2020 18:48:10 -0800 Subject: [PATCH] Remove bespoke indent function. Honestly just use textwrap. --- voussoirkit/betterhelp.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/voussoirkit/betterhelp.py b/voussoirkit/betterhelp.py index 322dbb8..ab0ef5d 100644 --- a/voussoirkit/betterhelp.py +++ b/voussoirkit/betterhelp.py @@ -1,18 +1,12 @@ import functools +import textwrap HELPSTRINGS = {'', 'help', '-h', '--help'} -def docstring_preview(text, indent=None): +def docstring_preview(text): text = text.split('\n\n')[0] - if indent: - text = _indent(text, spaces=indent) return text -def indent(text, spaces=4): - spaces = ' ' * spaces - return '\n'.join(spaces + line if line.strip() != '' else line for line in text.split('\n')) -_indent = indent - def listget(li, index, fallback=None): try: return li[index]