Skip to content

model

Model implementation for MLTE evidence.

ArrayValueModel

Bases: BaseModel

The model implementation for MLTE array values.

Source code in mlte/evidence/model.py
108
109
110
111
112
113
114
115
class ArrayValueModel(BaseModel):
    """The model implementation for MLTE array values."""

    evidence_type: Literal[EvidenceType.ARRAY] = EvidenceType.ARRAY
    """An identitifier for the evidence type."""

    data: List[Any]
    """The array to capture."""

data instance-attribute

The array to capture.

evidence_type = EvidenceType.ARRAY class-attribute instance-attribute

An identitifier for the evidence type.

EvidenceModel

Bases: BaseModel

The model implementation for MLTE evidence.

Source code in mlte/evidence/model.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class EvidenceModel(BaseModel):
    """The model implementation for MLTE evidence."""

    artifact_type: Literal[ArtifactType.EVIDENCE] = ArtifactType.EVIDENCE
    """Union discriminator."""

    metadata: EvidenceMetadata
    """Evidence information (id and measurement it came from)."""

    evidence_class: str
    """Full path to class that implements this evidence."""

    value: Union[
        "IntegerValueModel",
        "RealValueModel",
        "OpaqueValueModel",
        "ImageValueModel",
        "ArrayValueModel",
        "StringValueModel",
    ] = Field(..., discriminator="evidence_type")
    """The body of the evidence."""

artifact_type = ArtifactType.EVIDENCE class-attribute instance-attribute

Union discriminator.

evidence_class instance-attribute

Full path to class that implements this evidence.

metadata instance-attribute

Evidence information (id and measurement it came from).

value = Field(..., discriminator='evidence_type') class-attribute instance-attribute

The body of the evidence.

EvidenceType

Bases: StrEnum

An ennumeration over supported evidence types.

Source code in mlte/evidence/model.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class EvidenceType(StrEnum):
    """An ennumeration over supported evidence types."""

    INTEGER = "integer"
    """An integral type."""

    REAL = "real"
    """A real type."""

    OPAQUE = "opaque"
    """An opaque type."""

    IMAGE = "image"
    """An image media type."""

    ARRAY = "array"
    """An array of values."""

    STRING = "string"
    """A string media type."""

ARRAY = 'array' class-attribute instance-attribute

An array of values.

IMAGE = 'image' class-attribute instance-attribute

An image media type.

INTEGER = 'integer' class-attribute instance-attribute

An integral type.

OPAQUE = 'opaque' class-attribute instance-attribute

An opaque type.

REAL = 'real' class-attribute instance-attribute

A real type.

STRING = 'string' class-attribute instance-attribute

A string media type.

ImageValueModel

Bases: BaseModel

The model implementation for MLTE image values.

Source code in mlte/evidence/model.py
 98
 99
100
101
102
103
104
105
class ImageValueModel(BaseModel):
    """The model implementation for MLTE image values."""

    evidence_type: Literal[EvidenceType.IMAGE] = EvidenceType.IMAGE
    """An identitifier for the evidence type."""

    data: str
    """The image data as base64-encoded string."""

data instance-attribute

The image data as base64-encoded string.

evidence_type = EvidenceType.IMAGE class-attribute instance-attribute

An identitifier for the evidence type.

IntegerValueModel

Bases: BaseModel

The model implementation for MLTE integer values.

Source code in mlte/evidence/model.py
62
63
64
65
66
67
68
69
70
71
72
class IntegerValueModel(BaseModel):
    """The model implementation for MLTE integer values."""

    evidence_type: Literal[EvidenceType.INTEGER] = EvidenceType.INTEGER
    """An identitifier for the evidence type."""

    integer: int
    """The encapsulated value."""

    unit: Optional[str] = None
    """The unit associated with this value, if any."""

evidence_type = EvidenceType.INTEGER class-attribute instance-attribute

An identitifier for the evidence type.

integer instance-attribute

The encapsulated value.

unit = None class-attribute instance-attribute

The unit associated with this value, if any.

OpaqueValueModel

Bases: BaseModel

The model implementation for MLTE opaque values.

Source code in mlte/evidence/model.py
88
89
90
91
92
93
94
95
class OpaqueValueModel(BaseModel):
    """The model implementation for MLTE opaque values."""

    evidence_type: Literal[EvidenceType.OPAQUE] = EvidenceType.OPAQUE
    """An identitifier for the evidence type."""

    data: Dict[str, Any]
    """Encapsulated, opaque data."""

data instance-attribute

Encapsulated, opaque data.

evidence_type = EvidenceType.OPAQUE class-attribute instance-attribute

An identitifier for the evidence type.

RealValueModel

Bases: BaseModel

The model implementation for MLTE real values.

Source code in mlte/evidence/model.py
75
76
77
78
79
80
81
82
83
84
85
class RealValueModel(BaseModel):
    """The model implementation for MLTE real values."""

    evidence_type: Literal[EvidenceType.REAL] = EvidenceType.REAL
    """An identitifier for the evidence type."""

    real: float
    """The encapsulated value."""

    unit: Optional[str] = None
    """The unit associated with this value, if any."""

evidence_type = EvidenceType.REAL class-attribute instance-attribute

An identitifier for the evidence type.

real instance-attribute

The encapsulated value.

unit = None class-attribute instance-attribute

The unit associated with this value, if any.

StringValueModel

Bases: BaseModel

The model implementation for MLTE string values.

Source code in mlte/evidence/model.py
118
119
120
121
122
123
124
125
class StringValueModel(BaseModel):
    """The model implementation for MLTE string values."""

    evidence_type: Literal[EvidenceType.STRING] = EvidenceType.STRING
    """An identitifier for the evidence type."""

    string: str
    """The encapsulated string."""

evidence_type = EvidenceType.STRING class-attribute instance-attribute

An identitifier for the evidence type.

string instance-attribute

The encapsulated string.