From e2325c5676afbf699238958fbd7655b59c3e5819 Mon Sep 17 00:00:00 2001 From: stepshal Date: Wed, 22 Jun 2016 22:39:22 +0700 Subject: Add missing whitespaces around arithmetic operators --- ranger/__init__.py | 2 +- ranger/config/commands.py | 2 +- ranger/container/bookmarks.py | 8 ++++---- ranger/container/history.py | 2 +- ranger/container/settings.py | 6 +++--- ranger/core/actions.py | 2 +- ranger/core/fm.py | 2 +- ranger/core/main.py | 4 ++-- ranger/ext/direction.py | 2 +- ranger/ext/img_display.py | 8 ++++---- ranger/ext/keybinding_parser.py | 8 ++++---- ranger/ext/widestring.py | 2 +- ranger/gui/ansi.py | 4 ++-- ranger/gui/ui.py | 2 +- ranger/gui/widgets/console.py | 4 ++-- ranger/gui/widgets/titlebar.py | 2 +- ranger/gui/widgets/view_base.py | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ranger/__init__.py b/ranger/__init__.py index 8b68a5b0..4d8e4afe 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -34,7 +34,7 @@ try: except NameError: ExceptionClass = IOError try: - LOGFILE = tempfile.gettempdir()+'/ranger_errorlog' + LOGFILE = tempfile.gettempdir() + '/ranger_errorlog' except ExceptionClass: LOGFILE = '/dev/null' del ExceptionClass diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 73272eb0..36c21f70 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -962,7 +962,7 @@ class relink(Command): def tab(self, tabnum): if not self.rest(1): - return self.line+os.readlink(self.fm.thisfile.path) + return self.line + os.readlink(self.fm.thisfile.path) else: return self._tab_directory_content() diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py index 8504bef9..cb15efee 100644 --- a/ranger/container/bookmarks.py +++ b/ranger/container/bookmarks.py @@ -151,7 +151,7 @@ class Bookmarks(object): if self.path is None: return if os.access(self.path, os.W_OK): - f = open(self.path+".new", 'w') + f = open(self.path + ".new", 'w') for key, value in self.dct.items(): if type(key) == str\ and key in ALLOWED_KEYS: @@ -163,11 +163,11 @@ class Bookmarks(object): f.close() old_perms = os.stat(self.path) try: - os.chown(self.path+".new", old_perms.st_uid, old_perms.st_gid) - os.chmod(self.path+".new", old_perms.st_mode) + os.chown(self.path + ".new", old_perms.st_uid, old_perms.st_gid) + os.chmod(self.path + ".new", old_perms.st_mode) except OSError: pass - os.rename(self.path+".new", self.path) + os.rename(self.path + ".new", self.path) self._update_mtime() def _load_dict(self): diff --git a/ranger/container/history.py b/ranger/container/history.py index 73e5fe7f..4e06d4b2 100644 --- a/ranger/container/history.py +++ b/ranger/container/history.py @@ -25,7 +25,7 @@ class History(object): def add(self, item): # Remove everything after index if self._index < len(self._history) - 2: - del self._history[:self._index+1] + del self._history[:self._index + 1] # Remove Duplicates if self.unique: try: diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 704540b2..af7ceb55 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -96,9 +96,9 @@ class Settings(SignalDispatcher, FileManagerAware): self.__dict__['_tagsettings'] = dict() self.__dict__['_settings'] = dict() for name in ALLOWED_SETTINGS: - self.signal_bind('setopt.'+name, + self.signal_bind('setopt.' + name, self._sanitize, priority=1.0) - self.signal_bind('setopt.'+name, + self.signal_bind('setopt.' + name, self._raw_set_with_signal, priority=0.2) def _sanitize(self, signal): @@ -142,7 +142,7 @@ class Settings(SignalDispatcher, FileManagerAware): kws = dict(setting=name, value=value, previous=previous, path=path, tags=tags, fm=self.fm) self.signal_emit('setopt', **kws) - self.signal_emit('setopt.'+name, **kws) + self.signal_emit('setopt.' + name, **kws) def get(self, name, path=None): assert name in ALLOWED_SETTINGS, "No such setting: {0}!".format(name) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 9b806d56..c119c501 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -489,7 +489,7 @@ class Actions(FileManagerAware, SettingsAware): if parent.pointer + n < 0: n = 0 - parent.pointer try: - self.thistab.enter_dir(parent.files[parent.pointer+n]) + self.thistab.enter_dir(parent.files[parent.pointer + n]) except IndexError: pass diff --git a/ranger/core/fm.py b/ranger/core/fm.py index cabb6c2b..523239c1 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -81,7 +81,7 @@ class FM(Actions, SignalDispatcher): def initialize(self): """If ui/bookmarks are None, they will be initialized here.""" - self.tabs = dict((n+1, Tab(path)) for n, path in + self.tabs = dict((n + 1, Tab(path)) for n, path in enumerate(self.start_paths)) tab_list = self._get_tab_list() if tab_list: diff --git a/ranger/core/main.py b/ranger/core/main.py index fefffad5..62a21b85 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -140,8 +140,8 @@ def main(): import pstats profile = None ranger.__fm = fm - cProfile.run('ranger.__fm.loop()', tempfile.gettempdir()+'/ranger_profile') - profile = pstats.Stats(tempfile.gettempdir()+'/ranger_profile', stream=sys.stderr) + cProfile.run('ranger.__fm.loop()', tempfile.gettempdir() + '/ranger_profile') + profile = pstats.Stats(tempfile.gettempdir() + '/ranger_profile', stream=sys.stderr) else: fm.loop() except Exception: diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index 8d3e7e7a..787da1bf 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -142,7 +142,7 @@ class Direction(dict): def select(self, lst, current, pagesize, override=None, offset=1): dest = self.move(direction=self.down(), override=override, - current=current, pagesize=pagesize, minimum=0, maximum=len(lst)+1) + current=current, pagesize=pagesize, minimum=0, maximum=len(lst) + 1) selection = lst[min(current, dest):max(current, dest) + offset] return dest + offset - 1, selection diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 521a2dad..c02dd984 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -230,8 +230,8 @@ 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 / float(width) + height_scale = max_height / float(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: @@ -239,10 +239,10 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware): else: return (width * min_scale) else: - scale = max_height/float(height) + scale = max_height / float(height) return (width * scale) elif width > max_width: - scale = max_width/float(width) + scale = max_width / float(width) return (width * scale) else: return width diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 68c44fa3..b285237e 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -6,7 +6,7 @@ import copy import curses.ascii PY3 = sys.version_info[0] >= 3 -digits = set(range(ord('0'), ord('9')+1)) +digits = set(range(ord('0'), ord('9') + 1)) # Arbitrary numbers which are not used with curses.KEY_XYZ ANYKEY, PASSIVE_ACTION, ALT_KEY, QUANT_KEY = range(9001, 9005) @@ -138,11 +138,11 @@ def key_to_string(key): def _unbind_traverse(pointer, keys, pos=0): if keys[pos] not in pointer: return - if len(keys) > pos+1 and isinstance(pointer, dict): - _unbind_traverse(pointer[keys[pos]], keys, pos=pos+1) + if len(keys) > pos + 1 and isinstance(pointer, dict): + _unbind_traverse(pointer[keys[pos]], keys, pos=pos + 1) if not pointer[keys[pos]]: del pointer[keys[pos]] - elif len(keys) == pos+1: + elif len(keys) == pos + 1: try: del pointer[keys[pos]] keys.pop() diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py index 39333e7f..4890c20b 100644 --- a/ranger/ext/widestring.py +++ b/ranger/ext/widestring.py @@ -150,7 +150,7 @@ class WideString(object): """ if isinstance(i, slice): return self.__getslice__(i.start, i.stop) - return self.__getslice__(i, i+1) + return self.__getslice__(i, i + 1) def __len__(self): """ diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py index 4a9fb248..e761c379 100644 --- a/ranger/gui/ansi.py +++ b/ranger/gui/ansi.py @@ -152,10 +152,10 @@ def char_slice(ansi_text, start, length): pass # seek elif old_pos < start and pos >= start: chunks.append(last_color) - chunks.append(chunk[start-old_pos:start-old_pos+length]) + chunks.append(chunk[start - old_pos:start - old_pos + length]) elif pos > length + start: chunks.append(last_color) - chunks.append(chunk[:start-old_pos+length]) + chunks.append(chunk[:start - old_pos + length]) else: chunks.append(last_color) chunks.append(chunk) diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 12bf3ddb..4c302e00 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -313,7 +313,7 @@ class UI(DisplayableContainer): self.taskview.resize(1, 0, y - 2, x) self.pager.resize(1, 0, y - 2, x) self.titlebar.resize(0, 0, 1, x) - self.status.resize(self.settings.status_bar_on_top and 1 or y-1, 0, 1, x) + self.status.resize(self.settings.status_bar_on_top and 1 or y - 1, 0, 1, x) self.console.resize(y - 1, 0, 1, x) def draw(self): diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 78b85580..db04a9c8 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -105,7 +105,7 @@ class Console(Widget): else: try: pos = uwid(self.line[0:self.pos]) + len(self.prompt) - move(self.y, self.x + min(self.wid-1, pos)) + move(self.y, self.x + min(self.wid - 1, pos)) except Exception: pass @@ -413,7 +413,7 @@ class Console(Widget): upos = len(self.line[:self.pos].decode('utf-8', 'ignore')) + mod left_part = ''.join(uc[:upos]).encode('utf-8', 'ignore') self.pos = len(left_part) - self.line = left_part + ''.join(uc[upos+1:]).encode('utf-8', 'ignore') + self.line = left_part + ''.join(uc[upos + 1:]).encode('utf-8', 'ignore') self.on_line_change() def execute(self, cmd=None): diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index af102539..d46fec62 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -105,7 +105,7 @@ class TitleBar(Widget): pathway = self.fm.thistab.pathway if self.settings.tilde_in_titlebar and \ self.fm.thisdir.path.startswith(self.fm.home_path): - pathway = pathway[self.fm.home_path.count('/')+1:] + pathway = pathway[self.fm.home_path.count('/') + 1:] bar.add('~/', 'directory', fixed=True) for path in pathway: diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py index 41a6bccf..0f3809e5 100644 --- a/ranger/gui/widgets/view_base.py +++ b/ranger/gui/widgets/view_base.py @@ -74,7 +74,7 @@ class ViewBase(Widget, DisplayableContainer): self.addnstr(ystart - 1, 0, "mark path".ljust(self.wid), self.wid) whitespace = " " * maxlen - for line, items in zip(range(self.hei-1), sorted_bookmarks): + for line, items in zip(range(self.hei - 1), sorted_bookmarks): key, mark = items string = " " + key + " " + mark.path self.addstr(ystart + line, 0, whitespace) -- cgit 1.4.1-2-gfad0