idmtools.config.idm_config_parser module#
idmtools IdmConfig paraer, the main configuration engine for idmtools.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- idmtools.config.idm_config_parser.initialization(force=False)[source]#
Initialization decorator for configuration methods.
- Parameters:
force – Force initialization
- Returns:
Wrapper function
- class idmtools.config.idm_config_parser.IdmConfigParser(dir_path: str = '.', file_name: str = 'idmtools.ini')[source]#
Bases:
object
Class that parses an INI configuration file.
- static __new__(cls, dir_path: str = '.', file_name: str = 'idmtools.ini') IdmConfigParser [source]#
Make
IdmConfigParser
creation a singleton.- Parameters:
dir_path – The INI configuration file directory.
file_name – The INI file name.
- Returns:
An
IdmConfigParser
instance.
- classmethod retrieve_dict_config_block(field_type, section) Dict[str, Any] [source]#
Retrieve dictionary config block.
- Parameters:
field_type – Field type
section – Section to load
- Returns:
Dictionary of the config block
- static get_global_configuration_name() str [source]#
Get Global Configuration Name.
- Returns:
On Windows, this returns %LOCALDATA%\idmtools\idmtools.ini On Mac and Linux, it returns “/home/username/.idmtools.ini’
- Raises:
Value Error on OSs not supported –
- classmethod is_progress_bar_disabled() bool [source]#
Are progress bars disabled.
- Returns:
Return is progress bars should be enabled
- classmethod is_output_enabled() bool [source]#
Is output enabled.
- Returns:
Return if output should be disabled
- classmethod ensure_init(dir_path: str = '.', file_name: str = 'idmtools.ini', force: bool = False) None [source]#
Verify that the INI file loaded and a configparser instance is available.
- Parameters:
dir_path – The directory to search for the INI configuration file.
file_name – The configuration file name to search for.
force – Force reload of everything
- Returns:
None
- Raises:
ValueError – If the config file is found but cannot be parsed
- classmethod display_config_block_details(block)[source]#
Display the values of a config block.
- Parameters:
block – Block to print
- Returns:
None
- classmethod found_ini() bool [source]#
Did we find the config?
- Returns:
True if did, False Otherwise
- classmethod clear_instance() None [source]#
Uninitialize and clean the
IdmConfigParser
instance.- Returns:
None