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)

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')

Bases: object

Class that parses an INI configuration file.

classmethod retrieve_dict_config_block(field_type, section) Dict[str, Any]

Retrieve dictionary config block.

Parameters:
  • field_type – Field type

  • section – Section to load

Returns:

Dictionary of the config block

classmethod retrieve_settings()
static get_global_configuration_name() str

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 get_section(*args, **kwargs)
classmethod get_option(*args, **kwargs)
classmethod is_progress_bar_disabled() bool

Are progress bars disabled.

Returns:

Return is progress bars should be enabled

classmethod is_output_enabled() bool

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

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 get_config_path(*args, **kwargs)
classmethod display_config_path(*args, **kwargs)
classmethod view_config_file(*args, **kwargs)
classmethod display_config_block_details(block)

Display the values of a config block.

Parameters:

block – Block to print

Returns:

None

classmethod has_section(*args, **kwargs)
classmethod has_option()
classmethod found_ini() bool

Did we find the config?

Returns:

True if did, False Otherwise

classmethod clear_instance() None

Uninitialize and clean the IdmConfigParser instance.

Returns:

None