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 <noreply@anthropic.com>
This commit is contained in:
@@ -447,8 +447,9 @@ class SlotManager(SientiaMonitoring):
|
|||||||
# Check if this group must be notified
|
# Check if this group must be notified
|
||||||
if (
|
if (
|
||||||
alert_type in receiver_group['contents']
|
alert_type in receiver_group['contents']
|
||||||
and notification_id not in ignore_list
|
and self._check_keys_and_notif_id(
|
||||||
and key not in already_added_keys
|
notification_id, ignore_list, key, already_added_keys
|
||||||
|
)
|
||||||
and self._check_levels_and_ignore_models_id(
|
and self._check_levels_and_ignore_models_id(
|
||||||
notification, levels_list, ignore_models_id_list
|
notification, levels_list, ignore_models_id_list
|
||||||
)
|
)
|
||||||
@@ -484,6 +485,23 @@ class SlotManager(SientiaMonitoring):
|
|||||||
)
|
)
|
||||||
return level_check and model_id_check
|
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')
|
@activity.defn(name='store_notification_cache')
|
||||||
def store_notification_cache(self, input_data: dict[str, Any]) -> None:
|
def store_notification_cache(self, input_data: dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user