From a59cc1c691f9f3b867e80f5ba94829489e74e0ed Mon Sep 17 00:00:00 2001 From: Eduardo Rios Date: Tue, 15 Sep 2026 14:48:45 -0300 Subject: [PATCH] fix: apply ruff formatting to _check_keys_and_notif_id Fixes CI formatting failure introduced by the manual Sonar cognitive- complexity fix (extracting the ignore-list/dedup check into its own helper). Co-Authored-By: Claude Sonnet 5 --- orchestrator/activities/slot_manager.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/orchestrator/activities/slot_manager.py b/orchestrator/activities/slot_manager.py index 08b6ba8..683813c 100644 --- a/orchestrator/activities/slot_manager.py +++ b/orchestrator/activities/slot_manager.py @@ -447,8 +447,9 @@ class SlotManager(SientiaMonitoring): # Check if this group must be notified if ( alert_type in receiver_group['contents'] - and notification_id not in ignore_list - and key not in already_added_keys + and self._check_keys_and_notif_id( + notification_id, ignore_list, key, already_added_keys + ) and self._check_levels_and_ignore_models_id( notification, levels_list, ignore_models_id_list ) @@ -484,6 +485,23 @@ class SlotManager(SientiaMonitoring): ) return level_check and model_id_check + @staticmethod + def _check_keys_and_notif_id(notification_id, ignore_list, key, already_added_keys) -> bool: + """ + Check if the key has already been added to the list of already added keys. + + Args: + notification_id (str): The ID of the notification. + ignore_list (list): List of notification IDs to ignore. + key (str): The key to check. + already_added_keys (list[str]): List of keys that have already been added. + + Returns: + bool: True if the key has not been added yet, False otherwise. + + """ + return notification_id not in ignore_list and key not in already_added_keys + @activity.defn(name='store_notification_cache') def store_notification_cache(self, input_data: dict[str, Any]) -> None: """