Skip to content

Commit a116515

Browse files
authored
Merge pull request #29980 from jorenham/remove-ndindex-ndincr
DEP: remove ``ndindex.ndincr`` (deprecated since 1.20)
2 parents 4d71f51 + 0488457 commit a116515

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Removed ``numpy.ndindex.ndincr()``
2+
----------------------------------
3+
4+
The ``ndindex.ndincr()`` method has been deprecated since NumPy 1.20 and is now removed;
5+
use ``next(ndindex)`` instead.

numpy/lib/_index_tricks_impl.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import functools
22
import math
33
import sys
4-
import warnings
54
from itertools import product
65

76
import numpy as np
@@ -695,22 +694,6 @@ def __init__(self, *shape):
695694
def __iter__(self):
696695
return self
697696

698-
def ndincr(self):
699-
"""
700-
Increment the multi-dimensional index by one.
701-
702-
This method is for backward compatibility only: do not use.
703-
704-
.. deprecated:: 1.20.0
705-
This method has been advised against since numpy 1.8.0, but only
706-
started emitting DeprecationWarning as of this version.
707-
"""
708-
# NumPy 1.20.0, 2020-09-08
709-
warnings.warn(
710-
"`ndindex.ndincr()` is deprecated, use `next(ndindex)` instead",
711-
DeprecationWarning, stacklevel=2)
712-
next(self)
713-
714697
def __next__(self):
715698
"""
716699
Standard iterator method, updates the index and returns the index

numpy/lib/_index_tricks_impl.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from typing import (
1111
final,
1212
overload,
1313
)
14-
from typing_extensions import TypeVar, deprecated
14+
from typing_extensions import TypeVar
1515

1616
import numpy as np
1717
from numpy._core.multiarray import ravel_multi_index, unravel_index
@@ -101,10 +101,6 @@ class ndindex:
101101
def __iter__(self) -> Self: ...
102102
def __next__(self) -> _AnyShape: ...
103103

104-
#
105-
@deprecated("Deprecated since 1.20.0.")
106-
def ndincr(self, /) -> None: ...
107-
108104
class nd_grid(Generic[_BoolT_co]):
109105
__slots__ = ("sparse",)
110106

0 commit comments

Comments
 (0)