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

Update iter_bytes to be the same as what's used in pyvisa-sim #389

Merged
merged 9 commits into from
Oct 19, 2023
Merged

Update iter_bytes to be the same as what's used in pyvisa-sim #389

merged 9 commits into from
Oct 19, 2023

Conversation

dougthor42
Copy link
Contributor

@dougthor42 dougthor42 commented Aug 6, 2023

This ports pyvisa/pyvisa-sim#81 to this project per request in pyvisa/pyvisa-sim#81 (comment), closing #374.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
Comment on lines 37 to 39
def iter_bytes(
data: bytes, mask: Optional[int] = None, send_end: Optional[bool] = False
):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if serial.iter_bytes was used by any external projects, so I opted to keep the API around. LMK if you'd rather I just remove it.

send_end, _ = self.get_attribute(ResourceAttribute.send_end_enabled)
end_out, _ = self.get_attribute(ResourceAttribute.asrl_end_out)
data_bits, _ = self.get_attribute(constants.ResourceAttribute.asrl_data_bits)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reordered end_out and send_end so that they match pyvisa_sim: https://github.com/pyvisa/pyvisa-sim/blob/17323c60b9e50f8cca4b983d42dd26a6ada877e3/pyvisa_sim/sessions/serial.py#L76-L78

I opted to not rename end_out to asrl_end to keep the diff down.

@dougthor42 dougthor42 marked this pull request as ready for review August 6, 2023 18:07
@MatthieuDartiailh
Copy link
Member

Sorry this completely escaped my attention. I would say we can scrape iter_bytes from serial. It was not really meant to be public. But its disappearance should be mentioned.

I am planning to release soon since there has been multiple bug fixes. Do you think you can make the changes before next week ?

@dougthor42
Copy link
Contributor Author

Updated, PTAL

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (ea7fa43) 23.14% compared to head (28fbf8c) 24.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #389      +/-   ##
==========================================
+ Coverage   23.14%   24.22%   +1.07%     
==========================================
  Files          23       24       +1     
  Lines        3318     3356      +38     
  Branches      458      469      +11     
==========================================
+ Hits          768      813      +45     
+ Misses       2532     2524       -8     
- Partials       18       19       +1     
Flag Coverage Δ
unittests 24.22% <83.63%> (+1.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pyvisa_py/testsuite/test_common.py 100.00% <100.00%> (ø)
pyvisa_py/common.py 88.09% <93.33%> (+13.09%) ⬆️
pyvisa_py/serial.py 5.97% <12.50%> (+0.25%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MatthieuDartiailh
Copy link
Member

Isort and flake8 are unhappy. CI do not run automatically because you are a first time contributor.

@MatthieuDartiailh MatthieuDartiailh merged commit a922159 into pyvisa:main Oct 19, 2023
17 checks passed
@dougthor42 dougthor42 deleted the 374-iter_bytes branch May 11, 2024 20:43
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.

Port pyvisa-sim iter_bytes changes for serial communication
2 participants