Dirty load

StrictYAML refuses to parse flow style and node anchors by default, but since there have since been some requests to parse flow style, this now allowed with the “dirty_load” method.

from strictyaml import Map, Int, MapPattern, Seq, Str, Any, dirty_load

schema = Map({"x": Map({"a": Any(), "b": Any(), "c": Any()}), "y": MapPattern(Str(), Str()), "z": Seq(Str())})

Flow style mapping:

x: { a: 1, b: 2, c: 3 }
y: {}
z: []
assert dirty_load(yaml_snippet, schema, allow_flow_style=True) == {"x": {"a": "1", "b": "2", "c": "3"}, "y": {}, "z": []}

Executable specification

Page automatically generated from dirty-load.story.