Module: check_mk
Branch: master
Commit: f2afd0e6eaa4f9c5bf4de166caffcd963343e1ba
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2afd0e6eaa4f9…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 09:50:16 2018 +0200
Fixed and enabled consider-merging-isinstance warnings.
Change-Id: Ibb0262eb37c5e80bd31d973ff01a3bc60d1d69fe
---
cmk/gui/bi.py | 2 +-
cmk/gui/config.py | 4 ++--
cmk/gui/dashboard.py | 2 +-
cmk/gui/watolib.py | 2 +-
tests/pylint/pylintrc | 3 +--
5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/cmk/gui/bi.py b/cmk/gui/bi.py
index 5553f2e..3b113cd 100644
--- a/cmk/gui/bi.py
+++ b/cmk/gui/bi.py
@@ -3714,7 +3714,7 @@ def _convert_legacy_aggregation_rule(rule):
if isinstance(rule, dict):
return rule
- if isinstance(rule, tuple) or isinstance(rule, list):
+ if isinstance(rule, (list, tuple)):
# Rule has at least four entries.
# Since version 1.4.0b4
# - werk 4460 introduced 'state_messages'.
diff --git a/cmk/gui/config.py b/cmk/gui/config.py
index 0b13ef9..44f1b3a 100644
--- a/cmk/gui/config.py
+++ b/cmk/gui/config.py
@@ -162,7 +162,7 @@ def load_config():
# Apply the default configuration to the module global level
for k, v in default_config.items():
- if isinstance(v, dict) or isinstance(v, list):
+ if isinstance(v, (dict, list)):
v = copy.deepcopy(v)
globals()[k] = v
@@ -214,7 +214,7 @@ def _load_default_config_from_module_plugins():
if k[0] == "_":
continue
- if isinstance(v, dict) or isinstance(v, list):
+ if isinstance(v, (dict, list)):
v = copy.deepcopy(v)
default_config[k] = v
diff --git a/cmk/gui/dashboard.py b/cmk/gui/dashboard.py
index 6de80f7..d2ad9fa 100644
--- a/cmk/gui/dashboard.py
+++ b/cmk/gui/dashboard.py
@@ -1126,7 +1126,7 @@ def page_edit_dashlet():
elements = params,
)
- elif isinstance(params, Dictionary) or isinstance(params, Transform):
+ elif isinstance(params, (Dictionary, Transform)):
vs_type = params
elif type(params) == type(lambda x: x):
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index c7a4dca..d1da847 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -6549,7 +6549,7 @@ function all_taggroup_choices($object_tags) {
def format_php(data, lvl = 1):
s = ''
- if isinstance(data, tuple) or isinstance(data, list):
+ if isinstance(data, (list, tuple)):
s += 'array(\n'
for item in data:
s += ' ' * lvl + format_php(item, lvl + 1) + ',\n'
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 137ba98..6abeb1e 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -77,9 +77,8 @@ disable=
wrong-import-order,
wrong-import-position,
#---------------------------------------------------------------------------
- # The 7 warnings below have already been fixed for non-web/ code. When the
+ # The 6 warnings below have already been fixed for non-web/ code. When the
# upcoming reorganization of web/ has been landed, these should be fixed first.
- consider-merging-isinstance,
misplaced-comparison-constant,
old-style-class,
simplifiable-if-statement,