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
odxtools/cli/main.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import argparse
|
3
3
|
import importlib
|
4
|
-
from typing import Any
|
4
|
+
from typing import Any
|
5
5
|
|
6
6
|
import odxtools
|
7
7
|
import odxtools.exceptions
|
@@ -11,7 +11,7 @@ from .dummy_sub_parser import DummyTool
|
|
11
11
|
|
12
12
|
# import the tool modules which can be loaded. if a tool
|
13
13
|
# can't be loaded, add a dummy one
|
14
|
-
tool_modules:
|
14
|
+
tool_modules: list[Any] = []
|
15
15
|
for tool_name in ["list", "browse", "snoop", "find", "decode", "compare"]:
|
16
16
|
try:
|
17
17
|
tool_modules.append(importlib.import_module(f".{tool_name}", package="odxtools.cli"))
|
odxtools/cli/snoop.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
import argparse
|
5
5
|
import asyncio
|
6
6
|
import sys
|
7
|
-
from typing import Any
|
7
|
+
from typing import Any
|
8
8
|
|
9
9
|
import can
|
10
10
|
|
@@ -103,7 +103,7 @@ def handle_telegram(telegram_id: int, payload: bytes) -> None:
|
|
103
103
|
f"({payload!r}, {len(payload)} bytes)")
|
104
104
|
|
105
105
|
|
106
|
-
def init_verbose_state_machine(BaseClass:
|
106
|
+
def init_verbose_state_machine(BaseClass: type[IsoTpStateMachine], *args: Any,
|
107
107
|
**kwargs: Any) -> IsoTpStateMachine:
|
108
108
|
|
109
109
|
class InformativeIsoTpDecoder(BaseClass): # type: ignore[valid-type, misc]
|
@@ -246,7 +246,7 @@ def run(args: argparse.Namespace) -> None:
|
|
246
246
|
|
247
247
|
protocol_name = args.protocol
|
248
248
|
if odx_diag_layer is not None and protocol_name is not None:
|
249
|
-
protocols:
|
249
|
+
protocols: list[Protocol] | None = getattr(odx_diag_layer, "protocols", None)
|
250
250
|
|
251
251
|
if protocols is None:
|
252
252
|
print(f"ECU variant {odx_diag_layer.short_name} is of type "
|
odxtools/codec.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import typing
|
3
|
-
from typing import
|
3
|
+
from typing import runtime_checkable
|
4
4
|
|
5
5
|
from .decodestate import DecodeState
|
6
6
|
from .encodestate import EncodeState
|
@@ -17,12 +17,12 @@ class Codec(typing.Protocol):
|
|
17
17
|
def short_name(self) -> str:
|
18
18
|
return ""
|
19
19
|
|
20
|
-
def encode_into_pdu(self, physical_value:
|
20
|
+
def encode_into_pdu(self, physical_value: ParameterValue | None,
|
21
21
|
encode_state: EncodeState) -> None:
|
22
22
|
...
|
23
23
|
|
24
24
|
def decode_from_pdu(self, decode_state: DecodeState) -> ParameterValue:
|
25
25
|
...
|
26
26
|
|
27
|
-
def get_static_bit_length(self) ->
|
27
|
+
def get_static_bit_length(self) -> int | None:
|
28
28
|
...
|
odxtools/commrelation.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import warnings
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import Any
|
4
|
+
from typing import Any
|
5
5
|
from xml.etree import ElementTree
|
6
6
|
|
7
7
|
from .commrelationvaluetype import CommRelationValueType
|
@@ -16,26 +16,26 @@ from .snrefcontext import SnRefContext
|
|
16
16
|
|
17
17
|
@dataclass
|
18
18
|
class CommRelation:
|
19
|
-
description:
|
19
|
+
description: Description | None
|
20
20
|
relation_type: str
|
21
|
-
diag_comm_ref:
|
22
|
-
diag_comm_snref:
|
23
|
-
in_param_if_snref:
|
21
|
+
diag_comm_ref: OdxLinkRef | None
|
22
|
+
diag_comm_snref: str | None
|
23
|
+
in_param_if_snref: str | None
|
24
24
|
#in_param_if_snpathref: Optional[str] # TODO
|
25
|
-
out_param_if_snref:
|
25
|
+
out_param_if_snref: str | None
|
26
26
|
#out_param_if_snpathref: Optional[str] # TODO
|
27
|
-
value_type_raw:
|
27
|
+
value_type_raw: CommRelationValueType | None
|
28
28
|
|
29
29
|
@property
|
30
30
|
def diag_comm(self) -> DiagComm:
|
31
31
|
return self._diag_comm
|
32
32
|
|
33
33
|
@property
|
34
|
-
def in_param_if(self) ->
|
34
|
+
def in_param_if(self) -> Parameter | None:
|
35
35
|
return self._in_param_if
|
36
36
|
|
37
37
|
@property
|
38
|
-
def out_param_if(self) ->
|
38
|
+
def out_param_if(self) -> Parameter | None:
|
39
39
|
return self._out_param_if
|
40
40
|
|
41
41
|
@property
|
@@ -46,7 +46,7 @@ class CommRelation:
|
|
46
46
|
return self.value_type_raw
|
47
47
|
|
48
48
|
@staticmethod
|
49
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
49
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "CommRelation":
|
50
50
|
description = Description.from_et(et_element.find("DESC"), doc_frags)
|
51
51
|
relation_type = odxrequire(et_element.findtext("RELATION-TYPE"))
|
52
52
|
|
@@ -85,7 +85,7 @@ class CommRelation:
|
|
85
85
|
out_param_if_snref=out_param_if_snref,
|
86
86
|
value_type_raw=value_type_raw)
|
87
87
|
|
88
|
-
def _build_odxlinks(self) ->
|
88
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
89
89
|
return {}
|
90
90
|
|
91
91
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/companydata.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 .companyspecificinfo import CompanySpecificInfo
|
@@ -15,12 +15,12 @@ from .utils import dataclass_fields_asdict
|
|
15
15
|
|
16
16
|
@dataclass
|
17
17
|
class CompanyData(IdentifiableElement):
|
18
|
-
roles:
|
18
|
+
roles: list[str]
|
19
19
|
team_members: NamedItemList[TeamMember]
|
20
|
-
company_specific_info:
|
20
|
+
company_specific_info: CompanySpecificInfo | None
|
21
21
|
|
22
22
|
@staticmethod
|
23
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
23
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "CompanyData":
|
24
24
|
|
25
25
|
kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
|
26
26
|
|
@@ -43,7 +43,7 @@ class CompanyData(IdentifiableElement):
|
|
43
43
|
**kwargs,
|
44
44
|
)
|
45
45
|
|
46
|
-
def _build_odxlinks(self) ->
|
46
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
47
47
|
result = {self.odx_id: self}
|
48
48
|
|
49
49
|
for tm in self.team_members:
|
odxtools/companydocinfo.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 .companydata import CompanyData
|
@@ -14,21 +14,21 @@ from .teammember import TeamMember
|
|
14
14
|
@dataclass
|
15
15
|
class CompanyDocInfo:
|
16
16
|
company_data_ref: OdxLinkRef
|
17
|
-
team_member_ref:
|
18
|
-
doc_label:
|
19
|
-
sdgs:
|
17
|
+
team_member_ref: OdxLinkRef | None
|
18
|
+
doc_label: str | None
|
19
|
+
sdgs: list[SpecialDataGroup]
|
20
20
|
|
21
21
|
@property
|
22
22
|
def company_data(self) -> CompanyData:
|
23
23
|
return self._company_data
|
24
24
|
|
25
25
|
@property
|
26
|
-
def team_member(self) ->
|
26
|
+
def team_member(self) -> TeamMember | None:
|
27
27
|
return self._team_member
|
28
28
|
|
29
29
|
@staticmethod
|
30
30
|
def from_et(et_element: ElementTree.Element,
|
31
|
-
doc_frags:
|
31
|
+
doc_frags: list[OdxDocFragment]) -> "CompanyDocInfo":
|
32
32
|
# the company data reference is mandatory
|
33
33
|
company_data_ref = odxrequire(
|
34
34
|
OdxLinkRef.from_et(et_element.find("COMPANY-DATA-REF"), doc_frags))
|
@@ -45,7 +45,7 @@ class CompanyDocInfo:
|
|
45
45
|
sdgs=sdgs,
|
46
46
|
)
|
47
47
|
|
48
|
-
def _build_odxlinks(self) ->
|
48
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
49
49
|
result = {}
|
50
50
|
|
51
51
|
for sdg in self.sdgs:
|
@@ -56,7 +56,7 @@ class CompanyDocInfo:
|
|
56
56
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
57
57
|
self._company_data = odxlinks.resolve(self.company_data_ref, CompanyData)
|
58
58
|
|
59
|
-
self._team_member:
|
59
|
+
self._team_member: TeamMember | None = None
|
60
60
|
if self.team_member_ref is not None:
|
61
61
|
self._team_member = odxlinks.resolve(self.team_member_ref, TeamMember)
|
62
62
|
|
odxtools/companyrevisioninfo.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 .companydata import CompanyData
|
@@ -12,8 +12,8 @@ from .snrefcontext import SnRefContext
|
|
12
12
|
@dataclass
|
13
13
|
class CompanyRevisionInfo:
|
14
14
|
company_data_ref: OdxLinkRef
|
15
|
-
revision_label:
|
16
|
-
state:
|
15
|
+
revision_label: str | None
|
16
|
+
state: str | None
|
17
17
|
|
18
18
|
@property
|
19
19
|
def company_data(self) -> CompanyData:
|
@@ -21,7 +21,7 @@ class CompanyRevisionInfo:
|
|
21
21
|
|
22
22
|
@staticmethod
|
23
23
|
def from_et(et_element: ElementTree.Element,
|
24
|
-
doc_frags:
|
24
|
+
doc_frags: list[OdxDocFragment]) -> "CompanyRevisionInfo":
|
25
25
|
|
26
26
|
company_data_ref = odxrequire(
|
27
27
|
OdxLinkRef.from_et(et_element.find("COMPANY-DATA-REF"), doc_frags))
|
@@ -31,7 +31,7 @@ class CompanyRevisionInfo:
|
|
31
31
|
return CompanyRevisionInfo(
|
32
32
|
company_data_ref=company_data_ref, revision_label=revision_label, state=state)
|
33
33
|
|
34
|
-
def _build_odxlinks(self) ->
|
34
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
35
35
|
return {}
|
36
36
|
|
37
37
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/companyspecificinfo.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 .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
|
@@ -11,12 +11,12 @@ from .specialdatagroup import SpecialDataGroup
|
|
11
11
|
|
12
12
|
@dataclass
|
13
13
|
class CompanySpecificInfo:
|
14
|
-
related_docs:
|
15
|
-
sdgs:
|
14
|
+
related_docs: list[RelatedDoc]
|
15
|
+
sdgs: list[SpecialDataGroup]
|
16
16
|
|
17
17
|
@staticmethod
|
18
18
|
def from_et(et_element: ElementTree.Element,
|
19
|
-
doc_frags:
|
19
|
+
doc_frags: list[OdxDocFragment]) -> "CompanySpecificInfo":
|
20
20
|
related_docs = [
|
21
21
|
RelatedDoc.from_et(rd, doc_frags)
|
22
22
|
for rd in et_element.iterfind("RELATED-DOCS/RELATED-DOC")
|
@@ -28,7 +28,7 @@ class CompanySpecificInfo:
|
|
28
28
|
|
29
29
|
return CompanySpecificInfo(related_docs=related_docs, sdgs=sdgs)
|
30
30
|
|
31
|
-
def _build_odxlinks(self) ->
|
31
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
32
32
|
result = {}
|
33
33
|
|
34
34
|
for rd in self.related_docs:
|
odxtools/comparam.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 .basecomparam import BaseComparam
|
@@ -27,7 +27,7 @@ class Comparam(BaseComparam):
|
|
27
27
|
return self._dop
|
28
28
|
|
29
29
|
@staticmethod
|
30
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
30
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "Comparam":
|
31
31
|
kwargs = dataclass_fields_asdict(BaseComparam.from_et(et_element, doc_frags))
|
32
32
|
|
33
33
|
physical_default_value_raw = odxrequire(et_element.findtext("PHYSICAL-DEFAULT-VALUE"))
|
@@ -36,7 +36,7 @@ class Comparam(BaseComparam):
|
|
36
36
|
return Comparam(
|
37
37
|
dop_ref=dop_ref, physical_default_value_raw=physical_default_value_raw, **kwargs)
|
38
38
|
|
39
|
-
def _build_odxlinks(self) ->
|
39
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
40
40
|
return super()._build_odxlinks()
|
41
41
|
|
42
42
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
odxtools/comparaminstance.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import warnings
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import Any
|
4
|
+
from typing import Any
|
5
5
|
from xml.etree import ElementTree
|
6
6
|
|
7
7
|
from .basecomparam import BaseComparam
|
@@ -20,10 +20,10 @@ class ComparamInstance:
|
|
20
20
|
|
21
21
|
Be aware that the ODX specification calls this class COMPARAM-REF!
|
22
22
|
"""
|
23
|
-
value:
|
24
|
-
description:
|
25
|
-
protocol_snref:
|
26
|
-
prot_stack_snref:
|
23
|
+
value: str | ComplexValue
|
24
|
+
description: Description | None
|
25
|
+
protocol_snref: str | None
|
26
|
+
prot_stack_snref: str | None
|
27
27
|
spec_ref: OdxLinkRef
|
28
28
|
|
29
29
|
@property
|
@@ -36,13 +36,13 @@ class ComparamInstance:
|
|
36
36
|
|
37
37
|
@staticmethod
|
38
38
|
def from_et(et_element: ElementTree.Element,
|
39
|
-
doc_frags:
|
39
|
+
doc_frags: list[OdxDocFragment]) -> "ComparamInstance":
|
40
40
|
spec_ref = odxrequire(OdxLinkRef.from_et(et_element, doc_frags))
|
41
41
|
|
42
42
|
# ODX standard v2.0.0 defined only VALUE. ODX v2.0.1 decided
|
43
43
|
# to break things and change it to a choice between SIMPLE-VALUE
|
44
44
|
# and COMPLEX-VALUE
|
45
|
-
value:
|
45
|
+
value: str | list[str | ComplexValue]
|
46
46
|
if et_element.find("VALUE") is not None:
|
47
47
|
value = odxrequire(et_element.findtext("VALUE"))
|
48
48
|
elif et_element.find("SIMPLE-VALUE") is not None:
|
@@ -68,7 +68,7 @@ class ComparamInstance:
|
|
68
68
|
prot_stack_snref=prot_stack_snref,
|
69
69
|
)
|
70
70
|
|
71
|
-
def _build_odxlinks(self) ->
|
71
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
72
72
|
return {}
|
73
73
|
|
74
74
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
@@ -98,7 +98,7 @@ class ComparamInstance:
|
|
98
98
|
|
99
99
|
return result
|
100
100
|
|
101
|
-
def get_subvalue(self, subparam_name: str) ->
|
101
|
+
def get_subvalue(self, subparam_name: str) -> str | None:
|
102
102
|
"""Retrieve the value of a complex communication parameter's sub-parameter by name
|
103
103
|
|
104
104
|
This takes the default value of the comparam (if any) into
|
@@ -133,7 +133,7 @@ class ComparamInstance:
|
|
133
133
|
return None
|
134
134
|
|
135
135
|
result = value_list[idx]
|
136
|
-
if result is None and isinstance(subparam,
|
136
|
+
if result is None and isinstance(subparam, Comparam | ComplexComparam):
|
137
137
|
result = subparam.physical_default_value
|
138
138
|
if not isinstance(result, str):
|
139
139
|
odxraise()
|
odxtools/comparamspec.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 .nameditemlist import NamedItemList
|
@@ -20,7 +20,7 @@ class ComparamSpec(OdxCategory):
|
|
20
20
|
prot_stacks: NamedItemList[ProtStack]
|
21
21
|
|
22
22
|
@staticmethod
|
23
|
-
def from_et(et_element: ElementTree.Element, doc_frags:
|
23
|
+
def from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment]) -> "ComparamSpec":
|
24
24
|
|
25
25
|
base_obj = OdxCategory.category_from_et(
|
26
26
|
et_element, doc_frags, doc_type=DocType.COMPARAM_SPEC)
|
@@ -34,7 +34,7 @@ class ComparamSpec(OdxCategory):
|
|
34
34
|
|
35
35
|
return ComparamSpec(prot_stacks=prot_stacks, **kwargs)
|
36
36
|
|
37
|
-
def _build_odxlinks(self) ->
|
37
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
38
38
|
odxlinks = super()._build_odxlinks()
|
39
39
|
|
40
40
|
for ps in self.prot_stacks:
|
odxtools/comparamsubset.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 .comparam import Comparam
|
@@ -22,12 +22,12 @@ class ComparamSubset(OdxCategory):
|
|
22
22
|
comparams: NamedItemList[Comparam]
|
23
23
|
complex_comparams: NamedItemList[ComplexComparam]
|
24
24
|
data_object_props: NamedItemList[DataObjectProperty]
|
25
|
-
unit_spec:
|
26
|
-
category:
|
25
|
+
unit_spec: UnitSpec | None
|
26
|
+
category: str | None # mandatory in ODX 2.2, but non-existent in ODX 2.0
|
27
27
|
|
28
28
|
@staticmethod
|
29
29
|
def from_et(et_element: ElementTree.Element,
|
30
|
-
doc_frags:
|
30
|
+
doc_frags: list[OdxDocFragment]) -> "ComparamSubset":
|
31
31
|
|
32
32
|
category_attrib = et_element.attrib.get("CATEGORY")
|
33
33
|
|
@@ -64,7 +64,7 @@ class ComparamSubset(OdxCategory):
|
|
64
64
|
unit_spec=unit_spec,
|
65
65
|
**kwargs)
|
66
66
|
|
67
|
-
def _build_odxlinks(self) ->
|
67
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
68
68
|
odxlinks = super()._build_odxlinks()
|
69
69
|
|
70
70
|
for comparam in self.comparams:
|
odxtools/complexcomparam.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, Union
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .basecomparam import BaseComparam
|
@@ -10,7 +10,7 @@ from .odxtypes import odxstr_to_bool
|
|
10
10
|
from .snrefcontext import SnRefContext
|
11
11
|
from .utils import dataclass_fields_asdict
|
12
12
|
|
13
|
-
ComplexValue =
|
13
|
+
ComplexValue = list[Union[str, "ComplexValue"]]
|
14
14
|
|
15
15
|
|
16
16
|
def create_complex_value_from_et(et_element: ElementTree.Element) -> ComplexValue:
|
@@ -26,8 +26,8 @@ def create_complex_value_from_et(et_element: ElementTree.Element) -> ComplexValu
|
|
26
26
|
@dataclass
|
27
27
|
class ComplexComparam(BaseComparam):
|
28
28
|
subparams: NamedItemList[BaseComparam]
|
29
|
-
physical_default_value:
|
30
|
-
allow_multiple_values_raw:
|
29
|
+
physical_default_value: ComplexValue | None
|
30
|
+
allow_multiple_values_raw: bool | None
|
31
31
|
|
32
32
|
@property
|
33
33
|
def allow_multiple_values(self) -> bool:
|
@@ -35,7 +35,7 @@ class ComplexComparam(BaseComparam):
|
|
35
35
|
|
36
36
|
@staticmethod
|
37
37
|
def from_et(et_element: ElementTree.Element,
|
38
|
-
doc_frags:
|
38
|
+
doc_frags: list[OdxDocFragment]) -> "ComplexComparam":
|
39
39
|
kwargs = dataclass_fields_asdict(BaseComparam.from_et(et_element, doc_frags))
|
40
40
|
|
41
41
|
# to avoid a cyclic import, create_any_comparam_from_et cannot
|
@@ -68,7 +68,7 @@ class ComplexComparam(BaseComparam):
|
|
68
68
|
# extract the complex physical default value. (what's the
|
69
69
|
# purpose of this? the sub-parameters can define their own
|
70
70
|
# default values if a default is desired...)
|
71
|
-
complex_physical_default_value:
|
71
|
+
complex_physical_default_value: ComplexValue | None = None
|
72
72
|
if (cpdv_elem := et_element.find("COMPLEX-PHYSICAL-DEFAULT-VALUE")) is not None:
|
73
73
|
complex_physical_default_value = create_complex_value_from_et(cpdv_elem)
|
74
74
|
|
@@ -80,7 +80,7 @@ class ComplexComparam(BaseComparam):
|
|
80
80
|
allow_multiple_values_raw=allow_multiple_values_raw,
|
81
81
|
**kwargs)
|
82
82
|
|
83
|
-
def _build_odxlinks(self) ->
|
83
|
+
def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
|
84
84
|
odxlinks = super()._build_odxlinks()
|
85
85
|
for subparam in self.subparams:
|
86
86
|
odxlinks.update(subparam._build_odxlinks())
|
odxtools/compositecodec.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import typing
|
3
|
-
from typing import
|
3
|
+
from typing import runtime_checkable
|
4
4
|
|
5
5
|
from .codec import Codec
|
6
6
|
from .decodestate import DecodeState
|
@@ -22,20 +22,20 @@ class CompositeCodec(Codec, typing.Protocol):
|
|
22
22
|
"""
|
23
23
|
|
24
24
|
@property
|
25
|
-
def parameters(self) ->
|
25
|
+
def parameters(self) -> list[Parameter]:
|
26
26
|
return []
|
27
27
|
|
28
28
|
@property
|
29
|
-
def required_parameters(self) ->
|
29
|
+
def required_parameters(self) -> list[Parameter]:
|
30
30
|
return []
|
31
31
|
|
32
32
|
@property
|
33
|
-
def free_parameters(self) ->
|
33
|
+
def free_parameters(self) -> list[Parameter]:
|
34
34
|
return []
|
35
35
|
|
36
36
|
|
37
37
|
# some helper functions useful for composite codec objects
|
38
|
-
def composite_codec_get_static_bit_length(codec: CompositeCodec) ->
|
38
|
+
def composite_codec_get_static_bit_length(codec: CompositeCodec) -> int | None:
|
39
39
|
"""Compute the length of a composite codec object in bits
|
40
40
|
|
41
41
|
This is basically the sum of the lengths of all parameters. If the
|
@@ -59,7 +59,7 @@ def composite_codec_get_static_bit_length(codec: CompositeCodec) -> Optional[int
|
|
59
59
|
return byte_length * 8
|
60
60
|
|
61
61
|
|
62
|
-
def composite_codec_get_required_parameters(codec: CompositeCodec) ->
|
62
|
+
def composite_codec_get_required_parameters(codec: CompositeCodec) -> list[Parameter]:
|
63
63
|
"""Return the list of parameters which are required to be
|
64
64
|
specified for encoding the composite codec object
|
65
65
|
|
@@ -68,7 +68,7 @@ def composite_codec_get_required_parameters(codec: CompositeCodec) -> List[Param
|
|
68
68
|
return [p for p in codec.parameters if p.is_required]
|
69
69
|
|
70
70
|
|
71
|
-
def composite_codec_get_free_parameters(codec: CompositeCodec) ->
|
71
|
+
def composite_codec_get_free_parameters(codec: CompositeCodec) -> list[Parameter]:
|
72
72
|
"""Return the list of parameters which can be freely specified by
|
73
73
|
the user when encoding the composite codec object
|
74
74
|
|
@@ -84,7 +84,7 @@ def composite_codec_get_coded_const_prefix(codec: CompositeCodec,
|
|
84
84
|
|
85
85
|
for param in codec.parameters:
|
86
86
|
if (isinstance(param, MatchingRequestParameter) and param.request_byte_position < len(request_prefix)) or \
|
87
|
-
isinstance(param,
|
87
|
+
isinstance(param, CodedConstParameter|PhysicalConstantParameter) :
|
88
88
|
param.encode_into_pdu(physical_value=None, encode_state=encode_state)
|
89
89
|
else:
|
90
90
|
break
|
@@ -92,7 +92,7 @@ def composite_codec_get_coded_const_prefix(codec: CompositeCodec,
|
|
92
92
|
return encode_state.coded_message
|
93
93
|
|
94
94
|
|
95
|
-
def composite_codec_encode_into_pdu(codec: CompositeCodec, physical_value:
|
95
|
+
def composite_codec_encode_into_pdu(codec: CompositeCodec, physical_value: ParameterValue | None,
|
96
96
|
encode_state: EncodeState) -> None:
|
97
97
|
from .parameters.lengthkeyparameter import LengthKeyParameter
|
98
98
|
from .parameters.tablekeyparameter import TableKeyParameter
|
@@ -132,7 +132,7 @@ def composite_codec_encode_into_pdu(codec: CompositeCodec, physical_value: Optio
|
|
132
132
|
# the ODX is located last in the PDU...
|
133
133
|
encode_state.is_end_of_pdu = orig_is_end_of_pdu
|
134
134
|
|
135
|
-
if isinstance(param,
|
135
|
+
if isinstance(param, LengthKeyParameter | TableKeyParameter):
|
136
136
|
# At this point, we encode a placeholder value for length-
|
137
137
|
# and table keys, since these can be specified
|
138
138
|
# implicitly (i.e., by means of parameters that use
|
@@ -159,7 +159,7 @@ def composite_codec_encode_into_pdu(codec: CompositeCodec, physical_value: Optio
|
|
159
159
|
# because we allow these to be defined implicitly (i.e. they
|
160
160
|
# are defined by their respective users)
|
161
161
|
for param in codec.parameters:
|
162
|
-
if not isinstance(param,
|
162
|
+
if not isinstance(param, LengthKeyParameter | TableKeyParameter):
|
163
163
|
# the current parameter is neither a length- nor a table key
|
164
164
|
continue
|
165
165
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import cast
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from ..exceptions import DecodeError, EncodeError, odxassert, odxraise
|
@@ -20,21 +20,21 @@ class CompuCodeCompuMethod(CompuMethod):
|
|
20
20
|
"""
|
21
21
|
|
22
22
|
@property
|
23
|
-
def internal_to_phys_code(self) ->
|
23
|
+
def internal_to_phys_code(self) -> ProgCode | None:
|
24
24
|
if self.compu_internal_to_phys is None:
|
25
25
|
return None
|
26
26
|
|
27
27
|
return self.compu_internal_to_phys.prog_code
|
28
28
|
|
29
29
|
@property
|
30
|
-
def phys_to_internal_code(self) ->
|
30
|
+
def phys_to_internal_code(self) -> ProgCode | None:
|
31
31
|
if self.compu_phys_to_internal is None:
|
32
32
|
return None
|
33
33
|
|
34
34
|
return self.compu_phys_to_internal.prog_code
|
35
35
|
|
36
36
|
@staticmethod
|
37
|
-
def compu_method_from_et(et_element: ElementTree.Element, doc_frags:
|
37
|
+
def compu_method_from_et(et_element: ElementTree.Element, doc_frags: list[OdxDocFragment], *,
|
38
38
|
internal_type: DataType,
|
39
39
|
physical_type: DataType) -> "CompuCodeCompuMethod":
|
40
40
|
cm = CompuMethod.compu_method_from_et(
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Optional
|
4
3
|
from xml.etree import ElementTree
|
5
4
|
|
6
5
|
from ..odxtypes import AtomicOdxType, DataType
|
@@ -8,13 +7,13 @@ from ..odxtypes import AtomicOdxType, DataType
|
|
8
7
|
|
9
8
|
@dataclass
|
10
9
|
class CompuConst:
|
11
|
-
v:
|
12
|
-
vt:
|
10
|
+
v: str | None
|
11
|
+
vt: str | None
|
13
12
|
|
14
13
|
data_type: DataType
|
15
14
|
|
16
15
|
@property
|
17
|
-
def value(self) ->
|
16
|
+
def value(self) -> AtomicOdxType | None:
|
18
17
|
return self._value
|
19
18
|
|
20
19
|
@staticmethod
|
@@ -26,6 +25,6 @@ class CompuConst:
|
|
26
25
|
return CompuConst(v=v, vt=vt, data_type=data_type)
|
27
26
|
|
28
27
|
def __post_init__(self) -> None:
|
29
|
-
self._value:
|
28
|
+
self._value: AtomicOdxType | None = self.vt
|
30
29
|
if self.v is not None:
|
31
30
|
self._value = self.data_type.from_string(self.v)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Optional
|
4
3
|
from xml.etree import ElementTree
|
5
4
|
|
6
5
|
from ..odxtypes import DataType
|
@@ -11,7 +10,7 @@ from .compuinversevalue import CompuInverseValue
|
|
11
10
|
|
12
11
|
@dataclass
|
13
12
|
class CompuDefaultValue(CompuConst):
|
14
|
-
compu_inverse_value:
|
13
|
+
compu_inverse_value: CompuInverseValue | None
|
15
14
|
|
16
15
|
@staticmethod
|
17
16
|
def compuvalue_from_et(et_element: ElementTree.Element, *,
|