inputs
inputs
Input parameter models and validation.
Classes
InputError
Bases: Exception
Base input error
Input
Bases: Base
Represents a slider in the front end. Inputs have default values, units and keys and may have a user value or be disabled by a coupling setting.
Source code in src/pyetm/models/base.py
Attributes
merged_value
property
Returns the merged value: user value if set, otherwise default value. Raises a warning if both user and default are None/NaN.
Functions
is_valid_update
Returns a WarningCollector with validation warnings without updating the current object.
Source code in src/pyetm/models/inputs.py
from_json
classmethod
Initialize an Input from a JSON-like tuple coming from .items()
Source code in src/pyetm/models/inputs.py
class_type
staticmethod
Return the appropriate Input subclass for the given unit
check_reset
classmethod
If a reset value is sent, treat it as setting the user value to None
Source code in src/pyetm/models/inputs.py
BoolInput
Bases: Input
Input representing a boolean. Uses floats to represent bools (1.0 true, 0.0 false)
Source code in src/pyetm/models/base.py
EnumInput
Bases: Input
Input representing an enumeration
Source code in src/pyetm/models/base.py
FloatInput
Bases: Input
Input representing a float
Source code in src/pyetm/models/base.py
Inputs
Bases: Base
A collection of Inputs.
Source code in src/pyetm/models/inputs.py
Functions
get_input_by_key
is_valid_update
Returns a dict mapping input keys to their WarningCollectors when errors were found.
Source code in src/pyetm/models/inputs.py
update
Update the values of certain inputs with validation and warning display.
Invalid values are rejected (not applied) to maintain data integrity. Warnings are automatically displayed for invalid values and non-existent keys. Warnings from previous updates are cleared to show only current operation issues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_vals
|
Dict[str, Any]
|
Dictionary mapping input keys to new values |
required |