Skip to content

Commit

Permalink
Merge pull request #392 from nada-ben-ali/NaBe/revert_comparaminstanc…
Browse files Browse the repository at this point in the history
…e_short_name

comparaminstance.spec property is not available during object creation
  • Loading branch information
andlaus authored Feb 25, 2025
2 parents 1e5f030 + 6f66a07 commit 924c08e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions odxtools/comparamsubset.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ class ComparamSubset(OdxCategory):
def from_et(et_element: ElementTree.Element,
doc_frags: List[OdxDocFragment]) -> "ComparamSubset":

cat = OdxCategory.category_from_et(et_element, doc_frags, doc_type=DocType.COMPARAM_SUBSET)
category = et_element.get("CATEGORY")

# In ODX 2.0, COMPARAM-SPEC is used, whereas in ODX 2.2, it refers to something else and has been replaced by COMPARAM-SUBSET.
# - If 'category' is missing (ODX 2.0), use COMPARAM_SPEC,
# - else (ODX 2.2), use COMPARAM_SUBSET.
doc_type = DocType.COMPARAM_SUBSET if category else DocType.COMPARAM_SPEC
cat = OdxCategory.category_from_et(et_element, doc_frags, doc_type=doc_type)
doc_frags = cat.odx_id.doc_fragments
kwargs = dataclass_fields_asdict(cat)

category = et_element.get("CATEGORY")

data_object_props = NamedItemList([
DataObjectProperty.from_et(el, doc_frags)
for el in et_element.iterfind("DATA-OBJECT-PROPS/DATA-OBJECT-PROP")
Expand Down

0 comments on commit 924c08e

Please sign in to comment.