_shape.py 441 B

123456789101112131415
  1. import sys
  2. from typing import Sequence, Tuple, Union, TYPE_CHECKING
  3. if TYPE_CHECKING:
  4. if sys.version_info >= (3, 8):
  5. from typing import SupportsIndex
  6. else:
  7. from typing_extensions import Protocol
  8. class SupportsIndex(Protocol):
  9. def __index__(self) -> int: ...
  10. _Shape = Tuple[int, ...]
  11. # Anything that can be coerced to a shape tuple
  12. _ShapeLike = Union["SupportsIndex", Sequence["SupportsIndex"]]