-
-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Some function signatures that are currently defined in numpy._core.strings
should be rewritten as a np.ufunc
, and re-exported from numpy._core._multiarray_umath
, specifically:
equal
not_equal
less
less_equal
greater
greater_equal
add
isalpha
isdigit
isspace
isalnum
islower
isupper
istitle
isdecimal
isnumeric
str_len
Most of the _multiarray_umath
are re-exported in numpy._core.multiarray
, with 89 explicit re-exports (in multiarray.__all__
), and 140 implicit re-exports. So that means that _multiarray_umath
defines at least 229 members.
There are also 157
(!) _multiarray_umath
explicit re-exportss in the numpy
namespace, i.e. in numpy.__all__
.
Stubgen produced an initial version, which after some initial cleanup looks like this:
import numpy as np
import numpy.typing as npt
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import Any, Final
from typing_extensions import CapsuleType as PyCapsule
_ARRAY_API: Final[PyCapsule] = ...
_UFUNC_API: Final[PyCapsule] = ...
DATETIMEUNITS: Final[PyCapsule] = ...
UFUNC_PYVALS_NAME: Final = "UFUNC_PYVALS"
ALLOW_THREADS: Final[int] = ...
BUFSIZE: Final[int] = ...
CLIP: Final[int] = ...
FLOATING_POINT_SUPPORT: Final[int] = ...
FPE_DIVIDEBYZERO: Final[int] = ...
FPE_INVALID: Final[int] = ...
FPE_OVERFLOW: Final[int] = ...
FPE_UNDERFLOW: Final[int] = ...
ITEM_HASOBJECT: Final[int] = ...
ITEM_IS_POINTER: Final[int] = ...
LIST_PICKLE: Final[int] = ...
MAXDIMS: Final = 64
MAY_SHARE_BOUNDS: Final[int] = ...
MAY_SHARE_EXACT: Final[int] = ...
NEEDS_INIT: Final[int] = ...
NEEDS_PYAPI: Final[int] = ...
RAISE: Final[int] = ...
UFUNC_BUFSIZE_DEFAULT: Final[int] = ...
USE_GETITEM: Final[int] = ...
USE_SETITEM: Final[int] = ...
WRAP: Final[int] = ...
tracemalloc_domain: Final[int] = ...
__version__: Final = "3.1"
__cpu_baseline__: Final[list[str]] = ...
__cpu_dispatch__: Final[list[str]] = ...
# TODO(jorenham): `TypedDict`s
__cpu_features__: Final[dict[str, bool]] = ...
__cpu_targets_info__: Final[dict[str, dict[str, dict[str, str]]]] = ...
_flagdict: Final[dict[str, int]] = ...
typeinfo: Final[dict[str, np.dtype[Any]]] = ...
e: Final[float] = ...
euler_gamma: Final[float] = ...
pi: Final[float] = ...
NAN: Final[float] = ...
NINF: Final[float] = ...
NZERO: Final[float] = ...
PINF: Final[float] = ...
PZERO: Final[float] = ...
#
_arg: np.ufunc
_center: np.ufunc
_expandtabs: np.ufunc
_expandtabs_length: np.ufunc
_ljust: np.ufunc
_lstrip_chars: np.ufunc
_lstrip_whitespace: np.ufunc
_ones_like: np.ufunc
_partition: np.ufunc
_partition_index: np.ufunc
_replace: np.ufunc
_rjust: np.ufunc
_rpartition: np.ufunc
_rpartition_index: np.ufunc
_rstrip_chars: np.ufunc
_rstrip_whitespace: np.ufunc
_strip_chars: np.ufunc
_strip_whitespace: np.ufunc
_zfill: np.ufunc
#
clip: np.ufunc
count: np.ufunc
endswith: np.ufunc
find: np.ufunc
index: np.ufunc
isalnum: np.ufunc
isalpha: np.ufunc
isdecimal: np.ufunc
isdigit: np.ufunc
islower: np.ufunc
isnumeric: np.ufunc
isspace: np.ufunc
istitle: np.ufunc
isupper: np.ufunc
rfind: np.ufunc
rindex: np.ufunc
startswith: np.ufunc
str_len: np.ufunc
#
def get_handler_name(a: npt.NDArray[Any]) -> str | None: ...
def get_handler_version(a: npt.NDArray[Any]) -> int | None: ...
def set_datetimeparse_function(*args: Incomplete, **kwargs: Incomplete) -> None: ...
def set_typeDict(dict: Mapping[str, np.dtype[Any]]) -> None: ...
#
def c_einsum(
subscripts: Incomplete,
*operands: Incomplete,
out: npt.NDArray[Incomplete] | None = None,
dtype: Incomplete = ...,
order: Incomplete = ...,
casting: str = ...,
) -> Incomplete: ...
#
def unpackbits(
a: npt.NDArray[np.uint8],
/,
axis: int | None = None,
count: int | None = None,
bitorder: Literal["big", "little"] = "big",
) -> npt.NDArray[np.uint8]: ...
def packbits(
a: npt.ArrayLike,
/,
axis: int | None = None,
bitorder: Literal["big", "little"] = "big",
) -> npt.NDArray[np.uint8]: ...
#
def where(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def putmask(a: Incomplete, mask: Incomplete, values) -> Incomplete: ...
#
def unravel_index(indices: Incomplete, shape: Incomplete, order: Incomplete = ...) -> Incomplete: ...
def ravel_multi_index(
multi_index: Incomplete,
dims: Incomplete,
mode: Incomplete = ...,
order: Incomplete = ...,
) -> Incomplete: ...
#
def min_scalar_type(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def result_type(*arrays_and_dtypes: Incomplete) -> Incomplete: ...
def can_cast(from_: Incomplete, to: Incomplete, casting: str = ...) -> Incomplete: ...
def shares_memory(x1: Incomplete, x2: Incomplete, max_work: Incomplete = ...) -> Incomplete: ...
def copyto(dst: npt.NDArray[Any], src: npt.ArrayLike, casting: str = "same_kind", where: Incomplete = True) -> None: ...
#
def empty_like(a: npt.ArrayLike) -> npt.NDArray[Incomplete]: ...
#
def dot(
a: npt.ArrayLike,
b: npt.ArrayLike,
out: npt.NDArray[Incomplete] | None = None,
) -> np.number | npt.NDArray[np.number]: ...
def vdot(a: npt.ArrayLike, b: npt.ArrayLike, /) -> np.number | npt.NDArray[np.number]: ...
def inner(a: npt.ArrayLike, b: npt.ArrayLike, /) -> np.number | npt.NDArray[np.number]: ...
#
def interp(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def interp_complex(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
#
def concatenate(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def correlate(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def correlate2(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
#
def count_nonzero(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def bincount(x: Incomplete, weights: Incomplete = ...) -> Incomplete: ...
#
def lexsort(keys: npt.ArrayLike, axis: int = -1) -> npt.NDArray[np.intp]: ...
#
def busday_count(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def busday_offset(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def is_busday(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
#
def datetime_as_string(
arr: Incomplete,
unit: str | None = None,
timezone: str = "naive",
casting: str = "same_kind",
) -> npt.NDArray[np.str_]: ...
def dragon4_positional(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def dragon4_scientific(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
def format_longfloat(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...