DocumentProfile
yosoi.documents.DocumentProfile
class DocumentProfile(ImmutableModel):
Validated representation and schema for retained payload bytes.
Attributes: representation: source, rendered_dom, or accessibility_tree selects capabilities. source_format: Owned payload syntax: html, xml, json, or text. schema_profile: Exact parser/schema profile, serialized under the field name schema. epoch: Positive generation for rendered DOM and accessibility snapshots; source profiles omit it.
Source: python/yosoi/documents.py:34
Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.
Fields and class attributes
Section titled “Fields and class attributes”representation: Literal['source', 'rendered_dom', 'accessibility_tree']
source_format: SourceFormat
schema_profile: Literal['html5', 'xml10', 'json_rfc8259', 'utf8_text', 'yosoi_rendered_dom_v1', 'yosoi_accessibility_tree_v1'] = Field(alias='schema')
epoch: DocumentEpoch | None = None
Methods
Section titled “Methods”source_html
Section titled “source_html”@classmethod
def source_html(cls) -> Self:
Return a source HTML5 profile without a snapshot epoch.
Source: python/yosoi/documents.py:70
source_xml
Section titled “source_xml”@classmethod
def source_xml(cls) -> Self:
Return a source XML 1.0 profile without a snapshot epoch.
Source: python/yosoi/documents.py:77
source_json
Section titled “source_json”@classmethod
def source_json(cls) -> Self:
Return a source RFC 8259 JSON profile without a snapshot epoch.
Source: python/yosoi/documents.py:82
source_text
Section titled “source_text”@classmethod
def source_text(cls) -> Self:
Return a source UTF-8 text profile without a snapshot epoch.
Source: python/yosoi/documents.py:91
rendered_dom
Section titled “rendered_dom”@classmethod
def rendered_dom(cls, epoch: int | DocumentEpoch) -> Self:
Declare retained rendered DOM snapshot interpretation.
Args: epoch: Positive immutable browser snapshot generation.
Returns: A validated profile without capturing a live browser.
Raises: pydantic.ValidationError: Epoch or authoring fields are invalid. DocumentError: Native profile or document validation rejects the inputs.
Source: python/yosoi/documents.py:98
accessibility_tree
Section titled “accessibility_tree”@classmethod
def accessibility_tree(cls, epoch: int | DocumentEpoch) -> Self:
Declare retained accessibility snapshot interpretation.
Args: epoch: Positive immutable browser snapshot generation.
Returns: A validated profile without capturing a live browser.
Raises: pydantic.ValidationError: Epoch or authoring fields are invalid. DocumentError: Native profile or document validation rejects the inputs.
Source: python/yosoi/documents.py:119
document_class
Section titled “document_class”@property
def document_class(self) -> DocumentClass:
Return the native capability class for this validated profile.