From 7f93f86ac384d3c68b801a24e166fd1774c31103 Mon Sep 17 00:00:00 2001 From: AleJo2995 Date: Mon, 3 Jun 2024 10:52:24 -0600 Subject: [PATCH] fix: correct sonar quality checks (#1568) Signed-off-by: Alejandro Jose Leiva Palomo --- trestle/core/catalog/catalog_interface.py | 6 +++--- trestle/core/catalog/catalog_merger.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/trestle/core/catalog/catalog_interface.py b/trestle/core/catalog/catalog_interface.py index be93dd3f5..2278ddbf4 100644 --- a/trestle/core/catalog/catalog_interface.py +++ b/trestle/core/catalog/catalog_interface.py @@ -469,9 +469,9 @@ def _get_groups_from_group(group: cat.Group) -> Iterator[cat.Group]: def get_group_info_by_control(self, control_id: str) -> Tuple[str, str, str]: """Get the group_id, title, class for this control from the dict.""" return ( - self._control_dict[control_id].group_id, - self._control_dict[control_id].group_title, - self._control_dict[control_id].group_class + '' if self._control_dict is None else self._control_dict[control_id].group_id, + '' if self._control_dict is None else self._control_dict[control_id].group_title, + '' if self._control_dict is None else self._control_dict[control_id].group_class ) def get_control_path(self, control_id: str) -> List[str]: diff --git a/trestle/core/catalog/catalog_merger.py b/trestle/core/catalog/catalog_merger.py index 46315670b..d2055d416 100644 --- a/trestle/core/catalog/catalog_merger.py +++ b/trestle/core/catalog/catalog_merger.py @@ -94,7 +94,10 @@ def merge_catalog(self, catalog: cat.Catalog, replace_params: bool) -> None: self._catalog_interface._control_dict[src.id] = new_control_handle # type: ignore # now need to cull any controls that are not in the src catalog - handled_ids = set(cat_interface._control_dict.keys()) + if cat_interface._control_dict is None: + handled_ids = None + else: + handled_ids = set(cat_interface._control_dict.keys()) orig_ids = set(self._catalog_interface._control_dict.keys()) extra_ids = orig_ids.difference(handled_ids) for extra_id in sorted(extra_ids):