Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
or isinstance(event, yaml.DocumentStartEvent)):
ret = _parse_events_list(events_list)
events_list.pop(-1)
return ret
elif (isinstance(event, yaml.ScalarEvent)
or isinstance(event, yaml.AliasEvent)
or isinstance(event, yaml.SequenceEndEvent)
or isinstance(event, yaml.MappingEndEvent)):
return event
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)