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

This commit is contained in:
Franck Nijhof authored and Paulus Schoutsen committed 2019-08-23 09:53:33 -07:00
1 parent 1efa29d6ff
commit decf13b948
67 files changed
+180 -246

No files matched your search

+3 -3
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}"