-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Create a VersionChild datatype #123
Conversation
luxtronik/datatypes.py
Outdated
@classmethod | ||
def from_heatpump(cls, value): | ||
return "".join([chr(c) for c in value]).strip("\x00") | ||
|
||
@Base.value.getter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint
complains here. Is this the correct way to overwrite the getter of value
in the Base
class?
luxtronik/calculations.py
Outdated
81: version, | ||
82: version.spawn_child(), | ||
83: version.spawn_child(), | ||
84: version.spawn_child(), | ||
85: version.spawn_child(), | ||
86: version.spawn_child(), | ||
87: version.spawn_child(), | ||
88: version.spawn_child(), | ||
89: version.spawn_child(), | ||
90: version.spawn_child(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Does this datatype no longer have a name (
ID_WEB_SoftStand
)? - I totally get that the handling of this datatype was not particularly nice and iterating over it was generating confusing results. While this fixes it, the definition doesn't look super handy. Couldn't we address this in the iterator itself somehow by indicating the length of each datatype, rather than specifying an internal flag 10 times iteratively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The name is unchanged, it is defined in Line 43.
- The version datatype is the only one with a length bigger than 1. Thus, it was more reasonable to me to handle it as an exceptional case by introducing the "sub"-datatype.
- To which "iterator" are you referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is unchanged, it is defined in Line 43.
Ah, somehow missed that on first glance, sorry for that.
The version datatype is the only one with a length bigger than 1. Thus, it was more reasonable to me to handle it as an exceptional case by introducing the "sub"-datatype.
Depending on how we're going to tackle #33, we might have other datatypes with length > 1, also.
Personally I would prefer some kind of length attribute (with the default being 1), compared to this approach.
To which "iterator" are you referring to?
In the description of this pull request you were referring to the iterator. I suppose you mean the __iter__
method of Calculations
. Haven't checked this in close detail yet, probably it didn't need to skip anything before, since the values have not been considered for iteration in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be two issues with pylint (as already noted).
|
Other input from @Bouni et al. might also be welcome ;-). |
Yes, but I do not understand how to fix it. |
I realized another possibility which seems to (almost) remove the exceptional handling:
|
@gerw That seems like the right way to solve this to me 👍🏽 |
That sounds also more "keep it simple"-like to me and introduces less complexity in the interpretation of the raw data by the current datatypes. So I would definitely prefer that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, looks good to me.
This works towards #122.
In
calculations.py
we have an exceptional handling for the fields 81-90, since these ten fields contain the version information. Positions 82-90 were uninhabited; with this patch, a newVersionChild
sits there and gobbles the value for its parent.A new flag
datatype_internal
indicates, that this datatype is only internal and the iterator ofCalculations
will skip this entry.