diff options
author | nfnty <git@nfnty.se> | 2017-01-20 12:07:53 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-20 12:07:53 +0100 |
commit | 1c90e610de6591e8052a1056c775219b5e767002 (patch) | |
tree | 69b56f67dee1d6dfcea869de897846baaded3fa6 /doc/tools/convert_papermode_to_metadata.py | |
parent | e26d163debc9f55a89a27f94a43771526d2ff0b7 (diff) | |
parent | 03ee065e35c6a8f0e0dc1e66d8f4c3e83c51f315 (diff) | |
download | ranger-1c90e610de6591e8052a1056c775219b5e767002.tar.gz |
Merge branch 'lint'
Diffstat (limited to 'doc/tools/convert_papermode_to_metadata.py')
-rwxr-xr-x | doc/tools/convert_papermode_to_metadata.py | 12 |
1 files changed, 7 insertions, 5 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()) |