strictyaml
strictyaml copied to clipboard
Helpers to construct YAML to ease dumping
It's possible to load, modify and dump YAML to a file.
>>> load(yaml_snippet)
YAML(OrderedDict([('name', 'Ford Prefect'), ('age', '42'), ('possessions', ['Towel'])]))
>>> person = load(yaml_snippet, schema)
>>> person['age'] = 43
>>> person.as_yaml()
If one wants to construct YAML without loading YAML before using YAML(...)
to construct YAML is quite inconvenient. Would it be possible to add helpers to help in constructing instances?
If I'm reading you correctly, as_document is supposed to do what you want. Is that right?
On Mon, 10 Feb 2020, 08:55 Florian Kromer, [email protected] wrote:
It's possible to load, modify and dump YAML to a file https://github.com/crdoconnor/strictyaml/issues/19.
load(yaml_snippet) YAML(OrderedDict([('name', 'Ford Prefect'), ('age', '42'), ('possessions', ['Towel'])])) person = load(yaml_snippet, schema) person['age'] = 43 person.as_yaml()
If one wants to construct YAML without loading YAML before using YAML(...) to construct YAML is quite inconvenient. Would it be possible to add helpers to help in constructing instances?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crdoconnor/strictyaml/issues/87?email_source=notifications&email_token=ABOJKNLR2CRDK62YZWS6UV3RCEI65A5CNFSM4KSJ7SG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IMFXYOA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOJKNMI7FU2QVMU6UAQN4DRCEI65ANCNFSM4KSJ7SGQ .
Yes. In the meanwhile I've found out how to use as_document
. Refer e.g. to usage in the tests.
Ill make an example in the readme. It's not very obvious where it is right now.
On Mon, 10 Feb 2020, 12:57 Florian Kromer, [email protected] wrote:
Yes. In the meanwhile I've found out how to use as_document. Refer e.g. to usage in the tests https://github.com/crdoconnor/strictyaml/blob/3148346bc56207c0700cf8d52a1de37840614df6/hitch/story/build-yaml-document-from-scratch.story .
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crdoconnor/strictyaml/issues/87?email_source=notifications&email_token=ABOJKNKYAMM3HKYO5HQ6LWLRCFFLDA5CNFSM4KSJ7SG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELIM4DQ#issuecomment-584109582, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOJKNIFCC7LEA5A7XPYATDRCFFLDANCNFSM4KSJ7SGQ .
Right. Thanks!