summaryrefslogtreecommitdiffstats
path: root/ipsilon/util/config.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-05-07 12:33:40 -0400
committerSimo Sorce <simo@redhat.com>2015-05-07 14:29:49 -0400
commitd8aa3e10398d0d23eefdbda899475ca32ec3abf6 (patch)
treef17e5fb0f9f0a1a922bcbd80ec798396c508f56d /ipsilon/util/config.py
parent93d4e52712767fe955f3a44a60a6c6f0f909423b (diff)
downloadipsilon-d8aa3e10398d0d23eefdbda899475ca32ec3abf6.tar.gz
ipsilon-d8aa3e10398d0d23eefdbda899475ca32ec3abf6.tar.xz
ipsilon-d8aa3e10398d0d23eefdbda899475ca32ec3abf6.zip
pylint 1.4.3 version fixespylint143
Pylint 1.4.3 completely stopped recognizing the star-args condition. In order to avoid pylint error with > 1.4.3 stop caring for star-args and add cmdline option to ignore those errors completly so older pylint versions are happy too. Also fix type() vs isinstance() checks, isinstance is generally a more correct approach to check for calsses. In some 'admin' files the type() -> isinstance() fix required to invert the order in which ComplexList and MappingList are checked as the latter is a subclass of ComplexList, so it needs to be checked first otherwise the check for isinstance(option, ComplexList) matches for both and the code stops funciotning properly. Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/util/config.py')
-rw-r--r--ipsilon/util/config.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/ipsilon/util/config.py b/ipsilon/util/config.py
index 5366a96..a20c87c 100644
--- a/ipsilon/util/config.py
+++ b/ipsilon/util/config.py
@@ -109,7 +109,7 @@ class Option(Log):
return None
def _str_import_value(self, value):
- if type(value) is not str:
+ if not isinstance(value, str):
raise ValueError('Value must be string')
self._assigned_value = value
@@ -170,7 +170,7 @@ class List(Option):
return None
def import_value(self, value):
- if type(value) is not str:
+ if not isinstance(value, str):
raise ValueError('Value (type: %s) must be string' % type(value))
self._assigned_value = [x.strip() for x in value.split(',')]
@@ -180,7 +180,7 @@ class ComplexList(List):
def _check_value(self, value):
if value is None:
return
- if type(value) is not list:
+ if not isinstance(value, list):
raise ValueError('The value type must be a list, not "%s"' %
type(value))
@@ -194,7 +194,7 @@ class ComplexList(List):
return None
def import_value(self, value):
- if type(value) is not str:
+ if not isinstance(value, str):
raise ValueError('The value type must be a string, not "%s"' %
type(value))
jsonval = json.loads(value)
@@ -206,11 +206,11 @@ class MappingList(ComplexList):
def _check_value(self, value):
if value is None:
return
- if type(value) is not list:
+ if not isinstance(value, list):
raise ValueError('The value type must be a list, not "%s"' %
type(value))
for v in value:
- if type(v) is not list:
+ if not isinstance(v, list):
raise ValueError('Each element must be a list, not "%s"' %
type(v))
if len(v) != 2:
@@ -218,7 +218,7 @@ class MappingList(ComplexList):
' not %d' % len(v))
def import_value(self, value):
- if type(value) is not str:
+ if not isinstance(value, str):
raise ValueError('Value (type: %s) must be string' % type(value))
jsonval = json.loads(value)
self.set_value(jsonval)
@@ -253,7 +253,7 @@ class Choice(Option):
return '%s=%s' % (self.name, self.get_value())
def set_value(self, value):
- if type(value) is not list:
+ if not isinstance(value, list):
value = [value]
self._assigned_value = list()
for val in value:
@@ -267,7 +267,7 @@ class Choice(Option):
self._assigned_value = None
def unset_value(self, value):
- if type(value) is str:
+ if isinstance(value, str):
value = [value]
unset = list()
for val in value: