diff options
Diffstat (limited to 'ranger/ext')
-rw-r--r-- | ranger/ext/direction.py | 4 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 16 | ||||
-rw-r--r-- | ranger/ext/keybinding_parser.py | 4 | ||||
-rw-r--r-- | ranger/ext/logutils.py | 2 | ||||
-rw-r--r-- | ranger/ext/openstruct.py | 3 | ||||
-rw-r--r-- | ranger/ext/spawn.py | 3 | ||||
-rw-r--r-- | ranger/ext/vcs/bzr.py | 2 | ||||
-rw-r--r-- | ranger/ext/vcs/git.py | 5 |
8 files changed, 19 insertions, 20 deletions
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index f4f2c9f9..5d2341c2 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -54,7 +54,7 @@ class Direction(dict): return fallback def up(self): # pylint: disable=invalid-name - return -Direction.down(self) + return -Direction.down(self) # pylint: disable=invalid-unary-operand-type def down(self): return Direction._get_direction(self, 'down', 'up') @@ -66,7 +66,7 @@ class Direction(dict): return Direction._get_bool(self, 'absolute', 'relative') def left(self): - return -Direction.right(self) + return -Direction.right(self) # pylint: disable=invalid-unary-operand-type def relative(self): return not Direction.absolute(self) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index e1141409..01f61369 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -135,8 +135,7 @@ class W3MImageDisplayer(ImageDisplayer): except IOError as ex: if ex.errno == errno.EPIPE: return - else: - raise ex + raise self.process.stdin.flush() self.process.stdout.readline() @@ -245,16 +244,15 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware): max_scale = max(width_scale, height_scale) if width * max_scale <= max_width and height * max_scale <= max_height: return width * max_scale - else: - return width * min_scale - else: - scale = max_height / float(height) - return width * scale + return width * min_scale + + scale = max_height / float(height) + return width * scale elif width > max_width: scale = max_width / float(width) return width * scale - else: - return width + + return width @staticmethod def _encode_image_content(path): diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 7430dfcf..b7816cf3 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -111,8 +111,8 @@ def parse_keybinding(obj): # pylint: disable=too-many-branches yield int(string) else: yield ord('<') - for char in bracket_content: - yield ord(char) + for bracket_char in bracket_content: + yield ord(bracket_char) yield ord('>') except TypeError: yield keys # it was no tuple, just an int diff --git a/ranger/ext/logutils.py b/ranger/ext/logutils.py index ce77360d..ff27b420 100644 --- a/ranger/ext/logutils.py +++ b/ranger/ext/logutils.py @@ -69,7 +69,7 @@ def setup_logging(debug=True, logfile=None): handlers = [] handlers.append(QueueHandler(log_queue)) if logfile: - if logfile is '-': + if logfile == '-': handlers.append(logging.StreamHandler()) else: handlers.append(logging.FileHandler(logfile)) diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py index 19d10ebc..7528ee92 100644 --- a/ranger/ext/openstruct.py +++ b/ranger/ext/openstruct.py @@ -24,5 +24,4 @@ class DefaultOpenStruct(collections.defaultdict): def __getattr__(self, name): if name not in self.__dict__: return None - else: - return self.__dict__[name] + return self.__dict__[name] diff --git a/ranger/ext/spawn.py b/ranger/ext/spawn.py index dae532e4..ffb4d94b 100644 --- a/ranger/ext/spawn.py +++ b/ranger/ext/spawn.py @@ -68,5 +68,4 @@ def spawn(*popenargs, **kwargs): """ if len(popenargs) == 1: return check_output(popenargs[0], **kwargs) - else: - return check_output(list(popenargs), **kwargs) + return check_output(list(popenargs), **kwargs) diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py index 0f0c858d..753b5d05 100644 --- a/ranger/ext/vcs/bzr.py +++ b/ranger/ext/vcs/bzr.py @@ -43,7 +43,9 @@ class Bzr(Vcs): output = self._run(args) except VcsError: return None + # pylint: disable=no-member entries = re.findall(r'-+\n(.+?)\n(?:-|\Z)', output, re.MULTILINE | re.DOTALL) + # pylint: enable=no-member log = [] for entry in entries: diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index 640d8bfe..c6cb2bf3 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -161,12 +161,13 @@ class Git(Vcs): return 'none' output = self._run(['rev-list', '--left-right', '{0:s}...{1:s}'.format(remote, head)]) + # pylint: disable=no-member ahead = re.search(r'^>', output, flags=re.MULTILINE) behind = re.search(r'^<', output, flags=re.MULTILINE) + # pylint: enable=no-member if ahead: return 'diverged' if behind else 'ahead' - else: - return 'behind' if behind else 'sync' + return 'behind' if behind else 'sync' def data_branch(self): try: |