Skip to content

library

pleat.gjh.library

Eager-loaded library of cached :data:TilesetSpecs indexed by GJH code.

At import time we scan pleat/gjh/_data/ for *.yml files, parse each into a :data:TilesetSpec, and read the GJH code from the leading # GJH: <code> comment. :data:GJH_CODES preserves the numeric filename prefix as the canonical ordering (regular → 1-uniform → 2-uniform → 3-uniform), matching the source paper.

cached_spec

cached_spec(code: str) -> TilesetSpec

Return the cached :data:TilesetSpec for code. Raises :class:KeyError if unknown.

Source code in pleat/gjh/library.py
def cached_spec(code: str) -> TilesetSpec:
    """Return the cached :data:`TilesetSpec` for ``code``. Raises :class:`KeyError` if unknown."""
    code = code.replace(" ", "")
    try:
        return CACHED_SPECS[code]
    except KeyError as e:
        raise KeyError(f"GJH code {code!r} is not in the cached library") from e