in scripts/shape_type_coverage.py [0:0]
def _split_list(string: str) -> List[str]:
"""Assumes an input of the form `[s1, s2, s3, ..., sn]`,
where each si may itself contain lists."""
assert string[0] == "[" and string[-1] == "]"
nesting_depth = 0
all_strings = []
current_string = ""
for character in string[1:-1]:
if character == "," and nesting_depth == 0:
all_strings.append(current_string)
current_string = ""
continue
if character == "[":
nesting_depth += 1
elif character == "]":
nesting_depth -= 1
current_string += character
if current_string != "":
all_strings.append(current_string)
return [string.strip() for string in all_strings]