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. If allow_flow_style is True, Map indentation is not checked for consistency, as the indentation level is dependent on the map key length.
from strictyaml import Map, Int, MapPattern, Seq, Str, Any, dirty_load
schema = Map({"foo": Map({"a": Any(), "b": Any(), "c": Any()}), "y": MapPattern(Str(), Str()), "z": Seq(Str())})
Flow style mapping:
foo: { a: 1, b: 2, c: 3 }
y: {}
z: []
assert dirty_load(yaml_snippet, schema, allow_flow_style=True) == {"foo": {"a": "1", "b": "2", "c": "3"}, "y": {}, "z": []}
Executable specification
Documentation automatically generated from dirty-load.story storytests.