Module: check_mk
Branch: master
Commit: 013db70cdaf2137574a49dba2bbf9edfe5636026
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=013db70cdaf213…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 10:52:03 2018 +0200
Fixed and enabled unnecessary-lambda warnings.
Change-Id: I5a076cc2f884eaf7f867402a2a60e192a087d54a
---
cmk/gui/multitar.py | 4 ++--
cmk/gui/pagetypes.py | 8 ++++----
tests/pylint/pylintrc | 3 +--
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/cmk/gui/multitar.py b/cmk/gui/multitar.py
index cd7ece2..ea96beb 100644
--- a/cmk/gui/multitar.py
+++ b/cmk/gui/multitar.py
@@ -560,10 +560,10 @@ def extract_domains(tar, domains):
logger.info("Restoring snapshot: %s" % tar.name)
logger.info("Domains: %s" % ", ".join(tar_domains.keys()))
for what, abort_on_error, handler in [
- ("Permissions", True, lambda domain, tar_member:
check_domain(domain, tar_member)),
+ ("Permissions", True, check_domain),
("Pre-Restore", True, lambda domain, tar_member:
execute_restore(domain, is_pre_restore = True)),
("Cleanup", False, lambda domain, tar_member:
cleanup_domain(domain)),
- ("Extract", False, lambda domain, tar_member:
extract_domain(domain, tar_member)),
+ ("Extract", False, extract_domain),
("Post-Restore", False, lambda domain, tar_member:
execute_restore(domain, is_pre_restore = False))
]:
errors = []
diff --git a/cmk/gui/pagetypes.py b/cmk/gui/pagetypes.py
index aba32ee..1c41daf 100644
--- a/cmk/gui/pagetypes.py
+++ b/cmk/gui/pagetypes.py
@@ -356,7 +356,7 @@ class PageRenderer(Base):
def page_handlers(cls):
handlers = super(PageRenderer, cls).page_handlers()
handlers.update({
- cls.type_name(): lambda: cls.page_show(),
+ cls.type_name(): cls.page_show,
})
return handlers
@@ -448,8 +448,8 @@ class Overridable(Base):
def page_handlers(cls):
handlers = super(Overridable, cls).page_handlers()
handlers.update({
- "%ss" % cls.type_name() : lambda: cls.page_list(),
- "edit_%s" % cls.type_name() : lambda: cls.page_edit(),
+ "%ss" % cls.type_name() : cls.page_list,
+ "edit_%s" % cls.type_name() : cls.page_edit,
})
return handlers
@@ -1237,7 +1237,7 @@ class OverridableContainer(Overridable, Container):
handlers = super(OverridableContainer, cls).page_handlers()
handlers.update({
# Ajax handler for adding elements to a container
- "ajax_pagetype_add_element": lambda: cls.ajax_add_element()
+ "ajax_pagetype_add_element": cls.ajax_add_element
})
return handlers
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 1b5807c..89afb96 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -77,9 +77,8 @@ disable=
wrong-import-order,
wrong-import-position,
#---------------------------------------------------------------------------
- # The 3 warnings below have already been fixed for non-web/ code. When the
+ # The 2 warnings below have already been fixed for non-web/ code. When the
# upcoming reorganization of web/ has been landed, these should be fixed first.
- unnecessary-lambda,
unnecessary-pass,
useless-super-delegation,
#---------------------------------------------------------------------------