summary refs log tree commit diff stats
path: root/doc/tools
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tools')
-rwxr-xr-xdoc/tools/convert_papermode_to_metadata.py10
-rwxr-xr-xdoc/tools/print_colors.py15
-rwxr-xr-xdoc/tools/print_keys.py21
3 files changed, 23 insertions, 23 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py
index 61427c83..e73df344 100755
--- a/doc/tools/convert_papermode_to_metadata.py
+++ b/doc/tools/convert_papermode_to_metadata.py
@@ -14,10 +14,9 @@ import json
 import os
 import sys
 
-if sys.version < '3.':
-    getuserinput = raw_input
-else:
-    getuserinput = input
+if sys.version_info[0] < 3:
+    input = raw_input  # NOQA pylint: disable=undefined-variable,redefined-builtin,invalid-name
+
 
 FIELDS = ["name", "year", "title", "authors", "url"]
 
@@ -30,7 +29,7 @@ def replace(source, target):
     # Ask for user confirmation if the target file already exists
     if os.path.exists(target):
         sys.stdout.write("Warning: target file `%s' exists! Overwrite? [y/N]")
-        userinput = getuserinput()
+        userinput = input()
         if not (userinput.startswith("y") or userinput.startswith("Y")):
             print("Skipping file `%s'" % source)
             return
@@ -63,6 +62,7 @@ def replace(source, target):
     else:
         print("Skipping writing `%s' due to a lack of data" % target)
 
+
 if __name__ == "__main__":
     if set(['--help', '-h']) & set(sys.argv[1:]):
         print(__doc__.strip())
diff --git a/doc/tools/print_colors.py b/doc/tools/print_colors.py
index 8cc944ed..c4b6e736 100755
--- a/doc/tools/print_colors.py
+++ b/doc/tools/print_colors.py
@@ -5,27 +5,26 @@ It will exit after a keypress.
 """
 
 import curses
-from curses import *
 
 
-@wrapper
+@curses.wrapper
 def main(win):
     def print_all_colors(attr):
-        for c in range(-1, curses.COLORS):
+        for color in range(-1, curses.COLORS):
             try:
-                init_pair(c, c, 0)
+                curses.init_pair(color, color, 0)
             except Exception:
                 pass
             else:
-                win.addstr(str(c) + ' ', color_pair(c) | attr)
-    start_color()
+                win.addstr(str(color) + ' ', curses.color_pair(color) | attr)
+    curses.start_color()
     try:
-        use_default_colors()
+        curses.use_default_colors()
     except Exception:
         pass
     win.addstr("available colors: %d\n\n" % curses.COLORS)
     print_all_colors(0)
     win.addstr("\n\n")
-    print_all_colors(A_BOLD)
+    print_all_colors(curses.A_BOLD)
     win.refresh()
     win.getch()
diff --git a/doc/tools/print_keys.py b/doc/tools/print_keys.py
index 73091db4..cf915591 100755
--- a/doc/tools/print_keys.py
+++ b/doc/tools/print_keys.py
@@ -3,18 +3,19 @@
 You can use this tool to find out values of keypresses
 """
 
-from curses import *
+import curses
 
-sep = '; '
 
+SEPARATOR = '; '
 
-@wrapper
-def main(w):
-    mousemask(ALL_MOUSE_EVENTS)
-    mouseinterval(0)
+
+@curses.wrapper
+def main(window):
+    curses.mousemask(curses.ALL_MOUSE_EVENTS)
+    curses.mouseinterval(0)
     while True:
-        ch = w.getch()
-        if ch == KEY_MOUSE:
-            w.addstr(repr(getmouse()) + sep)
+        char = window.getch()
+        if char == curses.KEY_MOUSE:
+            window.addstr(repr(curses.getmouse()) + SEPARATOR)
         else:
-            w.addstr(str(ch) + sep)
+            window.addstr(str(char) + SEPARATOR)