diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-11-13 22:18:16 -0800 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-11-13 22:18:46 -0800 |
commit | fc73a3ba91aaba22a6fa8778015afd32626a5645 (patch) | |
tree | 7f451efcc71e5b8aa817263e7d3bb10e09f967be /numpy/core/multiarray.py | |
parent | 4b505c5709ca0974b20176d3ef133e7ed2a7d3fa (diff) | |
download | numpy-fc73a3ba91aaba22a6fa8778015afd32626a5645.tar.gz |
MAINT: fix test failures
Diffstat (limited to 'numpy/core/multiarray.py')
-rw-r--r-- | numpy/core/multiarray.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/numpy/core/multiarray.py b/numpy/core/multiarray.py index 2b3633c97..f068717a4 100644 --- a/numpy/core/multiarray.py +++ b/numpy/core/multiarray.py @@ -7,6 +7,7 @@ by importing from the extension module. """ import functools +import warnings from . import overrides from . import _multiarray_umath @@ -994,12 +995,21 @@ def ravel_multi_index(multi_index, dims, mode='raise', order='C'): multi_index, dims, mode=mode, order=order) -def _unravel_index_dispatcher(indices, shape, order=None): +def _deprecate_dims(shape, dims): + if dims is not None: + warnings.warn("'shape' argument should be used instead of 'dims'", + DeprecationWarning, stacklevel=3) + shape = dims + return shape + + +def _unravel_index_dispatcher(indices, shape=None, order=None, dims=None): + shape = _deprecate_dims(shape, dims) return (indices,) @array_function_dispatch(_unravel_index_dispatcher) -def unravel_index(indices, shape, order='C'): +def unravel_index(indices, shape=None, order='C', dims=None): """ Converts a flat index or array of flat indices into a tuple of coordinate arrays. @@ -1043,6 +1053,7 @@ def unravel_index(indices, shape, order='C'): (3, 1, 4, 1) """ + shape = _deprecate_dims(shape, dims) return _multiarray_umath.unravel_index(indices, shape, order=order) |