[elbe-devel] [PATCH v3 21/75] validate: use f-strings

Daniel Braunwarth daniel at braunwarth.dev
Sun Nov 6 22:12:00 CET 2022


Signed-off-by: Daniel Braunwarth <daniel at braunwarth.dev>
---
 elbepack/commands/validate.py | 2 +-
 elbepack/validate.py          | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/validate.py b/elbepack/commands/validate.py
index 6a093033e..0dbe4eb0d 100644
--- a/elbepack/commands/validate.py
+++ b/elbepack/commands/validate.py
@@ -24,7 +24,7 @@ def run_command(argv):
         sys.exit(20)
 
     if not os.path.exists(args[0]):
-        print("%s - file not found" % args[0])
+        print(f"{args[0]} - file not found")
         oparser.print_help()
         sys.exit(20)
 
diff --git a/elbepack/validate.py b/elbepack/validate.py
index 366432c7e..93f4ea2fb 100644
--- a/elbepack/validate.py
+++ b/elbepack/validate.py
@@ -18,7 +18,7 @@ def error_log_to_strings(error_log):
     uses_norecommend = False
 
     for err in error_log:
-        errors.append("%s:%d error %s" % (err.filename, err.line, err.message))
+        errors.append(f"{err.filename}:{err.line} error {err.message}")
         if "http://www.w3.org/2003/XInclude" in err.message:
             uses_xinclude = True
         if "norecommend" in err.message:
@@ -36,8 +36,8 @@ def error_log_to_strings(error_log):
 
 def validate_xml(fname):
     if os.path.getsize(fname) > (1 << 30):
-        return ["%s is greater than 1 GiB. "
-                "Elbe does not support files of this size." % fname]
+        return [f"{fname} is greater than 1 GiB. "
+                "Elbe does not support files of this size."]
 
     schema_file = "https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
     parser = XMLParser(huge_tree=True)
-- 
2.38.1



More information about the elbe-devel mailing list