mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Use literal string interpolation in core (f-strings) (#26166)
This commit is contained in:
committed by
Paulus Schoutsen
parent
1efa29d6ff
commit
decf13b948
@@ -133,7 +133,7 @@ class EntityPlatform:
|
||||
current_platform.set(self)
|
||||
logger = self.logger
|
||||
hass = self.hass
|
||||
full_name = "{}.{}".format(self.domain, self.platform_name)
|
||||
full_name = f"{self.domain}.{self.platform_name}"
|
||||
|
||||
logger.info("Setting up %s", full_name)
|
||||
warn_task = hass.loop.call_later(
|
||||
@@ -357,7 +357,7 @@ class EntityPlatform:
|
||||
"Not adding entity %s because it's disabled",
|
||||
entry.name
|
||||
or entity.name
|
||||
or '"{} {}"'.format(self.platform_name, entity.unique_id),
|
||||
or f'"{self.platform_name} {entity.unique_id}"',
|
||||
)
|
||||
return
|
||||
|
||||
@@ -386,12 +386,12 @@ class EntityPlatform:
|
||||
|
||||
# Make sure it is valid in case an entity set the value themselves
|
||||
if not valid_entity_id(entity.entity_id):
|
||||
raise HomeAssistantError("Invalid entity id: {}".format(entity.entity_id))
|
||||
raise HomeAssistantError(f"Invalid entity id: {entity.entity_id}")
|
||||
if (
|
||||
entity.entity_id in self.entities
|
||||
or entity.entity_id in self.hass.states.async_entity_ids(self.domain)
|
||||
):
|
||||
msg = "Entity id already exists: {}".format(entity.entity_id)
|
||||
msg = f"Entity id already exists: {entity.entity_id}"
|
||||
if entity.unique_id is not None:
|
||||
msg += ". Platform {} does not generate unique IDs".format(
|
||||
self.platform_name
|
||||
|
||||
Reference in New Issue
Block a user