From b9fb94f75f317f4342a760eee314e77dfca8a42c Mon Sep 17 00:00:00 2001 From: Christian Ruf Date: Mon, 4 Mar 2024 21:45:03 +0100 Subject: [PATCH] Fix ros2/launch#762 Signed-off-by: Christian Ruf --- launch_yaml/launch_yaml/entity.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/launch_yaml/launch_yaml/entity.py b/launch_yaml/launch_yaml/entity.py index 93e262688..bd4e435cc 100644 --- a/launch_yaml/launch_yaml/entity.py +++ b/launch_yaml/launch_yaml/entity.py @@ -124,7 +124,15 @@ def get_attr( data = self.__element[name] if check_is_list_entity(data_type): if isinstance(data, list) and isinstance(data[0], dict): - return [Entity(child, name) for child in data] + entities = [] + for child in data: + if len(child) != 1: + raise RuntimeError( + 'Subentities must be a dictionary with only one key' + ', which is the entity type') + type_name = list(child.keys())[0] + entities.append(Entity(child[type_name], type_name)) + return entities raise TypeError( "Attribute '{}' of Entity '{}' expected to be a list of dictionaries.".format( name, self.type_name