mpilot.params

class mpilot.params.Parameter(required: bool = True)
Parameters:

required (bool) – If True, this argument is required and will cause the model execution to fail if it’s not present.

clean(value: Any, program: Any | None = None, lineno: int | None = None) Any

Clean and validate a raw parameter value

class mpilot.params.StringParameter(**kwargs)

Bases: Parameter

class mpilot.params.NumberParameter(required: bool = True)

Bases: Parameter

class mpilot.params.BooleanParameter(required: bool = True)

Bases: Parameter

class mpilot.params.PathParameter(must_exist=True, **kwargs)

Bases: StringParameter

Parameters:

must_exist (bool) – If True, the path is required to already exist when the model is run.

class mpilot.params.ResultParameter(output_type=None, is_fuzzy=None, **kwargs)

Bases: Parameter

Parameters:
  • output_type (Parameter) – The output type of the result. For example:

  • is_fuzzy (Optional[bool]) –

    If True, the input is required be fuzzy, if False, the input cannot be fuzzy. If None, either fuzzy of non-fuzzy is accepted.

    ResultParameter(NumberParameter())
    

    … denotes a result that is of a “Number” type. During validation, the output type of the result is checked against output_type.

class mpilot.params.ListParameter(value_type=<mpilot.params.Parameter object>, **kwargs)

Bases: Parameter

Parameters:

value_type (Parameter) –

The list item type. All items in the list will be validated for this type. E.g., for a list of numbers:

ListParameter(NumberParameter())

class mpilot.params.TupleParameter(required: bool = True)

Bases: Parameter

class mpilot.params.DataParameter(required: bool = True)

Bases: Parameter

class mpilot.params.DataTypeParameter(valid_types={'Float': float, 'Integer': int}, **kwargs)

Bases: StringParameter

Parameters:

valid_types (Dict[str,Any]) –

A dictionary in which the keys are values that can be passed to this argument and the values are the type used to transform the data. For example, to accept either integer or floating point data types:

DataTypeParameter(valid_types={"Integer": int, "Float": float})