Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fc28b0

Browse files
authored
Merge pull request #24536 from mtsokol/lib-nanfunctions-namespace
API: Update `lib.nanfunctions` namespace
2 parents 4b849d4 + ecb6a66 commit 7fc28b0

8 files changed

+11
-27
lines changed

numpy/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@
202202
iscomplexobj, isin, isneginf, isreal, isrealobj, issubclass_,
203203
issubsctype, iterable, ix_, kaiser, kron, load, loadtxt, mask_indices,
204204
median, meshgrid, mgrid, mintypecode, nan_to_num,
205-
nanargmax, nanargmin, nancumprod, nancumsum, nanmax, nanmean,
206-
nanmedian, nanmin, nanpercentile, nanprod, nanquantile, nanstd,
207-
nansum, nanvar, ndenumerate, ndindex, ogrid, packbits, pad,
205+
ndenumerate, ndindex, ogrid, packbits, pad,
208206
percentile, piecewise, place, poly, poly1d, polyadd, polyder,
209207
polydiv, polyfit, polyint, polymul, polysub, polyval,
210208
put_along_axis, quantile, r_, ravel_multi_index, real, real_if_close,
@@ -219,6 +217,11 @@
219217
from .lib._histograms_impl import (
220218
histogram, histogram_bin_edges, histogramdd
221219
)
220+
from .lib._nanfunctions_impl import (
221+
nanargmax, nanargmin, nancumprod, nancumsum, nanmax, nanmean,
222+
nanmedian, nanmin, nanpercentile, nanprod, nanquantile, nanstd,
223+
nansum, nanvar
224+
)
222225
from . import matrixlib as _mat
223226
from .matrixlib import (
224227
asmatrix, bmat, mat, matrix
@@ -280,6 +283,7 @@
280283
__all__ = list(
281284
__numpy_submodules__ | set(core.__all__) | set(lib.__all__) |
282285
set(_mat.__all__) | set(lib._histograms_impl.__all__) |
286+
set(lib._nanfunctions_impl.__all__) |
283287
{"show_config", "__version__"}
284288
)
285289

numpy/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ from numpy.lib.index_tricks import (
490490
diag_indices_from as diag_indices_from,
491491
)
492492

493-
from numpy.lib.nanfunctions import (
493+
from numpy.lib._nanfunctions_impl import (
494494
nansum as nansum,
495495
nanmax as nanmax,
496496
nanmin as nanmin,

numpy/lib/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from . import type_check
2323
from . import index_tricks
2424
from . import function_base
25-
from . import nanfunctions
25+
from . import _nanfunctions_impl
2626
from . import shape_base
2727
from . import stride_tricks
2828
from . import twodim_base
@@ -39,7 +39,6 @@
3939
from .type_check import *
4040
from .index_tricks import *
4141
from .function_base import *
42-
from .nanfunctions import *
4342
from .shape_base import *
4443
from .stride_tricks import *
4544
from .twodim_base import *
@@ -69,7 +68,6 @@
6968
__all__ += utils.__all__
7069
__all__ += arraysetops.__all__
7170
__all__ += npyio.__all__
72-
__all__ += nanfunctions.__all__
7371

7472
from numpy._pytesttester import PytestTester
7573
test = PytestTester(__name__)

numpy/lib/__init__.pyi

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,6 @@ from numpy.lib.index_tricks import (
9898
diag_indices_from as diag_indices_from,
9999
)
100100

101-
from numpy.lib.nanfunctions import (
102-
nansum as nansum,
103-
nanmax as nanmax,
104-
nanmin as nanmin,
105-
nanargmax as nanargmax,
106-
nanargmin as nanargmin,
107-
nanmean as nanmean,
108-
nanmedian as nanmedian,
109-
nanpercentile as nanpercentile,
110-
nanvar as nanvar,
111-
nanstd as nanstd,
112-
nanprod as nanprod,
113-
nancumsum as nancumsum,
114-
nancumprod as nancumprod,
115-
nanquantile as nanquantile,
116-
)
117-
118101
from numpy.lib.npyio import (
119102
savetxt as savetxt,
120103
loadtxt as loadtxt,
File renamed without changes.
File renamed without changes.

numpy/lib/tests/test_nanfunctions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
from numpy.core.numeric import normalize_axis_tuple
77
from numpy.exceptions import AxisError, ComplexWarning
8-
from numpy.lib.nanfunctions import _nan_mask, _replace_nan
8+
from numpy.lib._nanfunctions_impl import _nan_mask, _replace_nan
99
from numpy.testing import (
1010
assert_, assert_equal, assert_almost_equal, assert_raises,
1111
assert_raises_regex, assert_array_equal, suppress_warnings
@@ -81,7 +81,7 @@ def test_signature_match(self, nan_func, func):
8181
def test_exhaustiveness(self):
8282
"""Validate that all nan functions are actually tested."""
8383
np.testing.assert_equal(
84-
set(self.IDS), set(np.lib.nanfunctions.__all__)
84+
set(self.IDS), set(np.lib._nanfunctions_impl.__all__)
8585
)
8686

8787

numpy/tests/test_public_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def test_NPY_NO_EXPORT():
208208
"lib.arrayterator",
209209
"lib.function_base",
210210
"lib.index_tricks",
211-
"lib.nanfunctions",
212211
"lib.npyio",
213212
"lib.polynomial",
214213
"lib.shape_base",

0 commit comments

Comments
 (0)