Browse code

use more f-strings

Hanno Böck authored on 29/01/2022 17:55:36
Showing 1 changed files
... ...
@@ -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