Skip to content

Commit

Permalink
[YAML] Add _ById commands support for darwin-framework-tool - Followu…
Browse files Browse the repository at this point in the history
…p: Add comment explaining the use of isinstance for list detection (#36063)
  • Loading branch information
vivien-apple authored Oct 14, 2024
1 parent 9524ac9 commit 0474070
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool):
del value[key_name]

elif isinstance(value, list) and array:
# Instead of using `False` for the last parameter (array), `isinstance(v, list)` is used.
# While the data model specification does not include lists of lists, the format returned
# by the Matter.framework for *ById APIs may contain them.
# For example, the command:
# darwin-framework-tool any read-by-id 29 0 0x12344321 65535
# returns value such as:
# [[{'DeviceType': 17, 'Revision': 1}, {'DeviceType': 22, 'Revision': 1}], ...]
value = [self.run(specs, v, cluster_name, typename, isinstance(v, list))
for v in value]

Expand Down

0 comments on commit 0474070

Please sign in to comment.