From f6b458324f0be89f48229d4d1b5f3be9ae047497 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 26 Mar 2013 17:18:31 -0400 Subject: testsuite: can't disable pylint R0924, since it doesn't exist on older pylint and pylint barfs --- src/lib/Bcfg2/Server/Plugin/helpers.py | 9 +++++++++ src/lib/Bcfg2/Utils.py | 15 ++++++++++++++- src/lib/Bcfg2/version.py | 2 +- testsuite/pylintrc.conf | 5 +---- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 4bfef89f3..0123d68a1 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -313,6 +313,15 @@ class DirectoryBacked(Debuggable): def __getitem__(self, key): return self.entries[key] + def __len__(self): + return len(self.entries) + + def __delitem__(self, key): + del self.entries[key] + + def __setitem__(self, key, val): + self.entries[key] = val + def __iter__(self): return iter(list(self.entries.items())) diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py index 601217556..ed5c0a377 100644 --- a/src/lib/Bcfg2/Utils.py +++ b/src/lib/Bcfg2/Utils.py @@ -22,7 +22,7 @@ class ClassName(object): return owner.__name__ -class PackedDigitRange(object): +class PackedDigitRange(object): # pylint: disable=E0012,R0924 """ Representation of a set of integer ranges. A range is described by a comma-delimited string of integers and ranges, e.g.:: @@ -145,6 +145,19 @@ class ExecutorResult(object): returned a tuple of (return value, stdout split by lines). """ return (self.retval, self.stdout.splitlines())[idx] + def __len__(self): + """ This provides compatibility with the old Executor, which + returned a tuple of (return value, stdout split by lines). """ + return 2 + + def __delitem__(self, _): + raise TypeError("'%s' object doesn't support item deletion" % + self.__class__.__name__) + + def __setitem__(self, idx, val): + raise TypeError("'%s' object does not support item assignment" % + self.__class__.__name__) + def __nonzero__(self): return self.__bool__() diff --git a/src/lib/Bcfg2/version.py b/src/lib/Bcfg2/version.py index 6f3ba3e49..12fc584fe 100644 --- a/src/lib/Bcfg2/version.py +++ b/src/lib/Bcfg2/version.py @@ -5,7 +5,7 @@ import re __version__ = "1.3.1" -class Bcfg2VersionInfo(tuple): +class Bcfg2VersionInfo(tuple): # pylint: disable=E0012,R0924 """ object to make granular version operations (particularly comparisons) easier """ diff --git a/testsuite/pylintrc.conf b/testsuite/pylintrc.conf index 15f8ae23c..14ccd1d23 100644 --- a/testsuite/pylintrc.conf +++ b/testsuite/pylintrc.conf @@ -33,7 +33,7 @@ load-plugins=ext.exception_messages # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). -disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921,R0922,R0924,C0302,I0011,E0100,E0101,E0102,E0106 +disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921,R0922,C0302,I0011,E0100,E0101,E0102,E0106 # Some of these are disabled because they warn about things we _want_: # # * W0142: Used * or ** magic @@ -41,12 +41,9 @@ disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921, # * I0011: Locally disabling a pylint message # * R0921: Abstract class not referenced # * R0922: Abstract class is only referenced a small number of times -# * R0924: Badly implemented Container # # We have several modules, e.g., Bcfg2.Server.Plugin.interfaces, that # only declare abstract classes, which makes R0921 and R0922 useless. -# We also have several container objects that are immutable, which -# R0924 doesn't like. # Some of these are disabled because they just aren't that useful: # -- cgit v1.2.3-1-g7c22