hermes.commands.process.invenio_merge

Classes

InvenioMerge

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

InvenioProcessPlugin

Base plugin that defines additional merge strategies.

Module Contents

class hermes.commands.process.invenio_merge.InvenioMerge

Bases: hermes.model.merge.action.MergeAction

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

merge(target: hermes.model.merge.container.ld_merge_dict, key: list[str | int], value: hermes.model.merge.container.ld_merge_list | str, update: 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.

Parameters:
  • target (ld_merge_dict) – The ld_merge_dict inside of which the items are merged.

  • key (list[str | int]) – 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.

  • value (ld_merge_list | str) – The value inside target that is to be merged with update.

  • update (BASIC_TYPE | TIME_TYPE | ld_dict | ld_list) – The value that is to be merged into target with value.

Returns:

The merged value in an arbitrary format that is supported by ld_dict.__setitem__().

Return type:

JSON_LD_VALUE | BASIC_TYPE | TIME_TYPE | ld_dict | ld_list

class hermes.commands.process.invenio_merge.InvenioProcessPlugin

Bases: hermes.commands.process.base.HermesProcessPlugin

Base plugin that defines additional merge strategies.

__call__(command: hermes.commands.base.HermesCommand) dict[str | None, dict[str | None, hermes.model.merge.action.MergeAction]]

Execute the hermes process plugin self.

Parameters:

command (HermesProcessCommand) – The command being executed.

Returns:

The merge strategies.

Return type:

dict[str | None, dict[str | None, MergeAction]]