MatterMiners / cobald

Cobald is an Opportunistic Balancing Deamon
https://cobald.readthedocs.io
MIT License
11 stars 12 forks source link

Add basic yaml math evaluation tag #73

Open maxfischer2781 opened 4 years ago

maxfischer2781 commented 4 years ago

The YAML format does not allow for math or other convenience syntax. cobald could provide a YAML tag plugin for basic evaluation and unit replacement.

Before:

maxBytes: 10485760

After:

maxBytes: !eval 10 MiB

maxBytes: !eval 10 * 1024 * 1024

Possible to use ast.literal_eval for the evaluation part.

maxfischer2781 commented 4 years ago

It could be worth using pyparsing to offer lambda support.