summaryrefslogtreecommitdiff
path: root/numpy/typing/_shape.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-06-14 14:07:18 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-06-14 14:07:18 -0600
commit8c78b84968e580f24b3705378fb35705a434cdf1 (patch)
treec9f82beeb5a2c3f0301f7984d4b6d19539c35d23 /numpy/typing/_shape.py
parent8bf3a4618f1de951c7a4ccdb8bc3e36825a1b744 (diff)
parent75f852edf94a7293e7982ad516bee314d7187c2d (diff)
downloadnumpy-8c78b84968e580f24b3705378fb35705a434cdf1.tar.gz
Merge branch 'main' into matrix_rank-doc-fix
Diffstat (limited to 'numpy/typing/_shape.py')
-rw-r--r--numpy/typing/_shape.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/numpy/typing/_shape.py b/numpy/typing/_shape.py
index 4629046ea..75698f3d3 100644
--- a/numpy/typing/_shape.py
+++ b/numpy/typing/_shape.py
@@ -1,6 +1,16 @@
-from typing import Sequence, Tuple, Union
+import sys
+from typing import Sequence, Tuple, Union, Any
+
+from . import _HAS_TYPING_EXTENSIONS
+
+if sys.version_info >= (3, 8):
+ from typing import SupportsIndex
+elif _HAS_TYPING_EXTENSIONS:
+ from typing_extensions import SupportsIndex
+else:
+ SupportsIndex = Any
_Shape = Tuple[int, ...]
# Anything that can be coerced to a shape tuple
-_ShapeLike = Union[int, Sequence[int]]
+_ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]