Main Interface

class yact.Config(filename, unsafe=False, auto_reload=False)[source]

The Config object is a wrapper around YAML data. For most use cases, the basic functionality of reading a YAML file (extension does not matter) is sufficient.

While not currently tested, unsafe loading of YAML files is supported using the unsafe flag.

get(key, default=None)[source]

Retrieve the value of a key (or consecutive keys joined by periods) or default, similar to dict.get

remove(key)[source]

Remove an item from configuration file

Establishes lock on configuration data, deletes config entry matching the passed in key. Saves updated configuration back to file.

save()[source]

Save current configuration back to file in YAML format

Acquires configuration lock, opens file in overwrite mode (‘w’) and writes the output of yaml.dump to the file object. default_flow_style is set to false to force proper YAML formatting

sections

Provided for users of the standard ConfigParser module.

set(key, value)[source]

Set the value of a provided key (or nested keys joined by periods) to the provided value