aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-01-20 12:07:53 +0100
committernfnty <git@nfnty.se>2017-01-20 12:07:53 +0100
commit1c90e610de6591e8052a1056c775219b5e767002 (patch)
tree69b56f67dee1d6dfcea869de897846baaded3fa6 /doc
parente26d163debc9f55a89a27f94a43771526d2ff0b7 (diff)
parent03ee065e35c6a8f0e0dc1e66d8f4c3e83c51f315 (diff)
downloadranger-1c90e610de6591e8052a1056c775219b5e767002.tar.gz
Merge branch 'lint'
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/tools/convert_papermode_to_metadata.py12
-rwxr-xr-xdoc/tools/print_colors.py17
-rwxr-xr-xdoc/tools/print_keys.py23
3 files changed, 29 insertions, 23 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py
index 61427c83..d4427a10 100755
--- a/doc/tools/convert_papermode_to_metadata.py
+++ b/doc/tools/convert_papermode_to_metadata.py
@@ -9,15 +9,16 @@ ranger used to store metadata in .paperinfo files, but that format was rather
limited, so .metadata.json files were introduced.
"""
+from __future__ import (absolute_import, print_function)
+
import csv
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 +31,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 +64,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..69436778 100755
--- a/doc/tools/print_colors.py
+++ b/doc/tools/print_colors.py
@@ -4,28 +4,29 @@ You can use this tool to display all supported colors and their color number.
It will exit after a keypress.
"""
+from __future__ import (absolute_import, print_function)
+
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..936d9bf0 100755
--- a/doc/tools/print_keys.py
+++ b/doc/tools/print_keys.py
@@ -3,18 +3,21 @@
You can use this tool to find out values of keypresses
"""
-from curses import *
+from __future__ import (absolute_import, print_function)
-sep = '; '
+import curses
-@wrapper
-def main(w):
- mousemask(ALL_MOUSE_EVENTS)
- mouseinterval(0)
+SEPARATOR = '; '
+
+
+@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)