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

Skip to content

Commit ef961d9

Browse files
committed
API: Update lib.index_tricks namespace
1 parent 99c1d5f commit ef961d9

12 files changed

+17
-32
lines changed

numpy/__init__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,10 @@
183183

184184
from . import lib
185185
from .lib import (
186-
DataSource, c_, diag_indices, diag_indices_from, emath,
187-
fromregex, genfromtxt, index_exp, ix_, load, loadtxt,
188-
mgrid, ndenumerate, ndindex, ogrid, fill_diagonal,
186+
DataSource, emath, fromregex, genfromtxt, load, loadtxt,
189187
packbits, poly, poly1d, polyadd, polyder,
190188
polydiv, polyfit, polyint, polymul, polysub, polyval,
191-
r_, ravel_multi_index, roots, s_, save, savetxt, savez,
192-
savez_compressed, unpackbits, unravel_index
189+
roots, save, savetxt, savez, savez_compressed, unpackbits
193190
)
194191
from .lib._histograms_impl import (
195192
histogram, histogram_bin_edges, histogramdd
@@ -231,6 +228,11 @@
231228
from .lib._stride_tricks_impl import (
232229
broadcast_arrays, broadcast_shapes, broadcast_to
233230
)
231+
from .lib._index_tricks_impl import (
232+
diag_indices_from, diag_indices, fill_diagonal, ndindex, ndenumerate,
233+
ix_, c_, r_, s_, ogrid, mgrid, unravel_index, ravel_multi_index,
234+
index_exp
235+
)
234236
from . import matrixli 8000 b as _mat
235237
from .matrixlib import (
236238
asmatrix, bmat, matrix
@@ -302,6 +304,7 @@
302304
set(lib._arraypad_impl.__all__) |
303305
set(lib._utils_impl.__all__) |
304306
set(lib._stride_tricks_impl.__all__) |
307+
set(lib._index_tricks_impl.__all__) |
305308
{"show_config", "__version__"}
306309
)
307310

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 _stride_tricks_impl
@@ -37,7 +37,6 @@
3737
from . import _arraypad_impl
3838
from . import _version
3939

40-
from .index_tricks import *
4140
from .polynomial import *
4241
from .npyio import *
4342
from .arrayterator import Arrayterator
@@ -47,7 +46,6 @@
4746

4847

4948
__all__ = ['emath']
50-
__all__ += index_tricks.__all__
5149
__all__ += polynomial.__all__
5250
__all__ += npyio.__all__
5351

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
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_impl.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
10000 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
@@ -193,7 +193,6 @@ def test_NPY_NO_EXPORT():
193193
"f2py.use_rules",
194194
"fft.helper",
195195
"lib.arrayterator",
196-
"lib.index_tricks",
197196
"lib.npyio",
198197
"lib.polynomial",
199198
"lib.user_array", # note: not in np.lib, but probably should just be deleted

0 commit comments

Comments
 (0)
0