From 2dcb6ac5acf1aecc281a8e0eefc82fbe03b0f63c Mon Sep 17 00:00:00 2001 From: BRF2BJ Date: Wed, 6 Sep 2023 15:21:49 +0200 Subject: [PATCH] add simple support for elist in header comment using sequence numbers as keys --- src/asammdf/blocks/v4_blocks.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/asammdf/blocks/v4_blocks.py b/src/asammdf/blocks/v4_blocks.py index 78da1ff61..3fb09e4dd 100644 --- a/src/asammdf/blocks/v4_blocks.py +++ b/src/asammdf/blocks/v4_blocks.py @@ -5643,24 +5643,28 @@ def comment(self, string): self._common_properties.clear() def parse_common_properties(root): + root_name = root.get("name") info = {} - if root.tag in ("list", "tree"): - info[root.get("name")] = {} + if root.tag in ("list", "tree", "elist"): + info[root_name] = {} try: for element in root: name = element.get("name") if element.tag == "e": if root.tag == "tree": - info[root.get("name")][name] = element.text or "" + info[root_name][name] = element.text or "" else: info[name] = element.text or "" - elif element.tag in ("list", "tree"): + elif element.tag in ("list", "tree", "elist"): info.update(parse_common_properties(element)) elif element.tag == "li": - info[root.get("name")].update(parse_common_properties(element)) + info[root_name].update(parse_common_properties(element)) + + elif element.tag == "eli": + info[root_name][str(len(info[root_name]))] = element.text or "" except: print(format_exc())