odxtools 9.7.0__py3-none-any.whl → 10.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odxtools/additionalaudience.py +3 -3
- odxtools/admindata.py +8 -8
- odxtools/audience.py +10 -10
- odxtools/basecomparam.py +5 -5
- odxtools/basevariantpattern.py +4 -5
- odxtools/basicstructure.py +8 -8
- odxtools/cli/_print_utils.py +35 -23
- odxtools/cli/browse.py +9 -9
- odxtools/cli/compare.py +24 -24
- odxtools/cli/decode.py +3 -4
- odxtools/cli/find.py +4 -5
- odxtools/cli/list.py +7 -7
- odxtools/cli/main.py +2 -2
- odxtools/cli/snoop.py +3 -3
- odxtools/codec.py +3 -3
- odxtools/commrelation.py +11 -11
- odxtools/companydata.py +5 -5
- odxtools/companydocinfo.py +8 -8
- odxtools/companyrevisioninfo.py +5 -5
- odxtools/companyspecificinfo.py +5 -5
- odxtools/comparam.py +3 -3
- odxtools/comparaminstance.py +10 -10
- odxtools/comparamspec.py +3 -3
- odxtools/comparamsubset.py +5 -5
- odxtools/complexcomparam.py +7 -7
- odxtools/compositecodec.py +11 -11
- odxtools/compumethods/compucodecompumethod.py +4 -4
- odxtools/compumethods/compuconst.py +4 -5
- odxtools/compumethods/compudefaultvalue.py +1 -2
- odxtools/compumethods/compuinternaltophys.py +6 -6
- odxtools/compumethods/compumethod.py +5 -5
- odxtools/compumethods/compuphystointernal.py +6 -6
- odxtools/compumethods/compurationalcoeffs.py +4 -4
- odxtools/compumethods/compuscale.py +9 -10
- odxtools/compumethods/createanycompumethod.py +1 -2
- odxtools/compumethods/identicalcompumethod.py +1 -2
- odxtools/compumethods/limit.py +12 -12
- odxtools/compumethods/linearcompumethod.py +2 -2
- odxtools/compumethods/linearsegment.py +14 -15
- odxtools/compumethods/ratfunccompumethod.py +3 -3
- odxtools/compumethods/ratfuncsegment.py +7 -8
- odxtools/compumethods/scalelinearcompumethod.py +7 -7
- odxtools/compumethods/scaleratfunccompumethod.py +4 -4
- odxtools/compumethods/tabintpcompumethod.py +15 -18
- odxtools/compumethods/texttablecompumethod.py +3 -3
- odxtools/createanycomparam.py +2 -4
- odxtools/createanydiagcodedtype.py +1 -2
- odxtools/database.py +9 -8
- odxtools/dataobjectproperty.py +10 -10
- odxtools/decodestate.py +5 -5
- odxtools/description.py +5 -5
- odxtools/determinenumberofitems.py +4 -4
- odxtools/diagcodedtype.py +7 -7
- odxtools/diagcomm.py +17 -17
- odxtools/diagdatadictionaryspec.py +6 -6
- odxtools/diaglayercontainer.py +4 -4
- odxtools/diaglayers/basevariant.py +10 -9
- odxtools/diaglayers/basevariantraw.py +9 -9
- odxtools/diaglayers/diaglayer.py +20 -19
- odxtools/diaglayers/diaglayerraw.py +10 -10
- odxtools/diaglayers/diaglayertype.py +1 -2
- odxtools/diaglayers/ecushareddata.py +4 -4
- odxtools/diaglayers/ecushareddataraw.py +6 -6
- odxtools/diaglayers/ecuvariant.py +11 -10
- odxtools/diaglayers/ecuvariantraw.py +9 -9
- odxtools/diaglayers/functionalgroup.py +8 -7
- odxtools/diaglayers/functionalgroupraw.py +7 -7
- odxtools/diaglayers/hierarchyelement.py +43 -49
- odxtools/diaglayers/hierarchyelementraw.py +4 -4
- odxtools/diaglayers/protocol.py +4 -4
- odxtools/diaglayers/protocolraw.py +6 -6
- odxtools/diagnostictroublecode.py +8 -8
- odxtools/diagservice.py +18 -18
- odxtools/diagvariable.py +14 -14
- odxtools/docrevision.py +11 -11
- odxtools/dopbase.py +6 -6
- odxtools/dtcconnector.py +3 -3
- odxtools/dtcdop.py +13 -9
- odxtools/dynamicendmarkerfield.py +5 -4
- odxtools/dynamiclengthfield.py +5 -4
- odxtools/dyndefinedspec.py +5 -5
- odxtools/dynenddopref.py +5 -5
- odxtools/dyniddefmodeinfo.py +13 -13
- odxtools/ecuvariantpattern.py +4 -5
- odxtools/element.py +5 -6
- odxtools/encodestate.py +11 -11
- odxtools/encoding.py +2 -3
- odxtools/endofpdufield.py +6 -6
- odxtools/envdataconnector.py +3 -3
- odxtools/environmentdata.py +3 -4
- odxtools/environmentdatadescription.py +11 -11
- odxtools/exceptions.py +5 -5
- odxtools/externalaccessmethod.py +1 -2
- odxtools/externaldoc.py +4 -4
- odxtools/field.py +9 -10
- odxtools/functionalclass.py +4 -4
- odxtools/inputparam.py +6 -6
- odxtools/internalconstr.py +4 -5
- odxtools/isotp_state_machine.py +12 -11
- odxtools/leadinglengthinfotype.py +2 -3
- odxtools/library.py +5 -5
- odxtools/linkeddtcdop.py +4 -4
- odxtools/loadfile.py +5 -6
- odxtools/matchingbasevariantparameter.py +2 -3
- odxtools/matchingparameter.py +7 -7
- odxtools/minmaxlengthtype.py +4 -4
- odxtools/modification.py +4 -4
- odxtools/multiplexer.py +11 -11
- odxtools/multiplexercase.py +6 -6
- odxtools/multiplexerdefaultcase.py +6 -6
- odxtools/multiplexerswitchkey.py +4 -4
- odxtools/nameditemlist.py +14 -14
- odxtools/negoutputparam.py +3 -3
- odxtools/obd.py +1 -2
- odxtools/odxcategory.py +6 -6
- odxtools/odxlink.py +19 -20
- odxtools/odxtypes.py +21 -18
- odxtools/outputparam.py +4 -4
- odxtools/parameterinfo.py +1 -1
- odxtools/parameters/codedconstparameter.py +5 -5
- odxtools/parameters/createanyparameter.py +1 -2
- odxtools/parameters/dynamicparameter.py +2 -3
- odxtools/parameters/lengthkeyparameter.py +5 -5
- odxtools/parameters/matchingrequestparameter.py +3 -4
- odxtools/parameters/nrcconstparameter.py +7 -7
- odxtools/parameters/parameter.py +11 -11
- odxtools/parameters/parameterwithdop.py +9 -9
- odxtools/parameters/physicalconstantparameter.py +4 -4
- odxtools/parameters/reservedparameter.py +3 -4
- odxtools/parameters/systemparameter.py +2 -3
- odxtools/parameters/tableentryparameter.py +3 -3
- odxtools/parameters/tablekeyparameter.py +10 -10
- odxtools/parameters/tablestructparameter.py +7 -7
- odxtools/parameters/valueparameter.py +7 -7
- odxtools/paramlengthinfotype.py +5 -3
- odxtools/parentref.py +9 -9
- odxtools/physicaldimension.py +11 -11
- odxtools/physicaltype.py +3 -4
- odxtools/posresponsesuppressible.py +9 -10
- odxtools/preconditionstateref.py +7 -7
- odxtools/progcode.py +6 -6
- odxtools/protstack.py +4 -4
- odxtools/relateddiagcommref.py +1 -2
- odxtools/relateddoc.py +6 -6
- odxtools/request.py +9 -9
- odxtools/response.py +10 -10
- odxtools/scaleconstr.py +3 -4
- odxtools/servicebinner.py +5 -5
- odxtools/singleecujob.py +4 -4
- odxtools/snrefcontext.py +2 -2
- odxtools/specialdata.py +5 -5
- odxtools/specialdatagroup.py +9 -9
- odxtools/specialdatagroupcaption.py +3 -3
- odxtools/standardlengthtype.py +10 -10
- odxtools/state.py +3 -3
- odxtools/statechart.py +4 -4
- odxtools/statemachine.py +4 -3
- odxtools/statetransition.py +4 -4
- odxtools/statetransitionref.py +18 -18
- odxtools/staticfield.py +5 -4
- odxtools/structure.py +2 -3
- odxtools/subcomponent.py +5 -5
- odxtools/subcomponentparamconnector.py +5 -5
- odxtools/subcomponentpattern.py +4 -4
- odxtools/swvariable.py +3 -4
- odxtools/table.py +14 -14
- odxtools/tablediagcommconnector.py +5 -5
- odxtools/tablerow.py +30 -30
- odxtools/tablerowconnector.py +3 -3
- odxtools/teammember.py +11 -11
- odxtools/text.py +2 -3
- odxtools/uds.py +2 -3
- odxtools/unit.py +9 -9
- odxtools/unitgroup.py +5 -5
- odxtools/unitspec.py +6 -6
- odxtools/utils.py +3 -3
- odxtools/variablegroup.py +2 -2
- odxtools/variantmatcher.py +10 -10
- odxtools/variantpattern.py +3 -3
- odxtools/version.py +2 -2
- odxtools/writepdxfile.py +5 -5
- odxtools/xdoc.py +9 -9
- {odxtools-9.7.0.dist-info → odxtools-10.0.0.dist-info}/METADATA +4 -5
- odxtools-10.0.0.dist-info/RECORD +264 -0
- odxtools-9.7.0.dist-info/RECORD +0 -264
- {odxtools-9.7.0.dist-info → odxtools-10.0.0.dist-info}/WHEEL +0 -0
- {odxtools-9.7.0.dist-info → odxtools-10.0.0.dist-info}/entry_points.txt +0 -0
- {odxtools-9.7.0.dist-info → odxtools-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {odxtools-9.7.0.dist-info → odxtools-10.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .element import IdentifiableElement
|
@@ -14,12 +14,12 @@ class SpecialDataGroupCaption(IdentifiableElement):
|
|
14
14
|
|
15
15
|
@staticmethod
|
16
16
|
def from_et(et_element: ElementTree.Element,
|
17
|
-
doc_frags:
|
17
|
+
doc_frags: list[OdxDocFragment]) -> "SpecialDataGroupCaption":
|
18
18
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
19
19
|
|
20
20
|
return SpecialDataGroupCaption(**kwargs)
|
21
21
|
|
22
|
-
def _build_odxlinks(self) ->
|
22
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
23
23
|
result = {self.odx_id: self}
|
24
24
|
|
25
25
|
result[self.odx_id] = self
|
odxtools/standardlengthtype.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Literal
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from typing_extensions import override
|
@@ -14,12 +14,12 @@ from .odxtypes import AtomicOdxType, BytesTypes, DataType, odxstr_to_bool
|
|
14
14
|
from .utils import dataclass_fields_asdict, read_hex_binary
|
15
15
|
|
16
16
|
|
17
|
-
@dataclass
|
17
|
+
@dataclass(kw_only=True)
|
18
18
|
class StandardLengthType(DiagCodedType):
|
19
19
|
|
20
20
|
bit_length: int
|
21
|
-
bit_mask:
|
22
|
-
is_condensed_raw:
|
21
|
+
bit_mask: int | None = None
|
22
|
+
is_condensed_raw: bool | None = None
|
23
23
|
|
24
24
|
@property
|
25
25
|
def dct_type(self) -> DctType:
|
@@ -32,7 +32,7 @@ class StandardLengthType(DiagCodedType):
|
|
32
32
|
@staticmethod
|
33
33
|
@override
|
34
34
|
def from_et(et_element: ElementTree.Element,
|
35
|
-
doc_frags:
|
35
|
+
doc_frags: list[OdxDocFragment]) -> "StandardLengthType":
|
36
36
|
kwargs = dataclass_fields_asdict(DiagCodedType.from_et(et_element, doc_frags))
|
37
37
|
|
38
38
|
bit_length = int(odxrequire(et_element.findtext("BIT-LENGTH")))
|
@@ -50,7 +50,7 @@ class StandardLengthType(DiagCodedType):
|
|
50
50
|
'Can not apply a bit_mask on a value of type {self.base_data_type}',
|
51
51
|
)
|
52
52
|
|
53
|
-
def __get_used_mask(self, internal_value: AtomicOdxType) ->
|
53
|
+
def __get_used_mask(self, internal_value: AtomicOdxType) -> bytes | None:
|
54
54
|
"""Returns a byte field where all bits that are used by the
|
55
55
|
DiagCoded type are set and all unused ones are not set.
|
56
56
|
|
@@ -118,7 +118,7 @@ class StandardLengthType(DiagCodedType):
|
|
118
118
|
mask_bit += 1
|
119
119
|
|
120
120
|
if isinstance(internal_value, BytesTypes):
|
121
|
-
return result.to_bytes(len(internal_value), 'big')
|
121
|
+
return result.to_bytes(len(bytes(internal_value)), 'big')
|
122
122
|
|
123
123
|
return result
|
124
124
|
|
@@ -156,7 +156,7 @@ class StandardLengthType(DiagCodedType):
|
|
156
156
|
mask_bit += 1
|
157
157
|
|
158
158
|
if isinstance(raw_value, BytesTypes):
|
159
|
-
return result.to_bytes(len(raw_value), 'big')
|
159
|
+
return result.to_bytes(len(bytes(raw_value)), 'big')
|
160
160
|
|
161
161
|
return result
|
162
162
|
if isinstance(raw_value, int):
|
@@ -164,12 +164,12 @@ class StandardLengthType(DiagCodedType):
|
|
164
164
|
if isinstance(raw_value, BytesTypes):
|
165
165
|
int_value = int.from_bytes(raw_value, 'big')
|
166
166
|
int_value &= self.bit_mask
|
167
|
-
return int_value.to_bytes(len(raw_value), 'big')
|
167
|
+
return int_value.to_bytes(len(bytes(raw_value)), 'big')
|
168
168
|
|
169
169
|
odxraise(f'Can not apply a bit_mask on a value of type {type(raw_value)}')
|
170
170
|
return raw_value
|
171
171
|
|
172
|
-
def get_static_bit_length(self) ->
|
172
|
+
def get_static_bit_length(self) -> int | None:
|
173
173
|
if self.bit_mask is not None and self.is_condensed:
|
174
174
|
# TODO: this is pretty slow. replace it by
|
175
175
|
# `self.bit_mask.bit_count()` once we require python >=
|
odxtools/state.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .element import IdentifiableElement
|
@@ -16,12 +16,12 @@ class State(IdentifiableElement):
|
|
16
16
|
"""
|
17
17
|
|
18
18
|
@staticmethod
|
19
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
19
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "State":
|
20
20
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
21
21
|
|
22
22
|
return State(**kwargs)
|
23
23
|
|
24
|
-
def _build_odxlinks(self) ->
|
24
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
25
25
|
return {self.odx_id: self}
|
26
26
|
|
27
27
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/statechart.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .element import IdentifiableElement
|
@@ -19,7 +19,7 @@ class StateChart(IdentifiableElement):
|
|
19
19
|
Corresponds to STATE-CHART.
|
20
20
|
"""
|
21
21
|
semantic: str
|
22
|
-
state_transitions:
|
22
|
+
state_transitions: list[StateTransition]
|
23
23
|
start_state_snref: str
|
24
24
|
states: NamedItemList[State]
|
25
25
|
|
@@ -28,7 +28,7 @@ class StateChart(IdentifiableElement):
|
|
28
28
|
return self._start_state
|
29
29
|
|
30
30
|
@staticmethod
|
31
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
31
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "StateChart":
|
32
32
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
33
33
|
|
34
34
|
semantic: str = odxrequire(et_element.findtext("SEMANTIC"))
|
@@ -52,7 +52,7 @@ class StateChart(IdentifiableElement):
|
|
52
52
|
states=NamedItemList(states),
|
53
53
|
**kwargs)
|
54
54
|
|
55
|
-
def _build_odxlinks(self) ->
|
55
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
56
56
|
odxlinks = {self.odx_id: self}
|
57
57
|
|
58
58
|
for strans in self.state_transitions:
|
odxtools/statemachine.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
|
+
from collections.abc import Generator
|
2
3
|
from dataclasses import dataclass
|
3
|
-
from typing import TYPE_CHECKING, Any
|
4
|
+
from typing import TYPE_CHECKING, Any
|
4
5
|
|
5
6
|
from .exceptions import odxraise
|
6
7
|
from .odxtypes import ParameterValueDict
|
@@ -97,7 +98,7 @@ class StateMachine:
|
|
97
98
|
self._active_state = state_chart.start_state
|
98
99
|
|
99
100
|
def execute(self, service: "DiagService", **service_params: Any
|
100
|
-
) -> Generator[bytes,
|
101
|
+
) -> Generator[bytes, bytes | bytearray | ParameterValueDict, None]:
|
101
102
|
"""Run a diagnostic service and update the state machine
|
102
103
|
depending on the outcome.
|
103
104
|
|
@@ -159,7 +160,7 @@ class StateMachine:
|
|
159
160
|
|
160
161
|
if raw_resp is None:
|
161
162
|
raise RuntimeError("The calling code must send back a reply")
|
162
|
-
elif isinstance(raw_resp,
|
163
|
+
elif isinstance(raw_resp, bytes | bytearray):
|
163
164
|
for decoded_resp_msg in self.diag_layer.decode_response(raw_resp, raw_req):
|
164
165
|
for stransref in service.state_transition_refs:
|
165
166
|
# we only execute the first applicable state
|
odxtools/statetransition.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .element import IdentifiableElement
|
@@ -19,7 +19,7 @@ class StateTransition(IdentifiableElement):
|
|
19
19
|
"""
|
20
20
|
source_snref: str
|
21
21
|
target_snref: str
|
22
|
-
external_access_method:
|
22
|
+
external_access_method: ExternalAccessMethod | None
|
23
23
|
|
24
24
|
@property
|
25
25
|
def source_state(self) -> State:
|
@@ -31,7 +31,7 @@ class StateTransition(IdentifiableElement):
|
|
31
31
|
|
32
32
|
@staticmethod
|
33
33
|
def from_et(et_element: ElementTree.Element,
|
34
|
-
doc_frags:
|
34
|
+
doc_frags: list[OdxDocFragment]) -> "StateTransition":
|
35
35
|
|
36
36
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
37
37
|
|
@@ -50,7 +50,7 @@ class StateTransition(IdentifiableElement):
|
|
50
50
|
external_access_method=external_access_method,
|
51
51
|
**kwargs)
|
52
52
|
|
53
|
-
def _build_odxlinks(self) ->
|
53
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
54
54
|
return {self.odx_id: self}
|
55
55
|
|
56
56
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/statetransitionref.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import TYPE_CHECKING, Any,
|
3
|
+
from typing import TYPE_CHECKING, Any, Union
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .basicstructure import BasicStructure
|
@@ -27,11 +27,11 @@ if TYPE_CHECKING:
|
|
27
27
|
|
28
28
|
|
29
29
|
def _resolve_in_param(
|
30
|
-
in_param_if_snref:
|
31
|
-
in_param_if_snpathref:
|
32
|
-
params:
|
30
|
+
in_param_if_snref: str | None,
|
31
|
+
in_param_if_snpathref: str | None,
|
32
|
+
params: list[Parameter],
|
33
33
|
param_dict: ParameterValueDict,
|
34
|
-
) ->
|
34
|
+
) -> tuple[Parameter | None, ParameterValue | None]:
|
35
35
|
|
36
36
|
if in_param_if_snref is not None:
|
37
37
|
path_chunks = [in_param_if_snref]
|
@@ -44,10 +44,10 @@ def _resolve_in_param(
|
|
44
44
|
|
45
45
|
|
46
46
|
def _resolve_in_param_helper(
|
47
|
-
params:
|
47
|
+
params: list[Parameter],
|
48
48
|
param_dict: ParameterValueDict,
|
49
|
-
path_chunks:
|
50
|
-
) ->
|
49
|
+
path_chunks: list[str],
|
50
|
+
) -> tuple[Parameter | None, ParameterValue | None]:
|
51
51
|
|
52
52
|
inner_param = resolve_snref(path_chunks[0], params, Parameter, lenient=True)
|
53
53
|
if inner_param is None:
|
@@ -90,7 +90,7 @@ def _resolve_in_param_helper(
|
|
90
90
|
|
91
91
|
def _check_applies(ref: Union["StateTransitionRef",
|
92
92
|
"PreConditionStateRef"], state_machine: "StateMachine",
|
93
|
-
params:
|
93
|
+
params: list[Parameter], param_value_dict: ParameterValueDict) -> bool:
|
94
94
|
if state_machine.active_state != ref.state:
|
95
95
|
# if the active state of the state machine is not the
|
96
96
|
# specified one, the precondition does not apply
|
@@ -108,13 +108,13 @@ def _check_applies(ref: Union["StateTransitionRef",
|
|
108
108
|
return False
|
109
109
|
elif not isinstance(
|
110
110
|
param,
|
111
|
-
|
111
|
+
CodedConstParameter | PhysicalConstantParameter | TableKeyParameter | ValueParameter):
|
112
112
|
# see checker rule 194 in section B.2 of the spec
|
113
113
|
odxraise(f"Parameter referenced by state transition ref is of "
|
114
114
|
f"invalid type {type(param).__name__}")
|
115
115
|
return False
|
116
|
-
elif isinstance(param,
|
117
|
-
|
116
|
+
elif isinstance(param, CodedConstParameter | PhysicalConstantParameter
|
117
|
+
| TableKeyParameter) and ref.value is not None:
|
118
118
|
# see checker rule 193 in section B.2 of the spec. Why can
|
119
119
|
# no values for constant parameters be specified? (This
|
120
120
|
# seems to be rather inconvenient...)
|
@@ -155,10 +155,10 @@ class StateTransitionRef(OdxLinkRef):
|
|
155
155
|
may also be conditional on the observed response of the ECU.
|
156
156
|
|
157
157
|
"""
|
158
|
-
value:
|
158
|
+
value: str | None
|
159
159
|
|
160
|
-
in_param_if_snref:
|
161
|
-
in_param_if_snpathref:
|
160
|
+
in_param_if_snref: str | None
|
161
|
+
in_param_if_snpathref: str | None
|
162
162
|
|
163
163
|
@property
|
164
164
|
def state_transition(self) -> StateTransition:
|
@@ -171,7 +171,7 @@ class StateTransitionRef(OdxLinkRef):
|
|
171
171
|
@staticmethod
|
172
172
|
def from_et( # type: ignore[override]
|
173
173
|
et_element: ElementTree.Element,
|
174
|
-
doc_frags:
|
174
|
+
doc_frags: list[OdxDocFragment]) -> "StateTransitionRef":
|
175
175
|
kwargs = dataclass_fields_asdict(OdxLinkRef.from_et(et_element, doc_frags))
|
176
176
|
|
177
177
|
value = et_element.findtext("VALUE")
|
@@ -195,7 +195,7 @@ class StateTransitionRef(OdxLinkRef):
|
|
195
195
|
odxassert(self.in_param_if_snref is not None or self.in_param_if_snref is not None,
|
196
196
|
"If VALUE is specified, a parameter must be referenced")
|
197
197
|
|
198
|
-
def _build_odxlinks(self) ->
|
198
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
199
199
|
return {}
|
200
200
|
|
201
201
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
@@ -204,7 +204,7 @@ class StateTransitionRef(OdxLinkRef):
|
|
204
204
|
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
205
205
|
pass
|
206
206
|
|
207
|
-
def execute(self, state_machine: StateMachine, params:
|
207
|
+
def execute(self, state_machine: StateMachine, params: list[Parameter],
|
208
208
|
param_value_dict: ParameterValueDict) -> bool:
|
209
209
|
"""Update a StateMachine object if the state transition ought
|
210
210
|
to be executed based on the response received after executing a
|
odxtools/staticfield.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
|
+
from collections.abc import Sequence
|
2
3
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
4
|
+
from typing import Any
|
4
5
|
from xml.etree import ElementTree
|
5
6
|
|
6
7
|
from typing_extensions import override
|
@@ -23,7 +24,7 @@ class StaticField(Field):
|
|
23
24
|
|
24
25
|
@staticmethod
|
25
26
|
@override
|
26
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
27
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "StaticField":
|
27
28
|
kwargs = dataclass_fields_asdict(Field.from_et(et_element, doc_frags))
|
28
29
|
|
29
30
|
fixed_number_of_items = int(odxrequire(et_element.findtext('FIXED-NUMBER-OF-ITEMS')))
|
@@ -33,7 +34,7 @@ class StaticField(Field):
|
|
33
34
|
fixed_number_of_items=fixed_number_of_items, item_byte_size=item_byte_size, **kwargs)
|
34
35
|
|
35
36
|
@override
|
36
|
-
def _build_odxlinks(self) ->
|
37
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
37
38
|
odxlinks = super()._build_odxlinks()
|
38
39
|
return odxlinks
|
39
40
|
|
@@ -89,7 +90,7 @@ class StaticField(Field):
|
|
89
90
|
orig_origin = decode_state.origin_byte_position
|
90
91
|
decode_state.origin_byte_position = decode_state.cursor_byte_position
|
91
92
|
|
92
|
-
result:
|
93
|
+
result: list[ParameterValue] = []
|
93
94
|
for _ in range(self.fixed_number_of_items):
|
94
95
|
orig_cursor = decode_state.cursor_byte_position
|
95
96
|
|
odxtools/structure.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import List, Optional
|
4
3
|
from xml.etree import ElementTree
|
5
4
|
|
6
5
|
from .basicstructure import BasicStructure
|
@@ -11,14 +10,14 @@ from .utils import dataclass_fields_asdict
|
|
11
10
|
|
12
11
|
@dataclass
|
13
12
|
class Structure(BasicStructure):
|
14
|
-
is_visible_raw:
|
13
|
+
is_visible_raw: bool | None
|
15
14
|
|
16
15
|
@property
|
17
16
|
def is_visible(self) -> bool:
|
18
17
|
return self.is_visible_raw in (True, None)
|
19
18
|
|
20
19
|
@staticmethod
|
21
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
20
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "Structure":
|
22
21
|
"""Read a STRUCTURE element from XML."""
|
23
22
|
kwargs = dataclass_fields_asdict(BasicStructure.from_et(et_element, doc_frags))
|
24
23
|
|
odxtools/subcomponent.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .dtcconnector import DtcConnector
|
@@ -25,16 +25,16 @@ class SubComponent(IdentifiableElement):
|
|
25
25
|
|
26
26
|
"""
|
27
27
|
|
28
|
-
sub_component_patterns:
|
28
|
+
sub_component_patterns: list[SubComponentPattern]
|
29
29
|
sub_component_param_connectors: NamedItemList[SubComponentParamConnector]
|
30
30
|
table_row_connectors: NamedItemList[TableRowConnector]
|
31
31
|
env_data_connectors: NamedItemList[EnvDataConnector]
|
32
32
|
dtc_connectors: NamedItemList[DtcConnector]
|
33
33
|
|
34
|
-
semantic:
|
34
|
+
semantic: str | None
|
35
35
|
|
36
36
|
@staticmethod
|
37
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
37
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "SubComponent":
|
38
38
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
39
39
|
|
40
40
|
semantic = et_element.get("SEMANTIC")
|
@@ -69,7 +69,7 @@ class SubComponent(IdentifiableElement):
|
|
69
69
|
dtc_connectors=NamedItemList(dtc_connectors),
|
70
70
|
**kwargs)
|
71
71
|
|
72
|
-
def _build_odxlinks(self) ->
|
72
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
73
73
|
result = {}
|
74
74
|
|
75
75
|
for scp in self.sub_component_patterns:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .diagservice import DiagService
|
@@ -18,8 +18,8 @@ class SubComponentParamConnector(IdentifiableElement):
|
|
18
18
|
diag_comm_snref: str
|
19
19
|
|
20
20
|
# TODO: we currently only support SNREFs, not SNPATHREFs
|
21
|
-
out_param_if_refs:
|
22
|
-
in_param_if_refs:
|
21
|
+
out_param_if_refs: list[str]
|
22
|
+
in_param_if_refs: list[str]
|
23
23
|
|
24
24
|
@property
|
25
25
|
def service(self) -> DiagService:
|
@@ -35,7 +35,7 @@ class SubComponentParamConnector(IdentifiableElement):
|
|
35
35
|
|
36
36
|
@staticmethod
|
37
37
|
def from_et(et_element: ElementTree.Element,
|
38
|
-
doc_frags:
|
38
|
+
doc_frags: list[OdxDocFragment]) -> "SubComponentParamConnector":
|
39
39
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
40
40
|
|
41
41
|
diag_comm_snref = odxrequire(
|
@@ -65,7 +65,7 @@ class SubComponentParamConnector(IdentifiableElement):
|
|
65
65
|
in_param_if_refs=in_param_if_refs,
|
66
66
|
**kwargs)
|
67
67
|
|
68
|
-
def _build_odxlinks(self) ->
|
68
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
69
69
|
return {}
|
70
70
|
|
71
71
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/subcomponentpattern.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import TYPE_CHECKING, Any
|
3
|
+
from typing import TYPE_CHECKING, Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
|
@@ -12,11 +12,11 @@ if TYPE_CHECKING:
|
|
12
12
|
|
13
13
|
@dataclass
|
14
14
|
class SubComponentPattern:
|
15
|
-
matching_parameters:
|
15
|
+
matching_parameters: list["MatchingParameter"]
|
16
16
|
|
17
17
|
@staticmethod
|
18
18
|
def from_et(et_element: ElementTree.Element,
|
19
|
-
doc_frags:
|
19
|
+
doc_frags: list[OdxDocFragment]) -> "SubComponentPattern":
|
20
20
|
from .matchingparameter import MatchingParameter
|
21
21
|
|
22
22
|
matching_parameters = [
|
@@ -26,7 +26,7 @@ class SubComponentPattern:
|
|
26
26
|
|
27
27
|
return SubComponentPattern(matching_parameters=matching_parameters)
|
28
28
|
|
29
|
-
def _build_odxlinks(self) ->
|
29
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
30
30
|
result = {}
|
31
31
|
for mp in self.matching_parameters:
|
32
32
|
result.update(mp._build_odxlinks())
|
odxtools/swvariable.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import List, Optional
|
4
3
|
from xml.etree import ElementTree
|
5
4
|
|
6
5
|
from .element import NamedElement
|
@@ -10,11 +9,11 @@ from .utils import dataclass_fields_asdict
|
|
10
9
|
|
11
10
|
@dataclass
|
12
11
|
class SwVariable(NamedElement):
|
13
|
-
origin:
|
14
|
-
oid:
|
12
|
+
origin: str | None
|
13
|
+
oid: str | None
|
15
14
|
|
16
15
|
@staticmethod
|
17
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
16
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "SwVariable":
|
18
17
|
kwargs = dataclass_fields_asdict(NamedElement.from_et(et_element, doc_frags))
|
19
18
|
|
20
19
|
origin = et_element.findtext("ORIGIN")
|
odxtools/table.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .admindata import AdminData
|
@@ -19,17 +19,17 @@ from .utils import dataclass_fields_asdict
|
|
19
19
|
@dataclass
|
20
20
|
class Table(IdentifiableElement):
|
21
21
|
"""This class represents a TABLE."""
|
22
|
-
key_label:
|
23
|
-
struct_label:
|
24
|
-
admin_data:
|
25
|
-
key_dop_ref:
|
26
|
-
table_rows_raw:
|
27
|
-
table_diag_comm_connectors:
|
28
|
-
sdgs:
|
29
|
-
semantic:
|
22
|
+
key_label: str | None
|
23
|
+
struct_label: str | None
|
24
|
+
admin_data: AdminData | None
|
25
|
+
key_dop_ref: OdxLinkRef | None
|
26
|
+
table_rows_raw: list[TableRow | OdxLinkRef]
|
27
|
+
table_diag_comm_connectors: list[TableDiagCommConnector]
|
28
|
+
sdgs: list[SpecialDataGroup]
|
29
|
+
semantic: str | None
|
30
30
|
|
31
31
|
@property
|
32
|
-
def key_dop(self) ->
|
32
|
+
def key_dop(self) -> DataObjectProperty | None:
|
33
33
|
"""The key data object property associated with this table."""
|
34
34
|
return self._key_dop
|
35
35
|
|
@@ -39,7 +39,7 @@ class Table(IdentifiableElement):
|
|
39
39
|
return self._table_rows
|
40
40
|
|
41
41
|
@staticmethod
|
42
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
42
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "Table":
|
43
43
|
"""Reads a TABLE."""
|
44
44
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
45
45
|
odx_id = kwargs["odx_id"]
|
@@ -48,7 +48,7 @@ class Table(IdentifiableElement):
|
|
48
48
|
admin_data = AdminData.from_et(et_element.find("ADMIN-DATA"), doc_frags)
|
49
49
|
key_dop_ref = OdxLinkRef.from_et(et_element.find("KEY-DOP-REF"), doc_frags)
|
50
50
|
|
51
|
-
table_rows_raw:
|
51
|
+
table_rows_raw: list[OdxLinkRef | TableRow] = []
|
52
52
|
for sub_elem in et_element:
|
53
53
|
if sub_elem.tag == "TABLE-ROW":
|
54
54
|
table_rows_raw.append(
|
@@ -77,7 +77,7 @@ class Table(IdentifiableElement):
|
|
77
77
|
semantic=semantic,
|
78
78
|
**kwargs)
|
79
79
|
|
80
|
-
def _build_odxlinks(self) ->
|
80
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
81
81
|
result = {self.odx_id: self}
|
82
82
|
|
83
83
|
for table_row_wrapper in self.table_rows_raw:
|
@@ -93,7 +93,7 @@ class Table(IdentifiableElement):
|
|
93
93
|
return result
|
94
94
|
|
95
95
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
96
|
-
self._key_dop:
|
96
|
+
self._key_dop: DataObjectProperty | None = None
|
97
97
|
if self.key_dop_ref is not None:
|
98
98
|
self._key_dop = odxlinks.resolve(self.key_dop_ref, DataObjectProperty)
|
99
99
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .diagcomm import DiagComm
|
@@ -13,8 +13,8 @@ from .snrefcontext import SnRefContext
|
|
13
13
|
class TableDiagCommConnector:
|
14
14
|
semantic: str
|
15
15
|
|
16
|
-
diag_comm_ref:
|
17
|
-
diag_comm_snref:
|
16
|
+
diag_comm_ref: OdxLinkRef | None
|
17
|
+
diag_comm_snref: str | None
|
18
18
|
|
19
19
|
@property
|
20
20
|
def diag_comm(self) -> DiagComm:
|
@@ -22,7 +22,7 @@ class TableDiagCommConnector:
|
|
22
22
|
|
23
23
|
@staticmethod
|
24
24
|
def from_et(et_element: ElementTree.Element,
|
25
|
-
doc_frags:
|
25
|
+
doc_frags: list[OdxDocFragment]) -> "TableDiagCommConnector":
|
26
26
|
|
27
27
|
semantic = odxrequire(et_element.findtext("SEMANTIC"))
|
28
28
|
|
@@ -34,7 +34,7 @@ class TableDiagCommConnector:
|
|
34
34
|
return TableDiagCommConnector(
|
35
35
|
semantic=semantic, diag_comm_ref=diag_comm_ref, diag_comm_snref=diag_comm_snref)
|
36
36
|
|
37
|
-
def _build_odxlinks(self) ->
|
37
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
38
38
|
return {}
|
39
39
|
|
40
40
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|