Skip to content
YosoiDocs

ParsedDocument

yosoi.documents.ParsedDocument

class ParsedDocument:

A reusable Rust parse; close explicitly or use it as a context manager.

Source: python/yosoi/documents.py:467

Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.

def __init__(self, handle: _native.ParsedDocument) -> None:

Retain a native parse handle without acquiring or reparsing data.

Args: handle: Native owner returned by a supported parse operation.

Source: python/yosoi/documents.py:470

def locate(self, plan: Plan) -> LocateOutcome:

Reuse retained parse evidence for an authored locator plan.

Args: plan: Outputs and projections to evaluate against the parse.

Returns: Typed matches, absence, incomplete evidence, or failure.

Raises: ClosedResourceError: The parse has already been closed.

Source: python/yosoi/documents.py:478

@property
def closed(self) -> bool:

Return whether native parse ownership has been explicitly closed.

Source: python/yosoi/documents.py:493

def close(self) -> None:

Close native parse ownership; repeated closes are harmless.

Source: python/yosoi/documents.py:497

def __enter__(self) -> Self:

Return this parse owner for context-managed use.

Raises: ClosedResourceError: The parse was closed before context entry.

Source: python/yosoi/documents.py:501

def __exit__(self, *args: object) -> None:

Close native parse ownership on context exit, including on errors.

Source: python/yosoi/documents.py:511