nicetoolbox.utils.check_and_exception.check_user_input_config

nicetoolbox.utils.check_and_exception.check_user_input_config(config, check, config_name, var=None)[source]

Check a given configuration dictionary for correct user inputs based on a template dictionary describing the valid inputs.

Parameters:
  • config (dict) – The config that contains all inputs to be checked.

  • check (dict) – The template specifying which inputs are valid for each dict key.

  • config_name (str) – The name of the config to be checked, used for more descriptive logs.

Note

The keys of ‘check’ must include the keys of ‘config’. Syntax of the dict values:

‘type:<str/int/bool/…>’: specifies the valid data type ‘folder:<base/full>’: requires existence of the folder (in case of ‘full’)

or parent-folder (in case of ‘base’)

‘file’: requires that the file is existing on the system ‘keys:<toml_filepath>’: valid options are all keys from the dict given

by the toml_filepath

‘tbd’: not yet defined in the template dict ‘check’,

will write a warning to log

[<>, …]: list of valid options, may contain all basetypes