How to use the peru.edit_yaml.YamlDict function in peru

To help you get started, we’ve selected a few peru examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buildinspace / peru / peru / edit_yaml.py View on Github external
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)