Skip to content

Expand configuration options

Ethan Nelson requested to merge yaml-to-dict-option into master

For your consideration....

I am presently importing yori's functions into a script as opposed to calling it from the command line. Though it is possible to write a config file when running the script, I thought defining a dictionary and passing it to the function would be easier--especially if I want to recursively test different configurations.

This MR expands the ConfigReader capability by allowing either a filename, dictionary, or YAML string to be passed as input. Depending on the input, the function either reads the file and parses the YAML, takes the dictionary as-is, or parses the YAML string. In any case, it then passes the resulting objects to the validation as before. Scripts that call the ConfigReader have been modified to accommodate these changes as well.

I'm not sure if this is desired in the codebase, and if it is, whether this strategy is preferred.

Regarding testing, I ran py.test locally and it worked. I also ran the scripts I was using Yori in and they continued to reproduce the same results both a) when reading a YAML file and b) when using a supplied dictionary.

Merge request reports