diff options
author | nfnty <git@nfnty.se> | 2016-01-01 00:48:07 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:04 +0100 |
commit | 1b97f7150f50b610c9cba20da4e4d89e27e61374 (patch) | |
tree | e612802cebde0d813e7b17ae210e6d1869fe6986 /ranger | |
parent | d75ecbd7ea4139cbda1205bcd78525dc29f983a1 (diff) | |
download | ranger-1b97f7150f50b610c9cba20da4e4d89e27e61374.tar.gz |
VCS: pylint and flake8 compliancy
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/vcs/__init__.py | 2 | ||||
-rw-r--r-- | ranger/ext/vcs/bzr.py | 4 | ||||
-rw-r--r-- | ranger/ext/vcs/git.py | 6 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 24 |
4 files changed, 16 insertions, 20 deletions
diff --git a/ranger/ext/vcs/__init__.py b/ranger/ext/vcs/__init__.py index 36bbb369..ec26f07a 100644 --- a/ranger/ext/vcs/__init__.py +++ b/ranger/ext/vcs/__init__.py @@ -3,4 +3,4 @@ """VCS Extension""" -from .vcs import Vcs, VcsError, VcsThread +from .vcs import Vcs, VcsError, VcsThread # NOQA diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py index b06f28ec..300db796 100644 --- a/ranger/ext/vcs/bzr.py +++ b/ranger/ext/vcs/bzr.py @@ -8,6 +8,7 @@ import re from datetime import datetime from .vcs import Vcs, VcsError + class Bzr(Vcs): """VCS implementation for GNU Bazaar""" HEAD = 'last:1' @@ -19,7 +20,6 @@ class Bzr(Vcs): ) # Generic - #--------------------------- def _bzr(self, args, path=None, catchout=True, retbytes=False): """Run a bzr command""" @@ -71,7 +71,6 @@ class Bzr(Vcs): return 'unknown' # Action Interface - #--------------------------- def action_add(self, filelist=None): args = ['add'] @@ -86,7 +85,6 @@ class Bzr(Vcs): self._bzr(args, catchout=False) # Data Interface - #--------------------------- def data_status_root(self): statuses = set() diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index 1741ceff..5007b877 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -9,6 +9,7 @@ from datetime import datetime import json from .vcs import Vcs, VcsError + class Git(Vcs): """VCS implementation for Git""" _status_translations = ( @@ -25,7 +26,6 @@ class Git(Vcs): ) # Generic - #--------------------------- def _git(self, args, path=None, catchout=True, retbytes=False): """Run a git command""" @@ -75,13 +75,12 @@ class Git(Vcs): def _git_status_translate(self, code): """Translate status code""" - for X, Y, status in self._status_translations: + for X, Y, status in self._status_translations: # pylint: disable=invalid-name if code[0] in X and code[1] in Y: return status return 'unknown' # Action interface - #--------------------------- def action_add(self, filelist=None): args = ['add', '--all'] @@ -96,7 +95,6 @@ class Git(Vcs): self._git(args, catchout=False) # Data Interface - #--------------------------- def data_status_root(self): statuses = set() diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 4edd53b0..f4e0f378 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -12,17 +12,19 @@ import time try: import queue except ImportError: - import Queue as queue + import Queue as queue # pylint: disable=import-error try: FileNotFoundError except NameError: - FileNotFoundError = OSError + FileNotFoundError = OSError # pylint: disable=redefined-builtin + class VcsError(Exception): """VCS exception""" pass -class Vcs(object): + +class Vcs(object): # pylint: disable=too-many-instance-attributes """ This class represents a version controlled path, abstracting the usual operations from the different supported backends. @@ -112,9 +114,8 @@ class Vcs(object): self.track = False # Generic - #--------------------------- - def _vcs(self, cmd, path, catchout=True, retbytes=False): + def _vcs(self, cmd, path, catchout=True, retbytes=False): # pylint: disable=no-self-use """Run a VCS command""" with open(os.devnull, 'w') as devnull: try: @@ -318,7 +319,6 @@ class Vcs(object): return 'sync' # Action interface - #--------------------------- def action_add(self, filelist): """Adds files to the index""" @@ -329,7 +329,6 @@ class Vcs(object): raise NotImplementedError # Data interface - #--------------------------- def data_status_root(self): """Returns status of self.root cheaply""" @@ -355,12 +354,13 @@ class Vcs(object): """Returns info string about revision rev. None in special cases""" raise NotImplementedError + class VcsThread(threading.Thread): """VCS thread""" def __init__(self, ui, idle_delay): super(VcsThread, self).__init__() self.daemon = True - self.ui = ui + self.ui = ui # pylint: disable=invalid-name self.delay = idle_delay self.queue = queue.Queue() self.wake = threading.Event() @@ -489,7 +489,7 @@ class VcsThread(threading.Thread): self.wake.set() # Backend imports -import ranger.ext.vcs.git -import ranger.ext.vcs.hg -import ranger.ext.vcs.bzr -import ranger.ext.vcs.svn +import ranger.ext.vcs.git # NOQA pylint: disable=wrong-import-position +import ranger.ext.vcs.hg # NOQA pylint: disable=wrong-import-position +import ranger.ext.vcs.bzr # NOQA pylint: disable=wrong-import-position +import ranger.ext.vcs.svn # NOQA pylint: disable=wrong-import-position |