diff --git a/homeassistant/components/bayesian/binary_sensor.py b/homeassistant/components/bayesian/binary_sensor.py index 6d203c344f2..74e3db34b68 100644 --- a/homeassistant/components/bayesian/binary_sensor.py +++ b/homeassistant/components/bayesian/binary_sensor.py @@ -131,7 +131,10 @@ def _no_overlapping(configs: list[dict]) -> list[dict]: for i, tup in enumerate(intervals): if len(intervals) > i + 1 and tup.below > intervals[i + 1].above: raise vol.Invalid( - f"Ranges for bayesian numeric state entities must not overlap, but {ent_id} has overlapping ranges, above:{tup.above}, below:{tup.below} overlaps with above:{intervals[i+1].above}, below:{intervals[i+1].below}." + "Ranges for bayesian numeric state entities must not overlap, " + f"but {ent_id} has overlapping ranges, above:{tup.above}, " + f"below:{tup.below} overlaps with above:{intervals[i + 1].above}, " + f"below:{intervals[i + 1].below}." ) return configs @@ -206,7 +209,10 @@ async def async_setup_platform( broken_observations: list[dict[str, Any]] = [] for observation in observations: if CONF_P_GIVEN_F not in observation: - text: str = f"{name}/{observation.get(CONF_ENTITY_ID,'')}{observation.get(CONF_VALUE_TEMPLATE,'')}" + text = ( + f"{name}/{observation.get(CONF_ENTITY_ID, '')}" + f"{observation.get(CONF_VALUE_TEMPLATE, '')}" + ) raise_no_prob_given_false(hass, text) _LOGGER.error("Missing prob_given_false YAML entry for %s", text) broken_observations.append(observation) diff --git a/homeassistant/components/frontier_silicon/browse_media.py b/homeassistant/components/frontier_silicon/browse_media.py index 0b51cb767c7..9bad880a9b3 100644 --- a/homeassistant/components/frontier_silicon/browse_media.py +++ b/homeassistant/components/frontier_silicon/browse_media.py @@ -38,7 +38,9 @@ def _item_preset_payload(preset: Preset, player_mode: str) -> BrowseMedia: media_content_type=MediaType.CHANNEL, # We add 1 to the preset key to keep it in sync with the numbering shown # on the interface of the device - media_content_id=f"{player_mode}/{MEDIA_CONTENT_ID_PRESET}/{int(preset.key)+1}", + media_content_id=( + f"{player_mode}/{MEDIA_CONTENT_ID_PRESET}/{int(preset.key) + 1}" + ), can_play=True, can_expand=False, ) diff --git a/homeassistant/components/ista_ecotrend/sensor.py b/homeassistant/components/ista_ecotrend/sensor.py index eb06fabe373..e96ac103741 100644 --- a/homeassistant/components/ista_ecotrend/sensor.py +++ b/homeassistant/components/ista_ecotrend/sensor.py @@ -184,12 +184,12 @@ class IstaSensor(CoordinatorEntity[IstaCoordinator], SensorEntity): self.consumption_unit = consumption_unit self.entity_description = entity_description self._attr_unique_id = f"{consumption_unit}_{entity_description.key}" + address = coordinator.details[consumption_unit]["address"] self._attr_device_info = DeviceInfo( entry_type=DeviceEntryType.SERVICE, manufacturer="ista SE", model="ista EcoTrend", - name=f"{coordinator.details[consumption_unit]["address"]["street"]} " - f"{coordinator.details[consumption_unit]["address"]["houseNumber"]}".strip(), + name=f"{address['street']} {address['houseNumber']}".strip(), configuration_url="https://ecotrend.ista.de/", identifiers={(DOMAIN, consumption_unit)}, ) diff --git a/homeassistant/components/mqtt/discovery.py b/homeassistant/components/mqtt/discovery.py index a5ddb3ef4e6..a5af8430629 100644 --- a/homeassistant/components/mqtt/discovery.py +++ b/homeassistant/components/mqtt/discovery.py @@ -138,7 +138,10 @@ def get_origin_log_string( support_url_log = "" if include_url and (support_url := get_origin_support_url(discovery_payload)): support_url_log = f", support URL: {support_url}" - return f" from external application {origin_info["name"]}{sw_version_log}{support_url_log}" + return ( + " from external application " + f"{origin_info['name']}{sw_version_log}{support_url_log}" + ) @callback diff --git a/homeassistant/components/picnic/coordinator.py b/homeassistant/components/picnic/coordinator.py index c367d5ec548..b3979580990 100644 --- a/homeassistant/components/picnic/coordinator.py +++ b/homeassistant/components/picnic/coordinator.py @@ -79,7 +79,10 @@ class PicnicUpdateCoordinator(DataUpdateCoordinator): """Get the address that identifies the Picnic service.""" if self._user_address is None: address = self.picnic_api_client.get_user()["address"] - self._user_address = f'{address["street"]} {address["house_number"]}{address["house_number_ext"]}' + self._user_address = ( + f"{address['street']} " + f"{address['house_number']}{address['house_number_ext']}" + ) return self._user_address diff --git a/homeassistant/components/sonarr/sensor.py b/homeassistant/components/sonarr/sensor.py index bdb647de39c..f25c885ed84 100644 --- a/homeassistant/components/sonarr/sensor.py +++ b/homeassistant/components/sonarr/sensor.py @@ -67,7 +67,7 @@ def get_queue_attr(queue: SonarrQueue) -> dict[str, str]: remaining = 1 if item.size == 0 else item.sizeleft / item.size remaining_pct = 100 * (1 - remaining) identifier = ( - f"S{item.episode.seasonNumber:02d}E{item.episode. episodeNumber:02d}" + f"S{item.episode.seasonNumber:02d}E{item.episode.episodeNumber:02d}" ) attrs[f"{item.series.title} {identifier}"] = f"{remaining_pct:.2f}%" return attrs @@ -120,7 +120,8 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { value_fn=len, attributes_fn=lambda data: { i.title: ( - f"{getattr(i.statistics,'episodeFileCount', 0)}/{getattr(i.statistics, 'episodeCount', 0)} Episodes" + f"{getattr(i.statistics, 'episodeFileCount', 0)}/" + f"{getattr(i.statistics, 'episodeCount', 0)} Episodes" ) for i in data }, diff --git a/homeassistant/components/stream/hls.py b/homeassistant/components/stream/hls.py index 16694822b01..32845840f38 100644 --- a/homeassistant/components/stream/hls.py +++ b/homeassistant/components/stream/hls.py @@ -188,9 +188,13 @@ class HlsPlaylistView(StreamView): if track.stream_settings.ll_hls: playlist.extend( [ - f"#EXT-X-PART-INF:PART-TARGET={track.stream_settings.part_target_duration:.3f}", - f"#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,PART-HOLD-BACK={2*track.stream_settings.part_target_duration:.3f}", - f"#EXT-X-START:TIME-OFFSET=-{EXT_X_START_LL_HLS*track.stream_settings.part_target_duration:.3f},PRECISE=YES", + "#EXT-X-PART-INF:PART-TARGET=" + f"{track.stream_settings.part_target_duration:.3f}", + "#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,PART-HOLD-BACK=" + f"{2 * track.stream_settings.part_target_duration:.3f}", + "#EXT-X-START:TIME-OFFSET=-" + f"{EXT_X_START_LL_HLS * track.stream_settings.part_target_duration:.3f}" + ",PRECISE=YES", ] ) else: @@ -203,7 +207,9 @@ class HlsPlaylistView(StreamView): # which seems to take precedence for setting target delay. Yet it also # doesn't seem to hurt, so we can stick with it for now. playlist.append( - f"#EXT-X-START:TIME-OFFSET=-{EXT_X_START_NON_LL_HLS*track.target_duration:.3f},PRECISE=YES" + "#EXT-X-START:TIME-OFFSET=-" + f"{EXT_X_START_NON_LL_HLS * track.target_duration:.3f}" + ",PRECISE=YES" ) last_stream_id = first_segment.stream_id diff --git a/homeassistant/components/vicare/__init__.py b/homeassistant/components/vicare/__init__.py index 9c331f0e9ec..12d8ba520f1 100644 --- a/homeassistant/components/vicare/__init__.py +++ b/homeassistant/components/vicare/__init__.py @@ -146,7 +146,8 @@ async def async_migrate_devices_and_entities( # to `-heating-` if entity_entry.domain == DOMAIN_CLIMATE: unique_id_parts[len(unique_id_parts) - 1] = ( - f"{entity_entry.translation_key}-{unique_id_parts[len(unique_id_parts)-1]}" + f"{entity_entry.translation_key}-" + f"{unique_id_parts[len(unique_id_parts) - 1]}" ) entity_new_unique_id = "-".join(unique_id_parts) diff --git a/homeassistant/components/vicare/entity.py b/homeassistant/components/vicare/entity.py index 2d858185b9f..11955a94b94 100644 --- a/homeassistant/components/vicare/entity.py +++ b/homeassistant/components/vicare/entity.py @@ -29,7 +29,11 @@ class ViCareEntity(Entity): gateway_serial = device_config.getConfig().serial device_id = device_config.getId() - identifier = f"{gateway_serial}_{device_serial.replace("zigbee-", "zigbee_") if device_serial is not None else device_id}" + identifier = ( + f"{gateway_serial}_{device_serial.replace('zigbee-', 'zigbee_')}" + if device_serial is not None + else f"{gateway_serial}_{device_id}" + ) self._api: PyViCareDevice | PyViCareHeatingDeviceComponent = ( component if component else device