condition
mlte/validation/condition.py
The interface for measurement validation.
Condition
The Condition class defines the interface for measurement validators.
Source code in mlte/spec/condition.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
arguments = arguments
instance-attribute
The threshold arguments used when creating the condition.
name = name
instance-attribute
The human-readable identifier for the name method.
validator = validator
instance-attribute
The validator that implements validation.
value_class = value_class
instance-attribute
Value type class where this Condition came from, if any.
__call__(value)
Invoke the validation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Value
|
The value of measurement evaluation |
required |
Returns:
Type | Description |
---|---|
Result
|
The result of measurement validation |
Source code in mlte/spec/condition.py
54 55 56 57 58 59 60 61 62 63 64 |
|
__eq__(other)
Compare Condition instances for equality.
Source code in mlte/spec/condition.py
134 135 136 137 138 139 |
|
__init__(name, arguments, validator, value_class=None)
Initialize a Condition instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the name method, for documenting purposes. |
required |
arguments
|
List[Any]
|
The list of arguments/thresholds passed to the callable. |
required |
validator
|
Validator
|
The Validator that implements validation. |
required |
value_class
|
Optional[str]
|
The full module + class name of the Value that generated this condition, if any. |
None
|
Source code in mlte/spec/condition.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
__str__()
Return a string representation of Condition.
Source code in mlte/spec/condition.py
126 127 128 |
|
build_condition(bool_exp=None, success=None, failure=None, info=None)
staticmethod
Creates a Condition using the provided test, extracting context info from the method that called us.
Source code in mlte/spec/condition.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
from_model(model)
classmethod
Deserialize a Condition from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
ConditionModel
|
The model. |
required |
Returns:
Type | Description |
---|---|
Condition
|
The deserialized Condition |
Source code in mlte/spec/condition.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
to_model()
Returns this condition as a model.
Returns:
Type | Description |
---|---|
ConditionModel
|
The serialized model object. |
Source code in mlte/spec/condition.py
96 97 98 99 100 101 102 103 104 105 106 107 |
|