Use dict.values() when appropriate (#42509)

pull/42510/head
springstan 2020-10-28 11:59:07 +01:00 committed by GitHub
parent 9545fce55b
commit 989ab5029a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View File

@ -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):

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))