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

make the parameters data classes #177

Merged
merged 4 commits into from
Aug 11, 2023

Conversation

andlaus
Copy link
Collaborator

@andlaus andlaus commented Aug 10, 2023

The second part of the "use @dataclass where appropriate" quest...

Andreas Lauser <[email protected]>, on behalf of MBition GmbH.
Provider Information

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@kayoub5
Copy link
Collaborator

kayoub5 commented Aug 10, 2023

If using dataclass, then the custom __repr__ can be removed, right?

this makes the value of the `.parameter_type` property less "magical".

thanks to [at]kayoub5 for proposing this.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
- in non-strict mode, `odxraise()` now logs a warning if an error
  message was given instead of doing nothing.
- we do no longer mess around with the configuration of the `warnings`
  module. (this was missed during the recent big refactoring of the
  error handling code.)
- if we encounter a ParameterWithDop without a reference to a DOP, we
  now use the standard exception handling mechanism (`odxassert`),
  instead of just logging a warning.

thanks to [at]kayoub5 for inspiring this.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
since these are now data classes, these methods are automatically
generated and the manual variants are thus no longer necessary. Since
the these auto-generated methods are more comprehensive than the
manual ones, this implied a few minor correction in the writing code
and the unit tests to keep my personal test script working.

thanks to [at]kayoub5 for noticing this.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@andlaus
Copy link
Collaborator Author

andlaus commented Aug 11, 2023

If using dataclass, then the custom repr can be removed, right?

good point. done: 202f766

@andlaus andlaus merged commit dc941a4 into mercedes-benz:main Aug 11, 2023
6 checks passed
@andlaus andlaus deleted the moar_dataclasses_2 branch December 7, 2023 13:29
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