aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnubhav Shelat <ashelat@redhat.com>2023-06-01 16:27:31 -0400
committerJohn Kacur <jkacur@redhat.com>2023-06-12 14:37:24 -0400
commit6e063353072b73e43a732bb5dfa265767ac0dbd7 (patch)
tree40c68492204d2da8356cca529aa9387de12afbb9
parenta4acd156917024303f326dd5e66a7c9e2d12fda3 (diff)
downloadrteval-6e063353072b73e43a732bb5dfa265767ac0dbd7.tar.gz
rteval: Use f-strings in memory.py
Use f-strings in memory.py Signed-off-by: Anubhav Shelat <ashelat@redhat.com> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--rteval/sysinfo/memory.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py
index 7c5fd6f..cc2fa2c 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)