MCPcopy
hub / github.com/exaloop/codon / parse_docstr

Function parse_docstr

scripts/docgen.py:64–76  ·  view source on GitHub ↗

Parse docstr s and indent it with level spaces

(s, level=0)

Source from the content-addressed store, hash-verified

62print(f" - Done with directory tree")
63
64def 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
78def parse_type(a):
79 """Parse type signature"""

Callers 1

write_docstrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected