avl._core.enum module
- class avl._core.enum.Enum(name: str, value: ~typing.Any, values: dict[str, ~typing.Any], auto_random: bool = True, fmt: ~collections.abc.Callable[[...], ~typing.Any] = <class 'str'>)[source]
- __init__(name: str, value: ~typing.Any, values: dict[str, ~typing.Any], auto_random: bool = True, fmt: ~collections.abc.Callable[[...], ~typing.Any] = <class 'str'>) None[source]
Initialize an enumeration variable. This class represents an enumeration variable that can take on a set of predefined values. The variable can be automatically randomized if auto_random is set to True.
- Parameters:
name (str) – The name of the variable.
value (Any) – The initial value of the variable. It should be one of the values defined in values.
values (dict[str, Any]) – A dictionary where keys are the names of the enumeration values and values are the corresponding values.
auto_random (bool) – If True, the variable can be automatically randomized. Defaults to True.
- Raises:
ValueError – If the provided value is not in the list of values.