Skip to content

Commit

Permalink
python: Set urgent before early returns (#28793)
Browse files Browse the repository at this point in the history
* Set urgent before early returns

* Fix case where urgent isn't specified

* pythonify this thing.

Why use many line, when few line do trick.
  • Loading branch information
cecille authored and pull[bot] committed Nov 13, 2023
1 parent 82c282f commit ccce240
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/controller/python/chip/clusters/Attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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}"
Expand Down

0 comments on commit ccce240

Please sign in to comment.