shadchin 1 год назад
Родитель
Сommit
5bb4e90974

Разница между файлами не показана из-за своего большого размера
+ 979 - 14
contrib/python/numpy/py3/.dist-info/METADATA


+ 3 - 5
contrib/python/numpy/py3/.dist-info/entry_points.txt

@@ -1,11 +1,9 @@
 [array_api]
 numpy = numpy.array_api
 
-[console_scripts]
-f2py = numpy.f2py.f2py2e:main
-f2py3 = numpy.f2py.f2py2e:main
-f2py3.11 = numpy.f2py.f2py2e:main
-
 [pyinstaller40]
 hook-dirs = numpy:_pyinstaller_hooks_dir
 
+[console_scripts]
+f2py = numpy.f2py.f2py2e:main
+

+ 0 - 24
contrib/python/numpy/py3/LICENSE.txt

@@ -28,27 +28,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-The NumPy repository and source distributions bundle several libraries that are
-compatibly licensed.  We list these here.
-
-Name: lapack-lite
-Files: numpy/linalg/lapack_lite/*
-License: BSD-3-Clause
-  For details, see numpy/linalg/lapack_lite/LICENSE.txt
-
-Name: tempita
-Files: tools/npy_tempita/*
-License: MIT
-  For details, see tools/npy_tempita/license.txt
-
-Name: dragon4
-Files: numpy/core/src/multiarray/dragon4.c
-License: MIT
-  For license text, see numpy/core/src/multiarray/dragon4.c
-
-Name: libdivide
-Files: numpy/core/include/numpy/libdivide/*
-License: Zlib
-  For license text, see numpy/core/include/numpy/libdivide/LICENSE.txt

+ 41 - 0
contrib/python/numpy/py3/LICENSES_bundled.txt

@@ -0,0 +1,41 @@
+The NumPy repository and source distributions bundle several libraries that are
+compatibly licensed.  We list these here.
+
+Name: lapack-lite
+Files: numpy/linalg/lapack_lite/*
+License: BSD-3-Clause
+  For details, see numpy/linalg/lapack_lite/LICENSE.txt
+
+Name: tempita
+Files: tools/npy_tempita/*
+License: MIT
+  For details, see tools/npy_tempita/license.txt
+
+Name: dragon4
+Files: numpy/core/src/multiarray/dragon4.c
+License: MIT
+  For license text, see numpy/core/src/multiarray/dragon4.c
+
+Name: libdivide
+Files: numpy/core/include/numpy/libdivide/*
+License: Zlib
+  For license text, see numpy/core/include/numpy/libdivide/LICENSE.txt
+
+
+Note that the following files are vendored in the repository and sdist but not
+installed in built numpy packages:
+
+Name: Meson
+Files: vendored-meson/meson/*
+License: Apache 2.0
+  For license text, see vendored-meson/meson/COPYING
+
+Name: meson-python
+Files: vendored-meson/meson-python/*
+License: MIT
+  For license text, see vendored-meson/meson-python/LICENSE
+
+Name: spin
+Files: .spin/cmds.py
+License: BSD-3
+  For license text, see .spin/LICENSE

+ 2 - 1
contrib/python/numpy/py3/numpy/__init__.cython-30.pxd

@@ -21,7 +21,7 @@ cdef extern from *:
 
 
 cdef extern from "Python.h":
-    ctypedef Py_ssize_t Py_intptr_t
+    ctypedef int Py_intptr_t
 
 cdef extern from "numpy/arrayobject.h":
     ctypedef Py_intptr_t npy_intp
@@ -852,6 +852,7 @@ cdef extern from "numpy/arrayscalars.h":
         NPY_FR_ps
         NPY_FR_fs
         NPY_FR_as
+        NPY_FR_GENERIC
 
 
 #

+ 1 - 0
contrib/python/numpy/py3/numpy/__init__.pxd

@@ -810,6 +810,7 @@ cdef extern from "numpy/arrayscalars.h":
         NPY_FR_ps
         NPY_FR_fs
         NPY_FR_as
+        NPY_FR_GENERIC
 
 
 #

+ 6 - 4
contrib/python/numpy/py3/numpy/__init__.py

@@ -66,7 +66,7 @@ testing
     NumPy testing tools
 distutils
     Enhancements to distutils with support for
-    Fortran compilers support and more.
+    Fortran compilers support and more  (for Python <= 3.11).
 
 Utilities
 ---------
@@ -108,6 +108,11 @@ from .exceptions import (
     ComplexWarning, ModuleDeprecationWarning, VisibleDeprecationWarning,
     TooHardError, AxisError)
 
+
+# If a version with git hash was stored, use that instead
+from . import version
+from .version import __version__
+
 # We first need to detect if we're being called as part of the numpy setup
 # procedure itself in a reliable manner.
 try:
@@ -447,8 +452,5 @@ else:
     del os
 
 
-# get the version using versioneer
-from .version import __version__, git_revision as __git_version__
-
 # Remove symbols imported for internal use
 del sys, warnings

+ 24 - 12
contrib/python/numpy/py3/numpy/__init__.pyi

@@ -1,4 +1,5 @@
 import builtins
+import sys
 import os
 import mmap
 import ctypes as ct
@@ -666,7 +667,6 @@ class _SupportsWrite(Protocol[_AnyStr_contra]):
 __all__: list[str]
 __path__: list[str]
 __version__: str
-__git_version__: str
 test: PytestTester
 
 # TODO: Move placeholders to their respective module once
@@ -683,6 +683,7 @@ _ByteOrder = L["S", "<", ">", "=", "|", "L", "B", "N", "I"]
 @final
 class dtype(Generic[_DTypeScalar_co]):
     names: None | tuple[builtins.str, ...]
+    def __hash__(self) -> int: ...
     # Overload for subclass of generic
     @overload
     def __new__(
@@ -1440,17 +1441,18 @@ _ShapeType = TypeVar("_ShapeType", bound=Any)
 _ShapeType2 = TypeVar("_ShapeType2", bound=Any)
 _NumberType = TypeVar("_NumberType", bound=number[Any])
 
-# There is currently no exhaustive way to type the buffer protocol,
-# as it is implemented exclusively in the C API (python/typing#593)
-_SupportsBuffer = Union[
-    bytes,
-    bytearray,
-    memoryview,
-    _array.array[Any],
-    mmap.mmap,
-    NDArray[Any],
-    generic,
-]
+if sys.version_info >= (3, 12):
+    from collections.abc import Buffer as _SupportsBuffer
+else:
+    _SupportsBuffer = (
+        bytes
+        | bytearray
+        | memoryview
+        | _array.array[Any]
+        | mmap.mmap
+        | NDArray[Any]
+        | generic
+    )
 
 _T = TypeVar("_T")
 _T_co = TypeVar("_T_co", covariant=True)
@@ -1513,6 +1515,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
         order: _OrderKACF = ...,
     ) -> _ArraySelf: ...
 
+    if sys.version_info >= (3, 12):
+        def __buffer__(self, flags: int, /) -> memoryview: ...
+
     def __class_getitem__(self, item: Any) -> GenericAlias: ...
 
     @overload
@@ -2555,6 +2560,7 @@ class generic(_ArrayOrScalarCommon):
     def __array__(self: _ScalarType, dtype: None = ..., /) -> ndarray[Any, _dtype[_ScalarType]]: ...
     @overload
     def __array__(self, dtype: _DType, /) -> ndarray[Any, _DType]: ...
+    def __hash__(self) -> int: ...
     @property
     def base(self) -> None: ...
     @property
@@ -2569,6 +2575,9 @@ class generic(_ArrayOrScalarCommon):
     @property
     def flat(self: _ScalarType) -> flatiter[ndarray[Any, _dtype[_ScalarType]]]: ...
 
+    if sys.version_info >= (3, 12):
+        def __buffer__(self, flags: int, /) -> memoryview: ...
+
     @overload
     def astype(
         self,
@@ -2771,6 +2780,9 @@ class object_(generic):
     def __float__(self) -> float: ...
     def __complex__(self) -> complex: ...
 
+    if sys.version_info >= (3, 12):
+        def __release_buffer__(self, buffer: memoryview, /) -> None: ...
+
 # The `datetime64` constructors requires an object with the three attributes below,
 # and thus supports datetime duck typing
 class _DatetimeScalar(Protocol):

+ 99 - 0
contrib/python/numpy/py3/numpy/_build_utils/gitversion.py

@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+import os
+import textwrap
+
+
+def init_version():
+    init = os.path.join(os.path.dirname(__file__), '../../pyproject.toml')
+    with open(init) as fid:
+        data = fid.readlines()
+
+    version_line = next(
+        line for line in data if line.startswith('version =')
+    )
+
+    version = version_line.strip().split(' = ')[1]
+    version = version.replace('"', '').replace("'", '')
+
+    return version
+
+
+def git_version(version):
+    # Append last commit date and hash to dev version information,
+    # if available
+
+    import subprocess
+    import os.path
+
+    git_hash = ''
+    try:
+        p = subprocess.Popen(
+            ['git', 'log', '-1', '--format="%H %aI"'],
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            cwd=os.path.dirname(__file__),
+        )
+    except FileNotFoundError:
+        pass
+    else:
+        out, err = p.communicate()
+        if p.returncode == 0:
+            git_hash, git_date = (
+                out.decode('utf-8')
+                .strip()
+                .replace('"', '')
+                .split('T')[0]
+                .replace('-', '')
+                .split()
+            )
+
+            # Only attach git tag to development versions
+            if 'dev' in version:
+                version += f'+git{git_date}.{git_hash[:7]}'
+
+    return version, git_hash
+
+
+if __name__ == "__main__":
+    import argparse
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--write', help="Save version to this file")
+    parser.add_argument(
+        '--meson-dist',
+        help='Output path is relative to MESON_DIST_ROOT',
+        action='store_true'
+    )
+    args = parser.parse_args()
+
+    version, git_hash = git_version(init_version())
+
+    # For NumPy 2.0, this should only have one field: `version`
+    template = textwrap.dedent(f'''
+        version = "{version}"
+        __version__ = version
+        full_version = version
+
+        git_revision = "{git_hash}"
+        release = 'dev' not in version and '+' not in version
+        short_version = version.split("+")[0]
+    ''')
+
+    if args.write:
+        outfile = args.write
+        if args.meson_dist:
+            outfile = os.path.join(
+                os.environ.get('MESON_DIST_ROOT', ''),
+                outfile
+            )
+
+        # Print human readable output path
+        relpath = os.path.relpath(outfile)
+        if relpath.startswith('.'):
+            relpath = outfile
+
+        with open(outfile, 'w') as f:
+            print(f'Saving version to {relpath}')
+            f.write(template)
+    else:
+        print(version)

+ 4 - 0
contrib/python/numpy/py3/numpy/_build_utils/tempita.py

@@ -0,0 +1,4 @@
+"""
+This private module only contains stubs for interoperability with
+NumPy 2.0 pickled arrays. It may not be used by the end user.
+"""

Некоторые файлы не были показаны из-за большого количества измененных файлов