diff options
author | nfnty <git@nfnty.se> | 2017-01-21 22:56:06 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-21 22:56:06 +0100 |
commit | e53369588ee44a9fc4ec75228dc041448aa778d4 (patch) | |
tree | 5cddf5caef27797e921a180d3aeaf2ce880f08bf /ranger | |
parent | 1c90e610de6591e8052a1056c775219b5e767002 (diff) | |
parent | 4fc54db1bcb243504cdc41cee3885342b94cb13a (diff) | |
download | ranger-e53369588ee44a9fc4ec75228dc041448aa778d4.tar.gz |
Merge branch 'division'
Diffstat (limited to 'ranger')
73 files changed, 97 insertions, 97 deletions
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 <wojciech.siewierski@onet.pl>, 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..022dfe6b 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 @@ -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/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..ecde944a 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): @@ -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/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..df74eabf 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 @@ -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 7c75214e..1b20cc7b 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 @@ -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/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..c9133415 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 @@ -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 d7c5571b..2c0cafb0 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 @@ -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/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..569b93fa 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 @@ -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 ac2d5fac..9661d31e 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 @@ -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: |