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

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

 



Use f-strings in memory.py

Signed-off-by: Anubhav Shelat <ashelat@xxxxxxxxxx>
---
 rteval/sysinfo/memory.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py
index 7c5fd6f315cf..cc2fa2cfa4be 100644
--- a/rteval/sysinfo/memory.py
+++ b/rteval/sysinfo/memory.py
@@ -49,7 +49,7 @@ class MemoryInfo:
             if l.startswith('MemTotal:'):
                 parts = l.split()
                 if parts[2].lower() != 'kb':
-                    raise RuntimeError("Units changed from kB! (%s)" % parts[2])
+                    raise RuntimeError(f"Units changed from kB! ({parts[2]})")
                 rawsize = int(parts[1])
                 f.close()
                 break
@@ -76,7 +76,7 @@ class MemoryInfo:
 
         memsize = self.mem_get_size()
         mem_n = libxml2.newNode("memory_size")
-        mem_n.addContent("%.3f" % memsize[0])
+        mem_n.addContent(f"{memsize[0]:.3f}")
         mem_n.newProp("unit", memsize[1])
         rep_n.addChild(mem_n)
 
@@ -88,8 +88,8 @@ def unit_test(rootdir):
     import sys
     try:
         mi = MemoryInfo()
-        print("Numa nodes: %i" % mi.mem_get_numa_nodes())
-        print("Memory: %i %s" % mi.mem_get_size())
+        print(f"Numa nodes: {mi.mem_get_numa_nodes()}")
+        print(f"Memory: {int(mi.mem_get_size()[0])} {mi.mem_get_size()[1]}")
     except Exception as e:
         import traceback
         traceback.print_exc(file=sys.stdout)
-- 
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