Remove bespoke indent function. Honestly just use textwrap.

This commit is contained in:
Ethan Dalool 2020-01-30 18:48:10 -08:00
parent dc64fc3c47
commit 73483838c9

View file

@ -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]