summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-08-03 14:46:51 -0600
committerGitHub <noreply@github.com>2021-08-03 14:46:51 -0600
commit2a9a95d250c91f842b9fdc32cbeaeaced8b5896b (patch)
treeef62f2e4b35891a76d2d59dc2b602a86ef483e34 /numpy/ma/core.py
parenta1ee7968df16a4f57c8e22164d19aa2d14a6cdad (diff)
parent557bb33ff71c6aae64a85e58d2b78b2c8877a0f5 (diff)
downloadnumpy-2a9a95d250c91f842b9fdc32cbeaeaced8b5896b.tar.gz
Merge pull request #19599 from anntzer/loadtxtunclose
PERF: Avoid using `@recursive`.
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 431114fe0..d2150919f 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -39,7 +39,6 @@ from numpy.compat import (
)
from numpy import expand_dims
from numpy.core.numeric import normalize_axis_tuple
-from numpy.core._internal import recursive
__all__ = [
@@ -1685,6 +1684,16 @@ def make_mask_none(newshape, dtype=None):
return result
+def _recursive_mask_or(m1, m2, newmask):
+ names = m1.dtype.names
+ for name in names:
+ current1 = m1[name]
+ if current1.dtype.names is not None:
+ _recursive_mask_or(current1, m2[name], newmask[name])
+ else:
+ umath.logical_or(current1, m2[name], newmask[name])
+
+
def mask_or(m1, m2, copy=False, shrink=True):
"""
Combine two masks with the ``logical_or`` operator.
@@ -1722,17 +1731,6 @@ def mask_or(m1, m2, copy=False, shrink=True):
"""
- @recursive
- def _recursive_mask_or(self, m1, m2, newmask):
- names = m1.dtype.names
- for name in names:
- current1 = m1[name]
- if current1.dtype.names is not None:
- self(current1, m2[name], newmask[name])
- else:
- umath.logical_or(current1, m2[name], newmask[name])
- return
-
if (m1 is nomask) or (m1 is False):
dtype = getattr(m2, 'dtype', MaskType)
return make_mask(m2, copy=copy, shrink=shrink, dtype=dtype)