From cf63af88199f6859c39bced6f2fa3b9ab7421834 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Sun, 14 Jul 2013 04:47:34 +0200 Subject: [PATCH] Fixed some pylint violations in some newly added code. --- gitinspector/config.py | 5 +++-- gitinspector/format.py | 9 +++++---- gitinspector/optval.py | 17 +++++++++-------- gitinspector/terminal.py | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gitinspector/config.py b/gitinspector/config.py index eefcea2..0cffdd2 100644 --- a/gitinspector/config.py +++ b/gitinspector/config.py @@ -21,6 +21,7 @@ from __future__ import unicode_literals import extensions import filtering import format +import interval import missing import optval import os @@ -49,8 +50,8 @@ def __read_git_config_bool__(repo, variable): return False def __read_git_config_string__(repo, variable): - string = __read_git_config__(repo, variable) - return (True, string) if len(string) > 0 else (False, None) + string = __read_git_config__(repo, variable) + return (True, string) if len(string) > 0 else (False, None) def init(run): missing.set_checkout_missing(__read_git_config_bool__(run.repo, "checkout-missing")) diff --git a/gitinspector/format.py b/gitinspector/format.py index 15ecad3..cec0d87 100644 --- a/gitinspector/format.py +++ b/gitinspector/format.py @@ -32,11 +32,12 @@ DEFAULT_FORMAT = __available_formats__[2] __selected_format__ = DEFAULT_FORMAT class InvalidFormatError(Exception): - def __init__(self, msg): - self.msg = msg + def __init__(self, message): + super(InvalidFormatError, self).__init__(message) + self.message = message - def msg(): - return self.msg + def msg(self): + return self.message def select(format): global __selected_format__ diff --git a/gitinspector/optval.py b/gitinspector/optval.py index 2a741ca..6f375cc 100644 --- a/gitinspector/optval.py +++ b/gitinspector/optval.py @@ -20,11 +20,12 @@ from __future__ import unicode_literals import getopt class InvalidOptionArgument(Exception): - def __init__(self, msg): - self.msg = msg + def __init__(self, message): + super(InvalidOptionArgument, self).__init__(message) + self.message = message - def msg(): - return self.msg + def msg(self): + return self.message def __find_arg_in_options__(arg, options): for opt in options: @@ -36,10 +37,10 @@ def __find_arg_in_options__(arg, options): def __find_options_to_extend__(long_options): options_to_extend = [] - for n, arg in enumerate(long_options): + for num, arg in enumerate(long_options): arg = arg.split(":") if len(arg) == 2: - long_options[n] = arg[0] + "=" + long_options[num] = arg[0] + "=" options_to_extend.append(("--" + arg[0], arg[1])) return options_to_extend @@ -49,10 +50,10 @@ def __find_options_to_extend__(long_options): def gnu_getopt(args, options, long_options): options_to_extend = __find_options_to_extend__(long_options) - for n, arg in enumerate(args): + for num, arg in enumerate(args): opt = __find_arg_in_options__(arg, options_to_extend) if opt: - args[n] = arg + "=" + opt[1] + args[num] = arg + "=" + opt[1] return getopt.gnu_getopt(args, options, long_options) diff --git a/gitinspector/terminal.py b/gitinspector/terminal.py index a75d39d..60898dd 100644 --- a/gitinspector/terminal.py +++ b/gitinspector/terminal.py @@ -114,6 +114,6 @@ def convert_command_line_to_utf8(): for arg in sys.argv: argv.append(arg.decode(sys.stdin.encoding, "replace")) - return argv; + return argv except AttributeError: - return sys.argv; + return sys.argv