Skip to content

Commit

Permalink
Switch enum check for 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Oct 25, 2024
1 parent f077da1 commit a8c949c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion circuitmatter/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ def decode(self, buffer):
self.general_code, self.protocol_id, self.protocol_code = struct.unpack_from("<HIH", buffer)
self.general_code = GeneralCode(self.general_code)
self.protocol_data = buffer[8:]
if self.protocol_id in protocol.ProtocolId:
try:
# TODO: Once our minimum version is 3.12+ switch to an "in" check.
self.protocol_id = protocol.ProtocolId(self.protocol_id)
except ValueError:
pass

if self.protocol_id == protocol.ProtocolId.SECURE_CHANNEL:
self.protocol_code = SecureChannelProtocolCode(self.protocol_code)
Expand Down

0 comments on commit a8c949c

Please sign in to comment.