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

Fix some non-byteclean drivers #807

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Fix some non-byteclean drivers #807

wants to merge 7 commits into from

Conversation

kk7ds
Copy link
Owner

@kk7ds kk7ds commented Nov 8, 2023

  • bitwise: Support string-to-char[] in some cases
  • boblov_x3plus: Fix raw bytestring handling
  • leixen: Fix raw bytestring handling
  • puxing: Fix raw bytestring handling
  • tk8102: Fix raw bytestring handling
  • vx2,3,7: Fix raw bytestring handling
  • vx8: Fix raw bytestring handling (et al)

This makes bitwise allow converting strings to char[] without encoding
if the string can be encoded purely as ASCII. Drivers should really
be pre-encoding strings, which this will also natively allow, but
a LOT of drivers will need to change for this to be a hard requirement.
This driver also hasn't been converted or tested for python3. However,
it is pretty simple so this change also includes prospective byte-clean
conversions which may make it just work.
This also fixes some other python3isms that apparently never got
addressed originally.
@goldstar611
Copy link
Contributor

Now that CHIRP is python3 only, would you be opposed on adding typing information to the base/core functions where possible?

something like going from
def set_raw(self, data):
to
def set_raw(self, data: bytes):
or even
def set_raw(self, data: Union[bytes, CustomBytesClass]):

When I first started looking at python3 code (coming from python2) I hated it, but having the hints make using an IDE much more productive.

@kk7ds
Copy link
Owner Author

kk7ds commented Nov 11, 2023

Yeah I dunno. I appreciate the type hints in my editor as well, but I hate them in my code :( Python was supposed to be duck typed from the beginning, and so type annotations especially ("either this or that completely different type") is pretty silly.

But, lots of work to do on all the drivers before we get squared away anyway.

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.

2 participants