diff --git a/homeassistant/auth/providers/__init__.py b/homeassistant/auth/providers/__init__.py index b60fa8eff9c..1fe59346b00 100644 --- a/homeassistant/auth/providers/__init__.py +++ b/homeassistant/auth/providers/__init__.py @@ -207,7 +207,7 @@ class LoginFlow(data_entry_flow.FlowHandler): errors["base"] = "invalid_auth_module" if len(self.available_mfa_modules) == 1: - self._auth_module_id = list(self.available_mfa_modules.keys())[0] + self._auth_module_id = list(self.available_mfa_modules)[0] return await self.async_step_mfa() return self.async_show_form( diff --git a/homeassistant/components/asuswrt/device_tracker.py b/homeassistant/components/asuswrt/device_tracker.py index a7c4f9a7a7c..a3545183d2e 100644 --- a/homeassistant/components/asuswrt/device_tracker.py +++ b/homeassistant/components/asuswrt/device_tracker.py @@ -35,7 +35,7 @@ class AsusWrtDeviceScanner(DeviceScanner): async def async_scan_devices(self): """Scan for new devices and return a list with found device IDs.""" await self.async_update_info() - return list(self.last_results.keys()) + return list(self.last_results) async def async_get_device_name(self, device): """Return the name of the given device or None if we don't know.""" diff --git a/homeassistant/components/blink/alarm_control_panel.py b/homeassistant/components/blink/alarm_control_panel.py index 1ca4c4beac9..dbcb6d30143 100644 --- a/homeassistant/components/blink/alarm_control_panel.py +++ b/homeassistant/components/blink/alarm_control_panel.py @@ -66,7 +66,7 @@ class BlinkSyncModule(AlarmControlPanelEntity): """Return the state attributes.""" attr = self.sync.attributes attr["network_info"] = self.data.networks - attr["associated_cameras"] = list(self.sync.cameras.keys()) + attr["associated_cameras"] = list(self.sync.cameras) attr[ATTR_ATTRIBUTION] = DEFAULT_ATTRIBUTION return attr diff --git a/homeassistant/components/denon/media_player.py b/homeassistant/components/denon/media_player.py index ed90c2ddcb0..b909dc7c070 100644 --- a/homeassistant/components/denon/media_player.py +++ b/homeassistant/components/denon/media_player.py @@ -230,7 +230,7 @@ class DenonDevice(MediaPlayerEntity): @property def source_list(self): """Return the list of available input sources.""" - return sorted(list(self._source_list.keys())) + return sorted(list(self._source_list)) @property def media_title(self): diff --git a/homeassistant/components/environment_canada/sensor.py b/homeassistant/components/environment_canada/sensor.py index afd75956a9f..a8772909f68 100644 --- a/homeassistant/components/environment_canada/sensor.py +++ b/homeassistant/components/environment_canada/sensor.py @@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): lon = config.get(CONF_LONGITUDE, hass.config.longitude) ec_data = ECData(coordinates=(lat, lon), language=config.get(CONF_LANGUAGE)) - sensor_list = list(ec_data.conditions.keys()) + list(ec_data.alerts.keys()) + sensor_list = list(ec_data.conditions) + list(ec_data.alerts) add_entities([ECSensor(sensor_type, ec_data) for sensor_type in sensor_list], True) diff --git a/homeassistant/components/eq3btsmart/climate.py b/homeassistant/components/eq3btsmart/climate.py index 6eb0276c314..737b3fe357a 100644 --- a/homeassistant/components/eq3btsmart/climate.py +++ b/homeassistant/components/eq3btsmart/climate.py @@ -136,7 +136,7 @@ class EQ3BTSmartThermostat(ClimateEntity): @property def hvac_modes(self): """Return the list of available operation modes.""" - return list(HA_TO_EQ_HVAC.keys()) + return list(HA_TO_EQ_HVAC) def set_hvac_mode(self, hvac_mode): """Set operation mode.""" @@ -181,7 +181,7 @@ class EQ3BTSmartThermostat(ClimateEntity): Requires SUPPORT_PRESET_MODE. """ - return list(HA_TO_EQ_PRESET.keys()) + return list(HA_TO_EQ_PRESET) def set_preset_mode(self, preset_mode): """Set new preset mode.""" diff --git a/homeassistant/components/homekit/util.py b/homeassistant/components/homekit/util.py index 2ea4fcb551b..453ae13d846 100644 --- a/homeassistant/components/homekit/util.py +++ b/homeassistant/components/homekit/util.py @@ -357,7 +357,7 @@ class HomeKitSpeedMapping: for state, speed_range in reversed(self.speed_ranges.items()): if speed_range.start <= speed: return state - return list(self.speed_ranges.keys())[0] + return list(self.speed_ranges)[0] def show_setup_message(hass, entry_id, bridge_name, pincode, uri): diff --git a/homeassistant/components/insteon/climate.py b/homeassistant/components/insteon/climate.py index f05cf9d2940..7d4d9543c3f 100644 --- a/homeassistant/components/insteon/climate.py +++ b/homeassistant/components/insteon/climate.py @@ -202,12 +202,12 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity): async def async_set_fan_mode(self, fan_mode: str) -> None: """Set new target fan mode.""" - mode = list(FAN_MODES.keys())[list(FAN_MODES.values()).index(fan_mode)] + mode = list(FAN_MODES)[list(FAN_MODES.values()).index(fan_mode)] await self._insteon_device.async_set_mode(mode) async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set new target hvac mode.""" - mode = list(HVAC_MODES.keys())[list(HVAC_MODES.values()).index(hvac_mode)] + mode = list(HVAC_MODES)[list(HVAC_MODES.values()).index(hvac_mode)] await self._insteon_device.async_set_mode(mode) async def async_set_humidity(self, humidity): diff --git a/homeassistant/components/izone/climate.py b/homeassistant/components/izone/climate.py index cd14d1cadcf..443a80298f1 100644 --- a/homeassistant/components/izone/climate.py +++ b/homeassistant/components/izone/climate.py @@ -509,7 +509,7 @@ class ZoneDevice(ClimateEntity): @property def hvac_modes(self): """Return the list of available operation modes.""" - return list(self._state_to_pizone.keys()) + return list(self._state_to_pizone) @property def current_temperature(self): diff --git a/homeassistant/components/mqtt/discovery.py b/homeassistant/components/mqtt/discovery.py index 7a478733826..7f9a6730285 100644 --- a/homeassistant/components/mqtt/discovery.py +++ b/homeassistant/components/mqtt/discovery.py @@ -102,14 +102,14 @@ async def async_start( payload = MQTTConfig(payload) - for key in list(payload.keys()): + for key in list(payload): abbreviated_key = key key = ABBREVIATIONS.get(key, key) payload[key] = payload.pop(abbreviated_key) if CONF_DEVICE in payload: device = payload[CONF_DEVICE] - for key in list(device.keys()): + for key in list(device): abbreviated_key = key key = DEVICE_ABBREVIATIONS.get(key, key) device[key] = device.pop(abbreviated_key) diff --git a/homeassistant/components/nad/media_player.py b/homeassistant/components/nad/media_player.py index 7d8537db6c6..782b8735e3a 100644 --- a/homeassistant/components/nad/media_player.py +++ b/homeassistant/components/nad/media_player.py @@ -163,7 +163,7 @@ class NAD(MediaPlayerEntity): @property def source_list(self): """List of available input sources.""" - return sorted(list(self._reverse_mapping.keys())) + return sorted(list(self._reverse_mapping)) @property def available(self): diff --git a/homeassistant/components/pioneer/media_player.py b/homeassistant/components/pioneer/media_player.py index a04b79e3188..e573bf0929c 100644 --- a/homeassistant/components/pioneer/media_player.py +++ b/homeassistant/components/pioneer/media_player.py @@ -203,7 +203,7 @@ class PioneerDevice(MediaPlayerEntity): @property def source_list(self): """List of available input sources.""" - return list(self._source_name_to_number.keys()) + return list(self._source_name_to_number) @property def media_title(self): diff --git a/homeassistant/components/qnap/sensor.py b/homeassistant/components/qnap/sensor.py index fe4003a9423..11faba0f210 100644 --- a/homeassistant/components/qnap/sensor.py +++ b/homeassistant/components/qnap/sensor.py @@ -85,12 +85,12 @@ _VOLUME_MON_COND = { } _MONITORED_CONDITIONS = ( - list(_SYSTEM_MON_COND.keys()) - + list(_CPU_MON_COND.keys()) - + list(_MEMORY_MON_COND.keys()) - + list(_NETWORK_MON_COND.keys()) - + list(_DRIVE_MON_COND.keys()) - + list(_VOLUME_MON_COND.keys()) + list(_SYSTEM_MON_COND) + + list(_CPU_MON_COND) + + list(_MEMORY_MON_COND) + + list(_NETWORK_MON_COND) + + list(_DRIVE_MON_COND) + + list(_VOLUME_MON_COND) ) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( diff --git a/homeassistant/components/sma/sensor.py b/homeassistant/components/sma/sensor.py index ce61d4ff17b..119d9a366d6 100644 --- a/homeassistant/components/sma/sensor.py +++ b/homeassistant/components/sma/sensor.py @@ -40,7 +40,7 @@ def _check_sensor_schema(conf): except (ImportError, AttributeError): return conf - customs = list(conf[CONF_CUSTOM].keys()) + customs = list(conf[CONF_CUSTOM]) for sensor in conf[CONF_SENSORS]: if sensor in customs: @@ -120,7 +120,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= if isinstance(config_sensors, list): if not config_sensors: # Use all sensors by default config_sensors = [s.name for s in sensor_def] - used_sensors = list(set(config_sensors + list(config[CONF_CUSTOM].keys()))) + used_sensors = list(set(config_sensors + list(config[CONF_CUSTOM]))) for sensor in used_sensors: hass_sensors.append(SMAsensor(sensor_def[sensor], [])) diff --git a/homeassistant/components/upnp/sensor.py b/homeassistant/components/upnp/sensor.py index 80a5ce7021c..a9906e535b9 100644 --- a/homeassistant/components/upnp/sensor.py +++ b/homeassistant/components/upnp/sensor.py @@ -88,7 +88,7 @@ async def async_setup_entry( udn = data[CONFIG_ENTRY_UDN] else: # any device will do - udn = list(hass.data[DOMAIN][DOMAIN_DEVICES].keys())[0] + udn = list(hass.data[DOMAIN][DOMAIN_DEVICES])[0] device: Device = hass.data[DOMAIN][DOMAIN_DEVICES][udn] diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py index 82950e4f7f8..4807d780a48 100644 --- a/homeassistant/components/webostv/media_player.py +++ b/homeassistant/components/webostv/media_player.py @@ -271,7 +271,7 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity): @property def source_list(self): """List of available input sources.""" - return sorted(self._source_list.keys()) + return sorted(list(self._source_list)) @property def media_content_type(self): diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index 06cf91faf27..90704a6edfb 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -471,7 +471,7 @@ class YeelightGenericLight(YeelightEntity, LightEntity): @property def custom_effects_names(self): """Return list with custom effects names.""" - return list(self.custom_effects.keys()) + return list(self.custom_effects) @property def light_type(self): diff --git a/homeassistant/helpers/config_entry_oauth2_flow.py b/homeassistant/helpers/config_entry_oauth2_flow.py index ba43a057ca3..4d05ad7beab 100644 --- a/homeassistant/helpers/config_entry_oauth2_flow.py +++ b/homeassistant/helpers/config_entry_oauth2_flow.py @@ -233,7 +233,7 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta): data_schema=vol.Schema( { vol.Required( - "implementation", default=list(implementations.keys())[0] + "implementation", default=list(implementations)[0] ): vol.In({key: impl.name for key, impl in implementations.items()}) } ),