-
Notifications
You must be signed in to change notification settings - Fork 304
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
Escape demonstration bytes in BleakClient docstring. #1663
Conversation
I think the bug is in the documentation renderer.
>>> b"\x00\x01\x02\x03" == bytes([0, 1, 2, 3])
True
>>> b"\\x00\\x01\\x02\\x03" == bytes([0, 1, 2, 3])
False
>>> b"\\x00\\x01\\x02\\x03" == bytes([92, 120, 48, 48, 92, 120, 48, 49, 92, 120, 48, 50, 92, 120, 48, 51])
True |
This is not supposed to be python code, this is supposed to be a string containing python code (it is wrapped with >>> print("""await client.write_gatt_char(MY_CHAR_UUID, b"\\x00\\x01\\x02\\x03", response=True)""")
await client.write_gatt_char(MY_CHAR_UUID, b"\x00\x01\x02\x03", response=True)
>>> print("""await client.write_gatt_char(MY_CHAR_UUID, b"\x00\x01\x02\x03", response=True)""")
await client.write_gatt_char(MY_CHAR_UUID, b"", response=True)
>>> "\x61" # 0x61 is 97 in decimal which decodes to 'a' in ascii
'a'
>>> |
Besides, thank you for creating this library! |
Ah, of course! My mistake. |
Instead of adding escapes, could we change it to a raw string instead ( |
The bytes inside the example weren't properly escaped using a raw string helps. Some IDE's threw an error, readthedocs showed this as empty.
d008c76
to
7bc484e
Compare
Sure, an r-string is definitely better |
Thanks! |
The bytes inside the example weren't properly escaped. Some IDE's threw an error, readthedocs showed this as empty.