wfexs_backend.pushers
#
Submodules#
wfexs_backend.pushers.abstract_token_export
wfexs_backend.pushers.abstract_contexted_export
wfexs_backend.pushers.nextcloud_export
wfexs_backend.pushers.dataverse_export
wfexs_backend.pushers.zenodo_export
wfexs_backend.pushers.cache_export
wfexs_backend.pushers.b2share_export
wfexs_backend.pushers.abstract_token_sandboxed_export
Package Contents#
Classes#
Abstract class to model stateful export plugins |
|
Abstract class to model drafted stateful export plugins |
API#
- class wfexs_backend.pushers.DraftEntry#
Bases:
typing.NamedTuple
- class wfexs_backend.pushers.AbstractExportPlugin(refdir: pathlib.Path, setup_block: SecurityContextConfig | None = None, default_licences: Sequence[LicenceDescription] = [], default_orcids: Sequence[ResolvedORCID] = [], default_preferred_id: str | None = None)#
Bases:
abc.ABC
Abstract class to model stateful export plugins
Initialization
- PLUGIN_NAME: ClassVar[SymbolicName] = 'cast(...)'#
- abstract push(items: Sequence[AnyContent], preferred_id: str | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = [], metadata: Mapping[str, Any] | None = None, community_specific_metadata: Mapping[str, Any] | None = None) Sequence[URIWithMetadata] #
This is the method to be implemented by the stateful pusher
- abstract get_pid_metadata(pid: str) Mapping[str, Any] | None #
This method is used to obtained the metadata associated to a PID, in case the destination allows it.
- get_pid_draftentry(pid: str) DraftEntry | None #
This method is used to obtained the metadata associated to a PID, in case the destination allows it.
- abstract book_pid(preferred_id: str | None = None, initially_required_metadata: Mapping[str, Any] | None = None, initially_required_community_specific_metadata: Mapping[str, Any] | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) DraftEntry | None #
This method is used to book a new PID, in case the destination allows it.
We can even “suggest” either a new or existing PID.
It can return both the internal PID as the future, official one. It also returns the associated internal metadata.
When it returns None, it means either the destination does not allow booking pids, either temporary or permanently
- property _customized_book_pid_error_string: str#
This method can be overridden to provide more context
- abstract discard_booked_pid(pid_or_draft: str | DraftEntry) bool #
This method is used to release a previously booked PID, which has not been published.
When it returns False, it means that the provided id did exist, but it was not a draft
- classmethod PluginName() wfexs_backend.common.SymbolicName #
- class wfexs_backend.pushers.AbstractDraftedExportPlugin(refdir: pathlib.Path, setup_block: SecurityContextConfig | None = None, default_licences: Sequence[LicenceDescription] = [], default_orcids: Sequence[ResolvedORCID] = [], default_preferred_id: str | None = None)#
Bases:
wfexs_backend.pushers.AbstractExportPlugin
Abstract class to model drafted stateful export plugins
Initialization
- abstract upload_file_to_draft(draft_entry: wfexs_backend.pushers.DraftEntry, filename: str | IO[bytes], remote_filename: str | None, content_size: int | None = None) Mapping[str, Any] #
It takes as input the draft record representation, a local filename and optionally the remote filename to use
- upload_file_to_draft_by_id(record_id: str, filename: str | IO[bytes], remote_filename: str | None) Mapping[str, Any] #
- abstract update_record_metadata(draft_entry: wfexs_backend.pushers.DraftEntry, metadata: Mapping[str, Any] | None = None, community_specific_metadata: Mapping[str, Any] | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) Mapping[str, Any] #
This method updates the (draft or not) record metadata, both the general one, and the specific of the community. This one could not make sense for some providers.
- update_record_metadata_by_id(record_id: str, metadata: Mapping[str, Any] | None = None, community_specific_metadata: Mapping[str, Any] | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) Mapping[str, Any] #
This method updates the (draft or not) record metadata, both the general one, and the specific of the community. This one could not make sense for some providers.
- abstract publish_draft_record(draft_entry: wfexs_backend.pushers.DraftEntry) Mapping[str, Any] #
This method publishes a draft record, so its public id is permanent