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.

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

classmethod retrieve_settings()[source]
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 get_section(*args, **kwargs)[source]
classmethod get_option(*args, **kwargs)[source]
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 get_config_path(*args, **kwargs)[source]
classmethod display_config_path(*args, **kwargs)[source]
classmethod view_config_file(*args, **kwargs)[source]
classmethod display_config_block_details(block)[source]

Display the values of a config block.

Parameters:

block – Block to print

Returns:

None

classmethod has_section(*args, **kwargs)[source]
classmethod has_option()[source]
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