colour.utilities.validate_method#
- colour.utilities.validate_method(method: str, valid_methods: tuple, message: str = '"{0}" method is invalid, it must be one of {1}!', as_lowercase: bool = True) str [source]#
Validate whether given method exists in the given valid methods and optionally returns the method lower cased.
- Parameters:
- Returns:
Method optionally lower cased.
- Return type:
- Raises:
ValueError – If the method does not exist.
Examples
>>> validate_method("Valid", ("Valid", "Yes", "Ok")) 'valid' >>> validate_method("Valid", ("Valid", "Yes", "Ok"), as_lowercase=False) 'Valid'