Skip to content
Snippets Groups Projects
Commit 47498f06 authored by Stefano Borini's avatar Stefano Borini
Browse files

Added passing through to all other factory classes

parent 2f4bbfd4
No related branches found
No related tags found
1 merge request!158Introduces base class and interface for the factories
...@@ -26,8 +26,11 @@ class BaseMCOFactory(BaseFactory): ...@@ -26,8 +26,11 @@ class BaseMCOFactory(BaseFactory):
#: The communicator associated to the MCO. Define this to your MCO comm. #: The communicator associated to the MCO. Define this to your MCO comm.
communicator_class = Type(BaseMCOCommunicator, allow_none=False) communicator_class = Type(BaseMCOCommunicator, allow_none=False)
def __init__(self, plugin): def __init__(self, plugin, *args, **kwargs):
super(BaseMCOFactory, self).__init__(plugin=plugin) super(BaseMCOFactory, self).__init__(
plugin=plugin,
*args,
**kwargs)
self.optimizer_class = self.get_optimizer_class() self.optimizer_class = self.get_optimizer_class()
self.model_class = self.get_model_class() self.model_class = self.get_model_class()
......
...@@ -39,10 +39,12 @@ class BaseMCOParameterFactory(BaseFactory): ...@@ -39,10 +39,12 @@ class BaseMCOParameterFactory(BaseFactory):
"get_model_class was not implemented in factory {}".format( "get_model_class was not implemented in factory {}".format(
self.__class__)) self.__class__))
def __init__(self, mco_factory): def __init__(self, mco_factory, *args, **kwargs):
self.mco_factory = mco_factory
super(BaseMCOParameterFactory, self).__init__( super(BaseMCOParameterFactory, self).__init__(
plugin=mco_factory.plugin) mco_factory=mco_factory,
plugin=mco_factory.plugin,
*args,
**kwargs)
self.description = self.get_description() self.description = self.get_description()
self.model_class = self.get_model_class() self.model_class = self.get_model_class()
......
...@@ -32,7 +32,7 @@ class BaseNotificationListenerFactory(BaseFactory): ...@@ -32,7 +32,7 @@ class BaseNotificationListenerFactory(BaseFactory):
#: listener model class. #: listener model class.
model_class = Type(BaseNotificationListenerModel, allow_none=False) model_class = Type(BaseNotificationListenerModel, allow_none=False)
def __init__(self, plugin): def __init__(self, plugin, *args, **kwargs):
"""Initializes the instance. """Initializes the instance.
Parameters Parameters
...@@ -40,7 +40,8 @@ class BaseNotificationListenerFactory(BaseFactory): ...@@ -40,7 +40,8 @@ class BaseNotificationListenerFactory(BaseFactory):
plugin: Plugin plugin: Plugin
The plugin that holds this factory. The plugin that holds this factory.
""" """
super(BaseNotificationListenerFactory, self).__init__(plugin=plugin) super(BaseNotificationListenerFactory, self).__init__(
plugin=plugin, *args, **kwargs)
self.listener_class = self.get_listener_class() self.listener_class = self.get_listener_class()
self.model_class = self.get_model_class() self.model_class = self.get_model_class()
......
...@@ -18,7 +18,7 @@ class BaseUIHooksFactory(BaseFactory): ...@@ -18,7 +18,7 @@ class BaseUIHooksFactory(BaseFactory):
#: base hook managers. #: base hook managers.
ui_hooks_manager_class = Type(BaseUIHooksManager, allow_none=False) ui_hooks_manager_class = Type(BaseUIHooksManager, allow_none=False)
def __init__(self, plugin): def __init__(self, plugin, *args, **kwargs):
"""Initializes the instance. """Initializes the instance.
Parameters Parameters
...@@ -26,7 +26,8 @@ class BaseUIHooksFactory(BaseFactory): ...@@ -26,7 +26,8 @@ class BaseUIHooksFactory(BaseFactory):
plugin: Plugin plugin: Plugin
The plugin that holds this factory. The plugin that holds this factory.
""" """
super(BaseUIHooksFactory, self).__init__(plugin=plugin) super(BaseUIHooksFactory, self).__init__(
plugin=plugin, *args, **kwargs)
self.ui_hooks_manager_class = self.get_ui_hooks_manager_class() self.ui_hooks_manager_class = self.get_ui_hooks_manager_class()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment