e40fab
From e9f60274865475c4e9081ee356ffbc61d1df2ade Mon Sep 17 00:00:00 2001
e40fab
From: Leah Leshchinsky <lleshchi@redhat.com>
e40fab
Date: Wed, 2 Nov 2022 10:57:19 -0400
e40fab
Subject: [PATCH 3/3] tuna: tuna-cmd.py use fstrings
e40fab
e40fab
Add fstrings where possible to improve readabilty
e40fab
e40fab
Due to the discussion regarding dropping the language feature, gettext
e40fab
shorthand _() have been removed.
e40fab
e40fab
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
e40fab
Signed-off-by: John Kacur <jkacur@redhat.com>
e40fab
e40fab
diff --git a/tuna-cmd.py b/tuna-cmd.py
e40fab
index 79e33371837e..75b63da972c2 100755
e40fab
--- a/tuna-cmd.py
e40fab
+++ b/tuna-cmd.py
e40fab
@@ -176,13 +176,16 @@ def thread_help(tid):
e40fab
         ps = procfs.pidstats()
e40fab
 
e40fab
     if tid not in ps:
e40fab
-        print("tuna: " + _("thread %d doesn't exists!") % tid)
e40fab
+        print(f"tuna: thread {tid} doesn't exist!")
e40fab
         return
e40fab
 
e40fab
     pinfo = ps[tid]
e40fab
     cmdline = procfs.process_cmdline(pinfo)
e40fab
     help, title = tuna.kthread_help_plain_text(tid, cmdline)
e40fab
-    print("%s\n\n%s" % (title, _(help)))
e40fab
+    print(title, "\n\n")
e40fab
+    if help.isspace():
e40fab
+        help = "No help description available."
e40fab
+    print(help)
e40fab
 
e40fab
 
e40fab
 def save(cpu_list, thread_list, filename):
e40fab
@@ -208,7 +211,7 @@ def ps_show_header(has_ctxt_switch_info, cgroups=False):
e40fab
 
e40fab
 def ps_show_sockets(pid, ps, inodes, inode_re, indent=0):
e40fab
     header_printed = False
e40fab
-    dirname = "/proc/%s/fd" % pid
e40fab
+    dirname = f"/proc/{pid}/fd"
e40fab
     try:
e40fab
         filenames = os.listdir(dirname)
e40fab
     except:  # Process died
e40fab
@@ -650,7 +653,7 @@ def main():
e40fab
             try:
e40fab
                 gui_refresh=int(a)
e40fab
             except Exception as err:
e40fab
-                print("tuna: --refresh %s" % err)
e40fab
+                print(f"tuna: --refresh {err}")
e40fab
                 sys.exit(2)
e40fab
         elif o in ("-d", "--disable_perf"):
e40fab
             run_gui = True
e40fab
@@ -679,7 +682,7 @@ def main():
e40fab
                 try:
e40fab
                     tuna.threads_set_priority(thread_list, a, affect_children)
e40fab
                 except OSError as err:
e40fab
-                    print("tuna: %s" % err)
e40fab
+                    print(f"tuna: {err}")
e40fab
                     sys.exit(2)
e40fab
         elif o in ("-P", "--show_threads"):
e40fab
             # If the user specified process names that weren't
e40fab
-- 
e40fab
2.31.1
e40fab