This module contains type aliases used throughout the NumberLink codebase.
numberlink.typesΒΆ
Type AliasesΒΆ
- type numberlink.types.RenderMode[source]ΒΆ
Canonical type:
Literal["rgb_array", "ansi", "human"]Rendering mode for the environment. Can be
"rgb_array","ansi", or"human".
- type numberlink.types.Coord[source]ΒΆ
Canonical type:
tuple[int, int]A coordinate pair
(row, column)representing a grid position.
- type numberlink.types.Lane[source]ΒΆ
Canonical type:
Literal["n", "v", "h"]Lane indicator for bridge cells.
"n"marks a normal cell,"v"marks the vertical lane, and"h"marks the horizontal lane.
- type numberlink.types.CellLane[source]ΒΆ
Canonical type:
tuple[int, int, Lane]A cell coordinate and the active lane encoded as
(row, column, lane).
- type numberlink.types.RGBInt[source]ΒΆ
Canonical type:
tuple[int, int, int]An RGB color stored as three integers
(red, green, blue).
Utility FunctionsΒΆ
- numberlink.types.select_signed_dtype(min_value: int, max_value: int) type[signedinteger][source]ΒΆ
Return the smallest signed
numpyinteger dtype that covers a range.Inspect the absolute bounds of
min_valueandmax_valueand return one ofnumpy.int8,numpy.int16,numpy.int32, ornumpy.int64depending on which type can represent the full range.- Parameters:
- Returns:
Appropriate
numpysigned integer dtype type.- Return type:
- numberlink.types.select_unsigned_dtype(max_value: int) type[unsignedinteger][source]ΒΆ
Return the smallest unsigned
numpyinteger dtype that covers0..``max_value``.Select among
numpy.uint8,numpy.uint16,numpy.uint32, andnumpy.uint64based on the provided maximum value. Values below0are clamped to0before selection.
Typed dictsΒΆ
- class numberlink.types.Snapshot[source]ΒΆ
Runtime snapshot captured by
numberlink.viewer.NumberLinkViewer._snapshot_state().The snapshot contains internal environment arrays and viewer selection state used to restore a previous runtime configuration via
numberlink.viewer.NumberLinkViewer._restore_state().