hermes.commands.postprocess.base

Classes

HermesPostprocessPlugin

Base plugin for postprocess plugins.

PostprocessSettings

Generic post-processing settings.

HermesPostprocessCommand

Post-process the published metadata after deposition.

Module Contents

class hermes.commands.postprocess.base.HermesPostprocessPlugin

Bases: hermes.commands.base.HermesPlugin

Base plugin for postprocess plugins.

cache_operations

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

Type:

list[tuple[str, dict[str, str], dict[str, str]]]

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]]]

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]]]

__call__(command: HermesPostprocessCommand) None

Execute the hermes postprocess plugin self.

Parameters:

command (HermesPostprocessCommand) – The command being executed.

Return type:

None

get_deposit_result(target: str) dict

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

Parameters:

target (str) – The name of the deposit plugin.

Returns:

The result of the cache load operation.

Return type:

dict

load(func: Callable, source: Any, *args: Any | None, **kwargs: Any | None) 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.

Parameters:
  • func (Callable) – The function used for loading the requested source.

  • source (Any) – The source the data is to be loaded from.

  • args (Any | None) – Additional positional arguments for the load.

  • kwargs (Any | None) – Additional keyword arguments for the load.

Returns:

The result of the load operation.

Return type:

Any

write(func: Callable, data: Any, destination: Any, *args: Any | None, **kwargs: Any | None) 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.

Parameters:
  • func (Callable) – The function used for writing the requested source.

  • data (Any) – The data that is to be written.

  • destination (Any) – The source the data is to be written to.

  • args (Any | None) – Additional positional arguments for the write.

  • kwargs (Any | None) – Additional keyword arguments for the write.

Returns:

The result of the write operation.

Return type:

Any

class hermes.commands.postprocess.base.PostprocessSettings(/, **data: Any)

Bases: pydantic.BaseModel

Generic post-processing settings.

run

A list of plugins to be executed.

Type:

list[str]

class hermes.commands.postprocess.base.HermesPostprocessCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Post-process the published metadata after deposition.

args

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

Type:

Namespace

command_name

(class attribute) The name of the command.

Type:

str

settings_class

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

Type:

type

__call__(args: argparse.Namespace) None

Execute the hermes command self.

Parameters:

args (Namespace) – The namespace that was returned by the command line parser when reading the arguments.

Return type:

None

Raises:

HermesPluginRunError – If something went wrong with all plugin runs.

load_prov_doc() hermes.model.provenance.ld_prov.ld_prov_list | None

Loads the provenance document of the postprocess step.

Returns:

The loaded provenance document or None if the load failed.

Return type:

ld_prov_list | None