abc-classroom.config

abcclassroom.config.get_config(configpath=None)[source]

Attempts to read a config file at the provided path (or at “config.yml” if no path provided). Throws FileNotFoundError if no config file found, and RuntimeError if there is a problem reading the file.

Returns

Yaml object that contains the contents of the config file.

Return type

ruamel.yaml.comments.CommentedMap

abcclassroom.config.get_config_option(config, option, required=True)[source]

Get an option (value of key) from provided config dictionary. If the key does not exist, exit with KeyError (required=True) or return None (required=False).

abcclassroom.config.print_config(config=None, configpath=None)[source]

Print configuration. Can supply as dictionary parameter, or specify a path to look for config.yml. If neither option specified, looks for config.yml in current working directory. If both specified, prints dictionary, not from file.

abcclassroom.config.set_config_option(config, option, value, append_value=False, configpath=None)[source]

Sets a config option. If option already exists and append_value is False, replaces existing value. If option exists and append_value is true, adds new value to list of existing values. Will not add a duplicate value.

Writes the new config (overwriting the existing file) and returns new config dict.

abcclassroom.config.write_config(config, configpath=None)[source]