8000 MAINT: Move in1d implementation to a private function · numpy/numpy@f9fd36d · GitHub
[go: up one dir, main page]

Skip to content

Commit f9fd36d

Browse files
committed
MAINT: Move in1d implementation to a private function
1 parent 7eb545f commit f9fd36d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

numpy/lib/arraysetops.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,10 @@ def in1d(ar1, ar2, assume_unique=False, invert=False, *, kind=None):
624624
stacklevel=2
625625
)
626626

627+
return _in1d(ar1, ar2, assume_unique, invert, kind=kind)
628+
629+
630+
def _in1d(ar1, ar2, assume_unique=False, invert=False, *, kind=None):
627631
# Ravel both arrays, behavior for the first array could be different
628632
ar1 = np.asarray(ar1).ravel()
629633
ar2 = np.asarray(ar2).ravel()
@@ -896,13 +900,8 @@ def isin(element, test_elements, assume_unique=False, invert=False, *,
896900
[ True, False]])
897901
"""
898902
element = np.asarray(element)
899-
900-
# TODO: remove warning catch once `in1d` deprecation period passes
901-
# and import it as a private method.
902-
with warnings.catch_warnings():
903-
warnings.simplefilter("ignore", DeprecationWarning)
904-
result = in1d(element, test_elements, assume_unique=assume_unique,
905-
invert=invert, kind=kind).reshape(element.shape)
903+
result = _in1d(element, test_elements, assume_unique=assume_unique,
904+
invert=invert, kind=kind).reshape(element.shape)
906905
return result
907906

908907

@@ -993,9 +992,5 @@ def setdiff1d(ar1, ar2, assume_unique=False):
993992
else:
994993
ar1 = unique(ar1)
995994
ar2 = unique(ar2)
996-
# TODO: remove warning catch once `in1d` deprecation period passes
997-
# and import it as a private method.
998-
with warnings.catch_warnings():
999-
warnings.simplefilter("ignore", DeprecationWarning)
1000-
result = ar1[in1d(ar1, ar2, assume_unique=True, invert=True)]
995+
result = ar1[_in1d(ar1, ar2, assume_unique=True, invert=True)]
1001996
return result

0 commit comments

Comments
 (0)
0