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

Skip to content

API: Update lib.histograms namespace #24513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@
diag_indices_from, diagflat, diff, digitize, dsplit, dstack,
ediff1d, emath, expand_dims, extract, eye, fill_diagonal, fix,
flip, fliplr, flipud, fromregex, get_array_wrap, genfromtxt,
get_include, gradient, hamming, hanning, histogram, histogram2d,
histogram_bin_edges, histogramdd, hsplit, i0, imag, in1d,
get_include, gradient, hamming, hanning, histogram2d,
hsplit, i0, imag, in1d,
index_exp, info, insert, interp, intersect1d, iscomplex,
iscomplexobj, isin, isneginf, isreal, isrealobj, issubclass_,
issubsctype, iterable, ix_, kaiser, kron, load, loadtxt, mask_indices,
Expand All @@ -215,6 +215,9 @@
triu, triu_indices, triu_indices_from, isposinf, RankWarning, disp,
deprecate, deprecate_with_doc, safe_eval, recfromtxt, recfromcsv
)
from .lib._histograms_impl import (
histogram, histogram_bin_edges, histogramdd
)
from . import matrixlib as _mat
from .matrixlib import (
asmatrix, bmat, mat, matrix
Expand Down Expand Up @@ -275,7 +278,8 @@

__all__ = list(
__numpy_submodules__ | set(core.__all__) | set(lib.__all__) |
set(_mat.__all__) | {"show_config", "__version__"}
set(_mat.__all__) | set(lib._histograms_impl.__all__) |
{"show_config", "__version__"}
)

# Filter out Cython harmless warnings
Expand Down
2 changes: 1 addition & 1 deletion numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ from numpy.lib.function_base import (
quantile as quantile,
)

from numpy.lib.histograms import (
from numpy.lib._histograms_impl import (
histogram_bin_edges as histogram_bin_edges,
histogram as histogram,
histogramdd as histogramdd,
Expand Down
4 changes: 1 addition & 3 deletions numpy/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from . import stride_tricks
from . import twodim_base
from . import ufunclike
from . import histograms
from . import _histograms_impl
from . import polynomial
from . import utils
from . import arraysetops
Expand All @@ -44,7 +44,6 @@
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

from .polynomial import *
from .utils import *
Expand All @@ -71,7 +70,6 @@
__all__ += arraysetops.__all__
__all__ += npyio.__all__
__all__ += nanfunctions.__all__
__all__ += histograms.__all__

from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
Expand Down
6 changes: 0 additions & 6 deletions numpy/lib/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ from numpy.lib.function_base import (
quantile as quantile,
)

from numpy.lib.histograms import (
histogram_bin_edges as histogram_bin_edges,
histogram as histogram,
histogramdd as histogramdd,
)

from numpy.lib.index_tricks import (
ravel_multi_index as ravel_multi_index,
unravel_index as unravel_index,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from numpy._utils import set_module

# needed in this module for compatibility
from numpy.lib.histograms import histogram, histogramdd # noqa: F401
from numpy.lib._histograms_impl import histogram, histogramdd # noqa: F401


array_function_dispatch = functools.partial(
Expand Down
2 changes: 1 addition & 1 deletion numpy/lib/tests/test_histograms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from numpy.lib.histograms import histogram, histogramdd, histogram_bin_edges
from numpy import histogram, histogramdd, histogram_bin_edges
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_raises, assert_allclose,
Expand Down
1 change: 0 additions & 1 deletion numpy/tests/test_public_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def test_NPY_NO_EXPORT():
"lib.arraysetops",
"lib.arrayterator",
"lib.function_base",
"lib.histograms",
"lib.index_tricks",
"lib.nanfunctions",
"lib.npyio",
Expand Down