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

Skip to content

Commit 96395e3

Browse files
committed
API: Update lib.index_tricks namespace
1 parent b43384e commit 96395e3

12 files changed

+20
-36
lines changed

numpy/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,14 @@
185185
from .lib import (
186186
DataSource, apply_along_axis, apply_over_axes,
187187
array_split, broadcast_arrays, broadcast_shapes,
188-
broadcast_to, c_, column_stack, diag_indices,
189-
diag_indices_from, dsplit, dstack,
190-
emath, expand_dims, fill_diagonal,
191-
fromregex, get_array_wrap, genfromtxt,
192-
hsplit, index_exp, ix_, kron, load, loadtxt,
193-
mgrid, ndenumerate, ndindex, ogrid,
188+
broadcast_to, column_stack, dsplit, dstack,
189+
emath, expand_dims, fromregex, get_array_wrap, genfromtxt,
190+
hsplit, kron, load, loadtxt,
194191
packbits, poly, poly1d, polyadd, polyder,
195192
polydiv, polyfit, polyint, polymul, polysub, polyval,
196-
put_along_axis, r_, ravel_multi_index,
197-
roots, row_stack, s_, save, savetxt, savez,
193+
put_along_axis, roots, row_stack, save, savetxt, savez,
198194
savez_compressed, split, take_along_axis, tile,
199-
unpackbits, unravel_index, vsplit
195+
unpackbits, vsplit
200196
)
201197
from .lib._histograms_impl import (
202198
histogram, histogram_bin_edges, histogramdd
@@ -230,6 +226,11 @@
230226
from .lib._utils_impl import (
231227
byte_bounds, show_runtime, get_include, info
232228
)
229+
from .lib._index_tricks_impl import (
230+
diag_indices_from, diag_indices, fill_diagonal, ndindex, ndenumerate,
231+
ix_, c_, r_, s_, ogrid, mgrid, unravel_index, ravel_multi_index,
232+
index_exp
233+
)
233234
from . import matrixlib as _mat
234235
from .matrixlib import (
235236
asmatrix, bmat, matrix
@@ -299,6 +300,7 @@
299300
set(lib._ufunclike_impl.__all__) |
300301
set(lib._arraypad_impl.__all__) |
301302
set(lib._utils_impl.__all__) |
303+
set(lib._index_tricks_impl.__all__) |
302304
{"show_config", "__version__"}
303305
)
304306

numpy/__init__.pyi

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

460-
from numpy.lib.index_tricks import (
460+
from numpy.lib._index_tricks_impl import (
461461
ravel_multi_index as ravel_multi_index,
462462
unravel_index as unravel_index,
463463
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_impl
3737
from . import _version
3838

39-
from .index_tricks import *
4039
from .shape_base import *
4140
from .stride_tricks import *
4241
from .polynomial import *
@@ -48,7 +47,6 @@
4847

4948

5049
__all__ = ['emath']
51-
__all__ += index_tricks.__all__
5250
__all__ += shape_base.__all__
5351
__all__ += stride_tricks.__all__
5452
__all__ += polynomial.__all__

numpy/lib/__init__.pyi

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ from numpy.lib.arrayterator import (
2525
Arrayterator as Arrayterator,
2626
)
2727

28-
from numpy.lib.index_tricks import (
29-
ravel_multi_index as ravel_multi_index,
30-
unravel_index as unravel_index,
31-
mgrid as mgrid,
32-
ogrid as ogrid,
33-
r_ as r_,
34-
c_ as c_,
35-
s_ as s_,
36-
index_exp as index_exp,
37-
ix_ as ix_,
38-
fill_diagonal as fill_diagonal,
39-
diag_indices as diag_indices,
40-
diag_indices_from as diag_indices_from,
41-
)
42-
4328
from numpy.lib.npyio import (
4429
savetxt as savetxt,
4530
loadtxt as loadtxt,

numpy/lib/_arraypad_impl.py

Lines changed: 1 addition & 1 deletion
< 10000 tr class="diff-line-row">
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']
File renamed without changes.
File renamed without changes.

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,
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
@@ -194,7 +194,6 @@ def test_NPY_NO_EXPORT():
194194
"f2py.use_rules",
195195
"fft.helper",
196196
"lib.arrayterator",
197-
"lib.index_tricks",
198197
"lib.npyio",
199198
"lib.polynomial",
200199
"lib.shape_base",

0 commit comments

Comments
 (0)
0