Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ce7e9e

Browse files
committed
API: Update lib.arraypad lib.arraysetops lib.ufunclike lib.utils namespaces
1 parent a277f62 commit 8ce7e9e

26 files changed

+90
-156
lines changed

benchmarks/benchmarks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44

55
def show_cpu_features():
6-
from numpy.lib.utils import _opt_info
6+
from numpy.lib._utils_impl import _opt_info
77
info = _opt_info()
88
info = "NumPy CPU features: " + (info if info else 'nothing enabled')
99
# ASV wrapping stdout & stderr, so we assume having a tty here

doc/source/reference/routines.set.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ Set routines
33

44
.. currentmodule:: numpy
55

6-
.. autosummary::
7-
:toctree: generated/
8-
9-
lib.arraysetops
10-
116
Making proper sets
127
------------------
138
.. autosummary::
@@ -20,6 +15,7 @@ Boolean operations
2015
.. autosummary::
2116
:toctree: generated/
2217

18+
ediff1d
2319
in1d
2420
intersect1d
2521
isin

numpy/__init__.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,20 @@
185185
from .lib import (
186186
DataSource, apply_along_axis, apply_over_axes,
187187
array_split, broadcast_arrays, broadcast_shapes,
188-
broadcast_to, byte_bounds, c_, column_stack, diag, diag_indices,
188+
broadcast_to, c_, column_stack, diag, diag_indices,
189189
diag_indices_from, diagflat, dsplit, dstack,
190-
ediff1d, emath, expand_dims, eye, fill_diagonal, fix,
190+
emath, expand_dims, eye, fill_diagonal,
191191
fliplr, flipud, fromregex, get_array_wrap, genfromtxt,
192-
get_include, histogram2d, hsplit, in1d, index_exp, info, intersect1d,
193-
isin, isneginf, ix_, kron, load, loadtxt, mask_indices,
192+
histogram2d, hsplit, index_exp,
193+
ix_, kron, load, loadtxt, mask_indices,
194194
mgrid, ndenumerate, ndindex, ogrid,
195-
packbits, pad, poly, poly1d, polyadd, polyder,
195+
packbits, poly, poly1d, polyadd, polyder,
196196
polydiv, polyfit, polyint, polymul, polysub, polyval,
197197
put_along_axis, r_, ravel_multi_index,
198198
roots, row_stack, s_, save, savetxt, savez, savez_compressed,
199-
setdiff1d, setxor1d, show_runtime, split,
200-
take_along_axis, tile, tri, tril,
201-
tril_indices, tril_indices_from, union1d, unique, unpackbits,
202-
unravel_index, vander, vsplit, triu, triu_indices, triu_indices_from,
203-
isposinf
199+
split, take_along_axis, tile, tri, tril,
200+
tril_indices, tril_indices_from, unpackbits,
201+
unravel_index, vander, vsplit, triu, triu_indices, triu_indices_from
204202
)
205203
from .lib._histograms_impl import (
206204
histogram, histogram_bin_edges, histogramdd
@@ -221,6 +219,14 @@
221219
iscomplexobj, isrealobj, imag, iscomplex, isreal, nan_to_num, real,
222220
real_if_close, typename, mintypecode, common_type
223221
)
222+
from .lib._arraysetops_impl import (
223+
ediff1d, in1d, intersect1d, isin, setdiff1d, setxor1d, union1d, unique
224+
)
225+
from .lib._ufunclike_impl import fix, isneginf, isposinf
226+
from .lib._arraypad_impl import pad
227+
from .lib._utils_impl import (
228+
byte_bounds, show_runtime, get_include, info
229+
)
224230
from . import matrixlib as _mat
225231
from .matrixlib import (
226232
asmatrix, bmat, matrix
@@ -285,6 +291,10 @@
285291
set(lib._nanfunctions_impl.__all__) |
286292
set(lib._function_base_impl.__all__) |
287293
set(lib._type_check_impl.__all__) |
294+
set(lib._arraysetops_impl.__all__) |
295+
set(lib._ufunclike_impl.__all__) |
296+
set(lib._arraypad_impl.__all__) |
297+
set(lib._utils_impl.__all__) |
288298
{"show_config", "__version__"}
289299
)
290300

numpy/__init__.pyi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ from numpy.lib import (
397397
emath as emath,
398398
)
399399

400-
from numpy.lib.arraypad import (
400+
from numpy.lib._arraypad_impl import (
401401
pad as pad,
402402
)
403403

404-
from numpy.lib.arraysetops import (
404+
from numpy.lib._arraysetops_impl import (
405405
ediff1d as ediff1d,
406406
intersect1d as intersect1d,
407407
setxor1d as setxor1d,
@@ -575,17 +575,15 @@ from numpy.lib._type_check_impl import (
575575
common_type as common_type,
576576
)
577577

578-
from numpy.lib.ufunclike import (
578+
from numpy.lib._ufunclike_impl import (
579579
fix as fix,
580580
isposinf as isposinf,
581581
isneginf as isneginf,
582582
)
583583

584-
from numpy.lib.utils import (
585-
issubdtype as issubdtype,
584+
from numpy.lib._utils_impl import (
586585
get_include as get_include,
587586
info as info,
588-
source as source,
589587
byte_bounds as byte_bounds,
590588
show_runtime as show_runtime,
591589
)

numpy/_pytesttester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _show_numpy_info():
3939
print("NumPy version %s" % np.__version__)
4040
relaxed_strides = np.ones((10, 1), order="C").flags.f_contiguous
4141
print("NumPy relaxed strides checking option:", relaxed_strides)
42-
info = np.lib.utils._opt_info()
42+
info = np.lib._utils_impl._opt_info()
4343
print("NumPy CPU features: ", (info if info else 'nothing enabled'))
4444

4545

numpy/core/tests/test_deprecations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def test_deprecated_np_lib_math(self):
753753
class TestLibImports(_DeprecationTestCase):
754754
# Deprecated in Numpy 1.26.0, 2023-09
755755
def test_lib_functions_deprecation_call(self):
756-
from numpy.lib.utils import safe_eval
756+
from numpy.lib._utils_impl import safe_eval
757757
from numpy.lib.npyio import recfromcsv, recfromtxt
758758
from numpy.lib._function_base_impl import disp
759759
from numpy.lib.shape_base import get_array_wrap

numpy/lib/__init__.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,24 @@
2626
from . import shape_base
2727
from . import stride_tricks
2828
from . import twodim_base
29-
from . import ufunclike
29+
from . import _ufunclike_impl
3030
from . import _histograms_impl
3131
from . import polynomial
32-
from . import utils
33-
from . import arraysetops
32+
from . import _utils_impl
33+
from . import _arraysetops_impl
3434
from . import npyio
3535
from . import arrayterator
36-
from . import arraypad
36+
from . import _arraypad_impl
3737
from . import _version
3838

3939
from .index_tricks import *
4040
from .shape_base import *
4141
from .stride_tricks import *
4242
from .twodim_base import *
43-
from .ufunclike import *
4443

4544
from .polynomial import *
46-
from .utils import *
47-
from .arraysetops import *
4845
from .npyio import *
4946
from .arrayterator import Arrayterator
50-
from .arraypad import *
5147
from ._version import *
5248
from numpy.core._multiarray_umath import add_docstring, tracemalloc_domain
5349
from numpy.core.function_base import add_newdoc
@@ -58,11 +54,7 @@
5854
__all__ += shape_base.__all__
5955
__all__ += stride_tricks.__all__
6056
__all__ += twodim_base.__all__
61-
__all__ += ufunclike.__all__
62-
__all__ += arraypad.__all__
6357
__all__ += polynomial.__all__
64-
__all__ += utils.__all__
65-
__all__ += arraysetops.__all__
6658
__all__ += npyio.__all__
6759

6860
from numpy._pytesttester import PytestTester

numpy/lib/__init__.pyi

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ from numpy.lib._version import (
2121
NumpyVersion as NumpyVersion,
2222
)
2323

24-
from numpy.lib.arraypad import (
25-
pad as pad,
26-
)
27-
28-
from numpy.lib.arraysetops import (
29-
ediff1d as ediff1d,
30-
intersect1d as intersect1d,
31-
setxor1d as setxor1d,
32-
union1d as union1d,
33-
setdiff1d as setdiff1d,
34-
unique as unique,
35-
in1d as in1d,
36-
isin as isin,
37-
)
38-
3924
from numpy.lib.arrayterator import (
4025
Arrayterator as Arrayterator,
4126
)
@@ -128,19 +113,6 @@ from numpy.lib.twodim_base import (
128113
triu_indices_from as triu_indices_from,
129114
)
130115

131-
from numpy.lib.ufunclike import (
132-
fix as fix,
133-
isposinf as isposinf,
134-
isneginf as isneginf,
135-
)
136-
137-
from numpy.lib.utils import (
138-
get_include as get_include,
139-
info as info,
140-
byte_bounds as byte_bounds,
141-
show_runtime as show_runtime,
142-
)
143-
144116
from numpy.core.multiarray import (
145117
add_docstring as add_docstring,
146118
tracemalloc_domain as tracemalloc_domain,
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)