diff mbox series

[10/10] rteval: Use f-strings in __init__.py

Message ID 20230601192928.809434-10-ashelat@redhat.com
State Superseded
Headers show
Series [01/10] rteval: Use f-strings in rtevalclient.py | expand

Commit Message

Anubhav Shelat June 1, 2023, 7:29 p.m. UTC
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
---
 rteval/sysinfo/__init__.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py
index 5767e5b7f6fe..31059c564d59 100644
--- a/rteval/sysinfo/__init__.py
+++ b/rteval/sysinfo/__init__.py
@@ -83,27 +83,23 @@  if __name__ == "__main__":
 
     print(f"\tRunning on {si.get_base_os()}")
     print(f"\tNUMA nodes: {si.mem_get_numa_nodes()}")
-    print("\tMemory available: %03.2f %s\n" % si.mem_get_size())
+    print(f"\tMemory available: {si.mem_get_size()[0]:03.2f} {si.mem_get_size()[1]}\n")
 
     print("\tServices: ")
     for (s, r) in list(si.services_get().items()):
-        print("\t\t%s: %s" % (s, r))
+        print(f"\t\t{s}: {r}")
     (curr, avail) = si.kernel_get_clocksources()
 
-    print("\tCurrent clocksource: %s" % curr)
-    print("\tAvailable clocksources: %s" % avail)
+    print(f"\tCurrent clocksource: {curr}")
+    print(f"\tAvailable clocksources: {avail}")
     print("\tModules:")
     for m in si.kernel_get_modules():
-        print("\t\t%s: %s" % (m['modname'], m['modstate']))
+        print(f"\t\t{m['modname']}: {m['modstate']}")
     print("\tKernel threads:")
     for (p, i) in list(si.kernel_get_kthreads().items()):
-        print("\t\t%-30.30s pid: %-5.5s policy: %-7.7s prio: %-3.3s" % (
-            str(i["name"])+":", p, i["policy"], i["priority"]
-            ))
+        print(f"\t\t{str(i['name'])[:30]+':':<30} pid: {str(p)[:5]:<5} policy: {str(i['policy'])[:7]:<7} prio: {str(i['priority'])[:3]:<3}")
 
-    print("\n\tCPU topology info - cores: %i  online: %i  sockets: %i" % (
-        si.cpu_getCores(False), si.cpu_getCores(True), si.cpu_getSockets()
-        ))
+    print(f"\n\tCPU topology info - cores: {si.cpu_getCores(False)}  online: {si.cpu_getCores(True)}  sockets: {si.cpu_getSockets()}")
 
     xml = si.MakeReport()
     xml_d = libxml2.newDoc("1.0")