From 9f5eeff72146d3c5178d66b4879af7a6abfc22f1 Mon Sep 17 00:00:00 2001 From: nfnty Date: Sat, 21 Jan 2017 22:30:59 +0100 Subject: Python 3 division: Import `division` from `__future__` --- doc/tools/convert_papermode_to_metadata.py | 2 +- doc/tools/print_colors.py | 2 +- doc/tools/print_keys.py | 2 +- examples/plugin_chmod_keybindings.py | 2 +- examples/plugin_file_filter.py | 2 +- examples/plugin_hello_world.py | 2 +- examples/plugin_ipc.py | 2 +- examples/plugin_linemode.py | 2 +- examples/plugin_new_macro.py | 2 +- examples/plugin_new_sorting_method.py | 2 +- examples/plugin_pmount.py | 2 +- ranger.py | 2 +- ranger/__init__.py | 2 +- ranger/api/__init__.py | 2 +- ranger/api/commands.py | 2 +- ranger/api/options.py | 2 +- ranger/colorschemes/default.py | 2 +- ranger/colorschemes/jungle.py | 2 +- ranger/colorschemes/snow.py | 2 +- ranger/colorschemes/solarized.py | 2 +- ranger/config/commands.py | 2 +- ranger/config/commands_sample.py | 2 +- ranger/container/bookmarks.py | 2 +- ranger/container/directory.py | 2 +- ranger/container/file.py | 2 +- ranger/container/fsobject.py | 2 +- ranger/container/history.py | 2 +- ranger/container/settings.py | 2 +- ranger/container/tags.py | 2 +- ranger/core/actions.py | 2 +- ranger/core/fm.py | 2 +- ranger/core/linemode.py | 2 +- ranger/core/loader.py | 2 +- ranger/core/main.py | 2 +- ranger/core/metadata.py | 2 +- ranger/core/runner.py | 2 +- ranger/core/shared.py | 2 +- ranger/core/tab.py | 2 +- ranger/ext/accumulator.py | 2 +- ranger/ext/cached_function.py | 2 +- ranger/ext/curses_interrupt_handler.py | 2 +- ranger/ext/direction.py | 2 +- ranger/ext/get_executables.py | 2 +- ranger/ext/human_readable.py | 2 +- ranger/ext/img_display.py | 2 +- ranger/ext/iter_tools.py | 2 +- ranger/ext/keybinding_parser.py | 2 +- ranger/ext/lazy_property.py | 2 +- ranger/ext/logutils.py | 2 +- ranger/ext/mount_path.py | 2 +- ranger/ext/next_available_filename.py | 2 +- ranger/ext/openstruct.py | 2 +- ranger/ext/popen_forked.py | 2 +- ranger/ext/relative_symlink.py | 2 +- ranger/ext/rifle.py | 2 +- ranger/ext/shell_escape.py | 2 +- ranger/ext/shutil_generatorized.py | 2 +- ranger/ext/signals.py | 2 +- ranger/ext/spawn.py | 2 +- ranger/ext/vcs/__init__.py | 2 +- ranger/ext/vcs/bzr.py | 2 +- ranger/ext/vcs/git.py | 2 +- ranger/ext/vcs/hg.py | 2 +- ranger/ext/vcs/svn.py | 2 +- ranger/ext/vcs/vcs.py | 2 +- ranger/ext/widestring.py | 2 +- ranger/gui/ansi.py | 2 +- ranger/gui/bar.py | 2 +- ranger/gui/color.py | 2 +- ranger/gui/colorscheme.py | 2 +- ranger/gui/context.py | 2 +- ranger/gui/curses_shortcuts.py | 2 +- ranger/gui/displayable.py | 2 +- ranger/gui/mouse_event.py | 2 +- ranger/gui/ui.py | 2 +- ranger/gui/widgets/__init__.py | 2 +- ranger/gui/widgets/browsercolumn.py | 2 +- ranger/gui/widgets/console.py | 2 +- ranger/gui/widgets/pager.py | 2 +- ranger/gui/widgets/statusbar.py | 2 +- ranger/gui/widgets/taskview.py | 2 +- ranger/gui/widgets/titlebar.py | 2 +- ranger/gui/widgets/view_base.py | 2 +- ranger/gui/widgets/view_miller.py | 2 +- ranger/gui/widgets/view_multipane.py | 2 +- setup.py | 2 +- tests/ranger/container/test_bookmarks.py | 2 +- tests/ranger/container/test_container.py | 2 +- tests/ranger/container/test_fsobject.py | 2 +- 89 files changed, 89 insertions(+), 89 deletions(-) diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py index d4427a10..e4010a73 100755 --- a/doc/tools/convert_papermode_to_metadata.py +++ b/doc/tools/convert_papermode_to_metadata.py @@ -9,7 +9,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import csv import json diff --git a/doc/tools/print_colors.py b/doc/tools/print_colors.py index 69436778..65625cb5 100755 --- a/doc/tools/print_colors.py +++ b/doc/tools/print_colors.py @@ -4,7 +4,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import curses diff --git a/doc/tools/print_keys.py b/doc/tools/print_keys.py index 936d9bf0..900a478c 100755 --- a/doc/tools/print_keys.py +++ b/doc/tools/print_keys.py @@ -3,7 +3,7 @@ You can use this tool to find out values of keypresses """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import curses diff --git a/examples/plugin_chmod_keybindings.py b/examples/plugin_chmod_keybindings.py index faab2345..0041a0c2 100644 --- a/examples/plugin_chmod_keybindings.py +++ b/examples/plugin_chmod_keybindings.py @@ -4,7 +4,7 @@ # 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) +from __future__ import (absolute_import, division, print_function) import ranger.api diff --git a/examples/plugin_file_filter.py b/examples/plugin_file_filter.py index f5c474c5..df7d8c4b 100644 --- a/examples/plugin_file_filter.py +++ b/examples/plugin_file_filter.py @@ -5,7 +5,7 @@ # Save the original filter function -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import ranger.container.directory diff --git a/examples/plugin_hello_world.py b/examples/plugin_hello_world.py index b1451be1..be21d777 100644 --- a/examples/plugin_hello_world.py +++ b/examples/plugin_hello_world.py @@ -3,7 +3,7 @@ # This is a sample plugin that displays "Hello World" in ranger's console after # it started. -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) # We are going to extend the hook "ranger.api.hook_ready", so first we need # to import ranger.api: diff --git a/examples/plugin_ipc.py b/examples/plugin_ipc.py index 99637272..c6fc60c6 100644 --- a/examples/plugin_ipc.py +++ b/examples/plugin_ipc.py @@ -7,7 +7,7 @@ # Example: # $ echo tab_new ~/images > /tmp/ranger-ipc.1234 -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import ranger.api diff --git a/examples/plugin_linemode.py b/examples/plugin_linemode.py index 84cc57cc..52b9c60a 100644 --- a/examples/plugin_linemode.py +++ b/examples/plugin_linemode.py @@ -5,7 +5,7 @@ # the linemode by typing ":linemode rot13" in ranger. Type Mf to restore # the default linemode. -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import codecs diff --git a/examples/plugin_new_macro.py b/examples/plugin_new_macro.py index 0e44cdd3..cb4d7413 100644 --- a/examples/plugin_new_macro.py +++ b/examples/plugin_new_macro.py @@ -4,7 +4,7 @@ # date in commands that allow macros. You can test it with the command # ":shell echo %date; read" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import time diff --git a/examples/plugin_new_sorting_method.py b/examples/plugin_new_sorting_method.py index fefeaad9..d294067e 100644 --- a/examples/plugin_new_sorting_method.py +++ b/examples/plugin_new_sorting_method.py @@ -3,7 +3,7 @@ # 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 __future__ import (absolute_import, division, print_function) from random import random diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py index 5db85385..d7c88349 100644 --- a/examples/plugin_pmount.py +++ b/examples/plugin_pmount.py @@ -9,7 +9,7 @@ # alt+shift+m : unmount /dev/sd # alt+shift+n : list the devices -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import ranger.api diff --git a/ranger.py b/ranger.py index 3aa62eec..0046f371 100755 --- a/ranger.py +++ b/ranger.py @@ -22,7 +22,7 @@ rm -f -- "$tempfile" return $returnvalue """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import sys from os.path import exists, abspath diff --git a/ranger/__init__.py b/ranger/__init__.py index a84bf3e8..8e320aee 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -8,7 +8,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import sys import os diff --git a/ranger/api/__init__.py b/ranger/api/__init__.py index 992dfc20..e933ddfa 100644 --- a/ranger/api/__init__.py +++ b/ranger/api/__init__.py @@ -3,7 +3,7 @@ """Files in this module contain helper functions used in configuration files.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import ranger # NOQA diff --git a/ranger/api/commands.py b/ranger/api/commands.py index 0a3ea470..25353b5b 100644 --- a/ranger/api/commands.py +++ b/ranger/api/commands.py @@ -3,7 +3,7 @@ # TODO: Add an optional "!" to all commands and set a flag if it's there -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os import re diff --git a/ranger/api/options.py b/ranger/api/options.py index a2bf4e8c..37738ce8 100644 --- a/ranger/api/options.py +++ b/ranger/api/options.py @@ -3,7 +3,7 @@ # THIS WHOLE FILE IS OBSOLETE AND EXISTS FOR BACKWARDS COMPATIBILITIY -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) # pylint: disable=unused-import import re # NOQA diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index 7f4c48c5..7d2b124f 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from ranger.gui.colorscheme import ColorScheme from ranger.gui.color import ( diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py index 00f51d5c..2dd1db85 100644 --- a/ranger/colorschemes/jungle.py +++ b/ranger/colorschemes/jungle.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, 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 2e0a004f..8e9686a8 100644 --- a/ranger/colorschemes/snow.py +++ b/ranger/colorschemes/snow.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, 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 ad57dd8a..80fa57ea 100644 --- a/ranger/colorschemes/solarized.py +++ b/ranger/colorschemes/solarized.py @@ -5,7 +5,7 @@ # 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 __future__ import (absolute_import, division, print_function) from ranger.gui.colorscheme import ColorScheme from ranger.gui.color import ( diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 962a6a98..bb20ddcb 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -83,7 +83,7 @@ # of ranger. # =================================================================== -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from collections import deque import os diff --git a/ranger/config/commands_sample.py b/ranger/config/commands_sample.py index 8d0e6256..97b79096 100644 --- a/ranger/config/commands_sample.py +++ b/ranger/config/commands_sample.py @@ -7,7 +7,7 @@ # A simple command for demonstration purposes follows. # ----------------------------------------------------------------------------- -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, 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 964efcae..edffa5ae 100644 --- a/ranger/container/bookmarks.py +++ b/ranger/container/bookmarks.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import string import re diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 6c34641e..4fbc2e29 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import locale import os.path diff --git a/ranger/container/file.py b/ranger/container/file.py index f98be1d7..e1284c1f 100644 --- a/ranger/container/file.py +++ b/ranger/container/file.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import re from ranger.container.fsobject import FileSystemObject diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index 36817ff4..fbb75e6c 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import re from grp import getgrgid diff --git a/ranger/container/history.py b/ranger/container/history.py index 5a75854e..31830b55 100644 --- a/ranger/container/history.py +++ b/ranger/container/history.py @@ -3,7 +3,7 @@ # TODO: rewrite to use deque instead of list -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) class HistoryEmptyException(Exception): diff --git a/ranger/container/settings.py b/ranger/container/settings.py index a83192ca..c42f50f2 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import re import os.path diff --git a/ranger/container/tags.py b/ranger/container/tags.py index dd13c432..0cab299f 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -3,7 +3,7 @@ # TODO: add a __getitem__ method to get the tag of a file -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from os.path import isdir, exists, dirname, abspath, realpath, expanduser import string diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 070bda8c..5e840058 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -3,7 +3,7 @@ # pylint: disable=too-many-lines,attribute-defined-outside-init -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import codecs import os diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 9b7c8fae..87c8b9f1 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -3,7 +3,7 @@ """The File Manager, putting the pieces together""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from time import time from collections import deque diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py index 8b225787..8d53a9f8 100644 --- a/ranger/core/linemode.py +++ b/ranger/core/linemode.py @@ -3,7 +3,7 @@ # License: GNU GPL version 3, see the file "AUTHORS" for details. # Author: Wojciech Siewierski , 2015 -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import sys diff --git a/ranger/core/loader.py b/ranger/core/loader.py index db1f0651..32c4e2b6 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from collections import deque from subprocess import Popen, PIPE diff --git a/ranger/core/main.py b/ranger/core/main.py index b3173da2..bd837aa1 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -3,7 +3,7 @@ """The main function responsible to initialize the FM object and stuff.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os.path import sys diff --git a/ranger/core/metadata.py b/ranger/core/metadata.py index 76ff2bb9..28b1f5b7 100644 --- a/ranger/core/metadata.py +++ b/ranger/core/metadata.py @@ -11,7 +11,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import copy from os.path import join, dirname, exists, basename diff --git a/ranger/core/runner.py b/ranger/core/runner.py index ee182c29..6fc7b60d 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -22,7 +22,7 @@ t: run application in a new terminal window (An uppercase key negates the respective lower case flag) """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os import sys diff --git a/ranger/core/shared.py b/ranger/core/shared.py index 3595aede..73b42aad 100644 --- a/ranger/core/shared.py +++ b/ranger/core/shared.py @@ -3,7 +3,7 @@ """Shared objects contain singletons for shared use.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, 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 60097ced..26f634da 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import os from os.path import abspath, normpath, join, expanduser, isdir diff --git a/ranger/ext/accumulator.py b/ranger/ext/accumulator.py index d75363ca..b0e4a1c5 100644 --- a/ranger/ext/accumulator.py +++ b/ranger/ext/accumulator.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from ranger.ext.direction import Direction diff --git a/ranger/ext/cached_function.py b/ranger/ext/cached_function.py index c5a4cb47..643b6304 100644 --- a/ranger/ext/cached_function.py +++ b/ranger/ext/cached_function.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) def cached_function(fnc): diff --git a/ranger/ext/curses_interrupt_handler.py b/ranger/ext/curses_interrupt_handler.py index e31503b8..296b5056 100644 --- a/ranger/ext/curses_interrupt_handler.py +++ b/ranger/ext/curses_interrupt_handler.py @@ -8,7 +8,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import curses import signal diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index 5d2341c2..12d82eb0 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -18,7 +18,7 @@ has been defined. False """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) class Direction(dict): diff --git a/ranger/ext/get_executables.py b/ranger/ext/get_executables.py index e077d149..86296a2a 100644 --- a/ranger/ext/get_executables.py +++ b/ranger/ext/get_executables.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from stat import S_IXOTH, S_IFREG from os import listdir, environ, stat diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py index 71bc29b8..ace380dc 100644 --- a/ranger/ext/human_readable.py +++ b/ranger/ext/human_readable.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) def human_readable(byte, separator=' '): # pylint: disable=too-many-return-statements diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 7c75214e..2893e391 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -9,7 +9,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import base64 import curses diff --git a/ranger/ext/iter_tools.py b/ranger/ext/iter_tools.py index 70b74c39..f321aee0 100644 --- a/ranger/ext/iter_tools.py +++ b/ranger/ext/iter_tools.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from collections import deque diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index b7816cf3..34282767 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import sys import copy diff --git a/ranger/ext/lazy_property.py b/ranger/ext/lazy_property.py index 2fbe0cfd..92dc309d 100644 --- a/ranger/ext/lazy_property.py +++ b/ranger/ext/lazy_property.py @@ -1,6 +1,6 @@ # From http://blog.pythonisito.com/2008/08/lazy-descriptors.html -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) class lazy_property(object): # pylint: disable=invalid-name,too-few-public-methods diff --git a/ranger/ext/logutils.py b/ranger/ext/logutils.py index ff27b420..b00aa605 100644 --- a/ranger/ext/logutils.py +++ b/ranger/ext/logutils.py @@ -1,4 +1,4 @@ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import logging from collections import deque diff --git a/ranger/ext/mount_path.py b/ranger/ext/mount_path.py index 6c59b107..62092dda 100644 --- a/ranger/ext/mount_path.py +++ b/ranger/ext/mount_path.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, 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 4ff9be24..91d48631 100644 --- a/ranger/ext/next_available_filename.py +++ b/ranger/ext/next_available_filename.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import os.path diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py index 7528ee92..8e399f47 100644 --- a/ranger/ext/openstruct.py +++ b/ranger/ext/openstruct.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import collections diff --git a/ranger/ext/popen_forked.py b/ranger/ext/popen_forked.py index 119ce46a..bff1818e 100644 --- a/ranger/ext/popen_forked.py +++ b/ranger/ext/popen_forked.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import os import subprocess diff --git a/ranger/ext/relative_symlink.py b/ranger/ext/relative_symlink.py index 85eb746e..b43f3a3a 100644 --- a/ranger/ext/relative_symlink.py +++ b/ranger/ext/relative_symlink.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from os import symlink, sep diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 6c5d70be..551dd288 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -14,7 +14,7 @@ Example usage: rifle.execute(["file1", "file2"]) """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os.path import re diff --git a/ranger/ext/shell_escape.py b/ranger/ext/shell_escape.py index 64ddb086..a652fab1 100644 --- a/ranger/ext/shell_escape.py +++ b/ranger/ext/shell_escape.py @@ -3,7 +3,7 @@ """Functions to escape metacharacters of arguments for shell commands.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) META_CHARS = (' ', "'", '"', '`', '&', '|', ';', '#', diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py index 85d1d698..338ed5b8 100644 --- a/ranger/ext/shutil_generatorized.py +++ b/ranger/ext/shutil_generatorized.py @@ -5,7 +5,7 @@ XXX The functions here don't copy the resource fork or other metadata on Mac. """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os from os.path import abspath diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py index 83adf367..4d2ee25e 100644 --- a/ranger/ext/signals.py +++ b/ranger/ext/signals.py @@ -57,7 +57,7 @@ True True """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import weakref from types import MethodType diff --git a/ranger/ext/spawn.py b/ranger/ext/spawn.py index ffb4d94b..dacb3c4a 100644 --- a/ranger/ext/spawn.py +++ b/ranger/ext/spawn.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) from os import devnull from subprocess import Popen, PIPE, CalledProcessError diff --git a/ranger/ext/vcs/__init__.py b/ranger/ext/vcs/__init__.py index 90f9a713..e6bc5f22 100644 --- a/ranger/ext/vcs/__init__.py +++ b/ranger/ext/vcs/__init__.py @@ -3,7 +3,7 @@ """VCS Extension""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from .vcs import Vcs, VcsError, VcsThread diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py index 753b5d05..dc5a90fb 100644 --- a/ranger/ext/vcs/bzr.py +++ b/ranger/ext/vcs/bzr.py @@ -3,7 +3,7 @@ """GNU Bazaar module""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from datetime import datetime import os diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index c6cb2bf3..e5f74ee1 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -3,7 +3,7 @@ """Git module""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from datetime import datetime import os diff --git a/ranger/ext/vcs/hg.py b/ranger/ext/vcs/hg.py index 94d0f749..f94ded35 100644 --- a/ranger/ext/vcs/hg.py +++ b/ranger/ext/vcs/hg.py @@ -3,7 +3,7 @@ """Mercurial module""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from datetime import datetime import json diff --git a/ranger/ext/vcs/svn.py b/ranger/ext/vcs/svn.py index ceac84cf..ef958a24 100644 --- a/ranger/ext/vcs/svn.py +++ b/ranger/ext/vcs/svn.py @@ -3,7 +3,7 @@ """Subversion module""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from datetime import datetime import os diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index dbc2eace..8b13badd 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -3,7 +3,7 @@ """VCS module""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os import subprocess diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py index caab1c80..23e3d050 100644 --- a/ranger/ext/widestring.py +++ b/ranger/ext/widestring.py @@ -2,7 +2,7 @@ # 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 __future__ import (absolute_import, division, print_function) import sys from unicodedata import east_asian_width diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py index e68e780a..4bfaa0a0 100644 --- a/ranger/gui/ansi.py +++ b/ranger/gui/ansi.py @@ -4,7 +4,7 @@ """A library to help to convert ANSI codes to curses instructions.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import re diff --git a/ranger/gui/bar.py b/ranger/gui/bar.py index 730b7e27..64bd6ce1 100644 --- a/ranger/gui/bar.py +++ b/ranger/gui/bar.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import sys diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 06ed4d3a..7f2b73af 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -13,7 +13,7 @@ attr ^= reverse bool(attr & reverse) # => False """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import curses diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index 9bd96b17..c5aa0e31 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -24,7 +24,7 @@ Define which colorscheme in your settings (e.g. ~/.config/ranger/rc.conf): set colorscheme yourschemename """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os.path from curses import color_pair diff --git a/ranger/gui/context.py b/ranger/gui/context.py index dec00892..7c7f1727 100644 --- a/ranger/gui/context.py +++ b/ranger/gui/context.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) CONTEXT_KEYS = [ diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index 25a9d947..2c411058 100644 --- a/ranger/gui/curses_shortcuts.py +++ b/ranger/gui/curses_shortcuts.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import sys import curses diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index 16c78a91..2ce23165 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, 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 5a5f687f..160351d3 100644 --- a/ranger/gui/mouse_event.py +++ b/ranger/gui/mouse_event.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import curses diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 97938453..6c84580b 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, print_function) import os import sys diff --git a/ranger/gui/widgets/__init__.py b/ranger/gui/widgets/__init__.py index 7fa796f6..36292103 100644 --- a/ranger/gui/widgets/__init__.py +++ b/ranger/gui/widgets/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from ranger.gui.displayable import Displayable diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 222457c2..6f890dab 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -3,7 +3,7 @@ """The BrowserColumn widget displays the contents of a directory or file.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import stat from time import time diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 3c056aa9..0fa941d4 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -3,7 +3,7 @@ """The Console widget implements a vim-like console""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import curses import re diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 4182b189..2ecf65c0 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -3,7 +3,7 @@ """The pager displays text and allows you to scroll inside it.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from ranger.gui import ansi from ranger.ext.direction import Direction diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index bb0b2d4c..47a9ca9f 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -8,7 +8,7 @@ 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) +from __future__ import (absolute_import, division, print_function) import os from os import getuid, readlink diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py index d7c5571b..bedd9e4e 100644 --- a/ranger/gui/widgets/taskview.py +++ b/ranger/gui/widgets/taskview.py @@ -3,7 +3,7 @@ """The TaskView allows you to modify what the loader is doing.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from ranger.ext.accumulator import Accumulator diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index fc5aeeab..425dd64c 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -6,7 +6,7 @@ It displays the current path among other things. """ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from os.path import basename diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py index 001f40b3..8807628b 100644 --- a/ranger/gui/widgets/view_base.py +++ b/ranger/gui/widgets/view_base.py @@ -3,7 +3,7 @@ """The base GUI element for views on the directory""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import curses from ranger.ext.keybinding_parser import key_to_string diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 47e66060..da6b529f 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -3,7 +3,7 @@ """ViewMiller arranges the view in miller columns""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import curses import _curses diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index ac2d5fac..6b3d9232 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -1,7 +1,7 @@ # 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 __future__ import (absolute_import, division, 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 6e86a516..5bbafd5d 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # 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 __future__ import (absolute_import, division, print_function) import distutils.core # pylint: disable=import-error,no-name-in-module import os.path diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py index d5bafc6c..6fba2a3d 100644 --- a/tests/ranger/container/test_bookmarks.py +++ b/tests/ranger/container/test_bookmarks.py @@ -1,4 +1,4 @@ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import os import time diff --git a/tests/ranger/container/test_container.py b/tests/ranger/container/test_container.py index 2af96592..b5a1b389 100644 --- a/tests/ranger/container/test_container.py +++ b/tests/ranger/container/test_container.py @@ -1,4 +1,4 @@ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) from ranger.container import history diff --git a/tests/ranger/container/test_fsobject.py b/tests/ranger/container/test_fsobject.py index 8fe385c0..2c6a693f 100644 --- a/tests/ranger/container/test_fsobject.py +++ b/tests/ranger/container/test_fsobject.py @@ -1,4 +1,4 @@ -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) import operator -- cgit 1.4.1-2-gfad0 From 4fc54db1bcb243504cdc41cee3885342b94cb13a Mon Sep 17 00:00:00 2001 From: nfnty Date: Sat, 21 Jan 2017 22:51:56 +0100 Subject: Python 3 division: Remove explicit float conversions --- ranger/core/loader.py | 6 +++--- ranger/ext/direction.py | 2 +- ranger/ext/human_readable.py | 20 ++++++++++---------- ranger/ext/img_display.py | 8 ++++---- ranger/gui/widgets/statusbar.py | 4 ++-- ranger/gui/widgets/taskview.py | 2 +- ranger/gui/widgets/view_miller.py | 4 ++-- ranger/gui/widgets/view_multipane.py | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 32c4e2b6..022dfe6b 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -105,7 +105,7 @@ class CopyLoader(Loadable, FileManagerAware): # pylint: disable=too-many-instan n = 0 for n in shutil_g.move(src=fobj.path, dst=self.original_path, overwrite=self.overwrite): - self.percent = float(done + n) / size * 100. + self.percent = ((done + n) / size) * 100. yield done += n else: @@ -122,14 +122,14 @@ class CopyLoader(Loadable, FileManagerAware): # pylint: disable=too-many-instan symlinks=True, overwrite=self.overwrite, ): - self.percent = float(done + n) / size * 100. + self.percent = ((done + n) / size) * 100. yield done += n else: n = 0 for n in shutil_g.copy2(fobj.path, self.original_path, symlinks=True, overwrite=self.overwrite): - self.percent = float(done + n) / size * 100. + self.percent = ((done + n) / size) * 100. yield done += n cwd = self.fm.get_directory(self.original_path) diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index 12d82eb0..ecde944a 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -133,7 +133,7 @@ class Direction(dict): if self.pages(): pos *= pagesize elif self.percentage(): - pos *= maximum / 100.0 + pos *= maximum / 100 if self.absolute(): if pos < minimum: pos += maximum diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py index ace380dc..df74eabf 100644 --- a/ranger/ext/human_readable.py +++ b/ranger/ext/human_readable.py @@ -23,25 +23,25 @@ def human_readable(byte, separator=' '): # pylint: disable=too-many-return-stat if byte < 2**10: return '%d%sB' % (byte, separator) if byte < 2**10 * 999: - return '%.3g%sK' % (byte / 2**10.0, separator) + return '%.3g%sK' % ((byte / 2**10), separator) if byte < 2**20: - return '%.4g%sK' % (byte / 2**10.0, separator) + return '%.4g%sK' % ((byte / 2**10), separator) if byte < 2**20 * 999: - return '%.3g%sM' % (byte / 2**20.0, separator) + return '%.3g%sM' % ((byte / 2**20), separator) if byte < 2**30: - return '%.4g%sM' % (byte / 2**20.0, separator) + return '%.4g%sM' % ((byte / 2**20), separator) if byte < 2**30 * 999: - return '%.3g%sG' % (byte / 2**30.0, separator) + return '%.3g%sG' % ((byte / 2**30), separator) if byte < 2**40: - return '%.4g%sG' % (byte / 2**30.0, separator) + return '%.4g%sG' % ((byte / 2**30), separator) if byte < 2**40 * 999: - return '%.3g%sT' % (byte / 2**40.0, separator) + return '%.3g%sT' % ((byte / 2**40), separator) if byte < 2**50: - return '%.4g%sT' % (byte / 2**40.0, separator) + return '%.4g%sT' % ((byte / 2**40), separator) if byte < 2**50 * 999: - return '%.3g%sP' % (byte / 2**50.0, separator) + return '%.3g%sP' % ((byte / 2**50), separator) if byte < 2**60: - return '%.4g%sP' % (byte / 2**50.0, separator) + return '%.4g%sP' % ((byte / 2**50), separator) return '>9000' diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 2893e391..1b20cc7b 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -238,18 +238,18 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware): max_height = self._minimum_font_height * max_rows if height > max_height: if width > max_width: - width_scale = max_width / float(width) - height_scale = max_height / float(height) + width_scale = max_width / width + height_scale = max_height / height min_scale = min(width_scale, height_scale) max_scale = max(width_scale, height_scale) if width * max_scale <= max_width and height * max_scale <= max_height: return width * max_scale return width * min_scale - scale = max_height / float(height) + scale = max_height / height return width * scale elif width > max_width: - scale = max_width / float(width) + scale = max_width / width return width * scale return width diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 47a9ca9f..c9133415 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -295,7 +295,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes elif pos >= max_pos: right.add('Bot', base, 'bot') else: - right.add('{0:0.0%}'.format(float(pos) / max_pos), + right.add('{0:0.0%}'.format((pos / max_pos)), base, 'percentage') else: right.add('0/0 All', base, 'all') @@ -314,7 +314,7 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes states.append(item.percent) if states: state = sum(states) / len(states) - barwidth = state / 100.0 * self.wid + barwidth = (state / 100) * self.wid self.color_at(0, 0, int(barwidth), ("in_statusbar", "loaded")) self.color_reset() diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py index bedd9e4e..2c0cafb0 100644 --- a/ranger/gui/widgets/taskview.py +++ b/ranger/gui/widgets/taskview.py @@ -55,7 +55,7 @@ class TaskView(Widget, Accumulator): descr = obj.get_description() if obj.progressbar_supported and obj.percent >= 0 and obj.percent <= 100: self.addstr(y, 0, "%3.2f%% - %s" % (obj.percent, descr), self.wid) - wid = int(self.wid / 100.0 * obj.percent) + wid = int((self.wid / 100) * obj.percent) self.color_at(y, 0, self.wid, tuple(clr)) self.color_at(y, 0, wid, tuple(clr), 'loaded') else: diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index da6b529f..569b93fa 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -56,8 +56,8 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta self.remove_child(column) self.columns = [] - ratio_sum = float(sum(ratios)) - self.ratios = tuple(x / ratio_sum for x in ratios) + ratios_sum = sum(ratios) + self.ratios = tuple((x / ratios_sum) for x in ratios) last = 0.1 if self.settings.padding_right else 0 if len(self.ratios) >= 2: diff --git a/ranger/gui/widgets/view_multipane.py b/ranger/gui/widgets/view_multipane.py index 6b3d9232..9661d31e 100644 --- a/ranger/gui/widgets/view_multipane.py +++ b/ranger/gui/widgets/view_multipane.py @@ -45,7 +45,7 @@ class ViewMultipane(ViewBase): # pylint: disable=too-many-ancestors def resize(self, y, x, hei=None, wid=None): ViewBase.resize(self, y, x, hei, wid) - column_width = int((float(wid) - len(self.columns) + 1) / len(self.columns)) + column_width = int((wid - len(self.columns) + 1) / len(self.columns)) left = 0 top = 0 for column in self.columns: -- cgit 1.4.1-2-gfad0