Use f-strings in integrations starting with "H" - "L" (#32265)
* Use f-strings in integrations starting with "H" * Use f-strings in integrations starting with "I" * Use f-strings in integrations starting with "J" * Use f-strings in integrations starting with "K" * Use f-strings in integrations starting with "L" * Fix lint error * Use join instead of f-string in homekit_controller * Use local variables with f-strings * Fix lint error * Escape the characters in f-string * Sort imports with isort in homeworks light * Fix pylint error * Fix broken tests * Fix broken tests v2
This commit is contained in:
1 parent
7714160f4c
commit
157f972d72
77 files changed
+158
-246
No files matched your search
@@ -23,7 +23,6 @@ from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceC
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DOMAIN = "input_select"
|
||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||
|
||||
CONF_INITIAL = "initial"
|
||||
CONF_OPTIONS = "options"
|
||||
@@ -58,9 +57,7 @@ def _cv_input_select(cfg):
|
||||
initial = cfg.get(CONF_INITIAL)
|
||||
if initial is not None and initial not in options:
|
||||
raise vol.Invalid(
|
||||
'initial state "{}" is not part of the options: {}'.format(
|
||||
initial, ",".join(options)
|
||||
)
|
||||
f"initial state {initial} is not part of the options: {','.join(options)}"
|
||||
)
|
||||
return cfg
|
||||
|
||||
@@ -201,7 +198,7 @@ class InputSelect(RestoreEntity):
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputSelect":
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_select = cls(config)
|
||||
input_select.entity_id = ENTITY_ID_FORMAT.format(config[CONF_ID])
|
||||
input_select.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
input_select.editable = False
|
||||
return input_select
|
||||
|
||||
|
||||
Reference in new issue
Block a user