odxtools 8.0.6__py3-none-any.whl → 8.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.
Files changed (66) hide show
  1. odxtools/audience.py +7 -8
  2. odxtools/compumethods/compucodecompumethod.py +63 -0
  3. odxtools/compumethods/compuinternaltophys.py +19 -2
  4. odxtools/compumethods/compumethod.py +28 -2
  5. odxtools/compumethods/compuphystointernal.py +19 -2
  6. odxtools/compumethods/createanycompumethod.py +12 -0
  7. odxtools/compumethods/linearcompumethod.py +2 -2
  8. odxtools/compumethods/ratfunccompumethod.py +106 -0
  9. odxtools/compumethods/ratfuncsegment.py +87 -0
  10. odxtools/compumethods/scaleratfunccompumethod.py +113 -0
  11. odxtools/dataobjectproperty.py +3 -0
  12. odxtools/diaglayers/basevariantraw.py +7 -1
  13. odxtools/diaglayers/ecushareddataraw.py +7 -1
  14. odxtools/diaglayers/ecuvariantraw.py +7 -1
  15. odxtools/diaglayers/functionalgroupraw.py +7 -1
  16. odxtools/diaglayers/hierarchyelementraw.py +7 -1
  17. odxtools/diaglayers/protocolraw.py +7 -1
  18. odxtools/dtcdop.py +6 -0
  19. odxtools/element.py +9 -12
  20. odxtools/environmentdatadescription.py +11 -6
  21. odxtools/multiplexer.py +4 -4
  22. odxtools/multiplexercase.py +1 -1
  23. odxtools/odxtypes.py +14 -0
  24. odxtools/outputparam.py +1 -3
  25. odxtools/parameterinfo.py +132 -76
  26. odxtools/parameters/parameter.py +3 -0
  27. odxtools/parameters/systemparameter.py +51 -8
  28. odxtools/physicaldimension.py +1 -4
  29. odxtools/standardlengthtype.py +4 -1
  30. odxtools/templates/macros/printAudience.xml.jinja2 +1 -1
  31. odxtools/templates/macros/printCompanyData.xml.jinja2 +2 -2
  32. odxtools/templates/macros/printComparam.xml.jinja2 +2 -2
  33. odxtools/templates/macros/printDOP.xml.jinja2 +1 -1
  34. odxtools/templates/macros/printDiagComm.xml.jinja2 +1 -1
  35. odxtools/templates/macros/printDiagLayer.xml.jinja2 +1 -1
  36. odxtools/templates/macros/printDiagVariable.xml.jinja2 +3 -3
  37. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +1 -1
  38. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +1 -1
  39. odxtools/templates/macros/printElementId.xml.jinja2 +5 -0
  40. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  41. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  42. odxtools/templates/macros/printFunctionalClass.xml.jinja2 +1 -1
  43. odxtools/templates/macros/printMux.xml.jinja2 +1 -1
  44. odxtools/templates/macros/printParam.xml.jinja2 +2 -2
  45. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  46. odxtools/templates/macros/printRequest.xml.jinja2 +1 -1
  47. odxtools/templates/macros/printResponse.xml.jinja2 +1 -1
  48. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +1 -1
  49. odxtools/templates/macros/printSpecialData.xml.jinja2 +1 -1
  50. odxtools/templates/macros/printState.xml.jinja2 +1 -1
  51. odxtools/templates/macros/printStateChart.xml.jinja2 +1 -1
  52. odxtools/templates/macros/printStateTransition.xml.jinja2 +1 -1
  53. odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
  54. odxtools/templates/macros/printStructure.xml.jinja2 +1 -1
  55. odxtools/templates/macros/printTable.xml.jinja2 +2 -2
  56. odxtools/templates/macros/printUnitSpec.xml.jinja2 +3 -5
  57. odxtools/unit.py +1 -3
  58. odxtools/unitspec.py +10 -9
  59. odxtools/version.py +2 -2
  60. odxtools/writepdxfile.py +1 -0
  61. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/METADATA +1 -1
  62. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/RECORD +66 -62
  63. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/WHEEL +1 -1
  64. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/LICENSE +0 -0
  65. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/entry_points.txt +0 -0
  66. {odxtools-8.0.6.dist-info → odxtools-8.2.0.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,7 @@
8
8
  {%- import('macros/printDescription.xml.jinja2') as pd %}
9
9
 
10
10
  {%- macro printCompanyData(company_data) %}
11
- <COMPANY-DATA ID="{{company_data.odx_id.local_id}}">
11
+ <COMPANY-DATA {{-peid.printElementIdAttribs(company_data)}}>
12
12
  {{ peid.printElementIdSubtags(company_data)|indent(1) }}
13
13
  {%- if company_data.roles is not none %}
14
14
  <ROLES>
@@ -20,7 +20,7 @@
20
20
  {%- if company_data.team_members is not none %}
21
21
  <TEAM-MEMBERS>
22
22
  {%- for team_member in company_data.team_members %}
23
- <TEAM-MEMBER ID="{{team_member.odx_id.local_id}}">
23
+ <TEAM-MEMBER {{-peid.printElementIdAttribs(team_member)}}>
24
24
  {{ peid.printElementIdSubtags(team_member)|indent(3) }}
25
25
  {%- if team_member.roles is not none %}
26
26
  <ROLES>
@@ -38,7 +38,7 @@
38
38
  {%- endmacro %}
39
39
 
40
40
  {%- macro printSimpleComparam(cp) %}
41
- <COMPARAM ID="{{cp.odx_id.local_id}}"
41
+ <COMPARAM {{-peid.printElementIdAttribs(cp)}}
42
42
  PARAM-CLASS="{{cp.param_class}}"
43
43
  CPTYPE="{{cp.cptype.value}}"
44
44
  {{make_xml_attrib("DISPLAY-LEVEL", cp.display_level)}}{#- #}
@@ -52,7 +52,7 @@
52
52
  {%- endmacro %}
53
53
 
54
54
  {%- macro printComplexComparam(cp) %}
55
- <COMPLEX-COMPARAM ID="{{cp.odx_id.local_id}}"
55
+ <COMPLEX-COMPARAM {{-peid.printElementIdAttribs(cp)}}
56
56
  PARAM-CLASS="{{cp.param_class}}"
57
57
  CPTYPE="{{cp.cptype.value}}"
58
58
  {{make_xml_attrib("DISPLAY-LEVEL", cp.display_level)}}{#- #}
@@ -130,7 +130,7 @@
130
130
  {%- if hasattr(dtc, "ref_id") %}
131
131
  <DTC-REF ID-REF="{{dtc.ref_id}}" />
132
132
  {%- else %}
133
- <DTC ID="{{dtc.odx_id.local_id}}">
133
+ <DTC {{-peid.printElementIdAttribs(dtc)}}>
134
134
  <SHORT-NAME>{{dtc.short_name}}</SHORT-NAME>
135
135
  <TROUBLE-CODE>{{dtc.trouble_code}}</TROUBLE-CODE>
136
136
  {%- if dtc.display_trouble_code is not none %}
@@ -9,7 +9,7 @@
9
9
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
10
10
 
11
11
  {%- macro printDiagCommAttribs(dc) -%}
12
- ID="{{dc.odx_id.local_id}}"
12
+ {{-peid.printElementIdAttribs(dc)}}
13
13
  {{-make_xml_attrib("SEMANTIC", dc.semantic)}}
14
14
  {{-make_xml_attrib("DIAGNOSTIC-CLASS", dc.diagnostic_class and dc.diagnostic_class.value)}}
15
15
  {{-make_bool_xml_attrib("IS-MANDATORY", dc.is_mandatory_raw)}}
@@ -27,7 +27,7 @@
27
27
  {%- import('macros/printAdminData.xml.jinja2') as pad %}
28
28
 
29
29
  {%- macro printDiagLayerAttribs(dl) -%}
30
- {#- #} ID="{{dl.diag_layer_raw.odx_id.local_id}}"{# -#}
30
+ {#- #} {{-peid.printElementIdAttribs(dl)}}{# -#}
31
31
  {%- endmacro -%}
32
32
 
33
33
  {%- macro printDiagLayerSubtags(dl) -%}
@@ -7,7 +7,7 @@
7
7
  {%- import('macros/printDescription.xml.jinja2') as pd %}
8
8
 
9
9
  {%- macro printDiagVariable(diag_var) -%}
10
- <DIAG-VARIABLE>
10
+ <DIAG-VARIABLE {{-peid.printElementIdAttribs(diag_var)}}>
11
11
  {{ peid.printElementIdSubtags(diag_variable)|indent(2) }}
12
12
  {%- if diag_variable.admin_data is not none %}
13
13
  {{ pad.printAdminData(diag_variable.admin_data)|indent(2) }}
@@ -16,7 +16,7 @@
16
16
  {%- if diag_variable.sw_variables %}
17
17
  <SW-VARIABLES>
18
18
  {%- for sw_var in diag_variable.sw_variables %}
19
- <SW-VARIABLE>
19
+ <SW-VARIABLE {{-peid.printElementIdAttribs(sw_var)}}>
20
20
  {{ peid.printElementIdSubtags(sw_var)|indent(6) }}
21
21
  {%- if sw_var.origin is not none %}
22
22
  <ORIGIN>{{ sw_var.origin }}</ORIGIN>
@@ -60,7 +60,7 @@
60
60
  {%- endmacro -%}
61
61
 
62
62
  {%- macro printVariableGroup(var_group) -%}
63
- <VARIABLE-GROUP>
63
+ <VARIABLE-GROUP {{-peid.printElementIdAttribs(var_group)}}>
64
64
  {{ peid.printElementIdSubtags(diag_variable)|indent(2) }}
65
65
  </VARIABLE-GROUP>
66
66
  {%- endmacro -%}
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printStaticField(demf) -%}
9
- <DYNAMIC-ENDMARKER-FIELD ID="{{demf.odx_id.local_id}}">
9
+ <DYNAMIC-ENDMARKER-FIELD {{-peid.printElementIdAttribs(demf)}}>
10
10
  {{ peid.printElementIdSubtags(demf)|indent(1) }}
11
11
  <BASIC-STRUCTURE-REF ID-REF="{{demf.structure_ref.ref_id}}" />
12
12
  <DYN-END-DOP-REF ID-REF="{{demf.dyn_end_dop_ref.ref_id}}">
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printDynamicLengthField(dlf) -%}
9
- <DYNAMIC-LENGTH-FIELD ID="{{dlf.odx_id.local_id}}">
9
+ <DYNAMIC-LENGTH-FIELD {{-peid.printElementIdAttribs(dlf)}}>
10
10
  {{ peid.printElementIdSubtags(dlf)|indent(1) }}
11
11
  <BASIC-STRUCTURE-REF ID-REF="{{dlf.structure_ref.ref_id}}" />
12
12
  <OFFSET>{{dlf.offset}}</OFFSET>
@@ -5,6 +5,11 @@
5
5
 
6
6
  {%- import('macros/printDescription.xml.jinja2') as pd %}
7
7
 
8
+ {%- macro printElementIdAttribs(obj) -%}
9
+ {#- #} {{- make_xml_attrib("ID", obj.odx_id.local_id) }}
10
+ {#- #} {{- make_xml_attrib("OID", getattr(obj, "oid", none)) -}}
11
+ {%- endmacro -%}
12
+
8
13
  {%- macro printElementIdSubtags(obj) -%}
9
14
  <SHORT-NAME>{{ obj.short_name }}</SHORT-NAME>
10
15
  {%- if obj.long_name %}
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printEndOfPdu(eopdu) -%}
9
- <END-OF-PDU-FIELD ID="{{eopdu.odx_id.local_id}}">
9
+ <END-OF-PDU-FIELD {{-peid.printElementIdAttribs(eopdu)}}>
10
10
  {{ peid.printElementIdSubtags(eopdu)|indent(1) }}
11
11
  <BASIC-STRUCTURE-REF ID-REF="{{eopdu.structure_ref.ref_id}}" />
12
12
  {%- if eopdu.max_number_of_items is not none %}
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printEnvDataDesc(env_data_desc) %}
9
- <ENV-DATA-DESC ID="{{env_data_desc.odx_id.local_id}}">
9
+ <ENV-DATA-DESC {{-peid.printElementIdAttribs(env_data_desc)}}>
10
10
  {{ peid.printElementIdSubtags(env_data_desc)|indent(1) }}
11
11
  <PARAM-SNREF SHORT-NAME="{{env_data_desc.param_snref}}"/>
12
12
  <ENV-DATA-REFS>
@@ -7,7 +7,7 @@
7
7
  {%- import('macros/printElementId.xml.jinja2') as peid %}
8
8
 
9
9
  {%- macro printFunctionalClass(fc) -%}
10
- <FUNCT-CLASS ID="{{fc.odx_id.local_id}}">
10
+ <FUNCT-CLASS {{-peid.printElementIdAttribs(fc)}}>
11
11
  {{ peid.printElementIdSubtags(fc)|indent(1) }}
12
12
  </FUNCT-CLASS>
13
13
  {%- endmacro -%}
@@ -8,7 +8,7 @@
8
8
  {%- import('macros/printDOP.xml.jinja2') as pdop %}
9
9
 
10
10
  {%- macro printMux(mux) %}
11
- <MUX ID="{{mux.odx_id.local_id}}"
11
+ <MUX {{-peid.printElementIdAttribs(mux)}}
12
12
  {{-make_bool_xml_attrib("IS-VISIBLE", mux.is_visible_raw)}}
13
13
  {#- #}>
14
14
  {{ peid.printElementIdSubtags(mux)|indent(1) }}
@@ -11,8 +11,8 @@
11
11
  {%- set semattrib = make_xml_attrib("SEMANTIC", param.semantic) -%}
12
12
  {%- if param.parameter_type == "TABLE-KEY" %}
13
13
  <PARAM {{ semattrib }}
14
- {{- make_xml_attrib("ID", param.odx_id and param.odx_id.local_id) }}
15
- xsi:type="{{param.parameter_type}}">
14
+ {{-peid.printElementIdAttribs(param)}}
15
+ xsi:type="{{param.parameter_type}}">
16
16
  {%- elif param.parameter_type == "SYSTEM" %}
17
17
  <PARAM {{ semattrib }}
18
18
  {{- make_xml_attrib("SYSPARAM", param.sysparam) }}
@@ -7,7 +7,7 @@
7
7
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
8
8
 
9
9
  {%- macro printProtStack(ps) %}
10
- <PROT-STACK ID="{{ps.odx_id.local_id}}">
10
+ <PROT-STACK {{-peid.printElementIdAttribs(ps)}}>
11
11
  {{ peid.printElementIdSubtags(ps) | indent(1) }}
12
12
  <PDU-PROTOCOL-TYPE>{{ ps.pdu_protocol_type }}</PDU-PROTOCOL-TYPE>
13
13
  <PHYSICAL-LINK-TYPE>{{ ps.physical_link_type }}</PHYSICAL-LINK-TYPE>
@@ -9,7 +9,7 @@
9
9
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
10
10
 
11
11
  {%- macro printRequest(request) -%}
12
- <REQUEST ID="{{request.odx_id.local_id}}">
12
+ <REQUEST {{-peid.printElementIdAttribs(request)}}>
13
13
  {{ peid.printElementIdSubtags(request)|indent(1) }}
14
14
  {%- if request.parameters %}
15
15
  <PARAMS>
@@ -8,7 +8,7 @@
8
8
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
9
9
 
10
10
  {%- macro printResponse(resp, tag_name="POS-RESPONSE") -%}
11
- <{{tag_name}} ID="{{resp.odx_id.local_id}}">
11
+ <{{tag_name}} {{-peid.printElementIdAttribs(resp)}}>
12
12
  {{ peid.printElementIdSubtags(resp)|indent(1) }}
13
13
  {%- if resp.parameters %}
14
14
  <PARAMS>
@@ -73,7 +73,7 @@
73
73
  {%- endmacro -%}
74
74
 
75
75
  {%- macro printOutputParam(param) -%}
76
- <OUTPUT-PARAM ID="{{param.odx_id.local_id}}"
76
+ <OUTPUT-PARAM {{-peid.printElementIdAttribs(param)}}
77
77
  {{-make_xml_attrib("OID", param.oid)}}
78
78
  {{-make_xml_attrib("SEMANTIC", param.semantic)}}>
79
79
  {{ peid.printElementIdSubtags(param)|indent(1) }}
@@ -17,7 +17,7 @@
17
17
  {%- endmacro %}
18
18
 
19
19
  {%- macro printSdgCaption(sdg_caption) %}
20
- <SDG-CAPTION ID="{{sdg_caption.odx_id.local_id}}">
20
+ <SDG-CAPTION {{-peid.printElementIdAttribs(sdg_caption)}}>
21
21
  {{ peid.printElementIdSubtags(sdg_caption)|indent(1) }}
22
22
  </SDG-CAPTION>
23
23
  {%- endmacro %}
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printState(state) -%}
9
- <STATE ID="{{state.odx_id.local_id}}">
9
+ <STATE {{-peid.printElementIdAttribs(state)}}>
10
10
  {{ peid.printElementIdSubtags(state)|indent(1) }}
11
11
  </STATE>
12
12
  {%- endmacro -%}
@@ -8,7 +8,7 @@
8
8
  {%- import('macros/printStateTransition.xml.jinja2') as pst %}
9
9
 
10
10
  {%- macro printStateChart(state_chart) -%}
11
- <STATE-CHART ID="{{state_chart.odx_id.local_id}}">
11
+ <STATE-CHART {{-peid.printElementIdAttribs(state_chart)}}>
12
12
  {{ peid.printElementIdSubtags(state_chart)|indent(1) }}
13
13
  <SEMANTIC>{{state_chart.semantic}}</SEMANTIC>
14
14
  {%- if state_chart.state_transitions %}
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printStateTransition(state_transition) -%}
9
- <STATE-TRANSITION ID="{{state_transition.odx_id.local_id}}">
9
+ <STATE-TRANSITION {{-peid.printElementIdAttribs(state_transition)}}>
10
10
  {{ peid.printElementIdSubtags(state_transition)|indent(1) }}
11
11
  <SOURCE-SNREF SHORT-NAME="{{state_transition.source_snref}}" />
12
12
  <TARGET-SNREF SHORT-NAME="{{state_transition.target_snref}}" />
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printStaticField(sf) -%}
9
- <STATIC-FIELD ID="{{sf.odx_id.local_id}}">
9
+ <STATIC-FIELD {{-peid.printElementIdAttribs(sf)}}>
10
10
  {{ peid.printElementIdSubtags(sf)|indent(1) }}
11
11
  <BASIC-STRUCTURE-REF ID-REF="{{sf.structure_ref.ref_id}}" />
12
12
  <FIXED-NUMBER-OF-ITEMS>{{sf.fixed_number_of_items}}</FIXED-NUMBER-OF-ITEMS>
@@ -7,7 +7,7 @@
7
7
  {%- import('macros/printParam.xml.jinja2') as pp %}
8
8
 
9
9
  {%- macro printStructure(st) -%}
10
- <STRUCTURE ID="{{st.odx_id.local_id}}">
10
+ <STRUCTURE {{-peid.printElementIdAttribs(st)}}>
11
11
  {{ peid.printElementIdSubtags(st)|indent(1) }}
12
12
  {%- if st.byte_size is not none %}
13
13
  <BYTE-SIZE>{{st.byte_size}}</BYTE-SIZE>
@@ -8,7 +8,7 @@
8
8
  {%- import('macros/printDescription.xml.jinja2') as pd %}
9
9
 
10
10
  {%- macro printTable(table) %}
11
- <TABLE ID="{{table.odx_id.local_id}}"
11
+ <TABLE {{-peid.printElementIdAttribs(table)}}
12
12
  {{-make_xml_attrib("SEMANTIC", table.semantic)}}>
13
13
  {{ peid.printElementIdSubtags(table)|indent(1) }}
14
14
  {%- if table.key_dop_ref %}
@@ -16,7 +16,7 @@
16
16
  {%- endif %}
17
17
  {%- for table_row in table.table_rows_raw %}
18
18
  {%- if hasattr(table_row, "key") %}
19
- <TABLE-ROW ID="{{table_row.odx_id.local_id}}"
19
+ <TABLE-ROW {{-peid.printElementIdAttribs(table_row)}}
20
20
  {{-make_xml_attrib("SEMANTIC", table_row.semantic)}}>
21
21
  <SHORT-NAME>{{table_row.short_name}}</SHORT-NAME>
22
22
  {%- if table_row.long_name %}
@@ -35,8 +35,7 @@
35
35
 
36
36
 
37
37
  {%- macro printUnit(unit) -%}
38
- <UNIT ID="{{unit.odx_id.local_id}}"
39
- {{-make_xml_attrib("OID", unit.oid)}}>
38
+ <UNIT {{-peid.printElementIdAttribs(unit)}}>
40
39
  {{ peid.printElementIdSubtags(unit)|indent(1) }}
41
40
  <DISPLAY-NAME>{{ unit.display_name }}</DISPLAY-NAME>
42
41
  {%- if unit.factor_si_to_unit is not none %}
@@ -52,7 +51,7 @@
52
51
  {%- endmacro -%}
53
52
 
54
53
  {%- macro printUnitGroup(group) -%}
55
- <UNIT-GROUP {%- if group.oid %} OID="{{group.oid}}" {%- endif %}>
54
+ <UNIT-GROUP {{-make_xml_attrib("OID", group.oid)}}>
56
55
  {{ peid.printElementIdSubtags(group)|indent(1) }}
57
56
  <CATEGORY>{{ group.category.value }}</CATEGORY>
58
57
  {%- if group.unit_refs %}
@@ -66,8 +65,7 @@
66
65
  {%- endmacro -%}
67
66
 
68
67
  {%- macro printPhysicalDimesion(dim) -%}
69
- <PHYSICAL-DIMENSION ID="{{dim.odx_id.local_id}}"
70
- {{-make_xml_attrib("OID",dim.oid)}}>
68
+ <PHYSICAL-DIMENSION {{-peid.printElementIdAttribs(dim)}}>
71
69
  {{ peid.printElementIdSubtags(dim)|indent(1) }}
72
70
  {%- if dim.length_exp %}
73
71
  <LENGTH-EXP>{{ dim.length_exp }}</LENGTH-EXP>
odxtools/unit.py CHANGED
@@ -53,7 +53,6 @@ class Unit(IdentifiableElement):
53
53
  ```
54
54
  """
55
55
  display_name: str
56
- oid: Optional[str]
57
56
  factor_si_to_unit: Optional[float]
58
57
  offset_si_to_unit: Optional[float]
59
58
  physical_dimension_ref: Optional[OdxLinkRef]
@@ -64,7 +63,7 @@ class Unit(IdentifiableElement):
64
63
  @staticmethod
65
64
  def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> "Unit":
66
65
  kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
67
- oid = et_element.get("OID")
66
+
68
67
  display_name = odxrequire(et_element.findtext("DISPLAY-NAME"))
69
68
 
70
69
  def read_optional_float(element: ElementTree.Element, name: str) -> Optional[float]:
@@ -80,7 +79,6 @@ class Unit(IdentifiableElement):
80
79
 
81
80
  return Unit(
82
81
  display_name=display_name,
83
- oid=oid,
84
82
  factor_si_to_unit=factor_si_to_unit,
85
83
  offset_si_to_unit=offset_si_to_unit,
86
84
  physical_dimension_ref=physical_dimension_ref,
odxtools/unitspec.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  from dataclasses import dataclass
3
- from typing import Any, Dict, List, Union
3
+ from typing import Any, Dict, List
4
4
  from xml.etree import ElementTree
5
5
 
6
6
  from .nameditemlist import NamedItemList
@@ -25,9 +25,9 @@ class UnitSpec:
25
25
  """
26
26
 
27
27
  # TODO (?): Why are there type errors...
28
- unit_groups: Union[NamedItemList[UnitGroup], List[UnitGroup]]
29
- units: Union[NamedItemList[Unit], List[Unit]]
30
- physical_dimensions: Union[NamedItemList[PhysicalDimension], List[PhysicalDimension]]
28
+ unit_groups: NamedItemList[UnitGroup]
29
+ units: NamedItemList[Unit]
30
+ physical_dimensions: NamedItemList[PhysicalDimension]
31
31
  sdgs: List[SpecialDataGroup]
32
32
 
33
33
  def __post_init__(self) -> None:
@@ -38,14 +38,15 @@ class UnitSpec:
38
38
  @staticmethod
39
39
  def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> "UnitSpec":
40
40
 
41
- unit_groups = [
41
+ unit_groups = NamedItemList([
42
42
  UnitGroup.from_et(el, doc_frags) for el in et_element.iterfind("UNIT-GROUPS/UNIT-GROUP")
43
- ]
44
- units = [Unit.from_et(el, doc_frags) for el in et_element.iterfind("UNITS/UNIT")]
45
- physical_dimensions = [
43
+ ])
44
+ units = NamedItemList(
45
+ [Unit.from_et(el, doc_frags) for el in et_element.iterfind("UNITS/UNIT")])
46
+ physical_dimensions = NamedItemList([
46
47
  PhysicalDimension.from_et(el, doc_frags)
47
48
  for el in et_element.iterfind("PHYSICAL-DIMENSIONS/PHYSICAL-DIMENSION")
48
- ]
49
+ ])
49
50
  sdgs = [
50
51
  SpecialDataGroup.from_et(sdge, doc_frags) for sdge in et_element.iterfind("SDGS/SDG")
51
52
  ]
odxtools/version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '8.0.6'
16
- __version_tuple__ = version_tuple = (8, 0, 6)
15
+ __version__ = version = '8.2.0'
16
+ __version_tuple__ = version_tuple = (8, 2, 0)
odxtools/writepdxfile.py CHANGED
@@ -140,6 +140,7 @@ def write_pdx_file(
140
140
  out_file.write(data_file.read())
141
141
 
142
142
  jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_dir))
143
+ jinja_env.globals["getattr"] = getattr
143
144
  jinja_env.globals["hasattr"] = hasattr
144
145
  jinja_env.globals["odxraise"] = jinja2_odxraise_helper
145
146
  jinja_env.globals["make_xml_attrib"] = make_xml_attrib
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odxtools
3
- Version: 8.0.6
3
+ Version: 8.2.0
4
4
  Summary: Utilities to work with the ODX standard for automotive diagnostics
5
5
  Author-email: Katrin Bauer <katrin.bauer@mbition.io>, Andreas Lauser <andreas.lauser@mbition.io>, Ayoub Kaanich <kayoub5@live.com>
6
6
  Maintainer-email: Andreas Lauser <andreas.lauser@mbition.io>, Ayoub Kaanich <kayoub5@live.com>