changeset 79:5c7913c838cb

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 01 Mar 2022 13:23:09 +0200
parents 1e1d478f4845
children 0d9303f30e68
files lxmldump.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lxmldump.py	Mon Feb 28 14:46:29 2022 +0200
+++ b/lxmldump.py	Tue Mar 01 13:23:09 2022 +0200
@@ -206,7 +206,7 @@
 
 ## Handler for SIGINT signals
 def pkk_signal_handler(signal, frame):
-    print(u"\nQuitting due to SIGINT / Ctrl+C!")
+    print("\nQuitting due to SIGINT / Ctrl+C!")
     sys.exit(1)
 
 
@@ -559,14 +559,14 @@
 
     if pkk_cfg.list_values:
         if pkk_cfg.mode in [PKK_MODE_NORMAL, PKK_MODE_ANKI]:
-            print(u"Available format strings and values (mode '{}'):".format(
+            print("Available format strings and values (mode '{}'):".format(
                 pkk_modes_list[pkk_cfg.mode]))
 
             for mid in pkk_mode_defaults:
                 stmp = pkk_get_value(mid).replace("\\", "\\\\").replace("\n", "\\n")
-                print(u"  {:22s} : '{}'".format(mid, stmp))
+                print("  {mid:22s} : '{stmp}'")
         else:
-            print(u"Mode '{}' does not use format strings.".format(
+            print("Mode '{}' does not use format strings.".format(
                 pkk_modes_list[pkk_cfg.mode]))
 
         sys.exit(0)
@@ -580,7 +580,7 @@
         try:
             uxml = xmlET.parse(filename)
         except Exception as e:
-            pkk_fatal(u"SVG/XML parsing failed: {0}".format(str(e)))
+            pkk_fatal(f"SVG/XML parsing failed: {str(e)}")
 
         # Dump output
         try:
@@ -604,7 +604,7 @@
                 elif pkk_cfg.mode == PKK_MODE_XML:
                     pkk_print(xmlET.tostring(dnode, encoding="utf8").decode("utf8") + "\n\n")
                 else:
-                    pkk_fatal("Invalid operation mode?")
+                    pkk_fatal(f"Invalid operation mode '{pkk_cfg.mode}'.")
 
         except (BrokenPipeError, IOError) as e:
             sys.stderr.close()