summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2020-10-19 00:40:52 +0200
committerBas van Beek <b.f.van.beek@vu.nl>2020-10-19 00:40:52 +0200
commitd3e40dc59e638f2210a20e40f7edca5c5ee7c124 (patch)
tree24864a0265a8316f48db8481774e83aa7e6cd423
parentbb76bff17f86e468ca9fbc5071d95782dc932c10 (diff)
downloadnumpy-d3e40dc59e638f2210a20e40f7edca5c5ee7c124.tar.gz
MAINT: Move the `np.core.numerictypes` annotations to their own stub file
-rw-r--r--numpy/__init__.pyi36
-rw-r--r--numpy/core/numerictypes.pyi26
2 files changed, 38 insertions, 24 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index 2fff82d59..f70965c41 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -141,7 +141,7 @@ from numpy.core._asarray import (
require as require,
)
-from numpy.core.numeric import(
+from numpy.core.numeric import (
zeros_like as zeros_like,
ones as ones,
ones_like as ones_like,
@@ -172,6 +172,17 @@ from numpy.core.numeric import(
array_equiv as array_equiv,
)
+from numpy.core.numerictypes import (
+ maximum_sctype as maximum_sctype,
+ issctype as issctype,
+ obj2sctype as obj2sctype,
+ issubclass_ as issubclass_,
+ issubsctype as issubsctype,
+ issubdtype as issubdtype,
+ sctype2char as sctype2char,
+ find_common_type as find_common_type,
+)
+
# Add an object to `__all__` if their stubs are defined in an external file;
# their stubs will not be recognized otherwise.
# NOTE: This is redundant for objects defined within this file.
@@ -2149,26 +2160,3 @@ class AxisError(ValueError, IndexError):
def __init__(
self, axis: int, ndim: Optional[int] = ..., msg_prefix: Optional[str] = ...
) -> None: ...
-
-# Functions from np.core.numerictypes
-_DefaultType = TypeVar("_DefaultType")
-
-def maximum_sctype(t: DtypeLike) -> dtype: ...
-def issctype(rep: object) -> bool: ...
-@overload
-def obj2sctype(rep: object) -> Optional[generic]: ...
-@overload
-def obj2sctype(rep: object, default: None) -> Optional[generic]: ...
-@overload
-def obj2sctype(
- rep: object, default: Type[_DefaultType]
-) -> Union[generic, Type[_DefaultType]]: ...
-def issubclass_(arg1: object, arg2: Union[object, Tuple[object, ...]]) -> bool: ...
-def issubsctype(
- arg1: Union[ndarray, DtypeLike], arg2: Union[ndarray, DtypeLike]
-) -> bool: ...
-def issubdtype(arg1: DtypeLike, arg2: DtypeLike) -> bool: ...
-def sctype2char(sctype: object) -> str: ...
-def find_common_type(
- array_types: Sequence[DtypeLike], scalar_types: Sequence[DtypeLike]
-) -> dtype: ...
diff --git a/numpy/core/numerictypes.pyi b/numpy/core/numerictypes.pyi
new file mode 100644
index 000000000..86688a66e
--- /dev/null
+++ b/numpy/core/numerictypes.pyi
@@ -0,0 +1,26 @@
+from typing import TypeVar, Optional, Type, Union, Tuple, Sequence, overload, Any
+
+from numpy import generic, ndarray, dtype
+from numpy.typing import DtypeLike
+
+_DefaultType = TypeVar("_DefaultType")
+
+def maximum_sctype(t: DtypeLike) -> dtype: ...
+def issctype(rep: object) -> bool: ...
+@overload
+def obj2sctype(rep: object) -> Optional[generic]: ...
+@overload
+def obj2sctype(rep: object, default: None) -> Optional[generic]: ...
+@overload
+def obj2sctype(
+ rep: object, default: Type[_DefaultType]
+) -> Union[generic, Type[_DefaultType]]: ...
+def issubclass_(arg1: object, arg2: Union[object, Tuple[object, ...]]) -> bool: ...
+def issubsctype(
+ arg1: Union[ndarray, DtypeLike], arg2: Union[ndarray, DtypeLike]
+) -> bool: ...
+def issubdtype(arg1: DtypeLike, arg2: DtypeLike) -> bool: ...
+def sctype2char(sctype: object) -> str: ...
+def find_common_type(
+ array_types: Sequence[DtypeLike], scalar_types: Sequence[DtypeLike]
+) -> dtype: ...