Skip to content

Commit

Permalink
linting: Python 2 compat: Import from __future__
Browse files Browse the repository at this point in the history
  • Loading branch information
nfnty committed Jan 17, 2017
1 parent 916c239 commit e52629c
Show file tree
Hide file tree
Showing 89 changed files with 187 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/tools/convert_papermode_to_metadata.py
Expand Up @@ -9,6 +9,8 @@
limited, so .metadata.json files were introduced.
"""

from __future__ import (absolute_import, print_function)

import csv
import json
import os
Expand Down
2 changes: 2 additions & 0 deletions doc/tools/print_colors.py
Expand Up @@ -4,6 +4,8 @@
It will exit after a keypress.
"""

from __future__ import (absolute_import, print_function)

import curses


Expand Down
2 changes: 2 additions & 0 deletions doc/tools/print_keys.py
Expand Up @@ -3,6 +3,8 @@
You can use this tool to find out values of keypresses
"""

from __future__ import (absolute_import, print_function)

import curses


Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_chmod_keybindings.py
Expand Up @@ -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


Expand Down
3 changes: 3 additions & 0 deletions examples/plugin_file_filter.py
Expand Up @@ -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


Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_hello_world.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_ipc.py
Expand Up @@ -7,6 +7,8 @@
# Example:
# $ echo tab_new ~/images > /tmp/ranger-ipc.1234

from __future__ import (absolute_import, print_function)

import ranger.api


Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_linemode.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_new_macro.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_new_sorting_method.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin_pmount.py
Expand Up @@ -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'
Expand Down
10 changes: 6 additions & 4 deletions ranger.py
Expand Up @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions ranger/__init__.py
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions ranger/api/__init__.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/api/commands.py
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ranger/api/options.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions 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,
Expand Down
2 changes: 2 additions & 0 deletions 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

Expand Down
2 changes: 2 additions & 0 deletions 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

Expand Down
2 changes: 2 additions & 0 deletions ranger/colorschemes/solarized.py
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions ranger/config/commands.py
Expand Up @@ -83,6 +83,8 @@
# of ranger.
# ===================================================================

from __future__ import (absolute_import, print_function)

from collections import deque
import os
import re
Expand Down
2 changes: 2 additions & 0 deletions ranger/config/commands_sample.py
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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

Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions ranger/container/history.py
Expand Up @@ -3,6 +3,8 @@

# TODO: rewrite to use deque instead of list

from __future__ import (absolute_import, print_function)


class HistoryEmptyException(Exception):
pass
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions ranger/container/tags.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/actions.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/fm.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/linemode.py
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion 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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/main.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/metadata.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/runner.py
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ranger/core/shared.py
Expand Up @@ -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


Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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


Expand Down
2 changes: 2 additions & 0 deletions 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 = {}
Expand Down
2 changes: 2 additions & 0 deletions ranger/ext/curses_interrupt_handler.py
Expand Up @@ -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

Expand Down

0 comments on commit e52629c

Please sign in to comment.