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

Function parse_type

scripts/docgen.py:78–94  ·  view source on GitHub ↗

Parse type signature

(a)

Source from the content-addressed store, hash-verified

76 return "\n".join((" " * level) + l for l in lines)
77
78def parse_type(a):
79 """Parse type signature"""
80 if isinstance(a, str) and not a.isdigit():
81 return a
82 elif isinstance(a, list):
83 head, tail = a[0], a[1:]
84 else:
85 head, tail = a, None
86 if head[0].isdigit() and head not in j:
87 return "?"
88 s = j[head]["name"] if head[0].isdigit() else head
89 if tail:
90 for ti, t in enumerate(tail):
91 s += "[" if not ti else ", "
92 s += parse_type(t)
93 s += "]"
94 return s
95
96def parse_fn(v):
97 """Parse function signature after the name"""

Callers 2

parse_fnFunction · 0.85
docgen.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected