Skip to content

Reference

🛈 DocStrings

A pinned upstream schema release.

Source code in src/aclientp/schema_reference.py
@dataclass(frozen=True)
class Reference:
    """A pinned upstream schema release."""

    protocol_version: int
    tag: str
    schema: JSON
    meta: JSON
    directory: UPath

    @classmethod
    def load(cls, protocol_version: int, root: UPath = REFERENCE_ROOT) -> Reference:
        """Load the pinned reference of ``protocol_version``."""
        directory = root / f"v{protocol_version}"
        tag = (directory / "VERSION").read_text("utf-8").strip()
        schema = json.loads((directory / "schema.unstable.json").read_text("utf-8"))
        meta = json.loads((directory / "meta.unstable.json").read_text("utf-8"))
        return cls(protocol_version, tag, schema, meta, directory)

    @property
    def parsed(self) -> UpstreamSchema:
        return UpstreamSchema.parse(self.schema, self.meta)

load classmethod

load(protocol_version: int, root: UPath = REFERENCE_ROOT) -> Reference

Load the pinned reference of protocol_version.

Source code in src/aclientp/schema_reference.py
@classmethod
def load(cls, protocol_version: int, root: UPath = REFERENCE_ROOT) -> Reference:
    """Load the pinned reference of ``protocol_version``."""
    directory = root / f"v{protocol_version}"
    tag = (directory / "VERSION").read_text("utf-8").strip()
    schema = json.loads((directory / "schema.unstable.json").read_text("utf-8"))
    meta = json.loads((directory / "meta.unstable.json").read_text("utf-8"))
    return cls(protocol_version, tag, schema, meta, directory)

:fa-brands-github: Show source on GitHub