odxtools 7.1.1__py3-none-any.whl → 7.2.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/__init__.py +6 -4
- odxtools/additionalaudience.py +3 -5
- odxtools/admindata.py +5 -7
- odxtools/audience.py +3 -5
- odxtools/basecomparam.py +3 -5
- odxtools/basicstructure.py +10 -17
- odxtools/cli/_parser_utils.py +1 -1
- odxtools/cli/_print_utils.py +3 -2
- odxtools/cli/compare.py +1 -1
- odxtools/companydata.py +5 -7
- odxtools/companydocinfo.py +7 -8
- odxtools/companyrevisioninfo.py +3 -5
- odxtools/companyspecificinfo.py +8 -9
- odxtools/comparam.py +4 -6
- odxtools/comparaminstance.py +6 -8
- odxtools/comparamspec.py +14 -13
- odxtools/comparamsubset.py +17 -16
- odxtools/complexcomparam.py +5 -7
- odxtools/compumethods/compuconst.py +31 -0
- odxtools/compumethods/compudefaultvalue.py +27 -0
- odxtools/compumethods/compuinternaltophys.py +39 -0
- odxtools/compumethods/compuinversevalue.py +7 -0
- odxtools/compumethods/compumethod.py +67 -12
- odxtools/compumethods/compuphystointernal.py +39 -0
- odxtools/compumethods/compuscale.py +15 -26
- odxtools/compumethods/createanycompumethod.py +14 -160
- odxtools/compumethods/identicalcompumethod.py +31 -6
- odxtools/compumethods/linearcompumethod.py +69 -189
- odxtools/compumethods/linearsegment.py +193 -0
- odxtools/compumethods/scalelinearcompumethod.py +132 -26
- odxtools/compumethods/tabintpcompumethod.py +119 -99
- odxtools/compumethods/texttablecompumethod.py +107 -43
- odxtools/createanydiagcodedtype.py +10 -67
- odxtools/database.py +68 -62
- odxtools/dataobjectproperty.py +10 -19
- odxtools/description.py +47 -0
- odxtools/determinenumberofitems.py +4 -5
- odxtools/diagcodedtype.py +29 -12
- odxtools/diagcomm.py +10 -6
- odxtools/diagdatadictionaryspec.py +20 -21
- odxtools/diaglayer.py +34 -5
- odxtools/diaglayercontainer.py +17 -11
- odxtools/diaglayerraw.py +20 -21
- odxtools/diagnostictroublecode.py +7 -8
- odxtools/diagservice.py +9 -7
- odxtools/docrevision.py +5 -7
- odxtools/dopbase.py +7 -8
- odxtools/dtcdop.py +5 -8
- odxtools/dynamicendmarkerfield.py +22 -9
- odxtools/dynamiclengthfield.py +5 -11
- odxtools/element.py +4 -3
- odxtools/endofpdufield.py +0 -2
- odxtools/environmentdatadescription.py +4 -6
- odxtools/exceptions.py +1 -1
- odxtools/field.py +9 -9
- odxtools/functionalclass.py +3 -5
- odxtools/inputparam.py +3 -5
- odxtools/leadinglengthinfotype.py +15 -2
- odxtools/loadfile.py +64 -0
- odxtools/minmaxlengthtype.py +20 -2
- odxtools/modification.py +3 -5
- odxtools/multiplexer.py +7 -14
- odxtools/multiplexercase.py +4 -6
- odxtools/multiplexerdefaultcase.py +4 -6
- odxtools/multiplexerswitchkey.py +4 -5
- odxtools/negoutputparam.py +3 -5
- odxtools/outputparam.py +3 -5
- odxtools/parameterinfo.py +3 -3
- odxtools/parameters/codedconstparameter.py +2 -14
- odxtools/parameters/lengthkeyparameter.py +3 -17
- odxtools/parameters/nrcconstparameter.py +2 -14
- odxtools/parameters/parameter.py +22 -22
- odxtools/parameters/parameterwithdop.py +6 -8
- odxtools/parameters/physicalconstantparameter.py +5 -8
- odxtools/parameters/reservedparameter.py +4 -3
- odxtools/parameters/tablekeyparameter.py +6 -9
- odxtools/parameters/tablestructparameter.py +6 -8
- odxtools/parameters/valueparameter.py +5 -8
- odxtools/paramlengthinfotype.py +19 -6
- odxtools/parentref.py +15 -1
- odxtools/physicaldimension.py +3 -5
- odxtools/progcode.py +18 -7
- odxtools/protstack.py +3 -5
- odxtools/relateddoc.py +7 -9
- odxtools/request.py +8 -0
- odxtools/response.py +8 -0
- odxtools/scaleconstr.py +3 -3
- odxtools/singleecujob.py +12 -10
- odxtools/snrefcontext.py +29 -0
- odxtools/specialdata.py +3 -5
- odxtools/specialdatagroup.py +5 -7
- odxtools/specialdatagroupcaption.py +3 -6
- odxtools/standardlengthtype.py +27 -2
- odxtools/state.py +3 -5
- odxtools/statechart.py +9 -11
- odxtools/statetransition.py +4 -9
- odxtools/staticfield.py +4 -8
- odxtools/table.py +7 -8
- odxtools/tablerow.py +7 -6
- odxtools/teammember.py +3 -5
- odxtools/templates/comparam-spec.odx-c.xml.jinja2 +2 -5
- odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +2 -5
- odxtools/templates/macros/printCompanyData.xml.jinja2 +2 -5
- odxtools/templates/macros/printComparamRef.xml.jinja2 +5 -12
- odxtools/templates/macros/printCompuMethod.xml.jinja2 +153 -0
- odxtools/templates/macros/printDOP.xml.jinja2 +10 -132
- odxtools/templates/macros/printDescription.xml.jinja2 +18 -0
- odxtools/templates/macros/printElementId.xml.jinja2 +3 -3
- odxtools/templates/macros/printMux.xml.jinja2 +3 -2
- odxtools/templates/macros/printTable.xml.jinja2 +2 -3
- odxtools/unit.py +3 -5
- odxtools/unitgroup.py +3 -5
- odxtools/unitspec.py +9 -10
- odxtools/utils.py +1 -26
- odxtools/version.py +2 -2
- odxtools/{write_pdx_file.py → writepdxfile.py} +19 -10
- odxtools/xdoc.py +3 -5
- {odxtools-7.1.1.dist-info → odxtools-7.2.0.dist-info}/METADATA +1 -1
- odxtools-7.2.0.dist-info/RECORD +192 -0
- {odxtools-7.1.1.dist-info → odxtools-7.2.0.dist-info}/WHEEL +1 -1
- odxtools/createcompanydatas.py +0 -17
- odxtools/createsdgs.py +0 -19
- odxtools/load_file.py +0 -13
- odxtools/load_odx_d_file.py +0 -6
- odxtools/load_pdx_file.py +0 -8
- odxtools-7.1.1.dist-info/RECORD +0 -186
- /odxtools/templates/{index.xml.xml.jinja2 → index.xml.jinja2} +0 -0
- {odxtools-7.1.1.dist-info → odxtools-7.2.0.dist-info}/LICENSE +0 -0
- {odxtools-7.1.1.dist-info → odxtools-7.2.0.dist-info}/entry_points.txt +0 -0
- {odxtools-7.1.1.dist-info → odxtools-7.2.0.dist-info}/top_level.txt +0 -0
odxtools/functionalclass.py
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .element import IdentifiableElement
|
7
7
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
|
8
|
+
from .snrefcontext import SnRefContext
|
8
9
|
from .utils import dataclass_fields_asdict
|
9
10
|
|
10
|
-
if TYPE_CHECKING:
|
11
|
-
from .diaglayer import DiagLayer
|
12
|
-
|
13
11
|
|
14
12
|
@dataclass
|
15
13
|
class FunctionalClass(IdentifiableElement):
|
@@ -31,5 +29,5 @@ class FunctionalClass(IdentifiableElement):
|
|
31
29
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
32
30
|
pass
|
33
31
|
|
34
|
-
def _resolve_snrefs(self,
|
32
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
35
33
|
pass
|
odxtools/inputparam.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 Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from deprecation import deprecated
|
@@ -9,11 +9,9 @@ from .dopbase import DopBase
|
|
9
9
|
from .element import NamedElement
|
10
10
|
from .exceptions import odxrequire
|
11
11
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
|
12
|
+
from .snrefcontext import SnRefContext
|
12
13
|
from .utils import dataclass_fields_asdict
|
13
14
|
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from .diaglayer import DiagLayer
|
16
|
-
|
17
15
|
|
18
16
|
@dataclass
|
19
17
|
class InputParam(NamedElement):
|
@@ -44,7 +42,7 @@ class InputParam(NamedElement):
|
|
44
42
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
45
43
|
self._dop_base = odxlinks.resolve(self.dop_base_ref, DopBase)
|
46
44
|
|
47
|
-
def _resolve_snrefs(self,
|
45
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
48
46
|
pass
|
49
47
|
|
50
48
|
@property
|
@@ -1,14 +1,17 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Optional
|
3
|
+
from typing import List, Optional
|
4
|
+
from xml.etree import ElementTree
|
4
5
|
|
5
6
|
from typing_extensions import override
|
6
7
|
|
7
8
|
from .decodestate import DecodeState
|
8
9
|
from .diagcodedtype import DctType, DiagCodedType
|
9
10
|
from .encodestate import EncodeState
|
10
|
-
from .exceptions import EncodeError, odxassert, odxraise
|
11
|
+
from .exceptions import EncodeError, odxassert, odxraise, odxrequire
|
12
|
+
from .odxlink import OdxDocFragment
|
11
13
|
from .odxtypes import AtomicOdxType, DataType
|
14
|
+
from .utils import dataclass_fields_asdict
|
12
15
|
|
13
16
|
|
14
17
|
@dataclass
|
@@ -20,6 +23,16 @@ class LeadingLengthInfoType(DiagCodedType):
|
|
20
23
|
#: object.
|
21
24
|
bit_length: int
|
22
25
|
|
26
|
+
@staticmethod
|
27
|
+
@override
|
28
|
+
def from_et(et_element: ElementTree.Element,
|
29
|
+
doc_frags: List[OdxDocFragment]) -> "LeadingLengthInfoType":
|
30
|
+
kwargs = dataclass_fields_asdict(DiagCodedType.from_et(et_element, doc_frags))
|
31
|
+
|
32
|
+
bit_length = int(odxrequire(et_element.findtext("BIT-LENGTH")))
|
33
|
+
|
34
|
+
return LeadingLengthInfoType(bit_length=bit_length, **kwargs)
|
35
|
+
|
23
36
|
def __post_init__(self) -> None:
|
24
37
|
odxassert(self.bit_length > 0,
|
25
38
|
"A Leading length info type with bit length == 0 does not make sense.")
|
odxtools/loadfile.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
2
|
+
import os
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Union
|
5
|
+
|
6
|
+
from .database import Database
|
7
|
+
|
8
|
+
|
9
|
+
def load_pdx_file(pdx_file: Union[str, Path]) -> Database:
|
10
|
+
db = Database()
|
11
|
+
db.add_pdx_file(str(pdx_file))
|
12
|
+
db.refresh()
|
13
|
+
return db
|
14
|
+
|
15
|
+
|
16
|
+
def load_odx_d_file(odx_d_file_name: Union[str, Path]) -> Database:
|
17
|
+
db = Database()
|
18
|
+
db.add_odx_file(str(odx_d_file_name))
|
19
|
+
db.refresh()
|
20
|
+
|
21
|
+
return db
|
22
|
+
|
23
|
+
|
24
|
+
def load_file(file_name: Union[str, Path]) -> Database:
|
25
|
+
if str(file_name).lower().endswith(".pdx"):
|
26
|
+
return load_pdx_file(str(file_name))
|
27
|
+
elif str(file_name).lower().endswith(".odx-d"):
|
28
|
+
return load_odx_d_file(str(file_name))
|
29
|
+
else:
|
30
|
+
raise RuntimeError(f"Could not guess the file format of file '{file_name}'!")
|
31
|
+
|
32
|
+
|
33
|
+
def load_files(*file_names: Union[str, Path]) -> Database:
|
34
|
+
db = Database()
|
35
|
+
for file_name in file_names:
|
36
|
+
p = Path(file_name)
|
37
|
+
if p.suffix.lower() == ".pdx":
|
38
|
+
db.add_pdx_file(str(file_name))
|
39
|
+
elif p.suffix.lower().startswith(".odx"):
|
40
|
+
db.add_odx_file(str(file_name))
|
41
|
+
elif p.name.lower() != "index.xml":
|
42
|
+
db.add_auxiliary_file(str(file_name))
|
43
|
+
|
44
|
+
db.refresh()
|
45
|
+
return db
|
46
|
+
|
47
|
+
|
48
|
+
def load_directory(dir_name: Union[str, Path]) -> Database:
|
49
|
+
db = Database()
|
50
|
+
for file_name in os.listdir(str(dir_name)):
|
51
|
+
p = Path(dir_name) / file_name
|
52
|
+
|
53
|
+
if not p.is_file():
|
54
|
+
continue
|
55
|
+
|
56
|
+
if p.suffix.lower() == ".pdx":
|
57
|
+
db.add_pdx_file(str(p))
|
58
|
+
elif p.suffix.lower().startswith(".odx"):
|
59
|
+
db.add_odx_file(str(p))
|
60
|
+
elif p.name.lower() != "index.xml":
|
61
|
+
db.add_auxiliary_file(p.name, open(str(p), "rb"))
|
62
|
+
|
63
|
+
db.refresh()
|
64
|
+
return db
|
odxtools/minmaxlengthtype.py
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Optional
|
3
|
+
from typing import List, Optional
|
4
|
+
from xml.etree import ElementTree
|
4
5
|
|
5
6
|
from typing_extensions import override
|
6
7
|
|
7
8
|
from .decodestate import DecodeState
|
8
9
|
from .diagcodedtype import DctType, DiagCodedType
|
9
10
|
from .encodestate import EncodeState
|
10
|
-
from .exceptions import DecodeError, EncodeError, odxassert, odxraise
|
11
|
+
from .exceptions import DecodeError, EncodeError, odxassert, odxraise, odxrequire
|
12
|
+
from .odxlink import OdxDocFragment
|
11
13
|
from .odxtypes import AtomicOdxType, DataType
|
14
|
+
from .utils import dataclass_fields_asdict
|
12
15
|
|
13
16
|
|
14
17
|
@dataclass
|
@@ -17,6 +20,21 @@ class MinMaxLengthType(DiagCodedType):
|
|
17
20
|
max_length: Optional[int]
|
18
21
|
termination: str
|
19
22
|
|
23
|
+
@staticmethod
|
24
|
+
@override
|
25
|
+
def from_et(et_element: ElementTree.Element,
|
26
|
+
doc_frags: List[OdxDocFragment]) -> "MinMaxLengthType":
|
27
|
+
kwargs = dataclass_fields_asdict(DiagCodedType.from_et(et_element, doc_frags))
|
28
|
+
|
29
|
+
min_length = int(odxrequire(et_element.findtext("MIN-LENGTH")))
|
30
|
+
max_length = None
|
31
|
+
if et_element.find("MAX-LENGTH") is not None:
|
32
|
+
max_length = int(odxrequire(et_element.findtext("MAX-LENGTH")))
|
33
|
+
termination = odxrequire(et_element.get("TERMINATION"))
|
34
|
+
|
35
|
+
return MinMaxLengthType(
|
36
|
+
min_length=min_length, max_length=max_length, termination=termination, **kwargs)
|
37
|
+
|
20
38
|
def __post_init__(self) -> None:
|
21
39
|
odxassert(self.max_length is None or self.min_length <= self.max_length)
|
22
40
|
odxassert(
|
odxtools/modification.py
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
|
7
|
-
|
8
|
-
if TYPE_CHECKING:
|
9
|
-
from .diaglayer import DiagLayer
|
7
|
+
from .snrefcontext import SnRefContext
|
10
8
|
|
11
9
|
|
12
10
|
@dataclass
|
@@ -27,5 +25,5 @@ class Modification:
|
|
27
25
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
28
26
|
pass
|
29
27
|
|
30
|
-
def _resolve_snrefs(self,
|
28
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
31
29
|
pass
|
odxtools/multiplexer.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 Any, Dict, List, Optional, Tuple
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from typing_extensions import override
|
@@ -14,11 +14,9 @@ from .multiplexerdefaultcase import MultiplexerDefaultCase
|
|
14
14
|
from .multiplexerswitchkey import MultiplexerSwitchKey
|
15
15
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
|
16
16
|
from .odxtypes import AtomicOdxType, ParameterValue, odxstr_to_bool
|
17
|
+
from .snrefcontext import SnRefContext
|
17
18
|
from .utils import dataclass_fields_asdict
|
18
19
|
|
19
|
-
if TYPE_CHECKING:
|
20
|
-
from .diaglayer import DiagLayer
|
21
|
-
|
22
20
|
|
23
21
|
@dataclass
|
24
22
|
class Multiplexer(ComplexDop):
|
@@ -90,7 +88,6 @@ class Multiplexer(ComplexDop):
|
|
90
88
|
with only one key equal to the desired case""")
|
91
89
|
|
92
90
|
orig_origin = encode_state.origin_byte_position
|
93
|
-
orig_cursor = encode_state.cursor_byte_position
|
94
91
|
|
95
92
|
encode_state.origin_byte_position = encode_state.cursor_byte_position
|
96
93
|
|
@@ -120,8 +117,6 @@ class Multiplexer(ComplexDop):
|
|
120
117
|
physical_value=key_value, encode_state=encode_state)
|
121
118
|
|
122
119
|
encode_state.origin_byte_position = orig_origin
|
123
|
-
encode_state.cursor_byte_position = max(orig_cursor,
|
124
|
-
encode_state.cursor_byte_position)
|
125
120
|
return
|
126
121
|
|
127
122
|
raise EncodeError(f"The case {case_name} is not found in Multiplexer {self.short_name}")
|
@@ -132,7 +127,6 @@ class Multiplexer(ComplexDop):
|
|
132
127
|
# multiplexers are structures and thus the origin position
|
133
128
|
# must be moved to the start of the multiplexer
|
134
129
|
orig_origin = decode_state.origin_byte_position
|
135
|
-
orig_cursor = decode_state.cursor_byte_position
|
136
130
|
if self.byte_position is not None:
|
137
131
|
decode_state.cursor_byte_position = decode_state.origin_byte_position + self.byte_position
|
138
132
|
decode_state.origin_byte_position = decode_state.cursor_byte_position
|
@@ -164,7 +158,6 @@ class Multiplexer(ComplexDop):
|
|
164
158
|
|
165
159
|
# go back to the original origin
|
166
160
|
decode_state.origin_byte_position = orig_origin
|
167
|
-
decode_state.cursor_byte_position = max(orig_cursor, decode_state.cursor_byte_position)
|
168
161
|
|
169
162
|
return mux_value
|
170
163
|
|
@@ -191,12 +184,12 @@ class Multiplexer(ComplexDop):
|
|
191
184
|
odxlinks, key_physical_type=self.switch_key.dop.physical_type.base_data_type)
|
192
185
|
|
193
186
|
@override
|
194
|
-
def _resolve_snrefs(self,
|
195
|
-
super()._resolve_snrefs(
|
187
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
188
|
+
super()._resolve_snrefs(context)
|
196
189
|
|
197
|
-
self.switch_key._resolve_snrefs(
|
190
|
+
self.switch_key._resolve_snrefs(context)
|
198
191
|
if self.default_case is not None:
|
199
|
-
self.default_case._resolve_snrefs(
|
192
|
+
self.default_case._resolve_snrefs(context)
|
200
193
|
|
201
194
|
for mux_case in self.cases:
|
202
|
-
mux_case._resolve_snrefs(
|
195
|
+
mux_case._resolve_snrefs(context)
|
odxtools/multiplexercase.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 Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .basicstructure import BasicStructure
|
@@ -9,11 +9,9 @@ from .element import NamedElement
|
|
9
9
|
from .exceptions import odxrequire
|
10
10
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef, resolve_snref
|
11
11
|
from .odxtypes import AtomicOdxType, DataType
|
12
|
+
from .snrefcontext import SnRefContext
|
12
13
|
from .utils import dataclass_fields_asdict
|
13
14
|
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from .diaglayer import DiagLayer
|
16
|
-
|
17
15
|
|
18
16
|
@dataclass
|
19
17
|
class MultiplexerCase(NamedElement):
|
@@ -70,9 +68,9 @@ class MultiplexerCase(NamedElement):
|
|
70
68
|
self.lower_limit.set_value_type(key_physical_type)
|
71
69
|
self.upper_limit.set_value_type(key_physical_type)
|
72
70
|
|
73
|
-
def _resolve_snrefs(self,
|
71
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
74
72
|
if self.structure_snref:
|
75
|
-
ddds = diag_layer.diag_data_dictionary_spec
|
73
|
+
ddds = odxrequire(context.diag_layer).diag_data_dictionary_spec
|
76
74
|
self._structure = resolve_snref(self.structure_snref, ddds.structures, BasicStructure)
|
77
75
|
|
78
76
|
def applies(self, value: AtomicOdxType) -> bool:
|
@@ -1,17 +1,15 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .basicstructure import BasicStructure
|
7
7
|
from .element import NamedElement
|
8
8
|
from .exceptions import odxrequire
|
9
9
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef, resolve_snref
|
10
|
+
from .snrefcontext import SnRefContext
|
10
11
|
from .utils import dataclass_fields_asdict
|
11
12
|
|
12
|
-
if TYPE_CHECKING:
|
13
|
-
from .diaglayer import DiagLayer
|
14
|
-
|
15
13
|
|
16
14
|
@dataclass
|
17
15
|
class MultiplexerDefaultCase(NamedElement):
|
@@ -43,9 +41,9 @@ class MultiplexerDefaultCase(NamedElement):
|
|
43
41
|
if self.structure_ref is not None:
|
44
42
|
self._structure = odxlinks.resolve(self.structure_ref)
|
45
43
|
|
46
|
-
def _resolve_snrefs(self,
|
44
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
47
45
|
if self.structure_snref:
|
48
|
-
ddds = diag_layer.diag_data_dictionary_spec
|
46
|
+
ddds = odxrequire(context.diag_layer).diag_data_dictionary_spec
|
49
47
|
self._structure = resolve_snref(self.structure_snref, ddds.structures, BasicStructure)
|
50
48
|
|
51
49
|
@property
|
odxtools/multiplexerswitchkey.py
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
1
2
|
from dataclasses import dataclass
|
2
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional
|
3
4
|
from xml.etree import ElementTree
|
4
5
|
|
5
6
|
from .dataobjectproperty import DataObjectProperty
|
6
7
|
from .exceptions import odxrequire
|
7
8
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
|
8
|
-
|
9
|
-
if TYPE_CHECKING:
|
10
|
-
from .diaglayer import DiagLayer
|
9
|
+
from .snrefcontext import SnRefContext
|
11
10
|
|
12
11
|
|
13
12
|
@dataclass
|
@@ -39,7 +38,7 @@ class MultiplexerSwitchKey:
|
|
39
38
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
40
39
|
self._dop = odxlinks.resolve(self.dop_ref, DataObjectProperty)
|
41
40
|
|
42
|
-
def _resolve_snrefs(self,
|
41
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
43
42
|
pass
|
44
43
|
|
45
44
|
@property
|
odxtools/negoutputparam.py
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from .dopbase import DopBase
|
7
7
|
from .element import NamedElement
|
8
8
|
from .exceptions import odxrequire
|
9
9
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
|
10
|
+
from .snrefcontext import SnRefContext
|
10
11
|
from .utils import dataclass_fields_asdict
|
11
12
|
|
12
|
-
if TYPE_CHECKING:
|
13
|
-
from .diaglayer import DiagLayer
|
14
|
-
|
15
13
|
|
16
14
|
@dataclass
|
17
15
|
class NegOutputParam(NamedElement):
|
@@ -35,7 +33,7 @@ class NegOutputParam(NamedElement):
|
|
35
33
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
36
34
|
self._dop = odxlinks.resolve(self.dop_base_ref)
|
37
35
|
|
38
|
-
def _resolve_snrefs(self,
|
36
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
39
37
|
pass
|
40
38
|
|
41
39
|
@property
|
odxtools/outputparam.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 Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from deprecation import deprecated
|
@@ -9,11 +9,9 @@ from .dopbase import DopBase
|
|
9
9
|
from .element import IdentifiableElement
|
10
10
|
from .exceptions import odxrequire
|
11
11
|
from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
|
12
|
+
from .snrefcontext import SnRefContext
|
12
13
|
from .utils import dataclass_fields_asdict
|
13
14
|
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from .diaglayer import DiagLayer
|
16
|
-
|
17
15
|
|
18
16
|
@dataclass
|
19
17
|
class OutputParam(IdentifiableElement):
|
@@ -37,7 +35,7 @@ class OutputParam(IdentifiableElement):
|
|
37
35
|
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
38
36
|
self._dop_base = odxlinks.resolve(self.dop_base_ref, DopBase)
|
39
37
|
|
40
|
-
def _resolve_snrefs(self,
|
38
|
+
def _resolve_snrefs(self, context: SnRefContext) -> None:
|
41
39
|
pass
|
42
40
|
|
43
41
|
@property
|
odxtools/parameterinfo.py
CHANGED
@@ -128,7 +128,7 @@ def parameter_info(param_list: Iterable[Parameter], quoted_names: bool = False)
|
|
128
128
|
|
129
129
|
if isinstance(cm, TexttableCompuMethod):
|
130
130
|
of.write(f": enum; choices:\n")
|
131
|
-
for scale in cm.
|
131
|
+
for scale in odxrequire(cm.compu_internal_to_phys).compu_scales:
|
132
132
|
val_str = ""
|
133
133
|
if scale.lower_limit is not None:
|
134
134
|
val_str = f"({repr(scale.lower_limit.value)})"
|
@@ -166,8 +166,8 @@ def parameter_info(param_list: Iterable[Parameter], quoted_names: bool = False)
|
|
166
166
|
else:
|
167
167
|
of.write(f": <unknown type>")
|
168
168
|
|
169
|
-
ll = cm.physical_lower_limit
|
170
|
-
ul = cm.physical_upper_limit
|
169
|
+
ll = cm.segment.physical_lower_limit
|
170
|
+
ul = cm.segment.physical_upper_limit
|
171
171
|
if ll is None or ll.interval_type == IntervalType.INFINITE:
|
172
172
|
ll_str = "(-inf"
|
173
173
|
else:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import warnings
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import
|
4
|
+
from typing import Any, Dict, List, Optional
|
5
5
|
from xml.etree import ElementTree
|
6
6
|
|
7
7
|
from typing_extensions import override
|
@@ -11,14 +11,11 @@ from ..decodestate import DecodeState
|
|
11
11
|
from ..diagcodedtype import DiagCodedType
|
12
12
|
from ..encodestate import EncodeState
|
13
13
|
from ..exceptions import DecodeError, EncodeError, odxraise, odxrequire
|
14
|
-
from ..odxlink import OdxDocFragment,
|
14
|
+
from ..odxlink import OdxDocFragment, OdxLinkId
|
15
15
|
from ..odxtypes import AtomicOdxType, DataType, ParameterValue
|
16
16
|
from ..utils import dataclass_fields_asdict
|
17
17
|
from .parameter import Parameter, ParameterType
|
18
18
|
|
19
|
-
if TYPE_CHECKING:
|
20
|
-
from ..diaglayer import DiagLayer
|
21
|
-
|
22
19
|
|
23
20
|
@dataclass
|
24
21
|
class CodedConstParameter(Parameter):
|
@@ -54,15 +51,6 @@ class CodedConstParameter(Parameter):
|
|
54
51
|
|
55
52
|
return result
|
56
53
|
|
57
|
-
@override
|
58
|
-
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
59
|
-
super()._resolve_odxlinks(odxlinks)
|
60
|
-
|
61
|
-
@override
|
62
|
-
def _parameter_resolve_snrefs(self, diag_layer: "DiagLayer", *,
|
63
|
-
param_list: List[Parameter]) -> None:
|
64
|
-
super()._parameter_resolve_snrefs(diag_layer, param_list=param_list)
|
65
|
-
|
66
54
|
@override
|
67
55
|
def get_static_bit_length(self) -> Optional[int]:
|
68
56
|
return self.diag_coded_type.get_static_bit_length()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional
|
4
4
|
from xml.etree import ElementTree
|
5
5
|
|
6
6
|
from typing_extensions import final, override
|
@@ -8,15 +8,12 @@ from typing_extensions import final, override
|
|
8
8
|
from ..decodestate import DecodeState
|
9
9
|
from ..encodestate import EncodeState
|
10
10
|
from ..exceptions import EncodeError, odxraise, odxrequire
|
11
|
-
from ..odxlink import OdxDocFragment,
|
11
|
+
from ..odxlink import OdxDocFragment, OdxLinkId
|
12
12
|
from ..odxtypes import ParameterValue
|
13
13
|
from ..utils import dataclass_fields_asdict
|
14
|
-
from .parameter import
|
14
|
+
from .parameter import ParameterType
|
15
15
|
from .parameterwithdop import ParameterWithDOP
|
16
16
|
|
17
|
-
if TYPE_CHECKING:
|
18
|
-
from ..diaglayer import DiagLayer
|
19
|
-
|
20
17
|
|
21
18
|
@dataclass
|
22
19
|
class LengthKeyParameter(ParameterWithDOP):
|
@@ -55,15 +52,6 @@ class LengthKeyParameter(ParameterWithDOP):
|
|
55
52
|
|
56
53
|
return result
|
57
54
|
|
58
|
-
@override
|
59
|
-
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
60
|
-
super()._resolve_odxlinks(odxlinks)
|
61
|
-
|
62
|
-
@override
|
63
|
-
def _parameter_resolve_snrefs(self, diag_layer: "DiagLayer", *,
|
64
|
-
param_list: List[Parameter]) -> None:
|
65
|
-
super()._parameter_resolve_snrefs(diag_layer, param_list=param_list)
|
66
|
-
|
67
55
|
@property
|
68
56
|
@override
|
69
57
|
def is_required(self) -> bool:
|
@@ -107,7 +95,6 @@ class LengthKeyParameter(ParameterWithDOP):
|
|
107
95
|
|
108
96
|
encode_state.length_keys[self.short_name] = physical_value
|
109
97
|
|
110
|
-
orig_cursor = encode_state.cursor_byte_position
|
111
98
|
pos = encode_state.cursor_byte_position
|
112
99
|
if self.byte_position is not None:
|
113
100
|
pos = encode_state.origin_byte_position + self.byte_position
|
@@ -120,7 +107,6 @@ class LengthKeyParameter(ParameterWithDOP):
|
|
120
107
|
tmp_val = b'\x00' * ((n + 7) // 8)
|
121
108
|
encode_state.emplace_bytes(tmp_val, obj_used_mask=tmp_val)
|
122
109
|
|
123
|
-
encode_state.cursor_byte_position = max(encode_state.cursor_byte_position, orig_cursor)
|
124
110
|
encode_state.cursor_bit_position = 0
|
125
111
|
|
126
112
|
def encode_value_into_pdu(self, encode_state: EncodeState) -> None:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
2
2
|
import warnings
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import
|
4
|
+
from typing import Any, Dict, List, Optional, cast
|
5
5
|
from xml.etree import ElementTree
|
6
6
|
|
7
7
|
from typing_extensions import override
|
@@ -11,14 +11,11 @@ from ..decodestate import DecodeState
|
|
11
11
|
from ..diagcodedtype import DiagCodedType
|
12
12
|
from ..encodestate import EncodeState
|
13
13
|
from ..exceptions import DecodeError, EncodeError, odxraise, odxrequire
|
14
|
-
from ..odxlink import OdxDocFragment,
|
14
|
+
from ..odxlink import OdxDocFragment, OdxLinkId
|
15
15
|
from ..odxtypes import AtomicOdxType, DataType, ParameterValue
|
16
16
|
from ..utils import dataclass_fields_asdict
|
17
17
|
from .parameter import Parameter, ParameterType
|
18
18
|
|
19
|
-
if TYPE_CHECKING:
|
20
|
-
from ..diaglayer import DiagLayer
|
21
|
-
|
22
19
|
|
23
20
|
@dataclass
|
24
21
|
class NrcConstParameter(Parameter):
|
@@ -70,15 +67,6 @@ class NrcConstParameter(Parameter):
|
|
70
67
|
|
71
68
|
return result
|
72
69
|
|
73
|
-
@override
|
74
|
-
def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
|
75
|
-
super()._resolve_odxlinks(odxlinks)
|
76
|
-
|
77
|
-
@override
|
78
|
-
def _parameter_resolve_snrefs(self, diag_layer: "DiagLayer", *,
|
79
|
-
param_list: List[Parameter]) -> None:
|
80
|
-
super()._parameter_resolve_snrefs(diag_layer, param_list=param_list)
|
81
|
-
|
82
70
|
@override
|
83
71
|
def get_static_bit_length(self) -> Optional[int]:
|
84
72
|
return self.diag_coded_type.get_static_bit_length()
|