[elbe-devel] [PATCH 34/75] aptpkgutils: use f-strings

Daniel Braunwarth daniel at braunwarth.dev
Wed Nov 2 20:01:44 CET 2022


Signed-off-by: Daniel Braunwarth <daniel at braunwarth.dev>
---
 elbepack/aptpkgutils.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 181ccb1e0..e21f82cab 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -91,7 +91,7 @@ def pkgstate(pkg):
 def pkgorigin(pkg):
     if pkg.installed:
         o = pkg.installed.origins[0]
-        origin = "%s %s %s" % (o.site, o.archive, o.component)
+        origin = f"{o.site} {o.archive} {o.component}"
     else:
         origin = None
 
@@ -145,8 +145,9 @@ def fetch_binary(version, destdir='', progress=None):
     acq.run()
 
     if acqfile.status != acqfile.STAT_DONE:
-        raise FetchError("The item %r could not be fetched: %s" %
-                         (acqfile.destfile, acqfile.error_text))
+        raise FetchError(
+            f"The item {acqfile.destfile} could not be fetched: "
+            f"{acqfile.error_text}")
 
     return os.path.abspath(destfile)
 
@@ -178,8 +179,8 @@ class PackageBase:
         self.architecture = architecture
 
     def __repr__(self):
-        return "<APTPackage %s-%s state: %s>" % (
-            self.name, self.installed_version, statestring[self.state])
+        return (f"<APTPackage {self.name}-{self.installed_version} state: "
+                f"{statestring[self.state]}>")
 
     def __eq__(self, other):
         vereq = (self.installed_version == other.installed_version)
-- 
2.38.1



More information about the elbe-devel mailing list