Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .mypyignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ numpy(\..+)?\.complex(192|256)

# these are always either missing float96/complex192 or float128/complex256
numpy\.__all__
numpy\._core\.__all__
numpy\._core\.numeric\.__all__
numpy\._core\.numerictypes\.__all__
numpy\._?core\.__all__
numpy\._?core\.numeric\.__all__
numpy\._?core\.numerictypes\.__all__
numpy\.matlib\.__all__

# requires numpy/_core/code_generators to be on the PYTHONPATH when running stubtest
Expand Down
23 changes: 5 additions & 18 deletions .mypyignore-todo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ numpy(\..+)?\.complexfloating.__complex__
numpy(\.lib\._nanfunctions_impl|\.matlib)?\.nan(median|percentile)
numpy(\.lib\._twodim_base_impl)?\.tri(l|u)

numpy\._core(\._multiarray_umath|\.multiarray)\.error
numpy\._?core(\._multiarray_umath|\.multiarray)\.error
numpy(\._core(\.memmap)?|\.matlib)?\.memmap\.__new__
numpy(\.matrixlib(\.defmatrix)?|\.matlib)?\.matrix\.__new__
numpy(\.lib\._polynomial_impl|\.matlib)?\.poly1d\.integ
Expand All @@ -25,10 +25,10 @@ numpy._core._type_aliases.type_info
numpy._core._type_aliases.k
numpy._core._type_aliases.v

numpy(\._core(\.records)?|\.matlib|\.rec)?\.recarray\.__getattr__
numpy(\._core(\.records)?|\.matlib|\.rec)?\.recarray\.__new__
numpy(\._core(\.records)?|\.matlib|\.rec)?\.record\.__name__
numpy(\._core\.records|\.rec)\.array
numpy(\._?core(\.records)?|\.matlib|\.rec)?\.recarray\.__getattr__
numpy(\._?core(\.records)?|\.matlib|\.rec)?\.recarray\.__new__
numpy(\._?core(\.records)?|\.matlib|\.rec)?\.record\.__name__
numpy(\._?core\.records|\.rec)\.array

numpy._globals._CopyMode.IF_NEEDED
numpy._globals._CopyMode.__bool__
Expand All @@ -38,19 +38,6 @@ numpy._pyinstaller.hook-numpy
numpy.compat
numpy.compat.py3k

numpy.core.arrayprint
numpy.core.defchararray
numpy.core.einsumfunc
numpy.core.fromnumeric
numpy.core.function_base
numpy.core.getlimits
numpy.core.multiarray
numpy.core.numeric
numpy.core.numerictypes
numpy.core.records
numpy.core.shape_base
numpy.core.umath

numpy.ctypeslib._ctypeslib

numpy.distutils
Expand Down
9 changes: 0 additions & 9 deletions src/numpy-stubs/core/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# TODO(jorenham):
# add mirror modules of `_core` in the `core` namespace

from numpy import _core as _core # noqa: ICN003
from numpy._core import (
_dtype,
Expand Down Expand Up @@ -41,9 +38,3 @@ __all__ = [
"shape_base",
"umath",
]

# TODO(jorenham): stub `_core._dtype_ctypes`
# https://github.com/numpy/numtype/issues/54

# TODO(jorenham): stub `_core._dtype`
# https://github.com/numpy/numtype/issues/55
18 changes: 18 additions & 0 deletions src/numpy-stubs/core/_dtype.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from numpy._core._dtype import (
_aligned_offset as _aligned_offset,
_byte_order_str as _byte_order_str,
_construction_repr as _construction_repr,
_datetime_metadata_str as _datetime_metadata_str,
_is_packed as _is_packed,
_isunsized as _isunsized,
_kind_name as _kind_name,
_kind_to_stem as _kind_to_stem,
_name_get as _name_get,
_name_includes_bit_suffix as _name_includes_bit_suffix,
_scalar_str as _scalar_str,
_struct_dict_str as _struct_dict_str,
_struct_list_str as _struct_list_str,
_struct_str as _struct_str,
_subarray_str as _subarray_str,
_unpack_field as _unpack_field,
)
7 changes: 7 additions & 0 deletions src/numpy-stubs/core/_dtype_ctypes.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from numpy._core._dtype_ctypes import (
_from_ctypes_array as _from_ctypes_array,
_from_ctypes_scalar as _from_ctypes_scalar,
_from_ctypes_structure as _from_ctypes_structure,
_from_ctypes_union as _from_ctypes_union,
dtype_from_ctypes_type as dtype_from_ctypes_type,
)
11 changes: 11 additions & 0 deletions src/numpy-stubs/core/_internal.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from numpy._core._internal import (
IS_PYPY as IS_PYPY,
_ctypes as _ctypes,
array_function_errmsg_formatter as array_function_errmsg_formatter,
array_ufunc_errmsg_formatter as array_ufunc_errmsg_formatter,
dummy_ctype as dummy_ctype,
format_re as format_re,
npy_ctypes_check as npy_ctypes_check,
sep_re as sep_re,
space_re as space_re,
)
248 changes: 248 additions & 0 deletions src/numpy-stubs/core/_multiarray_umath.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
from typing import Any

from numpy._core._multiarray_umath import (
ALLOW_THREADS as ALLOW_THREADS,
BUFSIZE as BUFSIZE,
CLIP as CLIP,
DATETIMEUNITS as DATETIMEUNITS,
FLOATING_POINT_SUPPORT as FLOATING_POINT_SUPPORT,
FPE_DIVIDEBYZERO as FPE_DIVIDEBYZERO,
FPE_INVALID as FPE_INVALID,
FPE_OVERFLOW as FPE_OVERFLOW,
FPE_UNDERFLOW as FPE_UNDERFLOW,
ITEM_HASOBJECT as ITEM_HASOBJECT,
ITEM_IS_POINTER as ITEM_IS_POINTER,
LIST_PICKLE as LIST_PICKLE,
MAXDIMS as MAXDIMS,
MAY_SHARE_BOUNDS as MAY_SHARE_BOUNDS,
MAY_SHARE_EXACT as MAY_SHARE_EXACT,
NAN as NAN,
NEEDS_INIT as NEEDS_INIT,
NEEDS_PYAPI as NEEDS_PYAPI,
NINF as NINF,
NZERO as NZERO,
PINF as PINF,
PZERO as PZERO,
RAISE as RAISE,
UFUNC_BUFSIZE_DEFAULT as UFUNC_BUFSIZE_DEFAULT,
UFUNC_PYVALS_NAME as UFUNC_PYVALS_NAME,
USE_GETITEM as USE_GETITEM,
USE_SETITEM as USE_SETITEM,
WRAP as WRAP,
__cpu_baseline__ as __cpu_baseline__,
__cpu_dispatch__ as __cpu_dispatch__,
__cpu_features__ as __cpu_features__,
__cpu_targets_info__ as __cpu_targets_info__,
__version__ as __version__,
_add_newdoc_ufunc as _add_newdoc_ufunc,
_arg as _arg,
_center as _center,
_expandtabs as _expandtabs,
_expandtabs_length as _expandtabs_length,
_extobj_contextvar as _extobj_contextvar,
_flagdict as _flagdict,
_get_extobj_dict as _get_extobj_dict,
_get_madvise_hugepage as _get_madvise_hugepage,
_get_ndarray_c_version as _get_ndarray_c_version,
_ljust as _ljust,
_lstrip_chars as _lstrip_chars,
_lstrip_whitespace as _lstrip_whitespace,
_make_extobj as _make_extobj,
_monotonicity as _monotonicity,
_ones_like as _ones_like,
_partition as _partition,
_partition_index as _partition_index,
_place as _place,
_reconstruct as _reconstruct,
_replace as _replace,
_rjust as _rjust,
_rpartition as _rpartition,
_rpartition_index as _rpartition_index,
_rstrip_chars as _rstrip_chars,
_rstrip_whitespace as _rstrip_whitespace,
_set_madvise_hugepage as _set_madvise_hugepage,
_strip_chars as _strip_chars,
_strip_whitespace as _strip_whitespace,
_vec_string as _vec_string,
_zfill as _zfill,
absolute as absolute,
add as add,
add_docstring as add_docstring,
arange as arange,
arccos as arccos,
arccosh as arccosh,
arcsin as arcsin,
arcsinh as arcsinh,
arctan as arctan,
arctan2 as arctan2,
arctanh as arctanh,
array as array,
asanyarray as asanyarray,
asarray as asarray,
ascontiguousarray as ascontiguousarray,
asfortranarray as asfortranarray,
bincount as bincount,
bitwise_and as bitwise_and,
bitwise_count as bitwise_count,
bitwise_or as bitwise_or,
bitwise_xor as bitwise_xor,
broadcast as broadcast,
busday_count as busday_count,
busday_offset as busday_offset,
busdaycalendar as busdaycalendar,
c_einsum as c_einsum,
can_cast as can_cast,
cbrt as cbrt,
ceil as ceil,
clip as clip,
compare_chararrays as compare_chararrays,
concatenate as concatenate,
conj as conj,
conjugate as conjugate,
copysign as copysign,
copyto as copyto,
correlate as correlate,
correlate2 as correlate2,
cos as cos,
cosh as cosh,
count as count,
count_nonzero as count_nonzero,
datetime_as_string as datetime_as_string,
datetime_data as datetime_data,
deg2rad as deg2rad,
degrees as degrees,
divide as divide,
divmod as divmod,
dot as dot,
dragon4_positional as dragon4_positional,
dragon4_scientific as dragon4_scientific,
e as e,
empty as empty,
empty_like as empty_like,
endswith as endswith,
equal as equal,
error as error,
euler_gamma as euler_gamma,
exp as exp,
exp2 as exp2,
expm1 as expm1,
fabs as fabs,
find as find,
flagsobj as flagsobj,
flatiter as flatiter,
float_power as float_power,
floor as floor,
floor_divide as floor_divide,
fmax as fmax,
fmin as fmin,
fmod as fmod,
format_longfloat as format_longfloat,
frexp as frexp,
from_dlpack as from_dlpack,
frombuffer as frombuffer,
fromfile as fromfile,
fromiter as fromiter,
frompyfunc as frompyfunc,
fromstring as fromstring,
gcd as gcd,
get_handler_name as get_handler_name,
get_handler_version as get_handler_version,
greater as greater,
greater_equal as greater_equal,
heaviside as heaviside,
hypot as hypot,
index as index,
inner as inner,
interp as interp,
interp_complex as interp_complex,
invert as invert,
is_busday as is_busday,
isalnum as isalnum,
isalpha as isalpha,
isdecimal as isdecimal,
isdigit as isdigit,
isfinite as isfinite,
isinf as isinf,
islower as islower,
isnan as isnan,
isnat as isnat,
isnumeric as isnumeric,
isspace as isspace,
istitle as istitle,
isupper as isupper,
lcm as lcm,
ldexp as ldexp,
left_shift as left_shift,
less as less,
less_equal as less_equal,
lexsort as lexsort,
log as log,
log1p as log1p,
log2 as log2,
log10 as log10,
logaddexp as logaddexp,
logaddexp2 as logaddexp2,
logical_and as logical_and,
logical_not as logical_not,
logical_or as logical_or,
logical_xor as logical_xor,
matvec as matvec,
maximum as maximum,
may_share_memory as may_share_memory,
min_scalar_type as min_scalar_type,
minimum as minimum,
mod as mod,
modf as modf,
multiply as multiply,
nditer as nditer,
negative as negative,
nested_iters as nested_iters,
nextafter as nextafter,
not_equal as not_equal,
packbits as packbits,
pi as pi,
positive as positive,
power as power,
promote_types as promote_types,
putmask as putmask,
rad2deg as rad2deg,
radians as radians,
ravel_multi_index as ravel_multi_index,
reciprocal as reciprocal,
remainder as remainder,
result_type as result_type,
rfind as rfind,
right_shift as right_shift,
rindex as rindex,
rint as rint,
scalar as scalar,
set_datetimeparse_function as set_datetimeparse_function,
set_typeDict as set_typeDict,
shares_memory as shares_memory,
sign as sign,
signbit as signbit,
sin as sin,
sinh as sinh,
spacing as spacing,
sqrt as sqrt,
square as square,
startswith as startswith,
str_len as str_len,
subtract as subtract,
tan as tan,
tanh as tanh,
tracemalloc_domain as tracemalloc_domain,
true_divide as true_divide,
trunc as trunc,
typeinfo as typeinfo,
unpackbits as unpackbits,
unravel_index as unravel_index,
vdot as vdot,
vecdot as vecdot,
vecmat as vecmat,
where as where,
zeros as zeros,
)

item: str = ...
attr: Any = ...
1 change: 1 addition & 0 deletions src/numpy-stubs/core/_utils.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def _raise_warning(attr: str, submodule: str | None = None) -> None: ...
21 changes: 21 additions & 0 deletions src/numpy-stubs/core/arrayprint.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from numpy._core.arrayprint import (
array2string,
array_repr,
array_str,
format_float_positional,
format_float_scientific,
get_printoptions,
printoptions,
set_printoptions,
)

__all__ = [
"array2string",
"array_repr",
"array_str",
"format_float_positional",
"format_float_scientific",
"get_printoptions",
"printoptions",
"set_printoptions",
]
Loading