Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
_internal.py28 linesDownload Raw Back to core
1from numpy._core import _internal
2
3
4# Build a new array from the information in a pickle.
5# Note that the name numpy.core._internal._reconstruct is embedded in
6# pickles of ndarrays made with NumPy before release 1.0
7# so don't remove the name here, or you'll
8# break backward compatibility.
9def _reconstruct(subtype, shape, dtype):
10    from numpy import ndarray
11    return ndarray.__new__(subtype, shape, dtype)
12
13
14# Pybind11 (in versions <= 2.11.1) imports _dtype_from_pep3118 from the
15# _internal submodule, therefore it must be importable without a warning.
16_dtype_from_pep3118 = _internal._dtype_from_pep3118
17
18def __getattr__(attr_name):
19    from numpy._core import _internal
20
21    from ._utils import _raise_warning
22    ret = getattr(_internal, attr_name, None)
23    if ret is None:
24        raise AttributeError(
25            f"module 'numpy.core._internal' has no attribute {attr_name}")
26    _raise_warning(attr_name, "_internal")
27    return ret
28 
codekingpro/portable-devtools · Team Ai