moddef.codec.decode module

Point decoder (spec §8–§15). Faithful port of go/codec/decode.go and moddef-ts decode.ts, including §10.5 selector_ref case application with fallback to the point’s own transform.

moddef.codec.decode.decode_all(points: Iterable[Point], regs_by_id: Mapping[str, Sequence[int]]) dict[str, float | int | bool | str | bytes | list[str] | dict[str, int] | datetime | Unavailable][source]

Decode several points, resolving refs among them first.

moddef.codec.decode.decode_point(p: Point, regs: Sequence[int], ctx: Mapping[str, int] | None = None) float | int | bool | str | bytes | list[str] | dict[str, int] | datetime | Unavailable[source]

Decode the registers for a point into a typed value.

moddef.codec.decode.decode_point_raw(p: Point, regs: Sequence[int]) tuple[int, int][source]

Pre-scale integer view for callers that need exactness: (raw, bits).

moddef.codec.decode.is_signed(st: int) bool[source]
moddef.codec.decode.resolve_context(points: Iterable[Point], regs_by_id: Mapping[str, Sequence[int]]) dict[str, int][source]

Decode every point that is a scale_ref/selector_ref target into ints.

moddef.codec.decode.storage_bits(st: int, words: int) int[source]