From 61830c315a9b051a8ab46da487792d0c1e90ec5d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 18 Apr 2015 19:09:49 +0300 Subject: Run pylint in check; fix problems found --- Makefile | 1 + pylint.conf | 30 ++++++++++++++++++++++++++++++ summain | 7 +++++-- summainlib.py | 9 ++++----- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 pylint.conf diff --git a/Makefile b/Makefile index a1d3486..8a224fe 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ check: rm -f .coverage cmdtest tests pep8 summain summainlib.py summainlib_tests.py + pylint --rcfile=pylint.conf summain summainlib.py summainlib_tests.py clean: python setup.py clean diff --git a/pylint.conf b/pylint.conf new file mode 100644 index 0000000..bae19df --- /dev/null +++ b/pylint.conf @@ -0,0 +1,30 @@ +[MASTER] +persistent=no + +[MESSAGES CONTROL] +disable= + attribute-defined-outside-init, + bad-builtin, + blacklisted-name, + cyclic-import, + invalid-name, + missing-docstring, + no-member, + no-self-use, + pointless-statement, + protected-access, + star-args, + too-few-public-methods, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-locals, + too-many-public-methods, + too-many-statements, + unused-argument + +[REPORTS] +reports=no + +[SIMILARITIES] +min-similarity-lines=999 diff --git a/summain b/summain index aa8ae79..db12eda 100755 --- a/summain +++ b/summain @@ -19,7 +19,6 @@ import cliapp import csv import json import os -import sys import summainlib @@ -39,7 +38,7 @@ class OutputFormat(object): self.write_object(name, o) def write_object(self, name, o): - raise NotImplemented() + raise NotImplementedError() class Rfc822(OutputFormat): @@ -73,6 +72,7 @@ class CSV(OutputFormat): class GeneratorList(list): def __init__(self, gen): + list.__init__(self) self.gen = gen def __len__(self): @@ -89,6 +89,9 @@ class Json(OutputFormat): json.dump(gen, self.output, sort_keys=True, indent=1) self.output.write('\n') + def write_object(self, name, o): + pass + def dictify(self, name, o): keys = self.keys + self.checksums diff --git a/summainlib.py b/summainlib.py index 6466383..2579090 100644 --- a/summainlib.py +++ b/summainlib.py @@ -18,7 +18,6 @@ import base64 import grp import hashlib import hmac -import math import os import pwd import stat @@ -59,12 +58,12 @@ class NumberNormalizer(object): def __init__(self): self.reset() - def get(self, input_number, numbers, next): + def get(self, input_number, numbers, next_number): if input_number in numbers: - return numbers[input_number], next + return numbers[input_number], next_number else: - numbers[input_number] = next - return numbers[input_number], next + 1 + numbers[input_number] = next_number + return numbers[input_number], next_number + 1 def get_ino(self, ino): output, self.next_ino = self.get(ino, self.ino_numbers, self.next_ino) -- cgit v1.2.1