Skip to content

cmem_client.repositories.protocols.export_item¤

Protocol interface for repository item export operations.

This module defines the ExportItemProtocol that repositories can implement to support exporting items to files.

Classes:

  • ExportConfig – Abstract base class for Export Item Configuration Objects
  • ExportItemProtocol – Protocol which allows for exporting of items to a file path.

Attributes:

ExportConfig¤

Bases: Model, ABC

Abstract base class for Export Item Configuration Objects

Attributes:

  • model_config

ExportItemConfig_contra¤

ExportItemConfig_contra = TypeVar('ExportItemConfig_contra', bound=ExportConfig, contravariant=True)

ExportItemProtocol¤

Bases: Protocol[ItemType, ExportItemConfig_contra]

Protocol which allows for exporting of items to a file path.

This protocol defines the interface that repositories must implement to support exporting items to files. It provides both a public interface method and requires implementation of a concrete export method.

Attributes:

  • _client (Client) – Corporate Memory client used for the HTTP requests of this repository.
  • _dict (dict[str, ItemType]) – Cached contents of the repository, mapping the key of each item to the item itself. Backs the Mapping interface and is populated by fetch_data().
  • _logger (Logger) – Logger of this repository, created lazily on first access through the logger property as a child of the client logger.

Functions:

  • export_item – Export an item from the repository to a file path.

export_item¤

export_item(key, path=None, replace=False, configuration=None)

Export an item from the repository to a file path.

Parameters:

  • key (str) – The key identifying the item to export.
  • path (Path | None) – The target file path for export. If None, a path will be generated.
  • replace (bool) – Whether to replace existing files at the target path.
  • configuration (ExportItemConfig_contra | None) – Optional configuration for export behavior.

Returns:

  • Path – The actual path where the item was exported.

Raises:

logger¤

logger: logging.Logger

Gets the client logger

Comments