diff options
author | nfnty <git@nfnty.se> | 2016-12-24 07:12:18 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-17 05:59:04 +0100 |
commit | a59ca83853707522d9de515a6d4128a5c1c5ac0a (patch) | |
tree | 45be378a1529a7a3eb8513a3f6f82fdc519c12fc | |
parent | e30a3ee90c2c2c2d945d4d1684f5850700e3101a (diff) | |
download | ranger-a59ca83853707522d9de515a6d4128a5c1c5ac0a.tar.gz |
linting: Enable `attribute-defined-outside-init`
-rw-r--r-- | .pylintrc | 2 | ||||
-rw-r--r-- | ranger/container/fsobject.py | 4 | ||||
-rw-r--r-- | ranger/core/actions.py | 3 | ||||
-rw-r--r-- | ranger/core/fm.py | 3 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 4 | ||||
-rw-r--r-- | ranger/gui/ui.py | 17 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 4 |
7 files changed, 28 insertions, 9 deletions
diff --git a/.pylintrc b/.pylintrc index 43337df8..935c58f4 100644 --- a/.pylintrc +++ b/.pylintrc @@ -8,7 +8,7 @@ max-branches=16 [FORMAT] max-line-length = 99 -disable=locally-disabled,locally-enabled,missing-docstring,duplicate-code,fixme,broad-except,cyclic-import,attribute-defined-outside-init +disable=locally-disabled,locally-enabled,missing-docstring,duplicate-code,fixme,broad-except,cyclic-import [TYPECHECK] ignored-classes=ranger.core.actions.Actions diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index bfc3b0c4..36817ff4 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -193,9 +193,11 @@ class FileSystemObject( # pylint: disable=too-many-instance-attributes bname = self.basename if self.extension == 'part': bname = bname[0:-5] + # pylint: disable=attribute-defined-outside-init self._mimetype = self.fm.mimetypes.guess_type(bname, False)[0] if self._mimetype is None: self._mimetype = '' + # pylint: enable=attribute-defined-outside-init self.video = self._mimetype.startswith('video') self.image = self._mimetype.startswith('image') @@ -206,11 +208,13 @@ class FileSystemObject( # pylint: disable=too-many-instance-attributes or self.basename.lower() in DOCUMENT_BASENAMES self.container = self.extension in CONTAINER_EXTENSIONS + # pylint: disable=attribute-defined-outside-init keys = ('video', 'audio', 'image', 'media', 'document', 'container') self._mimetype_tuple = tuple(key for key in keys if getattr(self, key)) if self._mimetype == '': self._mimetype = None + # pylint: enable=attribute-defined-outside-init @property def mimetype(self): diff --git a/ranger/core/actions.py b/ranger/core/actions.py index c2a93231..cd48fc40 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1,6 +1,7 @@ # This file is part of ranger, the console file manager. # License: GNU GPL version 3, see the file "AUTHORS" for details. -# pylint: disable=too-many-lines + +# pylint: disable=too-many-lines,attribute-defined-outside-init from __future__ import (absolute_import, print_function) diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 4538a44f..a48d77da 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -68,6 +68,9 @@ class FM(Actions, # pylint: disable=too-many-instance-attributes self.do_cut = False self.metadata = MetadataManager() self.image_displayer = None + self.run = None + self.rifle = None + self.thistab = None try: self.username = pwd.getpwuid(os.geteuid()).pw_name diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index aff6bb29..e1141409 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -65,6 +65,10 @@ class W3MImageDisplayer(ImageDisplayer): """ is_initialized = False + def __init__(self): + self.binary_path = None + self.process = None + def initialize(self): """start w3mimgdisplay""" self.binary_path = None diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index f33f306e..5c665b71 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -57,6 +57,15 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method self.redrawlock = threading.Event() self.redrawlock.set() + self.titlebar = None + self._viewmode = None + self.taskview = None + self.status = None + self.console = None + self.pager = None + self._draw_title = None + self.browser = None + if fm is not None: self.fm = fm @@ -443,15 +452,13 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method self._viewmode = value new_browser = self._viewmode_to_class(value)(self.win) - if hasattr(self, 'browser'): - # pylint: disable=access-member-before-definition + if self.browser is None: + self.add_child(new_browser) + else: old_size = self.browser.y, self.browser.x, self.browser.hei, self.browser.wid self.replace_child(self.browser, new_browser) self.browser.destroy() - # pylint: enable=access-member-before-definition new_browser.resize(*old_size) - else: - self.add_child(new_browser) self.browser = new_browser self.redraw_window() diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index dbd9a7ff..349c904f 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -34,7 +34,8 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- def __init__(self, win): Widget.__init__(self, win) - self.clear() + self.pos = 0 + self.line = '' self.history = History(self.settings.max_console_history_size) # load history from files if not ranger.args.clean: @@ -47,7 +48,6 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- for line in fobj: self.history.add(line[:-1]) fobj.close() - self.line = "" self.history_backup = History(self.history) # NOTE: the console is considered in the "question mode" when the |