shape.pyi 292 B

123456789101112131415
  1. from typing import Any, NamedTuple
  2. import numpy as np
  3. from typing_extensions import assert_type
  4. # Subtype of tuple[int, int]
  5. class XYGrid(NamedTuple):
  6. x_axis: int
  7. y_axis: int
  8. arr: np.ndarray[XYGrid, Any]
  9. # Test shape property matches shape typevar
  10. assert_type(arr.shape, XYGrid)