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

Convert the parameter classes to the .from_et() pattern #279

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

andlaus
Copy link
Collaborator

@andlaus andlaus commented Mar 7, 2024

IMO this cleans up the parameter construction code significantly. On the flipside it requires to make the Parameter class instantiable...

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

abstract base classes cannot be instantiated, yet we need to be able
to do this in order to implement the `.from_et()` pattern with
inheritance.

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 requested a review from kayoub5 March 7, 2024 08:41
raise ValueError(
f"A parameter of type {parameter_type} must reference a DOP! {dop_ref}, {dop_snref}"
)

if parameter_type == "VALUE":
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of multiple ifs, maybe use a lookup dict?

Copy link
Collaborator

Choose a reason for hiding this comment

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

other than this, LGTM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that would make things harder to read and I doubt that the performance would be measurably better...

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
@andlaus
Copy link
Collaborator Author

andlaus commented Mar 8, 2024

ok, let's merge this. Thanks for the review @kayoub5!

@andlaus andlaus merged commit 076bbe3 into mercedes-benz:main Mar 8, 2024
7 checks passed
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.

None yet

2 participants