Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
__init__.py34 linesDownload Raw Back to core
1"""
2The `numpy.core` submodule exists solely for backward compatibility
3purposes. The original `core` was renamed to `_core` and made private.
4`numpy.core` will be removed in the future.
5"""
6from numpy import _core
7
8from ._utils import _raise_warning
9
10
11# We used to use `np.core._ufunc_reconstruct` to unpickle.
12# This is unnecessary, but old pickles saved before 1.20 will be using it,
13# and there is no reason to break loading them.
14def _ufunc_reconstruct(module, name):
15    # The `fromlist` kwarg is required to ensure that `mod` points to the
16    # inner-most module rather than the parent package when module name is
17    # nested. This makes it possible to pickle non-toplevel ufuncs such as
18    # scipy.special.expit for instance.
19    mod = __import__(module, fromlist=[name])
20    return getattr(mod, name)
21
22
23# force lazy-loading of submodules to ensure a warning is printed
24
25__all__ = ["arrayprint", "defchararray", "_dtype_ctypes", "_dtype",  # noqa: F822
26           "einsumfunc", "fromnumeric", "function_base", "getlimits",
27           "_internal", "multiarray", "_multiarray_umath", "numeric",
28           "numerictypes", "overrides", "records", "shape_base", "umath"]
29
30def __getattr__(attr_name):
31    attr = getattr(_core, attr_name)
32    _raise_warning(attr_name)
33    return attr
34 
codekingpro/portable-devtools · Team Ai