Module: check_mk
Branch: master
Commit: 86a13a6d3c5a7db0fbd202e8118808f8dd508f70
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86a13a6d3c5a7d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 16 09:55:46 2018 +0200
Plugin registry: Add explicit registering method and decorator
* Plugins will be changed to register explicitly with the registry
* The automatic plugin discovery will be dropped later
Change-Id: Iea9a89c92eda06ac5cab796a577269fbf92f5521
---
cmk/gui/plugin_registry.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/cmk/gui/plugin_registry.py b/cmk/gui/plugin_registry.py
index ddd68bc..ce29a44 100644
--- a/cmk/gui/plugin_registry.py
+++ b/cmk/gui/plugin_registry.py
@@ -35,8 +35,9 @@ class Registry(object):
The snapins are loaded by importing cmk.gui.plugins.[component]. These plugins
contain subclasses of the cmk.gui.plugins.PluginBase (e.g. SidebarSnpain) class.
- Registry.load_plugins() will register all snapins with this management
- object and make them available for use.
+
+ Entries are registered with this registry using either the register_plugin()
+ method or the Registry.register() decorator.
"""
__metaclass__ = abc.ABCMeta
@@ -79,6 +80,20 @@ class Registry(object):
@abc.abstractmethod
def register(self, plugin_class):
+ """Decorator to register a class with the registry"""
+ self._register(plugin_class)
+
+
+ @abc.abstractmethod
+ def register_plugin(self, plugin_class):
+ """Method for registering a plugin with the registry.
+
+ Result is equal to use the register() decorator"""
+ self._register(plugin_class)
+
+
+ @abc.abstractmethod
+ def _register(self, plugin_class):
raise NotImplementedError()
Module: check_mk
Branch: master
Commit: a54c82aac62afd63a5d316c25f4bf75d5229deac
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a54c82aac62afd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 24 08:22:53 2018 +0200
pylint: enable too-many-branches checker
Change-Id: Ia5d727e538e72d05a38538e130793bcf46424cbd
---
tests/pylint/pylintrc | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index ab09382..f018401 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -68,10 +68,6 @@ disable=
# depending on an implicit protocol to create them is an even worse one.
global-variable-undefined,
#---------------------------------------------------------------------------
- # We should enable this, at the moment it just means splitting up two
- # gigantic functions.
- too-many-branches,
- #---------------------------------------------------------------------------
# We have tons of unused imports, it is just a matter of removing them and
# leave those which have a "magic" purpose.
unused-import,