Parse docstr s and indent it with level spaces
(s, level=0)
| 62 | print(f" - Done with directory tree") |
| 63 | |
| 64 | def parse_docstr(s, level=0): |
| 65 | """Parse docstr s and indent it with level spaces""" |
| 66 | s = s.split("\n") |
| 67 | while s and s[0] == "": |
| 68 | s = s[1:] |
| 69 | while s and s[-1] == "": |
| 70 | s = s[:-1] |
| 71 | if not s: |
| 72 | return "" |
| 73 | i = 0 |
| 74 | indent = len(list(itertools.takewhile(lambda i: i == " ", s[0]))) |
| 75 | lines = [l[indent:] for l in s] |
| 76 | return "\n".join((" " * level) + l for l in lines) |
| 77 | |
| 78 | def parse_type(a): |
| 79 | """Parse type signature""" |