1"""
2**Note:** almost all functions in the ``numpy.lib`` namespace
3are also present in the main ``numpy`` namespace. Please use the
4functions as ``np.<funcname>`` where possible.
5
6``numpy.lib`` is mostly a space for implementing functions that don't
7belong in core or in another NumPy submodule with a clear purpose
8(e.g. ``random``, ``fft``, ``linalg``, ``ma``).
9
10Most contains basic functions that are used by several submodules and are
11useful to have in the main name-space.
12
13"""
14
15# Public submodules
16# Note: recfunctions and (maybe) format are public too, but not imported
17from . import mixins
18from . import scimath as emath
19
20# Private submodules
21# load module names. See https://github.com/networkx/networkx/issues/5838
22from . import type_check
23from . import index_tricks
24from . import function_base
25from . import nanfunctions
26from . import shape_base
27from . import stride_tricks
28from . import twodim_base
29from . import ufunclike
30from . import histograms
31from . import polynomial
32from . import utils
33from . import arraysetops
34from . import npyio
35from . import arrayterator
36from . import arraypad
37from . import _version
38
39from .type_check import *
40from .index_tricks import *
41from .function_base import *
42from .nanfunctions import *
43from .shape_base import *
44from .stride_tricks import *
45from .twodim_base import *
46from .ufunclike import *
47from .histograms import *
48
49from .polynomial import *
50from .utils import *
51from .arraysetops import *
52from .npyio import *
53from .arrayterator import Arrayterator
54from .arraypad import *
55from ._version import *
56from numpy.core._multiarray_umath import tracemalloc_domain
57
58__all__ = ['emath', 'tracemalloc_domain', 'Arrayterator']
59__all__ += type_check.__all__
60__all__ += index_tricks.__all__
61__all__ += function_base.__all__
62__all__ += shape_base.__all__
63__all__ += stride_tricks.__all__
64__all__ += twodim_base.__all__
65__all__ += ufunclike.__all__
66__all__ += arraypad.__all__
67__all__ += polynomial.__all__
68__all__ += utils.__all__
69__all__ += arraysetops.__all__
70__all__ += npyio.__all__
71__all__ += nanfunctions.__all__
72__all__ += histograms.__all__
73
74from numpy._pytesttester import PytestTester
75test = PytestTester(__name__)
76del PytestTester
77
78def __getattr__(attr):
79 # Warn for reprecated attributes
80 import math
81 import warnings
82
83 if attr == 'math':
84 warnings.warn(
85 "`np.lib.math` is a deprecated alias for the standard library "
86 "`math` module (Deprecated Numpy 1.25). Replace usages of "
87 "`numpy.lib.math` with `math`", DeprecationWarning, stacklevel=2)
88 return math
89 else:
90 raise AttributeError("module {!r} has no attribute "
91 "{!r}".format(__name__, attr))
92