From b1d93d5cfc8338a429d7af0b685199c0b0315854 Mon Sep 17 00:00:00 2001 From: toonn Date: Sat, 21 Apr 2018 19:17:46 +0200 Subject: MISSION CRITICAL update to adhere to pep8 Pep8 was changed to recommend breaking lines *before* rather than after binary operators. This patch makes everything right with the universe. Fixes #1145 --- ranger/container/directory.py | 5 +++-- ranger/core/main.py | 4 ++-- ranger/ext/direction.py | 4 ++-- ranger/ext/img_display.py | 16 ++++++++-------- ranger/gui/widgets/browsercolumn.py | 4 ++-- ranger/gui/widgets/view_base.py | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 18b1687c..e281e6c9 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -338,8 +338,9 @@ class Directory( # pylint: disable=too-many-instance-attributes,too-many-public dirlist = [ os.path.join("/", dirpath, d) for d in dirnames - if self.flat == -1 or - (dirpath.count(os.path.sep) - mypath.count(os.path.sep)) <= self.flat + if self.flat == -1 + or (dirpath.count(os.path.sep) + - mypath.count(os.path.sep)) <= self.flat ] filelist += dirlist filelist += [os.path.join("/", dirpath, f) for f in filenames] diff --git a/ranger/core/main.py b/ranger/core/main.py index 4adea918..9a7a554d 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -397,8 +397,8 @@ def load_settings( # pylint: disable=too-many-locals,too-many-branches,too-many default_conf = fm.relpath('config', 'rc.conf') custom_conf_is_readable = os.access(custom_conf, os.R_OK) - if (os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != 'FALSE' or - not custom_conf_is_readable): + if (os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != 'FALSE' + or not custom_conf_is_readable): fm.source(default_conf) if custom_conf_is_readable: fm.source(custom_conf) diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index 7df45556..33ebb604 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -97,8 +97,8 @@ class Direction(dict): return self.get('cycle') in (True, 'true', 'on', 'yes') def one_indexed(self): - return ('one_indexed' in self and - self.get('one_indexed') in (True, 'true', 'on', 'yes')) + return ('one_indexed' in self + and self.get('one_indexed') in (True, 'true', 'on', 'yes')) def multiply(self, n): for key in ('up', 'right', 'down', 'left'): diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 67941e27..78d71cb2 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -434,20 +434,20 @@ class URXVTImageDisplayer(ImageDisplayer, FileManagerAware): pct_width, pct_height = self._get_sizes() sys.stdout.write( - self.display_protocol + - path + - ";{pct_width}x{pct_height}+{pct_x}+{pct_y}:op=keep-aspect".format( + self.display_protocol + + path + + ";{pct_width}x{pct_height}+{pct_x}+{pct_y}:op=keep-aspect".format( pct_width=pct_width, pct_height=pct_height, pct_x=pct_x, pct_y=pct_y - ) + - self.close_protocol + ) + + self.close_protocol ) sys.stdout.flush() def clear(self, start_x, start_y, width, height): sys.stdout.write( - self.display_protocol + - ";100x100+1000+1000" + - self.close_protocol + self.display_protocol + + ";100x100+1000+1000" + + self.close_protocol ) sys.stdout.flush() diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index b3272cbc..cf322409 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -318,8 +318,8 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes text = current_linemode.filetitle(drawn, metadata) - if drawn.marked and (self.main_column or - self.settings.display_tags_in_all_columns): + if drawn.marked and (self.main_column + or self.settings.display_tags_in_all_columns): text = " " + text # Computing predisplay data. predisplay contains a list of lists diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py index 80061004..4493443e 100644 --- a/ranger/gui/widgets/view_base.py +++ b/ranger/gui/widgets/view_base.py @@ -72,8 +72,8 @@ class ViewBase(Widget, DisplayableContainer): # pylint: disable=too-many-instan sorted_bookmarks = sorted( ( item for item in self.fm.bookmarks - if self.fm.settings.show_hidden_bookmarks or - '/.' not in item[1].path + if self.fm.settings.show_hidden_bookmarks + or '/.' not in item[1].path ), key=lambda t: t[0].lower(), ) -- cgit 1.4.1-2-gfad0 From 0370e98e0df4286b8c87a2b4c0d0c35f83dad3e8 Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 14 May 2018 11:27:26 +0200 Subject: Add ignore for `W503` to `.flake8` to follow new pep8 --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index f5072c08..b77e4e6c 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] max-line-length = 99 -ignore = E221 +ignore = E221,W503 -- cgit 1.4.1-2-gfad0