diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py index e73df3442f..d4427a102c 100755 --- a/doc/tools/convert_papermode_to_metadata.py +++ b/doc/tools/convert_papermode_to_metadata.py @@ -9,6 +9,8 @@ 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 c4b6e736a2..69436778a9 100755 --- a/doc/tools/print_colors.py +++ b/doc/tools/print_colors.py @@ -4,6 +4,8 @@ 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 cf91559106..936d9bf015 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 72e901218b..faab234581 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 aece68f890..27afd5510c 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 dc4c3fee05..b1451be18e 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 ef87c3c570..99637272f6 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 febde8f15a..84cc57ccfa 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 1c69b8419c..0e44cdd363 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 2dd50257a5..fefeaad90e 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 6cd325f734..5db85385ac 100644 --- a/examples/plugin_pmount.py +++ b/examples/plugin_pmount.py @@ -9,6 +9,8 @@ # alt+shift+m : unmount /dev/sd # alt+shift+n : list the devices +from __future__ import (absolute_import, print_function) + import ranger.api MOUNT_KEY = 'm' diff --git a/ranger.py b/ranger.py index f8c0021333..3aa62eec7d 100755 --- a/ranger.py +++ b/ranger.py @@ -20,10 +20,12 @@ 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 @@ 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 e8f05c4d9c..6f41eb987b 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -8,6 +8,8 @@ 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 3c7818b850..992dfc2062 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 1d833ddae8..2160dbd722 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 3161a2c6e6..a2bf4e8cb9 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 557b6075c1..9ccb6ff244 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 b56bb6ed73..00f51d5c0a 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 315b425964..2e0a004f10 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 09d66bff62..0cfcb86de6 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 98af27e3f0..5fed15aced 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 4333823cc9..8d0e6256f5 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 6b188de021..fd7fc017c6 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 fbae9a9375..44ca45fe95 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 f6ab880cee..a746345c26 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 f4d84bc191..bfc3b0c49d 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 c72d5c3be9..857f12b62c 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 b135612ab9..9bbc777adf 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 128f984e22..2e5623f38e 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 7473fd78c6..68fc48842d 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 8535a17c09..f7a58b64f3 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 b79351c45e..97c6d4e647 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 , 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 862e01b417..6c4efc3649 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.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 48e3a6f09d..3cd1b9c5cb 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 1d0e1cd5ae..b2a1be3aad 100644 --- a/ranger/core/metadata.py +++ b/ranger/core/metadata.py @@ -11,6 +11,8 @@ # 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 1a9c81938c..a0eb161ffe 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -22,6 +22,8 @@ (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 764c238430..3595aedeb2 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 5634811174..60097cedde 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 dcbfb4d9c0..d75363cacd 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 3c26d4f98f..c5a4cb479b 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 d220d99c7a..e31503b886 100644 --- a/ranger/ext/curses_interrupt_handler.py +++ b/ranger/ext/curses_interrupt_handler.py @@ -8,6 +8,8 @@ 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 3de7e1c3c0..f4f2c9f9e4 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -18,6 +18,8 @@ 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 385ec45d57..e077d1494b 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 e4b04525a7..71bc29b88b 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 4a12446e17..aff6bb290e 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -9,6 +9,8 @@ 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 a18276b9b0..70b74c39cc 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 ec9d80348f..7430dfcf04 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 43dc65afd9..2fbe0cfde2 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 c8d887d003..ce77360d4e 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 69a277af9e..6c59b1072e 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 c408b35d1b..4ff9be24c1 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 4c4f7f1378..19d10ebc69 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 82997f0ce9..119ce46a66 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 247d131877..85eb746e69 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 842f289e47..2f6c88239e 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -14,6 +14,8 @@ 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 5cea1ec53b..17ad47a52a 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 f00e992d55..737ebec2ac 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 d7242a7950..83adf367e4 100644 --- a/ranger/ext/signals.py +++ b/ranger/ext/signals.py @@ -57,6 +57,8 @@ 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 04abfbd2d9..dae532e46d 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 26a328003a..90f9a713c4 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 d0db1faf8c..0f0c858de9 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 06e066d217..640d8bfe5d 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 2146097541..94d0f749b5 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 1f09cd5265..ceac84cfa6 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 1d9687dab9..dbc2eace7d 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 603439cb5d..f98b156239 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 184c04fbca..4d6cbeb500 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 91fdff2433..c1fd6ff94d 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 786299a3c0..cc2e9a5230 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -13,6 +13,8 @@ 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 363d4da3f9..e5909a0981 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -24,6 +24,8 @@ 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 be118655b1..dd1320f545 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 3213d097d8..398a9711dd 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 1eef8f4120..99d119aa9d 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 be25463e43..b479e383c8 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 90dee4c994..bc3f024d4e 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 ae515ae13c..3dde76a6ec 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 fa6c89fea4..ae59273b64 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 1909062044..7558183a5c 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 fabf6113b3..e214b587bb 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 ead79e5d3a..632a17591b 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -8,6 +8,8 @@ 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 803b4ae41d..2e913f9500 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 3f96e094cb..a9f2caafad 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 d6652ef5d5..3ec01c7239 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 1496e18c8e..aaaba3d466 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 f99b133cda..ac2d5fac05 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 26bb58e290..fc72441668 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 8107a71ab9..d5bafc6cfe 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 7144236f7b..2af9659213 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 49c15666c8..8fe385c0ec 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