fix style prebuild errors

M1nd3r/thp5
M1nd3r 2 months ago committed by M1nd3r
parent e876b2023c
commit d8c5678960

@ -112,11 +112,15 @@ async def _handle_single_message(
msg_type = protobuf.type_for_wire(msg.type).MESSAGE_NAME
except Exception:
msg_type = f"{msg.type} - unknown message type"
if ctx.session_id is not None:
sid = int.from_bytes(ctx.session_id, "big")
else:
sid = -1
log.debug(
__name__,
"%s:%x receive: <%s>",
ctx.iface.iface_num(),
int.from_bytes(ctx.session_id, "big"),
sid,
msg_type,
)

@ -99,11 +99,15 @@ class Context:
to save on having to decode the type code into a protobuf class.
"""
if __debug__:
if self.session_id is not None:
sid = int.from_bytes(self.session_id, "big")
else:
sid = -1
log.debug(
__name__,
"%s:%x expect: %s",
self.iface.iface_num(),
int.from_bytes(self.session_id, "big"),
sid,
expected_type.MESSAGE_NAME if expected_type else expected_types,
)
@ -122,11 +126,15 @@ class Context:
expected_type = protobuf.type_for_wire(msg.type)
if __debug__:
if self.session_id is not None:
sid = int.from_bytes(self.session_id, "big")
else:
sid = -1
log.debug(
__name__,
"%s:%x read: %s",
self.iface.iface_num(),
int.from_bytes(self.session_id, "big"),
sid,
expected_type.MESSAGE_NAME,
)
@ -138,11 +146,15 @@ class Context:
async def write(self, msg: protobuf.MessageType) -> None:
"""Write a message to the wire."""
if __debug__:
if self.session_id is not None:
sid = int.from_bytes(self.session_id, "big")
else:
sid = -1
log.debug(
__name__,
"%s:%x write: %s",
self.iface.iface_num(),
int.from_bytes(self.session_id, "big"),
sid,
msg.MESSAGE_NAME,
)

Loading…
Cancel
Save