Parse type signature
(a)
| 76 | return "\n".join((" " * level) + l for l in lines) |
| 77 | |
| 78 | def 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 | |
| 96 | def parse_fn(v): |
| 97 | """Parse function signature after the name""" |