Source code for cadrumo.application.ledger.evidence_textlayer_ports
"""Application-owned capability for reading PDF text-layer pages.The evidence use cases decide when a deterministic text read is appropriate;the composition root supplies the reader. Keeping this contract here leavesthe PDF library and its exception shape at the outer adapter boundary whilethe application works with in-memory bytes, page text, and its own refusaltype."""from__future__importannotationsfromdataclassesimportdataclassfromtypingimportProtocol
[docs]classEvidencePageTextExtractor(Protocol):"""Read PDF bytes into ordered, application-owned page text values."""def__call__(self,data:bytes)->tuple[str,...]:"""Return one stripped text value per source page."""...
[docs]@dataclass(frozen=True,slots=True)classEvidenceTextLayerPorts:"""Required page-text capability supplied by outer composition."""extract_pages_text:EvidencePageTextExtractor