flowserv.model.parameter.enum module
Declarations for enumeration parameter values. Enumeration parameters contain a list of valid parameter values. These values are defined by a printable ‘name’ and an associated ‘value’.
- flowserv.model.parameter.enum.Option(name: str, value: Union[str, int], default: Optional[bool] = None) Dict
Get a dictionary serialization for an element in the enumeration of valid values for a select parameter.
- Parameters
name (string) – Option display name.
value (string or int) – Returned value if this option is selected.
default (bool, default=None) – Indicate if this is the default option for the selection.
- Return type
dict
- class flowserv.model.parameter.enum.Select(name: str, values: List[Dict], index: Optional[int] = 0, label: Optional[str] = None, help: Optional[str] = None, default: Optional[bool] = None, required: Optional[bool] = False, group: Optional[str] = None)
Bases:
flowserv.model.parameter.base.ParameterEnumeration parameter type for select boxes. Extends the base parameter with a list of possible argument values.
- cast(value: Any) Any
Ensure that the given value is valid. If the value is not contained in the enumerated list of values an error is raised.
- Parameters
value (any) – User-provided value for a template parameter.
- Return type
sting
- Raises
- static from_dict(doc: Dict, validate: Optional[bool] = True) flowserv.model.parameter.enum.Select
Get select parameter instance from a dictionary serialization.
- Parameters
doc (dict) – Dictionary serialization for select parameter declaration.
validate (bool, default=True) – Validate the serialized object if True.
- Return type
- Raises
- to_dict() Dict
Get dictionary serialization for the parameter declaration. Adds list of enumerated values to the base serialization.
- Return type
dict