Use dict.values() when appropriate (#42509)
parent
9545fce55b
commit
989ab5029a
|
@ -186,7 +186,7 @@ class ApnsNotificationService(BaseNotificationService):
|
|||
def write_devices(self):
|
||||
"""Write all known devices to file."""
|
||||
with open(self.yaml_path, "w+") as out:
|
||||
for _, device in self.devices.items():
|
||||
for device in self.devices.values():
|
||||
_write_device(out, device)
|
||||
|
||||
def register(self, call):
|
||||
|
|
|
@ -79,7 +79,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
def dispose(event):
|
||||
"""Close connections to Netio Devices."""
|
||||
for _, value in DEVICES.items():
|
||||
for value in DEVICES.values():
|
||||
value.netio.stop()
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
scsgate = hass.data[DOMAIN]
|
||||
|
||||
if devices:
|
||||
for _, entity_info in devices.items():
|
||||
for entity_info in devices.values():
|
||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||
continue
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
scsgate = hass.data[DOMAIN]
|
||||
|
||||
if devices:
|
||||
for _, entity_info in devices.items():
|
||||
for entity_info in devices.values():
|
||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||
continue
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ def _setup_traditional_switches(logger, config, scsgate, add_entities_callback):
|
|||
switches = []
|
||||
|
||||
if traditional:
|
||||
for _, entity_info in traditional.items():
|
||||
for entity_info in traditional.values():
|
||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||
continue
|
||||
|
||||
|
@ -65,7 +65,7 @@ def _setup_scenario_switches(logger, config, scsgate, hass):
|
|||
scenario = config.get(CONF_SCENARIO)
|
||||
|
||||
if scenario:
|
||||
for _, entity_info in scenario.items():
|
||||
for entity_info in scenario.values():
|
||||
if entity_info[CONF_SCS_ID] in scsgate.devices:
|
||||
continue
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
switches = []
|
||||
tags = platform.load_tags()
|
||||
for switch_type in config.get(CONF_MONITORED_CONDITIONS):
|
||||
for _, tag in tags.items():
|
||||
for tag in tags.values():
|
||||
if switch_type in tag.allowed_monitoring_types:
|
||||
switches.append(WirelessTagSwitch(platform, tag, switch_type))
|
||||
|
||||
|
|
Loading…
Reference in New Issue