From 9de066d9e194080b9277323cad75e85a56aff6a8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 May 2024 15:26:35 -1000 Subject: [PATCH] Replace pop calls with del where the result is discarded in mqtt (#118338) --- homeassistant/components/mqtt/debug_info.py | 6 +++--- homeassistant/components/mqtt/tag.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mqtt/debug_info.py b/homeassistant/components/mqtt/debug_info.py index 83c78925f56..a8fd318b1e9 100644 --- a/homeassistant/components/mqtt/debug_info.py +++ b/homeassistant/components/mqtt/debug_info.py @@ -79,7 +79,7 @@ def remove_subscription( subscriptions = debug_info_entities[entity_id]["subscriptions"] subscriptions[subscription]["count"] -= 1 if not subscriptions[subscription]["count"]: - subscriptions.pop(subscription) + del subscriptions[subscription] def add_entity_discovery_data( @@ -107,7 +107,7 @@ def update_entity_discovery_data( def remove_entity_data(hass: HomeAssistant, entity_id: str) -> None: """Remove discovery data.""" if entity_id in (debug_info_entities := hass.data[DATA_MQTT].debug_info_entities): - debug_info_entities.pop(entity_id) + del debug_info_entities[entity_id] def add_trigger_discovery_data( @@ -138,7 +138,7 @@ def remove_trigger_discovery_data( hass: HomeAssistant, discovery_hash: tuple[str, str] ) -> None: """Remove discovery data.""" - hass.data[DATA_MQTT].debug_info_triggers.pop(discovery_hash) + del hass.data[DATA_MQTT].debug_info_triggers[discovery_hash] def _info_for_entity(hass: HomeAssistant, entity_id: str) -> dict[str, Any]: diff --git a/homeassistant/components/mqtt/tag.py b/homeassistant/components/mqtt/tag.py index ec6142401e5..22263a07499 100644 --- a/homeassistant/components/mqtt/tag.py +++ b/homeassistant/components/mqtt/tag.py @@ -181,4 +181,4 @@ class MQTTTagScanner(MqttDiscoveryDeviceUpdateMixin): self.hass, self._sub_state ) if self.device_id: - self.hass.data[DATA_MQTT].tags[self.device_id].pop(discovery_id) + del self.hass.data[DATA_MQTT].tags[self.device_id][discovery_id]