summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-08-30 11:58:53 -0600
committerGitHub <noreply@github.com>2021-08-30 11:58:53 -0600
commitb21ad7c5ee0cd76ea41bb519877804457d1776f8 (patch)
tree2e0fbb0cc3b8e5ffe214e217f9a6a55441ac4ed4 /numpy/lib
parent5f9445052238200b905074ee188bcfdab2ef8861 (diff)
parent6b46b35e8fc081b5b0244ab5e31fcfb34ddee17f (diff)
downloadnumpy-b21ad7c5ee0cd76ea41bb519877804457d1776f8.tar.gz
Merge pull request #19784 from BvB93/37-typing
MAINT: Remove typing code-paths specific to Python 3.7
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/arraypad.pyi8
-rw-r--r--numpy/lib/arrayterator.pyi1
-rw-r--r--numpy/lib/format.pyi8
-rw-r--r--numpy/lib/index_tricks.pyi8
-rw-r--r--numpy/lib/npyio.pyi4
-rw-r--r--numpy/lib/shape_base.pyi3
-rw-r--r--numpy/lib/stride_tricks.pyi3
-rw-r--r--numpy/lib/type_check.pyi8
-rw-r--r--numpy/lib/utils.pyi7
9 files changed, 12 insertions, 38 deletions
diff --git a/numpy/lib/arraypad.pyi b/numpy/lib/arraypad.pyi
index df9538dd7..d6e07a6bd 100644
--- a/numpy/lib/arraypad.pyi
+++ b/numpy/lib/arraypad.pyi
@@ -1,11 +1,12 @@
-import sys
from typing import (
+ Literal as L,
Any,
Dict,
List,
overload,
Tuple,
TypeVar,
+ Protocol,
)
from numpy import ndarray, dtype, generic
@@ -18,11 +19,6 @@ from numpy.typing import (
_SupportsArray,
)
-if sys.version_info >= (3, 8):
- from typing import Literal as L, Protocol
-else:
- from typing_extensions import Literal as L, Protocol
-
_SCT = TypeVar("_SCT", bound=generic)
class _ModeFunc(Protocol):
diff --git a/numpy/lib/arrayterator.pyi b/numpy/lib/arrayterator.pyi
index 39d6fd843..82c669206 100644
--- a/numpy/lib/arrayterator.pyi
+++ b/numpy/lib/arrayterator.pyi
@@ -1,4 +1,3 @@
-import sys
from typing import (
List,
Any,
diff --git a/numpy/lib/format.pyi b/numpy/lib/format.pyi
index 4c44d57bf..092245daf 100644
--- a/numpy/lib/format.pyi
+++ b/numpy/lib/format.pyi
@@ -1,10 +1,4 @@
-import sys
-from typing import Any, List, Set
-
-if sys.version_info >= (3, 8):
- from typing import Literal, Final
-else:
- from typing_extensions import Literal, Final
+from typing import Any, List, Set, Literal, Final
__all__: List[str]
diff --git a/numpy/lib/index_tricks.pyi b/numpy/lib/index_tricks.pyi
index 0f9ae94a9..530be3cae 100644
--- a/numpy/lib/index_tricks.pyi
+++ b/numpy/lib/index_tricks.pyi
@@ -1,4 +1,3 @@
-import sys
from typing import (
Any,
Tuple,
@@ -8,6 +7,8 @@ from typing import (
List,
Union,
Sequence,
+ Literal,
+ SupportsIndex,
)
from numpy import (
@@ -49,11 +50,6 @@ from numpy.core.multiarray import (
ravel_multi_index as ravel_multi_index,
)
-if sys.version_info >= (3, 8):
- from typing import Literal, SupportsIndex
-else:
- from typing_extensions import Literal, SupportsIndex
-
_T = TypeVar("_T")
_DType = TypeVar("_DType", bound=dtype[Any])
_BoolType = TypeVar("_BoolType", Literal[True], Literal[False])
diff --git a/numpy/lib/npyio.pyi b/numpy/lib/npyio.pyi
index de6bc3ded..1321afb55 100644
--- a/numpy/lib/npyio.pyi
+++ b/numpy/lib/npyio.pyi
@@ -3,6 +3,7 @@ import sys
import zipfile
import types
from typing import (
+ Literal as L,
Any,
Mapping,
TypeVar,
@@ -16,6 +17,7 @@ from typing import (
Sequence,
Callable,
Pattern,
+ Protocol,
)
from numpy import (
@@ -36,8 +38,6 @@ from numpy.core.multiarray import (
unpackbits as unpackbits,
)
-from typing_extensions import Protocol, Literal as L
-
_T = TypeVar("_T")
_T_contra = TypeVar("_T_contra", contravariant=True)
_T_co = TypeVar("_T_co", covariant=True)
diff --git a/numpy/lib/shape_base.pyi b/numpy/lib/shape_base.pyi
index cfb3040b7..4c275cc8c 100644
--- a/numpy/lib/shape_base.pyi
+++ b/numpy/lib/shape_base.pyi
@@ -1,5 +1,4 @@
-from typing import List, TypeVar, Callable, Sequence, Any, overload, Tuple
-from typing_extensions import SupportsIndex, Protocol
+from typing import List, TypeVar, Callable, Sequence, Any, overload, Tuple, SupportsIndex, Protocol
from numpy import (
generic,
diff --git a/numpy/lib/stride_tricks.pyi b/numpy/lib/stride_tricks.pyi
index 9e4e46b8b..bafc46e9c 100644
--- a/numpy/lib/stride_tricks.pyi
+++ b/numpy/lib/stride_tricks.pyi
@@ -1,5 +1,4 @@
-from typing import Any, List, Dict, Iterable, TypeVar, overload
-from typing_extensions import SupportsIndex
+from typing import Any, List, Dict, Iterable, TypeVar, overload, SupportsIndex
from numpy import dtype, generic
from numpy.typing import (
diff --git a/numpy/lib/type_check.pyi b/numpy/lib/type_check.pyi
index fbe325858..5eb0e62d2 100644
--- a/numpy/lib/type_check.pyi
+++ b/numpy/lib/type_check.pyi
@@ -1,5 +1,5 @@
-import sys
from typing import (
+ Literal as L,
Any,
Container,
Iterable,
@@ -7,6 +7,7 @@ from typing import (
overload,
Type,
TypeVar,
+ Protocol,
)
from numpy import (
@@ -32,11 +33,6 @@ from numpy.typing import (
_DTypeLikeComplex,
)
-if sys.version_info >= (3, 8):
- from typing import Protocol, Literal as L
-else:
- from typing_extensions import Protocol, Literal as L
-
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_SCT = TypeVar("_SCT", bound=generic)
diff --git a/numpy/lib/utils.pyi b/numpy/lib/utils.pyi
index 0518655c6..c13a219b5 100644
--- a/numpy/lib/utils.pyi
+++ b/numpy/lib/utils.pyi
@@ -1,4 +1,3 @@
-import sys
from ast import AST
from typing import (
Any,
@@ -11,6 +10,7 @@ from typing import (
Tuple,
TypeVar,
Union,
+ Protocol,
)
from numpy import ndarray, generic
@@ -21,11 +21,6 @@ from numpy.core.numerictypes import (
issubsctype as issubsctype,
)
-if sys.version_info >= (3, 8):
- from typing import Protocol
-else:
- from typing_extensions import Protocol
-
_T_contra = TypeVar("_T_contra", contravariant=True)
_FuncType = TypeVar("_FuncType", bound=Callable[..., Any])