hermes.commands.process.invenio_merge
Classes
|
|
Base plugin that defines additional merge strategies. |
Module Contents
- class hermes.commands.process.invenio_merge.InvenioMerge
Bases:
hermes.model.merge.action.MergeActionMergeActionproviding 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]]isvalueand for the outermost parent oftargetout_parentout_parent[key[0]]...[key[-1]]results invalue.value (ld_merge_list | str) – The value inside
targetthat is to be merged withupdate.update (BASIC_TYPE | TIME_TYPE | ld_dict | ld_list) – The value that is to be merged into
targetwithvalue.
- Returns:
The merged value in an arbitrary format that is supported by
ld_dict.__setitem__().- Return type:
- class hermes.commands.process.invenio_merge.InvenioProcessPlugin
Bases:
hermes.commands.process.base.HermesProcessPluginBase 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]]