From c015be2573b9df10897b6c7b5b3f4fdeba43e301 Mon Sep 17 00:00:00 2001 From: Andreas Florath Date: Sat, 6 May 2017 21:29:58 +0200 Subject: [PATCH] pep8 and pylint cleanup Signed-off-by: Andreas Florath --- rmtoo/lib/analytics/TopicCohe.py | 9 +++++---- rmtoo/lib/logging/__init__.py | 3 +-- rmtoo/lib/vcs/FileInterface.py | 2 -- rmtoo/lib/vcs/FileSystem.py | 2 -- rmtoo/lib/vcs/Git.py | 19 +++++++++---------- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/rmtoo/lib/analytics/TopicCohe.py b/rmtoo/lib/analytics/TopicCohe.py index d65196c4..26b3ad52 100644 --- a/rmtoo/lib/analytics/TopicCohe.py +++ b/rmtoo/lib/analytics/TopicCohe.py @@ -90,7 +90,8 @@ def topic_set_post(self, topic_set): for topic, cnt in iteritems(self.__tcnt): if cnt[0] <= cnt[1]: - self.add_result(Result("TopicCohe", topic, - - 10, ["%s: Topic coherence inadequate: " - "inner %d / outer %d" - % (topic, cnt[0], cnt[1])])) + self.add_result(Result( + "TopicCohe", topic, + - 10, ["%s: Topic coherence inadequate: " + "inner %d / outer %d" + % (topic, cnt[0], cnt[1])])) diff --git a/rmtoo/lib/logging/__init__.py b/rmtoo/lib/logging/__init__.py index 62407cb2..12e17ff6 100644 --- a/rmtoo/lib/logging/__init__.py +++ b/rmtoo/lib/logging/__init__.py @@ -16,8 +16,6 @@ import logging - - LOGGING_CONFIG = { "stdout": { "loglevel": logging.WARN, @@ -149,6 +147,7 @@ def configure_logging(cfg, mstderr): tracer.debug("rmtoo logging system configured.") + # The following names are uses as logging instances and therefore # should be lower case. # pylint: disable=invalid-name diff --git a/rmtoo/lib/vcs/FileInterface.py b/rmtoo/lib/vcs/FileInterface.py index 651b63b3..a285dc66 100644 --- a/rmtoo/lib/vcs/FileInterface.py +++ b/rmtoo/lib/vcs/FileInterface.py @@ -12,8 +12,6 @@ ''' from __future__ import unicode_literals -import os - from six import iteritems from rmtoo.lib.vcs.Interface import Interface diff --git a/rmtoo/lib/vcs/FileSystem.py b/rmtoo/lib/vcs/FileSystem.py index ea953df0..316b3e03 100644 --- a/rmtoo/lib/vcs/FileSystem.py +++ b/rmtoo/lib/vcs/FileSystem.py @@ -15,8 +15,6 @@ import stat import time -from six import iteritems - from rmtoo.lib.configuration.Cfg import Cfg from rmtoo.lib.vcs.Interface import Interface from rmtoo.lib.vcs.FileInterface import FileInterface diff --git a/rmtoo/lib/vcs/Git.py b/rmtoo/lib/vcs/Git.py index 7a560dbf..c016601c 100644 --- a/rmtoo/lib/vcs/Git.py +++ b/rmtoo/lib/vcs/Git.py @@ -15,7 +15,6 @@ import os import git -from six import iteritems from rmtoo.lib.configuration.Cfg import Cfg from rmtoo.lib.vcs.Interface import Interface @@ -65,13 +64,13 @@ def __setup_repo(self, directory): repo_found = False while len(directory) > 1: try: - tracer.debug("using [%s] as sample directory" % directory) + tracer.debug("using [%s] as sample directory", directory) self.__repo = git.Repo(directory) repo_found = True break except (git.exc.InvalidGitRepositoryError, git.exc.NoSuchPathError): - tracer.debug("Sample directory [%s] does not exists" % + tracer.debug("Sample directory [%s] does not exists", directory) directory = os.path.dirname(directory) if not repo_found: @@ -79,7 +78,7 @@ def __setup_repo(self, directory): # :-4: cut off the '/.git'. self.__repo_base_dir = self.__repo.git_dir[:-5] - tracer.debug("repository base directory [%s]" % self.__repo_base_dir) + tracer.debug("repository base directory [%s]", self.__repo_base_dir) def __init__(self, config): tracer.info("called") @@ -89,9 +88,9 @@ def __init__(self, config): self.__end_vers = cfg.get_rvalue("end_vers") self.__topic_root_node = cfg.get_rvalue("topic_root_node") tracer.debug("start version [%s] end version [%s] " - "topic root node [%s]" - % (self.__start_vers, self.__end_vers, - self.__topic_root_node)) + "topic root node [%s]", + self.__start_vers, self.__end_vers, + self.__topic_root_node) # When the directory is not absolute, convert it to an # absolute path that it can be compared to the outcome of the @@ -104,7 +103,7 @@ def __init__(self, config): def get_commits(self): '''Return an iterator for all the commits.''' return self.__repo.iter_commits( - self.__start_vers + ".." + self.__end_vers) + self.__start_vers + ".." + self.__end_vers) def get_timestamp(self, commit): '''Return the commit time.''' @@ -125,8 +124,8 @@ def __init__(self, base_dir, sub_dir, blob): self.__sub_dirname = os.path.join(*self.__sub_dir) tracer.debug(self) self.__filename = os.path.join( - self.__base_dirname, self.__sub_dirname, - self.__blob.name) + self.__base_dirname, self.__sub_dirname, + self.__blob.name) def __str__(self): '''Returns the string representation.'''