Module: check_mk
Branch: master
Commit: d1b117f2c1ea076a8ca98e944cb816041b280f4c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d1b117f2c1ea07…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jul 11 15:19:22 2018 +0200
Fixed a few consider-merging-isinstance warnings.
The unbelievable power of the distributive law in action...
Change-Id: I9bf7b9d59d2015e841b88630880dd3c305995f26
---
cmk/structured_data.py | 2 +-
cmk_base/config.py | 2 +-
cmk_base/data_sources/abstract.py | 4 +---
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/cmk/structured_data.py b/cmk/structured_data.py
index b6cfde5..6fb678a 100644
--- a/cmk/structured_data.py
+++ b/cmk/structured_data.py
@@ -112,7 +112,7 @@ class StructuredDataTree(object):
def _validate_tree_path(self, tree_path):
if not tree_path:
raise MKGeneralException("Empty tree path or zero.")
- if not (isinstance(tree_path, str) or isinstance(tree_path, unicode)):
+ if not (isinstance(tree_path, (str, unicode))):
raise MKGeneralException("Wrong tree path format. Must be of type
string.")
if not (tree_path.endswith(":") or tree_path.endswith(".")):
raise MKGeneralException("No valid tree path.")
diff --git a/cmk_base/config.py b/cmk_base/config.py
index a3f3b37..e14688f 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -67,7 +67,7 @@ def get_default_config():
for key in get_variable_names():
value = getattr(default_config, key)
- if isinstance(value, dict) or isinstance(value, list):
+ if isinstance(value, (dict, list)):
value = copy.deepcopy(value)
cfg[key] = value
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index cbc1f0a..c63551b 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -415,9 +415,7 @@ class DataSource(object):
if isinstance(self._exception, MKEmptyAgentData):
status = self._exit_code_spec.get("empty_output", 2)
- elif isinstance(self._exception, MKAgentError) \
- or isinstance(self._exception, MKIPAddressLookupError) \
- or isinstance(self._exception, MKSNMPError):
+ elif isinstance(self._exception, (MKAgentError, MKIPAddressLookupError,
MKSNMPError)):
status = self._exit_code_spec.get("connection", 2)
elif isinstance(self._exception, MKTimeout):