8000 API: Update lib.index_tricks namespace · numpy/numpy@eab45a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit eab45a4

Browse files
committed
API: Update lib.index_tricks namespace
1 parent 5ba26f0 commit eab45a4

12 files changed

+22
-36
lines changed

numpy/__init__.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,19 @@
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,
189-
diag_indices_from, diagflat, dsplit, dstack,
190-
ediff1d, emath, expand_dims, eye, fill_diagonal, fix,
188+
broadcast_to, byte_bounds, column_stack, diag,
189+
diagflat, dsplit, dstack, ediff1d, emath, expand_dims, eye, fix,
191190
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,
194-
mgrid, ndenumerate, ndindex, ogrid,
191+
get_include, histogram2d, hsplit, in1d, info, intersect1d,
192+
isin, isneginf, kron, load, loadtxt, mask_indices,
195193
packbits, pad, poly, poly1d, polyadd, polyder,
196194
polydiv, polyfit, polyint, polymul, polysub, polyval,
197-
put_along_axis, r_, ravel_multi_index,
198-
roots, row_stack, s_, save, savetxt, savez, savez_compressed,
195+
put_along_axis,
196+
roots, row_stack, save, savetxt, savez, savez_compressed,
199197
setdiff1d, setxor1d, show_runtime, split,
200198
take_along_axis, tile, tri, tril,
201199
tril_indices, tril_indices_from, union1d, unique, unpackbits,
202-
unravel_index, vander, vsplit, triu, triu_indices, triu_indices_from,
200+
vander, vsplit, triu, triu_indices, triu_indices_from,
203201
isposinf
204202
)
205203
from .lib._histograms_impl import (
@@ -221,6 +219,11 @@
221219
iscomplexobj, isrealobj, imag, iscomplex, isreal, nan_to_num, real,
222220
real_if_close, typename, mintypecode, common_type
223221
)
222+
from .lib._index_tricks_impl import (
223+
diag_indices_from, diag_indices, fill_diagonal, ndindex, ndenumerate,
224+
ix_, c_, r_, s_, ogrid, mgrid, unravel_index, ravel_multi_index,
225+
index_exp
226+
)
224227
from . import matrixlib as _mat
225228
from .matrixlib import (
226229
asmatrix, bmat, matrix
@@ -285,6 +288,7 @@
285288
set(lib._nanfunctions_impl.__all__) |
286289
set(lib._function_base_impl.__all__) |
287290
set(lib._type_check_impl.__all__) |
291+
set(lib._index_tricks_impl.__all__) |
288292
{"show_config", "__version__"}
289293
)
290294

numpy/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ from numpy.lib._histograms_impl import (
458458
histogramdd as histogramdd,
459459
)
460460

461-
from numpy.lib.index_tricks import (
461+
from numpy.lib._index_tricks_impl import (
462462
ravel_multi_index as ravel_multi_index,
463463
unravel_index as unravel_index,
464464
mgrid as mgrid,

numpy/core/tests/test_function_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def test_add_doc(self):
460460
tgt = "Current flat index into the array."
461461
assert_equal(np.core.flatiter.index.__doc__[:len(tgt)], tgt)
462462
assert_(len(np.core.ufunc.identity.__doc__) > 300)
463-
assert_(len(np.lib.index_tricks.mgrid.__doc__) > 300)
463+
assert_(len(np.lib._index_tricks_impl.mgrid.__doc__) > 300)
464464

465465
@pytest.mark.skipif(sys.flags.optimize == 2, reason="Python running -OO")
466466
def test_errors_are_ignored(self):

numpy/lib/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Private submodules
2121
# load module names. See https://github.com/networkx/networkx/issues/5838
2222
from . import _type_check_impl
23-
from . import index_tricks
23+
from . import _index_tricks_impl
2424
from . import _nanfunctions_impl
2525
from . import _function_base_impl
2626
from . import shape_base
@@ -36,7 +36,6 @@
3636
from . import arraypad
3737
from . import _version
3838

39-
from .index_tricks import *
4039
from .shape_base import *
4140
from .stride_tricks import *
4241
from .twodim_base import *
@@ -54,7 +53,6 @@
5453

5554

5655
__all__ = ['emath']
57-
__all__ += index_tricks.__all__
5856
__all__ += shape_base.__all__
5957
__all__ += stride_tricks.__all__
6058
__all__ += twodim_base.__all__

numpy/lib/__init__.pyi

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,6 @@ from numpy.lib.arrayterator import (
4040
Arrayterator as Arrayterator,
4141
)
4242

43-
from numpy.lib.index_tricks import (
44-
ravel_multi_index as ravel_multi_index,
45-
unravel_index as unravel_index,
46-
mgrid as mgrid,
47-
ogrid as ogrid,
48-
r_ as r_,
49-
c_ as c_,
50-
s_ as s_,
51-
index_exp as index_exp,
52-
ix_ as ix_,
53-
fill_diagonal as fill_diagonal,
54-
diag_indices as diag_indices,
55-
diag_indices_from as diag_indices_from,
56-
)
57-
5843
from numpy.lib.npyio import (
5944
savetxt as savetxt,
6045
loadtxt as loadtxt,
File renamed without changes.
File renamed without changes.

numpy/lib/arraypad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
import numpy as np
77
from numpy.core.overrides import array_function_dispatch
8-
from numpy.lib.index_tricks import ndindex
8+
from numpy.lib._index_tricks_impl import ndindex
99

1010

1111
__all__ = ['pad']

numpy/lib/shape_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from numpy.core import vstack, atleast_3d
1010
from numpy.core.numeric import normalize_axis_tuple
1111
from numpy.core.shape_base import _arrays_for_stack_dispatcher
12-
from numpy.lib.index_tricks import ndindex
12+
from numpy.lib._index_tricks_impl import ndindex
1313
from numpy.matrixlib.defmatrix import matrix # this raises all the right alarm bells
1414

1515

numpy/lib/tests/test_index_tricks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
assert_, assert_equal, assert_array_equal, assert_almost_equal,
66
assert_array_almost_equal, assert_raises, assert_raises_regex,
77
)
8-
from numpy.lib.index_tricks import (
8+
from numpy.lib._index_tricks_impl import (
99
mgrid, ogrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_from,
< 10000 /code>
10-
index_exp, ndindex, r_, s_, ix_
10+
index_exp, ndindex, c_, r_, s_, ix_
1111
)
1212

1313

@@ -405,7 +405,7 @@ def test_repeated_input(self):
405405

406406

407407
def test_c_():
408-
a = np.c_[np.array([[1, 2, 3]]), 0, 0, np.array([[4, 5, 6]])]
408+
a = c_[np.array([[1, 2, 3]]), 0, 0, np.array([[4, 5, 6]])]
409409
assert_equal(a, [[1, 2, 3, 0, 0, 4, 5, 6]])
410410

411411

numpy/ma/extras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from numpy.core.multiarray import normalize_axis_index
3636
from numpy.core.numeric import normalize_axis_tuple
3737
from numpy.lib._function_base_impl import _ureduce
38-
from numpy.lib.index_tricks import AxisConcatenator
38+
from numpy.lib._index_tricks_impl import AxisConcatenator
3939

4040

4141
def issequence(seq):

numpy/tests/test_public_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def test_NPY_NO_EXPORT():
199199
"lib.arraypad",
200200
"lib.arraysetops",
201201
"lib.arrayterator",
202-
"lib.index_tricks",
203202
"lib.npyio",
204203
"lib.polynomial",
205204
"lib.shape_base",

0 commit comments

Comments
 (0)
0