hermes.commands.postprocess.base
================================

.. py:module:: hermes.commands.postprocess.base


Classes
-------

.. autoapisummary::

   hermes.commands.postprocess.base.HermesPostprocessPlugin
   hermes.commands.postprocess.base.PostprocessSettings
   hermes.commands.postprocess.base.HermesPostprocessCommand


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

.. py:class:: HermesPostprocessPlugin

   Bases: :py:obj:`hermes.commands.base.HermesPlugin`


   Base plugin for postprocess plugins.

   .. attribute:: cache_operations

      The information recorded on the
      cache load operations executed by the plugin.

      :type: list[tuple[str, dict[str, str], dict[str, str]]]

   .. attribute:: load_operations

      The information recorded on the
      load operations executed by the plugin.

      :type: list[tuple[dict[str, str], dict[str, str], dict[str, str]]]

   .. attribute:: write_operations

      The information recorded on the
      write operations executed by the plugin.

      :type: list[tuple[dict[str, str], dict[str, str], dict[str, str]]]


   .. py:method:: __call__(command: HermesPostprocessCommand) -> None

      Execute the hermes postprocess plugin `self`.

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

      :rtype: None



   .. py:method:: get_deposit_result(target: str) -> dict

      Load the result of some deposit plugin from the cache so that the calls provenance information is recorded.

      :param target: The name of the deposit plugin.
      :type target: str

      :returns: The result of the cache load operation.
      :rtype: dict



   .. py:method:: load(func: Callable, source: Any, *args: Optional[Any], **kwargs: Optional[Any]) -> Any

      Load some data from some source using some function so that the calls provenance information is recorded.

      `func(source, *args, **kwargs)` will be executed.

      :param func: The function used for loading the requested source.
      :type func: Callable
      :param source: The source the data is to be loaded from.
      :type source: Any
      :param args: Additional positional arguments for the load.
      :type args: Any | None
      :param kwargs: Additional keyword arguments for the load.
      :type kwargs: Any | None

      :returns: The result of the load operation.
      :rtype: Any



   .. py:method:: write(func: Callable, data: Any, destination: Any, *args: Optional[Any], **kwargs: Optional[Any]) -> Any

      Write some data from some source using some function so that the calls provenance information is recorded.

      `func(source, *args, **kwargs)` will be executed.

      :param func: The function used for writing the requested source.
      :type func: Callable
      :param data: The data that is to be written.
      :type data: Any
      :param destination: The source the data is to be written to.
      :type destination: Any
      :param args: Additional positional arguments for the write.
      :type args: Any | None
      :param kwargs: Additional keyword arguments for the write.
      :type kwargs: Any | None

      :returns: The result of the write operation.
      :rtype: Any



.. py:class:: PostprocessSettings(/, **data: Any)

   Bases: :py:obj:`pydantic.BaseModel`


   Generic post-processing settings.

   .. attribute:: run

      A list of plugins to be executed.

      :type: list[str]


.. py:class:: HermesPostprocessCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Post-process the published metadata after deposition.

   .. attribute:: args

      The namespace that was returned by the command line parser when reading the arguments.

      :type: Namespace

   .. attribute:: command_name

      (class attribute) The name of the command.

      :type: str

   .. attribute:: settings_class

      (class attribute) The settings class for general deposit settings.

      :type: type


   .. py:method:: __call__(args: argparse.Namespace) -> None

      Execute the hermes command `self`.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None

      :raises HermesPluginRunError: If something went wrong with all plugin runs.



   .. py:method:: load_prov_doc() -> Optional[hermes.model.provenance.ld_prov.ld_prov_list]

      Loads the provenance document of the postprocess step.

      :returns: The loaded provenance document or None if the load failed.
      :rtype: ld_prov_list | None



