torchsig.utils.verify.verify_str¶
- torchsig.utils.verify.verify_str(s: str, name: str, valid: list[str] = [], str_format: str = 'lower') str[source]¶
Verifies that the value s is a string and optionally formats it according to the specified format.
- Parameters:
s (str) – The value to be checked.
name (str) – The name of the value to be used in error messages.
valid (List[str], optional) – A list of valid string values. Defaults to an empty list.
str_format (str, optional) – The format for the string. Can be “lower”, “upper”, or “title”. Defaults to “lower”.
- Raises:
ValueError – If s is not a string or if it is not in the list of valid values.
- Returns:
The verified string value s in the specified format.
- Return type: