Skip to content

cmem_client.repositories.protocols.delete_item¤

Protocol interface for repository item deletion operations.

This module defines the DeleteItemProtocol that repositories can implement to provide item deletion capabilities. It includes validation to ensure items exist before deletion and provides both individual and bulk deletion methods.

The protocol implements the Python delitem method to support standard dictionary-style deletion syntax while providing comprehensive error handling for HTTP communication failures.

Classes:

  • DeleteConfig – Abstract base class for repository item deletion configurations.
  • DeleteItemProtocol – Protocol which allows for deletion of items

Attributes:

DeleteConfig¤

Bases: Model, ABC

Abstract base class for repository item deletion configurations.

Attributes:

  • model_config

DeleteItemConfig_contra¤

DeleteItemConfig_contra = TypeVar('DeleteItemConfig_contra', bound=DeleteConfig, contravariant=True)

DeleteItemProtocol¤

Bases: Protocol[ItemType, DeleteItemConfig_contra]

Protocol which allows for deletion of items

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:

delete_all¤

delete_all()

Delete all items from the repository

delete_item¤

delete_item(key, skip_if_missing=False, configuration=None)

Delete an item from the repository

Parameters:

  • key (str) – The key of the item to delete
  • skip_if_missing (bool) – If True, it is ignored if the deleted item even exists
  • configuration (DeleteItemConfig) – Optional configuration for deletion

Raises:

logger¤

logger: logging.Logger

Gets the client logger

Comments