-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add MemoryExtended services #1362
Conversation
I had some problem with mypy, so I need some help |
xknx/telegram/apci.py
Outdated
# inject [0x00] before 3 bytes address to enable unsigned int unpack | ||
count, address, data = struct.unpack( | ||
f"!BI{size}s", bytes([raw[2], 0x00]) + raw[3:] | ||
) |
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.
# inject [0x00] before 3 bytes address to enable unsigned int unpack | |
count, address, data = struct.unpack( | |
f"!BI{size}s", bytes([raw[2], 0x00]) + raw[3:] | |
) | |
count = raw[2] | |
address = int.from_bytes(raw[3:6], "big") | |
data = raw[6:] |
Here is an alternative approach to this. I think it is easier readable since no 0-Byte injection is required.
Optionally, you could raw[6:size]
too.
Let me know what you think.
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.
fully agreed
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.
done
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.
Nice 👍 Can you do that for the other classes too and make CI pass? I think we would be fine to merge then.
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.
Sorry, I missed them, fix now
237da02
to
7a42f20
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1362 +/- ##
==========================================
+ Coverage 96.56% 96.59% +0.02%
==========================================
Files 150 150
Lines 9584 9695 +111
==========================================
+ Hits 9255 9365 +110
- Misses 329 330 +1
|
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.
Thank you very much! 👍
Description
add MemoryExtended services : Read, ReadResponse, Write, WriteResponse
Fixes # (issue)
Type of change
Checklist