Module: check_mk
Branch: master
Commit: 90e469f153786642265d17380402680b14b7449d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=90e469f1537866…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Nov 15 14:52:17 2018 +0100
Enable pylint unidiomatic-typecheck
CMK-837
Change-Id: Ibefcc60f7cfbcdbd66ec923e382642c2239c59bc
---
.pylintrc | 5 -----
cmk/gui/plugins/metrics/utils.py | 2 +-
cmk/gui/plugins/watolib/utils.py | 2 +-
inventory/dmidecode | 4 ++--
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index 9aa44c0..c4135ec 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -34,11 +34,6 @@ disable=
# duplication (introduce new classes, combine methods, etc.)
attribute-defined-outside-init,
#---------------------------------------------------------------------------
- # Enabling this would be very desirable, using type() instead of
- # isinstance() is a very bad idea most of the time, as it totally ignores
- # class hierarchies, breaking things in subtle ways.
- unidiomatic-typecheck,
- #---------------------------------------------------------------------------
# This should really be fixed: Global variables are already a bad idea, but
# depending on an implicit protocol to create them is an even worse one.
global-variable-undefined,
diff --git a/cmk/gui/plugins/metrics/utils.py b/cmk/gui/plugins/metrics/utils.py
index e06d8fb..bdb5ce1 100644
--- a/cmk/gui/plugins/metrics/utils.py
+++ b/cmk/gui/plugins/metrics/utils.py
@@ -318,7 +318,7 @@ def translate_metrics(perf_data, check_command):
# relevant when fetching RRD data and is used for selecting
# the consolidation function MAX.
def evaluate(expression, translated_metrics):
- if type(expression) in (float, int):
+ if isinstance(expression, (float, int)):
return _evaluate_literal(expression, translated_metrics)
else:
if "#" in expression:
diff --git a/cmk/gui/plugins/watolib/utils.py b/cmk/gui/plugins/watolib/utils.py
index 1834bf0..5e9a40d 100644
--- a/cmk/gui/plugins/watolib/utils.py
+++ b/cmk/gui/plugins/watolib/utils.py
@@ -189,7 +189,7 @@ def register_configvar(group,
# New API is to hand over the class via domain argument. But not all calls have been
# migrated. Perform the translation here.
- if type(domain) in [str, unicode]:
+ if isinstance(domain, basestring):
domain = ConfigDomain.get_class(domain)
_configvar_groups.setdefault(group, []).append((domain, varname, valuespec))
diff --git a/inventory/dmidecode b/inventory/dmidecode
index b47adfa..bb998da 100644
--- a/inventory/dmidecode
+++ b/inventory/dmidecode
@@ -273,14 +273,14 @@ def inv_dmidecode_parse_mem_device(lines):
def inv_dmidecode_parse_generic(node, lines, keyinfo):
- if type(node) == str:
+ if isinstance(node, str):
node = inv_tree(node)
for line in lines:
if line[0] in keyinfo:
key = keyinfo[line[0]]
if line[1] != "Not Specified":
value = line[1]
- if type(key) == tuple:
+ if isinstance(key, tuple):
key, transform = key
value = transform(value)
if value is None: