use more f-strings
Hanno Böck

Hanno Böck commited on 2022-01-29 17:55:36
Zeige 1 geänderte Dateien mit 7 Einfügungen und 8 Löschungen.

... ...
@@ -45,19 +45,18 @@ def vulnprint(appname, version, safeversion, vuln, vfilename, subdir,
45 45
               xml):
46 46
     appdir = '/'.join(os.path.abspath(vfilename).split('/')[:-1 - subdir])
47 47
     if not xml:
48
-        print("%(appname)s %(version)s (%(safeversion)s) %(vuln)s "
49
-              "%(appdir)s" % vars())
48
+        print(f"{appname} {version} ({safeversion}) {vuln} {appdir}")
50 49
     else:
51 50
         state = 'vulnerable'
52 51
         if safeversion == 'ok':
53 52
             state = 'ok'
54
-        print('  <app state="%s">' % state)
55
-        print('    <appname>%s</appname>' % escape(appname))
56
-        print('    <version>%s</version>' % escape(version))
57
-        print('    <directory>%s</directory>' % escape(appdir))
53
+        print(f'  <app state="{state}">')
54
+        print(f'    <appname>{escape(appname)}</appname>')
55
+        print(f'    <version>{escape(version)}</version>')
56
+        print(f'    <directory>{escape(appdir)}</directory>')
58 57
         if state == 'vulnerable':
59
-            print('    <safeversion>%s</safeversion>' % escape(safeversion))
60
-            print('    <vulninfo>%s</vulninfo>' % escape(vuln))
58
+            print(f'    <safeversion>{escape(safeversion)}</safeversion>')
59
+            print(f'    <vulninfo>{escape(vuln)}</vulninfo>')
61 60
         print('  </app>')
62 61
 
63 62
 
64 63