boss.factory
============

.. py:module:: boss.factory


Classes
-------

.. autoapisummary::

   boss.factory.BOSSObject
   boss.factory.Factory
   boss.factory.HEROFactory
   boss.factory.DatasourceHEROFactory
   boss.factory.PolledDatasourceHEROFactory


Functions
---------

.. autoapisummary::

   boss.factory.wrap_hero_class


Module Contents
---------------

.. py:class:: BOSSObject

   .. py:method:: _stop(boss: heros.RemoteHERO)


.. py:function:: wrap_hero_class(source_class: type, name: str, arg_dict: dict, wrap_target: str | None = None) -> type

   Wrap the source class to establish HEROS compatibility.

   BOSS supports different external libraries which require extra treatment to expose them correctly to the HERO
   network. This function returns a HEROS compatible representation of the source class.

   :param source_class: The class to be wrapped
   :param name: Name of the HERO to be created from the ``source_class``
   :param arg_dict: Arguments to be passed to ``source_class.__init__``
   :param wrap_target: By default (``None`` or ``"auto"``), the function tries to automatically find from which library
                       the source class is and wrap it accordingly. By specifying ``wrap_target`` the wrapper function can be
                       controlled or wrapping can be turned off by passing ``no_wrap``.


.. py:class:: Factory

   .. py:attribute:: _mixin_class
      :type:  type


   .. py:method:: _build(classname: str, name: str, arg_dict: dict | None = None, extra_decorators: list[tuple[str, str]] | None = None, wrap_target: str | None = None, realm: str = 'heros', session_manager=None, tags: list | None = None)
      :classmethod:



   .. py:method:: _get_init_replacement(source_class: type, name: str, realm: str, session_manager, tags: list | None) -> Callable
      :classmethod:

      :abstractmethod:



   .. py:method:: _decorate_methods(source_class: Any, extra_decorators: list[tuple[str, str]]) -> Any
      :staticmethod:


      Wrap methods on the class before instantiation.



.. py:class:: HEROFactory

   Bases: :py:obj:`Factory`


   .. py:attribute:: _mixin_class


   .. py:method:: build(classname: str, name: str, arg_dict: dict | None = None, extra_decorators: list[tuple[str, str]] | None = None, wrap_target: str | None = None, realm='heros', session_manager=None, tags: list | None = None)
      :classmethod:



   .. py:method:: _get_init_replacement(source_class: type, name: str, realm: str, session_manager, tags: list | None) -> Callable
      :classmethod:



.. py:class:: DatasourceHEROFactory

   Bases: :py:obj:`HEROFactory`


   .. py:attribute:: _mixin_class


   .. py:attribute:: _observables
      :type:  dict


   .. py:method:: build(classname: str, name: str, arg_dict: dict | None = None, extra_decorators: list[tuple[str, str]] | None = None, wrap_target: str | None = None, observables: dict | None = None, realm='heros', session_manager=None, tags: list | None = None)
      :classmethod:



   .. py:method:: _get_init_replacement(source_class: type, name: str, realm: str, session_manager, tags: list | None) -> Callable
      :classmethod:



.. py:class:: PolledDatasourceHEROFactory

   Bases: :py:obj:`Factory`


   .. py:attribute:: _mixin_class


   .. py:attribute:: _observables
      :type:  dict


   .. py:attribute:: _interval
      :type:  float


   .. py:method:: build(classname: str, name: str, arg_dict: dict | None = None, extra_decorators: list[tuple[str, str]] | None = None, wrap_target: str | None = None, loop: asyncio.AbstractEventLoop = asyncio.new_event_loop(), interval: float = 5, observables: dict | None = None, realm='heros', session_manager=None, tags: list | None = None)
      :classmethod:



   .. py:method:: _get_init_replacement(source_class: type, name: str, realm: str, session_manager, tags: list | None) -> Callable
      :classmethod:



