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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use f-strings in __init__.py

Signed-off-by: Anubhav Shelat <ashelat@xxxxxxxxxx>
---
 rteval/sysinfo/__init__.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

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")
-- 
2.31.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux