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

Bitwise strict checks and byte-compat deprecations #805

Merged
merged 7 commits into from
Nov 8, 2023
Merged

Conversation

kk7ds
Copy link
Owner

@kk7ds kk7ds commented Nov 6, 2023

  • Add a way to test for compat bytes usage
  • Default bitwise's get_raw() to byte-native
  • Fix deprecated trunc instead of int
  • Add warnings for non-byte-clean raw methods
  • Add test for strict bitwise seeks

@kk7ds kk7ds force-pushed the bitwise-cleanups branch 2 times, most recently from 51021d4 to c5eef46 Compare November 7, 2023 01:54
kk7ds added 7 commits November 7, 2023 15:36
A lot of radios are still relying on get_raw() returning a str instead
of a bytes. This adds an environment flag that can be used to run
without that compatibility layer to smoke out those offending drivers.
This makes get_raw() byte-native and requires opting into the old
compatibility behavior of returning a string. All new code should be
using byte-native results from this, which this will help.

All existing drivers not asking for asbytes=True have been changed to
request asbytes=False. I used diff-cover to manually examine any lines
not covered by tests to ensure they were compliant, so this should not
introduce any new behavior.
This makes us log a warning when a driver uses a get_raw(asbytes=False)
or set_raw() with a str argument instead of bytes. Those need to get
fixed up and this will help us notice when a driver is not converted.
This shows which drivers use negative and unnecessary seeks. These are
all marked as XFAIL right now because there are *so* many offenders.
This driver has some very non-chirp-conventional black-like formatting,
which after fixing, saves about 200 vertical lines. Grr.

Also take this opportunity to modernize the driver, remove the future
check, fix to be fully byte-clean.
@kk7ds
Copy link
Owner Author

kk7ds commented Nov 8, 2023

Unit failure is because repeaterbook is down right now.

@kk7ds kk7ds merged commit aaa669c into master Nov 8, 2023
5 of 6 checks passed
@kk7ds kk7ds deleted the bitwise-cleanups branch November 8, 2023 00:02
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.

1 participant