opencolorio_config_aces.utilities.validate_method#

opencolorio_config_aces.utilities.validate_method(method, valid_methods, message='"{0}" method is invalid, it must be one of {1}!')[source]#

Validate whether given method exists in the given valid methods and returns the method lower cased.

Parameters:
  • method (str) – Method to validate.

  • valid_methods (Union[Sequence, Mapping]) – Valid methods.

  • message (str) – Message for the exception.

Returns:

Method lower cased.

Return type:

str

Raises:

ValueError – If the method does not exist.

Examples

>>> validate_method('Valid', ['Valid', 'Yes', 'Ok'])
'valid'