Fix pylint issues

M1nd3r/thp5
M1nd3r 2 months ago committed by M1nd3r
parent a887a957ed
commit ef18d2951a

@ -85,7 +85,7 @@ def sync_set_can_send_message(session: SessionThpCache, can_send: bool) -> None:
def sync_set_receive_expected_bit(session: SessionThpCache, bit: int) -> None:
if bit != 0 and bit != 1:
if bit not in (0, 1):
raise ThpError("Unexpected receive sync bit")
# set second bit to "bit" value
@ -126,7 +126,7 @@ def _get_unauthenticated_session_or_none(session_id) -> SessionThpCache | None:
def _sync_set_send_bit(session: SessionThpCache, bit: int) -> None:
if bit != 0 and bit != 1:
if bit not in (0, 1):
raise ThpError("Unexpected send sync bit")
# set third bit to "bit" value

@ -285,7 +285,8 @@ async def _write_report(write, iface: WireInterface, report: bytearray) -> None:
async def _handle_broadcast(iface: WireInterface, ctrl_byte, report) -> Message | None:
if ctrl_byte != _CHANNEL_ALLOCATION_REQ:
raise ThpError("Unexpected ctrl_byte in broadcast channel packet")
length, nonce, checksum = ustruct.unpack(">H8s4s", report[3:])
nonce, checksum = ustruct.unpack(">8s4s", report[5:])
# Note that the length field of the channel allocation request is ignored.
if not _is_checksum_valid(checksum, data=report[:-4]):
raise ThpError("Checksum is not valid")

Loading…
Cancel
Save