Skip to content

Class swarmauri_base.measurements.MeasurementCalculateMixin.MeasurementCalculateMixin

swarmauri_base.measurements.MeasurementCalculateMixin.MeasurementCalculateMixin

Bases: IMeasurementCalculate, BaseModel

A base implementation of the IMeasurement interface that provides the foundation for specific measurement implementations.

update

update(value)

Update the measurement value based on new information. This should be used internally by the calculate method or other logic.

Source code in swarmauri_base/measurements/MeasurementCalculateMixin.py
14
15
16
17
18
19
def update(self, value) -> None:
    """
    Update the measurement value based on new information.
    This should be used internally by the `calculate` method or other logic.
    """
    self.value = value

calculate abstractmethod

calculate(**kwargs)

Calculate the measurement based on the provided data. This method must be implemented by subclasses to define specific calculation logic.

Source code in swarmauri_base/measurements/MeasurementCalculateMixin.py
21
22
23
24
25
26
27
@abstractmethod
def calculate(self, **kwargs) -> Any:
    """
    Calculate the measurement based on the provided data.
    This method must be implemented by subclasses to define specific calculation logic.
    """
    raise NotImplementedError("calculate is not implemented yet.")