Blame SOURCES/tuna-tuna-cmd.py-use-fstrings.patch

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