From d18dda6ded0a5eacdbacd1616020b01bf3c55571 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 23 Aug 2023 15:09:40 -0400 Subject: [PATCH] python: Set urgent before early returns (#28793) * Set urgent before early returns * Fix case where urgent isn't specified * pythonify this thing. Why use many line, when few line do trick. --- src/controller/python/chip/ChipDeviceCtrl.py | 2 +- src/controller/python/chip/clusters/Attribute.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 55a325fa8d3432..22ae11cda65a78 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1019,7 +1019,7 @@ def _parseEventPathTuple(self, pathTuple: typing.Union[ event = pathTuple[1] else: raise ValueError("Unsupported Attribute Path") - urgent = pathTuple[-1] + urgent = bool(pathTuple[-1]) if len(pathTuple) > 2 else False return ClusterAttribute.EventPath( EndpointId=endpoint, Cluster=cluster, Event=event, Urgent=urgent) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 4572065e3df501..308ffe9d8a9349 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -173,6 +173,7 @@ class EventPath: def __init__(self, EndpointId: int = None, Cluster=None, Event=None, ClusterId=None, EventId=None, Urgent=None): self.EndpointId = EndpointId + self.Urgent = Urgent if Cluster is not None: # Wildcard read for a specific cluster if (Event is not None) or (ClusterId is not None) or (EventId is not None): @@ -189,7 +190,6 @@ def __init__(self, EndpointId: int = None, Cluster=None, Event=None, ClusterId=N return self.ClusterId = ClusterId self.EventId = EventId - self.Urgent = Urgent def __str__(self) -> str: return f"{self.EndpointId}/{self.ClusterId}/{self.EventId}/{self.Urgent}"