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

Some random cleanups #162

Merged
merged 10 commits into from
Jul 18, 2023
Merged

Some random cleanups #162

merged 10 commits into from
Jul 18, 2023

Conversation

andlaus
Copy link
Collaborator

@andlaus andlaus commented Jul 18, 2023

This PR contains a scattershot of smaller cleanups which improve the esthetics and convenience of the code, but should change nothing to little functionality-wise.

Be aware that it is probably easier to review the patches here individually because they are all focused on a single issue instead of colluding everything together...

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

`ByteString` is [considered harmful](python/mypy#4871)

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
mypy treats `bytearray` as a sub-class of `bytes`, so allowing `bytes`
wherever possible/convenient makes for a more general solution.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
now, there is a `AtomicOdxType` type alias for primitive types like
strings, integers, floats and byte arrays and a `ParameterType` alias
for all values which a parameter can exhibit. (Note that there are
parameters for composite types like structures, `ParameterType` is
recursive.)

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
… conversion functions

i.e., `convert_physical_to_internal()`,
`convert_physical_to_internal()` and `convert_bytes_to_physical()`.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
this is basically just good style: it might be that the attribute has
been defined but evaluates to `False`...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
this was a remnant of changing the name of all ODXLINK id attributes
from `id` to `odx_id` using search and replace...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
this is completely analogos to `OdxLinkDatabase.resolve()`...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@andlaus andlaus requested a review from kayoub5 July 18, 2023 11:32
python 3.8 does not like `OrderedDict` and we still support this
python version. While the practical consequences of this are likely
minimal, this increases the difficulty of accessing a parameter by
position from "hard" to "impossible"...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
odxtools/multiplexer.py Outdated Show resolved Hide resolved
thanks!

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@andlaus andlaus merged commit ebc3985 into mercedes-benz:main Jul 18, 2023
6 checks passed
@andlaus andlaus deleted the random_cleanups 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