eelib.utils.validation

Provide a dictionary of type and value validation rules and validate given parameters or print a readable string of the given set of rules.

Author: elenia@TUBS
Copyright 2024 elenia
This file is part of eELib, which is free software under the terms of the GNU GPL Version 3.

Module Contents

Functions

validate_init_parameters(model_class, input_param_dict)

Validate the type and value of a list of parameters according to a provided dictionary.

format_valid_parameters_dictionary(valid_parameters)

Take the valid parameters dictionary of a model and transform it into a readable string

validate_init_parameters(model_class, input_param_dict: dict)

Validate the type and value of a list of parameters according to a provided dictionary.

Parameters:
  • model_class (class) – a class representing a component. This should contain a method get_valid_parameters() that returns a dictionary.

  • input_param_dict (dict) – a dictionary of parameter name value pairs to be assessed and validated.

Raises:
  • TypeError – Invalid parameter input types

  • ValueError – Invalid parameter input values

format_valid_parameters_dictionary(valid_parameters: dict)
Take the valid parameters dictionary of a model and transform it into a readable string

format for the purpose of displaying it.

Parameters:

valid_parameters (dict) – a dictionary representing valid parameter types and values

Returns:

Message string with the collected errors from input validation

Return type:

str