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

+4 -4
View File
@@ -79,20 +79,20 @@ class Integration:
"""Load manifest."""
manifest_path = self.path / "manifest.json"
if not manifest_path.is_file():
self.add_error("model", "Manifest file {} not found".format(manifest_path))
self.add_error("model", f"Manifest file {manifest_path} not found")
return
try:
manifest = json.loads(manifest_path.read_text())
except ValueError as err:
self.add_error("model", "Manifest contains invalid JSON: {}".format(err))
self.add_error("model", f"Manifest contains invalid JSON: {err}")
return
self.manifest = manifest
def import_pkg(self, platform=None):
"""Import the Python file."""
pkg = "homeassistant.components.{}".format(self.domain)
pkg = f"homeassistant.components.{self.domain}"
if platform is not None:
pkg += ".{}".format(platform)
pkg += f".{platform}"
return importlib.import_module(pkg)