Instructions to use sswayam/bt-momentum-engine with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use sswayam/bt-momentum-engine with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://sswayam/bt-momentum-engine") - Notebooks
- Google Colab
- Kaggle
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/DELVEWHEEL +2 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/INSTALLER +1 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/LICENSE.txt +971 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/METADATA +1092 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/RECORD +0 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/REQUESTED +0 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/WHEEL +4 -0
- .venv311/Lib/site-packages/numpy-1.26.4.dist-info/entry_points.txt +9 -0
- .venv311/Lib/site-packages/numpy/_core/__init__.py +4 -0
- .venv311/Lib/site-packages/numpy/_core/__init__.pyi +0 -0
- .venv311/Lib/site-packages/numpy/_core/_dtype.py +6 -0
- .venv311/Lib/site-packages/numpy/_core/_dtype_ctypes.py +6 -0
- .venv311/Lib/site-packages/numpy/_core/_internal.py +6 -0
- .venv311/Lib/site-packages/numpy/_core/_multiarray_umath.py +6 -0
- .venv311/Lib/site-packages/numpy/_core/multiarray.py +6 -0
- .venv311/Lib/site-packages/numpy/_core/umath.py +6 -0
- .venv311/Lib/site-packages/numpy/_pyinstaller/__init__.py +0 -0
- .venv311/Lib/site-packages/numpy/_pyinstaller/hook-numpy.py +37 -0
- .venv311/Lib/site-packages/numpy/_pyinstaller/pyinstaller-smoke.py +32 -0
- .venv311/Lib/site-packages/numpy/_pyinstaller/test_pyinstaller.py +35 -0
- .venv311/Lib/site-packages/numpy/_typing/__init__.py +221 -0
- .venv311/Lib/site-packages/numpy/_typing/_add_docstring.py +152 -0
- .venv311/Lib/site-packages/numpy/_typing/_array_like.py +167 -0
- .venv311/Lib/site-packages/numpy/_typing/_callable.pyi +338 -0
- .venv311/Lib/site-packages/numpy/_typing/_char_codes.py +111 -0
- .venv311/Lib/site-packages/numpy/_typing/_dtype_like.py +246 -0
- .venv311/Lib/site-packages/numpy/_typing/_extended_precision.py +27 -0
- .venv311/Lib/site-packages/numpy/_typing/_nbit.py +16 -0
- .venv311/Lib/site-packages/numpy/_typing/_nested_sequence.py +86 -0
- .venv311/Lib/site-packages/numpy/_typing/_scalars.py +30 -0
- .venv311/Lib/site-packages/numpy/_typing/_shape.py +7 -0
- .venv311/Lib/site-packages/numpy/_typing/_ufunc.pyi +445 -0
- .venv311/Lib/site-packages/numpy/_typing/setup.py +10 -0
- .venv311/Lib/site-packages/numpy/_utils/__init__.py +29 -0
- .venv311/Lib/site-packages/numpy/_utils/_convertions.py +18 -0
- .venv311/Lib/site-packages/numpy/_utils/_inspect.py +191 -0
- .venv311/Lib/site-packages/numpy/_utils/_pep440.py +487 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512bw_mask.c +18 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512dq_mask.c +16 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512f_reduce.c +41 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx3_half_double.c +12 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx4_mma.c +21 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx_asm.c +36 -0
- .venv311/Lib/site-packages/numpy/distutils/checks/test_flags.c +1 -0
- .venv311/Lib/site-packages/numpy/distutils/command/__init__.py +41 -0
- .venv311/Lib/site-packages/numpy/distutils/command/autodist.py +148 -0
- .venv311/Lib/site-packages/numpy/distutils/command/bdist_rpm.py +22 -0
- .venv311/Lib/site-packages/numpy/distutils/command/build.py +62 -0
- .venv311/Lib/site-packages/numpy/distutils/command/build_clib.py +469 -0
- .venv311/Lib/site-packages/numpy/distutils/command/build_ext.py +752 -0
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/DELVEWHEEL
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Version: 1.5.2
|
| 2 |
+
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-j442zwj6\\cp311-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '--add-path', 'C:/opt/openblas/openblas_dll', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-j442zwj6\\cp311-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-j442zwj6\\cp311-win_amd64\\built_wheel\\numpy-1.26.4-cp311-cp311-win_amd64.whl']
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/LICENSE.txt
ADDED
|
@@ -0,0 +1,971 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2005-2023, NumPy Developers.
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions are
|
| 6 |
+
met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
|
| 11 |
+
* Redistributions in binary form must reproduce the above
|
| 12 |
+
copyright notice, this list of conditions and the following
|
| 13 |
+
disclaimer in the documentation and/or other materials provided
|
| 14 |
+
with the distribution.
|
| 15 |
+
|
| 16 |
+
* Neither the name of the NumPy Developers nor the names of any
|
| 17 |
+
contributors may be used to endorse or promote products derived
|
| 18 |
+
from this software without specific prior written permission.
|
| 19 |
+
|
| 20 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 21 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 22 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 23 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 24 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 25 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 26 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 27 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 28 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 29 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 30 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
|
| 32 |
+
----
|
| 33 |
+
|
| 34 |
+
The NumPy repository and source distributions bundle several libraries that are
|
| 35 |
+
compatibly licensed. We list these here.
|
| 36 |
+
|
| 37 |
+
Name: lapack-lite
|
| 38 |
+
Files: numpy/linalg/lapack_lite/*
|
| 39 |
+
License: BSD-3-Clause
|
| 40 |
+
For details, see numpy/linalg/lapack_lite/LICENSE.txt
|
| 41 |
+
|
| 42 |
+
Name: tempita
|
| 43 |
+
Files: tools/npy_tempita/*
|
| 44 |
+
License: MIT
|
| 45 |
+
For details, see tools/npy_tempita/license.txt
|
| 46 |
+
|
| 47 |
+
Name: dragon4
|
| 48 |
+
Files: numpy/core/src/multiarray/dragon4.c
|
| 49 |
+
License: MIT
|
| 50 |
+
For license text, see numpy/core/src/multiarray/dragon4.c
|
| 51 |
+
|
| 52 |
+
Name: libdivide
|
| 53 |
+
Files: numpy/core/include/numpy/libdivide/*
|
| 54 |
+
License: Zlib
|
| 55 |
+
For license text, see numpy/core/include/numpy/libdivide/LICENSE.txt
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
Note that the following files are vendored in the repository and sdist but not
|
| 59 |
+
installed in built numpy packages:
|
| 60 |
+
|
| 61 |
+
Name: Meson
|
| 62 |
+
Files: vendored-meson/meson/*
|
| 63 |
+
License: Apache 2.0
|
| 64 |
+
For license text, see vendored-meson/meson/COPYING
|
| 65 |
+
|
| 66 |
+
Name: spin
|
| 67 |
+
Files: .spin/cmds.py
|
| 68 |
+
License: BSD-3
|
| 69 |
+
For license text, see .spin/LICENSE
|
| 70 |
+
|
| 71 |
+
----
|
| 72 |
+
|
| 73 |
+
This binary distribution of NumPy also bundles the following software:
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
Name: OpenBLAS
|
| 77 |
+
Files: numpy.libs\libopenblas*.dll
|
| 78 |
+
Description: bundled as a dynamically linked library
|
| 79 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 80 |
+
License: BSD-3-Clause
|
| 81 |
+
Copyright (c) 2011-2014, The OpenBLAS Project
|
| 82 |
+
All rights reserved.
|
| 83 |
+
|
| 84 |
+
Redistribution and use in source and binary forms, with or without
|
| 85 |
+
modification, are permitted provided that the following conditions are
|
| 86 |
+
met:
|
| 87 |
+
|
| 88 |
+
1. Redistributions of source code must retain the above copyright
|
| 89 |
+
notice, this list of conditions and the following disclaimer.
|
| 90 |
+
|
| 91 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 92 |
+
notice, this list of conditions and the following disclaimer in
|
| 93 |
+
the documentation and/or other materials provided with the
|
| 94 |
+
distribution.
|
| 95 |
+
3. Neither the name of the OpenBLAS project nor the names of
|
| 96 |
+
its contributors may be used to endorse or promote products
|
| 97 |
+
derived from this software without specific prior written
|
| 98 |
+
permission.
|
| 99 |
+
|
| 100 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 101 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 102 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 103 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
| 104 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 105 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 106 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 107 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 108 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
| 109 |
+
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
Name: LAPACK
|
| 113 |
+
Files: numpy.libs\libopenblas*.dll
|
| 114 |
+
Description: bundled in OpenBLAS
|
| 115 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 116 |
+
License: BSD-3-Clause-Attribution
|
| 117 |
+
Copyright (c) 1992-2013 The University of Tennessee and The University
|
| 118 |
+
of Tennessee Research Foundation. All rights
|
| 119 |
+
reserved.
|
| 120 |
+
Copyright (c) 2000-2013 The University of California Berkeley. All
|
| 121 |
+
rights reserved.
|
| 122 |
+
Copyright (c) 2006-2013 The University of Colorado Denver. All rights
|
| 123 |
+
reserved.
|
| 124 |
+
|
| 125 |
+
$COPYRIGHT$
|
| 126 |
+
|
| 127 |
+
Additional copyrights may follow
|
| 128 |
+
|
| 129 |
+
$HEADER$
|
| 130 |
+
|
| 131 |
+
Redistribution and use in source and binary forms, with or without
|
| 132 |
+
modification, are permitted provided that the following conditions are
|
| 133 |
+
met:
|
| 134 |
+
|
| 135 |
+
- Redistributions of source code must retain the above copyright
|
| 136 |
+
notice, this list of conditions and the following disclaimer.
|
| 137 |
+
|
| 138 |
+
- Redistributions in binary form must reproduce the above copyright
|
| 139 |
+
notice, this list of conditions and the following disclaimer listed
|
| 140 |
+
in this license in the documentation and/or other materials
|
| 141 |
+
provided with the distribution.
|
| 142 |
+
|
| 143 |
+
- Neither the name of the copyright holders nor the names of its
|
| 144 |
+
contributors may be used to endorse or promote products derived from
|
| 145 |
+
this software without specific prior written permission.
|
| 146 |
+
|
| 147 |
+
The copyright holders provide no reassurances that the source code
|
| 148 |
+
provided does not infringe any patent, copyright, or any other
|
| 149 |
+
intellectual property rights of third parties. The copyright holders
|
| 150 |
+
disclaim any liability to any recipient for claims brought against
|
| 151 |
+
recipient by any third party for infringement of that parties
|
| 152 |
+
intellectual property rights.
|
| 153 |
+
|
| 154 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 155 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 156 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 157 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 158 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 159 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 160 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 161 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 162 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 163 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 164 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
Name: GCC runtime library
|
| 168 |
+
Files: numpy.libs\libopenblas*.dll
|
| 169 |
+
Description: statically linked to files compiled with gcc
|
| 170 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libgfortran
|
| 171 |
+
License: GPL-3.0-with-GCC-exception
|
| 172 |
+
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
| 173 |
+
|
| 174 |
+
Libgfortran is free software; you can redistribute it and/or modify
|
| 175 |
+
it under the terms of the GNU General Public License as published by
|
| 176 |
+
the Free Software Foundation; either version 3, or (at your option)
|
| 177 |
+
any later version.
|
| 178 |
+
|
| 179 |
+
Libgfortran is distributed in the hope that it will be useful,
|
| 180 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 181 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 182 |
+
GNU General Public License for more details.
|
| 183 |
+
|
| 184 |
+
Under Section 7 of GPL version 3, you are granted additional
|
| 185 |
+
permissions described in the GCC Runtime Library Exception, version
|
| 186 |
+
3.1, as published by the Free Software Foundation.
|
| 187 |
+
|
| 188 |
+
You should have received a copy of the GNU General Public License and
|
| 189 |
+
a copy of the GCC Runtime Library Exception along with this program;
|
| 190 |
+
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 191 |
+
<http://www.gnu.org/licenses/>.
|
| 192 |
+
|
| 193 |
+
----
|
| 194 |
+
|
| 195 |
+
Full text of license texts referred to above follows (that they are
|
| 196 |
+
listed below does not necessarily imply the conditions apply to the
|
| 197 |
+
present binary release):
|
| 198 |
+
|
| 199 |
+
----
|
| 200 |
+
|
| 201 |
+
GCC RUNTIME LIBRARY EXCEPTION
|
| 202 |
+
|
| 203 |
+
Version 3.1, 31 March 2009
|
| 204 |
+
|
| 205 |
+
Copyright (C) 2009 Free Software Foundation, Inc. <http://fsf.org/>
|
| 206 |
+
|
| 207 |
+
Everyone is permitted to copy and distribute verbatim copies of this
|
| 208 |
+
license document, but changing it is not allowed.
|
| 209 |
+
|
| 210 |
+
This GCC Runtime Library Exception ("Exception") is an additional
|
| 211 |
+
permission under section 7 of the GNU General Public License, version
|
| 212 |
+
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
|
| 213 |
+
bears a notice placed by the copyright holder of the file stating that
|
| 214 |
+
the file is governed by GPLv3 along with this Exception.
|
| 215 |
+
|
| 216 |
+
When you use GCC to compile a program, GCC may combine portions of
|
| 217 |
+
certain GCC header files and runtime libraries with the compiled
|
| 218 |
+
program. The purpose of this Exception is to allow compilation of
|
| 219 |
+
non-GPL (including proprietary) programs to use, in this way, the
|
| 220 |
+
header files and runtime libraries covered by this Exception.
|
| 221 |
+
|
| 222 |
+
0. Definitions.
|
| 223 |
+
|
| 224 |
+
A file is an "Independent Module" if it either requires the Runtime
|
| 225 |
+
Library for execution after a Compilation Process, or makes use of an
|
| 226 |
+
interface provided by the Runtime Library, but is not otherwise based
|
| 227 |
+
on the Runtime Library.
|
| 228 |
+
|
| 229 |
+
"GCC" means a version of the GNU Compiler Collection, with or without
|
| 230 |
+
modifications, governed by version 3 (or a specified later version) of
|
| 231 |
+
the GNU General Public License (GPL) with the option of using any
|
| 232 |
+
subsequent versions published by the FSF.
|
| 233 |
+
|
| 234 |
+
"GPL-compatible Software" is software whose conditions of propagation,
|
| 235 |
+
modification and use would permit combination with GCC in accord with
|
| 236 |
+
the license of GCC.
|
| 237 |
+
|
| 238 |
+
"Target Code" refers to output from any compiler for a real or virtual
|
| 239 |
+
target processor architecture, in executable form or suitable for
|
| 240 |
+
input to an assembler, loader, linker and/or execution
|
| 241 |
+
phase. Notwithstanding that, Target Code does not include data in any
|
| 242 |
+
format that is used as a compiler intermediate representation, or used
|
| 243 |
+
for producing a compiler intermediate representation.
|
| 244 |
+
|
| 245 |
+
The "Compilation Process" transforms code entirely represented in
|
| 246 |
+
non-intermediate languages designed for human-written code, and/or in
|
| 247 |
+
Java Virtual Machine byte code, into Target Code. Thus, for example,
|
| 248 |
+
use of source code generators and preprocessors need not be considered
|
| 249 |
+
part of the Compilation Process, since the Compilation Process can be
|
| 250 |
+
understood as starting with the output of the generators or
|
| 251 |
+
preprocessors.
|
| 252 |
+
|
| 253 |
+
A Compilation Process is "Eligible" if it is done using GCC, alone or
|
| 254 |
+
with other GPL-compatible software, or if it is done without using any
|
| 255 |
+
work based on GCC. For example, using non-GPL-compatible Software to
|
| 256 |
+
optimize any GCC intermediate representations would not qualify as an
|
| 257 |
+
Eligible Compilation Process.
|
| 258 |
+
|
| 259 |
+
1. Grant of Additional Permission.
|
| 260 |
+
|
| 261 |
+
You have permission to propagate a work of Target Code formed by
|
| 262 |
+
combining the Runtime Library with Independent Modules, even if such
|
| 263 |
+
propagation would otherwise violate the terms of GPLv3, provided that
|
| 264 |
+
all Target Code was generated by Eligible Compilation Processes. You
|
| 265 |
+
may then convey such a combination under terms of your choice,
|
| 266 |
+
consistent with the licensing of the Independent Modules.
|
| 267 |
+
|
| 268 |
+
2. No Weakening of GCC Copyleft.
|
| 269 |
+
|
| 270 |
+
The availability of this Exception does not imply any general
|
| 271 |
+
presumption that third-party software is unaffected by the copyleft
|
| 272 |
+
requirements of the license of GCC.
|
| 273 |
+
|
| 274 |
+
----
|
| 275 |
+
|
| 276 |
+
GNU GENERAL PUBLIC LICENSE
|
| 277 |
+
Version 3, 29 June 2007
|
| 278 |
+
|
| 279 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
| 280 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 281 |
+
of this license document, but changing it is not allowed.
|
| 282 |
+
|
| 283 |
+
Preamble
|
| 284 |
+
|
| 285 |
+
The GNU General Public License is a free, copyleft license for
|
| 286 |
+
software and other kinds of works.
|
| 287 |
+
|
| 288 |
+
The licenses for most software and other practical works are designed
|
| 289 |
+
to take away your freedom to share and change the works. By contrast,
|
| 290 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 291 |
+
share and change all versions of a program--to make sure it remains free
|
| 292 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 293 |
+
GNU General Public License for most of our software; it applies also to
|
| 294 |
+
any other work released this way by its authors. You can apply it to
|
| 295 |
+
your programs, too.
|
| 296 |
+
|
| 297 |
+
When we speak of free software, we are referring to freedom, not
|
| 298 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 299 |
+
have the freedom to distribute copies of free software (and charge for
|
| 300 |
+
them if you wish), that you receive source code or can get it if you
|
| 301 |
+
want it, that you can change the software or use pieces of it in new
|
| 302 |
+
free programs, and that you know you can do these things.
|
| 303 |
+
|
| 304 |
+
To protect your rights, we need to prevent others from denying you
|
| 305 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 306 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 307 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 308 |
+
|
| 309 |
+
For example, if you distribute copies of such a program, whether
|
| 310 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 311 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 312 |
+
or can get the source code. And you must show them these terms so they
|
| 313 |
+
know their rights.
|
| 314 |
+
|
| 315 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 316 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 317 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 318 |
+
|
| 319 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 320 |
+
that there is no warranty for this free software. For both users' and
|
| 321 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 322 |
+
changed, so that their problems will not be attributed erroneously to
|
| 323 |
+
authors of previous versions.
|
| 324 |
+
|
| 325 |
+
Some devices are designed to deny users access to install or run
|
| 326 |
+
modified versions of the software inside them, although the manufacturer
|
| 327 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 328 |
+
protecting users' freedom to change the software. The systematic
|
| 329 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 330 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 331 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 332 |
+
products. If such problems arise substantially in other domains, we
|
| 333 |
+
stand ready to extend this provision to those domains in future versions
|
| 334 |
+
of the GPL, as needed to protect the freedom of users.
|
| 335 |
+
|
| 336 |
+
Finally, every program is threatened constantly by software patents.
|
| 337 |
+
States should not allow patents to restrict development and use of
|
| 338 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 339 |
+
avoid the special danger that patents applied to a free program could
|
| 340 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 341 |
+
patents cannot be used to render the program non-free.
|
| 342 |
+
|
| 343 |
+
The precise terms and conditions for copying, distribution and
|
| 344 |
+
modification follow.
|
| 345 |
+
|
| 346 |
+
TERMS AND CONDITIONS
|
| 347 |
+
|
| 348 |
+
0. Definitions.
|
| 349 |
+
|
| 350 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 351 |
+
|
| 352 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 353 |
+
works, such as semiconductor masks.
|
| 354 |
+
|
| 355 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 356 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 357 |
+
"recipients" may be individuals or organizations.
|
| 358 |
+
|
| 359 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 360 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 361 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 362 |
+
earlier work or a work "based on" the earlier work.
|
| 363 |
+
|
| 364 |
+
A "covered work" means either the unmodified Program or a work based
|
| 365 |
+
on the Program.
|
| 366 |
+
|
| 367 |
+
To "propagate" a work means to do anything with it that, without
|
| 368 |
+
permission, would make you directly or secondarily liable for
|
| 369 |
+
infringement under applicable copyright law, except executing it on a
|
| 370 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 371 |
+
distribution (with or without modification), making available to the
|
| 372 |
+
public, and in some countries other activities as well.
|
| 373 |
+
|
| 374 |
+
To "convey" a work means any kind of propagation that enables other
|
| 375 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 376 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 377 |
+
|
| 378 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 379 |
+
to the extent that it includes a convenient and prominently visible
|
| 380 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 381 |
+
tells the user that there is no warranty for the work (except to the
|
| 382 |
+
extent that warranties are provided), that licensees may convey the
|
| 383 |
+
work under this License, and how to view a copy of this License. If
|
| 384 |
+
the interface presents a list of user commands or options, such as a
|
| 385 |
+
menu, a prominent item in the list meets this criterion.
|
| 386 |
+
|
| 387 |
+
1. Source Code.
|
| 388 |
+
|
| 389 |
+
The "source code" for a work means the preferred form of the work
|
| 390 |
+
for making modifications to it. "Object code" means any non-source
|
| 391 |
+
form of a work.
|
| 392 |
+
|
| 393 |
+
A "Standard Interface" means an interface that either is an official
|
| 394 |
+
standard defined by a recognized standards body, or, in the case of
|
| 395 |
+
interfaces specified for a particular programming language, one that
|
| 396 |
+
is widely used among developers working in that language.
|
| 397 |
+
|
| 398 |
+
The "System Libraries" of an executable work include anything, other
|
| 399 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 400 |
+
packaging a Major Component, but which is not part of that Major
|
| 401 |
+
Component, and (b) serves only to enable use of the work with that
|
| 402 |
+
Major Component, or to implement a Standard Interface for which an
|
| 403 |
+
implementation is available to the public in source code form. A
|
| 404 |
+
"Major Component", in this context, means a major essential component
|
| 405 |
+
(kernel, window system, and so on) of the specific operating system
|
| 406 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 407 |
+
produce the work, or an object code interpreter used to run it.
|
| 408 |
+
|
| 409 |
+
The "Corresponding Source" for a work in object code form means all
|
| 410 |
+
the source code needed to generate, install, and (for an executable
|
| 411 |
+
work) run the object code and to modify the work, including scripts to
|
| 412 |
+
control those activities. However, it does not include the work's
|
| 413 |
+
System Libraries, or general-purpose tools or generally available free
|
| 414 |
+
programs which are used unmodified in performing those activities but
|
| 415 |
+
which are not part of the work. For example, Corresponding Source
|
| 416 |
+
includes interface definition files associated with source files for
|
| 417 |
+
the work, and the source code for shared libraries and dynamically
|
| 418 |
+
linked subprograms that the work is specifically designed to require,
|
| 419 |
+
such as by intimate data communication or control flow between those
|
| 420 |
+
subprograms and other parts of the work.
|
| 421 |
+
|
| 422 |
+
The Corresponding Source need not include anything that users
|
| 423 |
+
can regenerate automatically from other parts of the Corresponding
|
| 424 |
+
Source.
|
| 425 |
+
|
| 426 |
+
The Corresponding Source for a work in source code form is that
|
| 427 |
+
same work.
|
| 428 |
+
|
| 429 |
+
2. Basic Permissions.
|
| 430 |
+
|
| 431 |
+
All rights granted under this License are granted for the term of
|
| 432 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 433 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 434 |
+
permission to run the unmodified Program. The output from running a
|
| 435 |
+
covered work is covered by this License only if the output, given its
|
| 436 |
+
content, constitutes a covered work. This License acknowledges your
|
| 437 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 438 |
+
|
| 439 |
+
You may make, run and propagate covered works that you do not
|
| 440 |
+
convey, without conditions so long as your license otherwise remains
|
| 441 |
+
in force. You may convey covered works to others for the sole purpose
|
| 442 |
+
of having them make modifications exclusively for you, or provide you
|
| 443 |
+
with facilities for running those works, provided that you comply with
|
| 444 |
+
the terms of this License in conveying all material for which you do
|
| 445 |
+
not control copyright. Those thus making or running the covered works
|
| 446 |
+
for you must do so exclusively on your behalf, under your direction
|
| 447 |
+
and control, on terms that prohibit them from making any copies of
|
| 448 |
+
your copyrighted material outside their relationship with you.
|
| 449 |
+
|
| 450 |
+
Conveying under any other circumstances is permitted solely under
|
| 451 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 452 |
+
makes it unnecessary.
|
| 453 |
+
|
| 454 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 455 |
+
|
| 456 |
+
No covered work shall be deemed part of an effective technological
|
| 457 |
+
measure under any applicable law fulfilling obligations under article
|
| 458 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 459 |
+
similar laws prohibiting or restricting circumvention of such
|
| 460 |
+
measures.
|
| 461 |
+
|
| 462 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 463 |
+
circumvention of technological measures to the extent such circumvention
|
| 464 |
+
is effected by exercising rights under this License with respect to
|
| 465 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 466 |
+
modification of the work as a means of enforcing, against the work's
|
| 467 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 468 |
+
technological measures.
|
| 469 |
+
|
| 470 |
+
4. Conveying Verbatim Copies.
|
| 471 |
+
|
| 472 |
+
You may convey verbatim copies of the Program's source code as you
|
| 473 |
+
receive it, in any medium, provided that you conspicuously and
|
| 474 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 475 |
+
keep intact all notices stating that this License and any
|
| 476 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 477 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 478 |
+
recipients a copy of this License along with the Program.
|
| 479 |
+
|
| 480 |
+
You may charge any price or no price for each copy that you convey,
|
| 481 |
+
and you may offer support or warranty protection for a fee.
|
| 482 |
+
|
| 483 |
+
5. Conveying Modified Source Versions.
|
| 484 |
+
|
| 485 |
+
You may convey a work based on the Program, or the modifications to
|
| 486 |
+
produce it from the Program, in the form of source code under the
|
| 487 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 488 |
+
|
| 489 |
+
a) The work must carry prominent notices stating that you modified
|
| 490 |
+
it, and giving a relevant date.
|
| 491 |
+
|
| 492 |
+
b) The work must carry prominent notices stating that it is
|
| 493 |
+
released under this License and any conditions added under section
|
| 494 |
+
7. This requirement modifies the requirement in section 4 to
|
| 495 |
+
"keep intact all notices".
|
| 496 |
+
|
| 497 |
+
c) You must license the entire work, as a whole, under this
|
| 498 |
+
License to anyone who comes into possession of a copy. This
|
| 499 |
+
License will therefore apply, along with any applicable section 7
|
| 500 |
+
additional terms, to the whole of the work, and all its parts,
|
| 501 |
+
regardless of how they are packaged. This License gives no
|
| 502 |
+
permission to license the work in any other way, but it does not
|
| 503 |
+
invalidate such permission if you have separately received it.
|
| 504 |
+
|
| 505 |
+
d) If the work has interactive user interfaces, each must display
|
| 506 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 507 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 508 |
+
work need not make them do so.
|
| 509 |
+
|
| 510 |
+
A compilation of a covered work with other separate and independent
|
| 511 |
+
works, which are not by their nature extensions of the covered work,
|
| 512 |
+
and which are not combined with it such as to form a larger program,
|
| 513 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 514 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 515 |
+
used to limit the access or legal rights of the compilation's users
|
| 516 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 517 |
+
in an aggregate does not cause this License to apply to the other
|
| 518 |
+
parts of the aggregate.
|
| 519 |
+
|
| 520 |
+
6. Conveying Non-Source Forms.
|
| 521 |
+
|
| 522 |
+
You may convey a covered work in object code form under the terms
|
| 523 |
+
of sections 4 and 5, provided that you also convey the
|
| 524 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 525 |
+
in one of these ways:
|
| 526 |
+
|
| 527 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 528 |
+
(including a physical distribution medium), accompanied by the
|
| 529 |
+
Corresponding Source fixed on a durable physical medium
|
| 530 |
+
customarily used for software interchange.
|
| 531 |
+
|
| 532 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 533 |
+
(including a physical distribution medium), accompanied by a
|
| 534 |
+
written offer, valid for at least three years and valid for as
|
| 535 |
+
long as you offer spare parts or customer support for that product
|
| 536 |
+
model, to give anyone who possesses the object code either (1) a
|
| 537 |
+
copy of the Corresponding Source for all the software in the
|
| 538 |
+
product that is covered by this License, on a durable physical
|
| 539 |
+
medium customarily used for software interchange, for a price no
|
| 540 |
+
more than your reasonable cost of physically performing this
|
| 541 |
+
conveying of source, or (2) access to copy the
|
| 542 |
+
Corresponding Source from a network server at no charge.
|
| 543 |
+
|
| 544 |
+
c) Convey individual copies of the object code with a copy of the
|
| 545 |
+
written offer to provide the Corresponding Source. This
|
| 546 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 547 |
+
only if you received the object code with such an offer, in accord
|
| 548 |
+
with subsection 6b.
|
| 549 |
+
|
| 550 |
+
d) Convey the object code by offering access from a designated
|
| 551 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 552 |
+
Corresponding Source in the same way through the same place at no
|
| 553 |
+
further charge. You need not require recipients to copy the
|
| 554 |
+
Corresponding Source along with the object code. If the place to
|
| 555 |
+
copy the object code is a network server, the Corresponding Source
|
| 556 |
+
may be on a different server (operated by you or a third party)
|
| 557 |
+
that supports equivalent copying facilities, provided you maintain
|
| 558 |
+
clear directions next to the object code saying where to find the
|
| 559 |
+
Corresponding Source. Regardless of what server hosts the
|
| 560 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 561 |
+
available for as long as needed to satisfy these requirements.
|
| 562 |
+
|
| 563 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 564 |
+
you inform other peers where the object code and Corresponding
|
| 565 |
+
Source of the work are being offered to the general public at no
|
| 566 |
+
charge under subsection 6d.
|
| 567 |
+
|
| 568 |
+
A separable portion of the object code, whose source code is excluded
|
| 569 |
+
from the Corresponding Source as a System Library, need not be
|
| 570 |
+
included in conveying the object code work.
|
| 571 |
+
|
| 572 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 573 |
+
tangible personal property which is normally used for personal, family,
|
| 574 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 575 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 576 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 577 |
+
product received by a particular user, "normally used" refers to a
|
| 578 |
+
typical or common use of that class of product, regardless of the status
|
| 579 |
+
of the particular user or of the way in which the particular user
|
| 580 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 581 |
+
is a consumer product regardless of whether the product has substantial
|
| 582 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 583 |
+
the only significant mode of use of the product.
|
| 584 |
+
|
| 585 |
+
"Installation Information" for a User Product means any methods,
|
| 586 |
+
procedures, authorization keys, or other information required to install
|
| 587 |
+
and execute modified versions of a covered work in that User Product from
|
| 588 |
+
a modified version of its Corresponding Source. The information must
|
| 589 |
+
suffice to ensure that the continued functioning of the modified object
|
| 590 |
+
code is in no case prevented or interfered with solely because
|
| 591 |
+
modification has been made.
|
| 592 |
+
|
| 593 |
+
If you convey an object code work under this section in, or with, or
|
| 594 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 595 |
+
part of a transaction in which the right of possession and use of the
|
| 596 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 597 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 598 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 599 |
+
by the Installation Information. But this requirement does not apply
|
| 600 |
+
if neither you nor any third party retains the ability to install
|
| 601 |
+
modified object code on the User Product (for example, the work has
|
| 602 |
+
been installed in ROM).
|
| 603 |
+
|
| 604 |
+
The requirement to provide Installation Information does not include a
|
| 605 |
+
requirement to continue to provide support service, warranty, or updates
|
| 606 |
+
for a work that has been modified or installed by the recipient, or for
|
| 607 |
+
the User Product in which it has been modified or installed. Access to a
|
| 608 |
+
network may be denied when the modification itself materially and
|
| 609 |
+
adversely affects the operation of the network or violates the rules and
|
| 610 |
+
protocols for communication across the network.
|
| 611 |
+
|
| 612 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 613 |
+
in accord with this section must be in a format that is publicly
|
| 614 |
+
documented (and with an implementation available to the public in
|
| 615 |
+
source code form), and must require no special password or key for
|
| 616 |
+
unpacking, reading or copying.
|
| 617 |
+
|
| 618 |
+
7. Additional Terms.
|
| 619 |
+
|
| 620 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 621 |
+
License by making exceptions from one or more of its conditions.
|
| 622 |
+
Additional permissions that are applicable to the entire Program shall
|
| 623 |
+
be treated as though they were included in this License, to the extent
|
| 624 |
+
that they are valid under applicable law. If additional permissions
|
| 625 |
+
apply only to part of the Program, that part may be used separately
|
| 626 |
+
under those permissions, but the entire Program remains governed by
|
| 627 |
+
this License without regard to the additional permissions.
|
| 628 |
+
|
| 629 |
+
When you convey a copy of a covered work, you may at your option
|
| 630 |
+
remove any additional permissions from that copy, or from any part of
|
| 631 |
+
it. (Additional permissions may be written to require their own
|
| 632 |
+
removal in certain cases when you modify the work.) You may place
|
| 633 |
+
additional permissions on material, added by you to a covered work,
|
| 634 |
+
for which you have or can give appropriate copyright permission.
|
| 635 |
+
|
| 636 |
+
Notwithstanding any other provision of this License, for material you
|
| 637 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 638 |
+
that material) supplement the terms of this License with terms:
|
| 639 |
+
|
| 640 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 641 |
+
terms of sections 15 and 16 of this License; or
|
| 642 |
+
|
| 643 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 644 |
+
author attributions in that material or in the Appropriate Legal
|
| 645 |
+
Notices displayed by works containing it; or
|
| 646 |
+
|
| 647 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 648 |
+
requiring that modified versions of such material be marked in
|
| 649 |
+
reasonable ways as different from the original version; or
|
| 650 |
+
|
| 651 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 652 |
+
authors of the material; or
|
| 653 |
+
|
| 654 |
+
e) Declining to grant rights under trademark law for use of some
|
| 655 |
+
trade names, trademarks, or service marks; or
|
| 656 |
+
|
| 657 |
+
f) Requiring indemnification of licensors and authors of that
|
| 658 |
+
material by anyone who conveys the material (or modified versions of
|
| 659 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 660 |
+
any liability that these contractual assumptions directly impose on
|
| 661 |
+
those licensors and authors.
|
| 662 |
+
|
| 663 |
+
All other non-permissive additional terms are considered "further
|
| 664 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 665 |
+
received it, or any part of it, contains a notice stating that it is
|
| 666 |
+
governed by this License along with a term that is a further
|
| 667 |
+
restriction, you may remove that term. If a license document contains
|
| 668 |
+
a further restriction but permits relicensing or conveying under this
|
| 669 |
+
License, you may add to a covered work material governed by the terms
|
| 670 |
+
of that license document, provided that the further restriction does
|
| 671 |
+
not survive such relicensing or conveying.
|
| 672 |
+
|
| 673 |
+
If you add terms to a covered work in accord with this section, you
|
| 674 |
+
must place, in the relevant source files, a statement of the
|
| 675 |
+
additional terms that apply to those files, or a notice indicating
|
| 676 |
+
where to find the applicable terms.
|
| 677 |
+
|
| 678 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 679 |
+
form of a separately written license, or stated as exceptions;
|
| 680 |
+
the above requirements apply either way.
|
| 681 |
+
|
| 682 |
+
8. Termination.
|
| 683 |
+
|
| 684 |
+
You may not propagate or modify a covered work except as expressly
|
| 685 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 686 |
+
modify it is void, and will automatically terminate your rights under
|
| 687 |
+
this License (including any patent licenses granted under the third
|
| 688 |
+
paragraph of section 11).
|
| 689 |
+
|
| 690 |
+
However, if you cease all violation of this License, then your
|
| 691 |
+
license from a particular copyright holder is reinstated (a)
|
| 692 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 693 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 694 |
+
holder fails to notify you of the violation by some reasonable means
|
| 695 |
+
prior to 60 days after the cessation.
|
| 696 |
+
|
| 697 |
+
Moreover, your license from a particular copyright holder is
|
| 698 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 699 |
+
violation by some reasonable means, this is the first time you have
|
| 700 |
+
received notice of violation of this License (for any work) from that
|
| 701 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 702 |
+
your receipt of the notice.
|
| 703 |
+
|
| 704 |
+
Termination of your rights under this section does not terminate the
|
| 705 |
+
licenses of parties who have received copies or rights from you under
|
| 706 |
+
this License. If your rights have been terminated and not permanently
|
| 707 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 708 |
+
material under section 10.
|
| 709 |
+
|
| 710 |
+
9. Acceptance Not Required for Having Copies.
|
| 711 |
+
|
| 712 |
+
You are not required to accept this License in order to receive or
|
| 713 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 714 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 715 |
+
to receive a copy likewise does not require acceptance. However,
|
| 716 |
+
nothing other than this License grants you permission to propagate or
|
| 717 |
+
modify any covered work. These actions infringe copyright if you do
|
| 718 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 719 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 720 |
+
|
| 721 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 722 |
+
|
| 723 |
+
Each time you convey a covered work, the recipient automatically
|
| 724 |
+
receives a license from the original licensors, to run, modify and
|
| 725 |
+
propagate that work, subject to this License. You are not responsible
|
| 726 |
+
for enforcing compliance by third parties with this License.
|
| 727 |
+
|
| 728 |
+
An "entity transaction" is a transaction transferring control of an
|
| 729 |
+
organization, or substantially all assets of one, or subdividing an
|
| 730 |
+
organization, or merging organizations. If propagation of a covered
|
| 731 |
+
work results from an entity transaction, each party to that
|
| 732 |
+
transaction who receives a copy of the work also receives whatever
|
| 733 |
+
licenses to the work the party's predecessor in interest had or could
|
| 734 |
+
give under the previous paragraph, plus a right to possession of the
|
| 735 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 736 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 737 |
+
|
| 738 |
+
You may not impose any further restrictions on the exercise of the
|
| 739 |
+
rights granted or affirmed under this License. For example, you may
|
| 740 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 741 |
+
rights granted under this License, and you may not initiate litigation
|
| 742 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 743 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 744 |
+
sale, or importing the Program or any portion of it.
|
| 745 |
+
|
| 746 |
+
11. Patents.
|
| 747 |
+
|
| 748 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 749 |
+
License of the Program or a work on which the Program is based. The
|
| 750 |
+
work thus licensed is called the contributor's "contributor version".
|
| 751 |
+
|
| 752 |
+
A contributor's "essential patent claims" are all patent claims
|
| 753 |
+
owned or controlled by the contributor, whether already acquired or
|
| 754 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 755 |
+
by this License, of making, using, or selling its contributor version,
|
| 756 |
+
but do not include claims that would be infringed only as a
|
| 757 |
+
consequence of further modification of the contributor version. For
|
| 758 |
+
purposes of this definition, "control" includes the right to grant
|
| 759 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 760 |
+
this License.
|
| 761 |
+
|
| 762 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 763 |
+
patent license under the contributor's essential patent claims, to
|
| 764 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 765 |
+
propagate the contents of its contributor version.
|
| 766 |
+
|
| 767 |
+
In the following three paragraphs, a "patent license" is any express
|
| 768 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 769 |
+
(such as an express permission to practice a patent or covenant not to
|
| 770 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 771 |
+
party means to make such an agreement or commitment not to enforce a
|
| 772 |
+
patent against the party.
|
| 773 |
+
|
| 774 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 775 |
+
and the Corresponding Source of the work is not available for anyone
|
| 776 |
+
to copy, free of charge and under the terms of this License, through a
|
| 777 |
+
publicly available network server or other readily accessible means,
|
| 778 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 779 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 780 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 781 |
+
consistent with the requirements of this License, to extend the patent
|
| 782 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 783 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 784 |
+
covered work in a country, or your recipient's use of the covered work
|
| 785 |
+
in a country, would infringe one or more identifiable patents in that
|
| 786 |
+
country that you have reason to believe are valid.
|
| 787 |
+
|
| 788 |
+
If, pursuant to or in connection with a single transaction or
|
| 789 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 790 |
+
covered work, and grant a patent license to some of the parties
|
| 791 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 792 |
+
or convey a specific copy of the covered work, then the patent license
|
| 793 |
+
you grant is automatically extended to all recipients of the covered
|
| 794 |
+
work and works based on it.
|
| 795 |
+
|
| 796 |
+
A patent license is "discriminatory" if it does not include within
|
| 797 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 798 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 799 |
+
specifically granted under this License. You may not convey a covered
|
| 800 |
+
work if you are a party to an arrangement with a third party that is
|
| 801 |
+
in the business of distributing software, under which you make payment
|
| 802 |
+
to the third party based on the extent of your activity of conveying
|
| 803 |
+
the work, and under which the third party grants, to any of the
|
| 804 |
+
parties who would receive the covered work from you, a discriminatory
|
| 805 |
+
patent license (a) in connection with copies of the covered work
|
| 806 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 807 |
+
for and in connection with specific products or compilations that
|
| 808 |
+
contain the covered work, unless you entered into that arrangement,
|
| 809 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 810 |
+
|
| 811 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 812 |
+
any implied license or other defenses to infringement that may
|
| 813 |
+
otherwise be available to you under applicable patent law.
|
| 814 |
+
|
| 815 |
+
12. No Surrender of Others' Freedom.
|
| 816 |
+
|
| 817 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 818 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 819 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 820 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 821 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 822 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 823 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 824 |
+
the Program, the only way you could satisfy both those terms and this
|
| 825 |
+
License would be to refrain entirely from conveying the Program.
|
| 826 |
+
|
| 827 |
+
13. Use with the GNU Affero General Public License.
|
| 828 |
+
|
| 829 |
+
Notwithstanding any other provision of this License, you have
|
| 830 |
+
permission to link or combine any covered work with a work licensed
|
| 831 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 832 |
+
combined work, and to convey the resulting work. The terms of this
|
| 833 |
+
License will continue to apply to the part which is the covered work,
|
| 834 |
+
but the special requirements of the GNU Affero General Public License,
|
| 835 |
+
section 13, concerning interaction through a network will apply to the
|
| 836 |
+
combination as such.
|
| 837 |
+
|
| 838 |
+
14. Revised Versions of this License.
|
| 839 |
+
|
| 840 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 841 |
+
the GNU General Public License from time to time. Such new versions will
|
| 842 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 843 |
+
address new problems or concerns.
|
| 844 |
+
|
| 845 |
+
Each version is given a distinguishing version number. If the
|
| 846 |
+
Program specifies that a certain numbered version of the GNU General
|
| 847 |
+
Public License "or any later version" applies to it, you have the
|
| 848 |
+
option of following the terms and conditions either of that numbered
|
| 849 |
+
version or of any later version published by the Free Software
|
| 850 |
+
Foundation. If the Program does not specify a version number of the
|
| 851 |
+
GNU General Public License, you may choose any version ever published
|
| 852 |
+
by the Free Software Foundation.
|
| 853 |
+
|
| 854 |
+
If the Program specifies that a proxy can decide which future
|
| 855 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 856 |
+
public statement of acceptance of a version permanently authorizes you
|
| 857 |
+
to choose that version for the Program.
|
| 858 |
+
|
| 859 |
+
Later license versions may give you additional or different
|
| 860 |
+
permissions. However, no additional obligations are imposed on any
|
| 861 |
+
author or copyright holder as a result of your choosing to follow a
|
| 862 |
+
later version.
|
| 863 |
+
|
| 864 |
+
15. Disclaimer of Warranty.
|
| 865 |
+
|
| 866 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 867 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 868 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 869 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 870 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 871 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 872 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 873 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 874 |
+
|
| 875 |
+
16. Limitation of Liability.
|
| 876 |
+
|
| 877 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 878 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 879 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 880 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 881 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 882 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 883 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 884 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 885 |
+
SUCH DAMAGES.
|
| 886 |
+
|
| 887 |
+
17. Interpretation of Sections 15 and 16.
|
| 888 |
+
|
| 889 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 890 |
+
above cannot be given local legal effect according to their terms,
|
| 891 |
+
reviewing courts shall apply local law that most closely approximates
|
| 892 |
+
an absolute waiver of all civil liability in connection with the
|
| 893 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 894 |
+
copy of the Program in return for a fee.
|
| 895 |
+
|
| 896 |
+
END OF TERMS AND CONDITIONS
|
| 897 |
+
|
| 898 |
+
How to Apply These Terms to Your New Programs
|
| 899 |
+
|
| 900 |
+
If you develop a new program, and you want it to be of the greatest
|
| 901 |
+
possible use to the public, the best way to achieve this is to make it
|
| 902 |
+
free software which everyone can redistribute and change under these terms.
|
| 903 |
+
|
| 904 |
+
To do so, attach the following notices to the program. It is safest
|
| 905 |
+
to attach them to the start of each source file to most effectively
|
| 906 |
+
state the exclusion of warranty; and each file should have at least
|
| 907 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 908 |
+
|
| 909 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 910 |
+
Copyright (C) <year> <name of author>
|
| 911 |
+
|
| 912 |
+
This program is free software: you can redistribute it and/or modify
|
| 913 |
+
it under the terms of the GNU General Public License as published by
|
| 914 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 915 |
+
(at your option) any later version.
|
| 916 |
+
|
| 917 |
+
This program is distributed in the hope that it will be useful,
|
| 918 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 919 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 920 |
+
GNU General Public License for more details.
|
| 921 |
+
|
| 922 |
+
You should have received a copy of the GNU General Public License
|
| 923 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 924 |
+
|
| 925 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 926 |
+
|
| 927 |
+
If the program does terminal interaction, make it output a short
|
| 928 |
+
notice like this when it starts in an interactive mode:
|
| 929 |
+
|
| 930 |
+
<program> Copyright (C) <year> <name of author>
|
| 931 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 932 |
+
This is free software, and you are welcome to redistribute it
|
| 933 |
+
under certain conditions; type `show c' for details.
|
| 934 |
+
|
| 935 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 936 |
+
parts of the General Public License. Of course, your program's commands
|
| 937 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 938 |
+
|
| 939 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 940 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 941 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 942 |
+
<http://www.gnu.org/licenses/>.
|
| 943 |
+
|
| 944 |
+
The GNU General Public License does not permit incorporating your program
|
| 945 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 946 |
+
may consider it more useful to permit linking proprietary applications with
|
| 947 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 948 |
+
Public License instead of this License. But first, please read
|
| 949 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
| 950 |
+
|
| 951 |
+
Name: libquadmath
|
| 952 |
+
Files: numpy.libs\libopenb*.dll
|
| 953 |
+
Description: statically linked to files compiled with gcc
|
| 954 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libquadmath
|
| 955 |
+
License: LGPL-2.1-or-later
|
| 956 |
+
|
| 957 |
+
GCC Quad-Precision Math Library
|
| 958 |
+
Copyright (C) 2010-2019 Free Software Foundation, Inc.
|
| 959 |
+
Written by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
| 960 |
+
|
| 961 |
+
This file is part of the libquadmath library.
|
| 962 |
+
Libquadmath is free software; you can redistribute it and/or
|
| 963 |
+
modify it under the terms of the GNU Library General Public
|
| 964 |
+
License as published by the Free Software Foundation; either
|
| 965 |
+
version 2.1 of the License, or (at your option) any later version.
|
| 966 |
+
|
| 967 |
+
Libquadmath is distributed in the hope that it will be useful,
|
| 968 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 969 |
+
MERCHANTABILITY or FITNESS FOR A PARTICUL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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: numpy
|
| 3 |
+
Version: 1.26.4
|
| 4 |
+
Summary: Fundamental package for array computing in Python
|
| 5 |
+
Home-page: https://numpy.org
|
| 6 |
+
Author: Travis E. Oliphant et al.
|
| 7 |
+
Maintainer-Email: NumPy Developers <numpy-discussion@python.org>
|
| 8 |
+
License: Copyright (c) 2005-2023, NumPy Developers.
|
| 9 |
+
All rights reserved.
|
| 10 |
+
|
| 11 |
+
Redistribution and use in source and binary forms, with or without
|
| 12 |
+
modification, are permitted provided that the following conditions are
|
| 13 |
+
met:
|
| 14 |
+
|
| 15 |
+
* Redistributions of source code must retain the above copyright
|
| 16 |
+
notice, this list of conditions and the following disclaimer.
|
| 17 |
+
|
| 18 |
+
* Redistributions in binary form must reproduce the above
|
| 19 |
+
copyright notice, this list of conditions and the following
|
| 20 |
+
disclaimer in the documentation and/or other materials provided
|
| 21 |
+
with the distribution.
|
| 22 |
+
|
| 23 |
+
* Neither the name of the NumPy Developers nor the names of any
|
| 24 |
+
contributors may be used to endorse or promote products derived
|
| 25 |
+
from this software without specific prior written permission.
|
| 26 |
+
|
| 27 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 28 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 29 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 30 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 31 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 32 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 33 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 34 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 35 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 36 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 37 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 38 |
+
|
| 39 |
+
----
|
| 40 |
+
|
| 41 |
+
The NumPy repository and source distributions bundle several libraries that are
|
| 42 |
+
compatibly licensed. We list these here.
|
| 43 |
+
|
| 44 |
+
Name: lapack-lite
|
| 45 |
+
Files: numpy/linalg/lapack_lite/*
|
| 46 |
+
License: BSD-3-Clause
|
| 47 |
+
For details, see numpy/linalg/lapack_lite/LICENSE.txt
|
| 48 |
+
|
| 49 |
+
Name: tempita
|
| 50 |
+
Files: tools/npy_tempita/*
|
| 51 |
+
License: MIT
|
| 52 |
+
For details, see tools/npy_tempita/license.txt
|
| 53 |
+
|
| 54 |
+
Name: dragon4
|
| 55 |
+
Files: numpy/core/src/multiarray/dragon4.c
|
| 56 |
+
License: MIT
|
| 57 |
+
For license text, see numpy/core/src/multiarray/dragon4.c
|
| 58 |
+
|
| 59 |
+
Name: libdivide
|
| 60 |
+
Files: numpy/core/include/numpy/libdivide/*
|
| 61 |
+
License: Zlib
|
| 62 |
+
For license text, see numpy/core/include/numpy/libdivide/LICENSE.txt
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
Note that the following files are vendored in the repository and sdist but not
|
| 66 |
+
installed in built numpy packages:
|
| 67 |
+
|
| 68 |
+
Name: Meson
|
| 69 |
+
Files: vendored-meson/meson/*
|
| 70 |
+
License: Apache 2.0
|
| 71 |
+
For license text, see vendored-meson/meson/COPYING
|
| 72 |
+
|
| 73 |
+
Name: spin
|
| 74 |
+
Files: .spin/cmds.py
|
| 75 |
+
License: BSD-3
|
| 76 |
+
For license text, see .spin/LICENSE
|
| 77 |
+
|
| 78 |
+
----
|
| 79 |
+
|
| 80 |
+
This binary distribution of NumPy also bundles the following software:
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
Name: OpenBLAS
|
| 84 |
+
Files: numpy.libs\libopenblas*.dll
|
| 85 |
+
Description: bundled as a dynamically linked library
|
| 86 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 87 |
+
License: BSD-3-Clause
|
| 88 |
+
Copyright (c) 2011-2014, The OpenBLAS Project
|
| 89 |
+
All rights reserved.
|
| 90 |
+
|
| 91 |
+
Redistribution and use in source and binary forms, with or without
|
| 92 |
+
modification, are permitted provided that the following conditions are
|
| 93 |
+
met:
|
| 94 |
+
|
| 95 |
+
1. Redistributions of source code must retain the above copyright
|
| 96 |
+
notice, this list of conditions and the following disclaimer.
|
| 97 |
+
|
| 98 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 99 |
+
notice, this list of conditions and the following disclaimer in
|
| 100 |
+
the documentation and/or other materials provided with the
|
| 101 |
+
distribution.
|
| 102 |
+
3. Neither the name of the OpenBLAS project nor the names of
|
| 103 |
+
its contributors may be used to endorse or promote products
|
| 104 |
+
derived from this software without specific prior written
|
| 105 |
+
permission.
|
| 106 |
+
|
| 107 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 108 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 109 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 110 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
| 111 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 112 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 113 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 114 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 115 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
| 116 |
+
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
Name: LAPACK
|
| 120 |
+
Files: numpy.libs\libopenblas*.dll
|
| 121 |
+
Description: bundled in OpenBLAS
|
| 122 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 123 |
+
License: BSD-3-Clause-Attribution
|
| 124 |
+
Copyright (c) 1992-2013 The University of Tennessee and The University
|
| 125 |
+
of Tennessee Research Foundation. All rights
|
| 126 |
+
reserved.
|
| 127 |
+
Copyright (c) 2000-2013 The University of California Berkeley. All
|
| 128 |
+
rights reserved.
|
| 129 |
+
Copyright (c) 2006-2013 The University of Colorado Denver. All rights
|
| 130 |
+
reserved.
|
| 131 |
+
|
| 132 |
+
$COPYRIGHT$
|
| 133 |
+
|
| 134 |
+
Additional copyrights may follow
|
| 135 |
+
|
| 136 |
+
$HEADER$
|
| 137 |
+
|
| 138 |
+
Redistribution and use in source and binary forms, with or without
|
| 139 |
+
modification, are permitted provided that the following conditions are
|
| 140 |
+
met:
|
| 141 |
+
|
| 142 |
+
- Redistributions of source code must retain the above copyright
|
| 143 |
+
notice, this list of conditions and the following disclaimer.
|
| 144 |
+
|
| 145 |
+
- Redistributions in binary form must reproduce the above copyright
|
| 146 |
+
notice, this list of conditions and the following disclaimer listed
|
| 147 |
+
in this license in the documentation and/or other materials
|
| 148 |
+
provided with the distribution.
|
| 149 |
+
|
| 150 |
+
- Neither the name of the copyright holders nor the names of its
|
| 151 |
+
contributors may be used to endorse or promote products derived from
|
| 152 |
+
this software without specific prior written permission.
|
| 153 |
+
|
| 154 |
+
The copyright holders provide no reassurances that the source code
|
| 155 |
+
provided does not infringe any patent, copyright, or any other
|
| 156 |
+
intellectual property rights of third parties. The copyright holders
|
| 157 |
+
disclaim any liability to any recipient for claims brought against
|
| 158 |
+
recipient by any third party for infringement of that parties
|
| 159 |
+
intellectual property rights.
|
| 160 |
+
|
| 161 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 162 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 163 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 164 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 165 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 166 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 167 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 168 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 169 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 170 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 171 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
Name: GCC runtime library
|
| 175 |
+
Files: numpy.libs\libopenblas*.dll
|
| 176 |
+
Description: statically linked to files compiled with gcc
|
| 177 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libgfortran
|
| 178 |
+
License: GPL-3.0-with-GCC-exception
|
| 179 |
+
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
| 180 |
+
|
| 181 |
+
Libgfortran is free software; you can redistribute it and/or modify
|
| 182 |
+
it under the terms of the GNU General Public License as published by
|
| 183 |
+
the Free Software Foundation; either version 3, or (at your option)
|
| 184 |
+
any later version.
|
| 185 |
+
|
| 186 |
+
Libgfortran is distributed in the hope that it will be useful,
|
| 187 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 188 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 189 |
+
GNU General Public License for more details.
|
| 190 |
+
|
| 191 |
+
Under Section 7 of GPL version 3, you are granted additional
|
| 192 |
+
permissions described in the GCC Runtime Library Exception, version
|
| 193 |
+
3.1, as published by the Free Software Foundation.
|
| 194 |
+
|
| 195 |
+
You should have received a copy of the GNU General Public License and
|
| 196 |
+
a copy of the GCC Runtime Library Exception along with this program;
|
| 197 |
+
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 198 |
+
<http://www.gnu.org/licenses/>.
|
| 199 |
+
|
| 200 |
+
----
|
| 201 |
+
|
| 202 |
+
Full text of license texts referred to above follows (that they are
|
| 203 |
+
listed below does not necessarily imply the conditions apply to the
|
| 204 |
+
present binary release):
|
| 205 |
+
|
| 206 |
+
----
|
| 207 |
+
|
| 208 |
+
GCC RUNTIME LIBRARY EXCEPTION
|
| 209 |
+
|
| 210 |
+
Version 3.1, 31 March 2009
|
| 211 |
+
|
| 212 |
+
Copyright (C) 2009 Free Software Foundation, Inc. <http://fsf.org/>
|
| 213 |
+
|
| 214 |
+
Everyone is permitted to copy and distribute verbatim copies of this
|
| 215 |
+
license document, but changing it is not allowed.
|
| 216 |
+
|
| 217 |
+
This GCC Runtime Library Exception ("Exception") is an additional
|
| 218 |
+
permission under section 7 of the GNU General Public License, version
|
| 219 |
+
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
|
| 220 |
+
bears a notice placed by the copyright holder of the file stating that
|
| 221 |
+
the file is governed by GPLv3 along with this Exception.
|
| 222 |
+
|
| 223 |
+
When you use GCC to compile a program, GCC may combine portions of
|
| 224 |
+
certain GCC header files and runtime libraries with the compiled
|
| 225 |
+
program. The purpose of this Exception is to allow compilation of
|
| 226 |
+
non-GPL (including proprietary) programs to use, in this way, the
|
| 227 |
+
header files and runtime libraries covered by this Exception.
|
| 228 |
+
|
| 229 |
+
0. Definitions.
|
| 230 |
+
|
| 231 |
+
A file is an "Independent Module" if it either requires the Runtime
|
| 232 |
+
Library for execution after a Compilation Process, or makes use of an
|
| 233 |
+
interface provided by the Runtime Library, but is not otherwise based
|
| 234 |
+
on the Runtime Library.
|
| 235 |
+
|
| 236 |
+
"GCC" means a version of the GNU Compiler Collection, with or without
|
| 237 |
+
modifications, governed by version 3 (or a specified later version) of
|
| 238 |
+
the GNU General Public License (GPL) with the option of using any
|
| 239 |
+
subsequent versions published by the FSF.
|
| 240 |
+
|
| 241 |
+
"GPL-compatible Software" is software whose conditions of propagation,
|
| 242 |
+
modification and use would permit combination with GCC in accord with
|
| 243 |
+
the license of GCC.
|
| 244 |
+
|
| 245 |
+
"Target Code" refers to output from any compiler for a real or virtual
|
| 246 |
+
target processor architecture, in executable form or suitable for
|
| 247 |
+
input to an assembler, loader, linker and/or execution
|
| 248 |
+
phase. Notwithstanding that, Target Code does not include data in any
|
| 249 |
+
format that is used as a compiler intermediate representation, or used
|
| 250 |
+
for producing a compiler intermediate representation.
|
| 251 |
+
|
| 252 |
+
The "Compilation Process" transforms code entirely represented in
|
| 253 |
+
non-intermediate languages designed for human-written code, and/or in
|
| 254 |
+
Java Virtual Machine byte code, into Target Code. Thus, for example,
|
| 255 |
+
use of source code generators and preprocessors need not be considered
|
| 256 |
+
part of the Compilation Process, since the Compilation Process can be
|
| 257 |
+
understood as starting with the output of the generators or
|
| 258 |
+
preprocessors.
|
| 259 |
+
|
| 260 |
+
A Compilation Process is "Eligible" if it is done using GCC, alone or
|
| 261 |
+
with other GPL-compatible software, or if it is done without using any
|
| 262 |
+
work based on GCC. For example, using non-GPL-compatible Software to
|
| 263 |
+
optimize any GCC intermediate representations would not qualify as an
|
| 264 |
+
Eligible Compilation Process.
|
| 265 |
+
|
| 266 |
+
1. Grant of Additional Permission.
|
| 267 |
+
|
| 268 |
+
You have permission to propagate a work of Target Code formed by
|
| 269 |
+
combining the Runtime Library with Independent Modules, even if such
|
| 270 |
+
propagation would otherwise violate the terms of GPLv3, provided that
|
| 271 |
+
all Target Code was generated by Eligible Compilation Processes. You
|
| 272 |
+
may then convey such a combination under terms of your choice,
|
| 273 |
+
consistent with the licensing of the Independent Modules.
|
| 274 |
+
|
| 275 |
+
2. No Weakening of GCC Copyleft.
|
| 276 |
+
|
| 277 |
+
The availability of this Exception does not imply any general
|
| 278 |
+
presumption that third-party software is unaffected by the copyleft
|
| 279 |
+
requirements of the license of GCC.
|
| 280 |
+
|
| 281 |
+
----
|
| 282 |
+
|
| 283 |
+
GNU GENERAL PUBLIC LICENSE
|
| 284 |
+
Version 3, 29 June 2007
|
| 285 |
+
|
| 286 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
| 287 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 288 |
+
of this license document, but changing it is not allowed.
|
| 289 |
+
|
| 290 |
+
Preamble
|
| 291 |
+
|
| 292 |
+
The GNU General Public License is a free, copyleft license for
|
| 293 |
+
software and other kinds of works.
|
| 294 |
+
|
| 295 |
+
The licenses for most software and other practical works are designed
|
| 296 |
+
to take away your freedom to share and change the works. By contrast,
|
| 297 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 298 |
+
share and change all versions of a program--to make sure it remains free
|
| 299 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 300 |
+
GNU General Public License for most of our software; it applies also to
|
| 301 |
+
any other work released this way by its authors. You can apply it to
|
| 302 |
+
your programs, too.
|
| 303 |
+
|
| 304 |
+
When we speak of free software, we are referring to freedom, not
|
| 305 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 306 |
+
have the freedom to distribute copies of free software (and charge for
|
| 307 |
+
them if you wish), that you receive source code or can get it if you
|
| 308 |
+
want it, that you can change the software or use pieces of it in new
|
| 309 |
+
free programs, and that you know you can do these things.
|
| 310 |
+
|
| 311 |
+
To protect your rights, we need to prevent others from denying you
|
| 312 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 313 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 314 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 315 |
+
|
| 316 |
+
For example, if you distribute copies of such a program, whether
|
| 317 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 318 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 319 |
+
or can get the source code. And you must show them these terms so they
|
| 320 |
+
know their rights.
|
| 321 |
+
|
| 322 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 323 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 324 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 325 |
+
|
| 326 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 327 |
+
that there is no warranty for this free software. For both users' and
|
| 328 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 329 |
+
changed, so that their problems will not be attributed erroneously to
|
| 330 |
+
authors of previous versions.
|
| 331 |
+
|
| 332 |
+
Some devices are designed to deny users access to install or run
|
| 333 |
+
modified versions of the software inside them, although the manufacturer
|
| 334 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 335 |
+
protecting users' freedom to change the software. The systematic
|
| 336 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 337 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 338 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 339 |
+
products. If such problems arise substantially in other domains, we
|
| 340 |
+
stand ready to extend this provision to those domains in future versions
|
| 341 |
+
of the GPL, as needed to protect the freedom of users.
|
| 342 |
+
|
| 343 |
+
Finally, every program is threatened constantly by software patents.
|
| 344 |
+
States should not allow patents to restrict development and use of
|
| 345 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 346 |
+
avoid the special danger that patents applied to a free program could
|
| 347 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 348 |
+
patents cannot be used to render the program non-free.
|
| 349 |
+
|
| 350 |
+
The precise terms and conditions for copying, distribution and
|
| 351 |
+
modification follow.
|
| 352 |
+
|
| 353 |
+
TERMS AND CONDITIONS
|
| 354 |
+
|
| 355 |
+
0. Definitions.
|
| 356 |
+
|
| 357 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 358 |
+
|
| 359 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 360 |
+
works, such as semiconductor masks.
|
| 361 |
+
|
| 362 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 363 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 364 |
+
"recipients" may be individuals or organizations.
|
| 365 |
+
|
| 366 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 367 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 368 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 369 |
+
earlier work or a work "based on" the earlier work.
|
| 370 |
+
|
| 371 |
+
A "covered work" means either the unmodified Program or a work based
|
| 372 |
+
on the Program.
|
| 373 |
+
|
| 374 |
+
To "propagate" a work means to do anything with it that, without
|
| 375 |
+
permission, would make you directly or secondarily liable for
|
| 376 |
+
infringement under applicable copyright law, except executing it on a
|
| 377 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 378 |
+
distribution (with or without modification), making available to the
|
| 379 |
+
public, and in some countries other activities as well.
|
| 380 |
+
|
| 381 |
+
To "convey" a work means any kind of propagation that enables other
|
| 382 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 383 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 384 |
+
|
| 385 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 386 |
+
to the extent that it includes a convenient and prominently visible
|
| 387 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 388 |
+
tells the user that there is no warranty for the work (except to the
|
| 389 |
+
extent that warranties are provided), that licensees may convey the
|
| 390 |
+
work under this License, and how to view a copy of this License. If
|
| 391 |
+
the interface presents a list of user commands or options, such as a
|
| 392 |
+
menu, a prominent item in the list meets this criterion.
|
| 393 |
+
|
| 394 |
+
1. Source Code.
|
| 395 |
+
|
| 396 |
+
The "source code" for a work means the preferred form of the work
|
| 397 |
+
for making modifications to it. "Object code" means any non-source
|
| 398 |
+
form of a work.
|
| 399 |
+
|
| 400 |
+
A "Standard Interface" means an interface that either is an official
|
| 401 |
+
standard defined by a recognized standards body, or, in the case of
|
| 402 |
+
interfaces specified for a particular programming language, one that
|
| 403 |
+
is widely used among developers working in that language.
|
| 404 |
+
|
| 405 |
+
The "System Libraries" of an executable work include anything, other
|
| 406 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 407 |
+
packaging a Major Component, but which is not part of that Major
|
| 408 |
+
Component, and (b) serves only to enable use of the work with that
|
| 409 |
+
Major Component, or to implement a Standard Interface for which an
|
| 410 |
+
implementation is available to the public in source code form. A
|
| 411 |
+
"Major Component", in this context, means a major essential component
|
| 412 |
+
(kernel, window system, and so on) of the specific operating system
|
| 413 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 414 |
+
produce the work, or an object code interpreter used to run it.
|
| 415 |
+
|
| 416 |
+
The "Corresponding Source" for a work in object code form means all
|
| 417 |
+
the source code needed to generate, install, and (for an executable
|
| 418 |
+
work) run the object code and to modify the work, including scripts to
|
| 419 |
+
control those activities. However, it does not include the work's
|
| 420 |
+
System Libraries, or general-purpose tools or generally available free
|
| 421 |
+
programs which are used unmodified in performing those activities but
|
| 422 |
+
which are not part of the work. For example, Corresponding Source
|
| 423 |
+
includes interface definition files associated with source files for
|
| 424 |
+
the work, and the source code for shared libraries and dynamically
|
| 425 |
+
linked subprograms that the work is specifically designed to require,
|
| 426 |
+
such as by intimate data communication or control flow between those
|
| 427 |
+
subprograms and other parts of the work.
|
| 428 |
+
|
| 429 |
+
The Corresponding Source need not include anything that users
|
| 430 |
+
can regenerate automatically from other parts of the Corresponding
|
| 431 |
+
Source.
|
| 432 |
+
|
| 433 |
+
The Corresponding Source for a work in source code form is that
|
| 434 |
+
same work.
|
| 435 |
+
|
| 436 |
+
2. Basic Permissions.
|
| 437 |
+
|
| 438 |
+
All rights granted under this License are granted for the term of
|
| 439 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 440 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 441 |
+
permission to run the unmodified Program. The output from running a
|
| 442 |
+
covered work is covered by this License only if the output, given its
|
| 443 |
+
content, constitutes a covered work. This License acknowledges your
|
| 444 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 445 |
+
|
| 446 |
+
You may make, run and propagate covered works that you do not
|
| 447 |
+
convey, without conditions so long as your license otherwise remains
|
| 448 |
+
in force. You may convey covered works to others for the sole purpose
|
| 449 |
+
of having them make modifications exclusively for you, or provide you
|
| 450 |
+
with facilities for running those works, provided that you comply with
|
| 451 |
+
the terms of this License in conveying all material for which you do
|
| 452 |
+
not control copyright. Those thus making or running the covered works
|
| 453 |
+
for you must do so exclusively on your behalf, under your direction
|
| 454 |
+
and control, on terms that prohibit them from making any copies of
|
| 455 |
+
your copyrighted material outside their relationship with you.
|
| 456 |
+
|
| 457 |
+
Conveying under any other circumstances is permitted solely under
|
| 458 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 459 |
+
makes it unnecessary.
|
| 460 |
+
|
| 461 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 462 |
+
|
| 463 |
+
No covered work shall be deemed part of an effective technological
|
| 464 |
+
measure under any applicable law fulfilling obligations under article
|
| 465 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 466 |
+
similar laws prohibiting or restricting circumvention of such
|
| 467 |
+
measures.
|
| 468 |
+
|
| 469 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 470 |
+
circumvention of technological measures to the extent such circumvention
|
| 471 |
+
is effected by exercising rights under this License with respect to
|
| 472 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 473 |
+
modification of the work as a means of enforcing, against the work's
|
| 474 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 475 |
+
technological measures.
|
| 476 |
+
|
| 477 |
+
4. Conveying Verbatim Copies.
|
| 478 |
+
|
| 479 |
+
You may convey verbatim copies of the Program's source code as you
|
| 480 |
+
receive it, in any medium, provided that you conspicuously and
|
| 481 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 482 |
+
keep intact all notices stating that this License and any
|
| 483 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 484 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 485 |
+
recipients a copy of this License along with the Program.
|
| 486 |
+
|
| 487 |
+
You may charge any price or no price for each copy that you convey,
|
| 488 |
+
and you may offer support or warranty protection for a fee.
|
| 489 |
+
|
| 490 |
+
5. Conveying Modified Source Versions.
|
| 491 |
+
|
| 492 |
+
You may convey a work based on the Program, or the modifications to
|
| 493 |
+
produce it from the Program, in the form of source code under the
|
| 494 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 495 |
+
|
| 496 |
+
a) The work must carry prominent notices stating that you modified
|
| 497 |
+
it, and giving a relevant date.
|
| 498 |
+
|
| 499 |
+
b) The work must carry prominent notices stating that it is
|
| 500 |
+
released under this License and any conditions added under section
|
| 501 |
+
7. This requirement modifies the requirement in section 4 to
|
| 502 |
+
"keep intact all notices".
|
| 503 |
+
|
| 504 |
+
c) You must license the entire work, as a whole, under this
|
| 505 |
+
License to anyone who comes into possession of a copy. This
|
| 506 |
+
License will therefore apply, along with any applicable section 7
|
| 507 |
+
additional terms, to the whole of the work, and all its parts,
|
| 508 |
+
regardless of how they are packaged. This License gives no
|
| 509 |
+
permission to license the work in any other way, but it does not
|
| 510 |
+
invalidate such permission if you have separately received it.
|
| 511 |
+
|
| 512 |
+
d) If the work has interactive user interfaces, each must display
|
| 513 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 514 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 515 |
+
work need not make them do so.
|
| 516 |
+
|
| 517 |
+
A compilation of a covered work with other separate and independent
|
| 518 |
+
works, which are not by their nature extensions of the covered work,
|
| 519 |
+
and which are not combined with it such as to form a larger program,
|
| 520 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 521 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 522 |
+
used to limit the access or legal rights of the compilation's users
|
| 523 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 524 |
+
in an aggregate does not cause this License to apply to the other
|
| 525 |
+
parts of the aggregate.
|
| 526 |
+
|
| 527 |
+
6. Conveying Non-Source Forms.
|
| 528 |
+
|
| 529 |
+
You may convey a covered work in object code form under the terms
|
| 530 |
+
of sections 4 and 5, provided that you also convey the
|
| 531 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 532 |
+
in one of these ways:
|
| 533 |
+
|
| 534 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 535 |
+
(including a physical distribution medium), accompanied by the
|
| 536 |
+
Corresponding Source fixed on a durable physical medium
|
| 537 |
+
customarily used for software interchange.
|
| 538 |
+
|
| 539 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 540 |
+
(including a physical distribution medium), accompanied by a
|
| 541 |
+
written offer, valid for at least three years and valid for as
|
| 542 |
+
long as you offer spare parts or customer support for that product
|
| 543 |
+
model, to give anyone who possesses the object code either (1) a
|
| 544 |
+
copy of the Corresponding Source for all the software in the
|
| 545 |
+
product that is covered by this License, on a durable physical
|
| 546 |
+
medium customarily used for software interchange, for a price no
|
| 547 |
+
more than your reasonable cost of physically performing this
|
| 548 |
+
conveying of source, or (2) access to copy the
|
| 549 |
+
Corresponding Source from a network server at no charge.
|
| 550 |
+
|
| 551 |
+
c) Convey individual copies of the object code with a copy of the
|
| 552 |
+
written offer to provide the Corresponding Source. This
|
| 553 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 554 |
+
only if you received the object code with such an offer, in accord
|
| 555 |
+
with subsection 6b.
|
| 556 |
+
|
| 557 |
+
d) Convey the object code by offering access from a designated
|
| 558 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 559 |
+
Corresponding Source in the same way through the same place at no
|
| 560 |
+
further charge. You need not require recipients to copy the
|
| 561 |
+
Corresponding Source along with the object code. If the place to
|
| 562 |
+
copy the object code is a network server, the Corresponding Source
|
| 563 |
+
may be on a different server (operated by you or a third party)
|
| 564 |
+
that supports equivalent copying facilities, provided you maintain
|
| 565 |
+
clear directions next to the object code saying where to find the
|
| 566 |
+
Corresponding Source. Regardless of what server hosts the
|
| 567 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 568 |
+
available for as long as needed to satisfy these requirements.
|
| 569 |
+
|
| 570 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 571 |
+
you inform other peers where the object code and Corresponding
|
| 572 |
+
Source of the work are being offered to the general public at no
|
| 573 |
+
charge under subsection 6d.
|
| 574 |
+
|
| 575 |
+
A separable portion of the object code, whose source code is excluded
|
| 576 |
+
from the Corresponding Source as a System Library, need not be
|
| 577 |
+
included in conveying the object code work.
|
| 578 |
+
|
| 579 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 580 |
+
tangible personal property which is normally used for personal, family,
|
| 581 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 582 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 583 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 584 |
+
product received by a particular user, "normally used" refers to a
|
| 585 |
+
typical or common use of that class of product, regardless of the status
|
| 586 |
+
of the particular user or of the way in which the particular user
|
| 587 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 588 |
+
is a consumer product regardless of whether the product has substantial
|
| 589 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 590 |
+
the only significant mode of use of the product.
|
| 591 |
+
|
| 592 |
+
"Installation Information" for a User Product means any methods,
|
| 593 |
+
procedures, authorization keys, or other information required to install
|
| 594 |
+
and execute modified versions of a covered work in that User Product from
|
| 595 |
+
a modified version of its Corresponding Source. The information must
|
| 596 |
+
suffice to ensure that the continued functioning of the modified object
|
| 597 |
+
code is in no case prevented or interfered with solely because
|
| 598 |
+
modification has been made.
|
| 599 |
+
|
| 600 |
+
If you convey an object code work under this section in, or with, or
|
| 601 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 602 |
+
part of a transaction in which the right of possession and use of the
|
| 603 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 604 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 605 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 606 |
+
by the Installation Information. But this requirement does not apply
|
| 607 |
+
if neither you nor any third party retains the ability to install
|
| 608 |
+
modified object code on the User Product (for example, the work has
|
| 609 |
+
been installed in ROM).
|
| 610 |
+
|
| 611 |
+
The requirement to provide Installation Information does not include a
|
| 612 |
+
requirement to continue to provide support service, warranty, or updates
|
| 613 |
+
for a work that has been modified or installed by the recipient, or for
|
| 614 |
+
the User Product in which it has been modified or installed. Access to a
|
| 615 |
+
network may be denied when the modification itself materially and
|
| 616 |
+
adversely affects the operation of the network or violates the rules and
|
| 617 |
+
protocols for communication across the network.
|
| 618 |
+
|
| 619 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 620 |
+
in accord with this section must be in a format that is publicly
|
| 621 |
+
documented (and with an implementation available to the public in
|
| 622 |
+
source code form), and must require no special password or key for
|
| 623 |
+
unpacking, reading or copying.
|
| 624 |
+
|
| 625 |
+
7. Additional Terms.
|
| 626 |
+
|
| 627 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 628 |
+
License by making exceptions from one or more of its conditions.
|
| 629 |
+
Additional permissions that are applicable to the entire Program shall
|
| 630 |
+
be treated as though they were included in this License, to the extent
|
| 631 |
+
that they are valid under applicable law. If additional permissions
|
| 632 |
+
apply only to part of the Program, that part may be used separately
|
| 633 |
+
under those permissions, but the entire Program remains governed by
|
| 634 |
+
this License without regard to the additional permissions.
|
| 635 |
+
|
| 636 |
+
When you convey a copy of a covered work, you may at your option
|
| 637 |
+
remove any additional permissions from that copy, or from any part of
|
| 638 |
+
it. (Additional permissions may be written to require their own
|
| 639 |
+
removal in certain cases when you modify the work.) You may place
|
| 640 |
+
additional permissions on material, added by you to a covered work,
|
| 641 |
+
for which you have or can give appropriate copyright permission.
|
| 642 |
+
|
| 643 |
+
Notwithstanding any other provision of this License, for material you
|
| 644 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 645 |
+
that material) supplement the terms of this License with terms:
|
| 646 |
+
|
| 647 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 648 |
+
terms of sections 15 and 16 of this License; or
|
| 649 |
+
|
| 650 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 651 |
+
author attributions in that material or in the Appropriate Legal
|
| 652 |
+
Notices displayed by works containing it; or
|
| 653 |
+
|
| 654 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 655 |
+
requiring that modified versions of such material be marked in
|
| 656 |
+
reasonable ways as different from the original version; or
|
| 657 |
+
|
| 658 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 659 |
+
authors of the material; or
|
| 660 |
+
|
| 661 |
+
e) Declining to grant rights under trademark law for use of some
|
| 662 |
+
trade names, trademarks, or service marks; or
|
| 663 |
+
|
| 664 |
+
f) Requiring indemnification of licensors and authors of that
|
| 665 |
+
material by anyone who conveys the material (or modified versions of
|
| 666 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 667 |
+
any liability that these contractual assumptions directly impose on
|
| 668 |
+
those licensors and authors.
|
| 669 |
+
|
| 670 |
+
All other non-permissive additional terms are considered "further
|
| 671 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 672 |
+
received it, or any part of it, contains a notice stating that it is
|
| 673 |
+
governed by this License along with a term that is a further
|
| 674 |
+
restriction, you may remove that term. If a license document contains
|
| 675 |
+
a further restriction but permits relicensing or conveying under this
|
| 676 |
+
License, you may add to a covered work material governed by the terms
|
| 677 |
+
of that license document, provided that the further restriction does
|
| 678 |
+
not survive such relicensing or conveying.
|
| 679 |
+
|
| 680 |
+
If you add terms to a covered work in accord with this section, you
|
| 681 |
+
must place, in the relevant source files, a statement of the
|
| 682 |
+
additional terms that apply to those files, or a notice indicating
|
| 683 |
+
where to find the applicable terms.
|
| 684 |
+
|
| 685 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 686 |
+
form of a separately written license, or stated as exceptions;
|
| 687 |
+
the above requirements apply either way.
|
| 688 |
+
|
| 689 |
+
8. Termination.
|
| 690 |
+
|
| 691 |
+
You may not propagate or modify a covered work except as expressly
|
| 692 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 693 |
+
modify it is void, and will automatically terminate your rights under
|
| 694 |
+
this License (including any patent licenses granted under the third
|
| 695 |
+
paragraph of section 11).
|
| 696 |
+
|
| 697 |
+
However, if you cease all violation of this License, then your
|
| 698 |
+
license from a particular copyright holder is reinstated (a)
|
| 699 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 700 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 701 |
+
holder fails to notify you of the violation by some reasonable means
|
| 702 |
+
prior to 60 days after the cessation.
|
| 703 |
+
|
| 704 |
+
Moreover, your license from a particular copyright holder is
|
| 705 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 706 |
+
violation by some reasonable means, this is the first time you have
|
| 707 |
+
received notice of violation of this License (for any work) from that
|
| 708 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 709 |
+
your receipt of the notice.
|
| 710 |
+
|
| 711 |
+
Termination of your rights under this section does not terminate the
|
| 712 |
+
licenses of parties who have received copies or rights from you under
|
| 713 |
+
this License. If your rights have been terminated and not permanently
|
| 714 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 715 |
+
material under section 10.
|
| 716 |
+
|
| 717 |
+
9. Acceptance Not Required for Having Copies.
|
| 718 |
+
|
| 719 |
+
You are not required to accept this License in order to receive or
|
| 720 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 721 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 722 |
+
to receive a copy likewise does not require acceptance. However,
|
| 723 |
+
nothing other than this License grants you permission to propagate or
|
| 724 |
+
modify any covered work. These actions infringe copyright if you do
|
| 725 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 726 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 727 |
+
|
| 728 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 729 |
+
|
| 730 |
+
Each time you convey a covered work, the recipient automatically
|
| 731 |
+
receives a license from the original licensors, to run, modify and
|
| 732 |
+
propagate that work, subject to this License. You are not responsible
|
| 733 |
+
for enforcing compliance by third parties with this License.
|
| 734 |
+
|
| 735 |
+
An "entity transaction" is a transaction transferring control of an
|
| 736 |
+
organization, or substantially all assets of one, or subdividing an
|
| 737 |
+
organization, or merging organizations. If propagation of a covered
|
| 738 |
+
work results from an entity transaction, each party to that
|
| 739 |
+
transaction who receives a copy of the work also receives whatever
|
| 740 |
+
licenses to the work the party's predecessor in interest had or could
|
| 741 |
+
give under the previous paragraph, plus a right to possession of the
|
| 742 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 743 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 744 |
+
|
| 745 |
+
You may not impose any further restrictions on the exercise of the
|
| 746 |
+
rights granted or affirmed under this License. For example, you may
|
| 747 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 748 |
+
rights granted under this License, and you may not initiate litigation
|
| 749 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 750 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 751 |
+
sale, or importing the Program or any portion of it.
|
| 752 |
+
|
| 753 |
+
11. Patents.
|
| 754 |
+
|
| 755 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 756 |
+
License of the Program or a work on which the Program is based. The
|
| 757 |
+
work thus licensed is called the contributor's "contributor version".
|
| 758 |
+
|
| 759 |
+
A contributor's "essential patent claims" are all patent claims
|
| 760 |
+
owned or controlled by the contributor, whether already acquired or
|
| 761 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 762 |
+
by this License, of making, using, or selling its contributor version,
|
| 763 |
+
but do not include claims that would be infringed only as a
|
| 764 |
+
consequence of further modification of the contributor version. For
|
| 765 |
+
purposes of this definition, "control" includes the right to grant
|
| 766 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 767 |
+
this License.
|
| 768 |
+
|
| 769 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 770 |
+
patent license under the contributor's essential patent claims, to
|
| 771 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 772 |
+
propagate the contents of its contributor version.
|
| 773 |
+
|
| 774 |
+
In the following three paragraphs, a "patent license" is any express
|
| 775 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 776 |
+
(such as an express permission to practice a patent or covenant not to
|
| 777 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 778 |
+
party means to make such an agreement or commitment not to enforce a
|
| 779 |
+
patent against the party.
|
| 780 |
+
|
| 781 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 782 |
+
and the Corresponding Source of the work is not available for anyone
|
| 783 |
+
to copy, free of charge and under the terms of this License, through a
|
| 784 |
+
publicly available network server or other readily accessible means,
|
| 785 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 786 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 787 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 788 |
+
consistent with the requirements of this License, to extend the patent
|
| 789 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 790 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 791 |
+
covered work in a country, or your recipient's use of the covered work
|
| 792 |
+
in a country, would infringe one or more identifiable patents in that
|
| 793 |
+
country that you have reason to believe are valid.
|
| 794 |
+
|
| 795 |
+
If, pursuant to or in connection with a single transaction or
|
| 796 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 797 |
+
covered work, and grant a patent license to some of the parties
|
| 798 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 799 |
+
or convey a specific copy of the covered work, then the patent license
|
| 800 |
+
you grant is automatically extended to all recipients of the covered
|
| 801 |
+
work and works based on it.
|
| 802 |
+
|
| 803 |
+
A patent license is "discriminatory" if it does not include within
|
| 804 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 805 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 806 |
+
specifically granted under this License. You may not convey a covered
|
| 807 |
+
work if you are a party to an arrangement with a third party that is
|
| 808 |
+
in the business of distributing software, under which you make payment
|
| 809 |
+
to the third party based on the extent of your activity of conveying
|
| 810 |
+
the work, and under which the third party grants, to any of the
|
| 811 |
+
parties who would receive the covered work from you, a discriminatory
|
| 812 |
+
patent license (a) in connection with copies of the covered work
|
| 813 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 814 |
+
for and in connection with specific products or compilations that
|
| 815 |
+
contain the covered work, unless you entered into that arrangement,
|
| 816 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 817 |
+
|
| 818 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 819 |
+
any implied license or other defenses to infringement that may
|
| 820 |
+
otherwise be available to you under applicable patent law.
|
| 821 |
+
|
| 822 |
+
12. No Surrender of Others' Freedom.
|
| 823 |
+
|
| 824 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 825 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 826 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 827 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 828 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 829 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 830 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 831 |
+
the Program, the only way you could satisfy both those terms and this
|
| 832 |
+
License would be to refrain entirely from conveying the Program.
|
| 833 |
+
|
| 834 |
+
13. Use with the GNU Affero General Public License.
|
| 835 |
+
|
| 836 |
+
Notwithstanding any other provision of this License, you have
|
| 837 |
+
permission to link or combine any covered work with a work licensed
|
| 838 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 839 |
+
combined work, and to convey the resulting work. The terms of this
|
| 840 |
+
License will continue to apply to the part which is the covered work,
|
| 841 |
+
but the special requirements of the GNU Affero General Public License,
|
| 842 |
+
section 13, concerning interaction through a network will apply to the
|
| 843 |
+
combination as such.
|
| 844 |
+
|
| 845 |
+
14. Revised Versions of this License.
|
| 846 |
+
|
| 847 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 848 |
+
the GNU General Public License from time to time. Such new versions will
|
| 849 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 850 |
+
address new problems or concerns.
|
| 851 |
+
|
| 852 |
+
Each version is given a distinguishing version number. If the
|
| 853 |
+
Program specifies that a certain numbered version of the GNU General
|
| 854 |
+
Public License "or any later version" applies to it, you have the
|
| 855 |
+
option of following the terms and conditions either of that numbered
|
| 856 |
+
version or of any later version published by the Free Software
|
| 857 |
+
Foundation. If the Program does not specify a version number of the
|
| 858 |
+
GNU General Public License, you may choose any version ever published
|
| 859 |
+
by the Free Software Foundation.
|
| 860 |
+
|
| 861 |
+
If the Program specifies that a proxy can decide which future
|
| 862 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 863 |
+
public statement of acceptance of a version permanently authorizes you
|
| 864 |
+
to choose that version for the Program.
|
| 865 |
+
|
| 866 |
+
Later license versions may give you additional or different
|
| 867 |
+
permissions. However, no additional obligations are imposed on any
|
| 868 |
+
author or copyright holder as a result of your choosing to follow a
|
| 869 |
+
later version.
|
| 870 |
+
|
| 871 |
+
15. Disclaimer of Warranty.
|
| 872 |
+
|
| 873 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 874 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 875 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 876 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 877 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 878 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 879 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 880 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 881 |
+
|
| 882 |
+
16. Limitation of Liability.
|
| 883 |
+
|
| 884 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 885 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 886 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 887 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 888 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 889 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 890 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 891 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 892 |
+
SUCH DAMAGES.
|
| 893 |
+
|
| 894 |
+
17. Interpretation of Sections 15 and 16.
|
| 895 |
+
|
| 896 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 897 |
+
above cannot be given local legal effect according to their terms,
|
| 898 |
+
reviewing courts shall apply local law that most closely approximates
|
| 899 |
+
an absolute waiver of all civil liability in connection with the
|
| 900 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 901 |
+
copy of the Program in return for a fee.
|
| 902 |
+
|
| 903 |
+
END OF TERMS AND CONDITIONS
|
| 904 |
+
|
| 905 |
+
How to Apply These Terms to Your New Programs
|
| 906 |
+
|
| 907 |
+
If you develop a new program, and you want it to be of the greatest
|
| 908 |
+
possible use to the public, the best way to achieve this is to make it
|
| 909 |
+
free software which everyone can redistribute and change under these terms.
|
| 910 |
+
|
| 911 |
+
To do so, attach the following notices to the program. It is safest
|
| 912 |
+
to attach them to the start of each source file to most effectively
|
| 913 |
+
state the exclusion of warranty; and each file should have at least
|
| 914 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 915 |
+
|
| 916 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 917 |
+
Copyright (C) <year> <name of author>
|
| 918 |
+
|
| 919 |
+
This program is free software: you can redistribute it and/or modify
|
| 920 |
+
it under the terms of the GNU General Public License as published by
|
| 921 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 922 |
+
(at your option) any later version.
|
| 923 |
+
|
| 924 |
+
This program is distributed in the hope that it will be useful,
|
| 925 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 926 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 927 |
+
GNU General Public License for more details.
|
| 928 |
+
|
| 929 |
+
You should have received a copy of the GNU General Public License
|
| 930 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 931 |
+
|
| 932 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 933 |
+
|
| 934 |
+
If the program does terminal interaction, make it output a short
|
| 935 |
+
notice like this when it starts in an interactive mode:
|
| 936 |
+
|
| 937 |
+
<program> Copyright (C) <year> <name of author>
|
| 938 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 939 |
+
This is free software, and you are welcome to redistribute it
|
| 940 |
+
under certain conditions; type `show c' for details.
|
| 941 |
+
|
| 942 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 943 |
+
parts of the General Public License. Of course, your program's commands
|
| 944 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 945 |
+
|
| 946 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 947 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 948 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 949 |
+
<http://www.gnu.org/licenses/>.
|
| 950 |
+
|
| 951 |
+
The GNU General Public License does not permit incorporating your program
|
| 952 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 953 |
+
may consider it more useful to permit linking proprietary applications with
|
| 954 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 955 |
+
Public License instead of this License. But first, please read
|
| 956 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
| 957 |
+
|
| 958 |
+
Name: libquadmath
|
| 959 |
+
Files: numpy.libs\libopenb*.dll
|
| 960 |
+
Description: statically linked to files compiled with gcc
|
| 961 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libquadmath
|
| 962 |
+
License: LGPL-2.1-or-later
|
| 963 |
+
|
| 964 |
+
GCC Quad-Precision Math Library
|
| 965 |
+
Copyright (C) 2010-2019 Free Software Foundation, Inc.
|
| 966 |
+
Written by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
| 967 |
+
|
| 968 |
+
This file is part of the libquadmath library.
|
| 969 |
+
Libquadmath is free software; you can redistribute it and/or
|
| 970 |
+
modify it under the terms of the GNU Library General Public
|
| 971 |
+
License as published by the Free Software Foundation; either
|
| 972 |
+
version 2.1 of the License, or (at your option) any later version.
|
| 973 |
+
|
| 974 |
+
Libquadmath is distributed in the hope that it will be useful,
|
| 975 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 976 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 977 |
+
Lesser General Public License for more details.
|
| 978 |
+
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
| 979 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 980 |
+
Classifier: Intended Audience :: Science/Research
|
| 981 |
+
Classifier: Intended Audience :: Developers
|
| 982 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 983 |
+
Classifier: Programming Language :: C
|
| 984 |
+
Classifier: Programming Language :: Python
|
| 985 |
+
Classifier: Programming Language :: Python :: 3
|
| 986 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 987 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 988 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 989 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 990 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 991 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 992 |
+
Classifier: Topic :: Software Development
|
| 993 |
+
Classifier: Topic :: Scientific/Engineering
|
| 994 |
+
Classifier: Typing :: Typed
|
| 995 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 996 |
+
Classifier: Operating System :: POSIX
|
| 997 |
+
Classifier: Operating System :: Unix
|
| 998 |
+
Classifier: Operating System :: MacOS
|
| 999 |
+
Project-URL: Homepage, https://numpy.org
|
| 1000 |
+
Project-URL: Documentation, https://numpy.org/doc/
|
| 1001 |
+
Project-URL: Source, https://github.com/numpy/numpy
|
| 1002 |
+
Project-URL: Download, https://pypi.org/project/numpy/#files
|
| 1003 |
+
Project-URL: Tracker, https://github.com/numpy/numpy/issues
|
| 1004 |
+
Project-URL: Release notes, https://numpy.org/doc/stable/release
|
| 1005 |
+
Requires-Python: >=3.9
|
| 1006 |
+
Description-Content-Type: text/markdown
|
| 1007 |
+
|
| 1008 |
+
<h1 align="center">
|
| 1009 |
+
<img src="https://raw.githubusercontent.com/numpy/numpy/main/branding/logo/primary/numpylogo.svg" width="300">
|
| 1010 |
+
</h1><br>
|
| 1011 |
+
|
| 1012 |
+
|
| 1013 |
+
[](
|
| 1014 |
+
https://numfocus.org)
|
| 1015 |
+
[](
|
| 1016 |
+
https://pypi.org/project/numpy/)
|
| 1017 |
+
[](
|
| 1018 |
+
https://anaconda.org/conda-forge/numpy)
|
| 1019 |
+
[](
|
| 1020 |
+
https://stackoverflow.com/questions/tagged/numpy)
|
| 1021 |
+
[](
|
| 1022 |
+
https://doi.org/10.1038/s41586-020-2649-2)
|
| 1023 |
+
[](https://api.securityscorecards.dev/projects/github.com/numpy/numpy)
|
| 1024 |
+
|
| 1025 |
+
|
| 1026 |
+
NumPy is the fundamental package for scientific computing with Python.
|
| 1027 |
+
|
| 1028 |
+
- **Website:** https://www.numpy.org
|
| 1029 |
+
- **Documentation:** https://numpy.org/doc
|
| 1030 |
+
- **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion
|
| 1031 |
+
- **Source code:** https://github.com/numpy/numpy
|
| 1032 |
+
- **Contributing:** https://www.numpy.org/devdocs/dev/index.html
|
| 1033 |
+
- **Bug reports:** https://github.com/numpy/numpy/issues
|
| 1034 |
+
- **Report a security vulnerability:** https://tidelift.com/docs/security
|
| 1035 |
+
|
| 1036 |
+
It provides:
|
| 1037 |
+
|
| 1038 |
+
- a powerful N-dimensional array object
|
| 1039 |
+
- sophisticated (broadcasting) functions
|
| 1040 |
+
- tools for integrating C/C++ and Fortran code
|
| 1041 |
+
- useful linear algebra, Fourier transform, and random number capabilities
|
| 1042 |
+
|
| 1043 |
+
Testing:
|
| 1044 |
+
|
| 1045 |
+
NumPy requires `pytest` and `hypothesis`. Tests can then be run after installation with:
|
| 1046 |
+
|
| 1047 |
+
python -c "import numpy, sys; sys.exit(numpy.test() is False)"
|
| 1048 |
+
|
| 1049 |
+
Code of Conduct
|
| 1050 |
+
----------------------
|
| 1051 |
+
|
| 1052 |
+
NumPy is a community-driven open source project developed by a diverse group of
|
| 1053 |
+
[contributors](https://numpy.org/teams/). The NumPy leadership has made a strong
|
| 1054 |
+
commitment to creating an open, inclusive, and positive community. Please read the
|
| 1055 |
+
[NumPy Code of Conduct](https://numpy.org/code-of-conduct/) for guidance on how to interact
|
| 1056 |
+
with others in a way that makes our community thrive.
|
| 1057 |
+
|
| 1058 |
+
Call for Contributions
|
| 1059 |
+
----------------------
|
| 1060 |
+
|
| 1061 |
+
The NumPy project welcomes your expertise and enthusiasm!
|
| 1062 |
+
|
| 1063 |
+
Small improvements or fixes are always appreciated. If you are considering larger contributions
|
| 1064 |
+
to the source code, please contact us through the [mailing
|
| 1065 |
+
list](https://mail.python.org/mailman/listinfo/numpy-discussion) first.
|
| 1066 |
+
|
| 1067 |
+
Writing code isn’t the only way to contribute to NumPy. You can also:
|
| 1068 |
+
- review pull requests
|
| 1069 |
+
- help us stay on top of new and old issues
|
| 1070 |
+
- develop tutorials, presentations, and other educational materials
|
| 1071 |
+
- maintain and improve [our website](https://github.com/numpy/numpy.org)
|
| 1072 |
+
- develop graphic design for our brand assets and promotional materials
|
| 1073 |
+
- translate website content
|
| 1074 |
+
- help with outreach and onboard new contributors
|
| 1075 |
+
- write grant proposals and help with other fundraising efforts
|
| 1076 |
+
|
| 1077 |
+
For more information about the ways you can contribute to NumPy, visit [our website](https://numpy.org/contribute/).
|
| 1078 |
+
If you’re unsure where to start or how your skills fit in, reach out! You can
|
| 1079 |
+
ask on the mailing list or here, on GitHub, by opening a new issue or leaving a
|
| 1080 |
+
comment on a relevant issue that is already open.
|
| 1081 |
+
|
| 1082 |
+
Our preferred channels of communication are all public, but if you’d like to
|
| 1083 |
+
speak to us in private first, contact our community coordinators at
|
| 1084 |
+
numpy-team@googlegroups.com or on Slack (write numpy-team@googlegroups.com for
|
| 1085 |
+
an invitation).
|
| 1086 |
+
|
| 1087 |
+
We also have a biweekly community call, details of which are announced on the
|
| 1088 |
+
mailing list. You are very welcome to join.
|
| 1089 |
+
|
| 1090 |
+
If you are new to contributing to open source, [this
|
| 1091 |
+
guide](https://opensource.guide/how-to-contribute/) helps explain why, what,
|
| 1092 |
+
and how to successfully get involved.
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/RECORD
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/REQUESTED
ADDED
|
File without changes
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: meson
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp311-cp311-win_amd64
|
.venv311/Lib/site-packages/numpy-1.26.4.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[array_api]
|
| 2 |
+
numpy = numpy.array_api
|
| 3 |
+
|
| 4 |
+
[pyinstaller40]
|
| 5 |
+
hook-dirs = numpy:_pyinstaller_hooks_dir
|
| 6 |
+
|
| 7 |
+
[console_scripts]
|
| 8 |
+
f2py = numpy.f2py.f2py2e:main
|
| 9 |
+
|
.venv311/Lib/site-packages/numpy/_core/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This private module only contains stubs for interoperability with
|
| 3 |
+
NumPy 2.0 pickled arrays. It may not be used by the end user.
|
| 4 |
+
"""
|
.venv311/Lib/site-packages/numpy/_core/__init__.pyi
ADDED
|
File without changes
|
.venv311/Lib/site-packages/numpy/_core/_dtype.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import _dtype
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in _dtype.__dir__():
|
| 6 |
+
_globals[item] = getattr(_dtype, item)
|
.venv311/Lib/site-packages/numpy/_core/_dtype_ctypes.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import _dtype_ctypes
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in _dtype_ctypes.__dir__():
|
| 6 |
+
_globals[item] = getattr(_dtype_ctypes, item)
|
.venv311/Lib/site-packages/numpy/_core/_internal.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import _internal
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in _internal.__dir__():
|
| 6 |
+
_globals[item] = getattr(_internal, item)
|
.venv311/Lib/site-packages/numpy/_core/_multiarray_umath.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import _multiarray_umath
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in _multiarray_umath.__dir__():
|
| 6 |
+
_globals[item] = getattr(_multiarray_umath, item)
|
.venv311/Lib/site-packages/numpy/_core/multiarray.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import multiarray
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in multiarray.__dir__():
|
| 6 |
+
_globals[item] = getattr(multiarray, item)
|
.venv311/Lib/site-packages/numpy/_core/umath.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy.core import umath
|
| 2 |
+
|
| 3 |
+
_globals = globals()
|
| 4 |
+
|
| 5 |
+
for item in umath.__dir__():
|
| 6 |
+
_globals[item] = getattr(umath, item)
|
.venv311/Lib/site-packages/numpy/_pyinstaller/__init__.py
ADDED
|
File without changes
|
.venv311/Lib/site-packages/numpy/_pyinstaller/hook-numpy.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""This hook should collect all binary files and any hidden modules that numpy
|
| 2 |
+
needs.
|
| 3 |
+
|
| 4 |
+
Our (some-what inadequate) docs for writing PyInstaller hooks are kept here:
|
| 5 |
+
https://pyinstaller.readthedocs.io/en/stable/hooks.html
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
from PyInstaller.compat import is_conda, is_pure_conda
|
| 9 |
+
from PyInstaller.utils.hooks import collect_dynamic_libs, is_module_satisfies
|
| 10 |
+
|
| 11 |
+
# Collect all DLLs inside numpy's installation folder, dump them into built
|
| 12 |
+
# app's root.
|
| 13 |
+
binaries = collect_dynamic_libs("numpy", ".")
|
| 14 |
+
|
| 15 |
+
# If using Conda without any non-conda virtual environment manager:
|
| 16 |
+
if is_pure_conda:
|
| 17 |
+
# Assume running the NumPy from Conda-forge and collect it's DLLs from the
|
| 18 |
+
# communal Conda bin directory. DLLs from NumPy's dependencies must also be
|
| 19 |
+
# collected to capture MKL, OpenBlas, OpenMP, etc.
|
| 20 |
+
from PyInstaller.utils.hooks import conda_support
|
| 21 |
+
datas = conda_support.collect_dynamic_libs("numpy", dependencies=True)
|
| 22 |
+
|
| 23 |
+
# Submodules PyInstaller cannot detect. `_dtype_ctypes` is only imported
|
| 24 |
+
# from C and `_multiarray_tests` is used in tests (which are not packed).
|
| 25 |
+
hiddenimports = ['numpy.core._dtype_ctypes', 'numpy.core._multiarray_tests']
|
| 26 |
+
|
| 27 |
+
# Remove testing and building code and packages that are referenced throughout
|
| 28 |
+
# NumPy but are not really dependencies.
|
| 29 |
+
excludedimports = [
|
| 30 |
+
"scipy",
|
| 31 |
+
"pytest",
|
| 32 |
+
"f2py",
|
| 33 |
+
"setuptools",
|
| 34 |
+
"numpy.f2py",
|
| 35 |
+
"distutils",
|
| 36 |
+
"numpy.distutils",
|
| 37 |
+
]
|
.venv311/Lib/site-packages/numpy/_pyinstaller/pyinstaller-smoke.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A crude *bit of everything* smoke test to verify PyInstaller compatibility.
|
| 2 |
+
|
| 3 |
+
PyInstaller typically goes wrong by forgetting to package modules, extension
|
| 4 |
+
modules or shared libraries. This script should aim to touch as many of those
|
| 5 |
+
as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
|
| 6 |
+
due to an uncollected resource. Missing resources are unlikely to lead to
|
| 7 |
+
arithmetic errors so there's generally no need to verify any calculation's
|
| 8 |
+
output - merely that it made it to the end OK. This script should not
|
| 9 |
+
explicitly import any of numpy's submodules as that gives PyInstaller undue
|
| 10 |
+
hints that those submodules exist and should be collected (accessing implicitly
|
| 11 |
+
loaded submodules is OK).
|
| 12 |
+
|
| 13 |
+
"""
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
a = np.arange(1., 10.).reshape((3, 3)) % 5
|
| 17 |
+
np.linalg.det(a)
|
| 18 |
+
a @ a
|
| 19 |
+
a @ a.T
|
| 20 |
+
np.linalg.inv(a)
|
| 21 |
+
np.sin(np.exp(a))
|
| 22 |
+
np.linalg.svd(a)
|
| 23 |
+
np.linalg.eigh(a)
|
| 24 |
+
|
| 25 |
+
np.unique(np.random.randint(0, 10, 100))
|
| 26 |
+
np.sort(np.random.uniform(0, 10, 100))
|
| 27 |
+
|
| 28 |
+
np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
|
| 29 |
+
np.ma.masked_array(np.arange(10), np.random.rand(10) < .5).sum()
|
| 30 |
+
np.polynomial.Legendre([7, 8, 9]).roots()
|
| 31 |
+
|
| 32 |
+
print("I made it!")
|
.venv311/Lib/site-packages/numpy/_pyinstaller/test_pyinstaller.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# PyInstaller has been very unproactive about replacing 'imp' with 'importlib'.
|
| 8 |
+
@pytest.mark.filterwarnings('ignore::DeprecationWarning')
|
| 9 |
+
# It also leaks io.BytesIO()s.
|
| 10 |
+
@pytest.mark.filterwarnings('ignore::ResourceWarning')
|
| 11 |
+
@pytest.mark.parametrize("mode", ["--onedir", "--onefile"])
|
| 12 |
+
@pytest.mark.slow
|
| 13 |
+
def test_pyinstaller(mode, tmp_path):
|
| 14 |
+
"""Compile and run pyinstaller-smoke.py using PyInstaller."""
|
| 15 |
+
|
| 16 |
+
pyinstaller_cli = pytest.importorskip("PyInstaller.__main__").run
|
| 17 |
+
|
| 18 |
+
source = Path(__file__).with_name("pyinstaller-smoke.py").resolve()
|
| 19 |
+
args = [
|
| 20 |
+
# Place all generated files in ``tmp_path``.
|
| 21 |
+
'--workpath', str(tmp_path / "build"),
|
| 22 |
+
'--distpath', str(tmp_path / "dist"),
|
| 23 |
+
'--specpath', str(tmp_path),
|
| 24 |
+
mode,
|
| 25 |
+
str(source),
|
| 26 |
+
]
|
| 27 |
+
pyinstaller_cli(args)
|
| 28 |
+
|
| 29 |
+
if mode == "--onefile":
|
| 30 |
+
exe = tmp_path / "dist" / source.stem
|
| 31 |
+
else:
|
| 32 |
+
exe = tmp_path / "dist" / source.stem / source.stem
|
| 33 |
+
|
| 34 |
+
p = subprocess.run([str(exe)], check=True, stdout=subprocess.PIPE)
|
| 35 |
+
assert p.stdout.strip() == b"I made it!"
|
.venv311/Lib/site-packages/numpy/_typing/__init__.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Private counterpart of ``numpy.typing``."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .. import ufunc
|
| 6 |
+
from .._utils import set_module
|
| 7 |
+
from typing import TYPE_CHECKING, final
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@final # Disallow the creation of arbitrary `NBitBase` subclasses
|
| 11 |
+
@set_module("numpy.typing")
|
| 12 |
+
class NBitBase:
|
| 13 |
+
"""
|
| 14 |
+
A type representing `numpy.number` precision during static type checking.
|
| 15 |
+
|
| 16 |
+
Used exclusively for the purpose static type checking, `NBitBase`
|
| 17 |
+
represents the base of a hierarchical set of subclasses.
|
| 18 |
+
Each subsequent subclass is herein used for representing a lower level
|
| 19 |
+
of precision, *e.g.* ``64Bit > 32Bit > 16Bit``.
|
| 20 |
+
|
| 21 |
+
.. versionadded:: 1.20
|
| 22 |
+
|
| 23 |
+
Examples
|
| 24 |
+
--------
|
| 25 |
+
Below is a typical usage example: `NBitBase` is herein used for annotating
|
| 26 |
+
a function that takes a float and integer of arbitrary precision
|
| 27 |
+
as arguments and returns a new float of whichever precision is largest
|
| 28 |
+
(*e.g.* ``np.float16 + np.int64 -> np.float64``).
|
| 29 |
+
|
| 30 |
+
.. code-block:: python
|
| 31 |
+
|
| 32 |
+
>>> from __future__ import annotations
|
| 33 |
+
>>> from typing import TypeVar, TYPE_CHECKING
|
| 34 |
+
>>> import numpy as np
|
| 35 |
+
>>> import numpy.typing as npt
|
| 36 |
+
|
| 37 |
+
>>> T1 = TypeVar("T1", bound=npt.NBitBase)
|
| 38 |
+
>>> T2 = TypeVar("T2", bound=npt.NBitBase)
|
| 39 |
+
|
| 40 |
+
>>> def add(a: np.floating[T1], b: np.integer[T2]) -> np.floating[T1 | T2]:
|
| 41 |
+
... return a + b
|
| 42 |
+
|
| 43 |
+
>>> a = np.float16()
|
| 44 |
+
>>> b = np.int64()
|
| 45 |
+
>>> out = add(a, b)
|
| 46 |
+
|
| 47 |
+
>>> if TYPE_CHECKING:
|
| 48 |
+
... reveal_locals()
|
| 49 |
+
... # note: Revealed local types are:
|
| 50 |
+
... # note: a: numpy.floating[numpy.typing._16Bit*]
|
| 51 |
+
... # note: b: numpy.signedinteger[numpy.typing._64Bit*]
|
| 52 |
+
... # note: out: numpy.floating[numpy.typing._64Bit*]
|
| 53 |
+
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
def __init_subclass__(cls) -> None:
|
| 57 |
+
allowed_names = {
|
| 58 |
+
"NBitBase", "_256Bit", "_128Bit", "_96Bit", "_80Bit",
|
| 59 |
+
"_64Bit", "_32Bit", "_16Bit", "_8Bit",
|
| 60 |
+
}
|
| 61 |
+
if cls.__name__ not in allowed_names:
|
| 62 |
+
raise TypeError('cannot inherit from final class "NBitBase"')
|
| 63 |
+
super().__init_subclass__()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
# Silence errors about subclassing a `@final`-decorated class
|
| 67 |
+
class _256Bit(NBitBase): # type: ignore[misc]
|
| 68 |
+
pass
|
| 69 |
+
|
| 70 |
+
class _128Bit(_256Bit): # type: ignore[misc]
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
class _96Bit(_128Bit): # type: ignore[misc]
|
| 74 |
+
pass
|
| 75 |
+
|
| 76 |
+
class _80Bit(_96Bit): # type: ignore[misc]
|
| 77 |
+
pass
|
| 78 |
+
|
| 79 |
+
class _64Bit(_80Bit): # type: ignore[misc]
|
| 80 |
+
pass
|
| 81 |
+
|
| 82 |
+
class _32Bit(_64Bit): # type: ignore[misc]
|
| 83 |
+
pass
|
| 84 |
+
|
| 85 |
+
class _16Bit(_32Bit): # type: ignore[misc]
|
| 86 |
+
pass
|
| 87 |
+
|
| 88 |
+
class _8Bit(_16Bit): # type: ignore[misc]
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
from ._nested_sequence import (
|
| 93 |
+
_NestedSequence as _NestedSequence,
|
| 94 |
+
)
|
| 95 |
+
from ._nbit import (
|
| 96 |
+
_NBitByte as _NBitByte,
|
| 97 |
+
_NBitShort as _NBitShort,
|
| 98 |
+
_NBitIntC as _NBitIntC,
|
| 99 |
+
_NBitIntP as _NBitIntP,
|
| 100 |
+
_NBitInt as _NBitInt,
|
| 101 |
+
_NBitLongLong as _NBitLongLong,
|
| 102 |
+
_NBitHalf as _NBitHalf,
|
| 103 |
+
_NBitSingle as _NBitSingle,
|
| 104 |
+
_NBitDouble as _NBitDouble,
|
| 105 |
+
_NBitLongDouble as _NBitLongDouble,
|
| 106 |
+
)
|
| 107 |
+
from ._char_codes import (
|
| 108 |
+
_BoolCodes as _BoolCodes,
|
| 109 |
+
_UInt8Codes as _UInt8Codes,
|
| 110 |
+
_UInt16Codes as _UInt16Codes,
|
| 111 |
+
_UInt32Codes as _UInt32Codes,
|
| 112 |
+
_UInt64Codes as _UInt64Codes,
|
| 113 |
+
_Int8Codes as _Int8Codes,
|
| 114 |
+
_Int16Codes as _Int16Codes,
|
| 115 |
+
_Int32Codes as _Int32Codes,
|
| 116 |
+
_Int64Codes as _Int64Codes,
|
| 117 |
+
_Float16Codes as _Float16Codes,
|
| 118 |
+
_Float32Codes as _Float32Codes,
|
| 119 |
+
_Float64Codes as _Float64Codes,
|
| 120 |
+
_Complex64Codes as _Complex64Codes,
|
| 121 |
+
_Complex128Codes as _Complex128Codes,
|
| 122 |
+
_ByteCodes as _ByteCodes,
|
| 123 |
+
_ShortCodes as _ShortCodes,
|
| 124 |
+
_IntCCodes as _IntCCodes,
|
| 125 |
+
_IntPCodes as _IntPCodes,
|
| 126 |
+
_IntCodes as _IntCodes,
|
| 127 |
+
_LongLongCodes as _LongLongCodes,
|
| 128 |
+
_UByteCodes as _UByteCodes,
|
| 129 |
+
_UShortCodes as _UShortCodes,
|
| 130 |
+
_UIntCCodes as _UIntCCodes,
|
| 131 |
+
_UIntPCodes as _UIntPCodes,
|
| 132 |
+
_UIntCodes as _UIntCodes,
|
| 133 |
+
_ULongLongCodes as _ULongLongCodes,
|
| 134 |
+
_HalfCodes as _HalfCodes,
|
| 135 |
+
_SingleCodes as _SingleCodes,
|
| 136 |
+
_DoubleCodes as _DoubleCodes,
|
| 137 |
+
_LongDoubleCodes as _LongDoubleCodes,
|
| 138 |
+
_CSingleCodes as _CSingleCodes,
|
| 139 |
+
_CDoubleCodes as _CDoubleCodes,
|
| 140 |
+
_CLongDoubleCodes as _CLongDoubleCodes,
|
| 141 |
+
_DT64Codes as _DT64Codes,
|
| 142 |
+
_TD64Codes as _TD64Codes,
|
| 143 |
+
_StrCodes as _StrCodes,
|
| 144 |
+
_BytesCodes as _BytesCodes,
|
| 145 |
+
_VoidCodes as _VoidCodes,
|
| 146 |
+
_ObjectCodes as _ObjectCodes,
|
| 147 |
+
)
|
| 148 |
+
from ._scalars import (
|
| 149 |
+
_CharLike_co as _CharLike_co,
|
| 150 |
+
_BoolLike_co as _BoolLike_co,
|
| 151 |
+
_UIntLike_co as _UIntLike_co,
|
| 152 |
+
_IntLike_co as _IntLike_co,
|
| 153 |
+
_FloatLike_co as _FloatLike_co,
|
| 154 |
+
_ComplexLike_co as _ComplexLike_co,
|
| 155 |
+
_TD64Like_co as _TD64Like_co,
|
| 156 |
+
_NumberLike_co as _NumberLike_co,
|
| 157 |
+
_ScalarLike_co as _ScalarLike_co,
|
| 158 |
+
_VoidLike_co as _VoidLike_co,
|
| 159 |
+
)
|
| 160 |
+
from ._shape import (
|
| 161 |
+
_Shape as _Shape,
|
| 162 |
+
_ShapeLike as _ShapeLike,
|
| 163 |
+
)
|
| 164 |
+
from ._dtype_like import (
|
| 165 |
+
DTypeLike as DTypeLike,
|
| 166 |
+
_DTypeLike as _DTypeLike,
|
| 167 |
+
_SupportsDType as _SupportsDType,
|
| 168 |
+
_VoidDTypeLike as _VoidDTypeLike,
|
| 169 |
+
_DTypeLikeBool as _DTypeLikeBool,
|
| 170 |
+
_DTypeLikeUInt as _DTypeLikeUInt,
|
| 171 |
+
_DTypeLikeInt as _DTypeLikeInt,
|
| 172 |
+
_DTypeLikeFloat as _DTypeLikeFloat,
|
| 173 |
+
_DTypeLikeComplex as _DTypeLikeComplex,
|
| 174 |
+
_DTypeLikeTD64 as _DTypeLikeTD64,
|
| 175 |
+
_DTypeLikeDT64 as _DTypeLikeDT64,
|
| 176 |
+
_DTypeLikeObject as _DTypeLikeObject,
|
| 177 |
+
_DTypeLikeVoid as _DTypeLikeVoid,
|
| 178 |
+
_DTypeLikeStr as _DTypeLikeStr,
|
| 179 |
+
_DTypeLikeBytes as _DTypeLikeBytes,
|
| 180 |
+
_DTypeLikeComplex_co as _DTypeLikeComplex_co,
|
| 181 |
+
)
|
| 182 |
+
from ._array_like import (
|
| 183 |
+
NDArray as NDArray,
|
| 184 |
+
ArrayLike as ArrayLike,
|
| 185 |
+
_ArrayLike as _ArrayLike,
|
| 186 |
+
_FiniteNestedSequence as _FiniteNestedSequence,
|
| 187 |
+
_SupportsArray as _SupportsArray,
|
| 188 |
+
_SupportsArrayFunc as _SupportsArrayFunc,
|
| 189 |
+
_ArrayLikeInt as _ArrayLikeInt,
|
| 190 |
+
_ArrayLikeBool_co as _ArrayLikeBool_co,
|
| 191 |
+
_ArrayLikeUInt_co as _ArrayLikeUInt_co,
|
| 192 |
+
_ArrayLikeInt_co as _ArrayLikeInt_co,
|
| 193 |
+
_ArrayLikeFloat_co as _ArrayLikeFloat_co,
|
| 194 |
+
_ArrayLikeComplex_co as _ArrayLikeComplex_co,
|
| 195 |
+
_ArrayLikeNumber_co as _ArrayLikeNumber_co,
|
| 196 |
+
_ArrayLikeTD64_co as _ArrayLikeTD64_co,
|
| 197 |
+
_ArrayLikeDT64_co as _ArrayLikeDT64_co,
|
| 198 |
+
_ArrayLikeObject_co as _ArrayLikeObject_co,
|
| 199 |
+
_ArrayLikeVoid_co as _ArrayLikeVoid_co,
|
| 200 |
+
_ArrayLikeStr_co as _ArrayLikeStr_co,
|
| 201 |
+
_ArrayLikeBytes_co as _ArrayLikeBytes_co,
|
| 202 |
+
_ArrayLikeUnknown as _ArrayLikeUnknown,
|
| 203 |
+
_UnknownType as _UnknownType,
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
if TYPE_CHECKING:
|
| 207 |
+
from ._ufunc import (
|
| 208 |
+
_UFunc_Nin1_Nout1 as _UFunc_Nin1_Nout1,
|
| 209 |
+
_UFunc_Nin2_Nout1 as _UFunc_Nin2_Nout1,
|
| 210 |
+
_UFunc_Nin1_Nout2 as _UFunc_Nin1_Nout2,
|
| 211 |
+
_UFunc_Nin2_Nout2 as _UFunc_Nin2_Nout2,
|
| 212 |
+
_GUFunc_Nin2_Nout1 as _GUFunc_Nin2_Nout1,
|
| 213 |
+
)
|
| 214 |
+
else:
|
| 215 |
+
# Declare the (type-check-only) ufunc subclasses as ufunc aliases during
|
| 216 |
+
# runtime; this helps autocompletion tools such as Jedi (numpy/numpy#19834)
|
| 217 |
+
_UFunc_Nin1_Nout1 = ufunc
|
| 218 |
+
_UFunc_Nin2_Nout1 = ufunc
|
| 219 |
+
_UFunc_Nin1_Nout2 = ufunc
|
| 220 |
+
_UFunc_Nin2_Nout2 = ufunc
|
| 221 |
+
_GUFunc_Nin2_Nout1 = ufunc
|
.venv311/Lib/site-packages/numpy/_typing/_add_docstring.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module for creating docstrings for sphinx ``data`` domains."""
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
from ._array_like import NDArray
|
| 7 |
+
|
| 8 |
+
_docstrings_list = []
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def add_newdoc(name: str, value: str, doc: str) -> None:
|
| 12 |
+
"""Append ``_docstrings_list`` with a docstring for `name`.
|
| 13 |
+
|
| 14 |
+
Parameters
|
| 15 |
+
----------
|
| 16 |
+
name : str
|
| 17 |
+
The name of the object.
|
| 18 |
+
value : str
|
| 19 |
+
A string-representation of the object.
|
| 20 |
+
doc : str
|
| 21 |
+
The docstring of the object.
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
_docstrings_list.append((name, value, doc))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _parse_docstrings() -> str:
|
| 28 |
+
"""Convert all docstrings in ``_docstrings_list`` into a single
|
| 29 |
+
sphinx-legible text block.
|
| 30 |
+
|
| 31 |
+
"""
|
| 32 |
+
type_list_ret = []
|
| 33 |
+
for name, value, doc in _docstrings_list:
|
| 34 |
+
s = textwrap.dedent(doc).replace("\n", "\n ")
|
| 35 |
+
|
| 36 |
+
# Replace sections by rubrics
|
| 37 |
+
lines = s.split("\n")
|
| 38 |
+
new_lines = []
|
| 39 |
+
indent = ""
|
| 40 |
+
for line in lines:
|
| 41 |
+
m = re.match(r'^(\s+)[-=]+\s*$', line)
|
| 42 |
+
if m and new_lines:
|
| 43 |
+
prev = textwrap.dedent(new_lines.pop())
|
| 44 |
+
if prev == "Examples":
|
| 45 |
+
indent = ""
|
| 46 |
+
new_lines.append(f'{m.group(1)}.. rubric:: {prev}')
|
| 47 |
+
else:
|
| 48 |
+
indent = 4 * " "
|
| 49 |
+
new_lines.append(f'{m.group(1)}.. admonition:: {prev}')
|
| 50 |
+
new_lines.append("")
|
| 51 |
+
else:
|
| 52 |
+
new_lines.append(f"{indent}{line}")
|
| 53 |
+
|
| 54 |
+
s = "\n".join(new_lines)
|
| 55 |
+
s_block = f""".. data:: {name}\n :value: {value}\n {s}"""
|
| 56 |
+
type_list_ret.append(s_block)
|
| 57 |
+
return "\n".join(type_list_ret)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
add_newdoc('ArrayLike', 'typing.Union[...]',
|
| 61 |
+
"""
|
| 62 |
+
A `~typing.Union` representing objects that can be coerced
|
| 63 |
+
into an `~numpy.ndarray`.
|
| 64 |
+
|
| 65 |
+
Among others this includes the likes of:
|
| 66 |
+
|
| 67 |
+
* Scalars.
|
| 68 |
+
* (Nested) sequences.
|
| 69 |
+
* Objects implementing the `~class.__array__` protocol.
|
| 70 |
+
|
| 71 |
+
.. versionadded:: 1.20
|
| 72 |
+
|
| 73 |
+
See Also
|
| 74 |
+
--------
|
| 75 |
+
:term:`array_like`:
|
| 76 |
+
Any scalar or sequence that can be interpreted as an ndarray.
|
| 77 |
+
|
| 78 |
+
Examples
|
| 79 |
+
--------
|
| 80 |
+
.. code-block:: python
|
| 81 |
+
|
| 82 |
+
>>> import numpy as np
|
| 83 |
+
>>> import numpy.typing as npt
|
| 84 |
+
|
| 85 |
+
>>> def as_array(a: npt.ArrayLike) -> np.ndarray:
|
| 86 |
+
... return np.array(a)
|
| 87 |
+
|
| 88 |
+
""")
|
| 89 |
+
|
| 90 |
+
add_newdoc('DTypeLike', 'typing.Union[...]',
|
| 91 |
+
"""
|
| 92 |
+
A `~typing.Union` representing objects that can be coerced
|
| 93 |
+
into a `~numpy.dtype`.
|
| 94 |
+
|
| 95 |
+
Among others this includes the likes of:
|
| 96 |
+
|
| 97 |
+
* :class:`type` objects.
|
| 98 |
+
* Character codes or the names of :class:`type` objects.
|
| 99 |
+
* Objects with the ``.dtype`` attribute.
|
| 100 |
+
|
| 101 |
+
.. versionadded:: 1.20
|
| 102 |
+
|
| 103 |
+
See Also
|
| 104 |
+
--------
|
| 105 |
+
:ref:`Specifying and constructing data types <arrays.dtypes.constructing>`
|
| 106 |
+
A comprehensive overview of all objects that can be coerced
|
| 107 |
+
into data types.
|
| 108 |
+
|
| 109 |
+
Examples
|
| 110 |
+
--------
|
| 111 |
+
.. code-block:: python
|
| 112 |
+
|
| 113 |
+
>>> import numpy as np
|
| 114 |
+
>>> import numpy.typing as npt
|
| 115 |
+
|
| 116 |
+
>>> def as_dtype(d: npt.DTypeLike) -> np.dtype:
|
| 117 |
+
... return np.dtype(d)
|
| 118 |
+
|
| 119 |
+
""")
|
| 120 |
+
|
| 121 |
+
add_newdoc('NDArray', repr(NDArray),
|
| 122 |
+
"""
|
| 123 |
+
A :term:`generic <generic type>` version of
|
| 124 |
+
`np.ndarray[Any, np.dtype[+ScalarType]] <numpy.ndarray>`.
|
| 125 |
+
|
| 126 |
+
Can be used during runtime for typing arrays with a given dtype
|
| 127 |
+
and unspecified shape.
|
| 128 |
+
|
| 129 |
+
.. versionadded:: 1.21
|
| 130 |
+
|
| 131 |
+
Examples
|
| 132 |
+
--------
|
| 133 |
+
.. code-block:: python
|
| 134 |
+
|
| 135 |
+
>>> import numpy as np
|
| 136 |
+
>>> import numpy.typing as npt
|
| 137 |
+
|
| 138 |
+
>>> print(npt.NDArray)
|
| 139 |
+
numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]]
|
| 140 |
+
|
| 141 |
+
>>> print(npt.NDArray[np.float64])
|
| 142 |
+
numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
|
| 143 |
+
|
| 144 |
+
>>> NDArrayInt = npt.NDArray[np.int_]
|
| 145 |
+
>>> a: NDArrayInt = np.arange(10)
|
| 146 |
+
|
| 147 |
+
>>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]:
|
| 148 |
+
... return np.array(a)
|
| 149 |
+
|
| 150 |
+
""")
|
| 151 |
+
|
| 152 |
+
_docstrings = _parse_docstrings()
|
.venv311/Lib/site-packages/numpy/_typing/_array_like.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
from collections.abc import Collection, Callable, Sequence
|
| 5 |
+
from typing import Any, Protocol, Union, TypeVar, runtime_checkable
|
| 6 |
+
|
| 7 |
+
from numpy import (
|
| 8 |
+
ndarray,
|
| 9 |
+
dtype,
|
| 10 |
+
generic,
|
| 11 |
+
bool_,
|
| 12 |
+
unsignedinteger,
|
| 13 |
+
integer,
|
| 14 |
+
floating,
|
| 15 |
+
complexfloating,
|
| 16 |
+
number,
|
| 17 |
+
timedelta64,
|
| 18 |
+
datetime64,
|
| 19 |
+
object_,
|
| 20 |
+
void,
|
| 21 |
+
str_,
|
| 22 |
+
bytes_,
|
| 23 |
+
)
|
| 24 |
+
from ._nested_sequence import _NestedSequence
|
| 25 |
+
|
| 26 |
+
_T = TypeVar("_T")
|
| 27 |
+
_ScalarType = TypeVar("_ScalarType", bound=generic)
|
| 28 |
+
_ScalarType_co = TypeVar("_ScalarType_co", bound=generic, covariant=True)
|
| 29 |
+
_DType = TypeVar("_DType", bound=dtype[Any])
|
| 30 |
+
_DType_co = TypeVar("_DType_co", covariant=True, bound=dtype[Any])
|
| 31 |
+
|
| 32 |
+
NDArray = ndarray[Any, dtype[_ScalarType_co]]
|
| 33 |
+
|
| 34 |
+
# The `_SupportsArray` protocol only cares about the default dtype
|
| 35 |
+
# (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned
|
| 36 |
+
# array.
|
| 37 |
+
# Concrete implementations of the protocol are responsible for adding
|
| 38 |
+
# any and all remaining overloads
|
| 39 |
+
@runtime_checkable
|
| 40 |
+
class _SupportsArray(Protocol[_DType_co]):
|
| 41 |
+
def __array__(self) -> ndarray[Any, _DType_co]: ...
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@runtime_checkable
|
| 45 |
+
class _SupportsArrayFunc(Protocol):
|
| 46 |
+
"""A protocol class representing `~class.__array_function__`."""
|
| 47 |
+
def __array_function__(
|
| 48 |
+
self,
|
| 49 |
+
func: Callable[..., Any],
|
| 50 |
+
types: Collection[type[Any]],
|
| 51 |
+
args: tuple[Any, ...],
|
| 52 |
+
kwargs: dict[str, Any],
|
| 53 |
+
) -> object: ...
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# TODO: Wait until mypy supports recursive objects in combination with typevars
|
| 57 |
+
_FiniteNestedSequence = Union[
|
| 58 |
+
_T,
|
| 59 |
+
Sequence[_T],
|
| 60 |
+
Sequence[Sequence[_T]],
|
| 61 |
+
Sequence[Sequence[Sequence[_T]]],
|
| 62 |
+
Sequence[Sequence[Sequence[Sequence[_T]]]],
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
# A subset of `npt.ArrayLike` that can be parametrized w.r.t. `np.generic`
|
| 66 |
+
_ArrayLike = Union[
|
| 67 |
+
_SupportsArray[dtype[_ScalarType]],
|
| 68 |
+
_NestedSequence[_SupportsArray[dtype[_ScalarType]]],
|
| 69 |
+
]
|
| 70 |
+
|
| 71 |
+
# A union representing array-like objects; consists of two typevars:
|
| 72 |
+
# One representing types that can be parametrized w.r.t. `np.dtype`
|
| 73 |
+
# and another one for the rest
|
| 74 |
+
_DualArrayLike = Union[
|
| 75 |
+
_SupportsArray[_DType],
|
| 76 |
+
_NestedSequence[_SupportsArray[_DType]],
|
| 77 |
+
_T,
|
| 78 |
+
_NestedSequence[_T],
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
if sys.version_info >= (3, 12):
|
| 82 |
+
from collections.abc import Buffer
|
| 83 |
+
|
| 84 |
+
ArrayLike = Buffer | _DualArrayLike[
|
| 85 |
+
dtype[Any],
|
| 86 |
+
Union[bool, int, float, complex, str, bytes],
|
| 87 |
+
]
|
| 88 |
+
else:
|
| 89 |
+
ArrayLike = _DualArrayLike[
|
| 90 |
+
dtype[Any],
|
| 91 |
+
Union[bool, int, float, complex, str, bytes],
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
# `ArrayLike<X>_co`: array-like objects that can be coerced into `X`
|
| 95 |
+
# given the casting rules `same_kind`
|
| 96 |
+
_ArrayLikeBool_co = _DualArrayLike[
|
| 97 |
+
dtype[bool_],
|
| 98 |
+
bool,
|
| 99 |
+
]
|
| 100 |
+
_ArrayLikeUInt_co = _DualArrayLike[
|
| 101 |
+
dtype[Union[bool_, unsignedinteger[Any]]],
|
| 102 |
+
bool,
|
| 103 |
+
]
|
| 104 |
+
_ArrayLikeInt_co = _DualArrayLike[
|
| 105 |
+
dtype[Union[bool_, integer[Any]]],
|
| 106 |
+
Union[bool, int],
|
| 107 |
+
]
|
| 108 |
+
_ArrayLikeFloat_co = _DualArrayLike[
|
| 109 |
+
dtype[Union[bool_, integer[Any], floating[Any]]],
|
| 110 |
+
Union[bool, int, float],
|
| 111 |
+
]
|
| 112 |
+
_ArrayLikeComplex_co = _DualArrayLike[
|
| 113 |
+
dtype[Union[
|
| 114 |
+
bool_,
|
| 115 |
+
integer[Any],
|
| 116 |
+
floating[Any],
|
| 117 |
+
complexfloating[Any, Any],
|
| 118 |
+
]],
|
| 119 |
+
Union[bool, int, float, complex],
|
| 120 |
+
]
|
| 121 |
+
_ArrayLikeNumber_co = _DualArrayLike[
|
| 122 |
+
dtype[Union[bool_, number[Any]]],
|
| 123 |
+
Union[bool, int, float, complex],
|
| 124 |
+
]
|
| 125 |
+
_ArrayLikeTD64_co = _DualArrayLike[
|
| 126 |
+
dtype[Union[bool_, integer[Any], timedelta64]],
|
| 127 |
+
Union[bool, int],
|
| 128 |
+
]
|
| 129 |
+
_ArrayLikeDT64_co = Union[
|
| 130 |
+
_SupportsArray[dtype[datetime64]],
|
| 131 |
+
_NestedSequence[_SupportsArray[dtype[datetime64]]],
|
| 132 |
+
]
|
| 133 |
+
_ArrayLikeObject_co = Union[
|
| 134 |
+
_SupportsArray[dtype[object_]],
|
| 135 |
+
_NestedSequence[_SupportsArray[dtype[object_]]],
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
+
_ArrayLikeVoid_co = Union[
|
| 139 |
+
_SupportsArray[dtype[void]],
|
| 140 |
+
_NestedSequence[_SupportsArray[dtype[void]]],
|
| 141 |
+
]
|
| 142 |
+
_ArrayLikeStr_co = _DualArrayLike[
|
| 143 |
+
dtype[str_],
|
| 144 |
+
str,
|
| 145 |
+
]
|
| 146 |
+
_ArrayLikeBytes_co = _DualArrayLike[
|
| 147 |
+
dtype[bytes_],
|
| 148 |
+
bytes,
|
| 149 |
+
]
|
| 150 |
+
|
| 151 |
+
_ArrayLikeInt = _DualArrayLike[
|
| 152 |
+
dtype[integer[Any]],
|
| 153 |
+
int,
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
# Extra ArrayLike type so that pyright can deal with NDArray[Any]
|
| 157 |
+
# Used as the first overload, should only match NDArray[Any],
|
| 158 |
+
# not any actual types.
|
| 159 |
+
# https://github.com/numpy/numpy/pull/22193
|
| 160 |
+
class _UnknownType:
|
| 161 |
+
...
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
_ArrayLikeUnknown = _DualArrayLike[
|
| 165 |
+
dtype[_UnknownType],
|
| 166 |
+
_UnknownType,
|
| 167 |
+
]
|
.venv311/Lib/site-packages/numpy/_typing/_callable.pyi
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A module with various ``typing.Protocol`` subclasses that implement
|
| 3 |
+
the ``__call__`` magic method.
|
| 4 |
+
|
| 5 |
+
See the `Mypy documentation`_ on protocols for more details.
|
| 6 |
+
|
| 7 |
+
.. _`Mypy documentation`: https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from typing import (
|
| 14 |
+
TypeVar,
|
| 15 |
+
overload,
|
| 16 |
+
Any,
|
| 17 |
+
NoReturn,
|
| 18 |
+
Protocol,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
from numpy import (
|
| 22 |
+
ndarray,
|
| 23 |
+
dtype,
|
| 24 |
+
generic,
|
| 25 |
+
bool_,
|
| 26 |
+
timedelta64,
|
| 27 |
+
number,
|
| 28 |
+
integer,
|
| 29 |
+
unsignedinteger,
|
| 30 |
+
signedinteger,
|
| 31 |
+
int8,
|
| 32 |
+
int_,
|
| 33 |
+
floating,
|
| 34 |
+
float64,
|
| 35 |
+
complexfloating,
|
| 36 |
+
complex128,
|
| 37 |
+
)
|
| 38 |
+
from ._nbit import _NBitInt, _NBitDouble
|
| 39 |
+
from ._scalars import (
|
| 40 |
+
_BoolLike_co,
|
| 41 |
+
_IntLike_co,
|
| 42 |
+
_FloatLike_co,
|
| 43 |
+
_NumberLike_co,
|
| 44 |
+
)
|
| 45 |
+
from . import NBitBase
|
| 46 |
+
from ._array_like import NDArray
|
| 47 |
+
from ._nested_sequence import _NestedSequence
|
| 48 |
+
|
| 49 |
+
_T1 = TypeVar("_T1")
|
| 50 |
+
_T2 = TypeVar("_T2")
|
| 51 |
+
_T1_contra = TypeVar("_T1_contra", contravariant=True)
|
| 52 |
+
_T2_contra = TypeVar("_T2_contra", contravariant=True)
|
| 53 |
+
_2Tuple = tuple[_T1, _T1]
|
| 54 |
+
|
| 55 |
+
_NBit1 = TypeVar("_NBit1", bound=NBitBase)
|
| 56 |
+
_NBit2 = TypeVar("_NBit2", bound=NBitBase)
|
| 57 |
+
|
| 58 |
+
_IntType = TypeVar("_IntType", bound=integer)
|
| 59 |
+
_FloatType = TypeVar("_FloatType", bound=floating)
|
| 60 |
+
_NumberType = TypeVar("_NumberType", bound=number)
|
| 61 |
+
_NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number)
|
| 62 |
+
_GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)
|
| 63 |
+
|
| 64 |
+
class _BoolOp(Protocol[_GenericType_co]):
|
| 65 |
+
@overload
|
| 66 |
+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
|
| 67 |
+
@overload # platform dependent
|
| 68 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 69 |
+
@overload
|
| 70 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 71 |
+
@overload
|
| 72 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 73 |
+
@overload
|
| 74 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 75 |
+
|
| 76 |
+
class _BoolBitOp(Protocol[_GenericType_co]):
|
| 77 |
+
@overload
|
| 78 |
+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
|
| 79 |
+
@overload # platform dependent
|
| 80 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 81 |
+
@overload
|
| 82 |
+
def __call__(self, other: _IntType, /) -> _IntType: ...
|
| 83 |
+
|
| 84 |
+
class _BoolSub(Protocol):
|
| 85 |
+
# Note that `other: bool_` is absent here
|
| 86 |
+
@overload
|
| 87 |
+
def __call__(self, other: bool, /) -> NoReturn: ...
|
| 88 |
+
@overload # platform dependent
|
| 89 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 90 |
+
@overload
|
| 91 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 92 |
+
@overload
|
| 93 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 94 |
+
@overload
|
| 95 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 96 |
+
|
| 97 |
+
class _BoolTrueDiv(Protocol):
|
| 98 |
+
@overload
|
| 99 |
+
def __call__(self, other: float | _IntLike_co, /) -> float64: ...
|
| 100 |
+
@overload
|
| 101 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 102 |
+
@overload
|
| 103 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 104 |
+
|
| 105 |
+
class _BoolMod(Protocol):
|
| 106 |
+
@overload
|
| 107 |
+
def __call__(self, other: _BoolLike_co, /) -> int8: ...
|
| 108 |
+
@overload # platform dependent
|
| 109 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 110 |
+
@overload
|
| 111 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 112 |
+
@overload
|
| 113 |
+
def __call__(self, other: _IntType, /) -> _IntType: ...
|
| 114 |
+
@overload
|
| 115 |
+
def __call__(self, other: _FloatType, /) -> _FloatType: ...
|
| 116 |
+
|
| 117 |
+
class _BoolDivMod(Protocol):
|
| 118 |
+
@overload
|
| 119 |
+
def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ...
|
| 120 |
+
@overload # platform dependent
|
| 121 |
+
def __call__(self, other: int, /) -> _2Tuple[int_]: ...
|
| 122 |
+
@overload
|
| 123 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 124 |
+
@overload
|
| 125 |
+
def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ...
|
| 126 |
+
@overload
|
| 127 |
+
def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ...
|
| 128 |
+
|
| 129 |
+
class _TD64Div(Protocol[_NumberType_co]):
|
| 130 |
+
@overload
|
| 131 |
+
def __call__(self, other: timedelta64, /) -> _NumberType_co: ...
|
| 132 |
+
@overload
|
| 133 |
+
def __call__(self, other: _BoolLike_co, /) -> NoReturn: ...
|
| 134 |
+
@overload
|
| 135 |
+
def __call__(self, other: _FloatLike_co, /) -> timedelta64: ...
|
| 136 |
+
|
| 137 |
+
class _IntTrueDiv(Protocol[_NBit1]):
|
| 138 |
+
@overload
|
| 139 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 140 |
+
@overload
|
| 141 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 142 |
+
@overload
|
| 143 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 144 |
+
@overload
|
| 145 |
+
def __call__(
|
| 146 |
+
self, other: complex, /,
|
| 147 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 148 |
+
@overload
|
| 149 |
+
def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ...
|
| 150 |
+
|
| 151 |
+
class _UnsignedIntOp(Protocol[_NBit1]):
|
| 152 |
+
# NOTE: `uint64 + signedinteger -> float64`
|
| 153 |
+
@overload
|
| 154 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 155 |
+
@overload
|
| 156 |
+
def __call__(
|
| 157 |
+
self, other: int | signedinteger[Any], /
|
| 158 |
+
) -> Any: ...
|
| 159 |
+
@overload
|
| 160 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 161 |
+
@overload
|
| 162 |
+
def __call__(
|
| 163 |
+
self, other: complex, /,
|
| 164 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 165 |
+
@overload
|
| 166 |
+
def __call__(
|
| 167 |
+
self, other: unsignedinteger[_NBit2], /
|
| 168 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 169 |
+
|
| 170 |
+
class _UnsignedIntBitOp(Protocol[_NBit1]):
|
| 171 |
+
@overload
|
| 172 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 173 |
+
@overload
|
| 174 |
+
def __call__(self, other: int, /) -> signedinteger[Any]: ...
|
| 175 |
+
@overload
|
| 176 |
+
def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ...
|
| 177 |
+
@overload
|
| 178 |
+
def __call__(
|
| 179 |
+
self, other: unsignedinteger[_NBit2], /
|
| 180 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 181 |
+
|
| 182 |
+
class _UnsignedIntMod(Protocol[_NBit1]):
|
| 183 |
+
@overload
|
| 184 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 185 |
+
@overload
|
| 186 |
+
def __call__(
|
| 187 |
+
self, other: int | signedinteger[Any], /
|
| 188 |
+
) -> Any: ...
|
| 189 |
+
@overload
|
| 190 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 191 |
+
@overload
|
| 192 |
+
def __call__(
|
| 193 |
+
self, other: unsignedinteger[_NBit2], /
|
| 194 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 195 |
+
|
| 196 |
+
class _UnsignedIntDivMod(Protocol[_NBit1]):
|
| 197 |
+
@overload
|
| 198 |
+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
|
| 199 |
+
@overload
|
| 200 |
+
def __call__(
|
| 201 |
+
self, other: int | signedinteger[Any], /
|
| 202 |
+
) -> _2Tuple[Any]: ...
|
| 203 |
+
@overload
|
| 204 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 205 |
+
@overload
|
| 206 |
+
def __call__(
|
| 207 |
+
self, other: unsignedinteger[_NBit2], /
|
| 208 |
+
) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ...
|
| 209 |
+
|
| 210 |
+
class _SignedIntOp(Protocol[_NBit1]):
|
| 211 |
+
@overload
|
| 212 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 213 |
+
@overload
|
| 214 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 215 |
+
@overload
|
| 216 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 217 |
+
@overload
|
| 218 |
+
def __call__(
|
| 219 |
+
self, other: complex, /,
|
| 220 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 221 |
+
@overload
|
| 222 |
+
def __call__(
|
| 223 |
+
self, other: signedinteger[_NBit2], /,
|
| 224 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 225 |
+
|
| 226 |
+
class _SignedIntBitOp(Protocol[_NBit1]):
|
| 227 |
+
@overload
|
| 228 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 229 |
+
@overload
|
| 230 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 231 |
+
@overload
|
| 232 |
+
def __call__(
|
| 233 |
+
self, other: signedinteger[_NBit2], /,
|
| 234 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 235 |
+
|
| 236 |
+
class _SignedIntMod(Protocol[_NBit1]):
|
| 237 |
+
@overload
|
| 238 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 239 |
+
@overload
|
| 240 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 241 |
+
@overload
|
| 242 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 243 |
+
@overload
|
| 244 |
+
def __call__(
|
| 245 |
+
self, other: signedinteger[_NBit2], /,
|
| 246 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 247 |
+
|
| 248 |
+
class _SignedIntDivMod(Protocol[_NBit1]):
|
| 249 |
+
@overload
|
| 250 |
+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
|
| 251 |
+
@overload
|
| 252 |
+
def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
|
| 253 |
+
@overload
|
| 254 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 255 |
+
@overload
|
| 256 |
+
def __call__(
|
| 257 |
+
self, other: signedinteger[_NBit2], /,
|
| 258 |
+
) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ...
|
| 259 |
+
|
| 260 |
+
class _FloatOp(Protocol[_NBit1]):
|
| 261 |
+
@overload
|
| 262 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 263 |
+
@overload
|
| 264 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 265 |
+
@overload
|
| 266 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 267 |
+
@overload
|
| 268 |
+
def __call__(
|
| 269 |
+
self, other: complex, /,
|
| 270 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 271 |
+
@overload
|
| 272 |
+
def __call__(
|
| 273 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 274 |
+
) -> floating[_NBit1 | _NBit2]: ...
|
| 275 |
+
|
| 276 |
+
class _FloatMod(Protocol[_NBit1]):
|
| 277 |
+
@overload
|
| 278 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 279 |
+
@overload
|
| 280 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 281 |
+
@overload
|
| 282 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 283 |
+
@overload
|
| 284 |
+
def __call__(
|
| 285 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 286 |
+
) -> floating[_NBit1 | _NBit2]: ...
|
| 287 |
+
|
| 288 |
+
class _FloatDivMod(Protocol[_NBit1]):
|
| 289 |
+
@overload
|
| 290 |
+
def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ...
|
| 291 |
+
@overload
|
| 292 |
+
def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
|
| 293 |
+
@overload
|
| 294 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 295 |
+
@overload
|
| 296 |
+
def __call__(
|
| 297 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 298 |
+
) -> _2Tuple[floating[_NBit1 | _NBit2]]: ...
|
| 299 |
+
|
| 300 |
+
class _ComplexOp(Protocol[_NBit1]):
|
| 301 |
+
@overload
|
| 302 |
+
def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ...
|
| 303 |
+
@overload
|
| 304 |
+
def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
|
| 305 |
+
@overload
|
| 306 |
+
def __call__(
|
| 307 |
+
self, other: complex, /,
|
| 308 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 309 |
+
@overload
|
| 310 |
+
def __call__(
|
| 311 |
+
self,
|
| 312 |
+
other: (
|
| 313 |
+
integer[_NBit2]
|
| 314 |
+
| floating[_NBit2]
|
| 315 |
+
| complexfloating[_NBit2, _NBit2]
|
| 316 |
+
), /,
|
| 317 |
+
) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ...
|
| 318 |
+
|
| 319 |
+
class _NumberOp(Protocol):
|
| 320 |
+
def __call__(self, other: _NumberLike_co, /) -> Any: ...
|
| 321 |
+
|
| 322 |
+
class _SupportsLT(Protocol):
|
| 323 |
+
def __lt__(self, other: Any, /) -> object: ...
|
| 324 |
+
|
| 325 |
+
class _SupportsGT(Protocol):
|
| 326 |
+
def __gt__(self, other: Any, /) -> object: ...
|
| 327 |
+
|
| 328 |
+
class _ComparisonOp(Protocol[_T1_contra, _T2_contra]):
|
| 329 |
+
@overload
|
| 330 |
+
def __call__(self, other: _T1_contra, /) -> bool_: ...
|
| 331 |
+
@overload
|
| 332 |
+
def __call__(self, other: _T2_contra, /) -> NDArray[bool_]: ...
|
| 333 |
+
@overload
|
| 334 |
+
def __call__(
|
| 335 |
+
self,
|
| 336 |
+
other: _SupportsLT | _SupportsGT | _NestedSequence[_SupportsLT | _SupportsGT],
|
| 337 |
+
/,
|
| 338 |
+
) -> Any: ...
|
.venv311/Lib/site-packages/numpy/_typing/_char_codes.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
_BoolCodes = Literal["?", "=?", "<?", ">?", "bool", "bool_", "bool8"]
|
| 4 |
+
|
| 5 |
+
_UInt8Codes = Literal["uint8", "u1", "=u1", "<u1", ">u1"]
|
| 6 |
+
_UInt16Codes = Literal["uint16", "u2", "=u2", "<u2", ">u2"]
|
| 7 |
+
_UInt32Codes = Literal["uint32", "u4", "=u4", "<u4", ">u4"]
|
| 8 |
+
_UInt64Codes = Literal["uint64", "u8", "=u8", "<u8", ">u8"]
|
| 9 |
+
|
| 10 |
+
_Int8Codes = Literal["int8", "i1", "=i1", "<i1", ">i1"]
|
| 11 |
+
_Int16Codes = Literal["int16", "i2", "=i2", "<i2", ">i2"]
|
| 12 |
+
_Int32Codes = Literal["int32", "i4", "=i4", "<i4", ">i4"]
|
| 13 |
+
_Int64Codes = Literal["int64", "i8", "=i8", "<i8", ">i8"]
|
| 14 |
+
|
| 15 |
+
_Float16Codes = Literal["float16", "f2", "=f2", "<f2", ">f2"]
|
| 16 |
+
_Float32Codes = Literal["float32", "f4", "=f4", "<f4", ">f4"]
|
| 17 |
+
_Float64Codes = Literal["float64", "f8", "=f8", "<f8", ">f8"]
|
| 18 |
+
|
| 19 |
+
_Complex64Codes = Literal["complex64", "c8", "=c8", "<c8", ">c8"]
|
| 20 |
+
_Complex128Codes = Literal["complex128", "c16", "=c16", "<c16", ">c16"]
|
| 21 |
+
|
| 22 |
+
_ByteCodes = Literal["byte", "b", "=b", "<b", ">b"]
|
| 23 |
+
_ShortCodes = Literal["short", "h", "=h", "<h", ">h"]
|
| 24 |
+
_IntCCodes = Literal["intc", "i", "=i", "<i", ">i"]
|
| 25 |
+
_IntPCodes = Literal["intp", "int0", "p", "=p", "<p", ">p"]
|
| 26 |
+
_IntCodes = Literal["long", "int", "int_", "l", "=l", "<l", ">l"]
|
| 27 |
+
_LongLongCodes = Literal["longlong", "q", "=q", "<q", ">q"]
|
| 28 |
+
|
| 29 |
+
_UByteCodes = Literal["ubyte", "B", "=B", "<B", ">B"]
|
| 30 |
+
_UShortCodes = Literal["ushort", "H", "=H", "<H", ">H"]
|
| 31 |
+
_UIntCCodes = Literal["uintc", "I", "=I", "<I", ">I"]
|
| 32 |
+
_UIntPCodes = Literal["uintp", "uint0", "P", "=P", "<P", ">P"]
|
| 33 |
+
_UIntCodes = Literal["ulong", "uint", "L", "=L", "<L", ">L"]
|
| 34 |
+
_ULongLongCodes = Literal["ulonglong", "Q", "=Q", "<Q", ">Q"]
|
| 35 |
+
|
| 36 |
+
_HalfCodes = Literal["half", "e", "=e", "<e", ">e"]
|
| 37 |
+
_SingleCodes = Literal["single", "f", "=f", "<f", ">f"]
|
| 38 |
+
_DoubleCodes = Literal["double", "float", "float_", "d", "=d", "<d", ">d"]
|
| 39 |
+
_LongDoubleCodes = Literal["longdouble", "longfloat", "g", "=g", "<g", ">g"]
|
| 40 |
+
|
| 41 |
+
_CSingleCodes = Literal["csingle", "singlecomplex", "F", "=F", "<F", ">F"]
|
| 42 |
+
_CDoubleCodes = Literal["cdouble", "complex", "complex_", "cfloat", "D", "=D", "<D", ">D"]
|
| 43 |
+
_CLongDoubleCodes = Literal["clongdouble", "clongfloat", "longcomplex", "G", "=G", "<G", ">G"]
|
| 44 |
+
|
| 45 |
+
_StrCodes = Literal["str", "str_", "str0", "unicode", "unicode_", "U", "=U", "<U", ">U"]
|
| 46 |
+
_BytesCodes = Literal["bytes", "bytes_", "bytes0", "S", "=S", "<S", ">S"]
|
| 47 |
+
_VoidCodes = Literal["void", "void0", "V", "=V", "<V", ">V"]
|
| 48 |
+
_ObjectCodes = Literal["object", "object_", "O", "=O", "<O", ">O"]
|
| 49 |
+
|
| 50 |
+
_DT64Codes = Literal[
|
| 51 |
+
"datetime64", "=datetime64", "<datetime64", ">datetime64",
|
| 52 |
+
"datetime64[Y]", "=datetime64[Y]", "<datetime64[Y]", ">datetime64[Y]",
|
| 53 |
+
"datetime64[M]", "=datetime64[M]", "<datetime64[M]", ">datetime64[M]",
|
| 54 |
+
"datetime64[W]", "=datetime64[W]", "<datetime64[W]", ">datetime64[W]",
|
| 55 |
+
"datetime64[D]", "=datetime64[D]", "<datetime64[D]", ">datetime64[D]",
|
| 56 |
+
"datetime64[h]", "=datetime64[h]", "<datetime64[h]", ">datetime64[h]",
|
| 57 |
+
"datetime64[m]", "=datetime64[m]", "<datetime64[m]", ">datetime64[m]",
|
| 58 |
+
"datetime64[s]", "=datetime64[s]", "<datetime64[s]", ">datetime64[s]",
|
| 59 |
+
"datetime64[ms]", "=datetime64[ms]", "<datetime64[ms]", ">datetime64[ms]",
|
| 60 |
+
"datetime64[us]", "=datetime64[us]", "<datetime64[us]", ">datetime64[us]",
|
| 61 |
+
"datetime64[ns]", "=datetime64[ns]", "<datetime64[ns]", ">datetime64[ns]",
|
| 62 |
+
"datetime64[ps]", "=datetime64[ps]", "<datetime64[ps]", ">datetime64[ps]",
|
| 63 |
+
"datetime64[fs]", "=datetime64[fs]", "<datetime64[fs]", ">datetime64[fs]",
|
| 64 |
+
"datetime64[as]", "=datetime64[as]", "<datetime64[as]", ">datetime64[as]",
|
| 65 |
+
"M", "=M", "<M", ">M",
|
| 66 |
+
"M8", "=M8", "<M8", ">M8",
|
| 67 |
+
"M8[Y]", "=M8[Y]", "<M8[Y]", ">M8[Y]",
|
| 68 |
+
"M8[M]", "=M8[M]", "<M8[M]", ">M8[M]",
|
| 69 |
+
"M8[W]", "=M8[W]", "<M8[W]", ">M8[W]",
|
| 70 |
+
"M8[D]", "=M8[D]", "<M8[D]", ">M8[D]",
|
| 71 |
+
"M8[h]", "=M8[h]", "<M8[h]", ">M8[h]",
|
| 72 |
+
"M8[m]", "=M8[m]", "<M8[m]", ">M8[m]",
|
| 73 |
+
"M8[s]", "=M8[s]", "<M8[s]", ">M8[s]",
|
| 74 |
+
"M8[ms]", "=M8[ms]", "<M8[ms]", ">M8[ms]",
|
| 75 |
+
"M8[us]", "=M8[us]", "<M8[us]", ">M8[us]",
|
| 76 |
+
"M8[ns]", "=M8[ns]", "<M8[ns]", ">M8[ns]",
|
| 77 |
+
"M8[ps]", "=M8[ps]", "<M8[ps]", ">M8[ps]",
|
| 78 |
+
"M8[fs]", "=M8[fs]", "<M8[fs]", ">M8[fs]",
|
| 79 |
+
"M8[as]", "=M8[as]", "<M8[as]", ">M8[as]",
|
| 80 |
+
]
|
| 81 |
+
_TD64Codes = Literal[
|
| 82 |
+
"timedelta64", "=timedelta64", "<timedelta64", ">timedelta64",
|
| 83 |
+
"timedelta64[Y]", "=timedelta64[Y]", "<timedelta64[Y]", ">timedelta64[Y]",
|
| 84 |
+
"timedelta64[M]", "=timedelta64[M]", "<timedelta64[M]", ">timedelta64[M]",
|
| 85 |
+
"timedelta64[W]", "=timedelta64[W]", "<timedelta64[W]", ">timedelta64[W]",
|
| 86 |
+
"timedelta64[D]", "=timedelta64[D]", "<timedelta64[D]", ">timedelta64[D]",
|
| 87 |
+
"timedelta64[h]", "=timedelta64[h]", "<timedelta64[h]", ">timedelta64[h]",
|
| 88 |
+
"timedelta64[m]", "=timedelta64[m]", "<timedelta64[m]", ">timedelta64[m]",
|
| 89 |
+
"timedelta64[s]", "=timedelta64[s]", "<timedelta64[s]", ">timedelta64[s]",
|
| 90 |
+
"timedelta64[ms]", "=timedelta64[ms]", "<timedelta64[ms]", ">timedelta64[ms]",
|
| 91 |
+
"timedelta64[us]", "=timedelta64[us]", "<timedelta64[us]", ">timedelta64[us]",
|
| 92 |
+
"timedelta64[ns]", "=timedelta64[ns]", "<timedelta64[ns]", ">timedelta64[ns]",
|
| 93 |
+
"timedelta64[ps]", "=timedelta64[ps]", "<timedelta64[ps]", ">timedelta64[ps]",
|
| 94 |
+
"timedelta64[fs]", "=timedelta64[fs]", "<timedelta64[fs]", ">timedelta64[fs]",
|
| 95 |
+
"timedelta64[as]", "=timedelta64[as]", "<timedelta64[as]", ">timedelta64[as]",
|
| 96 |
+
"m", "=m", "<m", ">m",
|
| 97 |
+
"m8", "=m8", "<m8", ">m8",
|
| 98 |
+
"m8[Y]", "=m8[Y]", "<m8[Y]", ">m8[Y]",
|
| 99 |
+
"m8[M]", "=m8[M]", "<m8[M]", ">m8[M]",
|
| 100 |
+
"m8[W]", "=m8[W]", "<m8[W]", ">m8[W]",
|
| 101 |
+
"m8[D]", "=m8[D]", "<m8[D]", ">m8[D]",
|
| 102 |
+
"m8[h]", "=m8[h]", "<m8[h]", ">m8[h]",
|
| 103 |
+
"m8[m]", "=m8[m]", "<m8[m]", ">m8[m]",
|
| 104 |
+
"m8[s]", "=m8[s]", "<m8[s]", ">m8[s]",
|
| 105 |
+
"m8[ms]", "=m8[ms]", "<m8[ms]", ">m8[ms]",
|
| 106 |
+
"m8[us]", "=m8[us]", "<m8[us]", ">m8[us]",
|
| 107 |
+
"m8[ns]", "=m8[ns]", "<m8[ns]", ">m8[ns]",
|
| 108 |
+
"m8[ps]", "=m8[ps]", "<m8[ps]", ">m8[ps]",
|
| 109 |
+
"m8[fs]", "=m8[fs]", "<m8[fs]", ">m8[fs]",
|
| 110 |
+
"m8[as]", "=m8[as]", "<m8[as]", ">m8[as]",
|
| 111 |
+
]
|
.venv311/Lib/site-packages/numpy/_typing/_dtype_like.py
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence
|
| 2 |
+
from typing import (
|
| 3 |
+
Any,
|
| 4 |
+
Sequence,
|
| 5 |
+
Union,
|
| 6 |
+
TypeVar,
|
| 7 |
+
Protocol,
|
| 8 |
+
TypedDict,
|
| 9 |
+
runtime_checkable,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
|
| 14 |
+
from ._shape import _ShapeLike
|
| 15 |
+
|
| 16 |
+
from ._char_codes import (
|
| 17 |
+
_BoolCodes,
|
| 18 |
+
_UInt8Codes,
|
| 19 |
+
_UInt16Codes,
|
| 20 |
+
_UInt32Codes,
|
| 21 |
+
_UInt64Codes,
|
| 22 |
+
_Int8Codes,
|
| 23 |
+
_Int16Codes,
|
| 24 |
+
_Int32Codes,
|
| 25 |
+
_Int64Codes,
|
| 26 |
+
_Float16Codes,
|
| 27 |
+
_Float32Codes,
|
| 28 |
+
_Float64Codes,
|
| 29 |
+
_Complex64Codes,
|
| 30 |
+
_Complex128Codes,
|
| 31 |
+
_ByteCodes,
|
| 32 |
+
_ShortCodes,
|
| 33 |
+
_IntCCodes,
|
| 34 |
+
_IntPCodes,
|
| 35 |
+
_IntCodes,
|
| 36 |
+
_LongLongCodes,
|
| 37 |
+
_UByteCodes,
|
| 38 |
+
_UShortCodes,
|
| 39 |
+
_UIntCCodes,
|
| 40 |
+
_UIntPCodes,
|
| 41 |
+
_UIntCodes,
|
| 42 |
+
_ULongLongCodes,
|
| 43 |
+
_HalfCodes,
|
| 44 |
+
_SingleCodes,
|
| 45 |
+
_DoubleCodes,
|
| 46 |
+
_LongDoubleCodes,
|
| 47 |
+
_CSingleCodes,
|
| 48 |
+
_CDoubleCodes,
|
| 49 |
+
_CLongDoubleCodes,
|
| 50 |
+
_DT64Codes,
|
| 51 |
+
_TD64Codes,
|
| 52 |
+
_StrCodes,
|
| 53 |
+
_BytesCodes,
|
| 54 |
+
_VoidCodes,
|
| 55 |
+
_ObjectCodes,
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
_SCT = TypeVar("_SCT", bound=np.generic)
|
| 59 |
+
_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
|
| 60 |
+
|
| 61 |
+
_DTypeLikeNested = Any # TODO: wait for support for recursive types
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# Mandatory keys
|
| 65 |
+
class _DTypeDictBase(TypedDict):
|
| 66 |
+
names: Sequence[str]
|
| 67 |
+
formats: Sequence[_DTypeLikeNested]
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# Mandatory + optional keys
|
| 71 |
+
class _DTypeDict(_DTypeDictBase, total=False):
|
| 72 |
+
# Only `str` elements are usable as indexing aliases,
|
| 73 |
+
# but `titles` can in principle accept any object
|
| 74 |
+
offsets: Sequence[int]
|
| 75 |
+
titles: Sequence[Any]
|
| 76 |
+
itemsize: int
|
| 77 |
+
aligned: bool
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# A protocol for anything with the dtype attribute
|
| 81 |
+
@runtime_checkable
|
| 82 |
+
class _SupportsDType(Protocol[_DType_co]):
|
| 83 |
+
@property
|
| 84 |
+
def dtype(self) -> _DType_co: ...
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
|
| 88 |
+
_DTypeLike = Union[
|
| 89 |
+
np.dtype[_SCT],
|
| 90 |
+
type[_SCT],
|
| 91 |
+
_SupportsDType[np.dtype[_SCT]],
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# Would create a dtype[np.void]
|
| 96 |
+
_VoidDTypeLike = Union[
|
| 97 |
+
# (flexible_dtype, itemsize)
|
| 98 |
+
tuple[_DTypeLikeNested, int],
|
| 99 |
+
# (fixed_dtype, shape)
|
| 100 |
+
tuple[_DTypeLikeNested, _ShapeLike],
|
| 101 |
+
# [(field_name, field_dtype, field_shape), ...]
|
| 102 |
+
#
|
| 103 |
+
# The type here is quite broad because NumPy accepts quite a wide
|
| 104 |
+
# range of inputs inside the list; see the tests for some
|
| 105 |
+
# examples.
|
| 106 |
+
list[Any],
|
| 107 |
+
# {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ...,
|
| 108 |
+
# 'itemsize': ...}
|
| 109 |
+
_DTypeDict,
|
| 110 |
+
# (base_dtype, new_dtype)
|
| 111 |
+
tuple[_DTypeLikeNested, _DTypeLikeNested],
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
# Anything that can be coerced into numpy.dtype.
|
| 115 |
+
# Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
|
| 116 |
+
DTypeLike = Union[
|
| 117 |
+
np.dtype[Any],
|
| 118 |
+
# default data type (float64)
|
| 119 |
+
None,
|
| 120 |
+
# array-scalar types and generic types
|
| 121 |
+
type[Any], # NOTE: We're stuck with `type[Any]` due to object dtypes
|
| 122 |
+
# anything with a dtype attribute
|
| 123 |
+
_SupportsDType[np.dtype[Any]],
|
| 124 |
+
# character codes, type strings or comma-separated fields, e.g., 'float64'
|
| 125 |
+
str,
|
| 126 |
+
_VoidDTypeLike,
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
# NOTE: while it is possible to provide the dtype as a dict of
|
| 130 |
+
# dtype-like objects (e.g. `{'field1': ..., 'field2': ..., ...}`),
|
| 131 |
+
# this syntax is officially discourged and
|
| 132 |
+
# therefore not included in the Union defining `DTypeLike`.
|
| 133 |
+
#
|
| 134 |
+
# See https://github.com/numpy/numpy/issues/16891 for more details.
|
| 135 |
+
|
| 136 |
+
# Aliases for commonly used dtype-like objects.
|
| 137 |
+
# Note that the precision of `np.number` subclasses is ignored herein.
|
| 138 |
+
_DTypeLikeBool = Union[
|
| 139 |
+
type[bool],
|
| 140 |
+
type[np.bool_],
|
| 141 |
+
np.dtype[np.bool_],
|
| 142 |
+
_SupportsDType[np.dtype[np.bool_]],
|
| 143 |
+
_BoolCodes,
|
| 144 |
+
]
|
| 145 |
+
_DTypeLikeUInt = Union[
|
| 146 |
+
type[np.unsignedinteger],
|
| 147 |
+
np.dtype[np.unsignedinteger],
|
| 148 |
+
_SupportsDType[np.dtype[np.unsignedinteger]],
|
| 149 |
+
_UInt8Codes,
|
| 150 |
+
_UInt16Codes,
|
| 151 |
+
_UInt32Codes,
|
| 152 |
+
_UInt64Codes,
|
| 153 |
+
_UByteCodes,
|
| 154 |
+
_UShortCodes,
|
| 155 |
+
_UIntCCodes,
|
| 156 |
+
_UIntPCodes,
|
| 157 |
+
_UIntCodes,
|
| 158 |
+
_ULongLongCodes,
|
| 159 |
+
]
|
| 160 |
+
_DTypeLikeInt = Union[
|
| 161 |
+
type[int],
|
| 162 |
+
type[np.signedinteger],
|
| 163 |
+
np.dtype[np.signedinteger],
|
| 164 |
+
_SupportsDType[np.dtype[np.signedinteger]],
|
| 165 |
+
_Int8Codes,
|
| 166 |
+
_Int16Codes,
|
| 167 |
+
_Int32Codes,
|
| 168 |
+
_Int64Codes,
|
| 169 |
+
_ByteCodes,
|
| 170 |
+
_ShortCodes,
|
| 171 |
+
_IntCCodes,
|
| 172 |
+
_IntPCodes,
|
| 173 |
+
_IntCodes,
|
| 174 |
+
_LongLongCodes,
|
| 175 |
+
]
|
| 176 |
+
_DTypeLikeFloat = Union[
|
| 177 |
+
type[float],
|
| 178 |
+
type[np.floating],
|
| 179 |
+
np.dtype[np.floating],
|
| 180 |
+
_SupportsDType[np.dtype[np.floating]],
|
| 181 |
+
_Float16Codes,
|
| 182 |
+
_Float32Codes,
|
| 183 |
+
_Float64Codes,
|
| 184 |
+
_HalfCodes,
|
| 185 |
+
_SingleCodes,
|
| 186 |
+
_DoubleCodes,
|
| 187 |
+
_LongDoubleCodes,
|
| 188 |
+
]
|
| 189 |
+
_DTypeLikeComplex = Union[
|
| 190 |
+
type[complex],
|
| 191 |
+
type[np.complexfloating],
|
| 192 |
+
np.dtype[np.complexfloating],
|
| 193 |
+
_SupportsDType[np.dtype[np.complexfloating]],
|
| 194 |
+
_Complex64Codes,
|
| 195 |
+
_Complex128Codes,
|
| 196 |
+
_CSingleCodes,
|
| 197 |
+
_CDoubleCodes,
|
| 198 |
+
_CLongDoubleCodes,
|
| 199 |
+
]
|
| 200 |
+
_DTypeLikeDT64 = Union[
|
| 201 |
+
type[np.timedelta64],
|
| 202 |
+
np.dtype[np.timedelta64],
|
| 203 |
+
_SupportsDType[np.dtype[np.timedelta64]],
|
| 204 |
+
_TD64Codes,
|
| 205 |
+
]
|
| 206 |
+
_DTypeLikeTD64 = Union[
|
| 207 |
+
type[np.datetime64],
|
| 208 |
+
np.dtype[np.datetime64],
|
| 209 |
+
_SupportsDType[np.dtype[np.datetime64]],
|
| 210 |
+
_DT64Codes,
|
| 211 |
+
]
|
| 212 |
+
_DTypeLikeStr = Union[
|
| 213 |
+
type[str],
|
| 214 |
+
type[np.str_],
|
| 215 |
+
np.dtype[np.str_],
|
| 216 |
+
_SupportsDType[np.dtype[np.str_]],
|
| 217 |
+
_StrCodes,
|
| 218 |
+
]
|
| 219 |
+
_DTypeLikeBytes = Union[
|
| 220 |
+
type[bytes],
|
| 221 |
+
type[np.bytes_],
|
| 222 |
+
np.dtype[np.bytes_],
|
| 223 |
+
_SupportsDType[np.dtype[np.bytes_]],
|
| 224 |
+
_BytesCodes,
|
| 225 |
+
]
|
| 226 |
+
_DTypeLikeVoid = Union[
|
| 227 |
+
type[np.void],
|
| 228 |
+
np.dtype[np.void],
|
| 229 |
+
_SupportsDType[np.dtype[np.void]],
|
| 230 |
+
_VoidCodes,
|
| 231 |
+
_VoidDTypeLike,
|
| 232 |
+
]
|
| 233 |
+
_DTypeLikeObject = Union[
|
| 234 |
+
type,
|
| 235 |
+
np.dtype[np.object_],
|
| 236 |
+
_SupportsDType[np.dtype[np.object_]],
|
| 237 |
+
_ObjectCodes,
|
| 238 |
+
]
|
| 239 |
+
|
| 240 |
+
_DTypeLikeComplex_co = Union[
|
| 241 |
+
_DTypeLikeBool,
|
| 242 |
+
_DTypeLikeUInt,
|
| 243 |
+
_DTypeLikeInt,
|
| 244 |
+
_DTypeLikeFloat,
|
| 245 |
+
_DTypeLikeComplex,
|
| 246 |
+
]
|
.venv311/Lib/site-packages/numpy/_typing/_extended_precision.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with platform-specific extended precision
|
| 2 |
+
`numpy.number` subclasses.
|
| 3 |
+
|
| 4 |
+
The subclasses are defined here (instead of ``__init__.pyi``) such
|
| 5 |
+
that they can be imported conditionally via the numpy's mypy plugin.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
from . import (
|
| 10 |
+
_80Bit,
|
| 11 |
+
_96Bit,
|
| 12 |
+
_128Bit,
|
| 13 |
+
_256Bit,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
uint128 = np.unsignedinteger[_128Bit]
|
| 17 |
+
uint256 = np.unsignedinteger[_256Bit]
|
| 18 |
+
int128 = np.signedinteger[_128Bit]
|
| 19 |
+
int256 = np.signedinteger[_256Bit]
|
| 20 |
+
float80 = np.floating[_80Bit]
|
| 21 |
+
float96 = np.floating[_96Bit]
|
| 22 |
+
float128 = np.floating[_128Bit]
|
| 23 |
+
float256 = np.floating[_256Bit]
|
| 24 |
+
complex160 = np.complexfloating[_80Bit, _80Bit]
|
| 25 |
+
complex192 = np.complexfloating[_96Bit, _96Bit]
|
| 26 |
+
complex256 = np.complexfloating[_128Bit, _128Bit]
|
| 27 |
+
complex512 = np.complexfloating[_256Bit, _256Bit]
|
.venv311/Lib/site-packages/numpy/_typing/_nbit.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with the precisions of platform-specific `~numpy.number`s."""
|
| 2 |
+
|
| 3 |
+
from typing import Any
|
| 4 |
+
|
| 5 |
+
# To-be replaced with a `npt.NBitBase` subclass by numpy's mypy plugin
|
| 6 |
+
_NBitByte = Any
|
| 7 |
+
_NBitShort = Any
|
| 8 |
+
_NBitIntC = Any
|
| 9 |
+
_NBitIntP = Any
|
| 10 |
+
_NBitInt = Any
|
| 11 |
+
_NBitLongLong = Any
|
| 12 |
+
|
| 13 |
+
_NBitHalf = Any
|
| 14 |
+
_NBitSingle = Any
|
| 15 |
+
_NBitDouble = Any
|
| 16 |
+
_NBitLongDouble = Any
|
.venv311/Lib/site-packages/numpy/_typing/_nested_sequence.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module containing the `_NestedSequence` protocol."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from collections.abc import Iterator
|
| 6 |
+
from typing import (
|
| 7 |
+
Any,
|
| 8 |
+
TypeVar,
|
| 9 |
+
Protocol,
|
| 10 |
+
runtime_checkable,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
__all__ = ["_NestedSequence"]
|
| 14 |
+
|
| 15 |
+
_T_co = TypeVar("_T_co", covariant=True)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@runtime_checkable
|
| 19 |
+
class _NestedSequence(Protocol[_T_co]):
|
| 20 |
+
"""A protocol for representing nested sequences.
|
| 21 |
+
|
| 22 |
+
Warning
|
| 23 |
+
-------
|
| 24 |
+
`_NestedSequence` currently does not work in combination with typevars,
|
| 25 |
+
*e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.
|
| 26 |
+
|
| 27 |
+
See Also
|
| 28 |
+
--------
|
| 29 |
+
collections.abc.Sequence
|
| 30 |
+
ABCs for read-only and mutable :term:`sequences`.
|
| 31 |
+
|
| 32 |
+
Examples
|
| 33 |
+
--------
|
| 34 |
+
.. code-block:: python
|
| 35 |
+
|
| 36 |
+
>>> from __future__ import annotations
|
| 37 |
+
|
| 38 |
+
>>> from typing import TYPE_CHECKING
|
| 39 |
+
>>> import numpy as np
|
| 40 |
+
>>> from numpy._typing import _NestedSequence
|
| 41 |
+
|
| 42 |
+
>>> def get_dtype(seq: _NestedSequence[float]) -> np.dtype[np.float64]:
|
| 43 |
+
... return np.asarray(seq).dtype
|
| 44 |
+
|
| 45 |
+
>>> a = get_dtype([1.0])
|
| 46 |
+
>>> b = get_dtype([[1.0]])
|
| 47 |
+
>>> c = get_dtype([[[1.0]]])
|
| 48 |
+
>>> d = get_dtype([[[[1.0]]]])
|
| 49 |
+
|
| 50 |
+
>>> if TYPE_CHECKING:
|
| 51 |
+
... reveal_locals()
|
| 52 |
+
... # note: Revealed local types are:
|
| 53 |
+
... # note: a: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 54 |
+
... # note: b: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 55 |
+
... # note: c: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 56 |
+
... # note: d: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 57 |
+
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
def __len__(self, /) -> int:
|
| 61 |
+
"""Implement ``len(self)``."""
|
| 62 |
+
raise NotImplementedError
|
| 63 |
+
|
| 64 |
+
def __getitem__(self, index: int, /) -> _T_co | _NestedSequence[_T_co]:
|
| 65 |
+
"""Implement ``self[x]``."""
|
| 66 |
+
raise NotImplementedError
|
| 67 |
+
|
| 68 |
+
def __contains__(self, x: object, /) -> bool:
|
| 69 |
+
"""Implement ``x in self``."""
|
| 70 |
+
raise NotImplementedError
|
| 71 |
+
|
| 72 |
+
def __iter__(self, /) -> Iterator[_T_co | _NestedSequence[_T_co]]:
|
| 73 |
+
"""Implement ``iter(self)``."""
|
| 74 |
+
raise NotImplementedError
|
| 75 |
+
|
| 76 |
+
def __reversed__(self, /) -> Iterator[_T_co | _NestedSequence[_T_co]]:
|
| 77 |
+
"""Implement ``reversed(self)``."""
|
| 78 |
+
raise NotImplementedError
|
| 79 |
+
|
| 80 |
+
def count(self, value: Any, /) -> int:
|
| 81 |
+
"""Return the number of occurrences of `value`."""
|
| 82 |
+
raise NotImplementedError
|
| 83 |
+
|
| 84 |
+
def index(self, value: Any, /) -> int:
|
| 85 |
+
"""Return the first index of `value`."""
|
| 86 |
+
raise NotImplementedError
|
.venv311/Lib/site-packages/numpy/_typing/_scalars.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Union, Any
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and
|
| 6 |
+
# `np.bytes_` are already subclasses of their builtin counterpart
|
| 7 |
+
|
| 8 |
+
_CharLike_co = Union[str, bytes]
|
| 9 |
+
|
| 10 |
+
# The 6 `<X>Like_co` type-aliases below represent all scalars that can be
|
| 11 |
+
# coerced into `<X>` (with the casting rule `same_kind`)
|
| 12 |
+
_BoolLike_co = Union[bool, np.bool_]
|
| 13 |
+
_UIntLike_co = Union[_BoolLike_co, np.unsignedinteger[Any]]
|
| 14 |
+
_IntLike_co = Union[_BoolLike_co, int, np.integer[Any]]
|
| 15 |
+
_FloatLike_co = Union[_IntLike_co, float, np.floating[Any]]
|
| 16 |
+
_ComplexLike_co = Union[_FloatLike_co, complex, np.complexfloating[Any, Any]]
|
| 17 |
+
_TD64Like_co = Union[_IntLike_co, np.timedelta64]
|
| 18 |
+
|
| 19 |
+
_NumberLike_co = Union[int, float, complex, np.number[Any], np.bool_]
|
| 20 |
+
_ScalarLike_co = Union[
|
| 21 |
+
int,
|
| 22 |
+
float,
|
| 23 |
+
complex,
|
| 24 |
+
str,
|
| 25 |
+
bytes,
|
| 26 |
+
np.generic,
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
# `_VoidLike_co` is technically not a scalar, but it's close enough
|
| 30 |
+
_VoidLike_co = Union[tuple[Any, ...], np.void]
|
.venv311/Lib/site-packages/numpy/_typing/_shape.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence
|
| 2 |
+
from typing import Union, SupportsIndex
|
| 3 |
+
|
| 4 |
+
_Shape = tuple[int, ...]
|
| 5 |
+
|
| 6 |
+
# Anything that can be coerced to a shape tuple
|
| 7 |
+
_ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]
|
.venv311/Lib/site-packages/numpy/_typing/_ufunc.pyi
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
| 1 |
+
"""A module with private type-check-only `numpy.ufunc` subclasses.
|
| 2 |
+
|
| 3 |
+
The signatures of the ufuncs are too varied to reasonably type
|
| 4 |
+
with a single class. So instead, `ufunc` has been expanded into
|
| 5 |
+
four private subclasses, one for each combination of
|
| 6 |
+
`~ufunc.nin` and `~ufunc.nout`.
|
| 7 |
+
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from typing import (
|
| 11 |
+
Any,
|
| 12 |
+
Generic,
|
| 13 |
+
overload,
|
| 14 |
+
TypeVar,
|
| 15 |
+
Literal,
|
| 16 |
+
SupportsIndex,
|
| 17 |
+
Protocol,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
from numpy import ufunc, _CastingKind, _OrderKACF
|
| 21 |
+
from numpy.typing import NDArray
|
| 22 |
+
|
| 23 |
+
from ._shape import _ShapeLike
|
| 24 |
+
from ._scalars import _ScalarLike_co
|
| 25 |
+
from ._array_like import ArrayLike, _ArrayLikeBool_co, _ArrayLikeInt_co
|
| 26 |
+
from ._dtype_like import DTypeLike
|
| 27 |
+
|
| 28 |
+
_T = TypeVar("_T")
|
| 29 |
+
_2Tuple = tuple[_T, _T]
|
| 30 |
+
_3Tuple = tuple[_T, _T, _T]
|
| 31 |
+
_4Tuple = tuple[_T, _T, _T, _T]
|
| 32 |
+
|
| 33 |
+
_NTypes = TypeVar("_NTypes", bound=int)
|
| 34 |
+
_IDType = TypeVar("_IDType", bound=Any)
|
| 35 |
+
_NameType = TypeVar("_NameType", bound=str)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class _SupportsArrayUFunc(Protocol):
|
| 39 |
+
def __array_ufunc__(
|
| 40 |
+
self,
|
| 41 |
+
ufunc: ufunc,
|
| 42 |
+
method: Literal["__call__", "reduce", "reduceat", "accumulate", "outer", "inner"],
|
| 43 |
+
*inputs: Any,
|
| 44 |
+
**kwargs: Any,
|
| 45 |
+
) -> Any: ...
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
# NOTE: In reality `extobj` should be a length of list 3 containing an
|
| 49 |
+
# int, an int, and a callable, but there's no way to properly express
|
| 50 |
+
# non-homogenous lists.
|
| 51 |
+
# Use `Any` over `Union` to avoid issues related to lists invariance.
|
| 52 |
+
|
| 53 |
+
# NOTE: `reduce`, `accumulate`, `reduceat` and `outer` raise a ValueError for
|
| 54 |
+
# ufuncs that don't accept two input arguments and return one output argument.
|
| 55 |
+
# In such cases the respective methods are simply typed as `None`.
|
| 56 |
+
|
| 57 |
+
# NOTE: Similarly, `at` won't be defined for ufuncs that return
|
| 58 |
+
# multiple outputs; in such cases `at` is typed as `None`
|
| 59 |
+
|
| 60 |
+
# NOTE: If 2 output types are returned then `out` must be a
|
| 61 |
+
# 2-tuple of arrays. Otherwise `None` or a plain array are also acceptable
|
| 62 |
+
|
| 63 |
+
class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 64 |
+
@property
|
| 65 |
+
def __name__(self) -> _NameType: ...
|
| 66 |
+
@property
|
| 67 |
+
def ntypes(self) -> _NTypes: ...
|
| 68 |
+
@property
|
| 69 |
+
def identity(self) -> _IDType: ...
|
| 70 |
+
@property
|
| 71 |
+
def nin(self) -> Literal[1]: ...
|
| 72 |
+
@property
|
| 73 |
+
def nout(self) -> Literal[1]: ...
|
| 74 |
+
@property
|
| 75 |
+
def nargs(self) -> Literal[2]: ...
|
| 76 |
+
@property
|
| 77 |
+
def signature(self) -> None: ...
|
| 78 |
+
@property
|
| 79 |
+
def reduce(self) -> None: ...
|
| 80 |
+
@property
|
| 81 |
+
def accumulate(self) -> None: ...
|
| 82 |
+
@property
|
| 83 |
+
def reduceat(self) -> None: ...
|
| 84 |
+
@property
|
| 85 |
+
def outer(self) -> None: ...
|
| 86 |
+
|
| 87 |
+
@overload
|
| 88 |
+
def __call__(
|
| 89 |
+
self,
|
| 90 |
+
__x1: _ScalarLike_co,
|
| 91 |
+
out: None = ...,
|
| 92 |
+
*,
|
| 93 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 94 |
+
casting: _CastingKind = ...,
|
| 95 |
+
order: _OrderKACF = ...,
|
| 96 |
+
dtype: DTypeLike = ...,
|
| 97 |
+
subok: bool = ...,
|
| 98 |
+
signature: str | _2Tuple[None | str] = ...,
|
| 99 |
+
extobj: list[Any] = ...,
|
| 100 |
+
) -> Any: ...
|
| 101 |
+
@overload
|
| 102 |
+
def __call__(
|
| 103 |
+
self,
|
| 104 |
+
__x1: ArrayLike,
|
| 105 |
+
out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
|
| 106 |
+
*,
|
| 107 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 108 |
+
casting: _CastingKind = ...,
|
| 109 |
+
order: _OrderKACF = ...,
|
| 110 |
+
dtype: DTypeLike = ...,
|
| 111 |
+
subok: bool = ...,
|
| 112 |
+
signature: str | _2Tuple[None | str] = ...,
|
| 113 |
+
extobj: list[Any] = ...,
|
| 114 |
+
) -> NDArray[Any]: ...
|
| 115 |
+
@overload
|
| 116 |
+
def __call__(
|
| 117 |
+
self,
|
| 118 |
+
__x1: _SupportsArrayUFunc,
|
| 119 |
+
out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
|
| 120 |
+
*,
|
| 121 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 122 |
+
casting: _CastingKind = ...,
|
| 123 |
+
order: _OrderKACF = ...,
|
| 124 |
+
dtype: DTypeLike = ...,
|
| 125 |
+
subok: bool = ...,
|
| 126 |
+
signature: str | _2Tuple[None | str] = ...,
|
| 127 |
+
extobj: list[Any] = ...,
|
| 128 |
+
) -> Any: ...
|
| 129 |
+
|
| 130 |
+
def at(
|
| 131 |
+
self,
|
| 132 |
+
a: _SupportsArrayUFunc,
|
| 133 |
+
indices: _ArrayLikeInt_co,
|
| 134 |
+
/,
|
| 135 |
+
) -> None: ...
|
| 136 |
+
|
| 137 |
+
class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 138 |
+
@property
|
| 139 |
+
def __name__(self) -> _NameType: ...
|
| 140 |
+
@property
|
| 141 |
+
def ntypes(self) -> _NTypes: ...
|
| 142 |
+
@property
|
| 143 |
+
def identity(self) -> _IDType: ...
|
| 144 |
+
@property
|
| 145 |
+
def nin(self) -> Literal[2]: ...
|
| 146 |
+
@property
|
| 147 |
+
def nout(self) -> Literal[1]: ...
|
| 148 |
+
@property
|
| 149 |
+
def nargs(self) -> Literal[3]: ...
|
| 150 |
+
@property
|
| 151 |
+
def signature(self) -> None: ...
|
| 152 |
+
|
| 153 |
+
@overload
|
| 154 |
+
def __call__(
|
| 155 |
+
self,
|
| 156 |
+
__x1: _ScalarLike_co,
|
| 157 |
+
__x2: _ScalarLike_co,
|
| 158 |
+
out: None = ...,
|
| 159 |
+
*,
|
| 160 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 161 |
+
casting: _CastingKind = ...,
|
| 162 |
+
order: _OrderKACF = ...,
|
| 163 |
+
dtype: DTypeLike = ...,
|
| 164 |
+
subok: bool = ...,
|
| 165 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 166 |
+
extobj: list[Any] = ...,
|
| 167 |
+
) -> Any: ...
|
| 168 |
+
@overload
|
| 169 |
+
def __call__(
|
| 170 |
+
self,
|
| 171 |
+
__x1: ArrayLike,
|
| 172 |
+
__x2: ArrayLike,
|
| 173 |
+
out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
|
| 174 |
+
*,
|
| 175 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 176 |
+
casting: _CastingKind = ...,
|
| 177 |
+
order: _OrderKACF = ...,
|
| 178 |
+
dtype: DTypeLike = ...,
|
| 179 |
+
subok: bool = ...,
|
| 180 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 181 |
+
extobj: list[Any] = ...,
|
| 182 |
+
) -> NDArray[Any]: ...
|
| 183 |
+
|
| 184 |
+
def at(
|
| 185 |
+
self,
|
| 186 |
+
a: NDArray[Any],
|
| 187 |
+
indices: _ArrayLikeInt_co,
|
| 188 |
+
b: ArrayLike,
|
| 189 |
+
/,
|
| 190 |
+
) -> None: ...
|
| 191 |
+
|
| 192 |
+
def reduce(
|
| 193 |
+
self,
|
| 194 |
+
array: ArrayLike,
|
| 195 |
+
axis: None | _ShapeLike = ...,
|
| 196 |
+
dtype: DTypeLike = ...,
|
| 197 |
+
out: None | NDArray[Any] = ...,
|
| 198 |
+
keepdims: bool = ...,
|
| 199 |
+
initial: Any = ...,
|
| 200 |
+
where: _ArrayLikeBool_co = ...,
|
| 201 |
+
) -> Any: ...
|
| 202 |
+
|
| 203 |
+
def accumulate(
|
| 204 |
+
self,
|
| 205 |
+
array: ArrayLike,
|
| 206 |
+
axis: SupportsIndex = ...,
|
| 207 |
+
dtype: DTypeLike = ...,
|
| 208 |
+
out: None | NDArray[Any] = ...,
|
| 209 |
+
) -> NDArray[Any]: ...
|
| 210 |
+
|
| 211 |
+
def reduceat(
|
| 212 |
+
self,
|
| 213 |
+
array: ArrayLike,
|
| 214 |
+
indices: _ArrayLikeInt_co,
|
| 215 |
+
axis: SupportsIndex = ...,
|
| 216 |
+
dtype: DTypeLike = ...,
|
| 217 |
+
out: None | NDArray[Any] = ...,
|
| 218 |
+
) -> NDArray[Any]: ...
|
| 219 |
+
|
| 220 |
+
# Expand `**kwargs` into explicit keyword-only arguments
|
| 221 |
+
@overload
|
| 222 |
+
def outer(
|
| 223 |
+
self,
|
| 224 |
+
A: _ScalarLike_co,
|
| 225 |
+
B: _ScalarLike_co,
|
| 226 |
+
/, *,
|
| 227 |
+
out: None = ...,
|
| 228 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 229 |
+
casting: _CastingKind = ...,
|
| 230 |
+
order: _OrderKACF = ...,
|
| 231 |
+
dtype: DTypeLike = ...,
|
| 232 |
+
subok: bool = ...,
|
| 233 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 234 |
+
extobj: list[Any] = ...,
|
| 235 |
+
) -> Any: ...
|
| 236 |
+
@overload
|
| 237 |
+
def outer( # type: ignore[misc]
|
| 238 |
+
self,
|
| 239 |
+
A: ArrayLike,
|
| 240 |
+
B: ArrayLike,
|
| 241 |
+
/, *,
|
| 242 |
+
out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
|
| 243 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 244 |
+
casting: _CastingKind = ...,
|
| 245 |
+
order: _OrderKACF = ...,
|
| 246 |
+
dtype: DTypeLike = ...,
|
| 247 |
+
subok: bool = ...,
|
| 248 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 249 |
+
extobj: list[Any] = ...,
|
| 250 |
+
) -> NDArray[Any]: ...
|
| 251 |
+
|
| 252 |
+
class _UFunc_Nin1_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 253 |
+
@property
|
| 254 |
+
def __name__(self) -> _NameType: ...
|
| 255 |
+
@property
|
| 256 |
+
def ntypes(self) -> _NTypes: ...
|
| 257 |
+
@property
|
| 258 |
+
def identity(self) -> _IDType: ...
|
| 259 |
+
@property
|
| 260 |
+
def nin(self) -> Literal[1]: ...
|
| 261 |
+
@property
|
| 262 |
+
def nout(self) -> Literal[2]: ...
|
| 263 |
+
@property
|
| 264 |
+
def nargs(self) -> Literal[3]: ...
|
| 265 |
+
@property
|
| 266 |
+
def signature(self) -> None: ...
|
| 267 |
+
@property
|
| 268 |
+
def at(self) -> None: ...
|
| 269 |
+
@property
|
| 270 |
+
def reduce(self) -> None: ...
|
| 271 |
+
@property
|
| 272 |
+
def accumulate(self) -> None: ...
|
| 273 |
+
@property
|
| 274 |
+
def reduceat(self) -> None: ...
|
| 275 |
+
@property
|
| 276 |
+
def outer(self) -> None: ...
|
| 277 |
+
|
| 278 |
+
@overload
|
| 279 |
+
def __call__(
|
| 280 |
+
self,
|
| 281 |
+
__x1: _ScalarLike_co,
|
| 282 |
+
__out1: None = ...,
|
| 283 |
+
__out2: None = ...,
|
| 284 |
+
*,
|
| 285 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 286 |
+
casting: _CastingKind = ...,
|
| 287 |
+
order: _OrderKACF = ...,
|
| 288 |
+
dtype: DTypeLike = ...,
|
| 289 |
+
subok: bool = ...,
|
| 290 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 291 |
+
extobj: list[Any] = ...,
|
| 292 |
+
) -> _2Tuple[Any]: ...
|
| 293 |
+
@overload
|
| 294 |
+
def __call__(
|
| 295 |
+
self,
|
| 296 |
+
__x1: ArrayLike,
|
| 297 |
+
__out1: None | NDArray[Any] = ...,
|
| 298 |
+
__out2: None | NDArray[Any] = ...,
|
| 299 |
+
*,
|
| 300 |
+
out: _2Tuple[NDArray[Any]] = ...,
|
| 301 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 302 |
+
casting: _CastingKind = ...,
|
| 303 |
+
order: _OrderKACF = ...,
|
| 304 |
+
dtype: DTypeLike = ...,
|
| 305 |
+
subok: bool = ...,
|
| 306 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 307 |
+
extobj: list[Any] = ...,
|
| 308 |
+
) -> _2Tuple[NDArray[Any]]: ...
|
| 309 |
+
@overload
|
| 310 |
+
def __call__(
|
| 311 |
+
self,
|
| 312 |
+
__x1: _SupportsArrayUFunc,
|
| 313 |
+
__out1: None | NDArray[Any] = ...,
|
| 314 |
+
__out2: None | NDArray[Any] = ...,
|
| 315 |
+
*,
|
| 316 |
+
out: _2Tuple[NDArray[Any]] = ...,
|
| 317 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 318 |
+
casting: _CastingKind = ...,
|
| 319 |
+
order: _OrderKACF = ...,
|
| 320 |
+
dtype: DTypeLike = ...,
|
| 321 |
+
subok: bool = ...,
|
| 322 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 323 |
+
extobj: list[Any] = ...,
|
| 324 |
+
) -> _2Tuple[Any]: ...
|
| 325 |
+
|
| 326 |
+
class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 327 |
+
@property
|
| 328 |
+
def __name__(self) -> _NameType: ...
|
| 329 |
+
@property
|
| 330 |
+
def ntypes(self) -> _NTypes: ...
|
| 331 |
+
@property
|
| 332 |
+
def identity(self) -> _IDType: ...
|
| 333 |
+
@property
|
| 334 |
+
def nin(self) -> Literal[2]: ...
|
| 335 |
+
@property
|
| 336 |
+
def nout(self) -> Literal[2]: ...
|
| 337 |
+
@property
|
| 338 |
+
def nargs(self) -> Literal[4]: ...
|
| 339 |
+
@property
|
| 340 |
+
def signature(self) -> None: ...
|
| 341 |
+
@property
|
| 342 |
+
def at(self) -> None: ...
|
| 343 |
+
@property
|
| 344 |
+
def reduce(self) -> None: ...
|
| 345 |
+
@property
|
| 346 |
+
def accumulate(self) -> None: ...
|
| 347 |
+
@property
|
| 348 |
+
def reduceat(self) -> None: ...
|
| 349 |
+
@property
|
| 350 |
+
def outer(self) -> None: ...
|
| 351 |
+
|
| 352 |
+
@overload
|
| 353 |
+
def __call__(
|
| 354 |
+
self,
|
| 355 |
+
__x1: _ScalarLike_co,
|
| 356 |
+
__x2: _ScalarLike_co,
|
| 357 |
+
__out1: None = ...,
|
| 358 |
+
__out2: None = ...,
|
| 359 |
+
*,
|
| 360 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 361 |
+
casting: _CastingKind = ...,
|
| 362 |
+
order: _OrderKACF = ...,
|
| 363 |
+
dtype: DTypeLike = ...,
|
| 364 |
+
subok: bool = ...,
|
| 365 |
+
signature: str | _4Tuple[None | str] = ...,
|
| 366 |
+
extobj: list[Any] = ...,
|
| 367 |
+
) -> _2Tuple[Any]: ...
|
| 368 |
+
@overload
|
| 369 |
+
def __call__(
|
| 370 |
+
self,
|
| 371 |
+
__x1: ArrayLike,
|
| 372 |
+
__x2: ArrayLike,
|
| 373 |
+
__out1: None | NDArray[Any] = ...,
|
| 374 |
+
__out2: None | NDArray[Any] = ...,
|
| 375 |
+
*,
|
| 376 |
+
out: _2Tuple[NDArray[Any]] = ...,
|
| 377 |
+
where: None | _ArrayLikeBool_co = ...,
|
| 378 |
+
casting: _CastingKind = ...,
|
| 379 |
+
order: _OrderKACF = ...,
|
| 380 |
+
dtype: DTypeLike = ...,
|
| 381 |
+
subok: bool = ...,
|
| 382 |
+
signature: str | _4Tuple[None | str] = ...,
|
| 383 |
+
extobj: list[Any] = ...,
|
| 384 |
+
) -> _2Tuple[NDArray[Any]]: ...
|
| 385 |
+
|
| 386 |
+
class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 387 |
+
@property
|
| 388 |
+
def __name__(self) -> _NameType: ...
|
| 389 |
+
@property
|
| 390 |
+
def ntypes(self) -> _NTypes: ...
|
| 391 |
+
@property
|
| 392 |
+
def identity(self) -> _IDType: ...
|
| 393 |
+
@property
|
| 394 |
+
def nin(self) -> Literal[2]: ...
|
| 395 |
+
@property
|
| 396 |
+
def nout(self) -> Literal[1]: ...
|
| 397 |
+
@property
|
| 398 |
+
def nargs(self) -> Literal[3]: ...
|
| 399 |
+
|
| 400 |
+
# NOTE: In practice the only gufunc in the main namespace is `matmul`,
|
| 401 |
+
# so we can use its signature here
|
| 402 |
+
@property
|
| 403 |
+
def signature(self) -> Literal["(n?,k),(k,m?)->(n?,m?)"]: ...
|
| 404 |
+
@property
|
| 405 |
+
def reduce(self) -> None: ...
|
| 406 |
+
@property
|
| 407 |
+
def accumulate(self) -> None: ...
|
| 408 |
+
@property
|
| 409 |
+
def reduceat(self) -> None: ...
|
| 410 |
+
@property
|
| 411 |
+
def outer(self) -> None: ...
|
| 412 |
+
@property
|
| 413 |
+
def at(self) -> None: ...
|
| 414 |
+
|
| 415 |
+
# Scalar for 1D array-likes; ndarray otherwise
|
| 416 |
+
@overload
|
| 417 |
+
def __call__(
|
| 418 |
+
self,
|
| 419 |
+
__x1: ArrayLike,
|
| 420 |
+
__x2: ArrayLike,
|
| 421 |
+
out: None = ...,
|
| 422 |
+
*,
|
| 423 |
+
casting: _CastingKind = ...,
|
| 424 |
+
order: _OrderKACF = ...,
|
| 425 |
+
dtype: DTypeLike = ...,
|
| 426 |
+
subok: bool = ...,
|
| 427 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 428 |
+
extobj: list[Any] = ...,
|
| 429 |
+
axes: list[_2Tuple[SupportsIndex]] = ...,
|
| 430 |
+
) -> Any: ...
|
| 431 |
+
@overload
|
| 432 |
+
def __call__(
|
| 433 |
+
self,
|
| 434 |
+
__x1: ArrayLike,
|
| 435 |
+
__x2: ArrayLike,
|
| 436 |
+
out: NDArray[Any] | tuple[NDArray[Any]],
|
| 437 |
+
*,
|
| 438 |
+
casting: _CastingKind = ...,
|
| 439 |
+
order: _OrderKACF = ...,
|
| 440 |
+
dtype: DTypeLike = ...,
|
| 441 |
+
subok: bool = ...,
|
| 442 |
+
signature: str | _3Tuple[None | str] = ...,
|
| 443 |
+
extobj: list[Any] = ...,
|
| 444 |
+
axes: list[_2Tuple[SupportsIndex]] = ...,
|
| 445 |
+
) -> NDArray[Any]: ...
|
.venv311/Lib/site-packages/numpy/_typing/setup.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def configuration(parent_package='', top_path=None):
|
| 2 |
+
from numpy.distutils.misc_util import Configuration
|
| 3 |
+
config = Configuration('_typing', parent_package, top_path)
|
| 4 |
+
config.add_data_files('*.pyi')
|
| 5 |
+
return config
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
from numpy.distutils.core import setup
|
| 10 |
+
setup(configuration=configuration)
|
.venv311/Lib/site-packages/numpy/_utils/__init__.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This is a module for defining private helpers which do not depend on the
|
| 3 |
+
rest of NumPy.
|
| 4 |
+
|
| 5 |
+
Everything in here must be self-contained so that it can be
|
| 6 |
+
imported anywhere else without creating circular imports.
|
| 7 |
+
If a utility requires the import of NumPy, it probably belongs
|
| 8 |
+
in ``numpy.core``.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from ._convertions import asunicode, asbytes
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def set_module(module):
|
| 15 |
+
"""Private decorator for overriding __module__ on a function or class.
|
| 16 |
+
|
| 17 |
+
Example usage::
|
| 18 |
+
|
| 19 |
+
@set_module('numpy')
|
| 20 |
+
def example():
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
+
assert example.__module__ == 'numpy'
|
| 24 |
+
"""
|
| 25 |
+
def decorator(func):
|
| 26 |
+
if module is not None:
|
| 27 |
+
func.__module__ = module
|
| 28 |
+
return func
|
| 29 |
+
return decorator
|
.venv311/Lib/site-packages/numpy/_utils/_convertions.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A set of methods retained from np.compat module that
|
| 3 |
+
are still used across codebase.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
__all__ = ["asunicode", "asbytes"]
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def asunicode(s):
|
| 10 |
+
if isinstance(s, bytes):
|
| 11 |
+
return s.decode('latin1')
|
| 12 |
+
return str(s)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def asbytes(s):
|
| 16 |
+
if isinstance(s, b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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Subset of inspect module from upstream python
|
| 2 |
+
|
| 3 |
+
We use this instead of upstream because upstream inspect is slow to import, and
|
| 4 |
+
significantly contributes to numpy import times. Importing this copy has almost
|
| 5 |
+
no overhead.
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
import types
|
| 9 |
+
|
| 10 |
+
__all__ = ['getargspec', 'formatargspec']
|
| 11 |
+
|
| 12 |
+
# ----------------------------------------------------------- type-checking
|
| 13 |
+
def ismethod(object):
|
| 14 |
+
"""Return true if the object is an instance method.
|
| 15 |
+
|
| 16 |
+
Instance method objects provide these attributes:
|
| 17 |
+
__doc__ documentation string
|
| 18 |
+
__name__ name with which this method was defined
|
| 19 |
+
im_class class object in which this method belongs
|
| 20 |
+
im_func function object containing implementation of method
|
| 21 |
+
im_self instance to which this method is bound, or None
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
return isinstance(object, types.MethodType)
|
| 25 |
+
|
| 26 |
+
def isfunction(object):
|
| 27 |
+
"""Return true if the object is a user-defined function.
|
| 28 |
+
|
| 29 |
+
Function objects provide these attributes:
|
| 30 |
+
__doc__ documentation string
|
| 31 |
+
__name__ name with which this function was defined
|
| 32 |
+
func_code code object containing compiled function bytecode
|
| 33 |
+
func_defaults tuple of any default values for arguments
|
| 34 |
+
func_doc (same as __doc__)
|
| 35 |
+
func_globals global namespace in which this function was defined
|
| 36 |
+
func_name (same as __name__)
|
| 37 |
+
|
| 38 |
+
"""
|
| 39 |
+
return isinstance(object, types.FunctionType)
|
| 40 |
+
|
| 41 |
+
def iscode(object):
|
| 42 |
+
"""Return true if the object is a code object.
|
| 43 |
+
|
| 44 |
+
Code objects provide these attributes:
|
| 45 |
+
co_argcount number of arguments (not including * or ** args)
|
| 46 |
+
co_code string of raw compiled bytecode
|
| 47 |
+
co_consts tuple of constants used in the bytecode
|
| 48 |
+
co_filename name of file in which this code object was created
|
| 49 |
+
co_firstlineno number of first line in Python source code
|
| 50 |
+
co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
|
| 51 |
+
co_lnotab encoded mapping of line numbers to bytecode indices
|
| 52 |
+
co_name name with which this code object was defined
|
| 53 |
+
co_names tuple of names of local variables
|
| 54 |
+
co_nlocals number of local variables
|
| 55 |
+
co_stacksize virtual machine stack space required
|
| 56 |
+
co_varnames tuple of names of arguments and local variables
|
| 57 |
+
|
| 58 |
+
"""
|
| 59 |
+
return isinstance(object, types.CodeType)
|
| 60 |
+
|
| 61 |
+
# ------------------------------------------------ argument list extraction
|
| 62 |
+
# These constants are from Python's compile.h.
|
| 63 |
+
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 1, 2, 4, 8
|
| 64 |
+
|
| 65 |
+
def getargs(co):
|
| 66 |
+
"""Get information about the arguments accepted by a code object.
|
| 67 |
+
|
| 68 |
+
Three things are returned: (args, varargs, varkw), where 'args' is
|
| 69 |
+
a list of argument names (possibly containing nested lists), and
|
| 70 |
+
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
| 71 |
+
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
if not iscode(co):
|
| 75 |
+
raise TypeError('arg is not a code object')
|
| 76 |
+
|
| 77 |
+
nargs = co.co_argcount
|
| 78 |
+
names = co.co_varnames
|
| 79 |
+
args = list(names[:nargs])
|
| 80 |
+
|
| 81 |
+
# The following acrobatics are for anonymous (tuple) arguments.
|
| 82 |
+
# Which we do not need to support, so remove to avoid importing
|
| 83 |
+
# the dis module.
|
| 84 |
+
for i in range(nargs):
|
| 85 |
+
if args[i][:1] in ['', '.']:
|
| 86 |
+
raise TypeError("tuple function arguments are not supported")
|
| 87 |
+
varargs = None
|
| 88 |
+
if co.co_flags & CO_VARARGS:
|
| 89 |
+
varargs = co.co_varnames[nargs]
|
| 90 |
+
nargs = nargs + 1
|
| 91 |
+
varkw = None
|
| 92 |
+
if co.co_flags & CO_VARKEYWORDS:
|
| 93 |
+
varkw = co.co_varnames[nargs]
|
| 94 |
+
return args, varargs, varkw
|
| 95 |
+
|
| 96 |
+
def getargspec(func):
|
| 97 |
+
"""Get the names and default values of a function's arguments.
|
| 98 |
+
|
| 99 |
+
A tuple of four things is returned: (args, varargs, varkw, defaults).
|
| 100 |
+
'args' is a list of the argument names (it may contain nested lists).
|
| 101 |
+
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
| 102 |
+
'defaults' is an n-tuple of the default values of the last n arguments.
|
| 103 |
+
|
| 104 |
+
"""
|
| 105 |
+
|
| 106 |
+
if ismethod(func):
|
| 107 |
+
func = func.__func__
|
| 108 |
+
if not isfunction(func):
|
| 109 |
+
raise TypeError('arg is not a Python function')
|
| 110 |
+
args, varargs, varkw = getargs(func.__code__)
|
| 111 |
+
return args, varargs, varkw, func.__defaults__
|
| 112 |
+
|
| 113 |
+
def getargvalues(frame):
|
| 114 |
+
"""Get information about arguments passed into a particular frame.
|
| 115 |
+
|
| 116 |
+
A tuple of four things is returned: (args, varargs, varkw, locals).
|
| 117 |
+
'args' is a list of the argument names (it may contain nested lists).
|
| 118 |
+
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
| 119 |
+
'locals' is the locals dictionary of the given frame.
|
| 120 |
+
|
| 121 |
+
"""
|
| 122 |
+
args, varargs, varkw = getargs(frame.f_code)
|
| 123 |
+
return args, varargs, varkw, frame.f_locals
|
| 124 |
+
|
| 125 |
+
def joinseq(seq):
|
| 126 |
+
if len(seq) == 1:
|
| 127 |
+
return '(' + seq[0] + ',)'
|
| 128 |
+
else:
|
| 129 |
+
return '(' + ', '.join(seq) + ')'
|
| 130 |
+
|
| 131 |
+
def strseq(object, convert, join=joinseq):
|
| 132 |
+
"""Recursively walk a sequence, stringifying each element.
|
| 133 |
+
|
| 134 |
+
"""
|
| 135 |
+
if type(object) in [list, tuple]:
|
| 136 |
+
return join([strseq(_o, convert, join) for _o in object])
|
| 137 |
+
else:
|
| 138 |
+
return convert(object)
|
| 139 |
+
|
| 140 |
+
def formatargspec(args, varargs=None, varkw=None, defaults=None,
|
| 141 |
+
formatarg=str,
|
| 142 |
+
formatvarargs=lambda name: '*' + name,
|
| 143 |
+
formatvarkw=lambda name: '**' + name,
|
| 144 |
+
formatvalue=lambda value: '=' + repr(value),
|
| 145 |
+
join=joinseq):
|
| 146 |
+
"""Format an argument spec from the 4 values returned by getargspec.
|
| 147 |
+
|
| 148 |
+
The first four arguments are (args, varargs, varkw, defaults). The
|
| 149 |
+
other four arguments are the corresponding optional formatting functions
|
| 150 |
+
that are called to turn names and values into strings. The ninth
|
| 151 |
+
argument is an optional function to format the sequence of arguments.
|
| 152 |
+
|
| 153 |
+
"""
|
| 154 |
+
specs = []
|
| 155 |
+
if defaults:
|
| 156 |
+
firstdefault = len(args) - len(defaults)
|
| 157 |
+
for i in range(len(args)):
|
| 158 |
+
spec = strseq(args[i], formatarg, join)
|
| 159 |
+
if defaults and i >= firstdefault:
|
| 160 |
+
spec = spec + formatvalue(defaults[i - firstdefault])
|
| 161 |
+
specs.append(spec)
|
| 162 |
+
if varargs is not None:
|
| 163 |
+
specs.append(formatvarargs(varargs))
|
| 164 |
+
if varkw is not None:
|
| 165 |
+
specs.append(formatvarkw(varkw))
|
| 166 |
+
return '(' + ', '.join(specs) + ')'
|
| 167 |
+
|
| 168 |
+
def formatargvalues(args, varargs, varkw, locals,
|
| 169 |
+
formatarg=str,
|
| 170 |
+
formatvarargs=lambda name: '*' + name,
|
| 171 |
+
formatvarkw=lambda name: '**' + name,
|
| 172 |
+
formatvalue=lambda value: '=' + repr(value),
|
| 173 |
+
join=joinseq):
|
| 174 |
+
"""Format an argument spec from the 4 values returned by getargvalues.
|
| 175 |
+
|
| 176 |
+
The first four arguments are (args, varargs, varkw, locals). The
|
| 177 |
+
next four arguments are the corresponding optional formatting functions
|
| 178 |
+
that are called to turn names and values into strings. The ninth
|
| 179 |
+
argument is an optional function to format the sequence of arguments.
|
| 180 |
+
|
| 181 |
+
"""
|
| 182 |
+
def convert(name, locals=locals,
|
| 183 |
+
formatarg=formatarg, formatvalue=formatvalue):
|
| 184 |
+
return formatarg(name) + formatvalue(locals[name])
|
| 185 |
+
specs = [strseq(arg, convert, join) for arg in args]
|
| 186 |
+
|
| 187 |
+
if varargs:
|
| 188 |
+
specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
|
| 189 |
+
if varkw:
|
| 190 |
+
specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
|
| 191 |
+
return '(' + ', '.join(specs) + ')'
|
.venv311/Lib/site-packages/numpy/_utils/_pep440.py
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Utility to compare pep440 compatible version strings.
|
| 2 |
+
|
| 3 |
+
The LooseVersion and StrictVersion classes that distutils provides don't
|
| 4 |
+
work; they don't recognize anything like alpha/beta/rc/dev versions.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
# Copyright (c) Donald Stufft and individual contributors.
|
| 8 |
+
# All rights reserved.
|
| 9 |
+
|
| 10 |
+
# Redistribution and use in source and binary forms, with or without
|
| 11 |
+
# modification, are permitted provided that the following conditions are met:
|
| 12 |
+
|
| 13 |
+
# 1. Redistributions of source code must retain the above copyright notice,
|
| 14 |
+
# this list of conditions and the following disclaimer.
|
| 15 |
+
|
| 16 |
+
# 2. Redistributions in binary form must reproduce the above copyright
|
| 17 |
+
# notice, this list of conditions and the following disclaimer in the
|
| 18 |
+
# documentation and/or other materials provided with the distribution.
|
| 19 |
+
|
| 20 |
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 21 |
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 22 |
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 23 |
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
| 24 |
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 25 |
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 26 |
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 27 |
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 28 |
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 29 |
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 30 |
+
# POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
|
| 32 |
+
import collections
|
| 33 |
+
import itertools
|
| 34 |
+
import re
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
__all__ = [
|
| 38 |
+
"parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN",
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# BEGIN packaging/_structures.py
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Infinity:
|
| 46 |
+
def __repr__(self):
|
| 47 |
+
return "Infinity"
|
| 48 |
+
|
| 49 |
+
def __hash__(self):
|
| 50 |
+
return hash(repr(self))
|
| 51 |
+
|
| 52 |
+
def __lt__(self, other):
|
| 53 |
+
return False
|
| 54 |
+
|
| 55 |
+
def __le__(self, other):
|
| 56 |
+
return False
|
| 57 |
+
|
| 58 |
+
def __eq__(self, other):
|
| 59 |
+
return isinstance(other, self.__class__)
|
| 60 |
+
|
| 61 |
+
def __ne__(self, other):
|
| 62 |
+
return not isinstance(other, self.__class__)
|
| 63 |
+
|
| 64 |
+
def __gt__(self, other):
|
| 65 |
+
return True
|
| 66 |
+
|
| 67 |
+
def __ge__(self, other):
|
| 68 |
+
return True
|
| 69 |
+
|
| 70 |
+
def __neg__(self):
|
| 71 |
+
return NegativeInfinity
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
Infinity = Infinity()
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class NegativeInfinity:
|
| 78 |
+
def __repr__(self):
|
| 79 |
+
return "-Infinity"
|
| 80 |
+
|
| 81 |
+
def __hash__(self):
|
| 82 |
+
return hash(repr(self))
|
| 83 |
+
|
| 84 |
+
def __lt__(self, other):
|
| 85 |
+
return True
|
| 86 |
+
|
| 87 |
+
def __le__(self, other):
|
| 88 |
+
return True
|
| 89 |
+
|
| 90 |
+
def __eq__(self, other):
|
| 91 |
+
return isinstance(other, self.__class__)
|
| 92 |
+
|
| 93 |
+
def __ne__(self, other):
|
| 94 |
+
return not isinstance(other, self.__class__)
|
| 95 |
+
|
| 96 |
+
def __gt__(self, other):
|
| 97 |
+
return False
|
| 98 |
+
|
| 99 |
+
def __ge__(self, other):
|
| 100 |
+
return False
|
| 101 |
+
|
| 102 |
+
def __neg__(self):
|
| 103 |
+
return Infinity
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
# BEGIN packaging/version.py
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
NegativeInfinity = NegativeInfinity()
|
| 110 |
+
|
| 111 |
+
_Version = collections.namedtuple(
|
| 112 |
+
"_Version",
|
| 113 |
+
["epoch", "release", "dev", "pre", "post", "local"],
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def parse(version):
|
| 118 |
+
"""
|
| 119 |
+
Parse the given version string and return either a :class:`Version` object
|
| 120 |
+
or a :class:`LegacyVersion` object depending on if the given version is
|
| 121 |
+
a valid PEP 440 version or a legacy version.
|
| 122 |
+
"""
|
| 123 |
+
try:
|
| 124 |
+
return Version(version)
|
| 125 |
+
except InvalidVersion:
|
| 126 |
+
return LegacyVersion(version)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class InvalidVersion(ValueError):
|
| 130 |
+
"""
|
| 131 |
+
An invalid version was found, users should refer to PEP 440.
|
| 132 |
+
"""
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class _BaseVersion:
|
| 136 |
+
|
| 137 |
+
def __hash__(self):
|
| 138 |
+
return hash(self._key)
|
| 139 |
+
|
| 140 |
+
def __lt__(self, other):
|
| 141 |
+
return self._compare(other, lambda s, o: s < o)
|
| 142 |
+
|
| 143 |
+
def __le__(self, other):
|
| 144 |
+
return self._compare(other, lambda s, o: s <= o)
|
| 145 |
+
|
| 146 |
+
def __eq__(self, other):
|
| 147 |
+
return self._compare(other, lambda s, o: s == o)
|
| 148 |
+
|
| 149 |
+
def __ge__(self, other):
|
| 150 |
+
return self._compare(other, lambda s, o: s >= o)
|
| 151 |
+
|
| 152 |
+
def __gt__(self, other):
|
| 153 |
+
return self._compare(other, lambda s, o: s > o)
|
| 154 |
+
|
| 155 |
+
def __ne__(self, other):
|
| 156 |
+
return self._compare(other, lambda s, o: s != o)
|
| 157 |
+
|
| 158 |
+
def _compare(self, other, method):
|
| 159 |
+
if not isinstance(other, _BaseVersion):
|
| 160 |
+
return NotImplemented
|
| 161 |
+
|
| 162 |
+
return method(self._key, other._key)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class LegacyVersion(_BaseVersion):
|
| 166 |
+
|
| 167 |
+
def __init__(self, version):
|
| 168 |
+
self._version = str(version)
|
| 169 |
+
self._key = _legacy_cmpkey(self._version)
|
| 170 |
+
|
| 171 |
+
def __str__(self):
|
| 172 |
+
return self._version
|
| 173 |
+
|
| 174 |
+
def __repr__(self):
|
| 175 |
+
return "<LegacyVersion({0})>".format(repr(str(self)))
|
| 176 |
+
|
| 177 |
+
@property
|
| 178 |
+
def public(self):
|
| 179 |
+
return self._version
|
| 180 |
+
|
| 181 |
+
@property
|
| 182 |
+
def base_version(self):
|
| 183 |
+
return self._version
|
| 184 |
+
|
| 185 |
+
@property
|
| 186 |
+
def local(self):
|
| 187 |
+
return None
|
| 188 |
+
|
| 189 |
+
@property
|
| 190 |
+
def is_prerelease(self):
|
| 191 |
+
return False
|
| 192 |
+
|
| 193 |
+
@property
|
| 194 |
+
def is_postrelease(self):
|
| 195 |
+
return False
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
_legacy_version_component_re = re.compile(
|
| 199 |
+
r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
_legacy_version_replacement_map = {
|
| 203 |
+
"pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def _parse_version_parts(s):
|
| 208 |
+
for part in _legacy_version_component_re.split(s):
|
| 209 |
+
part = _legacy_version_replacement_map.get(part, part)
|
| 210 |
+
|
| 211 |
+
if not part or part == ".":
|
| 212 |
+
continue
|
| 213 |
+
|
| 214 |
+
if part[:1] in "0123456789":
|
| 215 |
+
# pad for numeric comparison
|
| 216 |
+
yield part.zfill(8)
|
| 217 |
+
else:
|
| 218 |
+
yield "*" + part
|
| 219 |
+
|
| 220 |
+
# ensure that alpha/beta/candidate are before final
|
| 221 |
+
yield "*final"
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
def _legacy_cmpkey(version):
|
| 225 |
+
# We hardcode an epoch of -1 here. A PEP 440 version can only have an epoch
|
| 226 |
+
# greater than or equal to 0. This will effectively put the LegacyVersion,
|
| 227 |
+
# which uses the defacto standard originally implemented by setuptools,
|
| 228 |
+
# as before all PEP 440 versions.
|
| 229 |
+
epoch = -1
|
| 230 |
+
|
| 231 |
+
# This scheme is taken from pkg_resources.parse_version setuptools prior to
|
| 232 |
+
# its adoption of the packaging library.
|
| 233 |
+
parts = []
|
| 234 |
+
for part in _parse_version_parts(version.lower()):
|
| 235 |
+
if part.startswith("*"):
|
| 236 |
+
# remove "-" before a prerelease tag
|
| 237 |
+
if part < "*final":
|
| 238 |
+
while parts and parts[-1] == "*final-":
|
| 239 |
+
parts.pop()
|
| 240 |
+
|
| 241 |
+
# remove trailing zeros from each series of numeric parts
|
| 242 |
+
while parts and parts[-1] == "00000000":
|
| 243 |
+
parts.pop()
|
| 244 |
+
|
| 245 |
+
parts.append(part)
|
| 246 |
+
parts = tuple(parts)
|
| 247 |
+
|
| 248 |
+
return epoch, parts
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
# Deliberately not anchored to the start and end of the string, to make it
|
| 252 |
+
# easier for 3rd party code to reuse
|
| 253 |
+
VERSION_PATTERN = r"""
|
| 254 |
+
v?
|
| 255 |
+
(?:
|
| 256 |
+
(?:(?P<epoch>[0-9]+)!)? # epoch
|
| 257 |
+
(?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
|
| 258 |
+
(?P<pre> # pre-release
|
| 259 |
+
[-_\.]?
|
| 260 |
+
(?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
|
| 261 |
+
[-_\.]?
|
| 262 |
+
(?P<pre_n>[0-9]+)?
|
| 263 |
+
)?
|
| 264 |
+
(?P<post> # post release
|
| 265 |
+
(?:-(?P<post_n1>[0-9]+))
|
| 266 |
+
|
|
| 267 |
+
(?:
|
| 268 |
+
[-_\.]?
|
| 269 |
+
(?P<post_l>post|rev|r)
|
| 270 |
+
[-_\.]?
|
| 271 |
+
(?P<post_n2>[0-9]+)?
|
| 272 |
+
)
|
| 273 |
+
)?
|
| 274 |
+
(?P<dev> # dev release
|
| 275 |
+
[-_\.]?
|
| 276 |
+
(?P<dev_l>dev)
|
| 277 |
+
[-_\.]?
|
| 278 |
+
(?P<dev_n>[0-9]+)?
|
| 279 |
+
)?
|
| 280 |
+
)
|
| 281 |
+
(?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
|
| 282 |
+
"""
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
class Version(_BaseVersion):
|
| 286 |
+
|
| 287 |
+
_regex = re.compile(
|
| 288 |
+
r"^\s*" + VERSION_PATTERN + r"\s*$",
|
| 289 |
+
re.VERBOSE | re.IGNORECASE,
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
def __init__(self, version):
|
| 293 |
+
# Validate the version and parse it into pieces
|
| 294 |
+
match = self._regex.search(version)
|
| 295 |
+
if not match:
|
| 296 |
+
raise InvalidVersion("Invalid version: '{0}'".format(version))
|
| 297 |
+
|
| 298 |
+
# Store the parsed out pieces of the version
|
| 299 |
+
self._version = _Version(
|
| 300 |
+
epoch=int(match.group("epoch")) if match.group("epoch") else 0,
|
| 301 |
+
release=tuple(int(i) for i in match.group("release").split(".")),
|
| 302 |
+
pre=_parse_letter_version(
|
| 303 |
+
match.group("pre_l"),
|
| 304 |
+
match.group("pre_n"),
|
| 305 |
+
),
|
| 306 |
+
post=_parse_letter_version(
|
| 307 |
+
match.group("post_l"),
|
| 308 |
+
match.group("post_n1") or match.group("post_n2"),
|
| 309 |
+
),
|
| 310 |
+
dev=_parse_letter_version(
|
| 311 |
+
match.group("dev_l"),
|
| 312 |
+
match.group("dev_n"),
|
| 313 |
+
),
|
| 314 |
+
local=_parse_local_version(match.group("local")),
|
| 315 |
+
)
|
| 316 |
+
|
| 317 |
+
# Generate a key which will be used for sorting
|
| 318 |
+
self._key = _cmpkey(
|
| 319 |
+
self._version.epoch,
|
| 320 |
+
self._version.release,
|
| 321 |
+
self._version.pre,
|
| 322 |
+
self._version.post,
|
| 323 |
+
self._version.dev,
|
| 324 |
+
self._version.local,
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
+
def __repr__(self):
|
| 328 |
+
return "<Version({0})>".format(repr(str(self)))
|
| 329 |
+
|
| 330 |
+
def __str__(self):
|
| 331 |
+
parts = []
|
| 332 |
+
|
| 333 |
+
# Epoch
|
| 334 |
+
if self._version.epoch != 0:
|
| 335 |
+
parts.append("{0}!".format(self._version.epoch))
|
| 336 |
+
|
| 337 |
+
# Release segment
|
| 338 |
+
parts.append(".".join(str(x) for x in self._version.release))
|
| 339 |
+
|
| 340 |
+
# Pre-release
|
| 341 |
+
if self._version.pre is not None:
|
| 342 |
+
parts.append("".join(str(x) for x in self._version.pre))
|
| 343 |
+
|
| 344 |
+
# Post-release
|
| 345 |
+
if self._version.post is not None:
|
| 346 |
+
parts.append(".post{0}".format(self._version.post[1]))
|
| 347 |
+
|
| 348 |
+
# Development release
|
| 349 |
+
if self._version.dev is not None:
|
| 350 |
+
parts.append(".dev{0}".format(self._version.dev[1]))
|
| 351 |
+
|
| 352 |
+
# Local version segment
|
| 353 |
+
if self._version.local is not None:
|
| 354 |
+
parts.append(
|
| 355 |
+
"+{0}".format(".".join(str(x) for x in self._version.local))
|
| 356 |
+
)
|
| 357 |
+
|
| 358 |
+
return "".join(parts)
|
| 359 |
+
|
| 360 |
+
@property
|
| 361 |
+
def public(self):
|
| 362 |
+
return str(self).split("+", 1)[0]
|
| 363 |
+
|
| 364 |
+
@property
|
| 365 |
+
def base_version(self):
|
| 366 |
+
parts = []
|
| 367 |
+
|
| 368 |
+
# Epoch
|
| 369 |
+
if self._version.epoch != 0:
|
| 370 |
+
parts.append("{0}!".format(self._version.epoch))
|
| 371 |
+
|
| 372 |
+
# Release segment
|
| 373 |
+
parts.append(".".join(str(x) for x in self._version.release))
|
| 374 |
+
|
| 375 |
+
return "".join(parts)
|
| 376 |
+
|
| 377 |
+
@property
|
| 378 |
+
def local(self):
|
| 379 |
+
version_string = str(self)
|
| 380 |
+
if "+" in version_string:
|
| 381 |
+
return version_string.split("+", 1)[1]
|
| 382 |
+
|
| 383 |
+
@property
|
| 384 |
+
def is_prerelease(self):
|
| 385 |
+
return bool(self._version.dev or self._version.pre)
|
| 386 |
+
|
| 387 |
+
@property
|
| 388 |
+
def is_postrelease(self):
|
| 389 |
+
return bool(self._version.post)
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
def _parse_letter_version(letter, number):
|
| 393 |
+
if letter:
|
| 394 |
+
# We assume there is an implicit 0 in a pre-release if there is
|
| 395 |
+
# no numeral associated with it.
|
| 396 |
+
if number is None:
|
| 397 |
+
number = 0
|
| 398 |
+
|
| 399 |
+
# We normalize any letters to their lower-case form
|
| 400 |
+
letter = letter.lower()
|
| 401 |
+
|
| 402 |
+
# We consider some words to be alternate spellings of other words and
|
| 403 |
+
# in those cases we want to normalize the spellings to our preferred
|
| 404 |
+
# spelling.
|
| 405 |
+
if letter == "alpha":
|
| 406 |
+
letter = "a"
|
| 407 |
+
elif letter == "beta":
|
| 408 |
+
letter = "b"
|
| 409 |
+
elif letter in ["c", "pre", "preview"]:
|
| 410 |
+
letter = "rc"
|
| 411 |
+
elif letter in ["rev", "r"]:
|
| 412 |
+
letter = "post"
|
| 413 |
+
|
| 414 |
+
return letter, int(number)
|
| 415 |
+
if not letter and number:
|
| 416 |
+
# We assume that if we are given a number but not given a letter,
|
| 417 |
+
# then this is using the implicit post release syntax (e.g., 1.0-1)
|
| 418 |
+
letter = "post"
|
| 419 |
+
|
| 420 |
+
return letter, int(number)
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
_local_version_seperators = re.compile(r"[\._-]")
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
def _parse_local_version(local):
|
| 427 |
+
"""
|
| 428 |
+
Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
|
| 429 |
+
"""
|
| 430 |
+
if local is not None:
|
| 431 |
+
return tuple(
|
| 432 |
+
part.lower() if not part.isdigit() else int(part)
|
| 433 |
+
for part in _local_version_seperators.split(local)
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def _cmpkey(epoch, release, pre, post, dev, local):
|
| 438 |
+
# When we compare a release version, we want to compare it with all of the
|
| 439 |
+
# trailing zeros removed. So we'll use a reverse the list, drop all the now
|
| 440 |
+
# leading zeros until we come to something non-zero, then take the rest,
|
| 441 |
+
# re-reverse it back into the correct order, and make it a tuple and use
|
| 442 |
+
# that for our sorting key.
|
| 443 |
+
release = tuple(
|
| 444 |
+
reversed(list(
|
| 445 |
+
itertools.dropwhile(
|
| 446 |
+
lambda x: x == 0,
|
| 447 |
+
reversed(release),
|
| 448 |
+
)
|
| 449 |
+
))
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
+
# We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
|
| 453 |
+
# We'll do this by abusing the pre-segment, but we _only_ want to do this
|
| 454 |
+
# if there is no pre- or a post-segment. If we have one of those, then
|
| 455 |
+
# the normal sorting rules will handle this case correctly.
|
| 456 |
+
if pre is None and post is None and dev is not None:
|
| 457 |
+
pre = -Infinity
|
| 458 |
+
# Versions without a pre-release (except as noted above) should sort after
|
| 459 |
+
# those with one.
|
| 460 |
+
elif pre is None:
|
| 461 |
+
pre = Infinity
|
| 462 |
+
|
| 463 |
+
# Versions without a post-segment should sort before those with one.
|
| 464 |
+
if post is None:
|
| 465 |
+
post = -Infinity
|
| 466 |
+
|
| 467 |
+
# Versions without a development segment should sort after those with one.
|
| 468 |
+
if dev is None:
|
| 469 |
+
dev = Infinity
|
| 470 |
+
|
| 471 |
+
if local is None:
|
| 472 |
+
# Versions without a local segment should sort before those with one.
|
| 473 |
+
local = -Infinity
|
| 474 |
+
else:
|
| 475 |
+
# Versions with a local segment need that segment parsed to implement
|
| 476 |
+
# the sorting rules in PEP440.
|
| 477 |
+
# - Alphanumeric segments sort before numeric segments
|
| 478 |
+
# - Alphanumeric segments sort lexicographically
|
| 479 |
+
# - Numeric segments sort numerically
|
| 480 |
+
# - Shorter versions sort before longer versions when the prefixes
|
| 481 |
+
# match exactly
|
| 482 |
+
local = tuple(
|
| 483 |
+
(i, "") if isinstance(i, int) else (-Infinity, i)
|
| 484 |
+
for i in local
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
return epoch, release, pre, post, dev, local
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512bw_mask.c
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include <immintrin.h>
|
| 2 |
+
/**
|
| 3 |
+
* Test BW mask operations due to:
|
| 4 |
+
* - MSVC has supported it since vs2019 see,
|
| 5 |
+
* https://developercommunity.visualstudio.com/content/problem/518298/missing-avx512bw-mask-intrinsics.html
|
| 6 |
+
* - Clang >= v8.0
|
| 7 |
+
* - GCC >= v7.1
|
| 8 |
+
*/
|
| 9 |
+
int main(void)
|
| 10 |
+
{
|
| 11 |
+
__mmask64 m64 = _mm512_cmpeq_epi8_mask(_mm512_set1_epi8((char)1), _mm512_set1_epi8((char)1));
|
| 12 |
+
m64 = _kor_mask64(m64, m64);
|
| 13 |
+
m64 = _kxor_mask64(m64, m64);
|
| 14 |
+
m64 = _cvtu64_mask64(_cvtmask64_u64(m64));
|
| 15 |
+
m64 = _mm512_kunpackd(m64, m64);
|
| 16 |
+
m64 = (__mmask64)_mm512_kunpackw((__mmask32)m64, (__mmask32)m64);
|
| 17 |
+
return (int)_cvtmask64_u64(m64);
|
| 18 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512dq_mask.c
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include <immintrin.h>
|
| 2 |
+
/**
|
| 3 |
+
* Test DQ mask operations due to:
|
| 4 |
+
* - MSVC has supported it since vs2019 see,
|
| 5 |
+
* https://developercommunity.visualstudio.com/content/problem/518298/missing-avx512bw-mask-intrinsics.html
|
| 6 |
+
* - Clang >= v8.0
|
| 7 |
+
* - GCC >= v7.1
|
| 8 |
+
*/
|
| 9 |
+
int main(void)
|
| 10 |
+
{
|
| 11 |
+
__mmask8 m8 = _mm512_cmpeq_epi64_mask(_mm512_set1_epi64(1), _mm512_set1_epi64(1));
|
| 12 |
+
m8 = _kor_mask8(m8, m8);
|
| 13 |
+
m8 = _kxor_mask8(m8, m8);
|
| 14 |
+
m8 = _cvtu32_mask8(_cvtmask8_u32(m8));
|
| 15 |
+
return (int)_cvtmask8_u32(m8);
|
| 16 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_avx512f_reduce.c
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include <immintrin.h>
|
| 2 |
+
/**
|
| 3 |
+
* The following intrinsics don't have direct native support but compilers
|
| 4 |
+
* tend to emulate them.
|
| 5 |
+
* They're usually supported by gcc >= 7.1, clang >= 4 and icc >= 19
|
| 6 |
+
*/
|
| 7 |
+
int main(void)
|
| 8 |
+
{
|
| 9 |
+
__m512 one_ps = _mm512_set1_ps(1.0f);
|
| 10 |
+
__m512d one_pd = _mm512_set1_pd(1.0);
|
| 11 |
+
__m512i one_i64 = _mm512_set1_epi64(1);
|
| 12 |
+
// add
|
| 13 |
+
float sum_ps = _mm512_reduce_add_ps(one_ps);
|
| 14 |
+
double sum_pd = _mm512_reduce_add_pd(one_pd);
|
| 15 |
+
int sum_int = (int)_mm512_reduce_add_epi64(one_i64);
|
| 16 |
+
sum_int += (int)_mm512_reduce_add_epi32(one_i64);
|
| 17 |
+
// mul
|
| 18 |
+
sum_ps += _mm512_reduce_mul_ps(one_ps);
|
| 19 |
+
sum_pd += _mm512_reduce_mul_pd(one_pd);
|
| 20 |
+
sum_int += (int)_mm512_reduce_mul_epi64(one_i64);
|
| 21 |
+
sum_int += (int)_mm512_reduce_mul_epi32(one_i64);
|
| 22 |
+
// min
|
| 23 |
+
sum_ps += _mm512_reduce_min_ps(one_ps);
|
| 24 |
+
sum_pd += _mm512_reduce_min_pd(one_pd);
|
| 25 |
+
sum_int += (int)_mm512_reduce_min_epi32(one_i64);
|
| 26 |
+
sum_int += (int)_mm512_reduce_min_epu32(one_i64);
|
| 27 |
+
sum_int += (int)_mm512_reduce_min_epi64(one_i64);
|
| 28 |
+
// max
|
| 29 |
+
sum_ps += _mm512_reduce_max_ps(one_ps);
|
| 30 |
+
sum_pd += _mm512_reduce_max_pd(one_pd);
|
| 31 |
+
sum_int += (int)_mm512_reduce_max_epi32(one_i64);
|
| 32 |
+
sum_int += (int)_mm512_reduce_max_epu32(one_i64);
|
| 33 |
+
sum_int += (int)_mm512_reduce_max_epi64(one_i64);
|
| 34 |
+
// and
|
| 35 |
+
sum_int += (int)_mm512_reduce_and_epi32(one_i64);
|
| 36 |
+
sum_int += (int)_mm512_reduce_and_epi64(one_i64);
|
| 37 |
+
// or
|
| 38 |
+
sum_int += (int)_mm512_reduce_or_epi32(one_i64);
|
| 39 |
+
sum_int += (int)_mm512_reduce_or_epi64(one_i64);
|
| 40 |
+
return (int)sum_ps + (int)sum_pd + sum_int;
|
| 41 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx3_half_double.c
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Assembler may not fully support the following VSX3 scalar
|
| 3 |
+
* instructions, even though compilers report VSX3 support.
|
| 4 |
+
*/
|
| 5 |
+
int main(void)
|
| 6 |
+
{
|
| 7 |
+
unsigned short bits = 0xFF;
|
| 8 |
+
double f;
|
| 9 |
+
__asm__ __volatile__("xscvhpdp %x0,%x1" : "=wa"(f) : "wa"(bits));
|
| 10 |
+
__asm__ __volatile__ ("xscvdphp %x0,%x1" : "=wa" (bits) : "wa" (f));
|
| 11 |
+
return bits;
|
| 12 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx4_mma.c
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef __VSX__
|
| 2 |
+
#error "VSX is not supported"
|
| 3 |
+
#endif
|
| 4 |
+
#include <altivec.h>
|
| 5 |
+
|
| 6 |
+
typedef __vector float fv4sf_t;
|
| 7 |
+
typedef __vector unsigned char vec_t;
|
| 8 |
+
|
| 9 |
+
int main(void)
|
| 10 |
+
{
|
| 11 |
+
__vector_quad acc0;
|
| 12 |
+
float a[4] = {0,1,2,3};
|
| 13 |
+
float b[4] = {0,1,2,3};
|
| 14 |
+
vec_t *va = (vec_t *) a;
|
| 15 |
+
vec_t *vb = (vec_t *) b;
|
| 16 |
+
__builtin_mma_xvf32ger(&acc0, va[0], vb[0]);
|
| 17 |
+
fv4sf_t result[4];
|
| 18 |
+
__builtin_mma_disassemble_acc((void *)result, &acc0);
|
| 19 |
+
fv4sf_t c0 = result[0];
|
| 20 |
+
return (int)((float*)&c0)[0];
|
| 21 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/extra_vsx_asm.c
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Testing ASM VSX register number fixer '%x<n>'
|
| 3 |
+
*
|
| 4 |
+
* old versions of CLANG doesn't support %x<n> in the inline asm template
|
| 5 |
+
* which fixes register number when using any of the register constraints wa, wd, wf.
|
| 6 |
+
*
|
| 7 |
+
* xref:
|
| 8 |
+
* - https://bugs.llvm.org/show_bug.cgi?id=31837
|
| 9 |
+
* - https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
|
| 10 |
+
*/
|
| 11 |
+
#ifndef __VSX__
|
| 12 |
+
#error "VSX is not supported"
|
| 13 |
+
#endif
|
| 14 |
+
#include <altivec.h>
|
| 15 |
+
|
| 16 |
+
#if (defined(__GNUC__) && !defined(vec_xl)) || (defined(__clang__) && !defined(__IBMC__))
|
| 17 |
+
#define vsx_ld vec_vsx_ld
|
| 18 |
+
#define vsx_st vec_vsx_st
|
| 19 |
+
#else
|
| 20 |
+
#define vsx_ld vec_xl
|
| 21 |
+
#define vsx_st vec_xst
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
int main(void)
|
| 25 |
+
{
|
| 26 |
+
float z4[] = {0, 0, 0, 0};
|
| 27 |
+
signed int zout[] = {0, 0, 0, 0};
|
| 28 |
+
|
| 29 |
+
__vector float vz4 = vsx_ld(0, z4);
|
| 30 |
+
__vector signed int asm_ret = vsx_ld(0, zout);
|
| 31 |
+
|
| 32 |
+
__asm__ ("xvcvspsxws %x0,%x1" : "=wa" (vz4) : "wa" (asm_ret));
|
| 33 |
+
|
| 34 |
+
vsx_st(asm_ret, 0, zout);
|
| 35 |
+
return zout[0];
|
| 36 |
+
}
|
.venv311/Lib/site-packages/numpy/distutils/checks/test_flags.c
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
int test_flags;
|
.venv311/Lib/site-packages/numpy/distutils/command/__init__.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""distutils.command
|
| 2 |
+
|
| 3 |
+
Package containing implementation of all the standard Distutils
|
| 4 |
+
commands.
|
| 5 |
+
|
| 6 |
+
"""
|
| 7 |
+
def test_na_writable_attributes_deletion():
|
| 8 |
+
a = np.NA(2)
|
| 9 |
+
attr = ['payload', 'dtype']
|
| 10 |
+
for s in attr:
|
| 11 |
+
assert_raises(AttributeError, delattr, a, s)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
__revision__ = "$Id: __init__.py,v 1.3 2005/05/16 11:08:49 pearu Exp $"
|
| 15 |
+
|
| 16 |
+
distutils_all = [ #'build_py',
|
| 17 |
+
'clean',
|
| 18 |
+
'install_clib',
|
| 19 |
+
'install_scripts',
|
| 20 |
+
'bdist',
|
| 21 |
+
'bdist_dumb',
|
| 22 |
+
'bdist_wininst',
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
__import__('distutils.command', globals(), locals(), distutils_all)
|
| 26 |
+
|
| 27 |
+
__all__ = ['build',
|
| 28 |
+
'config_compiler',
|
| 29 |
+
'config',
|
| 30 |
+
'build_src',
|
| 31 |
+
'build_py',
|
| 32 |
+
'build_ext',
|
| 33 |
+
'build_clib',
|
| 34 |
+
'build_scripts',
|
| 35 |
+
'install',
|
| 36 |
+
'install_data',
|
| 37 |
+
'install_headers',
|
| 38 |
+
'install_lib',
|
| 39 |
+
'bdist_rpm',
|
| 40 |
+
'sdist',
|
| 41 |
+
] + distutils_all
|
.venv311/Lib/site-packages/numpy/distutils/command/autodist.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""This module implements additional tests ala autoconf which can be useful.
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
# We put them here since they could be easily reused outside numpy.distutils
|
| 7 |
+
|
| 8 |
+
def check_inline(cmd):
|
| 9 |
+
"""Return the inline identifier (may be empty)."""
|
| 10 |
+
cmd._check_compiler()
|
| 11 |
+
body = textwrap.dedent("""
|
| 12 |
+
#ifndef __cplusplus
|
| 13 |
+
static %(inline)s int static_func (void)
|
| 14 |
+
{
|
| 15 |
+
return 0;
|
| 16 |
+
}
|
| 17 |
+
%(inline)s int nostatic_func (void)
|
| 18 |
+
{
|
| 19 |
+
return 0;
|
| 20 |
+
}
|
| 21 |
+
#endif""")
|
| 22 |
+
|
| 23 |
+
for kw in ['inline', '__inline__', '__inline']:
|
| 24 |
+
st = cmd.try_compile(body % {'inline': kw}, None, None)
|
| 25 |
+
if st:
|
| 26 |
+
return kw
|
| 27 |
+
|
| 28 |
+
return ''
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def check_restrict(cmd):
|
| 32 |
+
"""Return the restrict identifier (may be empty)."""
|
| 33 |
+
cmd._check_compiler()
|
| 34 |
+
body = textwrap.dedent("""
|
| 35 |
+
static int static_func (char * %(restrict)s a)
|
| 36 |
+
{
|
| 37 |
+
return 0;
|
| 38 |
+
}
|
| 39 |
+
""")
|
| 40 |
+
|
| 41 |
+
for kw in ['restrict', '__restrict__', '__restrict']:
|
| 42 |
+
st = cmd.try_compile(body % {'restrict': kw}, None, None)
|
| 43 |
+
if st:
|
| 44 |
+
return kw
|
| 45 |
+
|
| 46 |
+
return ''
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def check_compiler_gcc(cmd):
|
| 50 |
+
"""Check if the compiler is GCC."""
|
| 51 |
+
|
| 52 |
+
cmd._check_compiler()
|
| 53 |
+
body = textwrap.dedent("""
|
| 54 |
+
int
|
| 55 |
+
main()
|
| 56 |
+
{
|
| 57 |
+
#if (! defined __GNUC__)
|
| 58 |
+
#error gcc required
|
| 59 |
+
#endif
|
| 60 |
+
return 0;
|
| 61 |
+
}
|
| 62 |
+
""")
|
| 63 |
+
return cmd.try_compile(body, None, None)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def check_gcc_version_at_least(cmd, major, minor=0, patchlevel=0):
|
| 67 |
+
"""
|
| 68 |
+
Check that the gcc version is at least the specified version."""
|
| 69 |
+
|
| 70 |
+
cmd._check_compiler()
|
| 71 |
+
version = '.'.join([str(major), str(minor), str(patchlevel)])
|
| 72 |
+
body = textwrap.dedent("""
|
| 73 |
+
int
|
| 74 |
+
main()
|
| 75 |
+
{
|
| 76 |
+
#if (! defined __GNUC__) || (__GNUC__ < %(major)d) || \\
|
| 77 |
+
(__GNUC_MINOR__ < %(minor)d) || \\
|
| 78 |
+
(__GNUC_PATCHLEVEL__ < %(patchlevel)d)
|
| 79 |
+
#error gcc >= %(version)s required
|
| 80 |
+
#endif
|
| 81 |
+
return 0;
|
| 82 |
+
}
|
| 83 |
+
""")
|
| 84 |
+
kw = {'version': version, 'major': major, 'minor': minor,
|
| 85 |
+
'patchlevel': patchlevel}
|
| 86 |
+
|
| 87 |
+
return cmd.try_compile(body % kw, None, None)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def check_gcc_function_attribute(cmd, attribute, name):
|
| 91 |
+
"""Return True if the given function attribute is supported."""
|
| 92 |
+
cmd._check_compiler()
|
| 93 |
+
body = textwrap.dedent("""
|
| 94 |
+
#pragma GCC diagnostic error "-Wattributes"
|
| 95 |
+
#pragma clang diagnostic error "-Wattributes"
|
| 96 |
+
|
| 97 |
+
int %s %s(void* unused)
|
| 98 |
+
{
|
| 99 |
+
return 0;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
int
|
| 103 |
+
main()
|
| 104 |
+
{
|
| 105 |
+
return 0;
|
| 106 |
+
}
|
| 107 |
+
""") % (attribute, name)
|
| 108 |
+
return cmd.try_compile(body, None, None) != 0
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def check_gcc_function_attribute_with_intrinsics(cmd, attribute, name, code,
|
| 112 |
+
include):
|
| 113 |
+
"""Return True if the given function attribute is supported with
|
| 114 |
+
intrinsics."""
|
| 115 |
+
cmd._check_compiler()
|
| 116 |
+
body = textwrap.dedent("""
|
| 117 |
+
#include<%s>
|
| 118 |
+
int %s %s(void)
|
| 119 |
+
{
|
| 120 |
+
%s;
|
| 121 |
+
return 0;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
int
|
| 125 |
+
main()
|
| 126 |
+
{
|
| 127 |
+
return 0;
|
| 128 |
+
}
|
| 129 |
+
""") % (include, attribute, name, code)
|
| 130 |
+
return cmd.try_compile(body, None, None) != 0
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def check_gcc_variable_attribute(cmd, attribute):
|
| 134 |
+
"""Return True if the given variable attribute is supported."""
|
| 135 |
+
cmd._check_compiler()
|
| 136 |
+
body = textwrap.dedent("""
|
| 137 |
+
#pragma GCC diagnostic error "-Wattributes"
|
| 138 |
+
#pragma clang diagnostic error "-Wattributes"
|
| 139 |
+
|
| 140 |
+
int %s foo;
|
| 141 |
+
|
| 142 |
+
int
|
| 143 |
+
main()
|
| 144 |
+
{
|
| 145 |
+
return 0;
|
| 146 |
+
}
|
| 147 |
+
""") % (attribute, )
|
| 148 |
+
return cmd.try_compile(body, None, None) != 0
|
.venv311/Lib/site-packages/numpy/distutils/command/bdist_rpm.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
if 'setuptools' in sys.modules:
|
| 4 |
+
from setuptools.command.bdist_rpm import bdist_rpm as old_bdist_rpm
|
| 5 |
+
else:
|
| 6 |
+
from distutils.command.bdist_rpm import bdist_rpm as old_bdist_rpm
|
| 7 |
+
|
| 8 |
+
class bdist_rpm(old_bdist_rpm):
|
| 9 |
+
|
| 10 |
+
def _make_spec_file(self):
|
| 11 |
+
spec_file = old_bdist_rpm._make_spec_file(self)
|
| 12 |
+
|
| 13 |
+
# Replace hardcoded setup.py script name
|
| 14 |
+
# with the real setup script name.
|
| 15 |
+
setup_py = os.path.basename(sys.argv[0])
|
| 16 |
+
if setup_py == 'setup.py':
|
| 17 |
+
return spec_file
|
| 18 |
+
new_spec_file = []
|
| 19 |
+
for line in spec_file:
|
| 20 |
+
line = line.replace('setup.py', setup_py)
|
| 21 |
+
new_spec_file.append(line)
|
| 22 |
+
return new_spec_file
|
.venv311/Lib/site-packages/numpy/distutils/command/build.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
from distutils.command.build import build as old_build
|
| 4 |
+
from distutils.util import get_platform
|
| 5 |
+
from numpy.distutils.command.config_compiler import show_fortran_compilers
|
| 6 |
+
|
| 7 |
+
class build(old_build):
|
| 8 |
+
|
| 9 |
+
sub_commands = [('config_cc', lambda *args: True),
|
| 10 |
+
('config_fc', lambda *args: True),
|
| 11 |
+
('build_src', old_build.has_ext_modules),
|
| 12 |
+
] + old_build.sub_commands
|
| 13 |
+
|
| 14 |
+
user_options = old_build.user_options + [
|
| 15 |
+
('fcompiler=', None,
|
| 16 |
+
"specify the Fortran compiler type"),
|
| 17 |
+
('warn-error', None,
|
| 18 |
+
"turn all warnings into errors (-Werror)"),
|
| 19 |
+
('cpu-baseline=', None,
|
| 20 |
+
"specify a list of enabled baseline CPU optimizations"),
|
| 21 |
+
('cpu-dispatch=', None,
|
| 22 |
+
"specify a list of dispatched CPU optimizations"),
|
| 23 |
+
('disable-optimization', None,
|
| 24 |
+
"disable CPU optimized code(dispatch,simd,fast...)"),
|
| 25 |
+
('simd-test=', None,
|
| 26 |
+
"specify a list of CPU optimizations to be tested against NumPy SIMD interface"),
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
help_options = old_build.help_options + [
|
| 30 |
+
('help-fcompiler', None, "list available Fortran compilers",
|
| 31 |
+
show_fortran_compilers),
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
def initialize_options(self):
|
| 35 |
+
old_build.initialize_options(self)
|
| 36 |
+
self.fcompiler = None
|
| 37 |
+
self.warn_error = False
|
| 38 |
+
self.cpu_baseline = "min"
|
| 39 |
+
self.cpu_dispatch = "max -xop -fma4" # drop AMD legacy features by default
|
| 40 |
+
self.disable_optimization = False
|
| 41 |
+
"""
|
| 42 |
+
the '_simd' module is a very large. Adding more dispatched features
|
| 43 |
+
will increase binary size and compile time. By default we minimize
|
| 44 |
+
the targeted features to those most commonly used by the NumPy SIMD interface(NPYV),
|
| 45 |
+
NOTE: any specified features will be ignored if they're:
|
| 46 |
+
- part of the baseline(--cpu-baseline)
|
| 47 |
+
- not part of dispatch-able features(--cpu-dispatch)
|
| 48 |
+
- not supported by compiler or platform
|
| 49 |
+
"""
|
| 50 |
+
self.simd_test = "BASELINE SSE2 SSE42 XOP FMA4 (FMA3 AVX2) AVX512F " \
|
| 51 |
+
"AVX512_SKX VSX VSX2 VSX3 VSX4 NEON ASIMD VX VXE VXE2"
|
| 52 |
+
|
| 53 |
+
def finalize_options(self):
|
| 54 |
+
build_scripts = self.build_scripts
|
| 55 |
+
old_build.finalize_options(self)
|
| 56 |
+
plat_specifier = ".{}-{}.{}".format(get_platform(), *sys.version_info[:2])
|
| 57 |
+
if build_scripts is None:
|
| 58 |
+
self.build_scripts = os.path.join(self.build_base,
|
| 59 |
+
'scripts' + plat_specifier)
|
| 60 |
+
|
| 61 |
+
def run(self):
|
| 62 |
+
old_build.run(self)
|
.venv311/Lib/site-packages/numpy/distutils/command/build_clib.py
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
from glob import glob
|
| 5 |
+
import shutil
|
| 6 |
+
from distutils.command.build_clib import build_clib as old_build_clib
|
| 7 |
+
from distutils.errors import DistutilsSetupError, DistutilsError, \
|
| 8 |
+
DistutilsFileError
|
| 9 |
+
|
| 10 |
+
from numpy.distutils import log
|
| 11 |
+
from distutils.dep_util import newer_group
|
| 12 |
+
from numpy.distutils.misc_util import (
|
| 13 |
+
filter_sources, get_lib_source_files, get_numpy_include_dirs,
|
| 14 |
+
has_cxx_sources, has_f_sources, is_sequence
|
| 15 |
+
)
|
| 16 |
+
from numpy.distutils.ccompiler_opt import new_ccompiler_opt
|
| 17 |
+
|
| 18 |
+
# Fix Python distutils bug sf #1718574:
|
| 19 |
+
_l = old_build_clib.user_options
|
| 20 |
+
for _i in range(len(_l)):
|
| 21 |
+
if _l[_i][0] in ['build-clib', 'build-temp']:
|
| 22 |
+
_l[_i] = (_l[_i][0] + '=',) + _l[_i][1:]
|
| 23 |
+
#
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class build_clib(old_build_clib):
|
| 27 |
+
|
| 28 |
+
description = "build C/C++/F libraries used by Python extensions"
|
| 29 |
+
|
| 30 |
+
user_options = old_build_clib.user_options + [
|
| 31 |
+
('fcompiler=', None,
|
| 32 |
+
"specify the Fortran compiler type"),
|
| 33 |
+
('inplace', 'i', 'Build in-place'),
|
| 34 |
+
('parallel=', 'j',
|
| 35 |
+
"number of parallel jobs"),
|
| 36 |
+
('warn-error', None,
|
| 37 |
+
"turn all warnings into errors (-Werror)"),
|
| 38 |
+
('cpu-baseline=', None,
|
| 39 |
+
"specify a list of enabled baseline CPU optimizations"),
|
| 40 |
+
('cpu-dispatch=', None,
|
| 41 |
+
"specify a list of dispatched CPU optimizations"),
|
| 42 |
+
('disable-optimization', None,
|
| 43 |
+
"disable CPU optimized code(dispatch,simd,fast...)"),
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
boolean_options = old_build_clib.boolean_options + \
|
| 47 |
+
['inplace', 'warn-error', 'disable-optimization']
|
| 48 |
+
|
| 49 |
+
def initialize_options(self):
|
| 50 |
+
old_build_clib.initialize_options(self)
|
| 51 |
+
self.fcompiler = None
|
| 52 |
+
self.inplace = 0
|
| 53 |
+
self.parallel = None
|
| 54 |
+
self.warn_error = None
|
| 55 |
+
self.cpu_baseline = None
|
| 56 |
+
self.cpu_dispatch = None
|
| 57 |
+
self.disable_optimization = None
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def finalize_options(self):
|
| 61 |
+
if self.parallel:
|
| 62 |
+
try:
|
| 63 |
+
self.parallel = int(self.parallel)
|
| 64 |
+
except ValueError as e:
|
| 65 |
+
raise ValueError("--parallel/-j argument must be an integer") from e
|
| 66 |
+
old_build_clib.finalize_options(self)
|
| 67 |
+
self.set_undefined_options('build',
|
| 68 |
+
('parallel', 'parallel'),
|
| 69 |
+
('warn_error', 'warn_error'),
|
| 70 |
+
('cpu_baseline', 'cpu_baseline'),
|
| 71 |
+
('cpu_dispatch', 'cpu_dispatch'),
|
| 72 |
+
('disable_optimization', 'disable_optimization')
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
def have_f_sources(self):
|
| 76 |
+
for (lib_name, build_info) in self.libraries:
|
| 77 |
+
if has_f_sources(build_info.get('sources', [])):
|
| 78 |
+
return True
|
| 79 |
+
return False
|
| 80 |
+
|
| 81 |
+
def have_cxx_sources(self):
|
| 82 |
+
for (lib_name, build_info) in self.libraries:
|
| 83 |
+
if has_cxx_sources(build_info.get('sources', [])):
|
| 84 |
+
return True
|
| 85 |
+
return False
|
| 86 |
+
|
| 87 |
+
def run(self):
|
| 88 |
+
if not self.libraries:
|
| 89 |
+
return
|
| 90 |
+
|
| 91 |
+
# Make sure that library sources are complete.
|
| 92 |
+
languages = []
|
| 93 |
+
|
| 94 |
+
# Make sure that extension sources are complete.
|
| 95 |
+
self.run_command('build_src')
|
| 96 |
+
|
| 97 |
+
for (lib_name, build_info) in self.libraries:
|
| 98 |
+
l = build_info.get('language', None)
|
| 99 |
+
if l and l not in languages:
|
| 100 |
+
languages.append(l)
|
| 101 |
+
|
| 102 |
+
from distutils.ccompiler import new_compiler
|
| 103 |
+
self.compiler = new_compiler(compiler=self.compiler,
|
| 104 |
+
dry_run=self.dry_run,
|
| 105 |
+
force=self.force)
|
| 106 |
+
self.compiler.customize(self.distribution,
|
| 107 |
+
need_cxx=self.have_cxx_sources())
|
| 108 |
+
|
| 109 |
+
if self.warn_error:
|
| 110 |
+
self.compiler.compiler.append('-Werror')
|
| 111 |
+
self.compiler.compiler_so.append('-Werror')
|
| 112 |
+
|
| 113 |
+
libraries = self.libraries
|
| 114 |
+
self.libraries = None
|
| 115 |
+
self.compiler.customize_cmd(self)
|
| 116 |
+
self.libraries = libraries
|
| 117 |
+
|
| 118 |
+
self.compiler.show_customization()
|
| 119 |
+
|
| 120 |
+
if not self.disable_optimization:
|
| 121 |
+
dispatch_hpath = os.path.join("numpy", "distutils", "include", "npy_cpu_dispatch_config.h")
|
| 122 |
+
dispatch_hpath = os.path.join(self.get_finalized_command("build_src").build_src, dispatch_hpath)
|
| 123 |
+
opt_cache_path = os.path.abspath(
|
| 124 |
+
os.path.join(self.build_temp, 'ccompiler_opt_cache_clib.py')
|
| 125 |
+
)
|
| 126 |
+
if hasattr(self, "compiler_opt"):
|
| 127 |
+
# By default `CCompilerOpt` update the cache at the exit of
|
| 128 |
+
# the process, which may lead to duplicate building
|
| 129 |
+
# (see build_extension()/force_rebuild) if run() called
|
| 130 |
+
# multiple times within the same os process/thread without
|
| 131 |
+
# giving the chance the previous instances of `CCompilerOpt`
|
| 132 |
+
# to update the cache.
|
| 133 |
+
self.compiler_opt.cache_flush()
|
| 134 |
+
|
| 135 |
+
self.compiler_opt = new_ccompiler_opt(
|
| 136 |
+
compiler=self.compiler, dispatch_hpath=dispatch_hpath,
|
| 137 |
+
cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch,
|
| 138 |
+
cache_path=opt_cache_path
|
| 139 |
+
)
|
| 140 |
+
def report(copt):
|
| 141 |
+
log.info("\n########### CLIB COMPILER OPTIMIZATION ###########")
|
| 142 |
+
log.info(copt.report(full=True))
|
| 143 |
+
|
| 144 |
+
import atexit
|
| 145 |
+
atexit.register(report, self.compiler_opt)
|
| 146 |
+
|
| 147 |
+
if self.have_f_sources():
|
| 148 |
+
from numpy.distutils.fcompiler import new_fcompiler
|
| 149 |
+
self._f_compiler = new_fcompiler(compiler=self.fcompiler,
|
| 150 |
+
verbose=self.verbose,
|
| 151 |
+
dry_run=self.dry_run,
|
| 152 |
+
force=self.force,
|
| 153 |
+
requiref90='f90' in languages,
|
| 154 |
+
c_compiler=self.compiler)
|
| 155 |
+
if self._f_compiler is not None:
|
| 156 |
+
self._f_compiler.customize(self.distribution)
|
| 157 |
+
|
| 158 |
+
libraries = self.libraries
|
| 159 |
+
self.libraries = None
|
| 160 |
+
self._f_compiler.customize_cmd(self)
|
| 161 |
+
self.libraries = libraries
|
| 162 |
+
|
| 163 |
+
self._f_compiler.show_customization()
|
| 164 |
+
else:
|
| 165 |
+
self._f_compiler = None
|
| 166 |
+
|
| 167 |
+
self.build_libraries(self.libraries)
|
| 168 |
+
|
| 169 |
+
if self.inplace:
|
| 170 |
+
for l in self.distribution.installed_libraries:
|
| 171 |
+
libname = self.compiler.library_filename(l.name)
|
| 172 |
+
source = os.path.join(self.build_clib, libname)
|
| 173 |
+
target = os.path.join(l.target_dir, libname)
|
| 174 |
+
self.mkpath(l.target_dir)
|
| 175 |
+
shutil.copy(source, target)
|
| 176 |
+
|
| 177 |
+
def get_source_files(self):
|
| 178 |
+
self.check_library_list(self.libraries)
|
| 179 |
+
filenames = []
|
| 180 |
+
for lib in self.libraries:
|
| 181 |
+
filenames.extend(get_lib_source_files(lib))
|
| 182 |
+
return filenames
|
| 183 |
+
|
| 184 |
+
def build_libraries(self, libraries):
|
| 185 |
+
for (lib_name, build_info) in libraries:
|
| 186 |
+
self.build_a_library(build_info, lib_name, libraries)
|
| 187 |
+
|
| 188 |
+
def assemble_flags(self, in_flags):
|
| 189 |
+
""" Assemble flags from flag list
|
| 190 |
+
|
| 191 |
+
Parameters
|
| 192 |
+
----------
|
| 193 |
+
in_flags : None or sequence
|
| 194 |
+
None corresponds to empty list. Sequence elements can be strings
|
| 195 |
+
or callables that return lists of strings. Callable takes `self` as
|
| 196 |
+
single parameter.
|
| 197 |
+
|
| 198 |
+
Returns
|
| 199 |
+
-------
|
| 200 |
+
out_flags : list
|
| 201 |
+
"""
|
| 202 |
+
if in_flags is None:
|
| 203 |
+
return []
|
| 204 |
+
out_flags = []
|
| 205 |
+
for in_flag in in_flags:
|
| 206 |
+
if callable(in_flag):
|
| 207 |
+
out_flags += in_flag(self)
|
| 208 |
+
else:
|
| 209 |
+
out_flags.append(in_flag)
|
| 210 |
+
return out_flags
|
| 211 |
+
|
| 212 |
+
def build_a_library(self, build_info, lib_name, libraries):
|
| 213 |
+
# default compilers
|
| 214 |
+
compiler = self.compiler
|
| 215 |
+
fcompiler = self._f_compiler
|
| 216 |
+
|
| 217 |
+
sources = build_info.get('sources')
|
| 218 |
+
if sources is None or not is_sequence(sources):
|
| 219 |
+
raise DistutilsSetupError(("in 'libraries' option (library '%s'), " +
|
| 220 |
+
"'sources' must be present and must be " +
|
| 221 |
+
"a list of source filenames") % lib_name)
|
| 222 |
+
sources = list(sources)
|
| 223 |
+
|
| 224 |
+
c_sources, cxx_sources, f_sources, fmodule_sources \
|
| 225 |
+
= filter_sources(sources)
|
| 226 |
+
requiref90 = not not fmodule_sources or \
|
| 227 |
+
build_info.get('language', 'c') == 'f90'
|
| 228 |
+
|
| 229 |
+
# save source type information so that build_ext can use it.
|
| 230 |
+
source_languages = []
|
| 231 |
+
if c_sources:
|
| 232 |
+
source_languages.append('c')
|
| 233 |
+
if cxx_sources:
|
| 234 |
+
source_languages.append('c++')
|
| 235 |
+
if requiref90:
|
| 236 |
+
source_languages.append('f90')
|
| 237 |
+
elif f_sources:
|
| 238 |
+
source_languages.append('f77')
|
| 239 |
+
build_info['source_languages'] = source_languages
|
| 240 |
+
|
| 241 |
+
lib_file = compiler.library_filename(lib_name,
|
| 242 |
+
output_dir=self.build_clib)
|
| 243 |
+
depends = sources + build_info.get('depends', [])
|
| 244 |
+
|
| 245 |
+
force_rebuild = self.force
|
| 246 |
+
if not self.disable_optimization and not self.compiler_opt.is_cached():
|
| 247 |
+
log.debug("Detected changes on compiler optimizations")
|
| 248 |
+
force_rebuild = True
|
| 249 |
+
if not (force_rebuild or newer_group(depends, lib_file, 'newer')):
|
| 250 |
+
log.debug("skipping '%s' library (up-to-date)", lib_name)
|
| 251 |
+
return
|
| 252 |
+
else:
|
| 253 |
+
log.info("building '%s' library", lib_name)
|
| 254 |
+
|
| 255 |
+
config_fc = build_info.get('config_fc', {})
|
| 256 |
+
if fcompiler is not None and config_fc:
|
| 257 |
+
log.info('using additional config_fc from setup script '
|
| 258 |
+
'for fortran compiler: %s'
|
| 259 |
+
% (config_fc,))
|
| 260 |
+
from numpy.distutils.fcompiler import new_fcompiler
|
| 261 |
+
fcompiler = new_fcompiler(compiler=fcompiler.compiler_type,
|
| 262 |
+
verbose=self.verbose,
|
| 263 |
+
dry_run=self.dry_run,
|
| 264 |
+
force=self.force,
|
| 265 |
+
requiref90=requiref90,
|
| 266 |
+
c_compiler=self.compiler)
|
| 267 |
+
if fcompiler is not None:
|
| 268 |
+
dist = self.distribution
|
| 269 |
+
base_config_fc = dist.get_option_dict('config_fc').copy()
|
| 270 |
+
base_config_fc.update(config_fc)
|
| 271 |
+
fcompiler.customize(base_config_fc)
|
| 272 |
+
|
| 273 |
+
# check availability of Fortran compilers
|
| 274 |
+
if (f_sources or fmodule_sources) and fcompiler is None:
|
| 275 |
+
raise DistutilsError("library %s has Fortran sources"
|
| 276 |
+
" but no Fortran compiler found" % (lib_name))
|
| 277 |
+
|
| 278 |
+
if fcompiler is not None:
|
| 279 |
+
fcompiler.extra_f77_compile_args = build_info.get(
|
| 280 |
+
'extra_f77_compile_args') or []
|
| 281 |
+
fcompiler.extra_f90_compile_args = build_info.get(
|
| 282 |
+
'extra_f90_compile_args') or []
|
| 283 |
+
|
| 284 |
+
macros = build_info.get('macros')
|
| 285 |
+
if macros is None:
|
| 286 |
+
macros = []
|
| 287 |
+
include_dirs = build_info.get('include_dirs')
|
| 288 |
+
if include_dirs is None:
|
| 289 |
+
include_dirs = []
|
| 290 |
+
# Flags can be strings, or callables that return a list of strings.
|
| 291 |
+
extra_postargs = self.assemble_flags(
|
| 292 |
+
build_info.get('extra_compiler_args'))
|
| 293 |
+
extra_cflags = self.assemble_flags(
|
| 294 |
+
build_info.get('extra_cflags'))
|
| 295 |
+
extra_cxxflags = self.assemble_flags(
|
| 296 |
+
build_info.get('extra_cxxflags'))
|
| 297 |
+
|
| 298 |
+
include_dirs.extend(get_numpy_include_dirs())
|
| 299 |
+
# where compiled F90 module files are:
|
| 300 |
+
module_dirs = build_info.get('module_dirs') or []
|
| 301 |
+
module_build_dir = os.path.dirname(lib_file)
|
| 302 |
+
if requiref90:
|
| 303 |
+
self.mkpath(module_build_dir)
|
| 304 |
+
|
| 305 |
+
if compiler.compiler_type == 'msvc':
|
| 306 |
+
# this hack works around the msvc compiler attributes
|
| 307 |
+
# problem, msvc uses its own convention :(
|
| 308 |
+
c_sources += cxx_sources
|
| 309 |
+
cxx_sources = []
|
| 310 |
+
extra_cflags += extra_cxxflags
|
| 311 |
+
|
| 312 |
+
# filtering C dispatch-table sources when optimization is not disabled,
|
| 313 |
+
# otherwise treated as normal sources.
|
| 314 |
+
copt_c_sources = []
|
| 315 |
+
copt_cxx_sources = []
|
| 316 |
+
copt_baseline_flags = []
|
| 317 |
+
copt_macros = []
|
| 318 |
+
if not self.disable_optimization:
|
| 319 |
+
bsrc_dir = self.get_finalized_command("build_src").build_src
|
| 320 |
+
dispatch_hpath = os.path.join("numpy", "distutils", "include")
|
| 321 |
+
dispatch_hpath = os.path.join(bsrc_dir, dispatch_hpath)
|
| 322 |
+
include_dirs.append(dispatch_hpath)
|
| 323 |
+
# copt_build_src = None if self.inplace else bsrc_dir
|
| 324 |
+
copt_build_src = bsrc_dir
|
| 325 |
+
for _srcs, _dst, _ext in (
|
| 326 |
+
((c_sources,), copt_c_sources, ('.dispatch.c',)),
|
| 327 |
+
((c_sources, cxx_sources), copt_cxx_sources,
|
| 328 |
+
('.dispatch.cpp', '.dispatch.cxx'))
|
| 329 |
+
):
|
| 330 |
+
for _src in _srcs:
|
| 331 |
+
_dst += [
|
| 332 |
+
_src.pop(_src.index(s))
|
| 333 |
+
for s in _src[:] if s.endswith(_ext)
|
| 334 |
+
]
|
| 335 |
+
copt_baseline_flags = self.compiler_opt.cpu_baseline_flags()
|
| 336 |
+
else:
|
| 337 |
+
copt_macros.append(("NPY_DISABLE_OPTIMIZATION", 1))
|
| 338 |
+
|
| 339 |
+
objects = []
|
| 340 |
+
if copt_cxx_sources:
|
| 341 |
+
log.info("compiling C++ dispatch-able sources")
|
| 342 |
+
objects += self.compiler_opt.try_dispatch(
|
| 343 |
+
copt_c_sources,
|
| 344 |
+
output_dir=self.build_temp,
|
| 345 |
+
src_dir=copt_build_src,
|
| 346 |
+
macros=macros + copt_macros,
|
| 347 |
+
include_dirs=include_dirs,
|
| 348 |
+
debug=self.debug,
|
| 349 |
+
extra_postargs=extra_postargs + extra_cxxflags,
|
| 350 |
+
ccompiler=cxx_compiler
|
| 351 |
+
)
|
| 352 |
+
|
| 353 |
+
if copt_c_sources:
|
| 354 |
+
log.info("compiling C dispatch-able sources")
|
| 355 |
+
objects += self.compiler_opt.try_dispatch(
|
| 356 |
+
copt_c_sources,
|
| 357 |
+
output_dir=self.build_temp,
|
| 358 |
+
src_dir=copt_build_src,
|
| 359 |
+
macros=macros + copt_macros,
|
| 360 |
+
include_dirs=include_dirs,
|
| 361 |
+
debug=self.debug,
|
| 362 |
+
extra_postargs=extra_postargs + extra_cflags)
|
| 363 |
+
|
| 364 |
+
if c_sources:
|
| 365 |
+
log.info("compiling C sources")
|
| 366 |
+
objects += compiler.compile(
|
| 367 |
+
c_sources,
|
| 368 |
+
output_dir=self.build_temp,
|
| 369 |
+
macros=macros + copt_macros,
|
| 370 |
+
include_dirs=include_dirs,
|
| 371 |
+
debug=self.debug,
|
| 372 |
+
extra_postargs=(extra_postargs +
|
| 373 |
+
copt_baseline_flags +
|
| 374 |
+
extra_cflags))
|
| 375 |
+
|
| 376 |
+
if cxx_sources:
|
| 377 |
+
log.info("compiling C++ sources")
|
| 378 |
+
cxx_compiler = compiler.cxx_compiler()
|
| 379 |
+
cxx_objects = cxx_compiler.compile(
|
| 380 |
+
cxx_sources,
|
| 381 |
+
output_dir=self.build_temp,
|
| 382 |
+
macros=macros + copt_macros,
|
| 383 |
+
include_dirs=include_dirs,
|
| 384 |
+
debug=self.debug,
|
| 385 |
+
extra_postargs=(extra_postargs +
|
| 386 |
+
copt_baseline_flags +
|
| 387 |
+
extra_cxxflags))
|
| 388 |
+
objects.extend(cxx_objects)
|
| 389 |
+
|
| 390 |
+
if f_sources or fmodule_sources:
|
| 391 |
+
extra_postargs = []
|
| 392 |
+
f_objects = []
|
| 393 |
+
|
| 394 |
+
if requiref90:
|
| 395 |
+
if fcompiler.module_dir_switch is None:
|
| 396 |
+
existing_modules = glob('*.mod')
|
| 397 |
+
extra_postargs += fcompiler.module_options(
|
| 398 |
+
module_dirs, module_build_dir)
|
| 399 |
+
|
| 400 |
+
if fmodule_sources:
|
| 401 |
+
log.info("compiling Fortran 90 module sources")
|
| 402 |
+
f_objects += fcompiler.compile(fmodule_sources,
|
| 403 |
+
output_dir=self.build_temp,
|
| 404 |
+
macros=macros,
|
| 405 |
+
include_dirs=include_dirs,
|
| 406 |
+
debug=self.debug,
|
| 407 |
+
extra_postargs=extra_postargs)
|
| 408 |
+
|
| 409 |
+
if requiref90 and self._f_compiler.module_dir_switch is None:
|
| 410 |
+
# move new compiled F90 module files to module_build_dir
|
| 411 |
+
for f in glob('*.mod'):
|
| 412 |
+
if f in existing_modules:
|
| 413 |
+
continue
|
| 414 |
+
t = os.path.join(module_build_dir, f)
|
| 415 |
+
if os.path.abspath(f) == os.path.abspath(t):
|
| 416 |
+
continue
|
| 417 |
+
if os.path.isfile(t):
|
| 418 |
+
os.remove(t)
|
| 419 |
+
try:
|
| 420 |
+
self.move_file(f, module_build_dir)
|
| 421 |
+
except DistutilsFileError:
|
| 422 |
+
log.warn('failed to move %r to %r'
|
| 423 |
+
% (f, module_build_dir))
|
| 424 |
+
|
| 425 |
+
if f_sources:
|
| 426 |
+
log.info("compiling Fortran sources")
|
| 427 |
+
f_objects += fcompiler.compile(f_sources,
|
| 428 |
+
output_dir=self.build_temp,
|
| 429 |
+
macros=macros,
|
| 430 |
+
include_dirs=include_dirs,
|
| 431 |
+
debug=self.debug,
|
| 432 |
+
extra_postargs=extra_postargs)
|
| 433 |
+
else:
|
| 434 |
+
f_objects = []
|
| 435 |
+
|
| 436 |
+
if f_objects and not fcompiler.can_ccompiler_link(compiler):
|
| 437 |
+
# Default linker cannot link Fortran object files, and results
|
| 438 |
+
# need to be wrapped later. Instead of creating a real static
|
| 439 |
+
# library, just keep track of the object files.
|
| 440 |
+
listfn = os.path.join(self.build_clib,
|
| 441 |
+
lib_name + '.fobjects')
|
| 442 |
+
with open(listfn, 'w') as f:
|
| 443 |
+
f.write("\n".join(os.path.abspath(obj) for obj in f_objects))
|
| 444 |
+
|
| 445 |
+
listfn = os.path.join(self.build_clib,
|
| 446 |
+
lib_name + '.cobjects')
|
| 447 |
+
with open(listfn, 'w') as f:
|
| 448 |
+
f.write("\n".join(os.path.abspath(obj) for obj in objects))
|
| 449 |
+
|
| 450 |
+
# create empty "library" file for dependency tracking
|
| 451 |
+
lib_fname = os.path.join(self.build_clib,
|
| 452 |
+
lib_name + compiler.static_lib_extension)
|
| 453 |
+
with open(lib_fname, 'wb') as f:
|
| 454 |
+
pass
|
| 455 |
+
else:
|
| 456 |
+
# assume that default linker is suitable for
|
| 457 |
+
# linking Fortran object files
|
| 458 |
+
objects.extend(f_objects)
|
| 459 |
+
compiler.create_static_lib(objects, lib_name,
|
| 460 |
+
output_dir=self.build_clib,
|
| 461 |
+
debug=self.debug)
|
| 462 |
+
|
| 463 |
+
# fix library dependencies
|
| 464 |
+
clib_libraries = build_info.get('libraries', [])
|
| 465 |
+
for lname, binfo in libraries:
|
| 466 |
+
if lname in clib_libraries:
|
| 467 |
+
clib_libraries.extend(binfo.get('libraries', []))
|
| 468 |
+
if clib_libraries:
|
| 469 |
+
build_info['libraries'] = clib_libraries
|
.venv311/Lib/site-packages/numpy/distutils/command/build_ext.py
ADDED
|
@@ -0,0 +1,752 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" Modified version of build_ext that handles fortran source files.
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
import subprocess
|
| 6 |
+
from glob import glob
|
| 7 |
+
|
| 8 |
+
from distutils.dep_util import newer_group
|
| 9 |
+
from distutils.command.build_ext import build_ext as old_build_ext
|
| 10 |
+
from distutils.errors import DistutilsFileError, DistutilsSetupError,\
|
| 11 |
+
DistutilsError
|
| 12 |
+
from distutils.file_util import copy_file
|
| 13 |
+
|
| 14 |
+
from numpy.distutils import log
|
| 15 |
+
from numpy.distutils.exec_command import filepath_from_subprocess_output
|
| 16 |
+
from numpy.distutils.system_info import combine_paths
|
| 17 |
+
from numpy.distutils.misc_util import (
|
| 18 |
+
filter_sources, get_ext_source_files, get_numpy_include_dirs,
|
| 19 |
+
has_cxx_sources, has_f_sources, is_sequence
|
| 20 |
+
)
|
| 21 |
+
from numpy.distutils.command.config_compiler import show_fortran_compilers
|
| 22 |
+
from numpy.distutils.ccompiler_opt import new_ccompiler_opt, CCompilerOpt
|
| 23 |
+
|
| 24 |
+
class build_ext (old_build_ext):
|
| 25 |
+
|
| 26 |
+
description = "build C/C++/F extensions (compile/link to build directory)"
|
| 27 |
+
|
| 28 |
+
user_options = old_build_ext.user_options + [
|
| 29 |
+
('fcompiler=', None,
|
| 30 |
+
"specify the Fortran compiler type"),
|
| 31 |
+
('parallel=', 'j',
|
| 32 |
+
"number of parallel jobs"),
|
| 33 |
+
('warn-error', None,
|
| 34 |
+
"turn all warnings into errors (-Werror)"),
|
| 35 |
+
('cpu-baseline=', None,
|
| 36 |
+
"specify a list of enabled baseline CPU optimizations"),
|
| 37 |
+
('cpu-dispatch=', None,
|
| 38 |
+
"specify a list of dispatched CPU optimizations"),
|
| 39 |
+
('disable-optimization', None,
|
| 40 |
+
"disable CPU optimized code(dispatch,simd,fast...)"),
|
| 41 |
+
('simd-test=', None,
|
| 42 |
+
"specify a list of CPU optimizations to be tested against NumPy SIMD interface"),
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
help_options = old_build_ext.help_options + [
|
| 46 |
+
('help-fcompiler', None, "list available Fortran compilers",
|
| 47 |
+
show_fortran_compilers),
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
boolean_options = old_build_ext.boolean_options + ['warn-error', 'disable-optimization']
|
| 51 |
+
|
| 52 |
+
def initialize_options(self):
|
| 53 |
+
old_build_ext.initialize_options(self)
|
| 54 |
+
self.fcompiler = None
|
| 55 |
+
self.parallel = None
|
| 56 |
+
self.warn_error = None
|
| 57 |
+
self.cpu_baseline = None
|
| 58 |
+
self.cpu_dispatch = None
|
| 59 |
+
self.disable_optimization = None
|
| 60 |
+
self.simd_test = None
|
| 61 |
+
|
| 62 |
+
def finalize_options(self):
|
| 63 |
+
if self.parallel:
|
| 64 |
+
try:
|
| 65 |
+
self.parallel = int(self.parallel)
|
| 66 |
+
except ValueError as e:
|
| 67 |
+
raise ValueError("--parallel/-j argument must be an integer") from e
|
| 68 |
+
|
| 69 |
+
# Ensure that self.include_dirs and self.distribution.include_dirs
|
| 70 |
+
# refer to the same list object. finalize_options will modify
|
| 71 |
+
# self.include_dirs, but self.distribution.include_dirs is used
|
| 72 |
+
# during the actual build.
|
| 73 |
+
# self.include_dirs is None unless paths are specified with
|
| 74 |
+
# --include-dirs.
|
| 75 |
+
# The include paths will be passed to the compiler in the order:
|
| 76 |
+
# numpy paths, --include-dirs paths, Python include path.
|
| 77 |
+
if isinstance(self.include_dirs, str):
|
| 78 |
+
self.include_dirs = self.include_dirs.split(os.pathsep)
|
| 79 |
+
incl_dirs = self.include_dirs or []
|
| 80 |
+
if self.distribution.include_dirs is None:
|
| 81 |
+
self.distribution.include_dirs = []
|
| 82 |
+
self.include_dirs = self.distribution.include_dirs
|
| 83 |
+
self.include_dirs.extend(incl_dirs)
|
| 84 |
+
|
| 85 |
+
old_build_ext.finalize_options(self)
|
| 86 |
+
self.set_undefined_options('build',
|
| 87 |
+
('parallel', 'parallel'),
|
| 88 |
+
('warn_error', 'warn_error'),
|
| 89 |
+
('cpu_baseline', 'cpu_baseline'),
|
| 90 |
+
('cpu_dispatch', 'cpu_dispatch'),
|
| 91 |
+
('disable_optimization', 'disable_optimization'),
|
| 92 |
+
('simd_test', 'simd_test')
|
| 93 |
+
)
|
| 94 |
+
CCompilerOpt.conf_target_groups["simd_test"] = self.simd_test
|
| 95 |
+
|
| 96 |
+
def run(self):
|
| 97 |
+
if not self.extensions:
|
| 98 |
+
return
|
| 99 |
+
|
| 100 |
+
# Make sure that extension sources are complete.
|
| 101 |
+
self.run_command('build_src')
|
| 102 |
+
|
| 103 |
+
if self.distribution.has_c_libraries():
|
| 104 |
+
if self.inplace:
|
| 105 |
+
if self.distribution.have_run.get('build_clib'):
|
| 106 |
+
log.warn('build_clib already run, it is too late to '
|
| 107 |
+
'ensure in-place build of build_clib')
|
| 108 |
+
build_clib = self.distribution.get_command_obj(
|
| 109 |
+
'build_clib')
|
| 110 |
+
else:
|
| 111 |
+
build_clib = self.distribution.get_command_obj(
|
| 112 |
+
'build_clib')
|
| 113 |
+
build_clib.inplace = 1
|
| 114 |
+
build_clib.ensure_finalized()
|
| 115 |
+
build_clib.run()
|
| 116 |
+
self.distribution.have_run['build_clib'] = 1
|
| 117 |
+
|
| 118 |
+
else:
|
| 119 |
+
self.run_command('build_clib')
|
| 120 |
+
build_clib = self.get_finalized_command('build_clib')
|
| 121 |
+
self.library_dirs.append(build_clib.build_clib)
|
| 122 |
+
else:
|
| 123 |
+
build_clib = None
|
| 124 |
+
|
| 125 |
+
# Not including C libraries to the list of
|
| 126 |
+
# extension libraries automatically to prevent
|
| 127 |
+
# bogus linking commands. Extensions must
|
| 128 |
+
# explicitly specify the C libraries that they use.
|
| 129 |
+
|
| 130 |
+
from distutils.ccompiler import new_compiler
|
| 131 |
+
from numpy.distutils.fcompiler import new_fcompiler
|
| 132 |
+
|
| 133 |
+
compiler_type = self.compiler
|
| 134 |
+
# Initialize C compiler:
|
| 135 |
+
self.compiler = new_compiler(compiler=compiler_type,
|
| 136 |
+
verbose=self.verbose,
|
| 137 |
+
dry_run=self.dry_run,
|
| 138 |
+
force=self.force)
|
| 139 |
+
self.compiler.customize(self.distribution)
|
| 140 |
+
self.compiler.customize_cmd(self)
|
| 141 |
+
|
| 142 |
+
if self.warn_error:
|
| 143 |
+
self.compiler.compiler.append('-Werror')
|
| 144 |
+
self.compiler.compiler_so.append('-Werror')
|
| 145 |
+
|
| 146 |
+
self.compiler.show_customization()
|
| 147 |
+
|
| 148 |
+
if not self.disable_optimization:
|
| 149 |
+
dispatch_hpath = os.path.join("numpy", "distutils", "include", "npy_cpu_dispatch_config.h")
|
| 150 |
+
dispatch_hpath = os.path.join(self.get_finalized_command("build_src").build_src, dispatch_hpath)
|
| 151 |
+
opt_cache_path = os.path.abspath(
|
| 152 |
+
os.path.join(self.build_temp, 'ccompiler_opt_cache_ext.py')
|
| 153 |
+
)
|
| 154 |
+
if hasattr(self, "compiler_opt"):
|
| 155 |
+
# By default `CCompilerOpt` update the cache at the exit of
|
| 156 |
+
# the process, which may lead to duplicate building
|
| 157 |
+
# (see build_extension()/force_rebuild) if run() called
|
| 158 |
+
# multiple times within the same os process/thread without
|
| 159 |
+
# giving the chance the previous instances of `CCompilerOpt`
|
| 160 |
+
# to update the cache.
|
| 161 |
+
self.compiler_opt.cache_flush()
|
| 162 |
+
|
| 163 |
+
self.compiler_opt = new_ccompiler_opt(
|
| 164 |
+
compiler=self.compiler, dispatch_hpath=dispatch_hpath,
|
| 165 |
+
cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch,
|
| 166 |
+
cache_path=opt_cache_path
|
| 167 |
+
)
|
| 168 |
+
def report(copt):
|
| 169 |
+
log.info("\n########### EXT COMPILER OPTIMIZATION ###########")
|
| 170 |
+
log.info(copt.report(full=True))
|
| 171 |
+
|
| 172 |
+
import atexit
|
| 173 |
+
atexit.register(report, self.compiler_opt)
|
| 174 |
+
|
| 175 |
+
# Setup directory for storing generated extra DLL files on Windows
|
| 176 |
+
self.extra_dll_dir = os.path.join(self.build_temp, '.libs')
|
| 177 |
+
if not os.path.isdir(self.extra_dll_dir):
|
| 178 |
+
os.makedirs(self.extra_dll_dir)
|
| 179 |
+
|
| 180 |
+
# Create mapping of libraries built by build_clib:
|
| 181 |
+
clibs = {}
|
| 182 |
+
if build_clib is not None:
|
| 183 |
+
for libname, build_info in build_clib.libraries or []:
|
| 184 |
+
if libname in clibs and clibs[libname] != build_info:
|
| 185 |
+
log.warn('library %r defined more than once,'
|
| 186 |
+
' overwriting build_info\n%s... \nwith\n%s...'
|
| 187 |
+
% (libname, repr(clibs[libname])[:300], repr(build_info)[:300]))
|
| 188 |
+
clibs[libname] = build_info
|
| 189 |
+
# .. and distribution libraries:
|
| 190 |
+
for libname, build_info in self.distribution.libraries or []:
|
| 191 |
+
if libname in clibs:
|
| 192 |
+
# build_clib libraries have a precedence before distribution ones
|
| 193 |
+
continue
|
| 194 |
+
clibs[libname] = build_info
|
| 195 |
+
|
| 196 |
+
# Determine if C++/Fortran 77/Fortran 90 compilers are needed.
|
| 197 |
+
# Update extension libraries, library_dirs, and macros.
|
| 198 |
+
all_languages = set()
|
| 199 |
+
for ext in self.extensions:
|
| 200 |
+
ext_languages = set()
|
| 201 |
+
c_libs = []
|
| 202 |
+
c_lib_dirs = []
|
| 203 |
+
macros = []
|
| 204 |
+
for libname in ext.libraries:
|
| 205 |
+
if libname in clibs:
|
| 206 |
+
binfo = clibs[libname]
|
| 207 |
+
c_libs += binfo.get('libraries', [])
|
| 208 |
+
c_lib_dirs += binfo.get('library_dirs', [])
|
| 209 |
+
for m in binfo.get('macros', []):
|
| 210 |
+
if m not in macros:
|
| 211 |
+
macros.append(m)
|
| 212 |
+
|
| 213 |
+
for l in clibs.get(libname, {}).get('source_languages', []):
|
| 214 |
+
ext_languages.add(l)
|
| 215 |
+
if c_libs:
|
| 216 |
+
new_c_libs = ext.libraries + c_libs
|
| 217 |
+
log.info('updating extension %r libraries from %r to %r'
|
| 218 |
+
% (ext.name, ext.libraries, new_c_libs))
|
| 219 |
+
ext.libraries = new_c_libs
|
| 220 |
+
ext.library_dirs = ext.library_dirs + c_lib_dirs
|
| 221 |
+
if macros:
|
| 222 |
+
log.info('extending extension %r defined_macros with %r'
|
| 223 |
+
% (ext.name, macros))
|
| 224 |
+
ext.define_macros = ext.define_macros + macros
|
| 225 |
+
|
| 226 |
+
# determine extension languages
|
| 227 |
+
if has_f_sources(ext.sources):
|
| 228 |
+
ext_languages.add('f77')
|
| 229 |
+
if has_cxx_sources(ext.sources):
|
| 230 |
+
ext_languages.add('c++')
|
| 231 |
+
l = ext.language or self.compiler.detect_language(ext.sources)
|
| 232 |
+
if l:
|
| 233 |
+
ext_languages.add(l)
|
| 234 |
+
|
| 235 |
+
# reset language attribute for choosing proper linker
|
| 236 |
+
#
|
| 237 |
+
# When we build extensions with multiple languages, we have to
|
| 238 |
+
# choose a linker. The rules here are:
|
| 239 |
+
# 1. if there is Fortran code, always prefer the Fortran linker,
|
| 240 |
+
# 2. otherwise prefer C++ over C,
|
| 241 |
+
# 3. Users can force a particular linker by using
|
| 242 |
+
# `language='c'` # or 'c++', 'f90', 'f77'
|
| 243 |
+
# in their config.add_extension() calls.
|
| 244 |
+
if 'c++' in ext_languages:
|
| 245 |
+
ext_language = 'c++'
|
| 246 |
+
else:
|
| 247 |
+
ext_language = 'c' # default
|
| 248 |
+
|
| 249 |
+
has_fortran = False
|
| 250 |
+
if 'f90' in ext_languages:
|
| 251 |
+
ext_language = 'f90'
|
| 252 |
+
has_fortran = True
|
| 253 |
+
elif 'f77' in ext_languages:
|
| 254 |
+
ext_language = 'f77'
|
| 255 |
+
has_fortran = True
|
| 256 |
+
|
| 257 |
+
if not ext.language or has_fortran:
|
| 258 |
+
if l and l != ext_language and ext.language:
|
| 259 |
+
log.warn('resetting extension %r language from %r to %r.' %
|
| 260 |
+
(ext.name, l, ext_language))
|
| 261 |
+
|
| 262 |
+
ext.language = ext_language
|
| 263 |
+
|
| 264 |
+
# global language
|
| 265 |
+
all_languages.update(ext_languages)
|
| 266 |
+
|
| 267 |
+
need_f90_compiler = 'f90' in all_languages
|
| 268 |
+
need_f77_compiler = 'f77' in all_languages
|
| 269 |
+
need_cxx_compiler = 'c++' in all_languages
|
| 270 |
+
|
| 271 |
+
# Initialize C++ compiler:
|
| 272 |
+
if need_cxx_compiler:
|
| 273 |
+
self._cxx_compiler = new_compiler(compiler=compiler_type,
|
| 274 |
+
verbose=self.verbose,
|
| 275 |
+
dry_run=self.dry_run,
|
| 276 |
+
force=self.force)
|
| 277 |
+
compiler = self._cxx_compiler
|
| 278 |
+
compiler.customize(self.distribution, need_cxx=need_cxx_compiler)
|
| 279 |
+
compiler.customize_cmd(self)
|
| 280 |
+
compiler.show_customization()
|
| 281 |
+
self._cxx_compiler = compiler.cxx_compiler()
|
| 282 |
+
else:
|
| 283 |
+
self._cxx_compiler = None
|
| 284 |
+
|
| 285 |
+
# Initialize Fortran 77 compiler:
|
| 286 |
+
if need_f77_compiler:
|
| 287 |
+
ctype = self.fcompiler
|
| 288 |
+
self._f77_compiler = new_fcompiler(compiler=self.fcompiler,
|
| 289 |
+
verbose=self.verbose,
|
| 290 |
+
dry_run=self.dry_run,
|
| 291 |
+
force=self.force,
|
| 292 |
+
requiref90=False,
|
| 293 |
+
c_compiler=self.compiler)
|
| 294 |
+
fcompiler = self._f77_compiler
|
| 295 |
+
if fcompiler:
|
| 296 |
+
ctype = fcompiler.compiler_type
|
| 297 |
+
fcompiler.customize(self.distribution)
|
| 298 |
+
if fcompiler and fcompiler.get_version():
|
| 299 |
+
fcompiler.customize_cmd(self)
|
| 300 |
+
fcompiler.show_customization()
|
| 301 |
+
else:
|
| 302 |
+
self.warn('f77_compiler=%s is not available.' %
|
| 303 |
+
(ctype))
|
| 304 |
+
self._f77_compiler = None
|
| 305 |
+
else:
|
| 306 |
+
self._f77_compiler = None
|
| 307 |
+
|
| 308 |
+
# Initialize Fortran 90 compiler:
|
| 309 |
+
if need_f90_compiler:
|
| 310 |
+
ctype = self.fcompiler
|
| 311 |
+
self._f90_compiler = new_fcompiler(compiler=self.fcompiler,
|
| 312 |
+
verbose=self.verbose,
|
| 313 |
+
dry_run=self.dry_run,
|
| 314 |
+
force=self.force,
|
| 315 |
+
requiref90=True,
|
| 316 |
+
c_compiler=self.compiler)
|
| 317 |
+
fcompiler = self._f90_compiler
|
| 318 |
+
if fcompiler:
|
| 319 |
+
ctype = fcompiler.compiler_type
|
| 320 |
+
fcompiler.customize(self.distribution)
|
| 321 |
+
if fcompiler and fcompiler.get_version():
|
| 322 |
+
fcompiler.customize_cmd(self)
|
| 323 |
+
fcompiler.show_customization()
|
| 324 |
+
else:
|
| 325 |
+
self.warn('f90_compiler=%s is not available.' %
|
| 326 |
+
(ctype))
|
| 327 |
+
self._f90_compiler = None
|
| 328 |
+
else:
|
| 329 |
+
self._f90_compiler = None
|
| 330 |
+
|
| 331 |
+
# Build extensions
|
| 332 |
+
self.build_extensions()
|
| 333 |
+
|
| 334 |
+
# Copy over any extra DLL files
|
| 335 |
+
# FIXME: In the case where there are more than two packages,
|
| 336 |
+
# we blindly assume that both packages need all of the libraries,
|
| 337 |
+
# resulting in a larger wheel than is required. This should be fixed,
|
| 338 |
+
# but it's so rare that I won't bother to handle it.
|
| 339 |
+
pkg_roots = {
|
| 340 |
+
self.get_ext_fullname(ext.name).split('.')[0]
|
| 341 |
+
for ext in self.extensions
|
| 342 |
+
}
|
| 343 |
+
for pkg_root in pkg_roots:
|
| 344 |
+
shared_lib_dir = os.path.join(pkg_root, '.libs')
|
| 345 |
+
if not self.inplace:
|
| 346 |
+
shared_lib_dir = os.path.join(self.build_lib, shared_lib_dir)
|
| 347 |
+
for fn in os.listdir(self.extra_dll_dir):
|
| 348 |
+
if not os.path.isdir(shared_lib_dir):
|
| 349 |
+
os.makedirs(shared_lib_dir)
|
| 350 |
+
if not fn.lower().endswith('.dll'):
|
| 351 |
+
continue
|
| 352 |
+
runtime_lib = os.path.join(self.extra_dll_dir, fn)
|
| 353 |
+
copy_file(runtime_lib, shared_lib_dir)
|
| 354 |
+
|
| 355 |
+
def swig_sources(self, sources, extensions=None):
|
| 356 |
+
# Do nothing. Swig sources have been handled in build_src command.
|
| 357 |
+
return sources
|
| 358 |
+
|
| 359 |
+
def build_extension(self, ext):
|
| 360 |
+
sources = ext.sources
|
| 361 |
+
if sources is None or not is_sequence(sources):
|
| 362 |
+
raise DistutilsSetupError(
|
| 363 |
+
("in 'ext_modules' option (extension '%s'), " +
|
| 364 |
+
"'sources' must be present and must be " +
|
| 365 |
+
"a list of source filenames") % ext.name)
|
| 366 |
+
sources = list(sources)
|
| 367 |
+
|
| 368 |
+
if not sources:
|
| 369 |
+
return
|
| 370 |
+
|
| 371 |
+
fullname = self.get_ext_fullname(ext.name)
|
| 372 |
+
if self.inplace:
|
| 373 |
+
modpath = fullname.split('.')
|
| 374 |
+
package = '.'.join(modpath[0:-1])
|
| 375 |
+
base = modpath[-1]
|
| 376 |
+
build_py = self.get_finalized_command('build_py')
|
| 377 |
+
package_dir = build_py.get_package_dir(package)
|
| 378 |
+
ext_filename = os.path.join(package_dir,
|
| 379 |
+
self.get_ext_filename(base))
|
| 380 |
+
else:
|
| 381 |
+
ext_filename = os.path.join(self.build_lib,
|
| 382 |
+
self.get_ext_filename(fullname))
|
| 383 |
+
depends = sources + ext.depends
|
| 384 |
+
|
| 385 |
+
force_rebuild = self.force
|
| 386 |
+
if not self.disable_optimization and not self.compiler_opt.is_cached():
|
| 387 |
+
log.debug("Detected changes on compiler optimizations")
|
| 388 |
+
force_rebuild = True
|
| 389 |
+
if not (force_rebuild or newer_group(depends, ext_filename, 'newer')):
|
| 390 |
+
log.debug("skipping '%s' extension (up-to-date)", ext.name)
|
| 391 |
+
return
|
| 392 |
+
else:
|
| 393 |
+
log.info("building '%s' extension", ext.name)
|
| 394 |
+
|
| 395 |
+
extra_args = ext.extra_compile_args or []
|
| 396 |
+
extra_cflags = getattr(ext, 'extra_c_compile_args', None) or []
|
| 397 |
+
extra_cxxflags = getattr(ext, 'extra_cxx_compile_args', None) or []
|
| 398 |
+
|
| 399 |
+
macros = ext.define_macros[:]
|
| 400 |
+
for undef in ext.undef_macros:
|
| 401 |
+
macros.append((undef,))
|
| 402 |
+
|
| 403 |
+
c_sources, cxx_sources, f_sources, fmodule_sources = \
|
| 404 |
+
filter_sources(ext.sources)
|
| 405 |
+
|
| 406 |
+
if self.compiler.compiler_type == 'msvc':
|
| 407 |
+
if cxx_sources:
|
| 408 |
+
# Needed to compile kiva.agg._agg extension.
|
| 409 |
+
extra_args.append('/Zm1000')
|
| 410 |
+
extra_cflags += extra_cxxflags
|
| 411 |
+
# this hack works around the msvc compiler attributes
|
| 412 |
+
# problem, msvc uses its own convention :(
|
| 413 |
+
c_sources += cxx_sources
|
| 414 |
+
cxx_sources = []
|
| 415 |
+
|
| 416 |
+
# Set Fortran/C++ compilers for compilation and linking.
|
| 417 |
+
if ext.language == 'f90':
|
| 418 |
+
fcompiler = self._f90_compiler
|
| 419 |
+
elif ext.language == 'f77':
|
| 420 |
+
fcompiler = self._f77_compiler
|
| 421 |
+
else: # in case ext.language is c++, for instance
|
| 422 |
+
fcompiler = self._f90_compiler or self._f77_compiler
|
| 423 |
+
if fcompiler is not None:
|
| 424 |
+
fcompiler.extra_f77_compile_args = (ext.extra_f77_compile_args or []) if hasattr(
|
| 425 |
+
ext, 'extra_f77_compile_args') else []
|
| 426 |
+
fcompiler.extra_f90_compile_args = (ext.extra_f90_compile_args or []) if hasattr(
|
| 427 |
+
ext, 'extra_f90_compile_args') else []
|
| 428 |
+
cxx_compiler = self._cxx_compiler
|
| 429 |
+
|
| 430 |
+
# check for the availability of required compilers
|
| 431 |
+
if cxx_sources and cxx_compiler is None:
|
| 432 |
+
raise DistutilsError("extension %r has C++ sources"
|
| 433 |
+
"but no C++ compiler found" % (ext.name))
|
| 434 |
+
if (f_sources or fmodule_sources) and fcompiler is None:
|
| 435 |
+
raise DistutilsError("extension %r has Fortran sources "
|
| 436 |
+
"but no Fortran compiler found" % (ext.name))
|
| 437 |
+
if ext.language in ['f77', 'f90'] and fcompiler is None:
|
| 438 |
+
self.warn("extension %r has Fortran libraries "
|
| 439 |
+
"but no Fortran linker found, using default linker" % (ext.name))
|
| 440 |
+
if ext.language == 'c++' and cxx_compiler is None:
|
| 441 |
+
self.warn("extension %r has C++ libraries "
|
| 442 |
+
"but no C++ linker found, using default linker" % (ext.name))
|
| 443 |
+
|
| 444 |
+
kws = {'depends': ext.depends}
|
| 445 |
+
output_dir = self.build_temp
|
| 446 |
+
|
| 447 |
+
include_dirs = ext.include_dirs + get_numpy_include_dirs()
|
| 448 |
+
|
| 449 |
+
# filtering C dispatch-table sources when optimization is not disabled,
|
| 450 |
+
# otherwise treated as normal sources.
|
| 451 |
+
copt_c_sources = []
|
| 452 |
+
copt_cxx_sources = []
|
| 453 |
+
copt_baseline_flags = []
|
| 454 |
+
copt_macros = []
|
| 455 |
+
if not self.disable_optimization:
|
| 456 |
+
bsrc_dir = self.get_finalized_command("build_src").build_src
|
| 457 |
+
dispatch_hpath = os.path.join("numpy", "distutils", "include")
|
| 458 |
+
dispatch_hpath = os.path.join(bsrc_dir, dispatch_hpath)
|
| 459 |
+
include_dirs.append(dispatch_hpath)
|
| 460 |
+
|
| 461 |
+
# copt_build_src = None if self.inplace else bsrc_dir
|
| 462 |
+
# Always generate the generated config files and
|
| 463 |
+
# dispatch-able sources inside the build directory,
|
| 464 |
+
# even if the build option `inplace` is enabled.
|
| 465 |
+
# This approach prevents conflicts with Meson-generated
|
| 466 |
+
# config headers. Since `spin build --clean` will not remove
|
| 467 |
+
# these headers, they might overwrite the generated Meson headers,
|
| 468 |
+
# causing compatibility issues. Maintaining separate directories
|
| 469 |
+
# ensures compatibility between distutils dispatch config headers
|
| 470 |
+
# and Meson headers, avoiding build disruptions.
|
| 471 |
+
# See gh-24450 for more details.
|
| 472 |
+
copt_build_src = bsrc_dir
|
| 473 |
+
for _srcs, _dst, _ext in (
|
| 474 |
+
((c_sources,), copt_c_sources, ('.dispatch.c',)),
|
| 475 |
+
((c_sources, cxx_sources), copt_cxx_sources,
|
| 476 |
+
('.dispatch.cpp', '.dispatch.cxx'))
|
| 477 |
+
):
|
| 478 |
+
for _src in _srcs:
|
| 479 |
+
_dst += [
|
| 480 |
+
_src.pop(_src.index(s))
|
| 481 |
+
for s in _src[:] if s.endswith(_ext)
|
| 482 |
+
]
|
| 483 |
+
copt_baseline_flags = self.compiler_opt.cpu_baseline_flags()
|
| 484 |
+
else:
|
| 485 |
+
copt_macros.append(("NPY_DISABLE_OPTIMIZATION", 1))
|
| 486 |
+
|
| 487 |
+
c_objects = []
|
| 488 |
+
if copt_cxx_sources:
|
| 489 |
+
log.info("compiling C++ dispatch-able sources")
|
| 490 |
+
c_objects += self.compiler_opt.try_dispatch(
|
| 491 |
+
copt_cxx_sources,
|
| 492 |
+
output_dir=output_dir,
|
| 493 |
+
src_dir=copt_build_src,
|
| 494 |
+
macros=macros + copt_macros,
|
| 495 |
+
include_dirs=include_dirs,
|
| 496 |
+
debug=self.debug,
|
| 497 |
+
extra_postargs=extra_args + extra_cxxflags,
|
| 498 |
+
ccompiler=cxx_compiler,
|
| 499 |
+
**kws
|
| 500 |
+
)
|
| 501 |
+
if copt_c_sources:
|
| 502 |
+
log.info("compiling C dispatch-able sources")
|
| 503 |
+
c_objects += self.compiler_opt.try_dispatch(
|
| 504 |
+
copt_c_sources,
|
| 505 |
+
output_dir=output_dir,
|
| 506 |
+
src_dir=copt_build_src,
|
| 507 |
+
macros=macros + copt_macros,
|
| 508 |
+
include_dirs=include_dirs,
|
| 509 |
+
debug=self.debug,
|
| 510 |
+
extra_postargs=extra_args + extra_cflags,
|
| 511 |
+
**kws)
|
| 512 |
+
if c_sources:
|
| 513 |
+
log.info("compiling C sources")
|
| 514 |
+
c_objects += self.compiler.compile(
|
| 515 |
+
c_sources,
|
| 516 |
+
output_dir=output_dir,
|
| 517 |
+
macros=macros + copt_macros,
|
| 518 |
+
include_dirs=include_dirs,
|
| 519 |
+
debug=self.debug,
|
| 520 |
+
extra_postargs=(extra_args + copt_baseline_flags +
|
| 521 |
+
extra_cflags),
|
| 522 |
+
**kws)
|
| 523 |
+
if cxx_sources:
|
| 524 |
+
log.info("compiling C++ sources")
|
| 525 |
+
c_objects += cxx_compiler.compile(
|
| 526 |
+
cxx_sources,
|
| 527 |
+
output_dir=output_dir,
|
| 528 |
+
macros=macros + copt_macros,
|
| 529 |
+
include_dirs=include_dirs,
|
| 530 |
+
debug=self.debug,
|
| 531 |
+
extra_postargs=(extra_args + copt_baseline_flags +
|
| 532 |
+
extra_cxxflags),
|
| 533 |
+
**kws)
|
| 534 |
+
|
| 535 |
+
extra_postargs = []
|
| 536 |
+
f_objects = []
|
| 537 |
+
if fmodule_sources:
|
| 538 |
+
log.info("compiling Fortran 90 module sources")
|
| 539 |
+
module_dirs = ext.module_dirs[:]
|
| 540 |
+
module_build_dir = os.path.join(
|
| 541 |
+
self.build_temp, os.path.dirname(
|
| 542 |
+
self.get_ext_filename(fullname)))
|
| 543 |
+
|
| 544 |
+
self.mkpath(module_build_dir)
|
| 545 |
+
if fcompiler.module_dir_switch is None:
|
| 546 |
+
existing_modules = glob('*.mod')
|
| 547 |
+
extra_postargs += fcompiler.module_options(
|
| 548 |
+
module_dirs, module_build_dir)
|
| 549 |
+
f_objects += fcompiler.compile(fmodule_sources,
|
| 550 |
+
output_dir=self.build_temp,
|
| 551 |
+
macros=macros,
|
| 552 |
+
include_dirs=include_dirs,
|
| 553 |
+
debug=self.debug,
|
| 554 |
+
extra_postargs=extra_postargs,
|
| 555 |
+
depends=ext.depends)
|
| 556 |
+
|
| 557 |
+
if fcompiler.module_dir_switch is None:
|
| 558 |
+
for f in glob('*.mod'):
|
| 559 |
+
if f in existing_modules:
|
| 560 |
+
continue
|
| 561 |
+
t = os.path.join(module_build_dir, f)
|
| 562 |
+
if os.path.abspath(f) == os.path.abspath(t):
|
| 563 |
+
continue
|
| 564 |
+
if os.path.isfile(t):
|
| 565 |
+
os.remove(t)
|
| 566 |
+
try:
|
| 567 |
+
self.move_file(f, module_build_dir)
|
| 568 |
+
except DistutilsFileError:
|
| 569 |
+
log.warn('failed to move %r to %r' %
|
| 570 |
+
(f, module_build_dir))
|
| 571 |
+
if f_sources:
|
| 572 |
+
log.info("compiling Fortran sources")
|
| 573 |
+
f_objects += fcompiler.compile(f_sources,
|
| 574 |
+
output_dir=self.build_temp,
|
| 575 |
+
macros=macros,
|
| 576 |
+
include_dirs=include_dirs,
|
| 577 |
+
debug=self.debug,
|
| 578 |
+
extra_postargs=extra_postargs,
|
| 579 |
+
depends=ext.depends)
|
| 580 |
+
|
| 581 |
+
if f_objects and not fcompiler.can_ccompiler_link(self.compiler):
|
| 582 |
+
unlinkable_fobjects = f_objects
|
| 583 |
+
objects = c_objects
|
| 584 |
+
else:
|
| 585 |
+
unlinkable_fobjects = []
|
| 586 |
+
objects = c_objects + f_objects
|
| 587 |
+
|
| 588 |
+
if ext.extra_objects:
|
| 589 |
+
objects.extend(ext.extra_objects)
|
| 590 |
+
extra_args = ext.extra_link_args or []
|
| 591 |
+
libraries = self.get_libraries(ext)[:]
|
| 592 |
+
library_dirs = ext.library_dirs[:]
|
| 593 |
+
|
| 594 |
+
linker = self.compiler.link_shared_object
|
| 595 |
+
# Always use system linker when using MSVC compiler.
|
| 596 |
+
if self.compiler.compiler_type in ('msvc', 'intelw', 'intelemw'):
|
| 597 |
+
# expand libraries with fcompiler libraries as we are
|
| 598 |
+
# not using fcompiler linker
|
| 599 |
+
self._libs_with_msvc_and_fortran(
|
| 600 |
+
fcompiler, libraries, library_dirs)
|
| 601 |
+
if ext.runtime_library_dirs:
|
| 602 |
+
# gcc adds RPATH to the link. On windows, copy the dll into
|
| 603 |
+
# self.extra_dll_dir instead.
|
| 604 |
+
for d in ext.runtime_library_dirs:
|
| 605 |
+
for f in glob(d + '/*.dll'):
|
| 606 |
+
copy_file(f, self.extra_dll_dir)
|
| 607 |
+
ext.runtime_library_dirs = []
|
| 608 |
+
|
| 609 |
+
elif ext.language in ['f77', 'f90'] and fcompiler is not None:
|
| 610 |
+
linker = fcompiler.link_shared_object
|
| 611 |
+
if ext.language == 'c++' and cxx_compiler is not None:
|
| 612 |
+
linker = cxx_compiler.link_shared_object
|
| 613 |
+
|
| 614 |
+
if fcompiler is not None:
|
| 615 |
+
objects, libraries = self._process_unlinkable_fobjects(
|
| 616 |
+
objects, libraries,
|
| 617 |
+
fcompiler, library_dirs,
|
| 618 |
+
unlinkable_fobjects)
|
| 619 |
+
|
| 620 |
+
linker(objects, ext_filename,
|
| 621 |
+
libraries=libraries,
|
| 622 |
+
library_dirs=library_dirs,
|
| 623 |
+
runtime_library_dirs=ext.runtime_library_dirs,
|
| 624 |
+
extra_postargs=extra_args,
|
| 625 |
+
export_symbols=self.get_export_symbols(ext),
|
| 626 |
+
debug=self.debug,
|
| 627 |
+
build_temp=self.build_temp,
|
| 628 |
+
target_lang=ext.language)
|
| 629 |
+
|
| 630 |
+
def _add_dummy_mingwex_sym(self, c_sources):
|
| 631 |
+
build_src = self.get_finalized_command("build_src").build_src
|
| 632 |
+
build_clib = self.get_finalized_command("build_clib").build_clib
|
| 633 |
+
objects = self.compiler.compile([os.path.join(build_src,
|
| 634 |
+
"gfortran_vs2003_hack.c")],
|
| 635 |
+
output_dir=self.build_temp)
|
| 636 |
+
self.compiler.create_static_lib(
|
| 637 |
+
objects, "_gfortran_workaround", output_dir=build_clib, debug=self.debug)
|
| 638 |
+
|
| 639 |
+
def _process_unlinkable_fobjects(self, objects, libraries,
|
| 640 |
+
fcompiler, library_dirs,
|
| 641 |
+
unlinkable_fobjects):
|
| 642 |
+
libraries = list(libraries)
|
| 643 |
+
objects = list(objects)
|
| 644 |
+
unlinkable_fobjects = list(unlinkable_fobjects)
|
| 645 |
+
|
| 646 |
+
# Expand possible fake static libraries to objects;
|
| 647 |
+
# make sure to iterate over a copy of the list as
|
| 648 |
+
# "fake" libraries will be removed as they are
|
| 649 |
+
# encountered
|
| 650 |
+
for lib in libraries[:]:
|
| 651 |
+
for libdir in library_dirs:
|
| 652 |
+
fake_lib = os.path.join(libdir, lib + '.fobjects')
|
| 653 |
+
if os.path.isfile(fake_lib):
|
| 654 |
+
# Replace fake static library
|
| 655 |
+
libraries.remove(lib)
|
| 656 |
+
with open(fake_lib) as f:
|
| 657 |
+
unlinkable_fobjects.extend(f.read().splitlines())
|
| 658 |
+
|
| 659 |
+
# Expand C objects
|
| 660 |
+
c_lib = os.path.join(libdir, lib + '.cobjects')
|
| 661 |
+
with open(c_lib) as f:
|
| 662 |
+
objects.extend(f.read().splitlines())
|
| 663 |
+
|
| 664 |
+
# Wrap unlinkable objects to a linkable one
|
| 665 |
+
if unlinkable_fobjects:
|
| 666 |
+
fobjects = [os.path.abspath(obj) for obj in unlinkable_fobjects]
|
| 667 |
+
wrapped = fcompiler.wrap_unlinkable_objects(
|
| 668 |
+
fobjects, output_dir=self.build_temp,
|
| 669 |
+
extra_dll_dir=self.extra_dll_dir)
|
| 670 |
+
objects.extend(wrapped)
|
| 671 |
+
|
| 672 |
+
return objects, libraries
|
| 673 |
+
|
| 674 |
+
def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries,
|
| 675 |
+
c_library_dirs):
|
| 676 |
+
if fcompiler is None:
|
| 677 |
+
return
|
| 678 |
+
|
| 679 |
+
for libname in c_libraries:
|
| 680 |
+
if libname.startswith('msvc'):
|
| 681 |
+
continue
|
| 682 |
+
fileexists = False
|
| 683 |
+
for libdir in c_library_dirs or []:
|
| 684 |
+
libfile = os.path.join(libdir, '%s.lib' % (libname))
|
| 685 |
+
if os.path.isfile(libfile):
|
| 686 |
+
fileexists = True
|
| 687 |
+
break
|
| 688 |
+
if fileexists:
|
| 689 |
+
continue
|
| 690 |
+
# make g77-compiled static libs available to MSVC
|
| 691 |
+
fileexists = False
|
| 692 |
+
for libdir in c_library_dirs:
|
| 693 |
+
libfile = os.path.join(libdir, 'lib%s.a' % (libname))
|
| 694 |
+
if os.path.isfile(libfile):
|
| 695 |
+
# copy libname.a file to name.lib so that MSVC linker
|
| 696 |
+
# can find it
|
| 697 |
+
libfile2 = os.path.join(self.build_temp, libname + '.lib')
|
| 698 |
+
copy_file(libfile, libfile2)
|
| 699 |
+
if self.build_temp not in c_library_dirs:
|
| 700 |
+
c_library_dirs.append(self.build_temp)
|
| 701 |
+
fileexists = True
|
| 702 |
+
break
|
| 703 |
+
if fileexists:
|
| 704 |
+
continue
|
| 705 |
+
log.warn('could not find library %r in directories %s'
|
| 706 |
+
% (libname, c_library_dirs))
|
| 707 |
+
|
| 708 |
+
# Always use system linker when using MSVC compiler.
|
| 709 |
+
f_lib_dirs = []
|
| 710 |
+
for dir in fcompiler.library_dirs:
|
| 711 |
+
# correct path when compiling in Cygwin but with normal Win
|
| 712 |
+
# Python
|
| 713 |
+
if dir.startswith('/usr/lib'):
|
| 714 |
+
try:
|
| 715 |
+
dir = subprocess.check_output(['cygpath', '-w', dir])
|
| 716 |
+
except (OSError, subprocess.CalledProcessError):
|
| 717 |
+
pass
|
| 718 |
+
else:
|
| 719 |
+
dir = filepath_from_subprocess_output(dir)
|
| 720 |
+
f_lib_dirs.append(dir)
|
| 721 |
+
c_library_dirs.extend(f_lib_dirs)
|
| 722 |
+
|
| 723 |
+
# make g77-compiled static libs available to MSVC
|
| 724 |
+
for lib in fcompiler.libraries:
|
| 725 |
+
if not lib.startswith('msvc'):
|
| 726 |
+
c_libraries.append(lib)
|
| 727 |
+
p = combine_paths(f_lib_dirs, 'lib' + lib + '.a')
|
| 728 |
+
if p:
|
| 729 |
+
dst_name = os.path.join(self.build_temp, lib + '.lib')
|
| 730 |
+
if not os.path.isfile(dst_name):
|
| 731 |
+
copy_file(p[0], dst_name)
|
| 732 |
+
if self.build_temp not in c_library_dirs:
|
| 733 |
+
c_library_dirs.append(self.build_temp)
|
| 734 |
+
|
| 735 |
+
def get_source_files(self):
|
| 736 |
+
self.check_extensions_list(self.extensions)
|
| 737 |
+
filenames = []
|
| 738 |
+
for ext in self.extensions:
|
| 739 |
+
filenames.extend(get_ext_source_files(ext))
|
| 740 |
+
return filenames
|
| 741 |
+
|
| 742 |
+
def get_outputs(self):
|
| 743 |
+
self.check_extensions_list(self.extensions)
|
| 744 |
+
|
| 745 |
+
outputs = []
|
| 746 |
+
for ext in self.extensions:
|
| 747 |
+
if not ext.sources:
|
| 748 |
+
continue
|
| 749 |
+
fullname = self.get_ext_fullname(ext.name)
|
| 750 |
+
outputs.append(os.path.join(self.build_lib,
|
| 751 |
+
self.get_ext_filename(fullname)))
|
| 752 |
+
return outputs
|