shared.configuration_parser
- shared.configuration_parser.parse_configuration_file(config_file_path=None)[source]
Parses a configuration file and returns a dictionary with the configuration.
If a configuration file path is provided and the file exists, it will be used to load the configuration. If the provided file path does not exist, or if no path is provided, a default configuration file will be created and a warning message will be logged.
- Parameters:
config_file_path (str, optional) – The path to the configuration file. Default is
- Returns:
A dictionary representing the configuration.
- Return type:
dict
- Raises:
AssertionError – If the configuration file cannot be loaded.
Usage:
config = parse_configuration_file('config.json') # Load configuration from 'config.json'
- shared.configuration_parser.write_example_configuration_file(file_name: str)[source]
Writes an example configuration file.
This function creates a configuration file with default settings in the current working directory. If a file name is not provided, it uses a default name.
- Parameters:
file_name (str, optional) – The name of the file to be created.
- Raises:
Exception – Logs an error if the example configuration file cannot be written.
Usage:
write_example_configuration_file('example_config.json') # Creates 'example_config.json' with default settings