hermes.commands.process.invenio_merge
=====================================

.. py:module:: hermes.commands.process.invenio_merge


Classes
-------

.. autoapisummary::

   hermes.commands.process.invenio_merge.InvenioMerge
   hermes.commands.process.invenio_merge.InvenioProcessPlugin


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

.. py:class:: InvenioMerge

   Bases: :py:obj:`hermes.model.merge.action.MergeAction`


   :class:`MergeAction` providing a merge function that tries to conform with Invenios metadata restrictions.


   .. py:method:: merge(target: hermes.model.merge.container.ld_merge_dict, key: list[Union[str, int]], value: Union[hermes.model.merge.container.ld_merge_list, str], update: Union[hermes.model.types.ld_container.BASIC_TYPE, hermes.model.types.ld_container.TIME_TYPE, hermes.model.types.ld_dict, hermes.model.types.ld_list]) -> hermes.model.merge.container.ld_merge_list

      An abstract method that needs to be implemented by all subclasses
      to have a generic way to use the merge actions.

      :param target: The ld_merge_dict inside of which the items are merged.
      :type target: ld_merge_dict
      :param key: The "path" of keys so that ``target[key[-1]]`` is ``value`` and for the outermost
                  parent of ``target`` out_parent ``out_parent[key[0]]...[key[-1]]`` results in ``value``.
      :type key: list[str | int]
      :param value: The value inside ``target`` that is to be merged with ``update``.
      :type value: ld_merge_list | str
      :param update: The value that is to be merged into ``target``
                     with ``value``.
      :type update: BASIC_TYPE | TIME_TYPE | ld_dict | ld_list

      :returns:     The merged value in an arbitrary format that is supported by :meth:`ld_dict.__setitem__`.
      :rtype: JSON_LD_VALUE | BASIC_TYPE | TIME_TYPE | ld_dict | ld_list



.. py:class:: InvenioProcessPlugin

   Bases: :py:obj:`hermes.commands.process.base.HermesProcessPlugin`


   Base plugin that defines additional merge strategies.


   .. py:method:: __call__(command: hermes.commands.base.HermesCommand) -> dict[Union[str, None], dict[Union[str, None], hermes.model.merge.action.MergeAction]]

      Execute the hermes process plugin `self`.

      :param command: The command being executed.
      :type command: HermesProcessCommand

      :returns: The merge strategies.
      :rtype: dict[str | None, dict[str | None, MergeAction]]



