__init__.pyi

4.6 kB · python · 118 lines

1from typing import Any, Literal23from numpy.typing import NDArray4import mrlypy.math.name5from . import baseq, catalog, code, factory, universe, word67class Design:8    """A single design with its place in the orbit structure."""9    @property10    def i(self) -> int:11        """The design's code."""12    @i.setter13    def i(self, value: int) -> None: ...14    @property15    def dimension(self) -> int:16        """The design's dimension."""17    @dimension.setter18    def dimension(self, value: int) -> None: ...19    @property20    def canonical(self) -> bool:21        """Whether this code is the smallest in its orbit."""22    @canonical.setter23    def canonical(self, value: bool) -> None: ...24    @property25    def class_rep(self) -> int:26        """The smallest code in the orbit."""27    @class_rep.setter28    def class_rep(self, value: int) -> None: ...29    @property30    def orbit_size(self) -> int:31        """The number of codes in the orbit."""32    @orbit_size.setter33    def orbit_size(self, value: int) -> None: ...34    def anf(self) -> str:35        """Returns the design's algebraic normal form as a string."""36    def degree(self) -> int:37        """Returns the design's algebraic degree, or -1 for the zero design."""38    def name(self) -> str:39        """Returns the design's name as a line of prose, `bang dim 2, code 7`."""40    def rule(self) -> list[bytes]:41        """Returns the design's filled corners in sorted order."""42    @staticmethod43    def from_dict(data: Any) -> Design:44        """Reads plain data into the class."""45    def to_dict(self) -> Any:46        """Returns the value as plain data."""4748class Universe:49    """The complete enumeration of one dimension's designs and orbits."""50    def __init__(self, dimension: int) -> None: ...51    @property52    def dimension(self) -> int:53        """The universe's dimension."""54    @dimension.setter55    def dimension(self, value: int) -> None: ...56    @property57    def total(self) -> int:58        """The number of codes in the universe."""59    @total.setter60    def total(self, value: int) -> None: ...61    def all(self) -> list[Design]:62        """Returns every design in code order."""63    def canonical(self) -> list[Design]:64        """Returns the designs whose codes lead their orbits."""65    def design(self, code: int) -> Design:66        """Returns the design at a code with its precomputed orbit facts."""67    def distinct(self) -> int:68        """Returns the number of distinct orbits."""69    @staticmethod70    def new(dimension: int) -> Universe:71        """Enumerates every orbit of a dimension from 1 to 4."""72    @staticmethod73    def from_dict(data: Any) -> Universe:74        """Reads plain data into the class."""75    def to_dict(self) -> Any:76        """Returns the value as plain data."""7778class MagicLayer:79    """One ordered layer of a magic composition: a coded design at its own side number."""80    @staticmethod81    def new(design: mrlypy.math.name.Bang, number: int) -> dict[str, Any]:82        """Pins a design to the side number it renders at."""8384def bang(dimension: int) -> Universe:85    """Builds the universe of a dimension."""8687def code_to_corners(code: int, dimension: int, base: int) -> list[bytes]:88    """Unpacks a code into its filled residue corners."""8990def corners(dimension: int) -> list[bytes]:91    """Returns the binary corners of a dimension in code order."""9293def corners_to_code(filled: list[bytes], dimension: int, base: int) -> int:94    """Packs filled residue corners back into their code."""9596def levels_code(dimension: int, base: int, levels: list[int]) -> int:97    """Returns the code of the design filled wherever a corner's residue sum lands in the levels."""9899def magic(layers: list[dict[str, Any]]) -> NDArray[Any]:100    """Composes the layers into one mixed-design cell by the ordered Kronecker product, first layer outermost."""101102def magic_named(layers: list[tuple[str, int]]) -> NDArray[Any]:103    """Composes JSON-named layers in order."""104105def sources(catalog: Any, dimension: int) -> list[Any]:106    """Builds the tile sources a catalog names at a dimension."""107108def symmetries(dimension: int) -> list[tuple[list[int], bytes]]:109    """Returns the full symmetry group as axis permutations paired with flip patterns."""110111def total_exposure(code: int, dimension: int) -> bool:112    """Returns whether no two filled corners of a code sit at Hamming distance one."""113114def touches_every_corner(code: int, dimension: int) -> bool:115    """Returns whether a code fills the all-even corner, the rule that touches every grid corner at odd side."""116117def universe_codes(dimension: int) -> list[int]:118    """Returns the canonical design codes of a dimension, computed once and cached for the process."""