Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parsing and writing of COMPARAM-SPEC #243

Merged
merged 5 commits into from
Nov 21, 2023

Conversation

andlaus
Copy link
Collaborator

@andlaus andlaus commented Nov 21, 2023

It turns out that files containing "COMPARAM-SPEC" root elements were ignored for PDX files using ODX 2.2. (also, the writing code got slightly broken recently.)

I'm not 100% sure if this still works with ODX 2.0 files, though...

Andreas Lauser <andreas.lauser@mercedes-benz.com>, on behalf of MBition GmbH.
Provider Information

@andlaus andlaus requested a review from kayoub5 November 21, 2023 08:41
@andlaus andlaus force-pushed the comparam_spec_fixes branch from d0c1722 to dee3122 Compare November 21, 2023 08:49
odxtools/database.py Outdated Show resolved Hide resolved
odxtools/database.py Outdated Show resolved Hide resolved
It turns out that files containing "COMPARAM-SPEC" root elements were
ignored for PDX files using ODX 2.2. (also, the writing code got
slightly broken recently.)

I'm not 100% sure if this still works with ODX 2.0, though...

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
proposed by [at]kayoub5. Thanks!

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
@andlaus andlaus force-pushed the comparam_spec_fixes branch from dcb7d2f to d2f9ce9 Compare November 21, 2023 11:10
Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>

cp_spec = root.find("COMPARAM-SPEC")
if cp_spec is not None:
comparam_specs.append(ComparamSpec.from_et(cp_spec, []))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may look strange at first, but between 2.0 and 2.2 only the XML tag changed, the content of the COMPARAM-SPEC in 2.0 is basically a COMPARAM-SUBSET in 2.2
This way the code needed for 2.0 support remains minimal

Suggested change
comparam_specs.append(ComparamSpec.from_et(cp_spec, []))
comparam_specs.append(ComparamSubset.from_et(cp_spec, []))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see. it's better to append these objects to comparam_subsets then, though? (This would also make conversion of datasets from odx 2.0 to 2.2 easier.) I've implemented it this way for now: adf3dfb

It seems like what ODX 2.0 calls "COMPARAM-SPEC" is called
"COMPARAM-SUBSET" in ODX 2.2. Let's thus always use `.comparam_subset`
for these objects.

thanks to [at]kayoub5 for the clarifications.

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
@andlaus andlaus force-pushed the comparam_spec_fixes branch from 4985121 to adf3dfb Compare November 21, 2023 13:29
@andlaus andlaus merged commit 262f6c8 into mercedes-benz:main Nov 21, 2023
6 checks passed
@andlaus andlaus deleted the comparam_spec_fixes branch December 7, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants