diff --git a/homeassistant/components/alarmdecoder/config_flow.py b/homeassistant/components/alarmdecoder/config_flow.py index cc4a19e47552c441f59a07fe7385f938b7ab8bcb..45d04feb3b21517090d5e45cb095e1d23e235852 100644 --- a/homeassistant/components/alarmdecoder/config_flow.py +++ b/homeassistant/components/alarmdecoder/config_flow.py @@ -299,7 +299,7 @@ def _validate_zone_input(zone_input): errors["base"] = "relay_inclusive" # The following keys must be int - for key in [CONF_ZONE_NUMBER, CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN]: + for key in (CONF_ZONE_NUMBER, CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN): if key in zone_input: try: int(zone_input[key]) @@ -328,7 +328,7 @@ def _fix_input_types(zone_input): strings and then convert them to ints. """ - for key in [CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN]: + for key in (CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN): if key in zone_input: zone_input[key] = int(zone_input[key]) diff --git a/homeassistant/components/apple_tv/config_flow.py b/homeassistant/components/apple_tv/config_flow.py index 9afcb7a61cabac9e41acf74cd5a1d466a30dc3a0..56ad1e83e2378a20d4d7f272174bda48f6123c4b 100644 --- a/homeassistant/components/apple_tv/config_flow.py +++ b/homeassistant/components/apple_tv/config_flow.py @@ -56,7 +56,7 @@ async def device_scan(identifier, loop, cache=None): if matches: return cache, matches[0] - for hosts in [_host_filter(), None]: + for hosts in (_host_filter(), None): scan_result = await scan(loop, timeout=3, hosts=hosts) matches = [atv for atv in scan_result if _filter_device(atv)] diff --git a/homeassistant/components/aprs/device_tracker.py b/homeassistant/components/aprs/device_tracker.py index ef3686fcd004b20ad7a267cf63f72752a6c472b1..f86a5a4648d7f92f976fefe599ed6ef8462d9e58 100644 --- a/homeassistant/components/aprs/device_tracker.py +++ b/homeassistant/components/aprs/device_tracker.py @@ -178,7 +178,7 @@ class AprsListenerThread(threading.Thread): _LOGGER.warning( "APRS message contained invalid posambiguity: %s", str(pos_amb) ) - for attr in [ATTR_ALTITUDE, ATTR_COMMENT, ATTR_COURSE, ATTR_SPEED]: + for attr in (ATTR_ALTITUDE, ATTR_COMMENT, ATTR_COURSE, ATTR_SPEED): if attr in msg: attrs[attr] = msg[attr] diff --git a/homeassistant/components/arcam_fmj/media_player.py b/homeassistant/components/arcam_fmj/media_player.py index 89f0cc3b112138c982df1b3f62959ce5d2b27e3f..e9e5e29a1c7717321db03350f1b497a3c02d7dd4 100644 --- a/homeassistant/components/arcam_fmj/media_player.py +++ b/homeassistant/components/arcam_fmj/media_player.py @@ -52,7 +52,7 @@ async def async_setup_entry( State(client, zone), config_entry.unique_id or config_entry.entry_id, ) - for zone in [1, 2] + for zone in (1, 2) ], True, ) diff --git a/homeassistant/components/bmw_connected_drive/sensor.py b/homeassistant/components/bmw_connected_drive/sensor.py index 053a5adff22678544fb696625a38a6f0e0e7bb0d..8d44d1290dc6d8fd7d990ecb15dd05e7ae2dbae5 100644 --- a/homeassistant/components/bmw_connected_drive/sensor.py +++ b/homeassistant/components/bmw_connected_drive/sensor.py @@ -451,12 +451,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities): "chargecycle_range", "total_electric_distance", ): - for attr in [ + for attr in ( "community_average", "community_high", "community_low", "user_average", - ]: + ): device = BMWConnectedDriveSensor( account, vehicle, @@ -466,7 +466,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) entities.append(device) if attribute_name == "chargecycle_range": - for attr in ["user_current_charge_cycle", "user_high"]: + for attr in ("user_current_charge_cycle", "user_high"): device = BMWConnectedDriveSensor( account, vehicle, @@ -476,7 +476,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) entities.append(device) if attribute_name == "total_electric_distance": - for attr in ["user_total"]: + for attr in ("user_total",): device = BMWConnectedDriveSensor( account, vehicle, @@ -593,13 +593,13 @@ class BMWConnectedDriveSensor(BMWConnectedDriveBaseEntity, SensorEntity): self._state = getattr(vehicle_last_trip, self._attribute) elif self._service == SERVICE_ALL_TRIPS: vehicle_all_trips = self._vehicle.state.all_trips - for attribute in [ + for attribute in ( "average_combined_consumption", "average_electric_consumption", "average_recuperation", "chargecycle_range", "total_electric_distance", - ]: + ): if self._attribute.startswith(f"{attribute}_"): attr = getattr(vehicle_all_trips, attribute) sub_attr = self._attribute.replace(f"{attribute}_", "") diff --git a/homeassistant/components/climacell/weather.py b/homeassistant/components/climacell/weather.py index be03b53ef72fb5e2dd9006c6978f19635afeff9f..2043459c496a072da498bddf4cc57c907b78a51b 100644 --- a/homeassistant/components/climacell/weather.py +++ b/homeassistant/components/climacell/weather.py @@ -109,7 +109,7 @@ async def async_setup_entry( api_class = ClimaCellV3WeatherEntity if api_version == 3 else ClimaCellWeatherEntity entities = [ api_class(config_entry, coordinator, api_version, forecast_type) - for forecast_type in [DAILY, HOURLY, NOWCAST] + for forecast_type in (DAILY, HOURLY, NOWCAST) ] async_add_entities(entities) diff --git a/homeassistant/components/configurator/__init__.py b/homeassistant/components/configurator/__init__.py index e988e58f76bdfd052af336955ba84e4f6a8501bc..f06ec330815b00e248a1f937b11eb95dba175275 100644 --- a/homeassistant/components/configurator/__init__.py +++ b/homeassistant/components/configurator/__init__.py @@ -166,10 +166,10 @@ class Configurator: data.update( { key: value - for key, value in [ + for key, value in ( (ATTR_DESCRIPTION, description), (ATTR_SUBMIT_CAPTION, submit_caption), - ] + ) if value is not None } ) diff --git a/homeassistant/components/daikin/climate.py b/homeassistant/components/daikin/climate.py index d17c3fc0d934c22e8d1d732db7346a423d3f34fc..b3e833bb64fd1a9dd495c239d4b43dde3f4b4fa5 100644 --- a/homeassistant/components/daikin/climate.py +++ b/homeassistant/components/daikin/climate.py @@ -135,7 +135,7 @@ class DaikinClimate(ClimateEntity): """Set device settings using API.""" values = {} - for attr in [ATTR_TEMPERATURE, ATTR_FAN_MODE, ATTR_SWING_MODE, ATTR_HVAC_MODE]: + for attr in (ATTR_TEMPERATURE, ATTR_FAN_MODE, ATTR_SWING_MODE, ATTR_HVAC_MODE): value = settings.get(attr) if value is None: continue diff --git a/homeassistant/components/deconz/services.py b/homeassistant/components/deconz/services.py index a4f4aec6a7668df9bb28c9f031c37bf1a3257852..08ee9e11561feb951aca9c794511bba0528d0788 100644 --- a/homeassistant/components/deconz/services.py +++ b/homeassistant/components/deconz/services.py @@ -153,7 +153,7 @@ async def async_refresh_devices_service(gateway): await gateway.api.refresh_state() gateway.ignore_state_updates = False - for new_device_type in [NEW_GROUP, NEW_LIGHT, NEW_SCENE, NEW_SENSOR]: + for new_device_type in (NEW_GROUP, NEW_LIGHT, NEW_SCENE, NEW_SENSOR): gateway.async_add_device_callback(new_device_type, force=True) diff --git a/homeassistant/components/devolo_home_control/sensor.py b/homeassistant/components/devolo_home_control/sensor.py index 3ab449b2c9135f9a569ae42697dd247ad074ab63..0500fc72b0bcf80b377591e81109c8849496d78b 100644 --- a/homeassistant/components/devolo_home_control/sensor.py +++ b/homeassistant/components/devolo_home_control/sensor.py @@ -52,7 +52,7 @@ async def async_setup_entry( for device in gateway.devices.values(): if hasattr(device, "consumption_property"): for consumption in device.consumption_property: - for consumption_type in ["current", "total"]: + for consumption_type in ("current", "total"): entities.append( DevoloConsumptionEntity( homecontrol=gateway, diff --git a/homeassistant/components/doorbird/__init__.py b/homeassistant/components/doorbird/__init__.py index f0579ef900b47e2a6884f5b5f3de4657337e837d..d5964d5aea0af6eb9a508a6d0dde9da5657d657e 100644 --- a/homeassistant/components/doorbird/__init__.py +++ b/homeassistant/components/doorbird/__init__.py @@ -195,7 +195,7 @@ async def _update_listener(hass: HomeAssistant, entry: ConfigEntry): def _async_import_options_from_data_if_missing(hass: HomeAssistant, entry: ConfigEntry): options = dict(entry.options) modified = False - for importable_option in [CONF_EVENTS]: + for importable_option in (CONF_EVENTS,): if importable_option not in entry.options and importable_option in entry.data: options[importable_option] = entry.data[importable_option] modified = True diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index 4084045b1fb0513f744e82e8be80ae72dfee5a5e..045a742485bb8a979d81e1a7d019fdd3063df809 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -653,10 +653,10 @@ class EvoChild(EvoDevice): this_sp_day = -1 if sp_idx == -1 else 0 next_sp_day = 1 if sp_idx + 1 == len(day["Switchpoints"]) else 0 - for key, offset, idx in [ + for key, offset, idx in ( ("this", this_sp_day, sp_idx), ("next", next_sp_day, (sp_idx + 1) * (1 - next_sp_day)), - ]: + ): sp_date = (day_time + timedelta(days=offset)).strftime("%Y-%m-%d") day = self._schedule["DailySchedules"][(day_of_week + offset) % 7] switchpoint = day["Switchpoints"][idx] diff --git a/homeassistant/components/flunearyou/__init__.py b/homeassistant/components/flunearyou/__init__.py index d9203ed0c29513ab662a2b0bf782583b33412aab..d80591c067c81f887f51d867eadb2db12736d5c7 100644 --- a/homeassistant/components/flunearyou/__init__.py +++ b/homeassistant/components/flunearyou/__init__.py @@ -48,7 +48,7 @@ async def async_setup_entry(hass, entry): raise UpdateFailed(err) from err data_init_tasks = [] - for api_category in [CATEGORY_CDC_REPORT, CATEGORY_USER_REPORT]: + for api_category in (CATEGORY_CDC_REPORT, CATEGORY_USER_REPORT): coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][ api_category ] = DataUpdateCoordinator( diff --git a/homeassistant/components/fritz/services.py b/homeassistant/components/fritz/services.py index fcfbd54b74322381e8fe1cfd50638f1f746a8d79..359e7ced239ea3f4fa2205e6531c506cdb48e214 100644 --- a/homeassistant/components/fritz/services.py +++ b/homeassistant/components/fritz/services.py @@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_services(hass: HomeAssistant) -> None: """Set up services for Fritz integration.""" - for service in [SERVICE_REBOOT, SERVICE_RECONNECT]: + for service in (SERVICE_REBOOT, SERVICE_RECONNECT): if hass.services.has_service(DOMAIN, service): return @@ -34,7 +34,7 @@ async def async_setup_services(hass: HomeAssistant) -> None: fritz_tools = hass.data[DOMAIN][entry] await fritz_tools.service_fritzbox(service_call.service) - for service in [SERVICE_REBOOT, SERVICE_RECONNECT]: + for service in (SERVICE_REBOOT, SERVICE_RECONNECT): hass.services.async_register(DOMAIN, service, async_call_fritz_service) diff --git a/homeassistant/components/geniushub/__init__.py b/homeassistant/components/geniushub/__init__.py index bf5fc03ded5fc36b6b5298b38556bb520715f818..cad80e8d707ca532ffe6bc987a8abc10bf3ebf33 100644 --- a/homeassistant/components/geniushub/__init__.py +++ b/homeassistant/components/geniushub/__init__.py @@ -120,7 +120,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async_track_time_interval(hass, broker.async_update, SCAN_INTERVAL) - for platform in ["climate", "water_heater", "sensor", "binary_sensor", "switch"]: + for platform in ("climate", "water_heater", "sensor", "binary_sensor", "switch"): hass.async_create_task(async_load_platform(hass, platform, DOMAIN, {}, config)) setup_service_functions(hass, broker) diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 0ff488161ed576966b4f7cf14f6d07f47c6e57ab..8e605ca121c6d0df84dd0d9389f2e36ad2cc7869 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -60,13 +60,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Set up DataUpdateCoordinators for the valve controller: init_valve_controller_tasks = [] - for api, api_coro in [ + for api, api_coro in ( (API_SENSOR_PAIR_DUMP, client.sensor.pair_dump), (API_SYSTEM_DIAGNOSTICS, client.system.diagnostics), (API_SYSTEM_ONBOARD_SENSOR_STATUS, client.system.onboard_sensor_status), (API_VALVE_STATUS, client.valve.status), (API_WIFI_STATUS, client.wifi.status), - ]: + ): coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][ api ] = GuardianDataUpdateCoordinator( diff --git a/homeassistant/components/guardian/switch.py b/homeassistant/components/guardian/switch.py index 29069c1abc54ce91ddcce515b3d9a3abece4af25..ef74a35147febc93300258dac6c59a8ce3f5ef02 100644 --- a/homeassistant/components/guardian/switch.py +++ b/homeassistant/components/guardian/switch.py @@ -44,7 +44,7 @@ async def async_setup_entry( """Set up Guardian switches based on a config entry.""" platform = entity_platform.async_get_current_platform() - for service_name, schema, method in [ + for service_name, schema, method in ( (SERVICE_DISABLE_AP, {}, "async_disable_ap"), (SERVICE_ENABLE_AP, {}, "async_enable_ap"), (SERVICE_PAIR_SENSOR, {vol.Required(CONF_UID): cv.string}, "async_pair_sensor"), @@ -64,7 +64,7 @@ async def async_setup_entry( {vol.Required(CONF_UID): cv.string}, "async_unpair_sensor", ), - ]: + ): platform.async_register_entity_service(service_name, schema, method) async_add_entities( diff --git a/homeassistant/components/harmony/__init__.py b/homeassistant/components/harmony/__init__.py index e76e5559f9deb81c6e8e428f0d271740a2e6550f..c541aa0e0e3b25b03892e3f4d775692fd2996dc7 100644 --- a/homeassistant/components/harmony/__init__.py +++ b/homeassistant/components/harmony/__init__.py @@ -94,7 +94,7 @@ async def _migrate_old_unique_ids( def _async_import_options_from_data_if_missing(hass: HomeAssistant, entry: ConfigEntry): options = dict(entry.options) modified = 0 - for importable_option in [ATTR_ACTIVITY, ATTR_DELAY_SECS]: + for importable_option in (ATTR_ACTIVITY, ATTR_DELAY_SECS): if importable_option not in entry.options and importable_option in entry.data: options[importable_option] = entry.data[importable_option] modified = 1 diff --git a/homeassistant/components/history_stats/sensor.py b/homeassistant/components/history_stats/sensor.py index 69f42da5e3652a2c8ae7c4971b55e8f481401a75..e8ff9afc4e3cfddf2e82d8bb3c26bbb3ef8229dc 100644 --- a/homeassistant/components/history_stats/sensor.py +++ b/homeassistant/components/history_stats/sensor.py @@ -86,7 +86,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= sensor_type = config.get(CONF_TYPE) name = config.get(CONF_NAME) - for template in [start, end]: + for template in (start, end): if template is not None: template.hass = hass diff --git a/homeassistant/components/homekit/type_cameras.py b/homeassistant/components/homekit/type_cameras.py index 040c4017bb3bd54f8a7516a9091305670e3332d7..077366870e21e482633dae47011238b0562ea6ac 100644 --- a/homeassistant/components/homekit/type_cameras.py +++ b/homeassistant/components/homekit/type_cameras.py @@ -451,7 +451,7 @@ class Camera(HomeAccessory, PyhapCamera): _LOGGER.info("[%s] Stream already stopped", session_id) return True - for shutdown_method in ["close", "kill"]: + for shutdown_method in ("close", "kill"): _LOGGER.info("[%s] %s stream", session_id, shutdown_method) try: await getattr(stream, shutdown_method)() diff --git a/homeassistant/components/hyperion/light.py b/homeassistant/components/hyperion/light.py index 63e90a890684bd7c8555f1e36753b22563cc0a96..e9d23b4077e04f319b3cd96d8aa674e6815d7319 100644 --- a/homeassistant/components/hyperion/light.py +++ b/homeassistant/components/hyperion/light.py @@ -527,10 +527,10 @@ class HyperionLight(HyperionBaseLight): # color, effect), but this is not possible due to: # https://github.com/hyperion-project/hyperion.ng/issues/967 if not bool(self._client.is_on()): - for component in [ + for component in ( const.KEY_COMPONENTID_ALL, const.KEY_COMPONENTID_LEDDEVICE, - ]: + ): if not await self._client.async_send_set_component( **{ const.KEY_COMPONENTSTATE: { diff --git a/homeassistant/components/image_processing/__init__.py b/homeassistant/components/image_processing/__init__.py index 58a6582e33c010140ebbf9bf8c5827047fe3aaa4..d1220a84cdd5778965620ffcf81afdad5bd3dbea 100644 --- a/homeassistant/components/image_processing/__init__.py +++ b/homeassistant/components/image_processing/__init__.py @@ -164,7 +164,7 @@ class ImageProcessingFaceEntity(ImageProcessingEntity): f_co = face[ATTR_CONFIDENCE] if f_co > confidence: confidence = f_co - for attr in [ATTR_NAME, ATTR_MOTION]: + for attr in (ATTR_NAME, ATTR_MOTION): if attr in face: state = face[attr] break diff --git a/homeassistant/components/incomfort/__init__.py b/homeassistant/components/incomfort/__init__.py index cea7244919b18084b8a06f179a7cb215009f6cae..9d14703fa3296618c6734c92f6b0955cbf70a1c8 100644 --- a/homeassistant/components/incomfort/__init__.py +++ b/homeassistant/components/incomfort/__init__.py @@ -53,7 +53,7 @@ async def async_setup(hass, hass_config): for heater in heaters: await heater.update() - for platform in ["water_heater", "binary_sensor", "sensor", "climate"]: + for platform in ("water_heater", "binary_sensor", "sensor", "climate"): hass.async_create_task( async_load_platform(hass, platform, DOMAIN, {}, hass_config) ) diff --git a/homeassistant/components/insteon/climate.py b/homeassistant/components/insteon/climate.py index 7e034311a829360ccb17bdca7a574a72816b5a3c..dbfa3e8b2d9a27cf74c1eef14f4374382971e6c7 100644 --- a/homeassistant/components/insteon/climate.py +++ b/homeassistant/components/insteon/climate.py @@ -224,7 +224,7 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity): """Register INSTEON update events.""" await super().async_added_to_hass() await self._insteon_device.async_read_op_flags() - for group in [ + for group in ( COOLING, HEATING, DEHUMIDIFYING, @@ -236,5 +236,5 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity): HUMIDITY, HUMIDITY_HIGH, HUMIDITY_LOW, - ]: + ): self._insteon_device.groups[group].subscribe(self.async_entity_update) diff --git a/homeassistant/components/iqvia/__init__.py b/homeassistant/components/iqvia/__init__.py index 30a54fa1fd0798d5d5337a4b05d957f44755e060..fa783cc9031e367894c98eacee9befe12c64f4c9 100644 --- a/homeassistant/components/iqvia/__init__.py +++ b/homeassistant/components/iqvia/__init__.py @@ -59,7 +59,7 @@ async def async_setup_entry(hass, entry): raise UpdateFailed from err init_data_update_tasks = [] - for sensor_type, api_coro in [ + for sensor_type, api_coro in ( (TYPE_ALLERGY_FORECAST, client.allergens.extended), (TYPE_ALLERGY_INDEX, client.allergens.current), (TYPE_ALLERGY_OUTLOOK, client.allergens.outlook), @@ -67,7 +67,7 @@ async def async_setup_entry(hass, entry): (TYPE_ASTHMA_INDEX, client.asthma.current), (TYPE_DISEASE_FORECAST, client.disease.extended), (TYPE_DISEASE_INDEX, client.disease.current), - ]: + ): coordinator = coordinators[sensor_type] = DataUpdateCoordinator( hass, LOGGER, diff --git a/homeassistant/components/isy994/__init__.py b/homeassistant/components/isy994/__init__.py index 51c34aeb0a73eae156eeea39092b9a930b9b0936..e3d11efd739408be769da73707afee8fe2b5894d 100644 --- a/homeassistant/components/isy994/__init__.py +++ b/homeassistant/components/isy994/__init__.py @@ -244,11 +244,11 @@ def _async_import_options_from_data_if_missing( ): options = dict(entry.options) modified = False - for importable_option in [ + for importable_option in ( CONF_IGNORE_STRING, CONF_SENSOR_STRING, CONF_RESTORE_LIGHT_STATE, - ]: + ): if importable_option not in entry.options and importable_option in entry.data: options[importable_option] = entry.data[importable_option] modified = True diff --git a/homeassistant/components/konnected/__init__.py b/homeassistant/components/konnected/__init__.py index 4b5890532d11d37ccf6d1ad1c83dd7df4af31b81..32d0f0e20c0bd1989ec965e7dbe18e141c19125e 100644 --- a/homeassistant/components/konnected/__init__.py +++ b/homeassistant/components/konnected/__init__.py @@ -368,7 +368,7 @@ class KonnectedView(HomeAssistantView): zone_data["device_id"] = device_id - for attr in ["state", "temp", "humi", "addr"]: + for attr in ("state", "temp", "humi", "addr"): value = payload.get(attr) handler = HANDLERS.get(attr) if value is not None and handler: diff --git a/homeassistant/components/lifx/light.py b/homeassistant/components/lifx/light.py index 167a1ceee0a9747fc3144dd8656fb06668eff7b8..30c0ffbe8508e4cb1d6039f5e4c0c6796273b20f 100644 --- a/homeassistant/components/lifx/light.py +++ b/homeassistant/components/lifx/light.py @@ -275,12 +275,12 @@ class LIFXManager: for discovery in self.discoveries: discovery.cleanup() - for service in [ + for service in ( SERVICE_LIFX_SET_STATE, SERVICE_EFFECT_STOP, SERVICE_EFFECT_PULSE, SERVICE_EFFECT_COLORLOOP, - ]: + ): self.hass.services.async_remove(LIFX_DOMAIN, service) def register_set_state(self): diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index ef996a3c4bac940b539369fe5ef1a0db86ea6117..552ee8da6d617a2e6a5077ab2952cf470d11ed4a 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -360,7 +360,7 @@ class MqttFan(MqttEntity, FanEntity): if self._feature_preset_mode: self._supported_features |= SUPPORT_PRESET_MODE - for tpl_dict in [self._command_templates, self._value_templates]: + for tpl_dict in (self._command_templates, self._value_templates): for key, tpl in tpl_dict.items(): if tpl is None: tpl_dict[key] = lambda value: value diff --git a/homeassistant/components/mqtt/humidifier.py b/homeassistant/components/mqtt/humidifier.py index 4e7e9ee5879aad85e14ea6500cb9f75719434512..2f76b416184719575245393262a2ee7556822e9d 100644 --- a/homeassistant/components/mqtt/humidifier.py +++ b/homeassistant/components/mqtt/humidifier.py @@ -237,7 +237,7 @@ class MqttHumidifier(MqttEntity, HumidifierEntity): ) self._optimistic_mode = optimistic or self._topic[CONF_MODE_STATE_TOPIC] is None - for tpl_dict in [self._command_templates, self._value_templates]: + for tpl_dict in (self._command_templates, self._value_templates): for key, tpl in tpl_dict.items(): if tpl is None: tpl_dict[key] = lambda value: value diff --git a/homeassistant/components/mvglive/sensor.py b/homeassistant/components/mvglive/sensor.py index 16b061a3346cd70c946413d0f5445febab01a332..953fe4c69a8da3970d6de35b5aa57d5f1e6489ad 100644 --- a/homeassistant/components/mvglive/sensor.py +++ b/homeassistant/components/mvglive/sensor.py @@ -202,7 +202,7 @@ class MVGLiveData: # now select the relevant data _nextdep = {ATTR_ATTRIBUTION: ATTRIBUTION} - for k in ["destination", "linename", "time", "direction", "product"]: + for k in ("destination", "linename", "time", "direction", "product"): _nextdep[k] = _departure.get(k, "") _nextdep["time"] = int(_nextdep["time"]) self.departures.append(_nextdep) diff --git a/homeassistant/components/nam/__init__.py b/homeassistant/components/nam/__init__.py index 97d54fb06690fba760296dee961cb45a701bc9c9..52e506fc4dd6f173d5b673faa909c673f416a420 100644 --- a/homeassistant/components/nam/__init__.py +++ b/homeassistant/components/nam/__init__.py @@ -54,7 +54,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Remove air_quality entities from registry if they exist ent_reg = entity_registry.async_get(hass) - for sensor_type in ["sds", ATTR_SDS011, ATTR_SPS30]: + for sensor_type in ("sds", ATTR_SDS011, ATTR_SPS30): unique_id = f"{coordinator.unique_id}-{sensor_type}" if entity_id := ent_reg.async_get_entity_id( AIR_QUALITY_PLATFORM, DOMAIN, unique_id diff --git a/homeassistant/components/netatmo/config_flow.py b/homeassistant/components/netatmo/config_flow.py index ea44339b99f139df8ea6f4f8fc0234e463720dc8..909255aa38ea011f6602d5cf39bdcc8ebc1bbd78 100644 --- a/homeassistant/components/netatmo/config_flow.py +++ b/homeassistant/components/netatmo/config_flow.py @@ -191,7 +191,7 @@ class NetatmoOptionsFlowHandler(config_entries.OptionsFlow): def fix_coordinates(user_input): """Fix coordinates if they don't comply with the Netatmo API.""" # Ensure coordinates have acceptable length for the Netatmo API - for coordinate in [CONF_LAT_NE, CONF_LAT_SW, CONF_LON_NE, CONF_LON_SW]: + for coordinate in (CONF_LAT_NE, CONF_LAT_SW, CONF_LON_NE, CONF_LON_SW): if len(str(user_input[coordinate]).split(".")[1]) < 7: user_input[coordinate] = user_input[coordinate] + 0.0000001 diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index 035aa711a255545001b35155d8f864e9351414e3..917d04d1b4d097b9f8fa38f3d985733f149a2b1e 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -247,10 +247,10 @@ async def async_setup_entry(hass, entry, async_add_entities): _LOGGER.debug("Adding weather sensors %s", entities) return entities - for data_class_name in [ + for data_class_name in ( WEATHERSTATION_DATA_CLASS_NAME, HOMECOACH_DATA_CLASS_NAME, - ]: + ): await data_handler.register_data_class(data_class_name, data_class_name, None) data_class = data_handler.data.get(data_class_name) diff --git a/homeassistant/components/openuv/__init__.py b/homeassistant/components/openuv/__init__.py index 72bdbbd179add01690c1237e1292b04e9d455777..df63dd91b2ef4a663bdfed2ea1faf206400e14bc 100644 --- a/homeassistant/components/openuv/__init__.py +++ b/homeassistant/components/openuv/__init__.py @@ -92,11 +92,11 @@ async def async_setup_entry(hass, config_entry): await openuv.async_update_protection_data() async_dispatcher_send(hass, TOPIC_UPDATE) - for service, method in [ + for service, method in ( ("update_data", update_data), ("update_uv_index_data", update_uv_index_data), ("update_protection_data", update_protection_data), - ]: + ): hass.services.async_register(DOMAIN, service, method) return True diff --git a/homeassistant/components/persistent_notification/__init__.py b/homeassistant/components/persistent_notification/__init__.py index 071261e7b23876ded15e14c03eff756520f493f9..4a68dd3356f083473bd8de14ff6126a21831ae7e 100644 --- a/homeassistant/components/persistent_notification/__init__.py +++ b/homeassistant/components/persistent_notification/__init__.py @@ -80,11 +80,11 @@ def async_create( """Generate a notification.""" data = { key: value - for key, value in [ + for key, value in ( (ATTR_TITLE, title), (ATTR_MESSAGE, message), (ATTR_NOTIFICATION_ID, notification_id), - ] + ) if value is not None } diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 1da71bda6aa83bf05e52378c54eb7b325cfcec5b..1033c4286ac79bee87cff951012c657d9a0138f4 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -509,13 +509,13 @@ class PlexMediaPlayer(MediaPlayerEntity): def extra_state_attributes(self): """Return the scene state attributes.""" attributes = {} - for attr in [ + for attr in ( "media_content_rating", "media_library_title", "player_source", "media_summary", "username", - ]: + ): value = getattr(self, attr, None) if value: attributes[attr] = value diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index 6a239bc84a1d047df403f6d4acfbd4a617f7f204..13540c092fa42bf6dc1a2ac42943754b88f1d2f3 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -129,13 +129,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: raise UpdateFailed(err) from err controller_init_tasks = [] - for api_category in [ + for api_category in ( DATA_PROGRAMS, DATA_PROVISION_SETTINGS, DATA_RESTRICTIONS_CURRENT, DATA_RESTRICTIONS_UNIVERSAL, DATA_ZONES, - ]: + ): coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][ api_category ] = DataUpdateCoordinator( diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index 68ecd8c8d64714d5217196ef14c867b2734bab4b..8338e4c83053c99ad5b7d0c53a1afcc1a15e0b02 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -123,7 +123,7 @@ async def async_setup_entry( alter_program_schema = {vol.Required(CONF_PROGRAM_ID): cv.positive_int} alter_zone_schema = {vol.Required(CONF_ZONE_ID): cv.positive_int} - for service_name, schema, method in [ + for service_name, schema, method in ( ("disable_program", alter_program_schema, "async_disable_program"), ("disable_zone", alter_zone_schema, "async_disable_zone"), ("enable_program", alter_program_schema, "async_enable_program"), @@ -156,7 +156,7 @@ async def async_setup_entry( ), ("stop_zone", {vol.Required(CONF_ZONE_ID): cv.positive_int}, "async_stop_zone"), ("unpause_watering", {}, "async_unpause_watering"), - ]: + ): platform.async_register_entity_service(service_name, schema, method) controller = hass.data[DOMAIN][DATA_CONTROLLER][entry.entry_id] diff --git a/homeassistant/components/rmvtransport/sensor.py b/homeassistant/components/rmvtransport/sensor.py index d85dae533032ddc9965175b953b442b86a57af8e..9e4e7f3d58810542c480b93bfc2d3d51b8cc201d 100644 --- a/homeassistant/components/rmvtransport/sensor.py +++ b/homeassistant/components/rmvtransport/sensor.py @@ -262,7 +262,7 @@ class RMVDepartureData: elif journey["minutes"] < self._time_offset: continue - for attr in ["direction", "departure_time", "product", "minutes"]: + for attr in ("direction", "departure_time", "product", "minutes"): _nextdep[attr] = journey.get(attr, "") _nextdep["line"] = journey.get("number", "") diff --git a/homeassistant/components/roomba/irobot_base.py b/homeassistant/components/roomba/irobot_base.py index 2f57ef954b68739a9d0f5480afd68693132ca4d9..8cee2a1ce6171eed0b30e7f47d636008955868c6 100644 --- a/homeassistant/components/roomba/irobot_base.py +++ b/homeassistant/components/roomba/irobot_base.py @@ -212,7 +212,7 @@ class IRobotVacuum(IRobotEntity, StateVacuumEntity): pos_x = pos_state.get("point", {}).get("x") pos_y = pos_state.get("point", {}).get("y") theta = pos_state.get("theta") - if all(item is not None for item in [pos_x, pos_y, theta]): + if all(item is not None for item in (pos_x, pos_y, theta)): position = f"({pos_x}, {pos_y}, {theta})" state_attrs[ATTR_POSITION] = position diff --git a/homeassistant/components/simplisafe/__init__.py b/homeassistant/components/simplisafe/__init__.py index b3f246b184704eed383b9860afffad588a414366..baf1bcd7b2af49e823d096fc3a6a9857874340b1 100644 --- a/homeassistant/components/simplisafe/__init__.py +++ b/homeassistant/components/simplisafe/__init__.py @@ -261,7 +261,7 @@ async def async_setup_entry(hass, config_entry): # noqa: C901 LOGGER.error("Error during service call: %s", err) return - for service, method, schema in [ + for service, method, schema in ( ("clear_notifications", clear_notifications, None), ("remove_pin", remove_pin, SERVICE_REMOVE_PIN_SCHEMA), ("set_pin", set_pin, SERVICE_SET_PIN_SCHEMA), @@ -270,7 +270,7 @@ async def async_setup_entry(hass, config_entry): # noqa: C901 set_system_properties, SERVICE_SET_SYSTEM_PROPERTIES_SCHEMA, ), - ]: + ): async_register_admin_service(hass, DOMAIN, service, method, schema=schema) config_entry.async_on_unload(config_entry.add_update_listener(async_reload_entry)) diff --git a/homeassistant/components/solaredge/sensor.py b/homeassistant/components/solaredge/sensor.py index 340b6e0c2c9cbb5ba2ae1455caec19c22a99ee7e..23cfa116599eb9c578dd851f63b1fbfdfa98b8e5 100644 --- a/homeassistant/components/solaredge/sensor.py +++ b/homeassistant/components/solaredge/sensor.py @@ -72,31 +72,31 @@ class SolarEdgeSensorFactory: ], ] = {"site_details": (SolarEdgeDetailsSensor, details)} - for key in [ + for key in ( "lifetime_energy", "energy_this_year", "energy_this_month", "energy_today", "current_power", - ]: + ): self.services[key] = (SolarEdgeOverviewSensor, overview) - for key in ["meters", "sensors", "gateways", "batteries", "inverters"]: + for key in ("meters", "sensors", "gateways", "batteries", "inverters"): self.services[key] = (SolarEdgeInventorySensor, inventory) - for key in ["power_consumption", "solar_power", "grid_power", "storage_power"]: + for key in ("power_consumption", "solar_power", "grid_power", "storage_power"): self.services[key] = (SolarEdgePowerFlowSensor, flow) - for key in ["storage_level"]: + for key in ("storage_level",): self.services[key] = (SolarEdgeStorageLevelSensor, flow) - for key in [ + for key in ( "purchased_power", "production_power", "feedin_power", "consumption_power", "selfconsumption_power", - ]: + ): self.services[key] = (SolarEdgeEnergyDetailsSensor, energy) def create_sensor(self, sensor_type: SolarEdgeSensor) -> SolarEdgeSensor: diff --git a/homeassistant/components/sonos/__init__.py b/homeassistant/components/sonos/__init__.py index cf4592ff4b977bebf1c225852bb656f1e6e17836..ec26373c44e0438cd54cf40c683343af02fa5b01 100644 --- a/homeassistant/components/sonos/__init__.py +++ b/homeassistant/components/sonos/__init__.py @@ -190,10 +190,10 @@ class SonosDiscoveryManager: _LOGGER.debug("Adding new speaker: %s", speaker_info) speaker = SonosSpeaker(self.hass, soco, speaker_info) self.data.discovered[soco.uid] = speaker - for coordinator, coord_dict in [ + for coordinator, coord_dict in ( (SonosAlarms, self.data.alarms), (SonosFavorites, self.data.favorites), - ]: + ): if soco.household_id not in coord_dict: new_coordinator = coordinator(self.hass, soco.household_id) new_coordinator.setup(soco) diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index 4231bcc46af9f3530714491c1fe6bd058a0ee023..c3f07e5269d2ad756970475ef925ac076c0748b8 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -332,7 +332,7 @@ async def async_setup(hass, config): attribute_templ = data.get(attribute) if attribute_templ: if any( - isinstance(attribute_templ, vtype) for vtype in [float, int, str] + isinstance(attribute_templ, vtype) for vtype in (float, int, str) ): data[attribute] = attribute_templ else: @@ -352,7 +352,7 @@ async def async_setup(hass, config): msgtype = service.service kwargs = dict(service.data) - for attribute in [ + for attribute in ( ATTR_MESSAGE, ATTR_TITLE, ATTR_URL, @@ -360,7 +360,7 @@ async def async_setup(hass, config): ATTR_CAPTION, ATTR_LONGITUDE, ATTR_LATITUDE, - ]: + ): _render_template_attr(kwargs, attribute) _LOGGER.debug("New telegram message %s: %s", msgtype, kwargs) diff --git a/homeassistant/components/toon/binary_sensor.py b/homeassistant/components/toon/binary_sensor.py index de756225d5746694a46394a27660099522ecd4b1..9983dc4bee621fa15588c75100da914549fc6323 100644 --- a/homeassistant/components/toon/binary_sensor.py +++ b/homeassistant/components/toon/binary_sensor.py @@ -42,14 +42,14 @@ async def async_setup_entry( sensors.extend( [ ToonBoilerBinarySensor(coordinator, key=key) - for key in [ + for key in ( "thermostat_info_ot_communication_error_0", "thermostat_info_error_found_255", "thermostat_info_burner_info_None", "thermostat_info_burner_info_1", "thermostat_info_burner_info_2", "thermostat_info_burner_info_3", - ] + ) ] ) diff --git a/homeassistant/components/toon/sensor.py b/homeassistant/components/toon/sensor.py index 90f74ceae873194f7c38d7597be04fda04ec067c..b16672674af601399512030b398244ee4ff9f55b 100644 --- a/homeassistant/components/toon/sensor.py +++ b/homeassistant/components/toon/sensor.py @@ -89,7 +89,7 @@ async def async_setup_entry( sensors.extend( [ ToonSolarDeviceSensor(coordinator, key=key) - for key in [ + for key in ( "solar_value", "solar_maximum", "solar_produced", @@ -98,7 +98,7 @@ async def async_setup_entry( "power_usage_day_from_grid_usage", "power_usage_day_to_grid_usage", "power_usage_current_covered_by_solar", - ] + ) ] ) diff --git a/homeassistant/components/tplink/common.py b/homeassistant/components/tplink/common.py index 3096281776a3b140dd130123aa93ed62bb2cef6c..84ce7edadb63a5a3720cc4d8d37d1871c1c42efd 100644 --- a/homeassistant/components/tplink/common.py +++ b/homeassistant/components/tplink/common.py @@ -136,7 +136,7 @@ def get_static_devices(config_data) -> SmartDevices: lights = [] switches = [] - for type_ in [CONF_LIGHT, CONF_SWITCH, CONF_STRIP, CONF_DIMMER]: + for type_ in (CONF_LIGHT, CONF_SWITCH, CONF_STRIP, CONF_DIMMER): for entry in config_data[type_]: host = entry["host"] try: diff --git a/homeassistant/components/uk_transport/sensor.py b/homeassistant/components/uk_transport/sensor.py index 41549c202b3220b02db7a8620d9242034f3098fe..c66db9bb24bd6a0984dde8a0ea2fa4740c308979 100644 --- a/homeassistant/components/uk_transport/sensor.py +++ b/homeassistant/components/uk_transport/sensor.py @@ -183,12 +183,12 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor): """Return other details about the sensor state.""" attrs = {} if self._data is not None: - for key in [ + for key in ( ATTR_ATCOCODE, ATTR_LOCALITY, ATTR_STOP_NAME, ATTR_REQUEST_TIME, - ]: + ): attrs[key] = self._data.get(key) attrs[ATTR_NEXT_BUSES] = self._next_buses return attrs diff --git a/homeassistant/components/universal/media_player.py b/homeassistant/components/universal/media_player.py index 17dcde5538124f205e2535eba51ec34ab74ade59..a2981852dc173bff524973ba8164f0ef42446fa2 100644 --- a/homeassistant/components/universal/media_player.py +++ b/homeassistant/components/universal/media_player.py @@ -472,7 +472,7 @@ class UniversalMediaPlayer(MediaPlayerEntity): if SERVICE_MEDIA_PREVIOUS_TRACK in self._cmds: flags |= SUPPORT_PREVIOUS_TRACK - if any(cmd in self._cmds for cmd in [SERVICE_VOLUME_UP, SERVICE_VOLUME_DOWN]): + if any(cmd in self._cmds for cmd in (SERVICE_VOLUME_UP, SERVICE_VOLUME_DOWN)): flags |= SUPPORT_VOLUME_STEP if SERVICE_VOLUME_SET in self._cmds: flags |= SUPPORT_VOLUME_SET diff --git a/homeassistant/components/waze_travel_time/sensor.py b/homeassistant/components/waze_travel_time/sensor.py index 4fb56700f59054b0fe7b5f74e07e84279fc8fc73..b0168bbb44e72ed9e7901628aea8916305c2bf5b 100644 --- a/homeassistant/components/waze_travel_time/sensor.py +++ b/homeassistant/components/waze_travel_time/sensor.py @@ -127,7 +127,7 @@ async def async_setup_entry( if not config_entry.options: new_data = config_entry.data.copy() options = {} - for key in [ + for key in ( CONF_INCL_FILTER, CONF_EXCL_FILTER, CONF_REALTIME, @@ -136,7 +136,7 @@ async def async_setup_entry( CONF_AVOID_SUBSCRIPTION_ROADS, CONF_AVOID_FERRIES, CONF_UNITS, - ]: + ): if key in new_data: options[key] = new_data.pop(key) elif key in defaults: diff --git a/homeassistant/components/wsdot/sensor.py b/homeassistant/components/wsdot/sensor.py index 8b45326cdbd37599fcbc2a61272d6b8b2bd47ab8..153d496a7d6a34487749cdcde175ce959bcf7040 100644 --- a/homeassistant/components/wsdot/sensor.py +++ b/homeassistant/components/wsdot/sensor.py @@ -122,12 +122,12 @@ class WashingtonStateTravelTimeSensor(WashingtonStateTransportSensor): """Return other details about the sensor state.""" if self._data is not None: attrs = {ATTR_ATTRIBUTION: ATTRIBUTION} - for key in [ + for key in ( ATTR_AVG_TIME, ATTR_NAME, ATTR_DESCRIPTION, ATTR_TRAVEL_TIME_ID, - ]: + ): attrs[key] = self._data.get(key) attrs[ATTR_TIME_UPDATED] = _parse_wsdot_timestamp( self._data.get(ATTR_TIME_UPDATED) diff --git a/homeassistant/components/xiaomi_aqara/switch.py b/homeassistant/components/xiaomi_aqara/switch.py index 8b16b6491c7ace37e998cf342f3fbc4166561f68..c17cf080a608c3c8116bfb2f5874a707f42f8ea1 100644 --- a/homeassistant/components/xiaomi_aqara/switch.py +++ b/homeassistant/components/xiaomi_aqara/switch.py @@ -194,7 +194,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity): if not self._in_use: self._load_power = 0 - for key in [POWER_CONSUMED, ENERGY_CONSUMED]: + for key in (POWER_CONSUMED, ENERGY_CONSUMED): if key in data: self._power_consumed = round(float(data[key]), 2) break diff --git a/homeassistant/components/xiaomi_miio/switch.py b/homeassistant/components/xiaomi_miio/switch.py index 28c4f79ef289e0aabd9d8c8ddc104c7634467e15..52682a05f08e5171f960c5334d6fbd9cb83d65cb 100644 --- a/homeassistant/components/xiaomi_miio/switch.py +++ b/homeassistant/components/xiaomi_miio/switch.py @@ -181,7 +181,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # The device has two switchable channels (mains and a USB port). # A switch device per channel will be created. - for channel_usb in [True, False]: + for channel_usb in (True, False): if channel_usb: unique_id_ch = f"{unique_id}-USB" else: diff --git a/homeassistant/components/zamg/sensor.py b/homeassistant/components/zamg/sensor.py index b35f675440e7e31b82b67f627ebada1c1822cd15..a6018de831efb0a4fb816e638f6a9b4e649b04de 100644 --- a/homeassistant/components/zamg/sensor.py +++ b/homeassistant/components/zamg/sensor.py @@ -283,7 +283,7 @@ def _get_zamg_stations(): try: stations[row["synnr"]] = tuple( float(row[coord].replace(",", ".")) - for coord in ["breite_dezi", "länge_dezi"] + for coord in ("breite_dezi", "länge_dezi") ) except KeyError: _LOGGER.error("ZAMG schema changed again, cannot autodetect station") diff --git a/homeassistant/config.py b/homeassistant/config.py index 5a8f71bda77e1c6e22fe6785ef82c3c17349a714..9e128fc6d23b78e7210153a40d62bd6bc290eed9 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -511,7 +511,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non if any( k in config - for k in [ + for k in ( CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, @@ -520,7 +520,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non CONF_UNIT_SYSTEM, CONF_EXTERNAL_URL, CONF_INTERNAL_URL, - ] + ) ): hac.config_source = SOURCE_YAML diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 6108b4b8f65f28e88dece1178fa69a54425000e2..addd2ae046d26dfbd9b3a1d813e5c1b3e7a4e1f7 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -599,7 +599,7 @@ class _ScriptRun: """Fire an event.""" self._step_log(self._action.get(CONF_ALIAS, self._action[CONF_EVENT])) event_data = {} - for conf in [CONF_EVENT_DATA, CONF_EVENT_DATA_TEMPLATE]: + for conf in (CONF_EVENT_DATA, CONF_EVENT_DATA_TEMPLATE): if conf not in self._action: continue diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index ff037998f348af79f99ce55fafa842fa790f4ddc..ed07c6bda63265554e805c0e3461a26c768ae4d3 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -227,7 +227,7 @@ def async_prepare_call_from_config( service_data = {} - for conf in [CONF_SERVICE_DATA, CONF_SERVICE_DATA_TEMPLATE]: + for conf in (CONF_SERVICE_DATA, CONF_SERVICE_DATA_TEMPLATE): if conf not in config: continue try: diff --git a/homeassistant/util/unit_system.py b/homeassistant/util/unit_system.py index e49c1895180f200e29d8934b7d9231f7be9edf57..59dbf784152ffc9ac9034427dba00ba7191a947d 100644 --- a/homeassistant/util/unit_system.py +++ b/homeassistant/util/unit_system.py @@ -91,13 +91,13 @@ class UnitSystem: """Initialize the unit system object.""" errors: str = ", ".join( UNIT_NOT_RECOGNIZED_TEMPLATE.format(unit, unit_type) - for unit, unit_type in [ + for unit, unit_type in ( (temperature, TEMPERATURE), (length, LENGTH), (volume, VOLUME), (mass, MASS), (pressure, PRESSURE), - ] + ) if not is_valid_unit(unit, unit_type) ) diff --git a/pyproject.toml b/pyproject.toml index ee6e0015a84287788ec4f60669844c4a0eed6f1d..8ca6a06868fa67cdb41df0d2d3456a7f333c7084 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ ignore = [ jobs = 2 init-hook='from pylint.config.find_default_config_files import find_default_config_files; from pathlib import Path; import sys; sys.path.append(str(Path(Path(list(find_default_config_files())[0]).parent, "pylint/plugins")))' load-plugins = [ + "pylint.extensions.code_style", "pylint.extensions.typing", "pylint_strict_informational", "hass_constructor", @@ -68,6 +69,9 @@ good-names = [ # inconsistent-return-statements - doesn't handle raise # too-many-ancestors - it's too strict. # wrong-import-order - isort guards this +# --- +# Enable once current issues are fixed: +# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension) disable = [ "format", "abstract-class-little-used", @@ -90,6 +94,7 @@ disable = [ "too-many-boolean-expressions", "unused-argument", "wrong-import-order", + "consider-using-namedtuple-or-dataclass", ] enable = [ #"useless-suppression", # temporarily every now and then to clean them up