mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Replace pop calls with del where the result is discarded in mqtt (#118338)
This commit is contained in:
parent
fd9d4dbb34
commit
9de066d9e1
@ -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]:
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user