Use literal string interpolation in core (f-strings) (#26166)

This commit is contained in:
Franck Nijhof 2019-08-23 18:53:33 +02:00 committed by Paulus Schoutsen
parent 1efa29d6ff
commit decf13b948
67 changed files with 180 additions and 246 deletions

View file

@ -25,7 +25,7 @@ class TemplateError(HomeAssistantError):
def __init__(self, exception: jinja2.TemplateError) -> None:
"""Init the error."""
super().__init__("{}: {}".format(exception.__class__.__name__, exception))
super().__init__(f"{exception.__class__.__name__}: {exception}")
class PlatformNotReady(HomeAssistantError):
@ -73,10 +73,10 @@ class ServiceNotFound(HomeAssistantError):
def __init__(self, domain: str, service: str) -> None:
"""Initialize error."""
super().__init__(self, "Service {}.{} not found".format(domain, service))
super().__init__(self, f"Service {domain}.{service} not found")
self.domain = domain
self.service = service
def __str__(self) -> str:
"""Return string representation."""
return "Unable to find service {}/{}".format(self.domain, self.service)
return f"Unable to find service {self.domain}/{self.service}"