odxtools 10.1.1__py3-none-any.whl → 10.2.1__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 (112) hide show
  1. odxtools/addrdeffilter.py +33 -0
  2. odxtools/addrdefphyssegment.py +33 -0
  3. odxtools/checksum.py +67 -0
  4. odxtools/checksumresult.py +7 -0
  5. odxtools/database.py +24 -4
  6. odxtools/datablock.py +153 -0
  7. odxtools/datafile.py +23 -0
  8. odxtools/dataformat.py +39 -0
  9. odxtools/dataformatselection.py +9 -0
  10. odxtools/description.py +2 -5
  11. odxtools/diagdatadictionaryspec.py +1 -3
  12. odxtools/diaglayers/diaglayer.py +31 -11
  13. odxtools/diaglayers/ecuvariant.py +12 -19
  14. odxtools/diaglayers/hierarchyelement.py +5 -5
  15. odxtools/diaglayers/protocol.py +14 -0
  16. odxtools/direction.py +7 -0
  17. odxtools/ecumem.py +71 -0
  18. odxtools/ecumemconnector.py +136 -0
  19. odxtools/encryptcompressmethod.py +39 -0
  20. odxtools/encryptcompressmethodtype.py +13 -0
  21. odxtools/expectedident.py +40 -0
  22. odxtools/externflashdata.py +34 -0
  23. odxtools/filter.py +32 -0
  24. odxtools/flash.py +88 -0
  25. odxtools/flashclass.py +32 -0
  26. odxtools/flashdata.py +70 -0
  27. odxtools/fwchecksum.py +7 -0
  28. odxtools/fwsignature.py +7 -0
  29. odxtools/identdesc.py +54 -0
  30. odxtools/identvalue.py +32 -0
  31. odxtools/identvaluetype.py +14 -0
  32. odxtools/internflashdata.py +33 -0
  33. odxtools/loadfile.py +1 -1
  34. odxtools/mem.py +80 -0
  35. odxtools/modification.py +3 -2
  36. odxtools/negoffset.py +21 -0
  37. odxtools/odxlink.py +4 -2
  38. odxtools/ownident.py +38 -0
  39. odxtools/physicaltype.py +12 -10
  40. odxtools/physmem.py +52 -0
  41. odxtools/physsegment.py +42 -0
  42. odxtools/posoffset.py +21 -0
  43. odxtools/security.py +42 -0
  44. odxtools/securitymethod.py +7 -0
  45. odxtools/segment.py +63 -0
  46. odxtools/session.py +88 -0
  47. odxtools/sessiondesc.py +101 -0
  48. odxtools/sessionsubelemtype.py +14 -0
  49. odxtools/sizedeffilter.py +33 -0
  50. odxtools/sizedefphyssegment.py +33 -0
  51. odxtools/specialdata.py +2 -1
  52. odxtools/subcomponentparamconnector.py +1 -1
  53. odxtools/targetaddroffset.py +13 -0
  54. odxtools/templates/comparam-spec.odx-c.xml.jinja2 +1 -0
  55. odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +1 -0
  56. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +2 -1
  57. odxtools/templates/flash.odx-f.xml.jinja2 +42 -0
  58. odxtools/templates/macros/printAdminData.xml.jinja2 +4 -4
  59. odxtools/templates/macros/printAudience.xml.jinja2 +3 -3
  60. odxtools/templates/macros/printChecksum.xml.jinja2 +36 -0
  61. odxtools/templates/macros/printComparam.xml.jinja2 +1 -1
  62. odxtools/templates/macros/printComparamRef.xml.jinja2 +1 -3
  63. odxtools/templates/macros/printCompuMethod.xml.jinja2 +1 -1
  64. odxtools/templates/macros/printDOP.xml.jinja2 +3 -3
  65. odxtools/templates/macros/printDatablock.xml.jinja2 +78 -0
  66. odxtools/templates/macros/printDiagComm.xml.jinja2 +2 -2
  67. odxtools/templates/macros/printDiagLayer.xml.jinja2 +2 -1
  68. odxtools/templates/macros/printDiagVariable.xml.jinja2 +4 -4
  69. odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +3 -3
  70. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +2 -2
  71. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +2 -2
  72. odxtools/templates/macros/printEcuMem.xml.jinja2 +24 -0
  73. odxtools/templates/macros/printEcuMemConnector.xml.jinja2 +58 -0
  74. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  75. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  76. odxtools/templates/macros/printExpectedIdent.xml.jinja2 +21 -0
  77. odxtools/templates/macros/printFlashdata.xml.jinja2 +43 -0
  78. odxtools/templates/macros/printIdentDesc.xml.jinja2 +17 -0
  79. odxtools/templates/macros/printMem.xml.jinja2 +35 -0
  80. odxtools/templates/macros/printMux.xml.jinja2 +3 -3
  81. odxtools/templates/macros/printOdxCategory.xml.jinja2 +4 -4
  82. odxtools/templates/macros/printOwnIdent.xml.jinja2 +17 -0
  83. odxtools/templates/macros/printParam.xml.jinja2 +4 -4
  84. odxtools/templates/macros/printParentRef.xml.jinja2 +1 -5
  85. odxtools/templates/macros/printPhysMem.xml.jinja2 +20 -0
  86. odxtools/templates/macros/printPhysSegment.xml.jinja2 +33 -0
  87. odxtools/templates/macros/printPreConditionStateRef.xml.jinja2 +1 -1
  88. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  89. odxtools/templates/macros/printProtocol.xml.jinja2 +1 -1
  90. odxtools/templates/macros/printSecurity.xml.jinja2 +37 -0
  91. odxtools/templates/macros/printSegment.xml.jinja2 +31 -0
  92. odxtools/templates/macros/printService.xml.jinja2 +3 -3
  93. odxtools/templates/macros/printSession.xml.jinja2 +45 -0
  94. odxtools/templates/macros/printSessionDesc.xml.jinja2 +40 -0
  95. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +3 -3
  96. odxtools/templates/macros/printSpecialData.xml.jinja2 +2 -2
  97. odxtools/templates/macros/printStateTransitionRef.xml.jinja2 +1 -1
  98. odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
  99. odxtools/templates/macros/printSubComponent.xml.jinja2 +3 -3
  100. odxtools/templates/macros/printTable.xml.jinja2 +6 -6
  101. odxtools/templates/macros/printUnitSpec.xml.jinja2 +2 -2
  102. odxtools/text.py +2 -6
  103. odxtools/utils.py +22 -1
  104. odxtools/validityfor.py +30 -0
  105. odxtools/version.py +2 -2
  106. odxtools/writepdxfile.py +70 -21
  107. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/METADATA +1 -1
  108. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/RECORD +112 -55
  109. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/WHEEL +1 -1
  110. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/entry_points.txt +0 -0
  111. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/licenses/LICENSE +0 -0
  112. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/top_level.txt +0 -0
@@ -25,7 +25,7 @@
25
25
  {%- macro printSpecialDataGroup(sdg) %}
26
26
  <SDG {{-make_xml_attrib("SI", sdg.semantic_info)}}>
27
27
  {%- if sdg.sdg_caption_ref %}
28
- <SDG-CAPTION-REF ID-REF="{{sdg.sdg_caption_ref.ref_id}}" />
28
+ <SDG-CAPTION-REF {{make_ref_attribs(sdg.sdg_caption_ref)}} />
29
29
  {%- elif sdg.sdg_caption %}
30
30
  {{- printSdgCaption(sdg.sdg_caption) | indent(1, first=True) }}
31
31
  {%- endif %}
@@ -49,4 +49,4 @@
49
49
  {%- endfor %}
50
50
  </SDGS>
51
51
  {%- endif %}
52
- {%- endmacro %}
52
+ {#- #}{%- endmacro %}
@@ -4,7 +4,7 @@
4
4
  -#}
5
5
 
6
6
  {%- macro printStateTransitionRef(st_ref) -%}
7
- <STATE-TRANSITION-REF ID-REF="{{st_ref.ref_id}}">
7
+ <STATE-TRANSITION-REF {{make_ref_attribs(st_ref)}}>
8
8
  {%- if st_ref.value is not none %}
9
9
  <VALUE>{{ st_ref.value }}</VALUE>
10
10
  {%- endif %}
@@ -8,7 +8,7 @@
8
8
  {%- macro printStaticField(sf) -%}
9
9
  <STATIC-FIELD {{-peid.printElementIdAttribs(sf)}}>
10
10
  {{ peid.printElementIdSubtags(sf)|indent(1) }}
11
- <BASIC-STRUCTURE-REF ID-REF="{{sf.structure_ref.ref_id}}" />
11
+ <BASIC-STRUCTURE-REF {{make_ref_attribs(sf.structure_ref)}} />
12
12
  <FIXED-NUMBER-OF-ITEMS>{{sf.fixed_number_of_items}}</FIXED-NUMBER-OF-ITEMS>
13
13
  <ITEM-BYTE-SIZE>{{sf.item_byte_size}}</ITEM-BYTE-SIZE>
14
14
  </STATIC-FIELD>
@@ -40,7 +40,7 @@
40
40
  {%- macro printTableRowConnector(conn) %}
41
41
  <TABLE-ROW-CONNECTOR>
42
42
  {{ peid.printElementIdSubtags(conn)|indent(2) }}
43
- <TABLE-REF ID-REF="{{ conn.table_ref.ref_id }}" />
43
+ <TABLE-REF {{make_ref_attribs(conn.table_ref)}} />
44
44
  <TABLE-ROW-SNREF {{- make_xml_attrib("SHORT-NAME", conn.table_row_snref ) }} />
45
45
  </TABLE-ROW-CONNECTOR>
46
46
  {%- endmacro %}
@@ -48,7 +48,7 @@
48
48
  {%- macro printEnvDataConnector(conn) %}
49
49
  <ENV-DATA-CONNECTOR>
50
50
  {{ peid.printElementIdSubtags(conn)|indent(2) }}
51
- <ENV-DATA-DESC-REF ID-REF="{{ conn.env_data_desc_ref.ref_id }}" />
51
+ <ENV-DATA-DESC-REF {{make_ref_attribs(conn.env_data_desc_ref)}} />
52
52
  <ENV-DATA-SNREF {{- make_xml_attrib("SHORT-NAME", conn.env_data_snref ) }} />
53
53
  </ENV-DATA-CONNECTOR>
54
54
  {%- endmacro %}
@@ -56,7 +56,7 @@
56
56
  {%- macro printDtcConnector(conn) %}
57
57
  <DTC-CONNECTOR>
58
58
  {{ peid.printElementIdSubtags(conn)|indent(2) }}
59
- <DTC-DOP-REF ID-REF="{{ conn.dtc_dop_ref.ref_id }}" />
59
+ <DTC-DOP-REF {{make_ref_attribs(conn.dtc_dop_ref)}} />
60
60
  <DOP-SNREF {{- make_xml_attrib("SHORT-NAME", conn.dtc_snref ) }} />
61
61
  </DTC-CONNECTOR>
62
62
  {%- endmacro %}
@@ -16,7 +16,7 @@
16
16
  {{-make_xml_attrib("SEMANTIC", table.semantic)}}>
17
17
  {{ peid.printElementIdSubtags(table)|indent(1) }}
18
18
  {%- if table.key_dop_ref %}
19
- <KEY-DOP-REF ID-REF="{{ table.key_dop_ref.ref_id }}" />
19
+ <KEY-DOP-REF {{make_ref_attribs(table.key_dop_ref)}} />
20
20
  {%- endif %}
21
21
  {%- for table_row in table.table_rows_raw %}
22
22
  {%- if hasattr(table_row, "key") %}
@@ -25,13 +25,13 @@
25
25
  {{-peid.printElementIdSubtags(table_row)}}
26
26
  <KEY>{{table_row.key|e}}</KEY>
27
27
  {%- if table_row.dop_ref is not none %}
28
- <DATA-OBJECT-PROP-REF ID-REF="{{ table_row.dop_ref.ref_id }}" />
28
+ <DATA-OBJECT-PROP-REF {{make_ref_attribs(table_row.dop_ref)}} />
29
29
  {%- endif %}
30
30
  {%- if table_row.dop_snref is not none %}
31
31
  <DATA-OBJECT-PROP-SNREF SHORT-NAME="{{ table_row.dop_snref }}" />
32
32
  {%- endif %}
33
33
  {%- if table_row.structure_ref is not none %}
34
- <STRUCTURE-REF ID-REF="{{ table_row.structure_ref.ref_id }}" />
34
+ <STRUCTURE-REF {{make_ref_attribs(table_row.structure_ref)}} />
35
35
  {%- endif %}
36
36
  {%- if table_row.structure_snref is not none %}
37
37
  <STRUCTURE-SNREF SHORT-NAME="{{ table_row.structure_snref }}" />
@@ -43,7 +43,7 @@
43
43
  {%- if table_row.functional_class_refs %}
44
44
  <FUNCT-CLASS-REFS>
45
45
  {%- for fc_ref in table_row.functional_class_refs %}
46
- <FUNCT-CLASS-REF ID-REF="{{ fc_ref.ref_id }}" />
46
+ <FUNCT-CLASS-REF {{make_ref_attribs(fc_ref)}} />
47
47
  {%- endfor %}
48
48
  </FUNCT-CLASS-REFS>
49
49
  {%- endif %}
@@ -66,7 +66,7 @@
66
66
  {%- endif %}
67
67
  </TABLE-ROW>
68
68
  {%- else %}
69
- <TABLE-ROW-REF ID-REF="{{ table_row.ref_id }}" />
69
+ <TABLE-ROW-REF {{make_ref_attribs(table_row)}} />
70
70
  {%- endif %}
71
71
  {%- endfor %}
72
72
  {%- if table_diag_comm_connectors %}
@@ -75,7 +75,7 @@
75
75
  <TABLE-DIAG-COMM-CONNECTOR>
76
76
  <SEMANTIC>{{tdcc.semantic}}</SEMANTIC>
77
77
  {%- if tdcc.diag_comm_ref %}
78
- <DIAG-COMM-REF ID-REF="{{ tdcc.diag_comm_ref.ref_id }}" />
78
+ <DIAG-COMM-REF {{make_ref_attribs(tdcc.diag_comm_ref)}} />
79
79
  {%- elif tdcc.diag_comm_snref %}
80
80
  <DIAG-COMM-SNREF SHORT-NAME="{{ tdcc.diag_comm_snref }}" />
81
81
  {%- endif %}
@@ -49,7 +49,7 @@
49
49
  <OFFSET-SI-TO-UNIT>{{ unit.offset_si_to_unit }}</OFFSET-SI-TO-UNIT>
50
50
  {%- endif %}
51
51
  {%- if unit.physical_dimension_ref %}
52
- <PHYSICAL-DIMENSION-REF ID-REF="{{ unit.physical_dimension_ref.ref_id }}" />
52
+ <PHYSICAL-DIMENSION-REF {{make_ref_attribs(unit.physical_dimension_ref)}} />
53
53
  {%- endif %}
54
54
  </UNIT>
55
55
  {%- endmacro -%}
@@ -61,7 +61,7 @@
61
61
  {%- if group.unit_refs %}
62
62
  <UNIT-REFS>
63
63
  {%- for ref in group.unit_refs %}
64
- <UNIT-REF ID-REF="{{ ref.ref_id }}" />
64
+ <UNIT-REF {{make_ref_attribs(ref)}} />
65
65
  {%- endfor %}
66
66
  </UNIT-REFS>
67
67
  {%- endif %}
odxtools/text.py CHANGED
@@ -2,6 +2,7 @@ from dataclasses import dataclass
2
2
  from xml.etree import ElementTree
3
3
 
4
4
  from .odxdoccontext import OdxDocContext
5
+ from .utils import strip_indent
5
6
 
6
7
 
7
8
  @dataclass(kw_only=True)
@@ -16,12 +17,7 @@ class Text:
16
17
  for e in et_element:
17
18
  raw_string += ElementTree.tostring(e, encoding="unicode")
18
19
 
19
- # remove white spaces at the beginning and at the end of all
20
- # extracted lines
21
- stripped_lines = [x.strip() for x in raw_string.split("\n")]
22
-
23
- text = "\n".join(stripped_lines).strip()
24
-
20
+ text = strip_indent(raw_string)
25
21
  text_identifier = et_element.get("TI")
26
22
 
27
23
  return Text(text=text, text_identifier=text_identifier)
odxtools/utils.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  import dataclasses
3
3
  import re
4
- from typing import TYPE_CHECKING, Any, Optional
4
+ from typing import TYPE_CHECKING, Any, Optional, overload
5
5
  from xml.etree import ElementTree
6
6
 
7
7
  from .exceptions import odxraise
@@ -12,6 +12,27 @@ if TYPE_CHECKING:
12
12
  from .snrefcontext import SnRefContext
13
13
 
14
14
 
15
+ @overload
16
+ def strip_indent(text: str) -> str:
17
+ ...
18
+
19
+
20
+ @overload
21
+ def strip_indent(text: None) -> None:
22
+ ...
23
+
24
+
25
+ def strip_indent(text: str | None) -> str | None:
26
+ """Remove the leading and trailing space characters of all lines of a string.
27
+
28
+ Note that non-space whitespace characters (tabulators, etc) are unaffected
29
+ """
30
+ if text is None:
31
+ return None
32
+
33
+ return "\n".join([x.strip(" \r") for x in text.split("\n")])
34
+
35
+
15
36
  def read_hex_binary(et_element: ElementTree.Element | None) -> int | None:
16
37
  """Convert the contents of an xsd:hexBinary to an integer
17
38
  """
@@ -0,0 +1,30 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from dataclasses import dataclass
3
+ from typing import cast
4
+ from xml.etree import ElementTree
5
+
6
+ from .exceptions import odxraise, odxrequire
7
+ from .odxdoccontext import OdxDocContext
8
+ from .sessionsubelemtype import SessionSubElemType
9
+
10
+
11
+ @dataclass(kw_only=True)
12
+ class ValidityFor:
13
+ value: str
14
+ value_type: SessionSubElemType
15
+
16
+ @staticmethod
17
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "ValidityFor":
18
+ value = et_element.text or ""
19
+
20
+ value_type_str = odxrequire(et_element.get("TYPE"))
21
+ try:
22
+ value_type = SessionSubElemType(value_type_str)
23
+ except ValueError:
24
+ value_type = cast(SessionSubElemType, None)
25
+ odxraise(f"Encountered unknown SESSION-SUB-ELEM-TYPE type '{value_type_str}'")
26
+
27
+ return ValidityFor(
28
+ value=value,
29
+ value_type=value_type,
30
+ )
odxtools/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '10.1.1'
21
- __version_tuple__ = version_tuple = (10, 1, 1)
20
+ __version__ = version = '10.2.1'
21
+ __version_tuple__ = version_tuple = (10, 2, 1)
odxtools/writepdxfile.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  import datetime
3
+ import html
3
4
  import inspect
4
5
  import mimetypes
5
6
  import os
@@ -12,10 +13,9 @@ import jinja2
12
13
  import odxtools
13
14
 
14
15
  from .database import Database
16
+ from .odxlink import DocType, OdxDocFragment, OdxLinkRef
15
17
  from .odxtypes import bool_to_odxstr
16
18
 
17
- odxdatabase: Database | None = None
18
-
19
19
 
20
20
  def jinja2_odxraise_helper(msg: str) -> None:
21
21
  raise Exception(msg)
@@ -25,7 +25,7 @@ def make_xml_attrib(attrib_name: str, attrib_val: Any | None) -> str:
25
25
  if attrib_val is None:
26
26
  return ""
27
27
 
28
- return f' {attrib_name}="{attrib_val}"'
28
+ return f' {attrib_name}="{html.escape(attrib_val)}"'
29
29
 
30
30
 
31
31
  def make_bool_xml_attrib(attrib_name: str, attrib_val: bool | None) -> str:
@@ -35,6 +35,39 @@ def make_bool_xml_attrib(attrib_name: str, attrib_val: bool | None) -> str:
35
35
  return make_xml_attrib(attrib_name, bool_to_odxstr(attrib_val))
36
36
 
37
37
 
38
+ def set_category_docfrag(jinja_vars: dict[str, Any], category_short_name: str,
39
+ category_type: str) -> str:
40
+ jinja_vars["cur_docfrags"] = [OdxDocFragment(category_short_name, DocType(category_type))]
41
+
42
+ return ""
43
+
44
+
45
+ def set_layer_docfrag(jinja_vars: dict[str, Any], layer_short_name: str | None) -> str:
46
+ cur_docfrags = jinja_vars["cur_docfrags"]
47
+
48
+ if layer_short_name is None:
49
+ cur_docfrags = cur_docfrags[:1]
50
+ return ""
51
+
52
+ if len(cur_docfrags) == 1:
53
+ cur_docfrags.append(OdxDocFragment(layer_short_name, DocType.LAYER))
54
+ else:
55
+ cur_docfrags[1] = OdxDocFragment(layer_short_name, DocType.LAYER)
56
+
57
+ return ""
58
+
59
+
60
+ def make_ref_attribs(jinja_vars: dict[str, Any], ref: OdxLinkRef) -> str:
61
+ cur_docfrags = jinja_vars["cur_docfrags"]
62
+
63
+ for ref_frag in ref.ref_docs:
64
+ if ref_frag in cur_docfrags:
65
+ return f"ID-REF=\"{ref.ref_id}\""
66
+
67
+ docfrag = ref.ref_docs[-1]
68
+ return f"ID-REF=\"{ref.ref_id}\" DOCREF=\"{docfrag.doc_name}\" DOCTYPE=\"{docfrag.doc_type.value}\""
69
+
70
+
38
71
  __module_filename = inspect.getsourcefile(odxtools)
39
72
  assert isinstance(__module_filename, str)
40
73
  __templates_dir = os.path.sep.join([os.path.dirname(__module_filename), "templates"])
@@ -48,10 +81,6 @@ def write_pdx_file(
48
81
  """
49
82
  Write an internalized database to a PDX file.
50
83
  """
51
- global odxdatabase
52
-
53
- odxdatabase = database
54
-
55
84
  file_index = []
56
85
  with zipfile.ZipFile(output_file_name, mode="w", compression=zipfile.ZIP_DEFLATED) as zf:
57
86
 
@@ -128,9 +157,14 @@ def write_pdx_file(
128
157
  jinja_env.globals["make_xml_attrib"] = make_xml_attrib
129
158
  jinja_env.globals["make_bool_xml_attrib"] = make_bool_xml_attrib
130
159
 
131
- vars: dict[str, Any] = {}
132
- vars["odxtools_version"] = odxtools.__version__
133
- vars["database"] = database
160
+ jinja_vars: dict[str, Any] = {}
161
+ jinja_vars["odxtools_version"] = odxtools.__version__
162
+ jinja_vars["database"] = database
163
+
164
+ jinja_env.globals["set_category_docfrag"] = lambda cname, ctype: set_category_docfrag(
165
+ jinja_vars, cname, ctype)
166
+ jinja_env.globals["set_layer_docfrag"] = lambda lname: set_layer_docfrag(jinja_vars, lname)
167
+ jinja_env.globals["make_ref_attribs"] = lambda ref: make_ref_attribs(jinja_vars, ref)
134
168
 
135
169
  # write the communication parameter subsets
136
170
  comparam_subset_tpl = jinja_env.get_template("comparam-subset.odx-cs.xml.jinja2")
@@ -139,13 +173,13 @@ def write_pdx_file(
139
173
  zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
140
174
  zf_mime_type = "application/x-asam.odx.odx-cs"
141
175
 
142
- vars["comparam_subset"] = comparam_subset
176
+ jinja_vars["comparam_subset"] = comparam_subset
143
177
 
144
178
  file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
145
179
 
146
- zf.writestr(zf_file_name, comparam_subset_tpl.render(**vars))
180
+ zf.writestr(zf_file_name, comparam_subset_tpl.render(**jinja_vars))
147
181
 
148
- del vars["comparam_subset"]
182
+ del jinja_vars["comparam_subset"]
149
183
 
150
184
  # write the communication parameter specs
151
185
  comparam_spec_tpl = jinja_env.get_template("comparam-spec.odx-c.xml.jinja2")
@@ -154,18 +188,18 @@ def write_pdx_file(
154
188
  zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
155
189
  zf_mime_type = "application/x-asam.odx.odx-c"
156
190
 
157
- vars["comparam_spec"] = comparam_spec
191
+ jinja_vars["comparam_spec"] = comparam_spec
158
192
 
159
193
  file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
160
194
 
161
- zf.writestr(zf_file_name, comparam_spec_tpl.render(**vars))
195
+ zf.writestr(zf_file_name, comparam_spec_tpl.render(**jinja_vars))
162
196
 
163
- del vars["comparam_spec"]
197
+ del jinja_vars["comparam_spec"]
164
198
 
165
199
  # write the actual diagnostic data.
166
200
  dlc_tpl = jinja_env.get_template("diag_layer_container.odx-d.xml.jinja2")
167
201
  for dlc in database.diag_layer_containers:
168
- vars["dlc"] = dlc
202
+ jinja_vars["dlc"] = dlc
169
203
 
170
204
  file_name = f"{dlc.short_name}.odx-d"
171
205
  file_cdate = datetime.datetime.now()
@@ -173,13 +207,28 @@ def write_pdx_file(
173
207
  mime_type = "application/x-asam.odx.odx-d"
174
208
 
175
209
  file_index.append((file_name, creation_date, mime_type))
176
- zf.writestr(file_name, dlc_tpl.render(**vars))
177
- del vars["dlc"]
210
+ zf.writestr(file_name, dlc_tpl.render(**jinja_vars))
211
+ del jinja_vars["dlc"]
212
+
213
+ # write the flash description objects
214
+ flash_tpl = jinja_env.get_template("flash.odx-f.xml.jinja2")
215
+ for flash in database.flashs:
216
+ zf_file_name = f"{flash.short_name}.odx-f"
217
+ zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
218
+ zf_mime_type = "application/x-asam.odx.odx-f"
219
+
220
+ jinja_vars["flash"] = flash
221
+
222
+ file_index.append((zf_file_name, zf_file_cdate, zf_mime_type))
223
+
224
+ zf.writestr(zf_file_name, flash_tpl.render(**jinja_vars))
225
+
226
+ del jinja_vars["flash"]
178
227
 
179
228
  # write the index.xml file
180
- vars["file_index"] = file_index
229
+ jinja_vars["file_index"] = file_index
181
230
  index_tpl = jinja_env.get_template("index.xml.jinja2")
182
- text = index_tpl.render(**vars)
231
+ text = index_tpl.render(**jinja_vars)
183
232
  zf.writestr("index.xml", text)
184
233
 
185
234
  return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: odxtools
3
- Version: 10.1.1
3
+ Version: 10.2.1
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>