diff --git a/subiquity/common/serialize.py b/subiquity/common/serialize.py index 9b1a76fb..5036fcde 100644 --- a/subiquity/common/serialize.py +++ b/subiquity/common/serialize.py @@ -164,7 +164,7 @@ class Serializer: serializer = self.type_serializers[annotation] except KeyError: raise Exception( - "do not know how to handle %s at %s", annotation, path) + f"do not know how to handle {annotation} at {path}") else: return serializer(annotation, value, metadata, path) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 94937182..ee0189cb 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -1417,7 +1417,7 @@ class FilesystemModel(object): volume.flag == 'bios_grub' and fstype == 'fat32')): raise Exception("{} is not available".format(volume)) if volume._fs is not None: - raise Exception("%s is already formatted", volume) + raise Exception(f"{volume} is already formatted") fs = Filesystem( m=self, volume=volume, fstype=fstype, preserve=preserve) self._actions.append(fs) @@ -1430,7 +1430,7 @@ class FilesystemModel(object): def add_mount(self, fs, path): if fs._mount is not None: - raise Exception("%s is already mounted", fs) + raise Exception(f"{fs} is already mounted") m = Mount(m=self, device=fs, path=path) self._actions.append(m) return m diff --git a/subiquity/server/controllers/refresh.py b/subiquity/server/controllers/refresh.py index 75bd9eee..4267ed0d 100644 --- a/subiquity/server/controllers/refresh.py +++ b/subiquity/server/controllers/refresh.py @@ -100,7 +100,7 @@ class RefreshController(SubiquityController): while True: change = await self.get_progress(change_id) if change['status'] not in ['Do', 'Doing', 'Done']: - raise Exception("update failed: %s", change['status']) + raise Exception(f"update failed: {change['status']}") await asyncio.sleep(0.1) @with_context() diff --git a/subiquity/ui/mount.py b/subiquity/ui/mount.py index 6862a1c4..214ab968 100644 --- a/subiquity/ui/mount.py +++ b/subiquity/ui/mount.py @@ -129,7 +129,7 @@ class MountSelector(WidgetWrap): self._selector.value = OTHER self._showhide_other(True) if not val.startswith('/'): - raise ValueError("%s does not start with /", val) + raise ValueError(f"{val} does not start with /") self._other.value = val[1:] diff --git a/subiquitycore/ui/selector.py b/subiquitycore/ui/selector.py index e7b9f10d..8ec5965f 100644 --- a/subiquitycore/ui/selector.py +++ b/subiquitycore/ui/selector.py @@ -125,7 +125,7 @@ class Option: self.enabled = True self.value = val else: - raise SelectorError("invalid option %r", val) + raise SelectorError(f"invalid option {val!r}") elif len(val) == 1: self.label = val[0] self.enabled = True diff --git a/subiquitycore/ui/width.py b/subiquitycore/ui/width.py index eb4cbcdc..7e92c926 100644 --- a/subiquitycore/ui/width.py +++ b/subiquitycore/ui/width.py @@ -57,4 +57,4 @@ def widget_width(w): r += widget_width(w1) r += (len(w.contents) - 1) * w.dividechars return r - raise Exception("don't know how to find width of %r", w) + raise Exception(f"don't know how to find width of {w!r}")