Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif isinstance(event, yaml.SequenceStartEvent):
contents = []
while True:
item = _parse_events_list(events_list)
if isinstance(item, yaml.SequenceEndEvent):
end_event = item
return YamlList(event, end_event, contents)
contents.append(item)
elif isinstance(event, yaml.MappingStartEvent):
keys = []
vals = []
while True:
key = _parse_events_list(events_list)
if isinstance(key, yaml.MappingEndEvent):
end_event = key
return YamlDict(event, end_event, keys, vals)
keys.append(key)
val = _parse_events_list(events_list)
vals.append(val)
else:
raise RuntimeError("Unknown parse event type", event)