diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index add1c8eb..055aa8b9 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -32,154 +32,170 @@ from uuid import UUID import numpy as np from numpy.__config__ import show as show_config from numpy._array_api_info import __array_namespace_info__ -from numpy._core._asarray import require -from numpy._core._internal import _ctypes -from numpy._core._type_aliases import sctypeDict -from numpy._core._ufunc_config import _ErrCall, _ErrKind, getbufsize, geterr, geterrcall, setbufsize, seterr, seterrcall -from numpy._core.arrayprint import ( - array2string, - array_repr, - array_str, - format_float_positional, - format_float_scientific, - get_printoptions, - printoptions, - set_printoptions, -) -from numpy._core.einsumfunc import einsum, einsum_path -from numpy._core.fromnumeric import ( +from numpy._core import ( + False_, + ScalarType, + True_, all, + allclose, amax, amin, any, + arange, argmax, argmin, argpartition, argsort, + argwhere, around, - choose, - clip, - compress, - cumprod, - cumsum, - cumulative_prod, - cumulative_sum, - diagonal, - matrix_transpose, - max, - mean, - min, - ndim, - nonzero, - partition, - prod, - ptp, - put, - ravel, - repeat, - reshape, - resize, - round, - searchsorted, - shape, - size, - sort, - squeeze, - std, - sum, - swapaxes, - take, - trace, - transpose, - var, -) -from numpy._core.function_base import geomspace, linspace, logspace -from numpy._core.getlimits import finfo, iinfo -from numpy._core.memmap import memmap -from numpy._core.multiarray import ( - arange, array, + array2string, + array_equal, + array_equiv, + array_repr, + array_str, asanyarray, asarray, ascontiguousarray, asfortranarray, - bincount, + astype, + atleast_1d, + atleast_2d, + atleast_3d, + base_repr, + binary_repr, + block, broadcast, busday_count, busday_offset, busdaycalendar, can_cast, + choose, + clip, + complex192, + complex256, + compress, concatenate, + convolve, copyto, + correlate, + count_nonzero, + cross, + cumprod, + cumsum, + cumulative_prod, + cumulative_sum, datetime_as_string, datetime_data, + diagonal, dot, + einsum, + einsum_path, empty, empty_like, - flagsobj, + finfo, flatiter, + flatnonzero, + float96, + float128, + format_float_positional, + format_float_scientific, from_dlpack, frombuffer, fromfile, + fromfunction, fromiter, frompyfunc, fromstring, - inner, - is_busday, - lexsort, - may_share_memory, - min_scalar_type, - nditer, - nested_iters, - packbits, - promote_types, - putmask, - result_type, - shares_memory, - unpackbits, - vdot, - where, - zeros, -) -from numpy._core.numeric import ( - False_, - True_, - allclose, - argwhere, - array_equal, - array_equiv, - astype, - base_repr, - binary_repr, - convolve, - correlate, - count_nonzero, - cross, - flatnonzero, - fromfunction, full, full_like, + geomspace, + get_printoptions, + getbufsize, + geterr, + geterrcall, + hstack, identity, + iinfo, indices, inf, + inner, + is_busday, isclose, + isdtype, isfortran, isscalar, + issubdtype, + lexsort, + linspace, little_endian, + logspace, + matrix_transpose, + max, + may_share_memory, + mean, + min, + min_scalar_type, moveaxis, nan, + ndim, + nditer, + nested_iters, newaxis, + nonzero, ones, ones_like, outer, + partition, + printoptions, + prod, + promote_types, + ptp, + put, + putmask, + ravel, + recarray, + record, + repeat, + require, + reshape, + resize, + result_type, roll, rollaxis, + round, + sctypeDict, + searchsorted, + set_printoptions, + setbufsize, + seterr, + seterrcall, + shape, + shares_memory, + size, + sort, + squeeze, + stack, + std, + sum, + swapaxes, + take, tensordot, + trace, + transpose, + typecodes, + unstack, + var, + vdot, + vstack, + where, + zeros, zeros_like, ) -from numpy._core.numerictypes import ScalarType, isdtype, issubdtype, typecodes -from numpy._core.records import recarray, record -from numpy._core.shape_base import atleast_1d, atleast_2d, atleast_3d, block, hstack, stack, unstack, vstack +from numpy._core._internal import _ctypes +from numpy._core._ufunc_config import _ErrCall, _ErrKind +from numpy._core.memmap import memmap +from numpy._core.multiarray import bincount, flagsobj, packbits, unpackbits from numpy._pytesttester import PytestTester from numpy._typing import ( ArrayLike, @@ -302,20 +318,9 @@ from numpy._typing._callable import ( _UnsignedIntMod, _UnsignedIntOp, ) -from numpy._typing._extended_precision import ( - complex160, - complex192, - complex256, - complex512, - float80, - float96, - float128, - float256, - int128, - int256, - uint128, - uint256, -) + +# TODO(jorenham): remove these: https://github.com/numpy/numtype/issues/120 +from numpy._typing._extended_precision import complex160, complex512, float80, float256, int128, int256, uint128, uint256 from numpy.lib import scimath as emath from numpy.lib._arraypad_impl import pad from numpy.lib._arraysetops_impl import ( diff --git a/src/numpy-stubs/_core/__init__.pyi b/src/numpy-stubs/_core/__init__.pyi index 40d9c411..dacd259f 100644 --- a/src/numpy-stubs/_core/__init__.pyi +++ b/src/numpy-stubs/_core/__init__.pyi @@ -1,2 +1,647 @@ -# NOTE: The `np._core` namespace is deliberately kept empty due to it -# being private +from ._asarray import require +from ._multiarray_umath import ( + absolute, + absolute as abs, + add, + arccos, + arccos as acos, + arccosh, + arccosh as acosh, + arcsin, + arcsin as asin, + arcsinh, + arcsinh as asinh, + arctan, + arctan as atan, + arctan2, + arctan2 as atan2, + arctanh, + arctanh as atanh, + bitwise_and, + bitwise_count, + bitwise_or, + bitwise_xor, + cbrt, + ceil, + conj, + conjugate, + copysign, + cos, + cosh, + deg2rad, + degrees, + divide, + divmod, + e, + equal, + euler_gamma, + exp, + exp2, + expm1, + fabs, + float_power, + floor, + floor_divide, + fmax, + fmin, + fmod, + frexp, + frompyfunc, + gcd, + greater, + greater_equal, + heaviside, + hypot, + invert, + invert as bitwise_invert, + isfinite, + isinf, + isnan, + isnat, + lcm, + ldexp, + left_shift, + left_shift as bitwise_left_shift, + less, + less_equal, + log, + log1p, + log2, + log10, + logaddexp, + logaddexp2, + logical_and, + logical_not, + logical_or, + logical_xor, + matvec, + maximum, + minimum, + mod, + modf, + multiply, + negative, + nextafter, + not_equal, + pi, + positive, + power, + power as pow, + rad2deg, + radians, + reciprocal, + remainder, + right_shift, + right_shift as bitwise_right_shift, + rint, + sign, + signbit, + sin, + sinh, + spacing, + sqrt, + square, + subtract, + tan, + tanh, + true_divide, + trunc, + vecmat, +) +from ._ufunc_config import errstate, getbufsize, geterr, geterrcall, setbufsize, seterr, seterrcall +from .arrayprint import ( + array2string, + array_repr, + array_str, + format_float_positional, + format_float_scientific, + get_printoptions, + printoptions, + set_printoptions, +) +from .einsumfunc import einsum, einsum_path +from .fromnumeric import ( + all, + amax, + amin, + any, + argmax, + argmin, + argpartition, + argsort, + around, + choose, + clip, + compress, + cumprod, + cumsum, + cumulative_prod, + cumulative_sum, + diagonal, + matrix_transpose, + max, + mean, + min, + ndim, + nonzero, + partition, + prod, + ptp, + put, + ravel, + repeat, + reshape, + resize, + round, + searchsorted, + shape, + size, + sort, + squeeze, + std, + sum, + swapaxes, + take, + trace, + transpose, + transpose as permute_dims, + var, +) +from .function_base import geomspace, linspace, logspace +from .getlimits import finfo, iinfo +from .memmap import memmap +from .numeric import ( + False_, + True_, + allclose, + arange, + argwhere, + array, + array_equal, + array_equiv, + asanyarray, + asarray, + ascontiguousarray, + asfortranarray, + astype, + base_repr, + binary_repr, + bitwise_not, + broadcast, + can_cast, + concatenate, + concatenate as concat, + convolve, + copyto, + correlate, + count_nonzero, + cross, + dot, + dtype, + empty, + empty_like, + flatiter, + flatnonzero, + from_dlpack, + frombuffer, + fromfile, + fromfunction, + fromiter, + fromstring, + full, + full_like, + identity, + indices, + inf, + inner, + isclose, + isfortran, + isscalar, + lexsort, + little_endian, + matmul, + may_share_memory, + min_scalar_type, + moveaxis, + nan, + ndarray, + nditer, + nested_iters, + newaxis, + ones, + ones_like, + outer, + promote_types, + putmask, + result_type, + roll, + rollaxis, + shares_memory, + tensordot, + ufunc, + vdot, + vecdot, + where, + zeros, + zeros_like, +) +from .numerictypes import ( + ScalarType, + bool, + bool_, + busday_count, + busday_offset, + busdaycalendar, + byte, + bytes_, + cdouble, + character, + clongdouble, + complex64, + complex128, + complex192, + complex256, + complexfloating, + csingle, + datetime64, + datetime_as_string, + datetime_data, + double, + flexible, + float16, + float32, + float64, + float96, + float128, + floating, + generic, + half, + inexact, + int8, + int16, + int32, + int64, + int_, + intc, + integer, + intp, + is_busday, + isdtype, + issubdtype, + long, + longdouble, + longlong, + number, + object_, + sctypeDict, + short, + signedinteger, + single, + str_, + timedelta64, + typecodes, + ubyte, + uint8, + uint16, + uint32, + uint64, + uintc, + uintp, + uintp as uint, + ulong, + ulonglong, + unsignedinteger, + ushort, + void, +) +from .records import recarray, record +from .shape_base import atleast_1d, atleast_2d, atleast_3d, block, hstack, stack, unstack, vstack + +__all__ = [ + "False_", + "ScalarType", + "True_", + "abs", + "absolute", + "acos", + "acosh", + "add", + "all", + "allclose", + "amax", + "amin", + "any", + "arange", + "arccos", + "arccosh", + "arcsin", + "arcsinh", + "arctan", + "arctan2", + "arctanh", + "argmax", + "argmin", + "argpartition", + "argsort", + "argwhere", + "around", + "array", + "array2string", + "array_equal", + "array_equiv", + "array_repr", + "array_str", + "asanyarray", + "asarray", + "ascontiguousarray", + "asfortranarray", + "asin", + "asinh", + "astype", + "atan", + "atan2", + "atanh", + "atleast_1d", + "atleast_2d", + "atleast_3d", + "base_repr", + "binary_repr", + "bitwise_and", + "bitwise_count", + "bitwise_invert", + "bitwise_left_shift", + "bitwise_not", + "bitwise_or", + "bitwise_right_shift", + "bitwise_xor", + "block", + "bool", + "bool_", + "broadcast", + "busday_count", + "busday_offset", + "busdaycalendar", + "byte", + "bytes_", + "can_cast", + "cbrt", + "cdouble", + "ceil", + "character", + "choose", + "clip", + "clongdouble", + "complex64", + "complex128", + "complex192", + "complex256", + "complexfloating", + "compress", + "concat", + "concatenate", + "conj", + "conjugate", + "convolve", + "copysign", + "copyto", + "correlate", + "cos", + "cosh", + "count_nonzero", + "cross", + "csingle", + "cumprod", + "cumsum", + "cumulative_prod", + "cumulative_sum", + "datetime64", + "datetime_as_string", + "datetime_data", + "deg2rad", + "degrees", + "diagonal", + "divide", + "divmod", + "dot", + "double", + "dtype", + "e", + "einsum", + "einsum_path", + "empty", + "empty_like", + "equal", + "errstate", + "euler_gamma", + "exp", + "exp2", + "expm1", + "fabs", + "finfo", + "flatiter", + "flatnonzero", + "flexible", + "float16", + "float32", + "float64", + "float96", + "float128", + "float_power", + "floating", + "floor", + "floor_divide", + "fmax", + "fmin", + "fmod", + "format_float_positional", + "format_float_scientific", + "frexp", + "from_dlpack", + "frombuffer", + "fromfile", + "fromfunction", + "fromiter", + "frompyfunc", + "fromstring", + "full", + "full_like", + "gcd", + "generic", + "geomspace", + "get_printoptions", + "getbufsize", + "geterr", + "geterrcall", + "greater", + "greater_equal", + "half", + "heaviside", + "hstack", + "hypot", + "identity", + "iinfo", + "indices", + "inexact", + "inf", + "inner", + "int8", + "int16", + "int32", + "int64", + "int_", + "intc", + "integer", + "intp", + "invert", + "is_busday", + "isclose", + "isdtype", + "isfinite", + "isfortran", + "isinf", + "isnan", + "isnat", + "isscalar", + "issubdtype", + "lcm", + "ldexp", + "left_shift", + "less", + "less_equal", + "lexsort", + "linspace", + "little_endian", + "log", + "log1p", + "log2", + "log10", + "logaddexp", + "logaddexp2", + "logical_and", + "logical_not", + "logical_or", + "logical_xor", + "logspace", + "long", + "longdouble", + "longlong", + "matmul", + "matrix_transpose", + "matvec", + "max", + "maximum", + "may_share_memory", + "mean", + "memmap", + "min", + "min_scalar_type", + "minimum", + "mod", + "modf", + "moveaxis", + "multiply", + "nan", + "ndarray", + "ndim", + "nditer", + "negative", + "nested_iters", + "newaxis", + "nextafter", + "nonzero", + "not_equal", + "number", + "object_", + "ones", + "ones_like", + "outer", + "partition", + "permute_dims", + "pi", + "positive", + "pow", + "power", + "printoptions", + "prod", + "promote_types", + "ptp", + "put", + "putmask", + "rad2deg", + "radians", + "ravel", + "recarray", + "reciprocal", + "record", + "remainder", + "repeat", + "require", + "reshape", + "resize", + "result_type", + "right_shift", + "rint", + "roll", + "rollaxis", + "round", + "sctypeDict", + "searchsorted", + "set_printoptions", + "setbufsize", + "seterr", + "seterrcall", + "shape", + "shares_memory", + "short", + "sign", + "signbit", + "signedinteger", + "sin", + "single", + "sinh", + "size", + "sort", + "spacing", + "sqrt", + "square", + "squeeze", + "stack", + "std", + "str_", + "subtract", + "sum", + "swapaxes", + "take", + "tan", + "tanh", + "tensordot", + "timedelta64", + "trace", + "transpose", + "true_divide", + "trunc", + "typecodes", + "ubyte", + "ufunc", + "uint", + "uint8", + "uint16", + "uint32", + "uint64", + "uintc", + "uintp", + "ulong", + "ulonglong", + "unsignedinteger", + "unstack", + "ushort", + "var", + "vdot", + "vecdot", + "vecmat", + "void", + "vstack", + "where", + "zeros", + "zeros_like", +] diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index a8774aea..0acc5537 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -49,11 +49,20 @@ from _numtype import ( _ToArray_1nd, _ToArray_nd, ) -from numpy import _AnyShapeT, _OrderCF, _OrderKACF, bitwise_not, dtype, matmul, ndarray, ufunc, vecdot # noqa: ICN003 +from numpy import _AnyShapeT, _OrderCF, _OrderKACF, ufunc # noqa: ICN003 from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ScalarLike_co, _ShapeLike, _SupportsArrayFunc from ._multiarray_umath import _KwargsD, _KwargsDL +from ._type_aliases import sctypes as sctypes from .multiarray import ( + ALLOW_THREADS as ALLOW_THREADS, + BUFSIZE as BUFSIZE, + CLIP as CLIP, + MAXDIMS as MAXDIMS, + MAY_SHARE_BOUNDS as MAY_SHARE_BOUNDS, + MAY_SHARE_EXACT as MAY_SHARE_EXACT, + RAISE as RAISE, + WRAP as WRAP, arange, array, asanyarray, @@ -65,6 +74,7 @@ from .multiarray import ( concatenate, copyto, dot, + dtype, empty, empty_like, flatiter, @@ -75,18 +85,23 @@ from .multiarray import ( fromstring, inner, lexsort, + matmul, may_share_memory, min_scalar_type, + ndarray, nditer, nested_iters, + normalize_axis_index as normalize_axis_index, promote_types, putmask, result_type, shares_memory, vdot, + vecdot, where, zeros, ) +from .umath import invert, multiply as multiply, sin as sin __all__ = [ "False_", @@ -174,6 +189,7 @@ _Axes: TypeAlias = int | tuple[_ShapeLike, _ShapeLike] ### +bitwise_not = invert newaxis: Final[None] = None little_endian: Final[bool] = ... diff --git a/src/numpy-stubs/_core/numerictypes.pyi b/src/numpy-stubs/_core/numerictypes.pyi index 27d8e636..dcbb0056 100644 --- a/src/numpy-stubs/_core/numerictypes.pyi +++ b/src/numpy-stubs/_core/numerictypes.pyi @@ -57,20 +57,7 @@ from numpy import ( # noqa: ICN003 void, ) from numpy._typing import DTypeLike -from numpy._typing._extended_precision import ( - complex160, - complex192, - complex256, - complex512, - float80, - float96, - float128, - float256, - int128, - int256, - uint128, - uint256, -) +from numpy._typing._extended_precision import complex192, complex256, float96, float128 from ._type_aliases import sctypeDict as sctypeDict from .multiarray import busday_count, busday_offset, busdaycalendar, datetime_as_string, datetime_data, is_busday @@ -89,10 +76,8 @@ __all__ = [ "clongdouble", "complex64", "complex128", - "complex160", "complex192", "complex256", - "complex512", "complexfloating", "csingle", "datetime64", @@ -103,10 +88,8 @@ __all__ = [ "float16", "float32", "float64", - "float80", "float96", "float128", - "float256", "floating", "generic", "half", @@ -115,8 +98,6 @@ __all__ = [ "int16", "int32", "int64", - "int128", - "int256", "int_", "intc", "integer", @@ -141,8 +122,6 @@ __all__ = [ "uint32", "uint64", "uint64", - "uint128", - "uint256", "uintc", "uintp", "ulong",