hermes.commands.harvest.base

Classes

HermesHarvestPlugin

Base plugin that does harvesting.

HarvestSettings

Generic harvesting settings.

HermesHarvestCommand

Harvest metadata from configured sources.

Functions

remove_harvest_plugin_from_prov_doc(→ None)

Removes information on the specified harvest plugin from the given provenance document.

Module Contents

class hermes.commands.harvest.base.HermesHarvestPlugin

Bases: hermes.commands.base.HermesPlugin

Base plugin that does harvesting.

operations

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

Type:

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

TODO: describe the harvesting process and how this is mapped to this plugin.

__call__(command: HermesHarvestCommand) hermes.model.SoftwareMetadata

Execute the hermes harvest plugin self.

Parameters:

command (HermesHarvestCommand) – The command being executed.

Returns:

The harvested metadata.

Return type:

SoftwareMetadata

load(func: Callable, source: Any, *args: Any | None, encoding: str | None = 'utf-8', **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.

  • encoding (str) – Encoding for loaded file, utf-8 is default.

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

Returns:

The result of the load operation.

Return type:

Any

class hermes.commands.harvest.base.HarvestSettings(/, **data: Any)

Bases: pydantic.BaseModel

Generic harvesting settings.

sources

(class attribute) A list of plugins to be executed.

Type:

list[str]

hermes.commands.harvest.base.remove_harvest_plugin_from_prov_doc(prov_doc: hermes.model.provenance.ld_prov.ld_prov_list, plugin: str) None

Removes information on the specified harvest plugin from the given provenance document.

Parameters:
  • prov_doc (ld_prov_list) – The provenance document the plugins information is to be removed from.

  • plugin (str) – The name of the plugin of which the information is to be removed.

Return type:

None

class hermes.commands.harvest.base.HermesHarvestCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Harvest metadata from configured sources.

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 harvest 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:
classmethod init_provenance_document() hermes.model.provenance.ld_prov.ld_prov_list

Loads or creates a provenance document.

Returns:

The loaded or created provenance document.

Return type:

ld_prov_list