summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2016-12-23 10:49:25 +0100
committernfnty <git@nfnty.se>2017-01-17 05:59:02 +0100
commite52629c1c70f91ac117e488e04a73bf9e91ab8f9 (patch)
treec92b5de625f7e5dc57ee1374531d14ac60222717
parent916c239014b95f02bf045f8de0488d7614126edf (diff)
downloadranger-e52629c1c70f91ac117e488e04a73bf9e91ab8f9.tar.gz
linting: Python 2 compat: Import from `__future__`
-rwxr-xr-xdoc/tools/convert_papermode_to_metadata.py2
-rwxr-xr-xdoc/tools/print_colors.py2
-rwxr-xr-xdoc/tools/print_keys.py2
-rw-r--r--examples/plugin_chmod_keybindings.py2
-rw-r--r--examples/plugin_file_filter.py3
-rw-r--r--examples/plugin_hello_world.py2
-rw-r--r--examples/plugin_ipc.py2
-rw-r--r--examples/plugin_linemode.py2
-rw-r--r--examples/plugin_new_macro.py2
-rw-r--r--examples/plugin_new_sorting_method.py2
-rw-r--r--examples/plugin_pmount.py2
-rwxr-xr-xranger.py10
-rw-r--r--ranger/__init__.py2
-rw-r--r--ranger/api/__init__.py2
-rw-r--r--ranger/api/commands.py2
-rw-r--r--ranger/api/options.py3
-rw-r--r--ranger/colorschemes/default.py2
-rw-r--r--ranger/colorschemes/jungle.py2
-rw-r--r--ranger/colorschemes/snow.py2
-rw-r--r--ranger/colorschemes/solarized.py2
-rwxr-xr-xranger/config/commands.py2
-rw-r--r--ranger/config/commands_sample.py2
-rw-r--r--ranger/container/bookmarks.py2
-rw-r--r--ranger/container/directory.py2
-rw-r--r--ranger/container/file.py2
-rw-r--r--ranger/container/fsobject.py2
-rw-r--r--ranger/container/history.py2
-rw-r--r--ranger/container/settings.py2
-rw-r--r--ranger/container/tags.py2
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/fm.py2
-rw-r--r--ranger/core/linemode.py2
-rw-r--r--ranger/core/loader.py4
-rw-r--r--ranger/core/main.py2
-rw-r--r--ranger/core/metadata.py2
-rw-r--r--ranger/core/runner.py2
-rw-r--r--ranger/core/shared.py2
-rw-r--r--ranger/core/tab.py2
-rw-r--r--ranger/ext/accumulator.py2
-rw-r--r--ranger/ext/cached_function.py2
-rw-r--r--ranger/ext/curses_interrupt_handler.py2
-rw-r--r--ranger/ext/direction.py2
-rw-r--r--ranger/ext/get_executables.py2
-rw-r--r--ranger/ext/human_readable.py2
-rw-r--r--ranger/ext/img_display.py2
-rw-r--r--ranger/ext/iter_tools.py2
-rw-r--r--ranger/ext/keybinding_parser.py2
-rw-r--r--ranger/ext/lazy_property.py2
-rw-r--r--ranger/ext/logutils.py2
-rw-r--r--ranger/ext/mount_path.py2
-rw-r--r--ranger/ext/next_available_filename.py2
-rw-r--r--ranger/ext/openstruct.py2
-rw-r--r--ranger/ext/popen_forked.py2
-rw-r--r--ranger/ext/relative_symlink.py2
-rwxr-xr-xranger/ext/rifle.py2
-rw-r--r--ranger/ext/shell_escape.py3
-rw-r--r--ranger/ext/shutil_generatorized.py2
-rw-r--r--ranger/ext/signals.py2
-rw-r--r--ranger/ext/spawn.py2
-rw-r--r--ranger/ext/vcs/__init__.py2
-rw-r--r--ranger/ext/vcs/bzr.py2
-rw-r--r--ranger/ext/vcs/git.py2
-rw-r--r--ranger/ext/vcs/hg.py2
-rw-r--r--ranger/ext/vcs/svn.py2
-rw-r--r--ranger/ext/vcs/vcs.py2
-rw-r--r--ranger/ext/widestring.py2
-rw-r--r--ranger/gui/ansi.py2
-rw-r--r--ranger/gui/bar.py2
-rw-r--r--ranger/gui/color.py2
-rw-r--r--ranger/gui/colorscheme.py2
-rw-r--r--ranger/gui/context.py3
-rw-r--r--ranger/gui/curses_shortcuts.py2
-rw-r--r--ranger/gui/displayable.py2
-rw-r--r--ranger/gui/mouse_event.py2
-rw-r--r--ranger/gui/ui.py2
-rw-r--r--ranger/gui/widgets/__init__.py2
-rw-r--r--ranger/gui/widgets/browsercolumn.py2
-rw-r--r--ranger/gui/widgets/console.py2
-rw-r--r--ranger/gui/widgets/pager.py2
-rw-r--r--ranger/gui/widgets/statusbar.py2
-rw-r--r--ranger/gui/widgets/taskview.py2
-rw-r--r--ranger/gui/widgets/titlebar.py2
-rw-r--r--ranger/gui/widgets/view_base.py2
-rw-r--r--ranger/gui/widgets/view_miller.py2
-rw-r--r--ranger/gui/widgets/view_multipane.py2
-rwxr-xr-xsetup.py2
-rw-r--r--tests/ranger/container/test_bookmarks.py2
-rw-r--r--tests/ranger/container/test_container.py2
-rw-r--r--tests/ranger/container/test_fsobject.py2
89 files changed, 187 insertions, 5 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py
index e73df344..d4427a10 100755
--- a/doc/tools/convert_papermode_to_metadata.py
+++ b/doc/tools/convert_papermode_to_metadata.py
@@ -9,6 +9,8 @@ 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
diff --git a/doc/tools/print_colors.py b/doc/tools/print_colors.py
index c4b6e736..69436778 100755
--- a/doc/tools/print_colors.py
+++ b/doc/tools/print_colors.py
@@ -4,6 +4,8 @@ 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
 
 
diff --git a/doc/tools/print_keys.py b/doc/tools/print_keys.py
index cf915591..936d9bf0 100755
--- a/doc/tools/print_keys.py
+++ b/doc/tools/print_keys.py
@@ -3,6 +3,8 @@
 You can use this tool to find out values of keypresses
 """
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 
 
diff --git a/examples/plugin_chmod_keybindings.py b/examples/plugin_chmod_keybindings.py
index 72e90121..faab2345 100644
--- a/examples/plugin_chmod_keybindings.py
+++ b/examples/plugin_chmod_keybindings.py
@@ -4,6 +4,8 @@
 # It could replace the ten lines in the rc.conf that create the key bindings
 # for the "chmod" command.
 
+from __future__ import (absolute_import, print_function)
+
 import ranger.api
 
 
diff --git a/examples/plugin_file_filter.py b/examples/plugin_file_filter.py
index aece68f8..27afd551 100644
--- a/examples/plugin_file_filter.py
+++ b/examples/plugin_file_filter.py
@@ -4,6 +4,9 @@
 # the "show_hidden" option is activated.
 
 # Save the original filter function
+
+from __future__ import (absolute_import, print_function)
+
 import ranger.container.directory
 
 
diff --git a/examples/plugin_hello_world.py b/examples/plugin_hello_world.py
index dc4c3fee..b1451be1 100644
--- a/examples/plugin_hello_world.py
+++ b/examples/plugin_hello_world.py
@@ -3,6 +3,8 @@
 # This is a sample plugin that displays "Hello World" in ranger's console after
 # it started.
 
+from __future__ import (absolute_import, print_function)
+
 # We are going to extend the hook "ranger.api.hook_ready", so first we need
 # to import ranger.api:
 import ranger.api
diff --git a/examples/plugin_ipc.py b/examples/plugin_ipc.py
index ef87c3c5..99637272 100644
--- a/examples/plugin_ipc.py
+++ b/examples/plugin_ipc.py
@@ -7,6 +7,8 @@
 # Example:
 #   $ echo tab_new ~/images > /tmp/ranger-ipc.1234
 
+from __future__ import (absolute_import, print_function)
+
 import ranger.api
 
 
diff --git a/examples/plugin_linemode.py b/examples/plugin_linemode.py
index febde8f1..84cc57cc 100644
--- a/examples/plugin_linemode.py
+++ b/examples/plugin_linemode.py
@@ -5,6 +5,8 @@
 # the linemode by typing ":linemode rot13" in ranger.  Type Mf to restore
 # the default linemode.
 
+from __future__ import (absolute_import, print_function)
+
 import codecs
 
 import ranger.api
diff --git a/examples/plugin_new_macro.py b/examples/plugin_new_macro.py
index 1c69b841..0e44cdd3 100644
--- a/examples/plugin_new_macro.py
+++ b/examples/plugin_new_macro.py
@@ -4,6 +4,8 @@
 # date in commands that allow macros.  You can test it with the command
 # ":shell echo %date; read"
 
+from __future__ import (absolute_import, print_function)
+
 import time
 
 import ranger.core.actions
diff --git a/examples/plugin_new_sorting_method.py b/examples/plugin_new_sorting_method.py
index 2dd50257..fefeaad9 100644
--- a/examples/plugin_new_sorting_method.py
+++ b/examples/plugin_new_sorting_method.py
@@ -3,6 +3,8 @@
 # This plugin adds the sorting algorithm called 'random'.  To enable it, type
 # ":set sort=random" or create a key binding with ":map oz set sort=random"
 
+from __future__ import (absolute_import, print_function)
+
 from random import random
 
 from ranger.container.directory import Directory
diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py
index 6cd325f7..5db85385 100644
--- a/examples/plugin_pmount.py
+++ b/examples/plugin_pmount.py
@@ -9,6 +9,8 @@
 # alt+shift+m <uppercase letter>         : unmount /dev/sd<letter>
 # alt+shift+n                            : list the devices
 
+from __future__ import (absolute_import, print_function)
+
 import ranger.api
 
 MOUNT_KEY = '<alt>m'
diff --git a/ranger.py b/ranger.py
index f8c00213..3aa62eec 100755
--- a/ranger.py
+++ b/ranger.py
@@ -20,10 +20,12 @@ if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
 fi
 rm -f -- "$tempfile"
 return $returnvalue
-""" and None  # pylint: disable=pointless-statement
+"""
 
-import sys  # NOQA pylint: disable=wrong-import-position
-from os.path import exists, abspath  # NOQA pylint: disable=wrong-import-position
+from __future__ import (absolute_import, print_function)
+
+import sys
+from os.path import exists, abspath
 
 # Need to find out whether or not the flag --clean was used ASAP,
 # because --clean is supposed to disable bytecode compilation
@@ -35,5 +37,5 @@ if __file__[:4] == '/usr' and exists('ranger') and abspath('.') in sys.path:
     sys.path.remove(abspath('.'))
 
 # Start ranger
-import ranger  # NOQA pylint: disable=wrong-import-position,import-self
+import ranger  # NOQA pylint: disable=import-self,wrong-import-position
 sys.exit(ranger.main())  # pylint: disable=no-member
diff --git a/ranger/__init__.py b/ranger/__init__.py
index e8f05c4d..6f41eb98 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -8,6 +8,8 @@ directory hierarchy.  The secondary task of ranger is to figure out which
 program you want to use to open your files with.
 """
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 import os
 
diff --git a/ranger/api/__init__.py b/ranger/api/__init__.py
index 3c7818b8..992dfc20 100644
--- a/ranger/api/__init__.py
+++ b/ranger/api/__init__.py
@@ -3,6 +3,8 @@
 
 """Files in this module contain helper functions used in configuration files."""
 
+from __future__ import (absolute_import, print_function)
+
 import ranger  # NOQA
 
 from ranger.core.linemode import LinemodeBase  # NOQA
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 1d833dda..2160dbd7 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -3,6 +3,8 @@
 
 # TODO: Add an optional "!" to all commands and set a flag if it's there
 
+from __future__ import (absolute_import, print_function)
+
 import os
 import re
 import inspect
diff --git a/ranger/api/options.py b/ranger/api/options.py
index 3161a2c6..a2bf4e8c 100644
--- a/ranger/api/options.py
+++ b/ranger/api/options.py
@@ -2,6 +2,9 @@
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
 # THIS WHOLE FILE IS OBSOLETE AND EXISTS FOR BACKWARDS COMPATIBILITIY
+
+from __future__ import (absolute_import, print_function)
+
 # pylint: disable=unused-import
 import re  # NOQA
 from re import compile as regexp  # NOQA
diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py
index 557b6075..9ccb6ff2 100644
--- a/ranger/colorschemes/default.py
+++ b/ranger/colorschemes/default.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui.colorscheme import ColorScheme
 from ranger.gui.color import (
     black, blue, cyan, green, magenta, red, white, yellow, default,
diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py
index b56bb6ed..00f51d5c 100644
--- a/ranger/colorschemes/jungle.py
+++ b/ranger/colorschemes/jungle.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.colorschemes.default import Default
 from ranger.gui.color import green, red, blue
 
diff --git a/ranger/colorschemes/snow.py b/ranger/colorschemes/snow.py
index 315b4259..2e0a004f 100644
--- a/ranger/colorschemes/snow.py
+++ b/ranger/colorschemes/snow.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui.colorscheme import ColorScheme
 from ranger.gui.color import default_colors, reverse, bold
 
diff --git a/ranger/colorschemes/solarized.py b/ranger/colorschemes/solarized.py
index 09d66bff..0cfcb86d 100644
--- a/ranger/colorschemes/solarized.py
+++ b/ranger/colorschemes/solarized.py
@@ -5,6 +5,8 @@
 # from https://github.com/seebi/dircolors-solarized.
 # This is a modification of Roman Zimbelmann's default colorscheme.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui.colorscheme import ColorScheme
 from ranger.gui.color import (
     cyan, magenta, red, white, default,
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 98af27e3..5fed15ac 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -83,6 +83,8 @@
 # of ranger.
 # ===================================================================
 
+from __future__ import (absolute_import, print_function)
+
 from collections import deque
 import os
 import re
diff --git a/ranger/config/commands_sample.py b/ranger/config/commands_sample.py
index 4333823c..8d0e6256 100644
--- a/ranger/config/commands_sample.py
+++ b/ranger/config/commands_sample.py
@@ -7,6 +7,8 @@
 # A simple command for demonstration purposes follows.
 # -----------------------------------------------------------------------------
 
+from __future__ import (absolute_import, print_function)
+
 # You can import any python module as needed.
 import os
 
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 6b188de0..fd7fc017 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import string
 import re
 import os
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index fbae9a93..44ca45fe 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import locale
 import os.path
 from os import stat as os_stat, lstat as os_lstat
diff --git a/ranger/container/file.py b/ranger/container/file.py
index f6ab880c..a746345c 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import re
 from ranger.container.fsobject import FileSystemObject
 
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index f4d84bc1..bfc3b0c4 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import re
 from grp import getgrgid
 from os import lstat, stat
diff --git a/ranger/container/history.py b/ranger/container/history.py
index c72d5c3b..857f12b6 100644
--- a/ranger/container/history.py
+++ b/ranger/container/history.py
@@ -3,6 +3,8 @@
 
 # TODO: rewrite to use deque instead of list
 
+from __future__ import (absolute_import, print_function)
+
 
 class HistoryEmptyException(Exception):
     pass
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index b135612a..9bbc777a 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import re
 import os.path
 from inspect import isfunction
diff --git a/ranger/container/tags.py b/ranger/container/tags.py
index 128f984e..2e5623f3 100644
--- a/ranger/container/tags.py
+++ b/ranger/container/tags.py
@@ -3,6 +3,8 @@
 
 # TODO: add a __getitem__ method to get the tag of a file
 
+from __future__ import (absolute_import, print_function)
+
 from os.path import isdir, exists, dirname, abspath, realpath, expanduser
 import string
 import sys
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 7473fd78..68fc4884 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -2,6 +2,8 @@
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 # pylint: disable=too-many-lines
 
+from __future__ import (absolute_import, print_function)
+
 import codecs
 import os
 from os import link, symlink, getcwd, listdir, stat
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 8535a17c..f7a58b64 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -3,6 +3,8 @@
 
 """The File Manager, putting the pieces together"""
 
+from __future__ import (absolute_import, print_function)
+
 from time import time
 from collections import deque
 import logging
diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py
index b79351c4..97c6d4e6 100644
--- a/ranger/core/linemode.py
+++ b/ranger/core/linemode.py
@@ -3,6 +3,8 @@
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 # Author: Wojciech Siewierski <wojciech.siewierski@onet.pl>, 2015
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 
 from abc import ABCMeta, abstractproperty, abstractmethod
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 862e01b4..6c4efc36 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from collections import deque
 from subprocess import Popen, PIPE
 from time import time, sleep
@@ -14,7 +16,7 @@ from ranger.core.shared import FileManagerAware
 from ranger.ext.signals import SignalDispatcher
 from ranger.ext.human_readable import human_readable
 try:
-    import chardet
+    import chardet  # pylint: disable=import-error
     HAVE_CHARDET = True
 except Exception:
     HAVE_CHARDET = False
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 48e3a6f0..3cd1b9c5 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -3,6 +3,8 @@
 
 """The main function responsible to initialize the FM object and stuff."""
 
+from __future__ import (absolute_import, print_function)
+
 import os.path
 import sys
 import tempfile
diff --git a/ranger/core/metadata.py b/ranger/core/metadata.py
index 1d0e1cd5..b2a1be3a 100644
--- a/ranger/core/metadata.py
+++ b/ranger/core/metadata.py
@@ -11,6 +11,8 @@ The database is contained in a local .metadata.json file.
 # TODO: Update metadata keys if a file gets renamed/moved
 # TODO: A global metadata file, maybe as a replacement for tags
 
+from __future__ import (absolute_import, print_function)
+
 import copy
 from os.path import join, dirname, exists, basename
 from ranger.ext.openstruct import DefaultOpenStruct as ostruct
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index 1a9c8193..a0eb161f 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -22,6 +22,8 @@ t: run application in a new terminal window
 (An uppercase key negates the respective lower case flag)
 """
 
+from __future__ import (absolute_import, print_function)
+
 import os
 import sys
 from subprocess import Popen, PIPE
diff --git a/ranger/core/shared.py b/ranger/core/shared.py
index 764c2384..3595aede 100644
--- a/ranger/core/shared.py
+++ b/ranger/core/shared.py
@@ -3,6 +3,8 @@
 
 """Shared objects contain singletons for shared use."""
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.ext.lazy_property import lazy_property  # NOQA pylint: disable=unused-import
 
 
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 56348111..60097ced 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import os
 from os.path import abspath, normpath, join, expanduser, isdir
 import sys
diff --git a/ranger/ext/accumulator.py b/ranger/ext/accumulator.py
index dcbfb4d9..d75363ca 100644
--- a/ranger/ext/accumulator.py
+++ b/ranger/ext/accumulator.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.ext.direction import Direction
 
 
diff --git a/ranger/ext/cached_function.py b/ranger/ext/cached_function.py
index 3c26d4f9..c5a4cb47 100644
--- a/ranger/ext/cached_function.py
+++ b/ranger/ext/cached_function.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 
 def cached_function(fnc):
     cache = {}
diff --git a/ranger/ext/curses_interrupt_handler.py b/ranger/ext/curses_interrupt_handler.py
index d220d99c..e31503b8 100644
--- a/ranger/ext/curses_interrupt_handler.py
+++ b/ranger/ext/curses_interrupt_handler.py
@@ -8,6 +8,8 @@ rise a KeyboardInterrupt exception and handle it by pushing
 a Ctrl+C (ASCII value 3) to the curses getch stack.
 """
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 import signal
 
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 3de7e1c3..f4f2c9f9 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -18,6 +18,8 @@ has been defined.
 False
 """
 
+from __future__ import (absolute_import, print_function)
+
 
 class Direction(dict):
 
diff --git a/ranger/ext/get_executables.py b/ranger/ext/get_executables.py
index 385ec45d..e077d149 100644
--- a/ranger/ext/get_executables.py
+++ b/ranger/ext/get_executables.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from stat import S_IXOTH, S_IFREG
 from os import listdir, environ, stat
 import shlex
diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py
index e4b04525..71bc29b8 100644
--- a/ranger/ext/human_readable.py
+++ b/ranger/ext/human_readable.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 
 def human_readable(byte, separator=' '):  # pylint: disable=too-many-return-statements
     """Convert a large number of bytes to an easily readable format.
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 4a12446e..aff6bb29 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -9,6 +9,8 @@ This module provides functions to draw images in the terminal using supported
 implementations, which are currently w3m, iTerm2 and urxvt.
 """
 
+from __future__ import (absolute_import, print_function)
+
 import base64
 import curses
 import errno
diff --git a/ranger/ext/iter_tools.py b/ranger/ext/iter_tools.py
index a18276b9..70b74c39 100644
--- a/ranger/ext/iter_tools.py
+++ b/ranger/ext/iter_tools.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from collections import deque
 
 
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py
index ec9d8034..7430dfcf 100644
--- a/ranger/ext/keybinding_parser.py
+++ b/ranger/ext/keybinding_parser.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 import copy
 import curses.ascii
diff --git a/ranger/ext/lazy_property.py b/ranger/ext/lazy_property.py
index 43dc65af..2fbe0cfd 100644
--- a/ranger/ext/lazy_property.py
+++ b/ranger/ext/lazy_property.py
@@ -1,5 +1,7 @@
 # From http://blog.pythonisito.com/2008/08/lazy-descriptors.html
 
+from __future__ import (absolute_import, print_function)
+
 
 class lazy_property(object):  # pylint: disable=invalid-name,too-few-public-methods
     """A @property-like decorator with lazy evaluation
diff --git a/ranger/ext/logutils.py b/ranger/ext/logutils.py
index c8d887d0..ce77360d 100644
--- a/ranger/ext/logutils.py
+++ b/ranger/ext/logutils.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, print_function)
+
 import logging
 from collections import deque
 
diff --git a/ranger/ext/mount_path.py b/ranger/ext/mount_path.py
index 69a277af..6c59b107 100644
--- a/ranger/ext/mount_path.py
+++ b/ranger/ext/mount_path.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from os.path import realpath, abspath, dirname, ismount
 
 
diff --git a/ranger/ext/next_available_filename.py b/ranger/ext/next_available_filename.py
index c408b35d..4ff9be24 100644
--- a/ranger/ext/next_available_filename.py
+++ b/ranger/ext/next_available_filename.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import os.path
 
 
diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py
index 4c4f7f13..19d10ebc 100644
--- a/ranger/ext/openstruct.py
+++ b/ranger/ext/openstruct.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import collections
 
 
diff --git a/ranger/ext/popen_forked.py b/ranger/ext/popen_forked.py
index 82997f0c..119ce46a 100644
--- a/ranger/ext/popen_forked.py
+++ b/ranger/ext/popen_forked.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import os
 import subprocess
 
diff --git a/ranger/ext/relative_symlink.py b/ranger/ext/relative_symlink.py
index 247d1318..85eb746e 100644
--- a/ranger/ext/relative_symlink.py
+++ b/ranger/ext/relative_symlink.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from os import symlink, sep
 
 
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 842f289e..2f6c8823 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -14,6 +14,8 @@ Example usage:
     rifle.execute(["file1", "file2"])
 """
 
+from __future__ import (absolute_import, print_function)
+
 import os.path
 import re
 from subprocess import Popen, PIPE
diff --git a/ranger/ext/shell_escape.py b/ranger/ext/shell_escape.py
index 5cea1ec5..17ad47a5 100644
--- a/ranger/ext/shell_escape.py
+++ b/ranger/ext/shell_escape.py
@@ -3,6 +3,9 @@
 
 """Functions to escape metacharacters of arguments for shell commands."""
 
+from __future__ import (absolute_import, print_function)
+
+
 META_CHARS = (' ', "'", '"', '`', '&', '|', ';', '#',
               '$', '!', '(', ')', '[', ']', '<', '>', '\t')
 UNESCAPABLE = set(map(chr, list(range(9)) + list(range(10, 32))
diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py
index f00e992d..737ebec2 100644
--- a/ranger/ext/shutil_generatorized.py
+++ b/ranger/ext/shutil_generatorized.py
@@ -5,6 +5,8 @@
 XXX The functions here don't copy the resource fork or other metadata on Mac.
 """
 
+from __future__ import (absolute_import, print_function)
+
 import os
 from os.path import abspath
 import sys
diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py
index d7242a79..83adf367 100644
--- a/ranger/ext/signals.py
+++ b/ranger/ext/signals.py
@@ -57,6 +57,8 @@ True
 True
 """
 
+from __future__ import (absolute_import, print_function)
+
 import weakref
 from types import MethodType
 
diff --git a/ranger/ext/spawn.py b/ranger/ext/spawn.py
index 04abfbd2..dae532e4 100644
--- a/ranger/ext/spawn.py
+++ b/ranger/ext/spawn.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from os import devnull
 from subprocess import Popen, PIPE, CalledProcessError
 ENCODING = 'utf-8'
diff --git a/ranger/ext/vcs/__init__.py b/ranger/ext/vcs/__init__.py
index 26a32800..90f9a713 100644
--- a/ranger/ext/vcs/__init__.py
+++ b/ranger/ext/vcs/__init__.py
@@ -3,6 +3,8 @@
 
 """VCS Extension"""
 
+from __future__ import (absolute_import, print_function)
+
 from .vcs import Vcs, VcsError, VcsThread
 
 __all__ = ['Vcs', 'VcsError', 'VcsThread']
diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py
index d0db1faf..0f0c858d 100644
--- a/ranger/ext/vcs/bzr.py
+++ b/ranger/ext/vcs/bzr.py
@@ -3,6 +3,8 @@
 
 """GNU Bazaar module"""
 
+from __future__ import (absolute_import, print_function)
+
 from datetime import datetime
 import os
 import re
diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py
index 06e066d2..640d8bfe 100644
--- a/ranger/ext/vcs/git.py
+++ b/ranger/ext/vcs/git.py
@@ -3,6 +3,8 @@
 
 """Git module"""
 
+from __future__ import (absolute_import, print_function)
+
 from datetime import datetime
 import os
 import re
diff --git a/ranger/ext/vcs/hg.py b/ranger/ext/vcs/hg.py
index 21460975..94d0f749 100644
--- a/ranger/ext/vcs/hg.py
+++ b/ranger/ext/vcs/hg.py
@@ -3,6 +3,8 @@
 
 """Mercurial module"""
 
+from __future__ import (absolute_import, print_function)
+
 from datetime import datetime
 import json
 import os
diff --git a/ranger/ext/vcs/svn.py b/ranger/ext/vcs/svn.py
index 1f09cd52..ceac84cf 100644
--- a/ranger/ext/vcs/svn.py
+++ b/ranger/ext/vcs/svn.py
@@ -3,6 +3,8 @@
 
 """Subversion module"""
 
+from __future__ import (absolute_import, print_function)
+
 from datetime import datetime
 import os
 from xml.etree import ElementTree as etree
diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py
index 1d9687da..dbc2eace 100644
--- a/ranger/ext/vcs/vcs.py
+++ b/ranger/ext/vcs/vcs.py
@@ -3,6 +3,8 @@
 
 """VCS module"""
 
+from __future__ import (absolute_import, print_function)
+
 import os
 import subprocess
 import threading
diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py
index 603439cb..f98b1562 100644
--- a/ranger/ext/widestring.py
+++ b/ranger/ext/widestring.py
@@ -2,6 +2,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 from unicodedata import east_asian_width
 
diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py
index 184c04fb..4d6cbeb5 100644
--- a/ranger/gui/ansi.py
+++ b/ranger/gui/ansi.py
@@ -4,6 +4,8 @@
 
 """A library to help to convert ANSI codes to curses instructions."""
 
+from __future__ import (absolute_import, print_function)
+
 import re
 
 from ranger.gui import color
diff --git a/ranger/gui/bar.py b/ranger/gui/bar.py
index 91fdff24..c1fd6ff9 100644
--- a/ranger/gui/bar.py
+++ b/ranger/gui/bar.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 
 from ranger.ext.widestring import WideString, utf_char_width
diff --git a/ranger/gui/color.py b/ranger/gui/color.py
index 786299a3..cc2e9a52 100644
--- a/ranger/gui/color.py
+++ b/ranger/gui/color.py
@@ -13,6 +13,8 @@ attr ^= reverse
 bool(attr & reverse) # => False
 """
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 
 DEFAULT_FOREGROUND = curses.COLOR_WHITE
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 363d4da3..e5909a09 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -24,6 +24,8 @@ Define which colorscheme in your settings (e.g. ~/.config/ranger/rc.conf):
 set colorscheme yourschemename
 """
 
+from __future__ import (absolute_import, print_function)
+
 import os.path
 from curses import color_pair
 
diff --git a/ranger/gui/context.py b/ranger/gui/context.py
index be118655..dd1320f5 100644
--- a/ranger/gui/context.py
+++ b/ranger/gui/context.py
@@ -1,6 +1,9 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
+
 CONTEXT_KEYS = ['reset', 'error', 'badinfo',
                 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console',
                 'in_pager', 'in_taskview',
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py
index 3213d097..398a9711 100644
--- a/ranger/gui/curses_shortcuts.py
+++ b/ranger/gui/curses_shortcuts.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import sys
 import curses
 import _curses
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py
index 1eef8f41..99d119aa 100644
--- a/ranger/gui/displayable.py
+++ b/ranger/gui/displayable.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.core.shared import FileManagerAware
 from ranger.gui.curses_shortcuts import CursesShortcuts
 
diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py
index be25463e..b479e383 100644
--- a/ranger/gui/mouse_event.py
+++ b/ranger/gui/mouse_event.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 
 
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 90dee4c9..bc3f024d 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import os
 import sys
 import threading
diff --git a/ranger/gui/widgets/__init__.py b/ranger/gui/widgets/__init__.py
index ae515ae1..3dde76a6 100644
--- a/ranger/gui/widgets/__init__.py
+++ b/ranger/gui/widgets/__init__.py
@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui.displayable import Displayable
 
 
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index fa6c89fe..ae59273b 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -3,6 +3,8 @@
 
 """The BrowserColumn widget displays the contents of a directory or file."""
 
+from __future__ import (absolute_import, print_function)
+
 import stat
 from time import time
 from os.path import splitext
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 19090620..7558183a 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -3,6 +3,8 @@
 
 """The Console widget implements a vim-like console"""
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 import re
 from collections import deque
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index fabf6113..e214b587 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -3,6 +3,8 @@
 
 """The pager displays text and allows you to scroll inside it."""
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui import ansi
 from ranger.ext.direction import Direction
 from ranger.ext.img_display import ImgDisplayUnsupportedException
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index ead79e5d..632a1759 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -8,6 +8,8 @@ print for the current file.  The right side shows directory information
 such as the space used by all the files in this directory.
 """
 
+from __future__ import (absolute_import, print_function)
+
 import os
 from os import getuid, readlink
 from pwd import getpwuid
diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py
index 803b4ae4..2e913f95 100644
--- a/ranger/gui/widgets/taskview.py
+++ b/ranger/gui/widgets/taskview.py
@@ -3,6 +3,8 @@
 
 """The TaskView allows you to modify what the loader is doing."""
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.ext.accumulator import Accumulator
 
 from . import Widget
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index 3f96e094..a9f2caaf 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -6,6 +6,8 @@
 It displays the current path among other things.
 """
 
+from __future__ import (absolute_import, print_function)
+
 from os.path import basename
 
 from ranger.gui.bar import Bar
diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py
index d6652ef5..3ec01c72 100644
--- a/ranger/gui/widgets/view_base.py
+++ b/ranger/gui/widgets/view_base.py
@@ -3,6 +3,8 @@
 
 """The base GUI element for views on the directory"""
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 from ranger.ext.keybinding_parser import key_to_string
 from . import Widget
diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py
index 1496e18c..aaaba3d4 100644
--- a/ranger/gui/widgets/view_miller.py
+++ b/ranger/gui/widgets/view_miller.py
@@ -3,6 +3,8 @@
 
 """ViewMiller arranges the view in miller columns"""
 
+from __future__ import (absolute_import, print_function)
+
 import curses
 import _curses
 from ranger.container import settings
diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py
index f99b133c..ac2d5fac 100644
--- a/ranger/gui/widgets/view_multipane.py
+++ b/ranger/gui/widgets/view_multipane.py
@@ -1,6 +1,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 from ranger.gui.widgets.view_base import ViewBase
 from ranger.gui.widgets.browsercolumn import BrowserColumn
 
diff --git a/setup.py b/setup.py
index 26bb58e2..fc724416 100755
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,8 @@
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
+from __future__ import (absolute_import, print_function)
+
 import distutils.core
 import os.path
 
diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py
index 8107a71a..d5bafc6c 100644
--- a/tests/ranger/container/test_bookmarks.py
+++ b/tests/ranger/container/test_bookmarks.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, print_function)
+
 import os
 import time
 
diff --git a/tests/ranger/container/test_container.py b/tests/ranger/container/test_container.py
index 7144236f..2af96592 100644
--- a/tests/ranger/container/test_container.py
+++ b/tests/ranger/container/test_container.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, print_function)
+
 from ranger.container import history
 
 
diff --git a/tests/ranger/container/test_fsobject.py b/tests/ranger/container/test_fsobject.py
index 49c15666..8fe385c0 100644
--- a/tests/ranger/container/test_fsobject.py
+++ b/tests/ranger/container/test_fsobject.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, print_function)
+
 import operator
 
 from ranger.container.fsobject import FileSystemObject