sevnpy.check_allowed

sevnpy.utility.utility.check_allowed(input: str | float | int, allowed_list: tuple | None = None) str | float | int[source]

Check if the input value is in the allowed_list

Parameters:
  • input (str,float,int) – input value to check

  • allowed_list (tuple or None) – tuple of allowed values

Returns:

result – Return the input value if it is in the allowed_list or if allowed_list if None otherwise raise a Value Error

Return type:

str|float|int

Raises:

ValueError – if the input value is not in the allowed_list

Examples

>>> a="S"
>>> b=check_allowed("S", allowed_list=("S","B"))
'S'