devctrl.utility.config_file.ConfigFile#

class ConfigFile(filepath: str, init_values=None)[source]#

Bases: object

Class managing a yaml config file. The file is loaded on creation and can be saved with .save().

You may initialize an instance with empty string as filepath, in this case no file will not be loaded or saved.

Methods

get

get_or

get_path

Get a path with ~ and environment variables expanded :raise KeyError: if name is not a valid key

get_path_or

get_values

Get a copy of the values dictionary

save

Save the current variables to the config file

set

set_values

Set the values from a dictionary

get_path(name: str)[source]#

Get a path with ~ and environment variables expanded :raise KeyError: if name is not a valid key

get_values() dict[source]#

Get a copy of the values dictionary

save()[source]#

Save the current variables to the config file

set_values(values: dict)[source]#

Set the values from a dictionary