-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix python accessors and packet restore_defaults #1399
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1399 +/- ##
==========================================
+ Coverage 75.37% 75.40% +0.02%
==========================================
Files 600 600
Lines 44689 44701 +12
Branches 777 777
==========================================
+ Hits 33686 33707 +21
+ Misses 10916 10907 -9
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -38,6 +38,7 @@ def class_write_item(cls, item, value, buffer): | |||
else: | |||
decoded = buffer | |||
|
|||
print(f"cbor item:{item.name} value:{value} decoded:{decoded}") |
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.
Remove debugging print.
|
||
print(f"json key:{item.key} value:{value} decoded:{decoded}") |
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.
Remove debugging print
buffer = json.loads(buffer.decode()) | ||
except (UnicodeDecodeError, AttributeError): |
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.
What is going on here?
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.
Attempt at duck-typing the input so we could use bytes or bytearray ... I think we need bytearray (mutable) so I'll revert back.
Quality Gate passedIssues Measures |
buffer[0:-1] = self.template | ||
# Set both the internal buffer and our local copy | ||
self.buffer = self.template | ||
buffer = self._buffer |
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.
This was the fix to packet.py ... everything else was formatting
@@ -459,15 +459,15 @@ def process_current_packet(self, parser, keyword, params): | |||
case "TEMPLATE": | |||
usage = f"{keyword} <Template string>" | |||
parser.verify_num_parameters(1, 1, usage) | |||
self.current_packet.template = params[0] | |||
self.current_packet.template = bytearray(params[0], "ascii") |
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.
Template must be a bytearray
closes #1376