Skip to content

Class swarmauri_core.xmp.IEmbedXMP.IEmbedXMP

swarmauri_core.xmp.IEmbedXMP.IEmbedXMP

Bases: ABC

Interface implemented by components that manage embedded XMP packets.

supports abstractmethod

supports(header, path)

Return True when the handler can operate on the supplied payload.

Source code in swarmauri_core/xmp/IEmbedXMP.py
12
13
14
@abc.abstractmethod
def supports(self, header: bytes, path: str) -> bool:
    """Return ``True`` when the handler can operate on the supplied payload."""

read_xmp abstractmethod

read_xmp(data)

Extract an XMP packet from data if present.

Source code in swarmauri_core/xmp/IEmbedXMP.py
16
17
18
@abc.abstractmethod
def read_xmp(self, data: bytes) -> Optional[str]:
    """Extract an XMP packet from ``data`` if present."""

write_xmp abstractmethod

write_xmp(data, xmp_xml)

Return a copy of data with xmp_xml embedded.

Source code in swarmauri_core/xmp/IEmbedXMP.py
20
21
22
@abc.abstractmethod
def write_xmp(self, data: bytes, xmp_xml: str) -> bytes:
    """Return a copy of ``data`` with ``xmp_xml`` embedded."""

remove_xmp abstractmethod

remove_xmp(data)

Return data with any embedded XMP removed.

Source code in swarmauri_core/xmp/IEmbedXMP.py
24
25
26
@abc.abstractmethod
def remove_xmp(self, data: bytes) -> bytes:
    """Return ``data`` with any embedded XMP removed."""