-
Notifications
You must be signed in to change notification settings - Fork 39
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 support for dialogs without response #78
Fix support for dialogs without response #78
Conversation
Fixing types ends up being a much larger effort than suitable for this PR.
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.
Out of curiosity, why can't you apply the same typing you use in the tests ?
TL;DR: You can see what all the type changes are in this branch: https://github.com/dougthor42/pyvisa-sim/tree/gh-76-fix-dialog-wo-response-types Changing the return type of
After doing all of that, you get to:
pyvisa-sim/pyvisa_sim/devices.py Lines 256 to 258 in 6fb7d9d
Which requires it's own type guard if response is not NoResponse:
self._output_buffer.extend(response)
- self._output_buffer.extend(eom)
+ if eom is not NoResponse:
+ self._output_buffer.extend(eom) I'm not yet familiar enough with the code to know if the type guard should be on both In the end I didn't feel it was (a) worth it right now and (b) suitable to fix in this PR. |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #78 +/- ##
==========================================
+ Coverage 82.52% 82.81% +0.28%
==========================================
Files 15 16 +1
Lines 1076 1094 +18
Branches 167 171 +4
==========================================
+ Hits 888 906 +18
Misses 142 142
Partials 46 46
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Thanks. Type hints are a recent addition and I did not get them all right. I will merge as is but feel free to make a PR regarding teh type annotations and I will have a look. |
Fixes #76.
Re-add support for missing "response" key in the
dialogues
part and add tests for_get_pair
and_get_triplet
so that a similar regression won't happen in the future.Note: Fully fixing the type annotations ended up being a much larger endeavor than expected, so I left that out of this PR and simply used
type: ignore
.