config

Config module.

wmflib.config.load_yaml_config(config_file: str | PathLike, raises: bool = True) Dict[source]

Parse a YAML config file and return it, optionally not failing on error.

Parameters:
  • config_file (str) – the path of the configuration file.

  • raises (bool, optional) – whether to raise exception if unable to load the config.

Returns:

the parsed config or an empty dictionary as a fallback when raises is False.

Return type:

dict

Raises:

WmflibError – if unable to load the configuration and raises is True.

wmflib.config.load_ini_config(config_file: str | PathLike, raises: bool = True) ConfigParser[source]

Parse an INI config file and return it.

Parameters:

config_file (str) – the path of the configuration file.

Returns:

the parsed config.

Return type:

configparser.ConfigParser