Skip to main content

Python function

convert_max_config_value

convert_max_config_value()

max.pipelines.lib.convert_max_config_value(config_class, value, field_type, field_name)

source

Converts a config value to the appropriate type.

Handles enums, Optional types, Union types, lists, and basic types.

Parameters:

  • config_class (type[MAXConfig]) – The MAXConfig class requesting the conversion (required for enum resolution).
  • value (Any) – The value from the configuration file.
  • field_type (Any) – The expected type of the field.
  • field_name (str) – The name of the field (for error messages).

Returns:

The converted value.

Raises:

ValueError – If the value cannot be converted.

Return type:

Any