godlykmathews commited on
Commit
886c6cd
·
verified ·
1 Parent(s): 10f13f9

Upload folder using huggingface_hub (part 8)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +33 -0
  2. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/INSTALLER +1 -0
  3. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/METADATA +139 -0
  4. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/RECORD +0 -0
  5. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/WHEEL +6 -0
  6. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/entry_points.txt +13 -0
  7. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/LICENSE.txt +935 -0
  8. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/include/numpy/libdivide/LICENSE.txt +21 -0
  9. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/common/pythoncapi-compat/COPYING +14 -0
  10. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/highway/LICENSE +371 -0
  11. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/multiarray/dragon4_LICENSE.txt +27 -0
  12. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/npysort/x86-simd-sort/LICENSE.md +28 -0
  13. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/umath/svml/LICENSE +30 -0
  14. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/fft/pocketfft/LICENSE.md +25 -0
  15. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/linalg/lapack_lite/LICENSE.txt +48 -0
  16. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/ma/LICENSE +24 -0
  17. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/LICENSE.md +71 -0
  18. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/distributions/LICENSE.md +61 -0
  19. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/mt19937/LICENSE.md +61 -0
  20. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/pcg64/LICENSE.md +22 -0
  21. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/philox/LICENSE.md +31 -0
  22. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/sfc64/LICENSE.md +27 -0
  23. venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/splitmix64/LICENSE.md +9 -0
  24. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/routines/subrout.f +4 -0
  25. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/routines/subrout.pyf +10 -0
  26. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/size/foo.f90 +44 -0
  27. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/char.f90 +29 -0
  28. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/fixed_string.f90 +34 -0
  29. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh24008.f +8 -0
  30. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh24662.f90 +7 -0
  31. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286.f90 +14 -0
  32. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286.pyf +12 -0
  33. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286_bc.pyf +12 -0
  34. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/scalar_string.f90 +9 -0
  35. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/string.f +12 -0
  36. venv/lib/python3.14/site-packages/numpy/f2py/tests/src/value_attrspec/gh21665.f90 +9 -0
  37. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_abstract_interface.py +26 -0
  38. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_array_from_pyobj.py +732 -0
  39. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_assumed_shape.py +52 -0
  40. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_block_docstring.py +16 -0
  41. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_callback.py +262 -0
  42. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_capi_maps.py +10 -0
  43. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py +644 -0
  44. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_common.py +24 -0
  45. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py +427 -0
  46. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py +74 -0
  47. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_docs.py +66 -0
  48. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_f2cmap.py +20 -0
  49. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.py +1006 -0
  50. venv/lib/python3.14/site-packages/numpy/f2py/tests/test_inplace.py +49 -0
.gitattributes CHANGED
@@ -65,3 +65,36 @@ venv/lib/python3.14/site-packages/networkx/drawing/tests/baseline/test_display_c
65
  venv/lib/python3.14/site-packages/numpy/_core/_multiarray_tests.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
66
  venv/lib/python3.14/site-packages/numpy/_core/_multiarray_umath.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
67
  venv/lib/python3.14/site-packages/numpy/_core/_simd.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  venv/lib/python3.14/site-packages/numpy/_core/_multiarray_tests.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
66
  venv/lib/python3.14/site-packages/numpy/_core/_multiarray_umath.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
67
  venv/lib/python3.14/site-packages/numpy/_core/_simd.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
68
+ venv/lib/python3.14/site-packages/numpy/fft/_pocketfft_umath.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
69
+ venv/lib/python3.14/site-packages/numpy/linalg/_umath_linalg.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
70
+ venv/lib/python3.14/site-packages/numpy/random/_bounded_integers.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
71
+ venv/lib/python3.14/site-packages/numpy/random/_common.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
72
+ venv/lib/python3.14/site-packages/numpy/random/_generator.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
73
+ venv/lib/python3.14/site-packages/numpy/random/_mt19937.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
74
+ venv/lib/python3.14/site-packages/numpy/random/_pcg64.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
75
+ venv/lib/python3.14/site-packages/numpy/random/_philox.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
76
+ venv/lib/python3.14/site-packages/numpy/random/bit_generator.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
77
+ venv/lib/python3.14/site-packages/numpy/random/mtrand.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
78
+ venv/lib/python3.14/site-packages/pandas/_libs/_cyutility.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
79
+ venv/lib/python3.14/site-packages/pandas/_libs/algos.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
80
+ venv/lib/python3.14/site-packages/pandas/_libs/arrays.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
81
+ venv/lib/python3.14/site-packages/pandas/_libs/groupby.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
82
+ venv/lib/python3.14/site-packages/pandas/_libs/hashtable.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
83
+ venv/lib/python3.14/site-packages/pandas/_libs/index.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
84
+ venv/lib/python3.14/site-packages/pandas/_libs/internals.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
85
+ venv/lib/python3.14/site-packages/pandas/_libs/interval.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
86
+ venv/lib/python3.14/site-packages/pandas/_libs/join.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
87
+ venv/lib/python3.14/site-packages/pandas/_libs/lib.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
88
+ venv/lib/python3.14/site-packages/pandas/_libs/missing.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
89
+ venv/lib/python3.14/site-packages/pandas/_libs/ops.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
90
+ venv/lib/python3.14/site-packages/pandas/_libs/pandas_parser.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
91
+ venv/lib/python3.14/site-packages/pandas/_libs/parsers.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
92
+ venv/lib/python3.14/site-packages/pandas/_libs/reshape.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
93
+ venv/lib/python3.14/site-packages/pandas/_libs/sas.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
94
+ venv/lib/python3.14/site-packages/pandas/_libs/sparse.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
95
+ venv/lib/python3.14/site-packages/pandas/_libs/testing.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
96
+ venv/lib/python3.14/site-packages/pandas/_libs/tslib.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
97
+ venv/lib/python3.14/site-packages/pandas/_libs/tslibs/conversion.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
98
+ venv/lib/python3.14/site-packages/pandas/_libs/tslibs/dtypes.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
99
+ venv/lib/python3.14/site-packages/pandas/_libs/tslibs/fields.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
100
+ venv/lib/python3.14/site-packages/pandas/_libs/tslibs/nattype.cpython-314-darwin.so filter=lfs diff=lfs merge=lfs -text
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/METADATA ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: numpy
3
+ Version: 2.5.4
4
+ Summary: Fundamental package for array computing in Python
5
+ Author: Travis E. Oliphant et al.
6
+ Maintainer-Email: NumPy Developers <numpy-discussion@python.org>
7
+ License-Expression: BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0
8
+ License-File: LICENSE.txt
9
+ License-File: numpy/_core/include/numpy/libdivide/LICENSE.txt
10
+ License-File: numpy/_core/src/common/pythoncapi-compat/COPYING
11
+ License-File: numpy/_core/src/highway/LICENSE
12
+ License-File: numpy/_core/src/multiarray/dragon4_LICENSE.txt
13
+ License-File: numpy/_core/src/npysort/x86-simd-sort/LICENSE.md
14
+ License-File: numpy/_core/src/umath/svml/LICENSE
15
+ License-File: numpy/fft/pocketfft/LICENSE.md
16
+ License-File: numpy/linalg/lapack_lite/LICENSE.txt
17
+ License-File: numpy/ma/LICENSE
18
+ License-File: numpy/random/LICENSE.md
19
+ License-File: numpy/random/src/distributions/LICENSE.md
20
+ License-File: numpy/random/src/mt19937/LICENSE.md
21
+ License-File: numpy/random/src/pcg64/LICENSE.md
22
+ License-File: numpy/random/src/philox/LICENSE.md
23
+ License-File: numpy/random/src/sfc64/LICENSE.md
24
+ License-File: numpy/random/src/splitmix64/LICENSE.md
25
+ Classifier: Development Status :: 5 - Production/Stable
26
+ Classifier: Intended Audience :: Science/Research
27
+ Classifier: Intended Audience :: Developers
28
+ Classifier: Programming Language :: C
29
+ Classifier: Programming Language :: Python
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: Programming Language :: Python :: 3.12
32
+ Classifier: Programming Language :: Python :: 3.13
33
+ Classifier: Programming Language :: Python :: 3.14
34
+ Classifier: Programming Language :: Python :: 3.15
35
+ Classifier: Programming Language :: Python :: 3 :: Only
36
+ Classifier: Programming Language :: Python :: Implementation :: CPython
37
+ Classifier: Topic :: Software Development
38
+ Classifier: Topic :: Scientific/Engineering
39
+ Classifier: Typing :: Typed
40
+ Classifier: Operating System :: Microsoft :: Windows
41
+ Classifier: Operating System :: POSIX
42
+ Classifier: Operating System :: Unix
43
+ Classifier: Operating System :: MacOS
44
+ Project-URL: homepage, https://numpy.org
45
+ Project-URL: documentation, https://numpy.org/doc/
46
+ Project-URL: source, https://github.com/numpy/numpy
47
+ Project-URL: download, https://pypi.org/project/numpy/#files
48
+ Project-URL: tracker, https://github.com/numpy/numpy/issues
49
+ Project-URL: release notes, https://numpy.org/doc/stable/release
50
+ Requires-Python: >=3.12
51
+ Description-Content-Type: text/markdown
52
+
53
+ <h1 align="center">
54
+ <img src="https://raw.githubusercontent.com/numpy/numpy/main/branding/logo/primary/numpylogo.svg" width="300">
55
+ </h1><br>
56
+
57
+
58
+ [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](
59
+ https://numfocus.org)
60
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/numpy.svg?label=PyPI%20downloads)](
61
+ https://pypi.org/project/numpy/)
62
+ [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/numpy.svg?label=Conda%20downloads)](
63
+ https://anaconda.org/conda-forge/numpy)
64
+ [![Stack Overflow](https://img.shields.io/badge/stackoverflow-Ask%20questions-blue.svg)](
65
+ https://stackoverflow.com/questions/tagged/numpy)
66
+ [![Nature Paper](https://img.shields.io/badge/DOI-10.1038%2Fs41586--020--2649--2-blue)](
67
+ https://doi.org/10.1038/s41586-020-2649-2)
68
+ [![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=numpy)](https://insights.linuxfoundation.org/project/numpy)
69
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/numpy/numpy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/numpy/numpy)
70
+ [![Typing](https://img.shields.io/pypi/types/numpy)](https://pypi.org/project/numpy/)
71
+
72
+
73
+ NumPy is the fundamental package for scientific computing with Python.
74
+
75
+ - **Website:** https://numpy.org
76
+ - **Documentation:** https://numpy.org/doc
77
+ - **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion
78
+ - **Source code:** https://github.com/numpy/numpy
79
+ - **Contributing:** https://numpy.org/devdocs/dev/index.html
80
+ - **Bug reports:** https://github.com/numpy/numpy/issues
81
+ - **Report a security vulnerability:** https://github.com/numpy/numpy/security/policy (via Tidelift)
82
+
83
+ It provides:
84
+
85
+ - a powerful N-dimensional array object
86
+ - sophisticated (broadcasting) functions
87
+ - tools for integrating C/C++ and Fortran code
88
+ - useful linear algebra, Fourier transform, and random number capabilities
89
+
90
+ Testing:
91
+
92
+ NumPy requires `pytest` and `hypothesis`. Tests can then be run after installation with:
93
+
94
+ python -c "import numpy, sys; sys.exit(numpy.test() is False)"
95
+
96
+ Code of Conduct
97
+ ----------------------
98
+
99
+ NumPy is a community-driven open source project developed by a diverse group of
100
+ [contributors](https://numpy.org/teams/). The NumPy leadership has made a strong
101
+ commitment to creating an open, inclusive, and positive community. Please read the
102
+ [NumPy Code of Conduct](https://numpy.org/code-of-conduct/) for guidance on how to interact
103
+ with others in a way that makes our community thrive.
104
+
105
+ Call for Contributions
106
+ ----------------------
107
+
108
+ The NumPy project welcomes your expertise and enthusiasm!
109
+
110
+ Small improvements or fixes are always appreciated. If you are considering larger contributions
111
+ to the source code, please contact us through the [mailing
112
+ list](https://mail.python.org/mailman/listinfo/numpy-discussion) first.
113
+
114
+ Writing code isn’t the only way to contribute to NumPy. You can also:
115
+ - review pull requests
116
+ - help us stay on top of new and old issues
117
+ - develop tutorials, presentations, and other educational materials
118
+ - maintain and improve [our website](https://github.com/numpy/numpy.org)
119
+ - develop graphic design for our brand assets and promotional materials
120
+ - translate website content
121
+ - help with outreach and onboard new contributors
122
+ - write grant proposals and help with other fundraising efforts
123
+
124
+ For more information about the ways you can contribute to NumPy, visit [our website](https://numpy.org/contribute/).
125
+ If you’re unsure where to start or how your skills fit in, reach out! You can
126
+ ask on the mailing list or here, on GitHub, by opening a new issue or leaving a
127
+ comment on a relevant issue that is already open.
128
+
129
+ Our preferred channels of communication are all public, but if you’d like to
130
+ speak to us in private first, contact our community coordinators at
131
+ numpy-team@googlegroups.com or on Slack (write numpy-team@googlegroups.com for
132
+ an invitation).
133
+
134
+ We also have a biweekly community call, details of which are announced on the
135
+ mailing list. You are very welcome to join.
136
+
137
+ If you are new to contributing to open source, [this
138
+ guide](https://opensource.guide/how-to-contribute/) helps explain why, what,
139
+ and how to successfully get involved.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/WHEEL ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: meson
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-macosx_14_0_arm64
5
+ Generator: delocate 0.13.0
6
+
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/entry_points.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [pkg_config]
2
+ numpy = numpy._core.lib.pkgconfig
3
+
4
+ [array_api]
5
+ numpy = numpy
6
+
7
+ [pyinstaller40]
8
+ hook-dirs = numpy:_pyinstaller_hooks_dir
9
+
10
+ [console_scripts]
11
+ f2py = numpy.f2py.f2py2e:main
12
+ numpy-config = numpy._configtool:main
13
+
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/LICENSE.txt ADDED
@@ -0,0 +1,935 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2005-2025, 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
+
35
+ ----
36
+
37
+ This binary distribution of NumPy also bundles the following software:
38
+
39
+
40
+ Name: OpenBLAS
41
+ Files: numpy/.dylibs/libscipy_openblas*.so
42
+ Description: bundled as a dynamically linked library
43
+ Availability: https://github.com/OpenMathLib/OpenBLAS/
44
+ License: BSD-3-Clause
45
+ Copyright (c) 2011-2014, The OpenBLAS Project
46
+ All rights reserved.
47
+
48
+ Redistribution and use in source and binary forms, with or without
49
+ modification, are permitted provided that the following conditions are
50
+ met:
51
+
52
+ 1. Redistributions of source code must retain the above copyright
53
+ notice, this list of conditions and the following disclaimer.
54
+
55
+ 2. Redistributions in binary form must reproduce the above copyright
56
+ notice, this list of conditions and the following disclaimer in
57
+ the documentation and/or other materials provided with the
58
+ distribution.
59
+ 3. Neither the name of the OpenBLAS project nor the names of
60
+ its contributors may be used to endorse or promote products
61
+ derived from this software without specific prior written
62
+ permission.
63
+
64
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
65
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
67
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
68
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
70
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
71
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
72
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
73
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74
+
75
+
76
+ Name: LAPACK
77
+ Files: numpy/.dylibs/libscipy_openblas*.so
78
+ Description: bundled in OpenBLAS
79
+ Availability: https://github.com/OpenMathLib/OpenBLAS/
80
+ License: BSD-3-Clause-Open-MPI
81
+ Copyright (c) 1992-2013 The University of Tennessee and The University
82
+ of Tennessee Research Foundation. All rights
83
+ reserved.
84
+ Copyright (c) 2000-2013 The University of California Berkeley. All
85
+ rights reserved.
86
+ Copyright (c) 2006-2013 The University of Colorado Denver. All rights
87
+ reserved.
88
+
89
+ $COPYRIGHT$
90
+
91
+ Additional copyrights may follow
92
+
93
+ $HEADER$
94
+
95
+ Redistribution and use in source and binary forms, with or without
96
+ modification, are permitted provided that the following conditions are
97
+ met:
98
+
99
+ - Redistributions of source code must retain the above copyright
100
+ notice, this list of conditions and the following disclaimer.
101
+
102
+ - Redistributions in binary form must reproduce the above copyright
103
+ notice, this list of conditions and the following disclaimer listed
104
+ in this license in the documentation and/or other materials
105
+ provided with the distribution.
106
+
107
+ - Neither the name of the copyright holders nor the names of its
108
+ contributors may be used to endorse or promote products derived from
109
+ this software without specific prior written permission.
110
+
111
+ The copyright holders provide no reassurances that the source code
112
+ provided does not infringe any patent, copyright, or any other
113
+ intellectual property rights of third parties. The copyright holders
114
+ disclaim any liability to any recipient for claims brought against
115
+ recipient by any third party for infringement of that parties
116
+ intellectual property rights.
117
+
118
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
119
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
120
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
121
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
122
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
123
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
124
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
125
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
126
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
127
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
128
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129
+
130
+
131
+ Name: GCC runtime library
132
+ Files: numpy/.dylibs/libgfortran*, numpy/.dylibs/libgcc*
133
+ Description: dynamically linked to files compiled with gcc
134
+ Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libgfortran
135
+ License: GPL-3.0-or-later WITH GCC-exception-3.1
136
+ Copyright (C) 2002-2017 Free Software Foundation, Inc.
137
+
138
+ Libgfortran is free software; you can redistribute it and/or modify
139
+ it under the terms of the GNU General Public License as published by
140
+ the Free Software Foundation; either version 3, or (at your option)
141
+ any later version.
142
+
143
+ Libgfortran is distributed in the hope that it will be useful,
144
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
145
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146
+ GNU General Public License for more details.
147
+
148
+ Under Section 7 of GPL version 3, you are granted additional
149
+ permissions described in the GCC Runtime Library Exception, version
150
+ 3.1, as published by the Free Software Foundation.
151
+
152
+ You should have received a copy of the GNU General Public License and
153
+ a copy of the GCC Runtime Library Exception along with this program;
154
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
155
+ <http://www.gnu.org/licenses/>.
156
+
157
+ ----
158
+
159
+ Full text of license texts referred to above follows (that they are
160
+ listed below does not necessarily imply the conditions apply to the
161
+ present binary release):
162
+
163
+ ----
164
+
165
+ GCC RUNTIME LIBRARY EXCEPTION
166
+
167
+ Version 3.1, 31 March 2009
168
+
169
+ Copyright (C) 2009 Free Software Foundation, Inc. <https://fsf.org/>
170
+
171
+ Everyone is permitted to copy and distribute verbatim copies of this
172
+ license document, but changing it is not allowed.
173
+
174
+ This GCC Runtime Library Exception ("Exception") is an additional
175
+ permission under section 7 of the GNU General Public License, version
176
+ 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
177
+ bears a notice placed by the copyright holder of the file stating that
178
+ the file is governed by GPLv3 along with this Exception.
179
+
180
+ When you use GCC to compile a program, GCC may combine portions of
181
+ certain GCC header files and runtime libraries with the compiled
182
+ program. The purpose of this Exception is to allow compilation of
183
+ non-GPL (including proprietary) programs to use, in this way, the
184
+ header files and runtime libraries covered by this Exception.
185
+
186
+ 0. Definitions.
187
+
188
+ A file is an "Independent Module" if it either requires the Runtime
189
+ Library for execution after a Compilation Process, or makes use of an
190
+ interface provided by the Runtime Library, but is not otherwise based
191
+ on the Runtime Library.
192
+
193
+ "GCC" means a version of the GNU Compiler Collection, with or without
194
+ modifications, governed by version 3 (or a specified later version) of
195
+ the GNU General Public License (GPL) with the option of using any
196
+ subsequent versions published by the FSF.
197
+
198
+ "GPL-compatible Software" is software whose conditions of propagation,
199
+ modification and use would permit combination with GCC in accord with
200
+ the license of GCC.
201
+
202
+ "Target Code" refers to output from any compiler for a real or virtual
203
+ target processor architecture, in executable form or suitable for
204
+ input to an assembler, loader, linker and/or execution
205
+ phase. Notwithstanding that, Target Code does not include data in any
206
+ format that is used as a compiler intermediate representation, or used
207
+ for producing a compiler intermediate representation.
208
+
209
+ The "Compilation Process" transforms code entirely represented in
210
+ non-intermediate languages designed for human-written code, and/or in
211
+ Java Virtual Machine byte code, into Target Code. Thus, for example,
212
+ use of source code generators and preprocessors need not be considered
213
+ part of the Compilation Process, since the Compilation Process can be
214
+ understood as starting with the output of the generators or
215
+ preprocessors.
216
+
217
+ A Compilation Process is "Eligible" if it is done using GCC, alone or
218
+ with other GPL-compatible software, or if it is done without using any
219
+ work based on GCC. For example, using non-GPL-compatible Software to
220
+ optimize any GCC intermediate representations would not qualify as an
221
+ Eligible Compilation Process.
222
+
223
+ 1. Grant of Additional Permission.
224
+
225
+ You have permission to propagate a work of Target Code formed by
226
+ combining the Runtime Library with Independent Modules, even if such
227
+ propagation would otherwise violate the terms of GPLv3, provided that
228
+ all Target Code was generated by Eligible Compilation Processes. You
229
+ may then convey such a combination under terms of your choice,
230
+ consistent with the licensing of the Independent Modules.
231
+
232
+ 2. No Weakening of GCC Copyleft.
233
+
234
+ The availability of this Exception does not imply any general
235
+ presumption that third-party software is unaffected by the copyleft
236
+ requirements of the license of GCC.
237
+
238
+ ----
239
+
240
+ GNU GENERAL PUBLIC LICENSE
241
+ Version 3, 29 June 2007
242
+
243
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
244
+ Everyone is permitted to copy and distribute verbatim copies
245
+ of this license document, but changing it is not allowed.
246
+
247
+ Preamble
248
+
249
+ The GNU General Public License is a free, copyleft license for
250
+ software and other kinds of works.
251
+
252
+ The licenses for most software and other practical works are designed
253
+ to take away your freedom to share and change the works. By contrast,
254
+ the GNU General Public License is intended to guarantee your freedom to
255
+ share and change all versions of a program--to make sure it remains free
256
+ software for all its users. We, the Free Software Foundation, use the
257
+ GNU General Public License for most of our software; it applies also to
258
+ any other work released this way by its authors. You can apply it to
259
+ your programs, too.
260
+
261
+ When we speak of free software, we are referring to freedom, not
262
+ price. Our General Public Licenses are designed to make sure that you
263
+ have the freedom to distribute copies of free software (and charge for
264
+ them if you wish), that you receive source code or can get it if you
265
+ want it, that you can change the software or use pieces of it in new
266
+ free programs, and that you know you can do these things.
267
+
268
+ To protect your rights, we need to prevent others from denying you
269
+ these rights or asking you to surrender the rights. Therefore, you have
270
+ certain responsibilities if you distribute copies of the software, or if
271
+ you modify it: responsibilities to respect the freedom of others.
272
+
273
+ For example, if you distribute copies of such a program, whether
274
+ gratis or for a fee, you must pass on to the recipients the same
275
+ freedoms that you received. You must make sure that they, too, receive
276
+ or can get the source code. And you must show them these terms so they
277
+ know their rights.
278
+
279
+ Developers that use the GNU GPL protect your rights with two steps:
280
+ (1) assert copyright on the software, and (2) offer you this License
281
+ giving you legal permission to copy, distribute and/or modify it.
282
+
283
+ For the developers' and authors' protection, the GPL clearly explains
284
+ that there is no warranty for this free software. For both users' and
285
+ authors' sake, the GPL requires that modified versions be marked as
286
+ changed, so that their problems will not be attributed erroneously to
287
+ authors of previous versions.
288
+
289
+ Some devices are designed to deny users access to install or run
290
+ modified versions of the software inside them, although the manufacturer
291
+ can do so. This is fundamentally incompatible with the aim of
292
+ protecting users' freedom to change the software. The systematic
293
+ pattern of such abuse occurs in the area of products for individuals to
294
+ use, which is precisely where it is most unacceptable. Therefore, we
295
+ have designed this version of the GPL to prohibit the practice for those
296
+ products. If such problems arise substantially in other domains, we
297
+ stand ready to extend this provision to those domains in future versions
298
+ of the GPL, as needed to protect the freedom of users.
299
+
300
+ Finally, every program is threatened constantly by software patents.
301
+ States should not allow patents to restrict development and use of
302
+ software on general-purpose computers, but in those that do, we wish to
303
+ avoid the special danger that patents applied to a free program could
304
+ make it effectively proprietary. To prevent this, the GPL assures that
305
+ patents cannot be used to render the program non-free.
306
+
307
+ The precise terms and conditions for copying, distribution and
308
+ modification follow.
309
+
310
+ TERMS AND CONDITIONS
311
+
312
+ 0. Definitions.
313
+
314
+ "This License" refers to version 3 of the GNU General Public License.
315
+
316
+ "Copyright" also means copyright-like laws that apply to other kinds of
317
+ works, such as semiconductor masks.
318
+
319
+ "The Program" refers to any copyrightable work licensed under this
320
+ License. Each licensee is addressed as "you". "Licensees" and
321
+ "recipients" may be individuals or organizations.
322
+
323
+ To "modify" a work means to copy from or adapt all or part of the work
324
+ in a fashion requiring copyright permission, other than the making of an
325
+ exact copy. The resulting work is called a "modified version" of the
326
+ earlier work or a work "based on" the earlier work.
327
+
328
+ A "covered work" means either the unmodified Program or a work based
329
+ on the Program.
330
+
331
+ To "propagate" a work means to do anything with it that, without
332
+ permission, would make you directly or secondarily liable for
333
+ infringement under applicable copyright law, except executing it on a
334
+ computer or modifying a private copy. Propagation includes copying,
335
+ distribution (with or without modification), making available to the
336
+ public, and in some countries other activities as well.
337
+
338
+ To "convey" a work means any kind of propagation that enables other
339
+ parties to make or receive copies. Mere interaction with a user through
340
+ a computer network, with no transfer of a copy, is not conveying.
341
+
342
+ An interactive user interface displays "Appropriate Legal Notices"
343
+ to the extent that it includes a convenient and prominently visible
344
+ feature that (1) displays an appropriate copyright notice, and (2)
345
+ tells the user that there is no warranty for the work (except to the
346
+ extent that warranties are provided), that licensees may convey the
347
+ work under this License, and how to view a copy of this License. If
348
+ the interface presents a list of user commands or options, such as a
349
+ menu, a prominent item in the list meets this criterion.
350
+
351
+ 1. Source Code.
352
+
353
+ The "source code" for a work means the preferred form of the work
354
+ for making modifications to it. "Object code" means any non-source
355
+ form of a work.
356
+
357
+ A "Standard Interface" means an interface that either is an official
358
+ standard defined by a recognized standards body, or, in the case of
359
+ interfaces specified for a particular programming language, one that
360
+ is widely used among developers working in that language.
361
+
362
+ The "System Libraries" of an executable work include anything, other
363
+ than the work as a whole, that (a) is included in the normal form of
364
+ packaging a Major Component, but which is not part of that Major
365
+ Component, and (b) serves only to enable use of the work with that
366
+ Major Component, or to implement a Standard Interface for which an
367
+ implementation is available to the public in source code form. A
368
+ "Major Component", in this context, means a major essential component
369
+ (kernel, window system, and so on) of the specific operating system
370
+ (if any) on which the executable work runs, or a compiler used to
371
+ produce the work, or an object code interpreter used to run it.
372
+
373
+ The "Corresponding Source" for a work in object code form means all
374
+ the source code needed to generate, install, and (for an executable
375
+ work) run the object code and to modify the work, including scripts to
376
+ control those activities. However, it does not include the work's
377
+ System Libraries, or general-purpose tools or generally available free
378
+ programs which are used unmodified in performing those activities but
379
+ which are not part of the work. For example, Corresponding Source
380
+ includes interface definition files associated with source files for
381
+ the work, and the source code for shared libraries and dynamically
382
+ linked subprograms that the work is specifically designed to require,
383
+ such as by intimate data communication or control flow between those
384
+ subprograms and other parts of the work.
385
+
386
+ The Corresponding Source need not include anything that users
387
+ can regenerate automatically from other parts of the Corresponding
388
+ Source.
389
+
390
+ The Corresponding Source for a work in source code form is that
391
+ same work.
392
+
393
+ 2. Basic Permissions.
394
+
395
+ All rights granted under this License are granted for the term of
396
+ copyright on the Program, and are irrevocable provided the stated
397
+ conditions are met. This License explicitly affirms your unlimited
398
+ permission to run the unmodified Program. The output from running a
399
+ covered work is covered by this License only if the output, given its
400
+ content, constitutes a covered work. This License acknowledges your
401
+ rights of fair use or other equivalent, as provided by copyright law.
402
+
403
+ You may make, run and propagate covered works that you do not
404
+ convey, without conditions so long as your license otherwise remains
405
+ in force. You may convey covered works to others for the sole purpose
406
+ of having them make modifications exclusively for you, or provide you
407
+ with facilities for running those works, provided that you comply with
408
+ the terms of this License in conveying all material for which you do
409
+ not control copyright. Those thus making or running the covered works
410
+ for you must do so exclusively on your behalf, under your direction
411
+ and control, on terms that prohibit them from making any copies of
412
+ your copyrighted material outside their relationship with you.
413
+
414
+ Conveying under any other circumstances is permitted solely under
415
+ the conditions stated below. Sublicensing is not allowed; section 10
416
+ makes it unnecessary.
417
+
418
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
419
+
420
+ No covered work shall be deemed part of an effective technological
421
+ measure under any applicable law fulfilling obligations under article
422
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
423
+ similar laws prohibiting or restricting circumvention of such
424
+ measures.
425
+
426
+ When you convey a covered work, you waive any legal power to forbid
427
+ circumvention of technological measures to the extent such circumvention
428
+ is effected by exercising rights under this License with respect to
429
+ the covered work, and you disclaim any intention to limit operation or
430
+ modification of the work as a means of enforcing, against the work's
431
+ users, your or third parties' legal rights to forbid circumvention of
432
+ technological measures.
433
+
434
+ 4. Conveying Verbatim Copies.
435
+
436
+ You may convey verbatim copies of the Program's source code as you
437
+ receive it, in any medium, provided that you conspicuously and
438
+ appropriately publish on each copy an appropriate copyright notice;
439
+ keep intact all notices stating that this License and any
440
+ non-permissive terms added in accord with section 7 apply to the code;
441
+ keep intact all notices of the absence of any warranty; and give all
442
+ recipients a copy of this License along with the Program.
443
+
444
+ You may charge any price or no price for each copy that you convey,
445
+ and you may offer support or warranty protection for a fee.
446
+
447
+ 5. Conveying Modified Source Versions.
448
+
449
+ You may convey a work based on the Program, or the modifications to
450
+ produce it from the Program, in the form of source code under the
451
+ terms of section 4, provided that you also meet all of these conditions:
452
+
453
+ a) The work must carry prominent notices stating that you modified
454
+ it, and giving a relevant date.
455
+
456
+ b) The work must carry prominent notices stating that it is
457
+ released under this License and any conditions added under section
458
+ 7. This requirement modifies the requirement in section 4 to
459
+ "keep intact all notices".
460
+
461
+ c) You must license the entire work, as a whole, under this
462
+ License to anyone who comes into possession of a copy. This
463
+ License will therefore apply, along with any applicable section 7
464
+ additional terms, to the whole of the work, and all its parts,
465
+ regardless of how they are packaged. This License gives no
466
+ permission to license the work in any other way, but it does not
467
+ invalidate such permission if you have separately received it.
468
+
469
+ d) If the work has interactive user interfaces, each must display
470
+ Appropriate Legal Notices; however, if the Program has interactive
471
+ interfaces that do not display Appropriate Legal Notices, your
472
+ work need not make them do so.
473
+
474
+ A compilation of a covered work with other separate and independent
475
+ works, which are not by their nature extensions of the covered work,
476
+ and which are not combined with it such as to form a larger program,
477
+ in or on a volume of a storage or distribution medium, is called an
478
+ "aggregate" if the compilation and its resulting copyright are not
479
+ used to limit the access or legal rights of the compilation's users
480
+ beyond what the individual works permit. Inclusion of a covered work
481
+ in an aggregate does not cause this License to apply to the other
482
+ parts of the aggregate.
483
+
484
+ 6. Conveying Non-Source Forms.
485
+
486
+ You may convey a covered work in object code form under the terms
487
+ of sections 4 and 5, provided that you also convey the
488
+ machine-readable Corresponding Source under the terms of this License,
489
+ in one of these ways:
490
+
491
+ a) Convey the object code in, or embodied in, a physical product
492
+ (including a physical distribution medium), accompanied by the
493
+ Corresponding Source fixed on a durable physical medium
494
+ customarily used for software interchange.
495
+
496
+ b) Convey the object code in, or embodied in, a physical product
497
+ (including a physical distribution medium), accompanied by a
498
+ written offer, valid for at least three years and valid for as
499
+ long as you offer spare parts or customer support for that product
500
+ model, to give anyone who possesses the object code either (1) a
501
+ copy of the Corresponding Source for all the software in the
502
+ product that is covered by this License, on a durable physical
503
+ medium customarily used for software interchange, for a price no
504
+ more than your reasonable cost of physically performing this
505
+ conveying of source, or (2) access to copy the
506
+ Corresponding Source from a network server at no charge.
507
+
508
+ c) Convey individual copies of the object code with a copy of the
509
+ written offer to provide the Corresponding Source. This
510
+ alternative is allowed only occasionally and noncommercially, and
511
+ only if you received the object code with such an offer, in accord
512
+ with subsection 6b.
513
+
514
+ d) Convey the object code by offering access from a designated
515
+ place (gratis or for a charge), and offer equivalent access to the
516
+ Corresponding Source in the same way through the same place at no
517
+ further charge. You need not require recipients to copy the
518
+ Corresponding Source along with the object code. If the place to
519
+ copy the object code is a network server, the Corresponding Source
520
+ may be on a different server (operated by you or a third party)
521
+ that supports equivalent copying facilities, provided you maintain
522
+ clear directions next to the object code saying where to find the
523
+ Corresponding Source. Regardless of what server hosts the
524
+ Corresponding Source, you remain obligated to ensure that it is
525
+ available for as long as needed to satisfy these requirements.
526
+
527
+ e) Convey the object code using peer-to-peer transmission, provided
528
+ you inform other peers where the object code and Corresponding
529
+ Source of the work are being offered to the general public at no
530
+ charge under subsection 6d.
531
+
532
+ A separable portion of the object code, whose source code is excluded
533
+ from the Corresponding Source as a System Library, need not be
534
+ included in conveying the object code work.
535
+
536
+ A "User Product" is either (1) a "consumer product", which means any
537
+ tangible personal property which is normally used for personal, family,
538
+ or household purposes, or (2) anything designed or sold for incorporation
539
+ into a dwelling. In determining whether a product is a consumer product,
540
+ doubtful cases shall be resolved in favor of coverage. For a particular
541
+ product received by a particular user, "normally used" refers to a
542
+ typical or common use of that class of product, regardless of the status
543
+ of the particular user or of the way in which the particular user
544
+ actually uses, or expects or is expected to use, the product. A product
545
+ is a consumer product regardless of whether the product has substantial
546
+ commercial, industrial or non-consumer uses, unless such uses represent
547
+ the only significant mode of use of the product.
548
+
549
+ "Installation Information" for a User Product means any methods,
550
+ procedures, authorization keys, or other information required to install
551
+ and execute modified versions of a covered work in that User Product from
552
+ a modified version of its Corresponding Source. The information must
553
+ suffice to ensure that the continued functioning of the modified object
554
+ code is in no case prevented or interfered with solely because
555
+ modification has been made.
556
+
557
+ If you convey an object code work under this section in, or with, or
558
+ specifically for use in, a User Product, and the conveying occurs as
559
+ part of a transaction in which the right of possession and use of the
560
+ User Product is transferred to the recipient in perpetuity or for a
561
+ fixed term (regardless of how the transaction is characterized), the
562
+ Corresponding Source conveyed under this section must be accompanied
563
+ by the Installation Information. But this requirement does not apply
564
+ if neither you nor any third party retains the ability to install
565
+ modified object code on the User Product (for example, the work has
566
+ been installed in ROM).
567
+
568
+ The requirement to provide Installation Information does not include a
569
+ requirement to continue to provide support service, warranty, or updates
570
+ for a work that has been modified or installed by the recipient, or for
571
+ the User Product in which it has been modified or installed. Access to a
572
+ network may be denied when the modification itself materially and
573
+ adversely affects the operation of the network or violates the rules and
574
+ protocols for communication across the network.
575
+
576
+ Corresponding Source conveyed, and Installation Information provided,
577
+ in accord with this section must be in a format that is publicly
578
+ documented (and with an implementation available to the public in
579
+ source code form), and must require no special password or key for
580
+ unpacking, reading or copying.
581
+
582
+ 7. Additional Terms.
583
+
584
+ "Additional permissions" are terms that supplement the terms of this
585
+ License by making exceptions from one or more of its conditions.
586
+ Additional permissions that are applicable to the entire Program shall
587
+ be treated as though they were included in this License, to the extent
588
+ that they are valid under applicable law. If additional permissions
589
+ apply only to part of the Program, that part may be used separately
590
+ under those permissions, but the entire Program remains governed by
591
+ this License without regard to the additional permissions.
592
+
593
+ When you convey a copy of a covered work, you may at your option
594
+ remove any additional permissions from that copy, or from any part of
595
+ it. (Additional permissions may be written to require their own
596
+ removal in certain cases when you modify the work.) You may place
597
+ additional permissions on material, added by you to a covered work,
598
+ for which you have or can give appropriate copyright permission.
599
+
600
+ Notwithstanding any other provision of this License, for material you
601
+ add to a covered work, you may (if authorized by the copyright holders of
602
+ that material) supplement the terms of this License with terms:
603
+
604
+ a) Disclaiming warranty or limiting liability differently from the
605
+ terms of sections 15 and 16 of this License; or
606
+
607
+ b) Requiring preservation of specified reasonable legal notices or
608
+ author attributions in that material or in the Appropriate Legal
609
+ Notices displayed by works containing it; or
610
+
611
+ c) Prohibiting misrepresentation of the origin of that material, or
612
+ requiring that modified versions of such material be marked in
613
+ reasonable ways as different from the original version; or
614
+
615
+ d) Limiting the use for publicity purposes of names of licensors or
616
+ authors of the material; or
617
+
618
+ e) Declining to grant rights under trademark law for use of some
619
+ trade names, trademarks, or service marks; or
620
+
621
+ f) Requiring indemnification of licensors and authors of that
622
+ material by anyone who conveys the material (or modified versions of
623
+ it) with contractual assumptions of liability to the recipient, for
624
+ any liability that these contractual assumptions directly impose on
625
+ those licensors and authors.
626
+
627
+ All other non-permissive additional terms are considered "further
628
+ restrictions" within the meaning of section 10. If the Program as you
629
+ received it, or any part of it, contains a notice stating that it is
630
+ governed by this License along with a term that is a further
631
+ restriction, you may remove that term. If a license document contains
632
+ a further restriction but permits relicensing or conveying under this
633
+ License, you may add to a covered work material governed by the terms
634
+ of that license document, provided that the further restriction does
635
+ not survive such relicensing or conveying.
636
+
637
+ If you add terms to a covered work in accord with this section, you
638
+ must place, in the relevant source files, a statement of the
639
+ additional terms that apply to those files, or a notice indicating
640
+ where to find the applicable terms.
641
+
642
+ Additional terms, permissive or non-permissive, may be stated in the
643
+ form of a separately written license, or stated as exceptions;
644
+ the above requirements apply either way.
645
+
646
+ 8. Termination.
647
+
648
+ You may not propagate or modify a covered work except as expressly
649
+ provided under this License. Any attempt otherwise to propagate or
650
+ modify it is void, and will automatically terminate your rights under
651
+ this License (including any patent licenses granted under the third
652
+ paragraph of section 11).
653
+
654
+ However, if you cease all violation of this License, then your
655
+ license from a particular copyright holder is reinstated (a)
656
+ provisionally, unless and until the copyright holder explicitly and
657
+ finally terminates your license, and (b) permanently, if the copyright
658
+ holder fails to notify you of the violation by some reasonable means
659
+ prior to 60 days after the cessation.
660
+
661
+ Moreover, your license from a particular copyright holder is
662
+ reinstated permanently if the copyright holder notifies you of the
663
+ violation by some reasonable means, this is the first time you have
664
+ received notice of violation of this License (for any work) from that
665
+ copyright holder, and you cure the violation prior to 30 days after
666
+ your receipt of the notice.
667
+
668
+ Termination of your rights under this section does not terminate the
669
+ licenses of parties who have received copies or rights from you under
670
+ this License. If your rights have been terminated and not permanently
671
+ reinstated, you do not qualify to receive new licenses for the same
672
+ material under section 10.
673
+
674
+ 9. Acceptance Not Required for Having Copies.
675
+
676
+ You are not required to accept this License in order to receive or
677
+ run a copy of the Program. Ancillary propagation of a covered work
678
+ occurring solely as a consequence of using peer-to-peer transmission
679
+ to receive a copy likewise does not require acceptance. However,
680
+ nothing other than this License grants you permission to propagate or
681
+ modify any covered work. These actions infringe copyright if you do
682
+ not accept this License. Therefore, by modifying or propagating a
683
+ covered work, you indicate your acceptance of this License to do so.
684
+
685
+ 10. Automatic Licensing of Downstream Recipients.
686
+
687
+ Each time you convey a covered work, the recipient automatically
688
+ receives a license from the original licensors, to run, modify and
689
+ propagate that work, subject to this License. You are not responsible
690
+ for enforcing compliance by third parties with this License.
691
+
692
+ An "entity transaction" is a transaction transferring control of an
693
+ organization, or substantially all assets of one, or subdividing an
694
+ organization, or merging organizations. If propagation of a covered
695
+ work results from an entity transaction, each party to that
696
+ transaction who receives a copy of the work also receives whatever
697
+ licenses to the work the party's predecessor in interest had or could
698
+ give under the previous paragraph, plus a right to possession of the
699
+ Corresponding Source of the work from the predecessor in interest, if
700
+ the predecessor has it or can get it with reasonable efforts.
701
+
702
+ You may not impose any further restrictions on the exercise of the
703
+ rights granted or affirmed under this License. For example, you may
704
+ not impose a license fee, royalty, or other charge for exercise of
705
+ rights granted under this License, and you may not initiate litigation
706
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
707
+ any patent claim is infringed by making, using, selling, offering for
708
+ sale, or importing the Program or any portion of it.
709
+
710
+ 11. Patents.
711
+
712
+ A "contributor" is a copyright holder who authorizes use under this
713
+ License of the Program or a work on which the Program is based. The
714
+ work thus licensed is called the contributor's "contributor version".
715
+
716
+ A contributor's "essential patent claims" are all patent claims
717
+ owned or controlled by the contributor, whether already acquired or
718
+ hereafter acquired, that would be infringed by some manner, permitted
719
+ by this License, of making, using, or selling its contributor version,
720
+ but do not include claims that would be infringed only as a
721
+ consequence of further modification of the contributor version. For
722
+ purposes of this definition, "control" includes the right to grant
723
+ patent sublicenses in a manner consistent with the requirements of
724
+ this License.
725
+
726
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
727
+ patent license under the contributor's essential patent claims, to
728
+ make, use, sell, offer for sale, import and otherwise run, modify and
729
+ propagate the contents of its contributor version.
730
+
731
+ In the following three paragraphs, a "patent license" is any express
732
+ agreement or commitment, however denominated, not to enforce a patent
733
+ (such as an express permission to practice a patent or covenant not to
734
+ sue for patent infringement). To "grant" such a patent license to a
735
+ party means to make such an agreement or commitment not to enforce a
736
+ patent against the party.
737
+
738
+ If you convey a covered work, knowingly relying on a patent license,
739
+ and the Corresponding Source of the work is not available for anyone
740
+ to copy, free of charge and under the terms of this License, through a
741
+ publicly available network server or other readily accessible means,
742
+ then you must either (1) cause the Corresponding Source to be so
743
+ available, or (2) arrange to deprive yourself of the benefit of the
744
+ patent license for this particular work, or (3) arrange, in a manner
745
+ consistent with the requirements of this License, to extend the patent
746
+ license to downstream recipients. "Knowingly relying" means you have
747
+ actual knowledge that, but for the patent license, your conveying the
748
+ covered work in a country, or your recipient's use of the covered work
749
+ in a country, would infringe one or more identifiable patents in that
750
+ country that you have reason to believe are valid.
751
+
752
+ If, pursuant to or in connection with a single transaction or
753
+ arrangement, you convey, or propagate by procuring conveyance of, a
754
+ covered work, and grant a patent license to some of the parties
755
+ receiving the covered work authorizing them to use, propagate, modify
756
+ or convey a specific copy of the covered work, then the patent license
757
+ you grant is automatically extended to all recipients of the covered
758
+ work and works based on it.
759
+
760
+ A patent license is "discriminatory" if it does not include within
761
+ the scope of its coverage, prohibits the exercise of, or is
762
+ conditioned on the non-exercise of one or more of the rights that are
763
+ specifically granted under this License. You may not convey a covered
764
+ work if you are a party to an arrangement with a third party that is
765
+ in the business of distributing software, under which you make payment
766
+ to the third party based on the extent of your activity of conveying
767
+ the work, and under which the third party grants, to any of the
768
+ parties who would receive the covered work from you, a discriminatory
769
+ patent license (a) in connection with copies of the covered work
770
+ conveyed by you (or copies made from those copies), or (b) primarily
771
+ for and in connection with specific products or compilations that
772
+ contain the covered work, unless you entered into that arrangement,
773
+ or that patent license was granted, prior to 28 March 2007.
774
+
775
+ Nothing in this License shall be construed as excluding or limiting
776
+ any implied license or other defenses to infringement that may
777
+ otherwise be available to you under applicable patent law.
778
+
779
+ 12. No Surrender of Others' Freedom.
780
+
781
+ If conditions are imposed on you (whether by court order, agreement or
782
+ otherwise) that contradict the conditions of this License, they do not
783
+ excuse you from the conditions of this License. If you cannot convey a
784
+ covered work so as to satisfy simultaneously your obligations under this
785
+ License and any other pertinent obligations, then as a consequence you may
786
+ not convey it at all. For example, if you agree to terms that obligate you
787
+ to collect a royalty for further conveying from those to whom you convey
788
+ the Program, the only way you could satisfy both those terms and this
789
+ License would be to refrain entirely from conveying the Program.
790
+
791
+ 13. Use with the GNU Affero General Public License.
792
+
793
+ Notwithstanding any other provision of this License, you have
794
+ permission to link or combine any covered work with a work licensed
795
+ under version 3 of the GNU Affero General Public License into a single
796
+ combined work, and to convey the resulting work. The terms of this
797
+ License will continue to apply to the part which is the covered work,
798
+ but the special requirements of the GNU Affero General Public License,
799
+ section 13, concerning interaction through a network will apply to the
800
+ combination as such.
801
+
802
+ 14. Revised Versions of this License.
803
+
804
+ The Free Software Foundation may publish revised and/or new versions of
805
+ the GNU General Public License from time to time. Such new versions will
806
+ be similar in spirit to the present version, but may differ in detail to
807
+ address new problems or concerns.
808
+
809
+ Each version is given a distinguishing version number. If the
810
+ Program specifies that a certain numbered version of the GNU General
811
+ Public License "or any later version" applies to it, you have the
812
+ option of following the terms and conditions either of that numbered
813
+ version or of any later version published by the Free Software
814
+ Foundation. If the Program does not specify a version number of the
815
+ GNU General Public License, you may choose any version ever published
816
+ by the Free Software Foundation.
817
+
818
+ If the Program specifies that a proxy can decide which future
819
+ versions of the GNU General Public License can be used, that proxy's
820
+ public statement of acceptance of a version permanently authorizes you
821
+ to choose that version for the Program.
822
+
823
+ Later license versions may give you additional or different
824
+ permissions. However, no additional obligations are imposed on any
825
+ author or copyright holder as a result of your choosing to follow a
826
+ later version.
827
+
828
+ 15. Disclaimer of Warranty.
829
+
830
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
831
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
832
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
833
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
834
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
835
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
836
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
837
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
838
+
839
+ 16. Limitation of Liability.
840
+
841
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
842
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
843
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
844
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
845
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
846
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
847
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
848
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
849
+ SUCH DAMAGES.
850
+
851
+ 17. Interpretation of Sections 15 and 16.
852
+
853
+ If the disclaimer of warranty and limitation of liability provided
854
+ above cannot be given local legal effect according to their terms,
855
+ reviewing courts shall apply local law that most closely approximates
856
+ an absolute waiver of all civil liability in connection with the
857
+ Program, unless a warranty or assumption of liability accompanies a
858
+ copy of the Program in return for a fee.
859
+
860
+ END OF TERMS AND CONDITIONS
861
+
862
+ How to Apply These Terms to Your New Programs
863
+
864
+ If you develop a new program, and you want it to be of the greatest
865
+ possible use to the public, the best way to achieve this is to make it
866
+ free software which everyone can redistribute and change under these terms.
867
+
868
+ To do so, attach the following notices to the program. It is safest
869
+ to attach them to the start of each source file to most effectively
870
+ state the exclusion of warranty; and each file should have at least
871
+ the "copyright" line and a pointer to where the full notice is found.
872
+
873
+ <one line to give the program's name and a brief idea of what it does.>
874
+ Copyright (C) <year> <name of author>
875
+
876
+ This program is free software: you can redistribute it and/or modify
877
+ it under the terms of the GNU General Public License as published by
878
+ the Free Software Foundation, either version 3 of the License, or
879
+ (at your option) any later version.
880
+
881
+ This program is distributed in the hope that it will be useful,
882
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
883
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
884
+ GNU General Public License for more details.
885
+
886
+ You should have received a copy of the GNU General Public License
887
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
888
+
889
+ Also add information on how to contact you by electronic and paper mail.
890
+
891
+ If the program does terminal interaction, make it output a short
892
+ notice like this when it starts in an interactive mode:
893
+
894
+ <program> Copyright (C) <year> <name of author>
895
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
896
+ This is free software, and you are welcome to redistribute it
897
+ under certain conditions; type `show c' for details.
898
+
899
+ The hypothetical commands `show w' and `show c' should show the appropriate
900
+ parts of the General Public License. Of course, your program's commands
901
+ might be different; for a GUI interface, you would use an "about box".
902
+
903
+ You should also get your employer (if you work as a programmer) or school,
904
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
905
+ For more information on this, and how to apply and follow the GNU GPL, see
906
+ <https://www.gnu.org/licenses/>.
907
+
908
+ The GNU General Public License does not permit incorporating your program
909
+ into proprietary programs. If your program is a subroutine library, you
910
+ may consider it more useful to permit linking proprietary applications with
911
+ the library. If this is what you want to do, use the GNU Lesser General
912
+ Public License instead of this License. But first, please read
913
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
914
+
915
+ Name: libquadmath
916
+ Files: numpy/.dylibs/libquadmath*.so
917
+ Description: dynamically linked to files compiled with gcc
918
+ Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libquadmath
919
+ License: LGPL-2.1-or-later
920
+
921
+ GCC Quad-Precision Math Library
922
+ Copyright (C) 2010-2019 Free Software Foundation, Inc.
923
+ Written by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
924
+
925
+ This file is part of the libquadmath library.
926
+ Libquadmath is free software; you can redistribute it and/or
927
+ modify it under the terms of the GNU Library General Public
928
+ License as published by the Free Software Foundation; either
929
+ version 2.1 of the License, or (at your option) any later version.
930
+
931
+ Libquadmath is distributed in the hope that it will be useful,
932
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
933
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
934
+ Lesser General Public License for more details.
935
+ https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/include/numpy/libdivide/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ zlib License
2
+ ------------
3
+
4
+ Copyright (C) 2010 - 2019 ridiculous_fish, <libdivide@ridiculousfish.com>
5
+ Copyright (C) 2016 - 2019 Kim Walisch, <kim.walisch@gmail.com>
6
+
7
+ This software is provided 'as-is', without any express or implied
8
+ warranty. In no event will the authors be held liable for any damages
9
+ arising from the use of this software.
10
+
11
+ Permission is granted to anyone to use this software for any purpose,
12
+ including commercial applications, and to alter it and redistribute it
13
+ freely, subject to the following restrictions:
14
+
15
+ 1. The origin of this software must not be misrepresented; you must not
16
+ claim that you wrote the original software. If you use this software
17
+ in a product, an acknowledgment in the product documentation would be
18
+ appreciated but is not required.
19
+ 2. Altered source versions must be plainly marked as such, and must not be
20
+ misrepresented as being the original software.
21
+ 3. This notice may not be removed or altered from any source distribution.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/common/pythoncapi-compat/COPYING ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD Zero Clause License
2
+
3
+ Copyright Contributors to the pythoncapi_compat project.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/highway/LICENSE ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This project is primarily dual-licensed under your choice of either the Apache
2
+ License 2.0 or the BSD 3-Clause License.
3
+
4
+ The following files are licensed under different terms:
5
+ * hwy/contrib/random/random-inl.h: CC0 1.0 Universal
6
+
7
+ The full texts of all applicable licenses are included below, separated by
8
+ '---'.
9
+
10
+ --------------------------------------------------------------------------------
11
+ Apache License 2.0
12
+ --------------------------------------------------------------------------------
13
+
14
+ Apache License
15
+ Version 2.0, January 2004
16
+ http://www.apache.org/licenses/
17
+
18
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19
+
20
+ 1. Definitions.
21
+
22
+ "License" shall mean the terms and conditions for use, reproduction,
23
+ and distribution as defined by Sections 1 through 9 of this document.
24
+
25
+ "Licensor" shall mean the copyright owner or entity authorized by
26
+ the copyright owner that is granting the License.
27
+
28
+ "Legal Entity" shall mean the union of the acting entity and all
29
+ other entities that control, are controlled by, or are under common
30
+ control with that entity. For the purposes of this definition,
31
+ "control" means (i) the power, direct or indirect, to cause the
32
+ direction or management of such entity, whether by contract or
33
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
34
+ outstanding shares, or (iii) beneficial ownership of such entity.
35
+
36
+ "You" (or "Your") shall mean an individual or Legal Entity
37
+ exercising permissions granted by this License.
38
+
39
+ "Source" form shall mean the preferred form for making modifications,
40
+ including but not limited to software source code, documentation
41
+ source, and configuration files.
42
+
43
+ "Object" form shall mean any form resulting from mechanical
44
+ transformation or translation of a Source form, including but
45
+ not limited to compiled object code, generated documentation,
46
+ and conversions to other media types.
47
+
48
+ "Work" shall mean the work of authorship, whether in Source or
49
+ Object form, made available under the License, as indicated by a
50
+ copyright notice that is included in or attached to the work
51
+ (an example is provided in the Appendix below).
52
+
53
+ "Derivative Works" shall mean any work, whether in Source or Object
54
+ form, that is based on (or derived from) the Work and for which the
55
+ editorial revisions, annotations, elaborations, or other modifications
56
+ represent, as a whole, an original work of authorship. For the purposes
57
+ of this License, Derivative Works shall not include works that remain
58
+ separable from, or merely link (or bind by name) to the interfaces of,
59
+ the Work and Derivative Works thereof.
60
+
61
+ "Contribution" shall mean any work of authorship, including
62
+ the original version of the Work and any modifications or additions
63
+ to that Work or Derivative Works thereof, that is intentionally
64
+ submitted to Licensor for inclusion in the Work by the copyright owner
65
+ or by an individual or Legal Entity authorized to submit on behalf of
66
+ the copyright owner. For the purposes of this definition, "submitted"
67
+ means any form of electronic, verbal, or written communication sent
68
+ to the Licensor or its representatives, including but not limited to
69
+ communication on electronic mailing lists, source code control systems,
70
+ and issue tracking systems that are managed by, or on behalf of, the
71
+ Licensor for the purpose of discussing and improving the Work, but
72
+ excluding communication that is conspicuously marked or otherwise
73
+ designated in writing by the copyright owner as "Not a Contribution."
74
+
75
+ "Contributor" shall mean Licensor and any individual or Legal Entity
76
+ on behalf of whom a Contribution has been received by Licensor and
77
+ subsequently incorporated within the Work.
78
+
79
+ 2. Grant of Copyright License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ copyright license to reproduce, prepare Derivative Works of,
83
+ publicly display, publicly perform, sublicense, and distribute the
84
+ Work and such Derivative Works in Source or Object form.
85
+
86
+ 3. Grant of Patent License. Subject to the terms and conditions of
87
+ this License, each Contributor hereby grants to You a perpetual,
88
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89
+ (except as stated in this section) patent license to make, have made,
90
+ use, offer to sell, sell, import, and otherwise transfer the Work,
91
+ where such license applies only to those patent claims licensable
92
+ by such Contributor that are necessarily infringed by their
93
+ Contribution(s) alone or by combination of their Contribution(s)
94
+ with the Work to which such Contribution(s) was submitted. If You
95
+ institute patent litigation against any entity (including a
96
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
97
+ or a Contribution incorporated within the Work constitutes direct
98
+ or contributory patent infringement, then any patent licenses
99
+ granted to You under this License for that Work shall terminate
100
+ as of the date such litigation is filed.
101
+
102
+ 4. Redistribution. You may reproduce and distribute copies of the
103
+ Work or Derivative Works thereof in any medium, with or without
104
+ modifications, and in Source or Object form, provided that You
105
+ meet the following conditions:
106
+
107
+ (a) You must give any other recipients of the Work or
108
+ Derivative Works a copy of this License; and
109
+
110
+ (b) You must cause any modified files to carry prominent notices
111
+ stating that You changed the files; and
112
+
113
+ (c) You must retain, in the Source form of any Derivative Works
114
+ that You distribute, all copyright, patent, trademark, and
115
+ attribution notices from the Source form of the Work,
116
+ excluding those notices that do not pertain to any part of
117
+ the Derivative Works; and
118
+
119
+ (d) If the Work includes a "NOTICE" text file as part of its
120
+ distribution, then any Derivative Works that You distribute must
121
+ include a readable copy of the attribution notices contained
122
+ within such NOTICE file, excluding those notices that do not
123
+ pertain to any part of the Derivative Works, in at least one
124
+ of the following places: within a NOTICE text file distributed
125
+ as part of the Derivative Works; within the Source form or
126
+ documentation, if provided along with the Derivative Works; or,
127
+ within a display generated by the Derivative Works, if and
128
+ wherever such third-party notices normally appear. The contents
129
+ of the NOTICE file are for informational purposes only and
130
+ do not modify the License. You may add Your own attribution
131
+ notices within Derivative Works that You distribute, alongside
132
+ or as an addendum to the NOTICE text from the Work, provided
133
+ that such additional attribution notices cannot be construed
134
+ as modifying the License.
135
+
136
+ You may add Your own copyright statement to Your modifications and
137
+ may provide additional or different license terms and conditions
138
+ for use, reproduction, or distribution of Your modifications, or
139
+ for any such Derivative Works as a whole, provided Your use,
140
+ reproduction, and distribution of the Work otherwise complies with
141
+ the conditions stated in this License.
142
+
143
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
144
+ any Contribution intentionally submitted for inclusion in the Work
145
+ by You to the Licensor shall be under the terms and conditions of
146
+ this License, without any additional terms or conditions.
147
+ Notwithstanding the above, nothing herein shall supersede or modify
148
+ the terms of any separate license agreement you may have executed
149
+ with Licensor regarding such Contributions.
150
+
151
+ 6. Trademarks. This License does not grant permission to use the trade
152
+ names, trademarks, service marks, or product names of the Licensor,
153
+ except as required for reasonable and customary use in describing the
154
+ origin of the Work and reproducing the content of the NOTICE file.
155
+
156
+ 7. Disclaimer of Warranty. Unless required by applicable law or
157
+ agreed to in writing, Licensor provides the Work (and each
158
+ Contributor provides its Contributions) on an "AS IS" BASIS,
159
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160
+ implied, including, without limitation, any warranties or conditions
161
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162
+ PARTICULAR PURPOSE. You are solely responsible for determining the
163
+ appropriateness of using or redistributing the Work and assume any
164
+ risks associated with Your exercise of permissions under this License.
165
+
166
+ 8. Limitation of Liability. In no event and under no legal theory,
167
+ whether in tort (including negligence), contract, or otherwise,
168
+ unless required by applicable law (such as deliberate and grossly
169
+ negligent acts) or agreed to in writing, shall any Contributor be
170
+ liable to You for damages, including any direct, indirect, special,
171
+ incidental, or consequential damages of any character arising as a
172
+ result of this License or out of the use or inability to use the
173
+ Work (including but not limited to damages for loss of goodwill,
174
+ work stoppage, computer failure or malfunction, or any and all
175
+ other commercial damages or losses), even if such Contributor
176
+ has been advised of the possibility of such damages.
177
+
178
+ 9. Accepting Warranty or Additional Liability. While redistributing
179
+ the Work or Derivative Works thereof, You may choose to offer,
180
+ and charge a fee for, acceptance of support, warranty, indemnity,
181
+ or other liability obligations and/or rights consistent with this
182
+ License. However, in accepting such obligations, You may act only
183
+ on Your own behalf and on Your sole responsibility, not on behalf
184
+ of any other Contributor, and only if You agree to indemnify,
185
+ defend, and hold each Contributor harmless for any liability
186
+ incurred by, or claims asserted against, such Contributor by reason
187
+ of your accepting any such warranty or additional liability.
188
+
189
+ END OF TERMS AND CONDITIONS
190
+
191
+ APPENDIX: How to apply the Apache License to your work.
192
+
193
+ To apply the Apache License to your work, attach the following
194
+ boilerplate notice, with the fields enclosed by brackets "[]"
195
+ replaced with your own identifying information. (Don't include
196
+ the brackets!) The text should be enclosed in the appropriate
197
+ comment syntax for the file format. We also recommend that a
198
+ file or class name and description of purpose be included on the
199
+ same "printed page" as the copyright notice for easier
200
+ identification within third-party archives.
201
+
202
+ Copyright [yyyy] [name of copyright owner]
203
+
204
+ Licensed under the Apache License, Version 2.0 (the "License");
205
+ you may not use this file except in compliance with the License.
206
+ You may obtain a copy of the License at
207
+
208
+ http://www.apache.org/licenses/LICENSE-2.0
209
+
210
+ Unless required by applicable law or agreed to in writing, software
211
+ distributed under the License is distributed on an "AS IS" BASIS,
212
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213
+ See the License for the specific language governing permissions and
214
+ limitations under the License.
215
+
216
+ --------------------------------------------------------------------------------
217
+ BSD 3-Clause License
218
+ --------------------------------------------------------------------------------
219
+
220
+ Copyright (c) The Highway Project Authors. All rights reserved.
221
+
222
+ Redistribution and use in source and binary forms, with or without modification,
223
+ are permitted provided that the following conditions are met:
224
+
225
+ 1. Redistributions of source code must retain the above copyright notice, this
226
+ list of conditions and the following disclaimer.
227
+
228
+ 2. Redistributions in binary form must reproduce the above copyright notice,
229
+ this list of conditions and the following disclaimer in the documentation
230
+ and/or other materials provided with the distribution.
231
+
232
+ 3. Neither the name of the copyright holder nor the names of its
233
+ contributors may be used to endorse or promote products derived from
234
+ this software without specific prior written permission.
235
+
236
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
237
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
238
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
239
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
240
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
242
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
243
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
244
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
245
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
246
+
247
+ --------------------------------------------------------------------------------
248
+ CC0 1.0 Universal
249
+ --------------------------------------------------------------------------------
250
+
251
+ Creative Commons Legal Code
252
+
253
+ CC0 1.0 Universal
254
+
255
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
256
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
257
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
258
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
259
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
260
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
261
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
262
+ HEREUNDER.
263
+
264
+ Statement of Purpose
265
+
266
+ The laws of most jurisdictions throughout the world automatically confer
267
+ exclusive Copyright and Related Rights (defined below) upon the creator
268
+ and subsequent owner(s) (each and all, an "owner") of an original work of
269
+ authorship and/or a database (each, a "Work").
270
+
271
+ Certain owners wish to permanently relinquish those rights to a Work for
272
+ the purpose of contributing to a commons of creative, cultural and
273
+ scientific works ("Commons") that the public can reliably and without fear
274
+ of later claims of infringement build upon, modify, incorporate in other
275
+ works, reuse and redistribute as freely as possible in any form whatsoever
276
+ and for any purposes, including without limitation commercial purposes.
277
+ These owners may contribute to the Commons to promote the ideal of a free
278
+ culture and the further production of creative, cultural and scientific
279
+ works, or to gain reputation or greater distribution for their Work in
280
+ part through the use and efforts of others.
281
+
282
+ For these and/or other purposes and motivations, and without any
283
+ expectation of additional consideration or compensation, the person
284
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
285
+ is an owner of Copyright and Related Rights in the Work, voluntarily
286
+ elects to apply CC0 to the Work and publicly distribute the Work under its
287
+ terms, with knowledge of his or her Copyright and Related Rights in the
288
+ Work and the meaning and intended legal effect of CC0 on those rights.
289
+
290
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
291
+ protected by copyright and related or neighboring rights ("Copyright and
292
+ Related Rights"). Copyright and Related Rights include, but are not
293
+ limited to, the following:
294
+
295
+ i. the right to reproduce, adapt, distribute, perform, display,
296
+ communicate, and translate a Work;
297
+ ii. moral rights retained by the original author(s) and/or performer(s);
298
+ iii. publicity and privacy rights pertaining to a person's image or
299
+ likeness depicted in a Work;
300
+ iv. rights protecting against unfair competition in regards to a Work,
301
+ subject to the limitations in paragraph 4(a), below;
302
+ v. rights protecting the extraction, dissemination, use and reuse of data
303
+ in a Work;
304
+ vi. database rights (such as those arising under Directive 96/9/EC of the
305
+ European Parliament and of the Council of 11 March 1996 on the legal
306
+ protection of databases, and under any national implementation
307
+ thereof, including any amended or successor version of such
308
+ directive); and
309
+ vii. other similar, equivalent or corresponding rights throughout the
310
+ world based on applicable law or treaty, and any national
311
+ implementations thereof.
312
+
313
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
314
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
315
+ irrevocably and unconditionally waives, abandons, and surrenders all of
316
+ Affirmer's Copyright and Related Rights and associated claims and causes
317
+ of action, whether now known or unknown (including existing as well as
318
+ future claims and causes of action), in the Work (i) in all territories
319
+ worldwide, (ii) for the maximum duration provided by applicable law or
320
+ treaty (including future time extensions), (iii) in any current or future
321
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
322
+ including without limitation commercial, advertising or promotional
323
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
324
+ member of the public at large and to the detriment of Affirmer's heirs and
325
+ successors, fully intending that such Waiver shall not be subject to
326
+ revocation, rescission, cancellation, termination, or any other legal or
327
+ equitable action to disrupt the quiet enjoyment of the Work by the public
328
+ as contemplated by Affirmer's express Statement of Purpose.
329
+
330
+ 3. Public License Fallback. Should any part of the Waiver for any reason
331
+ be judged legally invalid or ineffective under applicable law, then the
332
+ Waiver shall be preserved to the maximum extent permitted taking into
333
+ account Affirmer's express Statement of Purpose. In addition, to the
334
+ extent the Waiver is so judged Affirmer hereby grants to each affected
335
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
336
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
337
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
338
+ maximum duration provided by applicable law or treaty (including future
339
+ time extensions), (iii) in any current or future medium and for any number
340
+ of copies, and (iv) for any purpose whatsoever, including without
341
+ limitation commercial, advertising or promotional purposes (the
342
+ "License"). The License shall be deemed effective as of the date CC0 was
343
+ applied by Affirmer to the Work. Should any part of the License for any
344
+ reason be judged legally invalid or ineffective under applicable law, such
345
+ partial invalidity or ineffectiveness shall not invalidate the remainder
346
+ of the License, and in such case Affirmer hereby affirms that he or she
347
+ will not (i) exercise any of his or her remaining Copyright and Related
348
+ Rights in the Work or (ii) assert any associated claims and causes of
349
+ action with respect to the Work, in either case contrary to Affirmer's
350
+ express Statement of Purpose.
351
+
352
+ 4. Limitations and Disclaimers.
353
+
354
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
355
+ surrendered, licensed or otherwise affected by this document.
356
+ b. Affirmer offers the Work as-is and makes no representations or
357
+ warranties of any kind concerning the Work, express, implied,
358
+ statutory or otherwise, including without limitation warranties of
359
+ title, merchantability, fitness for a particular purpose, non
360
+ infringement, or the absence of latent or other defects, accuracy, or
361
+ the present or absence of errors, whether or not discoverable, all to
362
+ the greatest extent permissible under applicable law.
363
+ c. Affirmer disclaims responsibility for clearing rights of other persons
364
+ that may apply to the Work or any use thereof, including without
365
+ limitation any person's Copyright and Related Rights in the Work.
366
+ Further, Affirmer disclaims responsibility for obtaining any necessary
367
+ consents, permissions or other rights required for any use of the
368
+ Work.
369
+ d. Affirmer understands and acknowledges that Creative Commons is not a
370
+ party to this document and has no duty or obligation with respect to
371
+ this CC0 or use of the Work.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/multiarray/dragon4_LICENSE.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2014 Ryan Juckett
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
20
+
21
+ dragon4.c|h h contains a modified version of Ryan Juckett's Dragon4
22
+ implementation, obtained from https://www.ryanjuckett.com,
23
+ which has been ported from C++ to C and which has
24
+ modifications specific to printing floats in numpy.
25
+
26
+ Ryan Juckett's original code was under the Zlib license; he gave numpy
27
+ permission to include it under the MIT license instead.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/npysort/x86-simd-sort/LICENSE.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, Intel. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/_core/src/umath/svml/LICENSE ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2005-2021, 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.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/fft/pocketfft/LICENSE.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (C) 2010-2018 Max-Planck-Society
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice, this
10
+ list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+ * Neither the name of the copyright holder nor the names of its contributors may
13
+ be used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/linalg/lapack_lite/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 1992-2013 The University of Tennessee and The University
2
+ of Tennessee Research Foundation. All rights
3
+ reserved.
4
+ Copyright (c) 2000-2013 The University of California Berkeley. All
5
+ rights reserved.
6
+ Copyright (c) 2006-2013 The University of Colorado Denver. All rights
7
+ reserved.
8
+
9
+ $COPYRIGHT$
10
+
11
+ Additional copyrights may follow
12
+
13
+ $HEADER$
14
+
15
+ Redistribution and use in source and binary forms, with or without
16
+ modification, are permitted provided that the following conditions are
17
+ met:
18
+
19
+ - Redistributions of source code must retain the above copyright
20
+ notice, this list of conditions and the following disclaimer.
21
+
22
+ - Redistributions in binary form must reproduce the above copyright
23
+ notice, this list of conditions and the following disclaimer listed
24
+ in this license in the documentation and/or other materials
25
+ provided with the distribution.
26
+
27
+ - Neither the name of the copyright holders nor the names of its
28
+ contributors may be used to endorse or promote products derived from
29
+ this software without specific prior written permission.
30
+
31
+ The copyright holders provide no reassurances that the source code
32
+ provided does not infringe any patent, copyright, or any other
33
+ intellectual property rights of third parties. The copyright holders
34
+ disclaim any liability to any recipient for claims brought against
35
+ recipient by any third party for infringement of that parties
36
+ intellectual property rights.
37
+
38
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/ma/LICENSE ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * Copyright (c) 2006, University of Georgia and Pierre G.F. Gerard-Marchant
2
+ * All rights reserved.
3
+ * Redistribution and use in source and binary forms, with or without
4
+ * modification, are permitted provided that the following conditions are met:
5
+ *
6
+ * * Redistributions of source code must retain the above copyright
7
+ * notice, this list of conditions and the following disclaimer.
8
+ * * Redistributions in binary form must reproduce the above copyright
9
+ * notice, this list of conditions and the following disclaimer in the
10
+ * documentation and/or other materials provided with the distribution.
11
+ * * Neither the name of the University of Georgia nor the
12
+ * names of its contributors may be used to endorse or promote products
13
+ * derived from this software without specific prior written permission.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
16
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
19
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/LICENSE.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **This software is dual-licensed under the The University of Illinois/NCSA
2
+ Open Source License (NCSA) and The 3-Clause BSD License**
3
+
4
+ # NCSA Open Source License
5
+ **Copyright (c) 2019 Kevin Sheppard. All rights reserved.**
6
+
7
+ Developed by: Kevin Sheppard (<kevin.sheppard@economics.ox.ac.uk>,
8
+ <kevin.k.sheppard@gmail.com>)
9
+ [http://www.kevinsheppard.com](http://www.kevinsheppard.com)
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
12
+ this software and associated documentation files (the "Software"), to deal with
13
+ the Software without restriction, including without limitation the rights to
14
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
15
+ of the Software, and to permit persons to whom the Software is furnished to do
16
+ so, subject to the following conditions:
17
+
18
+ Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimers.
20
+
21
+ Redistributions in binary form must reproduce the above copyright notice, this
22
+ list of conditions and the following disclaimers in the documentation and/or
23
+ other materials provided with the distribution.
24
+
25
+ Neither the names of Kevin Sheppard, nor the names of any contributors may be
26
+ used to endorse or promote products derived from this Software without specific
27
+ prior written permission.
28
+
29
+ **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
35
+ THE SOFTWARE.**
36
+
37
+
38
+ # 3-Clause BSD License
39
+ **Copyright (c) 2019 Kevin Sheppard. All rights reserved.**
40
+
41
+ Redistribution and use in source and binary forms, with or without
42
+ modification, are permitted provided that the following conditions are met:
43
+
44
+ 1. Redistributions of source code must retain the above copyright notice,
45
+ this list of conditions and the following disclaimer.
46
+
47
+ 2. Redistributions in binary form must reproduce the above copyright notice,
48
+ this list of conditions and the following disclaimer in the documentation
49
+ and/or other materials provided with the distribution.
50
+
51
+ 3. Neither the name of the copyright holder nor the names of its contributors
52
+ may be used to endorse or promote products derived from this software
53
+ without specific prior written permission.
54
+
55
+ **THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
56
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
59
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
60
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
61
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
62
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
63
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
64
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
65
+ THE POSSIBILITY OF SUCH DAMAGE.**
66
+
67
+ # Components
68
+
69
+ Many parts of this module have been derived from original sources,
70
+ often the algorithm's designer. Component licenses are located with
71
+ the component code.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/distributions/LICENSE.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## NumPy
2
+
3
+ Copyright (c) 2005-2017, NumPy Developers.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are
8
+ met:
9
+
10
+ * Redistributions of source code must retain the above copyright
11
+ notice, this list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above
14
+ copyright notice, this list of conditions and the following
15
+ disclaimer in the documentation and/or other materials provided
16
+ with the distribution.
17
+
18
+ * Neither the name of the NumPy Developers nor the names of any
19
+ contributors may be used to endorse or promote products derived
20
+ from this software without specific prior written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+
34
+
35
+ ## Julia
36
+
37
+ The ziggurat methods were derived from Julia.
38
+
39
+ Copyright (c) 2009-2019: Jeff Bezanson, Stefan Karpinski, Viral B. Shah,
40
+ and other contributors:
41
+
42
+ https://github.com/JuliaLang/julia/contributors
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining
45
+ a copy of this software and associated documentation files (the
46
+ "Software"), to deal in the Software without restriction, including
47
+ without limitation the rights to use, copy, modify, merge, publish,
48
+ distribute, sublicense, and/or sell copies of the Software, and to
49
+ permit persons to whom the Software is furnished to do so, subject to
50
+ the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be
53
+ included in all copies or substantial portions of the Software.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
56
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
58
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
59
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
60
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
61
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/mt19937/LICENSE.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MT19937
2
+
3
+ Copyright (c) 2003-2005, Jean-Sebastien Roy (js@jeannot.org)
4
+
5
+ The rk_random and rk_seed functions algorithms and the original design of
6
+ the Mersenne Twister RNG:
7
+
8
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
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
13
+ are met:
14
+
15
+ 1. Redistributions of source code must retain the above copyright
16
+ notice, this list of conditions and the following disclaimer.
17
+
18
+ 2. Redistributions in binary form must reproduce the above copyright
19
+ notice, this list of conditions and the following disclaimer in the
20
+ documentation and/or other materials provided with the distribution.
21
+
22
+ 3. The names of its contributors may not be used to endorse or promote
23
+ products derived from this software without specific prior written
24
+ permission.
25
+
26
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
30
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
+
38
+ Original algorithm for the implementation of rk_interval function from
39
+ Richard J. Wagner's implementation of the Mersenne Twister RNG, optimised by
40
+ Magnus Jonsson.
41
+
42
+ Constants used in the rk_double implementation by Isaku Wada.
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a
45
+ copy of this software and associated documentation files (the
46
+ "Software"), to deal in the Software without restriction, including
47
+ without limitation the rights to use, copy, modify, merge, publish,
48
+ distribute, sublicense, and/or sell copies of the Software, and to
49
+ permit persons to whom the Software is furnished to do so, subject to
50
+ the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be included
53
+ in all copies or substantial portions of the Software.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
56
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
58
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
59
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
60
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
61
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/pcg64/LICENSE.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PCG64
2
+
3
+ ## The MIT License
4
+
5
+ PCG Random Number Generation for C.
6
+
7
+ Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining
10
+ a copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/philox/LICENSE.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PHILOX
2
+
3
+ Copyright 2010-2012, D. E. Shaw Research.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are
8
+ met:
9
+
10
+ * Redistributions of source code must retain the above copyright
11
+ notice, this list of conditions, and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright
14
+ notice, this list of conditions, and the following disclaimer in the
15
+ documentation and/or other materials provided with the distribution.
16
+
17
+ * Neither the name of D. E. Shaw Research nor the names of its
18
+ contributors may be used to endorse or promote products derived from
19
+ this software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/sfc64/LICENSE.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SFC64
2
+
3
+ ## The MIT License
4
+
5
+ Adapted from a C++ implementation of Chris Doty-Humphrey's SFC PRNG.
6
+
7
+ https://gist.github.com/imneme/f1f7821f07cf76504a97f6537c818083
8
+
9
+ Copyright (c) 2018 Melissa E. O'Neill
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a
12
+ copy of this software and associated documentation files (the "Software"),
13
+ to deal in the Software without restriction, including without limitation
14
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
+ and/or sell copies of the Software, and to permit persons to whom the
16
+ Software is furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
+ DEALINGS IN THE SOFTWARE.
venv/lib/python3.14/site-packages/numpy-2.5.4.dist-info/licenses/numpy/random/src/splitmix64/LICENSE.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # SPLITMIX64
2
+
3
+ Written in 2015 by Sebastiano Vigna (vigna@acm.org)
4
+
5
+ To the extent possible under law, the author has dedicated all copyright
6
+ and related and neighboring rights to this software to the public domain
7
+ worldwide. This software is distributed without any warranty.
8
+
9
+ See <http://creativecommons.org/publicdomain/zero/1.0/>.
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/routines/subrout.f ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ SUBROUTINE SUBROUT(A,B,C)
2
+ REAL*8 A, B, C
3
+ C = A + B
4
+ END SUBROUTINE
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/routines/subrout.pyf ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ python module subrout ! in
2
+ interface ! in :subrout
3
+ subroutine subrout_default(a,b,c) ! in :subrout:subrout.f
4
+ fortranname subrout
5
+ real*8 :: a
6
+ real*8 :: b
7
+ real*8, intent(out) :: c
8
+ end subroutine subrout_default
9
+ end interface
10
+ end python module subrout
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/size/foo.f90 ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ subroutine foo(a, n, m, b)
3
+ implicit none
4
+
5
+ real, intent(in) :: a(n, m)
6
+ integer, intent(in) :: n, m
7
+ real, intent(out) :: b(size(a, 1))
8
+
9
+ integer :: i
10
+
11
+ do i = 1, size(b)
12
+ b(i) = sum(a(i,:))
13
+ enddo
14
+ end subroutine
15
+
16
+ subroutine trans(x,y)
17
+ implicit none
18
+ real, intent(in), dimension(:,:) :: x
19
+ real, intent(out), dimension( size(x,2), size(x,1) ) :: y
20
+ integer :: N, M, i, j
21
+ N = size(x,1)
22
+ M = size(x,2)
23
+ DO i=1,N
24
+ do j=1,M
25
+ y(j,i) = x(i,j)
26
+ END DO
27
+ END DO
28
+ end subroutine trans
29
+
30
+ subroutine flatten(x,y)
31
+ implicit none
32
+ real, intent(in), dimension(:,:) :: x
33
+ real, intent(out), dimension( size(x) ) :: y
34
+ integer :: N, M, i, j, k
35
+ N = size(x,1)
36
+ M = size(x,2)
37
+ k = 1
38
+ DO i=1,N
39
+ do j=1,M
40
+ y(k) = x(i,j)
41
+ k = k + 1
42
+ END DO
43
+ END DO
44
+ end subroutine flatten
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/char.f90 ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MODULE char_test
2
+
3
+ CONTAINS
4
+
5
+ SUBROUTINE change_strings(strings, n_strs, out_strings)
6
+ IMPLICIT NONE
7
+
8
+ ! Inputs
9
+ INTEGER, INTENT(IN) :: n_strs
10
+ CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings
11
+ CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: out_strings
12
+
13
+ !f2py INTEGER, INTENT(IN) :: n_strs
14
+ !f2py CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings
15
+ !f2py CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: strings
16
+
17
+ ! Misc.
18
+ INTEGER*4 :: j
19
+
20
+
21
+ DO j=1, n_strs
22
+ out_strings(1,j) = strings(1,j)
23
+ out_strings(2,j) = 'A'
24
+ END DO
25
+
26
+ END SUBROUTINE change_strings
27
+
28
+ END MODULE char_test
29
+
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/fixed_string.f90 ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function sint(s) result(i)
2
+ implicit none
3
+ character(len=*) :: s
4
+ integer :: j, i
5
+ i = 0
6
+ do j=len(s), 1, -1
7
+ if (.not.((i.eq.0).and.(s(j:j).eq.' '))) then
8
+ i = i + ichar(s(j:j)) * 10 ** (j - 1)
9
+ endif
10
+ end do
11
+ return
12
+ end function sint
13
+
14
+ function test_in_bytes4(a) result (i)
15
+ implicit none
16
+ integer :: sint
17
+ character(len=4) :: a
18
+ integer :: i
19
+ i = sint(a)
20
+ a(1:1) = 'A'
21
+ return
22
+ end function test_in_bytes4
23
+
24
+ function test_inout_bytes4(a) result (i)
25
+ implicit none
26
+ integer :: sint
27
+ character(len=4), intent(inout) :: a
28
+ integer :: i
29
+ if (a(1:1).ne.' ') then
30
+ a(1:1) = 'E'
31
+ endif
32
+ i = sint(a)
33
+ return
34
+ end function test_inout_bytes4
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh24008.f ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ SUBROUTINE GREET(NAME, GREETING)
2
+ CHARACTER NAME*(*), GREETING*(*)
3
+ CHARACTER*(50) MESSAGE
4
+
5
+ MESSAGE = 'Hello, ' // NAME // ', ' // GREETING
6
+ c$$$ PRINT *, MESSAGE
7
+
8
+ END SUBROUTINE GREET
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh24662.f90 ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ subroutine string_inout_optional(output)
2
+ implicit none
3
+ character*(32), optional, intent(inout) :: output
4
+ if (present(output)) then
5
+ output="output string"
6
+ endif
7
+ end subroutine
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286.f90 ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ subroutine charint(trans, info)
2
+ character, intent(in) :: trans
3
+ integer, intent(out) :: info
4
+ if (trans == 'N') then
5
+ info = 1
6
+ else if (trans == 'T') then
7
+ info = 2
8
+ else if (trans == 'C') then
9
+ info = 3
10
+ else
11
+ info = -1
12
+ end if
13
+
14
+ end subroutine charint
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286.pyf ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ python module _char_handling_test
2
+ interface
3
+ subroutine charint(trans, info)
4
+ callstatement (*f2py_func)(&trans, &info)
5
+ callprotoargument char*, int*
6
+
7
+ character, intent(in), check(trans=='N'||trans=='T'||trans=='C') :: trans = 'N'
8
+ integer intent(out) :: info
9
+
10
+ end subroutine charint
11
+ end interface
12
+ end python module _char_handling_test
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/gh25286_bc.pyf ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ python module _char_handling_test
2
+ interface
3
+ subroutine charint(trans, info)
4
+ callstatement (*f2py_func)(&trans, &info)
5
+ callprotoargument char*, int*
6
+
7
+ character, intent(in), check(*trans=='N'||*trans=='T'||*trans=='C') :: trans = 'N'
8
+ integer intent(out) :: info
9
+
10
+ end subroutine charint
11
+ end interface
12
+ end python module _char_handling_test
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/scalar_string.f90 ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ MODULE string_test
2
+
3
+ character(len=8) :: string
4
+ character string77 * 8
5
+
6
+ character(len=12), dimension(5,7) :: strarr
7
+ character strarr77(5,7) * 12
8
+
9
+ END MODULE string_test
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/string/string.f ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ C FILE: STRING.F
2
+ SUBROUTINE FOO(A,B,C,D)
3
+ CHARACTER*5 A, B
4
+ CHARACTER*(*) C,D
5
+ Cf2py intent(in) a,c
6
+ Cf2py intent(inout) b,d
7
+ A(1:1) = 'A'
8
+ B(1:1) = 'B'
9
+ C(1:1) = 'C'
10
+ D(1:1) = 'D'
11
+ END
12
+ C END OF FILE STRING.F
venv/lib/python3.14/site-packages/numpy/f2py/tests/src/value_attrspec/gh21665.f90 ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ module fortfuncs
2
+ implicit none
3
+ contains
4
+ subroutine square(x,y)
5
+ integer, intent(in), value :: x
6
+ integer, intent(out) :: y
7
+ y = x*x
8
+ end subroutine square
9
+ end module fortfuncs
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_abstract_interface.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from numpy.f2py import crackfortran
4
+ from numpy.testing import IS_WASM
5
+
6
+ from . import util
7
+
8
+
9
+ @pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
10
+ @pytest.mark.slow
11
+ class TestAbstractInterface(util.F2PyTest):
12
+ sources = [util.getpath("tests", "src", "abstract_interface", "foo.f90")]
13
+
14
+ skip = ["add1", "add2"]
15
+
16
+ def test_abstract_interface(self):
17
+ assert self.module.ops_module.foo(3, 5) == (8, 13)
18
+
19
+ def test_parse_abstract_interface(self):
20
+ # Test gh18403
21
+ fpath = util.getpath("tests", "src", "abstract_interface",
22
+ "gh18403_mod.f90")
23
+ mod = crackfortran.crackfortran([str(fpath)])
24
+ assert len(mod) == 1
25
+ assert len(mod[0]["body"]) == 1
26
+ assert mod[0]["body"][0]["block"] == "abstract interface"
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_array_from_pyobj.py ADDED
@@ -0,0 +1,732 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import platform
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ import numpy as np
9
+ from numpy._core._type_aliases import c_names_dict as _c_names_dict
10
+
11
+ from . import util
12
+
13
+ pytestmark = pytest.mark.slow
14
+
15
+ wrap = None
16
+
17
+ # Extend core typeinfo with CHARACTER to test dtype('c')
18
+ c_names_dict = dict(
19
+ CHARACTER=np.dtype("c"),
20
+ **_c_names_dict
21
+ )
22
+
23
+
24
+ def get_testdir():
25
+ testroot = Path(__file__).resolve().parent / "src"
26
+ return testroot / "array_from_pyobj"
27
+
28
+ def setup_module():
29
+ """
30
+ Build the required testing extension module
31
+
32
+ """
33
+ global wrap
34
+
35
+ if wrap is None:
36
+ src = [
37
+ get_testdir() / "wrapmodule.c",
38
+ ]
39
+ wrap = util.build_meson(src, module_name="test_array_from_pyobj_ext")
40
+
41
+
42
+ def flags_info(arr):
43
+ flags = wrap.array_attrs(arr)[6]
44
+ return flags2names(flags)
45
+
46
+
47
+ def flags2names(flags):
48
+ info = []
49
+ for flagname in [
50
+ "CONTIGUOUS",
51
+ "FORTRAN",
52
+ "OWNDATA",
53
+ "ENSURECOPY",
54
+ "ENSUREARRAY",
55
+ "ALIGNED",
56
+ "NOTSWAPPED",
57
+ "WRITEABLE",
58
+ "WRITEBACKIFCOPY",
59
+ "UPDATEIFCOPY",
60
+ "BEHAVED",
61
+ "BEHAVED_RO",
62
+ "CARRAY",
63
+ "FARRAY",
64
+ ]:
65
+ if abs(flags) & getattr(wrap, flagname, 0):
66
+ info.append(flagname)
67
+ return info
68
+
69
+
70
+ class Intent:
71
+ def __init__(self, intent_list=[]):
72
+ self.intent_list = intent_list[:]
73
+ flags = 0
74
+ for i in intent_list:
75
+ if i == "optional":
76
+ flags |= wrap.F2PY_OPTIONAL
77
+ else:
78
+ flags |= getattr(wrap, "F2PY_INTENT_" + i.upper())
79
+ self.flags = flags
80
+
81
+ def __getattr__(self, name):
82
+ name = name.lower()
83
+ if name == "in_":
84
+ name = "in"
85
+ return self.__class__(self.intent_list + [name])
86
+
87
+ def __str__(self):
88
+ return f"intent({','.join(self.intent_list)})"
89
+
90
+ def __repr__(self):
91
+ return f"Intent({self.intent_list!r})"
92
+
93
+ def is_intent(self, *names):
94
+ return all(name in self.intent_list for name in names)
95
+
96
+ def is_intent_exact(self, *names):
97
+ return len(self.intent_list) == len(names) and self.is_intent(*names)
98
+
99
+
100
+ intent = Intent()
101
+
102
+ _type_names = [
103
+ "BOOL",
104
+ "BYTE",
105
+ "UBYTE",
106
+ "SHORT",
107
+ "USHORT",
108
+ "INT",
109
+ "UINT",
110
+ "LONG",
111
+ "ULONG",
112
+ "LONGLONG",
113
+ "ULONGLONG",
114
+ "FLOAT",
115
+ "DOUBLE",
116
+ "CFLOAT",
117
+ "STRING1",
118
+ "STRING5",
119
+ "CHARACTER",
120
+ ]
121
+
122
+ _cast_dict = {"BOOL": ["BOOL"]}
123
+ _cast_dict["BYTE"] = _cast_dict["BOOL"] + ["BYTE"]
124
+ _cast_dict["UBYTE"] = _cast_dict["BOOL"] + ["UBYTE"]
125
+ _cast_dict["BYTE"] = ["BYTE"]
126
+ _cast_dict["UBYTE"] = ["UBYTE"]
127
+ _cast_dict["SHORT"] = _cast_dict["BYTE"] + ["UBYTE", "SHORT"]
128
+ _cast_dict["USHORT"] = _cast_dict["UBYTE"] + ["BYTE", "USHORT"]
129
+ _cast_dict["INT"] = _cast_dict["SHORT"] + ["USHORT", "INT"]
130
+ _cast_dict["UINT"] = _cast_dict["USHORT"] + ["SHORT", "UINT"]
131
+
132
+ _cast_dict["LONG"] = _cast_dict["INT"] + ["LONG"]
133
+ _cast_dict["ULONG"] = _cast_dict["UINT"] + ["ULONG"]
134
+
135
+ _cast_dict["LONGLONG"] = _cast_dict["LONG"] + ["LONGLONG"]
136
+ _cast_dict["ULONGLONG"] = _cast_dict["ULONG"] + ["ULONGLONG"]
137
+
138
+ _cast_dict["FLOAT"] = _cast_dict["SHORT"] + ["USHORT", "FLOAT"]
139
+ _cast_dict["DOUBLE"] = _cast_dict["INT"] + ["UINT", "FLOAT", "DOUBLE"]
140
+
141
+ _cast_dict["CFLOAT"] = _cast_dict["FLOAT"] + ["CFLOAT"]
142
+
143
+ _cast_dict['STRING1'] = ['STRING1']
144
+ _cast_dict['STRING5'] = ['STRING5']
145
+ _cast_dict['CHARACTER'] = ['CHARACTER']
146
+
147
+ # 32 bit system malloc typically does not provide the alignment required by
148
+ # 16 byte long double types this means the inout intent cannot be satisfied
149
+ # and several tests fail as the alignment flag can be randomly true or false
150
+ # when numpy gains an aligned allocator the tests could be enabled again
151
+ #
152
+ # Furthermore, on macOS ARM64 and AIX, LONGDOUBLE is an alias for DOUBLE.
153
+ if ((np.intp().dtype.itemsize != 4 or np.clongdouble().dtype.alignment <= 8)
154
+ and sys.platform not in ["win32", "aix"]
155
+ and (platform.system(), platform.processor()) != ("Darwin", "arm")):
156
+ _type_names.extend(["LONGDOUBLE", "CDOUBLE", "CLONGDOUBLE"])
157
+ _cast_dict["LONGDOUBLE"] = _cast_dict["LONG"] + [
158
+ "ULONG",
159
+ "FLOAT",
160
+ "DOUBLE",
161
+ "LONGDOUBLE",
162
+ ]
163
+ _cast_dict["CLONGDOUBLE"] = _cast_dict["LONGDOUBLE"] + [
164
+ "CFLOAT",
165
+ "CDOUBLE",
166
+ "CLONGDOUBLE",
167
+ ]
168
+ _cast_dict["CDOUBLE"] = _cast_dict["DOUBLE"] + ["CFLOAT", "CDOUBLE"]
169
+
170
+
171
+ class Type:
172
+ _type_cache = {}
173
+
174
+ def __new__(cls, name):
175
+ if isinstance(name, np.dtype):
176
+ dtype0 = name
177
+ name = None
178
+ for n, i in c_names_dict.items():
179
+ if not isinstance(i, type) and dtype0.type is i.type:
180
+ name = n
181
+ break
182
+ obj = cls._type_cache.get(name.upper(), None)
183
+ if obj is not None:
184
+ return obj
185
+ obj = object.__new__(cls)
186
+ obj._init(name)
187
+ cls._type_cache[name.upper()] = obj
188
+ return obj
189
+
190
+ def _init(self, name):
191
+ self.NAME = name.upper()
192
+
193
+ if self.NAME == 'CHARACTER':
194
+ info = c_names_dict[self.NAME]
195
+ self.type_num = wrap.NPY_STRING
196
+ self.elsize = 1
197
+ self.dtype = np.dtype('c')
198
+ elif self.NAME.startswith('STRING'):
199
+ info = c_names_dict[self.NAME[:6]]
200
+ self.type_num = wrap.NPY_STRING
201
+ self.elsize = int(self.NAME[6:] or 0)
202
+ self.dtype = np.dtype(f'S{self.elsize}')
203
+ else:
204
+ info = c_names_dict[self.NAME]
205
+ self.type_num = getattr(wrap, 'NPY_' + self.NAME)
206
+ self.elsize = info.itemsize
207
+ self.dtype = np.dtype(info.type)
208
+
209
+ assert self.type_num == info.num
210
+ self.type = info.type
211
+ self.dtypechar = info.char
212
+
213
+ def __repr__(self):
214
+ return (f"Type({self.NAME})|type_num={self.type_num},"
215
+ f" dtype={self.dtype},"
216
+ f" type={self.type}, elsize={self.elsize},"
217
+ f" dtypechar={self.dtypechar}")
218
+
219
+ def cast_types(self):
220
+ return [self.__class__(_m) for _m in _cast_dict[self.NAME]]
221
+
222
+ def all_types(self):
223
+ return [self.__class__(_m) for _m in _type_names]
224
+
225
+ def smaller_types(self):
226
+ bits = c_names_dict[self.NAME].alignment
227
+ types = []
228
+ for name in _type_names:
229
+ if c_names_dict[name].alignment < bits:
230
+ types.append(Type(name))
231
+ return types
232
+
233
+ def equal_types(self):
234
+ bits = c_names_dict[self.NAME].alignment
235
+ types = []
236
+ for name in _type_names:
237
+ if name == self.NAME:
238
+ continue
239
+ if c_names_dict[name].alignment == bits:
240
+ types.append(Type(name))
241
+ return types
242
+
243
+ def larger_types(self):
244
+ bits = c_names_dict[self.NAME].alignment
245
+ types = []
246
+ for name in _type_names:
247
+ if c_names_dict[name].alignment > bits:
248
+ types.append(Type(name))
249
+ return types
250
+
251
+
252
+ class Array:
253
+
254
+ def __repr__(self):
255
+ return (f'Array({self.type}, {self.dims}, {self.intent},'
256
+ f' {self.obj})|arr={self.arr}')
257
+
258
+ def __init__(self, typ, dims, intent, obj):
259
+ self.type = typ
260
+ self.dims = dims
261
+ self.intent = intent
262
+ self.obj_copy = copy.deepcopy(obj)
263
+ self.obj = obj
264
+
265
+ # arr.dtypechar may be different from typ.dtypechar
266
+ self.arr = wrap.call(typ.type_num,
267
+ typ.elsize,
268
+ dims, intent.flags, obj)
269
+
270
+ assert isinstance(self.arr, np.ndarray)
271
+
272
+ self.arr_attr = wrap.array_attrs(self.arr)
273
+
274
+ if len(dims) > 1:
275
+ if self.intent.is_intent("c"):
276
+ assert (intent.flags & wrap.F2PY_INTENT_C)
277
+ assert not self.arr.flags["FORTRAN"]
278
+ assert self.arr.flags["CONTIGUOUS"]
279
+ assert (not self.arr_attr[6] & wrap.FORTRAN)
280
+ else:
281
+ assert (not intent.flags & wrap.F2PY_INTENT_C)
282
+ assert self.arr.flags["FORTRAN"]
283
+ assert not self.arr.flags["CONTIGUOUS"]
284
+ assert (self.arr_attr[6] & wrap.FORTRAN)
285
+
286
+ if obj is None:
287
+ self.pyarr = None
288
+ self.pyarr_attr = None
289
+ return
290
+
291
+ if intent.is_intent("cache"):
292
+ assert isinstance(obj, np.ndarray), repr(type(obj))
293
+ self.pyarr = np.array(obj).reshape(*dims).copy()
294
+ else:
295
+ self.pyarr = np.array(
296
+ np.array(obj, dtype=typ.dtypechar).reshape(*dims),
297
+ order=(self.intent.is_intent("c") and "C") or "F",
298
+ )
299
+ assert self.pyarr.dtype == typ
300
+ self.pyarr.setflags(write=self.arr.flags["WRITEABLE"])
301
+ assert self.pyarr.flags["OWNDATA"], (obj, intent)
302
+ self.pyarr_attr = wrap.array_attrs(self.pyarr)
303
+
304
+ if len(dims) > 1:
305
+ if self.intent.is_intent("c"):
306
+ assert not self.pyarr.flags["FORTRAN"]
307
+ assert self.pyarr.flags["CONTIGUOUS"]
308
+ assert (not self.pyarr_attr[6] & wrap.FORTRAN)
309
+ else:
310
+ assert self.pyarr.flags["FORTRAN"]
311
+ assert not self.pyarr.flags["CONTIGUOUS"]
312
+ assert (self.pyarr_attr[6] & wrap.FORTRAN)
313
+
314
+ assert self.arr_attr[1] == self.pyarr_attr[1] # nd
315
+ assert self.arr_attr[2] == self.pyarr_attr[2] # dimensions
316
+ if self.arr_attr[1] <= 1:
317
+ assert self.arr_attr[3] == self.pyarr_attr[3], repr((
318
+ self.arr_attr[3],
319
+ self.pyarr_attr[3],
320
+ self.arr.tobytes(),
321
+ self.pyarr.tobytes(),
322
+ )) # strides
323
+ assert self.arr_attr[5][-2:] == self.pyarr_attr[5][-2:], repr((
324
+ self.arr_attr[5], self.pyarr_attr[5]
325
+ )) # descr
326
+ arr_flags = self.arr_attr[6]
327
+ if intent.is_intent("inplace") and not (
328
+ obj.dtype == typ and obj.flags["F_CONTIGUOUS"]
329
+ ):
330
+ assert flags2names(8192) == ["WRITEBACKIFCOPY"]
331
+ assert (arr_flags & 8192), f"{flags2names(8192)} not set."
332
+ arr_flags -= 8192 # Not easy to set on pyarr.
333
+ else:
334
+ assert not (arr_flags & 8192)
335
+
336
+ assert arr_flags == self.pyarr_attr[6], repr((
337
+ self.arr_attr[6],
338
+ self.pyarr_attr[6],
339
+ flags2names(0 * self.arr_attr[6] - self.pyarr_attr[6]),
340
+ flags2names(self.arr_attr[6]),
341
+ intent,
342
+ )) # flags
343
+
344
+ if intent.is_intent("cache"):
345
+ assert self.arr_attr[5][3] >= self.type.elsize
346
+ else:
347
+ assert self.arr_attr[5][3] == self.type.elsize
348
+ assert (self.arr_equal(self.pyarr, self.arr))
349
+
350
+ if isinstance(self.obj, np.ndarray):
351
+ if typ.elsize == Type(obj.dtype).elsize:
352
+ if not intent.is_intent("copy") and self.arr_attr[1] <= 1:
353
+ assert self.has_shared_memory()
354
+
355
+ def arr_equal(self, arr1, arr2):
356
+ if arr1.shape != arr2.shape:
357
+ return False
358
+ return (arr1 == arr2).all()
359
+
360
+ def __str__(self):
361
+ return str(self.arr)
362
+
363
+ def has_shared_memory(self):
364
+ """Check that created array shares data with input array."""
365
+ if self.obj is self.arr:
366
+ return True
367
+ if not isinstance(self.obj, np.ndarray):
368
+ return False
369
+ obj_attr = wrap.array_attrs(self.obj)
370
+ return obj_attr[0] == self.arr_attr[0]
371
+
372
+
373
+ class TestIntent:
374
+ def test_in_out(self):
375
+ assert str(intent.in_.out) == "intent(in,out)"
376
+ assert intent.in_.c.is_intent("c")
377
+ assert not intent.in_.c.is_intent_exact("c")
378
+ assert intent.in_.c.is_intent_exact("c", "in")
379
+ assert intent.in_.c.is_intent_exact("in", "c")
380
+ assert not intent.in_.is_intent("c")
381
+
382
+
383
+ class TestSharedMemory:
384
+
385
+ @pytest.fixture(autouse=True, scope="class", params=_type_names)
386
+ @classmethod
387
+ def setup_type(self, request):
388
+ request.cls.type = Type(request.param)
389
+ request.cls.array = lambda self, dims, intent, obj: Array(
390
+ Type(request.param), dims, intent, obj)
391
+
392
+ @property
393
+ def num2seq(self):
394
+ if self.type.NAME.startswith('STRING'):
395
+ elsize = self.type.elsize
396
+ return ['1' * elsize, '2' * elsize]
397
+ return [1, 2]
398
+
399
+ @property
400
+ def num23seq(self):
401
+ if self.type.NAME.startswith('STRING'):
402
+ elsize = self.type.elsize
403
+ return [['1' * elsize, '2' * elsize, '3' * elsize],
404
+ ['4' * elsize, '5' * elsize, '6' * elsize]]
405
+ return [[1, 2, 3], [4, 5, 6]]
406
+
407
+ def test_in_from_2seq(self):
408
+ a = self.array([2], intent.in_, self.num2seq)
409
+ assert not a.has_shared_memory()
410
+
411
+ def test_in_from_2casttype(self):
412
+ for t in self.type.cast_types():
413
+ obj = np.array(self.num2seq, dtype=t.dtype)
414
+ a = self.array([len(self.num2seq)], intent.in_, obj)
415
+ if t.elsize == self.type.elsize:
416
+ assert a.has_shared_memory(), repr((self.type.dtype, t.dtype))
417
+ else:
418
+ assert not a.has_shared_memory()
419
+
420
+ @pytest.mark.parametrize("write", ["w", "ro"])
421
+ @pytest.mark.parametrize("order", ["C", "F"])
422
+ @pytest.mark.parametrize("inp", ["2seq", "23seq"])
423
+ def test_in_nocopy(self, write, order, inp):
424
+ """Test if intent(in) array can be passed without copies"""
425
+ seq = getattr(self, "num" + inp)
426
+ obj = np.array(seq, dtype=self.type.dtype, order=order)
427
+ obj.setflags(write=(write == 'w'))
428
+ a = self.array(obj.shape,
429
+ ((order == 'C' and intent.in_.c) or intent.in_), obj)
430
+ assert a.has_shared_memory()
431
+
432
+ def test_inout_2seq(self):
433
+ obj = np.array(self.num2seq, dtype=self.type.dtype)
434
+ a = self.array([len(self.num2seq)], intent.inout, obj)
435
+ assert a.has_shared_memory()
436
+
437
+ try:
438
+ a = self.array([2], intent.in_.inout, self.num2seq)
439
+ except TypeError as msg:
440
+ if not str(msg).startswith(
441
+ "failed to initialize intent(inout|inplace|cache) array"):
442
+ raise
443
+ else:
444
+ raise SystemError("intent(inout) should have failed on sequence")
445
+
446
+ def test_f_inout_23seq(self):
447
+ obj = np.array(self.num23seq, dtype=self.type.dtype, order="F")
448
+ shape = (len(self.num23seq), len(self.num23seq[0]))
449
+ a = self.array(shape, intent.in_.inout, obj)
450
+ assert a.has_shared_memory()
451
+
452
+ obj = np.array(self.num23seq, dtype=self.type.dtype, order="C")
453
+ shape = (len(self.num23seq), len(self.num23seq[0]))
454
+ try:
455
+ a = self.array(shape, intent.in_.inout, obj)
456
+ except ValueError as msg:
457
+ if not str(msg).startswith(
458
+ "failed to initialize intent(inout) array"):
459
+ raise
460
+ else:
461
+ raise SystemError(
462
+ "intent(inout) should have failed on improper array")
463
+
464
+ def test_c_inout_23seq(self):
465
+ obj = np.array(self.num23seq, dtype=self.type.dtype)
466
+ shape = (len(self.num23seq), len(self.num23seq[0]))
467
+ a = self.array(shape, intent.in_.c.inout, obj)
468
+ assert a.has_shared_memory()
469
+
470
+ def test_in_copy_from_2casttype(self):
471
+ for t in self.type.cast_types():
472
+ obj = np.array(self.num2seq, dtype=t.dtype)
473
+ a = self.array([len(self.num2seq)], intent.in_.copy, obj)
474
+ assert not a.has_shared_memory()
475
+
476
+ def test_c_in_from_23seq(self):
477
+ a = self.array(
478
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_,
479
+ self.num23seq)
480
+ assert not a.has_shared_memory()
481
+
482
+ def test_in_from_23casttype(self):
483
+ for t in self.type.cast_types():
484
+ obj = np.array(self.num23seq, dtype=t.dtype)
485
+ a = self.array(
486
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_, obj)
487
+ assert not a.has_shared_memory()
488
+
489
+ def test_f_in_from_23casttype(self):
490
+ for t in self.type.cast_types():
491
+ obj = np.array(self.num23seq, dtype=t.dtype, order="F")
492
+ a = self.array(
493
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_, obj)
494
+ if t.elsize == self.type.elsize:
495
+ assert a.has_shared_memory()
496
+ else:
497
+ assert not a.has_shared_memory()
498
+
499
+ def test_c_in_from_23casttype(self):
500
+ for t in self.type.cast_types():
501
+ obj = np.array(self.num23seq, dtype=t.dtype)
502
+ a = self.array(
503
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_.c, obj)
504
+ if t.elsize == self.type.elsize:
505
+ assert a.has_shared_memory()
506
+ else:
507
+ assert not a.has_shared_memory()
508
+
509
+ def test_f_copy_in_from_23casttype(self):
510
+ for t in self.type.cast_types():
511
+ obj = np.array(self.num23seq, dtype=t.dtype, order="F")
512
+ a = self.array(
513
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_.copy,
514
+ obj)
515
+ assert not a.has_shared_memory()
516
+
517
+ def test_c_copy_in_from_23casttype(self):
518
+ for t in self.type.cast_types():
519
+ obj = np.array(self.num23seq, dtype=t.dtype)
520
+ a = self.array(
521
+ [len(self.num23seq), len(self.num23seq[0])], intent.in_.c.copy,
522
+ obj)
523
+ assert not a.has_shared_memory()
524
+
525
+ def test_in_cache_from_2casttype(self):
526
+ for t in self.type.all_types():
527
+ if t.elsize != self.type.elsize:
528
+ continue
529
+ obj = np.array(self.num2seq, dtype=t.dtype)
530
+ shape = (len(self.num2seq), )
531
+ a = self.array(shape, intent.in_.c.cache, obj)
532
+ assert a.has_shared_memory()
533
+
534
+ a = self.array(shape, intent.in_.cache, obj)
535
+ assert a.has_shared_memory()
536
+
537
+ obj = np.array(self.num2seq, dtype=t.dtype, order="F")
538
+ a = self.array(shape, intent.in_.c.cache, obj)
539
+ assert a.has_shared_memory()
540
+
541
+ a = self.array(shape, intent.in_.cache, obj)
542
+ assert a.has_shared_memory(), repr(t.dtype)
543
+
544
+ try:
545
+ a = self.array(shape, intent.in_.cache, obj[::-1])
546
+ except ValueError as msg:
547
+ if not str(msg).startswith(
548
+ "failed to initialize intent(cache) array"):
549
+ raise
550
+ else:
551
+ raise SystemError(
552
+ "intent(cache) should have failed on multisegmented array")
553
+
554
+ def test_in_cache_from_2casttype_failure(self):
555
+ for t in self.type.all_types():
556
+ if t.NAME == 'STRING':
557
+ # string elsize is 0, so skipping the test
558
+ continue
559
+ if t.elsize >= self.type.elsize:
560
+ continue
561
+ is_int = np.issubdtype(t.dtype, np.integer)
562
+ if is_int and int(self.num2seq[0]) > np.iinfo(t.dtype).max:
563
+ # skip test if num2seq would trigger an overflow error
564
+ continue
565
+ obj = np.array(self.num2seq, dtype=t.dtype)
566
+ shape = (len(self.num2seq), )
567
+ try:
568
+ self.array(shape, intent.in_.cache, obj) # Should succeed
569
+ except ValueError as msg:
570
+ if not str(msg).startswith(
571
+ "failed to initialize intent(cache) array"):
572
+ raise
573
+ else:
574
+ raise SystemError(
575
+ "intent(cache) should have failed on smaller array")
576
+
577
+ def test_cache_hidden(self):
578
+ shape = (2, )
579
+ a = self.array(shape, intent.cache.hide, None)
580
+ assert a.arr.shape == shape
581
+
582
+ shape = (2, 3)
583
+ a = self.array(shape, intent.cache.hide, None)
584
+ assert a.arr.shape == shape
585
+
586
+ shape = (-1, 3)
587
+ try:
588
+ a = self.array(shape, intent.cache.hide, None)
589
+ except ValueError as msg:
590
+ if not str(msg).startswith(
591
+ "failed to create intent(cache|hide)|optional array"):
592
+ raise
593
+ else:
594
+ raise SystemError(
595
+ "intent(cache) should have failed on undefined dimensions")
596
+
597
+ def test_hidden(self):
598
+ shape = (2, )
599
+ a = self.array(shape, intent.hide, None)
600
+ assert a.arr.shape == shape
601
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
602
+
603
+ shape = (2, 3)
604
+ a = self.array(shape, intent.hide, None)
605
+ assert a.arr.shape == shape
606
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
607
+ assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
608
+
609
+ shape = (2, 3)
610
+ a = self.array(shape, intent.c.hide, None)
611
+ assert a.arr.shape == shape
612
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
613
+ assert not a.arr.flags["FORTRAN"] and a.arr.flags["CONTIGUOUS"]
614
+
615
+ shape = (-1, 3)
616
+ try:
617
+ a = self.array(shape, intent.hide, None)
618
+ except ValueError as msg:
619
+ if not str(msg).startswith(
620
+ "failed to create intent(cache|hide)|optional array"):
621
+ raise
622
+ else:
623
+ raise SystemError(
624
+ "intent(hide) should have failed on undefined dimensions")
625
+
626
+ def test_optional_none(self):
627
+ shape = (2, )
628
+ a = self.array(shape, intent.optional, None)
629
+ assert a.arr.shape == shape
630
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
631
+
632
+ shape = (2, 3)
633
+ a = self.array(shape, intent.optional, None)
634
+ assert a.arr.shape == shape
635
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
636
+ assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
637
+
638
+ shape = (2, 3)
639
+ a = self.array(shape, intent.c.optional, None)
640
+ assert a.arr.shape == shape
641
+ assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
642
+ assert not a.arr.flags["FORTRAN"] and a.arr.flags["CONTIGUOUS"]
643
+
644
+ def test_optional_from_2seq(self):
645
+ obj = self.num2seq
646
+ shape = (len(obj), )
647
+ a = self.array(shape, intent.optional, obj)
648
+ assert a.arr.shape == shape
649
+ assert not a.has_shared_memory()
650
+
651
+ def test_optional_from_23seq(self):
652
+ obj = self.num23seq
653
+ shape = (len(obj), len(obj[0]))
654
+ a = self.array(shape, intent.optional, obj)
655
+ assert a.arr.shape == shape
656
+ assert not a.has_shared_memory()
657
+
658
+ a = self.array(shape, intent.optional.c, obj)
659
+ assert a.arr.shape == shape
660
+ assert not a.has_shared_memory()
661
+
662
+ def test_inplace(self):
663
+ obj = np.array(self.num23seq, dtype=self.type.dtype)
664
+ assert not obj.flags["FORTRAN"] and obj.flags["CONTIGUOUS"]
665
+ shape = obj.shape
666
+ a = self.array(shape, intent.inplace, obj)
667
+ # Spot check that they contain the same information initially.
668
+ assert obj[1][2] == a.arr[1][2], repr((obj, a.arr))
669
+ # If we change a.arr, that will not immediately be reflected in obj.
670
+ change_item = 54 if self.type.dtype != bool else False
671
+ a.arr[1][2] = change_item
672
+ assert a.arr[1][2] == np.array(change_item, dtype=self.type.dtype)
673
+ assert obj[1][2] != np.array(change_item, dtype=self.type.dtype)
674
+ # This is because our implementation uses writebackifcopy.
675
+ assert a.arr.flags["WRITEBACKIFCOPY"]
676
+ assert a.arr.base is obj
677
+ # It has a different organization from obj.
678
+ assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
679
+ # If we resolve the write-back, obj will be properly filled.
680
+ code = wrap.resolve_write_back_if_copy(a.arr)
681
+ assert code == 1, "no write-back resolution was done!"
682
+ assert obj[1][2] == np.array(change_item, dtype=self.type.dtype)
683
+ # Check that the original's attributes are not messed up.
684
+ assert not obj.flags["FORTRAN"] and obj.flags["CONTIGUOUS"]
685
+
686
+ def test_inplace_f_order(self):
687
+ # If the input array is suitable, it will just be used.
688
+ obj = np.array(self.num23seq, dtype=self.type.dtype, order="F")
689
+ assert obj.flags["FORTRAN"] and not obj.flags["CONTIGUOUS"]
690
+ a = self.array(obj.shape, intent.inplace, obj)
691
+ assert a.arr is obj
692
+
693
+ def test_inplace_from_casttype(self):
694
+ # Similar to above, but including casting.
695
+ for t in self.type.cast_types():
696
+ if t is self.type:
697
+ continue
698
+ obj = np.array(self.num23seq, dtype=t.dtype)
699
+ assert obj.dtype.type == t.type
700
+ assert obj.dtype.type is not self.type.type
701
+ assert not obj.flags["FORTRAN"] and obj.flags["CONTIGUOUS"]
702
+ shape = obj.shape
703
+ same_kind = obj.dtype.kind == self.type.dtype.kind
704
+ # We avoid pytest.raises here since if the error is not raised,
705
+ # we need to do the callback to avoid a runtime warning.
706
+ try:
707
+ a = self.array(shape, intent.inplace, obj)
708
+ except ValueError as exc:
709
+ assert not same_kind, "Array not created while having same kind"
710
+ assert "not compatible" in str(exc)
711
+ return
712
+
713
+ if not same_kind:
714
+ # Shouldn't happen! Resolve write-back to get right error.
715
+ wrap.resolve_write_back_if_copy(a.arr)
716
+ assert same_kind, "Array created despite not having same kind"
717
+
718
+ assert obj[1][2] == a.arr[1][2], repr((obj, a.arr))
719
+ change_item = 54 if self.type.dtype != bool else False
720
+ a.arr[1][2] = change_item
721
+ assert a.arr[1][2] == np.array(change_item, dtype=self.type.dtype)
722
+ # Not yet propagated.
723
+ assert obj[1][2] != np.array(change_item, dtype=self.type.dtype)
724
+ assert a.arr.flags["WRITEBACKIFCOPY"]
725
+ assert a.arr.base is obj
726
+ # Propagate back to obj.
727
+ code = wrap.resolve_write_back_if_copy(a.arr)
728
+ assert code == 1, "no write-back resolution was done!"
729
+ assert obj[1][2] == np.array(change_item, dtype=self.type.dtype)
730
+ # Should not affect attributes.
731
+ assert not obj.flags["FORTRAN"] and obj.flags["CONTIGUOUS"]
732
+ assert obj.dtype.type is not self.type.type
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_assumed_shape.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import tempfile
3
+
4
+ import pytest
5
+
6
+ from . import util
7
+
8
+
9
+ # Note: do not mark as slow! This is one of a small set of f2py compile tests retained
10
+ # in the default suite invocation for compile-path coverage.
11
+ class TestAssumedShapeSumExample(util.F2PyTest):
12
+ sources = [
13
+ util.getpath("tests", "src", "assumed_shape", "foo_free.f90"),
14
+ util.getpath("tests", "src", "assumed_shape", "foo_use.f90"),
15
+ util.getpath("tests", "src", "assumed_shape", "precision.f90"),
16
+ util.getpath("tests", "src", "assumed_shape", "foo_mod.f90"),
17
+ util.getpath("tests", "src", "assumed_shape", ".f2py_f2cmap"),
18
+ ]
19
+
20
+ def test_all(self):
21
+ r = self.module.fsum([1, 2])
22
+ assert r == 3
23
+ r = self.module.sum([1, 2])
24
+ assert r == 3
25
+ r = self.module.sum_with_use([1, 2])
26
+ assert r == 3
27
+
28
+ r = self.module.mod.sum([1, 2])
29
+ assert r == 3
30
+ r = self.module.mod.fsum([1, 2])
31
+ assert r == 3
32
+
33
+
34
+ @pytest.mark.slow
35
+ class TestF2cmapOption(TestAssumedShapeSumExample):
36
+ def setup_method(self):
37
+ # Use a custom file name for .f2py_f2cmap
38
+ self.sources = list(self.sources)
39
+ f2cmap_src = self.sources.pop(-1)
40
+
41
+ self.f2cmap_file = tempfile.NamedTemporaryFile(delete=False)
42
+ with open(f2cmap_src, "rb") as f:
43
+ self.f2cmap_file.write(f.read())
44
+ self.f2cmap_file.close()
45
+
46
+ self.sources.append(self.f2cmap_file.name)
47
+ self.options = ["--f2cmap", self.f2cmap_file.name]
48
+
49
+ super().setup_method()
50
+
51
+ def teardown_method(self):
52
+ os.unlink(self.f2cmap_file.name)
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_block_docstring.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ import pytest
4
+
5
+ from . import util
6
+
7
+
8
+ @pytest.mark.slow
9
+ class TestBlockDocString(util.F2PyTest):
10
+ sources = [util.getpath("tests", "src", "block_docstring", "foo.f")]
11
+
12
+ @pytest.mark.skipif(sys.platform == "win32",
13
+ reason="Fails with MinGW64 Gfortran (Issue #9673)")
14
+ def test_block_docstring(self):
15
+ expected = "bar : 'i'-array(2,3)\n"
16
+ assert self.module.block.__doc__ == expected
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_callback.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import platform
3
+ import sys
4
+ import textwrap
5
+ import threading
6
+ import time
7
+ import traceback
8
+
9
+ import pytest
10
+
11
+ import numpy as np
12
+
13
+ from . import util
14
+
15
+
16
+ @pytest.mark.slow
17
+ class TestF77Callback(util.F2PyTest):
18
+ sources = [util.getpath("tests", "src", "callback", "foo.f")]
19
+
20
+ @pytest.mark.parametrize("name", ["t", "t2"])
21
+ def test_all(self, name):
22
+ self.check_function(name)
23
+
24
+ def test_docstring(self):
25
+ expected = textwrap.dedent("""\
26
+ a = t(fun,[fun_extra_args])
27
+
28
+ Wrapper for ``t``.
29
+
30
+ Parameters
31
+ ----------
32
+ fun : call-back function
33
+
34
+ Other Parameters
35
+ ----------------
36
+ fun_extra_args : input tuple, optional
37
+ Default: ()
38
+
39
+ Returns
40
+ -------
41
+ a : int
42
+
43
+ Notes
44
+ -----
45
+ Call-back functions::
46
+
47
+ def fun(): return a
48
+ Return objects:
49
+ a : int
50
+ """)
51
+ assert self.module.t.__doc__ == expected
52
+
53
+ def check_function(self, name):
54
+ t = getattr(self.module, name)
55
+ r = t(lambda: 4)
56
+ assert r == 4
57
+ r = t(lambda a: 5, fun_extra_args=(6, ))
58
+ assert r == 5
59
+ r = t(lambda a: a, fun_extra_args=(6, ))
60
+ assert r == 6
61
+ r = t(lambda a: 5 + a, fun_extra_args=(7, ))
62
+ assert r == 12
63
+ r = t(math.degrees, fun_extra_args=(math.pi, ))
64
+ assert r == 180
65
+ r = t(math.degrees, fun_extra_args=(math.pi, ))
66
+ assert r == 180
67
+
68
+ r = t(self.module.func, fun_extra_args=(6, ))
69
+ assert r == 17
70
+ r = t(self.module.func0)
71
+ assert r == 11
72
+ r = t(self.module.func0._cpointer)
73
+ assert r == 11
74
+
75
+ class A:
76
+ def __call__(self):
77
+ return 7
78
+
79
+ def mth(self):
80
+ return 9
81
+
82
+ a = A()
83
+ r = t(a)
84
+ assert r == 7
85
+ r = t(a.mth)
86
+ assert r == 9
87
+
88
+ @pytest.mark.skipif(sys.platform == 'win32',
89
+ reason='Fails with MinGW64 Gfortran (Issue #9673)')
90
+ def test_string_callback(self):
91
+ def callback(code):
92
+ if code == "r":
93
+ return 0
94
+ else:
95
+ return 1
96
+
97
+ f = self.module.string_callback
98
+ r = f(callback)
99
+ assert r == 0
100
+
101
+ @pytest.mark.skipif(sys.platform == 'win32',
102
+ reason='Fails with MinGW64 Gfortran (Issue #9673)')
103
+ def test_string_callback_array(self):
104
+ # See gh-10027
105
+ cu1 = np.zeros((1, ), "S8")
106
+ cu2 = np.zeros((1, 8), "c")
107
+ cu3 = np.array([""], "S8")
108
+
109
+ def callback(cu, lencu):
110
+ if cu.shape != (lencu,):
111
+ return 1
112
+ if cu.dtype != "S8":
113
+ return 2
114
+ if not np.all(cu == b""):
115
+ return 3
116
+ return 0
117
+
118
+ f = self.module.string_callback_array
119
+ for cu in [cu1, cu2, cu3]:
120
+ res = f(callback, cu, cu.size)
121
+ assert res == 0
122
+
123
+ def test_threadsafety(self):
124
+ # Segfaults if the callback handling is not threadsafe
125
+
126
+ errors = []
127
+
128
+ def cb():
129
+ # Sleep here to make it more likely for another thread
130
+ # to call their callback at the same time.
131
+ time.sleep(1e-3)
132
+
133
+ # Check reentrancy
134
+ r = self.module.t(lambda: 123)
135
+ assert r == 123
136
+
137
+ return 42
138
+
139
+ def runner(name):
140
+ try:
141
+ for j in range(50):
142
+ r = self.module.t(cb)
143
+ assert r == 42
144
+ self.check_function(name)
145
+ except Exception:
146
+ errors.append(traceback.format_exc())
147
+
148
+ threads = [
149
+ threading.Thread(target=runner, args=(arg, ))
150
+ for arg in ("t", "t2") for n in range(20)
151
+ ]
152
+
153
+ for t in threads:
154
+ t.start()
155
+
156
+ for t in threads:
157
+ t.join()
158
+
159
+ errors = "\n\n".join(errors)
160
+ if errors:
161
+ raise AssertionError(errors)
162
+
163
+ def test_hidden_callback(self):
164
+ try:
165
+ self.module.hidden_callback(2)
166
+ except Exception as msg:
167
+ assert str(msg).startswith("Callback global_f not defined")
168
+
169
+ try:
170
+ self.module.hidden_callback2(2)
171
+ except Exception as msg:
172
+ assert str(msg).startswith("cb: Callback global_f not defined")
173
+
174
+ self.module.global_f = lambda x: x + 1
175
+ r = self.module.hidden_callback(2)
176
+ assert r == 3
177
+
178
+ self.module.global_f = lambda x: x + 2
179
+ r = self.module.hidden_callback(2)
180
+ assert r == 4
181
+
182
+ del self.module.global_f
183
+ try:
184
+ self.module.hidden_callback(2)
185
+ except Exception as msg:
186
+ assert str(msg).startswith("Callback global_f not defined")
187
+
188
+ self.module.global_f = lambda x=0: x + 3
189
+ r = self.module.hidden_callback(2)
190
+ assert r == 5
191
+
192
+ # reproducer of gh18341
193
+ r = self.module.hidden_callback2(2)
194
+ assert r == 3
195
+
196
+
197
+ @pytest.mark.slow
198
+ class TestF77CallbackPythonTLS(TestF77Callback):
199
+ """
200
+ Callback tests using Python thread-local storage instead of
201
+ compiler-provided
202
+ """
203
+
204
+ options = ["-DF2PY_USE_PYTHON_TLS"]
205
+
206
+
207
+ @pytest.mark.slow
208
+ class TestF90Callback(util.F2PyTest):
209
+ sources = [util.getpath("tests", "src", "callback", "gh17797.f90")]
210
+
211
+ def test_gh17797(self):
212
+ def incr(x):
213
+ return x + 123
214
+
215
+ y = np.array([1, 2, 3], dtype=np.int64)
216
+ r = self.module.gh17797(incr, y)
217
+ assert r == 123 + 1 + 2 + 3
218
+
219
+
220
+ @pytest.mark.slow
221
+ class TestGH18335(util.F2PyTest):
222
+ """The reproduction of the reported issue requires specific input that
223
+ extensions may break the issue conditions, so the reproducer is
224
+ implemented as a separate test class. Do not extend this test with
225
+ other tests!
226
+ """
227
+ sources = [util.getpath("tests", "src", "callback", "gh18335.f90")]
228
+
229
+ def test_gh18335(self):
230
+ def foo(x):
231
+ x[0] += 1
232
+
233
+ r = self.module.gh18335(foo)
234
+ assert r == 123 + 1
235
+
236
+
237
+ @pytest.mark.slow
238
+ class TestGH25211(util.F2PyTest):
239
+ sources = [util.getpath("tests", "src", "callback", "gh25211.f"),
240
+ util.getpath("tests", "src", "callback", "gh25211.pyf")]
241
+ module_name = "callback2"
242
+
243
+ def test_gh25211(self):
244
+ def bar(x):
245
+ return x * x
246
+
247
+ res = self.module.foo(bar)
248
+ assert res == 110
249
+
250
+
251
+ @pytest.mark.slow
252
+ @pytest.mark.xfail(condition=(platform.system().lower() == 'darwin'),
253
+ run=False,
254
+ reason="Callback aborts cause CI failures on macOS")
255
+ class TestCBFortranCallstatement(util.F2PyTest):
256
+ sources = [util.getpath("tests", "src", "callback", "gh26681.f90")]
257
+ options = ['--lower']
258
+
259
+ def test_callstatement_fortran(self):
260
+ with pytest.raises(ValueError, match='helpme') as exc:
261
+ self.module.mypy_abort = self.module.utils.my_abort
262
+ self.module.utils.do_something('helpme')
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_capi_maps.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.f2py import capi_maps
2
+
3
+
4
+ def test_complex_long_double_capi_map():
5
+ assert capi_maps.c2capi_map["complex_long_double"] == "NPY_CLONGDOUBLE"
6
+
7
+
8
+ def test_complex_long_double_is_distinct():
9
+ assert capi_maps.c2pycode_map["complex_long_double"] != capi_maps.c2pycode_map["complex_double"]
10
+ assert capi_maps.c2capi_map["complex_long_double"] != capi_maps.c2capi_map["complex_double"]
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py ADDED
@@ -0,0 +1,644 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import textwrap
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+ from numpy.f2py.tests import util
7
+ from numpy.testing import assert_array_equal, assert_equal, assert_raises
8
+
9
+
10
+ @pytest.mark.slow
11
+ class TestCharacterString(util.F2PyTest):
12
+ # options = ['--debug-capi', '--build-dir', '/tmp/test-build-f2py']
13
+ suffix = '.f90'
14
+ fprefix = 'test_character_string'
15
+ length_list = ['1', '3', 'star']
16
+
17
+ code = ''
18
+ for length in length_list:
19
+ fsuffix = length
20
+ clength = {'star': '(*)'}.get(length, length)
21
+
22
+ code += textwrap.dedent(f"""
23
+
24
+ subroutine {fprefix}_input_{fsuffix}(c, o, n)
25
+ character*{clength}, intent(in) :: c
26
+ integer n
27
+ !f2py integer, depend(c), intent(hide) :: n = slen(c)
28
+ integer*1, dimension(n) :: o
29
+ !f2py intent(out) o
30
+ o = transfer(c, o)
31
+ end subroutine {fprefix}_input_{fsuffix}
32
+
33
+ subroutine {fprefix}_output_{fsuffix}(c, o, n)
34
+ character*{clength}, intent(out) :: c
35
+ integer n
36
+ integer*1, dimension(n), intent(in) :: o
37
+ !f2py integer, depend(o), intent(hide) :: n = len(o)
38
+ c = transfer(o, c)
39
+ end subroutine {fprefix}_output_{fsuffix}
40
+
41
+ subroutine {fprefix}_array_input_{fsuffix}(c, o, m, n)
42
+ integer m, i, n
43
+ character*{clength}, intent(in), dimension(m) :: c
44
+ !f2py integer, depend(c), intent(hide) :: m = len(c)
45
+ !f2py integer, depend(c), intent(hide) :: n = f2py_itemsize(c)
46
+ integer*1, dimension(m, n), intent(out) :: o
47
+ do i=1,m
48
+ o(i, :) = transfer(c(i), o(i, :))
49
+ end do
50
+ end subroutine {fprefix}_array_input_{fsuffix}
51
+
52
+ subroutine {fprefix}_array_output_{fsuffix}(c, o, m, n)
53
+ character*{clength}, intent(out), dimension(m) :: c
54
+ integer n
55
+ integer*1, dimension(m, n), intent(in) :: o
56
+ !f2py character(f2py_len=n) :: c
57
+ !f2py integer, depend(o), intent(hide) :: m = len(o)
58
+ !f2py integer, depend(o), intent(hide) :: n = shape(o, 1)
59
+ do i=1,m
60
+ c(i) = transfer(o(i, :), c(i))
61
+ end do
62
+ end subroutine {fprefix}_array_output_{fsuffix}
63
+
64
+ subroutine {fprefix}_2d_array_input_{fsuffix}(c, o, m1, m2, n)
65
+ integer m1, m2, i, j, n
66
+ character*{clength}, intent(in), dimension(m1, m2) :: c
67
+ !f2py integer, depend(c), intent(hide) :: m1 = len(c)
68
+ !f2py integer, depend(c), intent(hide) :: m2 = shape(c, 1)
69
+ !f2py integer, depend(c), intent(hide) :: n = f2py_itemsize(c)
70
+ integer*1, dimension(m1, m2, n), intent(out) :: o
71
+ do i=1,m1
72
+ do j=1,m2
73
+ o(i, j, :) = transfer(c(i, j), o(i, j, :))
74
+ end do
75
+ end do
76
+ end subroutine {fprefix}_2d_array_input_{fsuffix}
77
+ """)
78
+
79
+ @pytest.mark.parametrize("length", length_list)
80
+ def test_input(self, length):
81
+ fsuffix = {'(*)': 'star'}.get(length, length)
82
+ f = getattr(self.module, self.fprefix + '_input_' + fsuffix)
83
+
84
+ a = {'1': 'a', '3': 'abc', 'star': 'abcde' * 3}[length]
85
+
86
+ assert_array_equal(f(a), np.array(list(map(ord, a)), dtype='u1'))
87
+
88
+ @pytest.mark.parametrize("length", length_list[:-1])
89
+ def test_output(self, length):
90
+ fsuffix = length
91
+ f = getattr(self.module, self.fprefix + '_output_' + fsuffix)
92
+
93
+ a = {'1': 'a', '3': 'abc'}[length]
94
+
95
+ assert_array_equal(f(np.array(list(map(ord, a)), dtype='u1')),
96
+ a.encode())
97
+
98
+ @pytest.mark.parametrize("length", length_list)
99
+ def test_array_input(self, length):
100
+ fsuffix = length
101
+ f = getattr(self.module, self.fprefix + '_array_input_' + fsuffix)
102
+
103
+ a = np.array([{'1': 'a', '3': 'abc', 'star': 'abcde' * 3}[length],
104
+ {'1': 'A', '3': 'ABC', 'star': 'ABCDE' * 3}[length],
105
+ ], dtype='S')
106
+
107
+ expected = np.array([list(s) for s in a], dtype='u1')
108
+ assert_array_equal(f(a), expected)
109
+
110
+ @pytest.mark.parametrize("length", length_list)
111
+ def test_array_output(self, length):
112
+ fsuffix = length
113
+ f = getattr(self.module, self.fprefix + '_array_output_' + fsuffix)
114
+
115
+ expected = np.array(
116
+ [{'1': 'a', '3': 'abc', 'star': 'abcde' * 3}[length],
117
+ {'1': 'A', '3': 'ABC', 'star': 'ABCDE' * 3}[length]], dtype='S')
118
+
119
+ a = np.array([list(s) for s in expected], dtype='u1')
120
+ assert_array_equal(f(a), expected)
121
+
122
+ @pytest.mark.parametrize("length", length_list)
123
+ def test_2d_array_input(self, length):
124
+ fsuffix = length
125
+ f = getattr(self.module, self.fprefix + '_2d_array_input_' + fsuffix)
126
+
127
+ a = np.array([[{'1': 'a', '3': 'abc', 'star': 'abcde' * 3}[length],
128
+ {'1': 'A', '3': 'ABC', 'star': 'ABCDE' * 3}[length]],
129
+ [{'1': 'f', '3': 'fgh', 'star': 'fghij' * 3}[length],
130
+ {'1': 'F', '3': 'FGH', 'star': 'FGHIJ' * 3}[length]]],
131
+ dtype='S')
132
+ expected = np.array([[list(item) for item in row] for row in a],
133
+ dtype='u1', order='F')
134
+ assert_array_equal(f(a), expected)
135
+
136
+
137
+ @pytest.mark.slow
138
+ class TestCharacter(util.F2PyTest):
139
+ # options = ['--debug-capi', '--build-dir', '/tmp/test-build-f2py']
140
+ suffix = '.f90'
141
+ fprefix = 'test_character'
142
+
143
+ code = textwrap.dedent(f"""
144
+ subroutine {fprefix}_input(c, o)
145
+ character, intent(in) :: c
146
+ integer*1 o
147
+ !f2py intent(out) o
148
+ o = transfer(c, o)
149
+ end subroutine {fprefix}_input
150
+
151
+ subroutine {fprefix}_output(c, o)
152
+ character :: c
153
+ integer*1, intent(in) :: o
154
+ !f2py intent(out) c
155
+ c = transfer(o, c)
156
+ end subroutine {fprefix}_output
157
+
158
+ subroutine {fprefix}_input_output(c, o)
159
+ character, intent(in) :: c
160
+ character o
161
+ !f2py intent(out) o
162
+ o = c
163
+ end subroutine {fprefix}_input_output
164
+
165
+ subroutine {fprefix}_inout(c, n)
166
+ character :: c, n
167
+ !f2py intent(in) n
168
+ !f2py intent(inout) c
169
+ c = n
170
+ end subroutine {fprefix}_inout
171
+
172
+ function {fprefix}_return(o) result (c)
173
+ character :: c
174
+ character, intent(in) :: o
175
+ c = transfer(o, c)
176
+ end function {fprefix}_return
177
+
178
+ subroutine {fprefix}_array_input(c, o)
179
+ character, intent(in) :: c(3)
180
+ integer*1 o(3)
181
+ !f2py intent(out) o
182
+ integer i
183
+ do i=1,3
184
+ o(i) = transfer(c(i), o(i))
185
+ end do
186
+ end subroutine {fprefix}_array_input
187
+
188
+ subroutine {fprefix}_2d_array_input(c, o)
189
+ character, intent(in) :: c(2, 3)
190
+ integer*1 o(2, 3)
191
+ !f2py intent(out) o
192
+ integer i, j
193
+ do i=1,2
194
+ do j=1,3
195
+ o(i, j) = transfer(c(i, j), o(i, j))
196
+ end do
197
+ end do
198
+ end subroutine {fprefix}_2d_array_input
199
+
200
+ subroutine {fprefix}_array_output(c, o)
201
+ character :: c(3)
202
+ integer*1, intent(in) :: o(3)
203
+ !f2py intent(out) c
204
+ do i=1,3
205
+ c(i) = transfer(o(i), c(i))
206
+ end do
207
+ end subroutine {fprefix}_array_output
208
+
209
+ subroutine {fprefix}_array_inout(c, n)
210
+ character :: c(3), n(3)
211
+ !f2py intent(in) n(3)
212
+ !f2py intent(inout) c(3)
213
+ do i=1,3
214
+ c(i) = n(i)
215
+ end do
216
+ end subroutine {fprefix}_array_inout
217
+
218
+ subroutine {fprefix}_2d_array_inout(c, n)
219
+ character :: c(2, 3), n(2, 3)
220
+ !f2py intent(in) n(2, 3)
221
+ !f2py intent(inout) c(2. 3)
222
+ integer i, j
223
+ do i=1,2
224
+ do j=1,3
225
+ c(i, j) = n(i, j)
226
+ end do
227
+ end do
228
+ end subroutine {fprefix}_2d_array_inout
229
+
230
+ function {fprefix}_array_return(o) result (c)
231
+ character, dimension(3) :: c
232
+ character, intent(in) :: o(3)
233
+ do i=1,3
234
+ c(i) = o(i)
235
+ end do
236
+ end function {fprefix}_array_return
237
+
238
+ function {fprefix}_optional(o) result (c)
239
+ character, intent(in) :: o
240
+ !f2py character o = "a"
241
+ character :: c
242
+ c = o
243
+ end function {fprefix}_optional
244
+ """)
245
+
246
+ @pytest.mark.parametrize("dtype", ['c', 'S1'])
247
+ def test_input(self, dtype):
248
+ f = getattr(self.module, self.fprefix + '_input')
249
+
250
+ assert_equal(f(np.array('a', dtype=dtype)), ord('a'))
251
+ assert_equal(f(np.array(b'a', dtype=dtype)), ord('a'))
252
+ assert_equal(f(np.array(['a'], dtype=dtype)), ord('a'))
253
+ assert_equal(f(np.array('abc', dtype=dtype)), ord('a'))
254
+ assert_equal(f(np.array([['a']], dtype=dtype)), ord('a'))
255
+
256
+ def test_input_varia(self):
257
+ f = getattr(self.module, self.fprefix + '_input')
258
+
259
+ assert_equal(f('a'), ord('a'))
260
+ assert_equal(f(b'a'), ord(b'a'))
261
+ assert_equal(f(''), 0)
262
+ assert_equal(f(b''), 0)
263
+ assert_equal(f(b'\0'), 0)
264
+ assert_equal(f('ab'), ord('a'))
265
+ assert_equal(f(b'ab'), ord('a'))
266
+ assert_equal(f(['a']), ord('a'))
267
+
268
+ assert_equal(f(np.array(b'a')), ord('a'))
269
+ assert_equal(f(np.array([b'a'])), ord('a'))
270
+ a = np.array('a')
271
+ assert_equal(f(a), ord('a'))
272
+ a = np.array(['a'])
273
+ assert_equal(f(a), ord('a'))
274
+
275
+ try:
276
+ f([])
277
+ except IndexError as msg:
278
+ if not str(msg).endswith(' got 0-list'):
279
+ raise
280
+ else:
281
+ raise SystemError(f'{f.__name__} should have failed on empty list')
282
+
283
+ try:
284
+ f(97)
285
+ except TypeError as msg:
286
+ if not str(msg).endswith(' got int instance'):
287
+ raise
288
+ else:
289
+ raise SystemError(f'{f.__name__} should have failed on int value')
290
+
291
+ @pytest.mark.parametrize("dtype", ['c', 'S1', 'U1'])
292
+ def test_array_input(self, dtype):
293
+ f = getattr(self.module, self.fprefix + '_array_input')
294
+
295
+ assert_array_equal(f(np.array(['a', 'b', 'c'], dtype=dtype)),
296
+ np.array(list(map(ord, 'abc')), dtype='i1'))
297
+ assert_array_equal(f(np.array([b'a', b'b', b'c'], dtype=dtype)),
298
+ np.array(list(map(ord, 'abc')), dtype='i1'))
299
+
300
+ def test_array_input_varia(self):
301
+ f = getattr(self.module, self.fprefix + '_array_input')
302
+ assert_array_equal(f(['a', 'b', 'c']),
303
+ np.array(list(map(ord, 'abc')), dtype='i1'))
304
+ assert_array_equal(f([b'a', b'b', b'c']),
305
+ np.array(list(map(ord, 'abc')), dtype='i1'))
306
+
307
+ try:
308
+ f(['a', 'b', 'c', 'd'])
309
+ except ValueError as msg:
310
+ if not str(msg).endswith(
311
+ 'th dimension must be fixed to 3 but got 4'):
312
+ raise
313
+ else:
314
+ raise SystemError(
315
+ f'{f.__name__} should have failed on wrong input')
316
+
317
+ @pytest.mark.parametrize("dtype", ['c', 'S1', 'U1'])
318
+ def test_2d_array_input(self, dtype):
319
+ f = getattr(self.module, self.fprefix + '_2d_array_input')
320
+
321
+ a = np.array([['a', 'b', 'c'],
322
+ ['d', 'e', 'f']], dtype=dtype, order='F')
323
+ expected = a.view(np.uint32 if dtype == 'U1' else np.uint8)
324
+ assert_array_equal(f(a), expected)
325
+
326
+ def test_output(self):
327
+ f = getattr(self.module, self.fprefix + '_output')
328
+
329
+ assert_equal(f(ord(b'a')), b'a')
330
+ assert_equal(f(0), b'\0')
331
+
332
+ def test_array_output(self):
333
+ f = getattr(self.module, self.fprefix + '_array_output')
334
+
335
+ assert_array_equal(f(list(map(ord, 'abc'))),
336
+ np.array(list('abc'), dtype='S1'))
337
+
338
+ def test_input_output(self):
339
+ f = getattr(self.module, self.fprefix + '_input_output')
340
+
341
+ assert_equal(f(b'a'), b'a')
342
+ assert_equal(f('a'), b'a')
343
+ assert_equal(f(''), b'\0')
344
+
345
+ @pytest.mark.parametrize("dtype", ['c', 'S1'])
346
+ def test_inout(self, dtype):
347
+ f = getattr(self.module, self.fprefix + '_inout')
348
+
349
+ a = np.array(list('abc'), dtype=dtype)
350
+ f(a, 'A')
351
+ assert_array_equal(a, np.array(list('Abc'), dtype=a.dtype))
352
+ f(a[1:], 'B')
353
+ assert_array_equal(a, np.array(list('ABc'), dtype=a.dtype))
354
+
355
+ a = np.array(['abc'], dtype=dtype)
356
+ f(a, 'A')
357
+ assert_array_equal(a, np.array(['Abc'], dtype=a.dtype))
358
+
359
+ def test_inout_varia(self):
360
+ f = getattr(self.module, self.fprefix + '_inout')
361
+ a = np.array('abc', dtype='S3')
362
+ f(a, 'A')
363
+ assert_array_equal(a, np.array('Abc', dtype=a.dtype))
364
+
365
+ a = np.array(['abc'], dtype='S3')
366
+ f(a, 'A')
367
+ assert_array_equal(a, np.array(['Abc'], dtype=a.dtype))
368
+
369
+ try:
370
+ f('abc', 'A')
371
+ except ValueError as msg:
372
+ if not str(msg).endswith(' got 3-str'):
373
+ raise
374
+ else:
375
+ raise SystemError(f'{f.__name__} should have failed on str value')
376
+
377
+ @pytest.mark.parametrize("dtype", ['c', 'S1'])
378
+ def test_array_inout(self, dtype):
379
+ f = getattr(self.module, self.fprefix + '_array_inout')
380
+ n = np.array(['A', 'B', 'C'], dtype=dtype, order='F')
381
+
382
+ a = np.array(['a', 'b', 'c'], dtype=dtype, order='F')
383
+ f(a, n)
384
+ assert_array_equal(a, n)
385
+
386
+ a = np.array(['a', 'b', 'c', 'd'], dtype=dtype)
387
+ f(a[1:], n)
388
+ assert_array_equal(a, np.array(['a', 'A', 'B', 'C'], dtype=dtype))
389
+
390
+ a = np.array([['a', 'b', 'c']], dtype=dtype, order='F')
391
+ f(a, n)
392
+ assert_array_equal(a, np.array([['A', 'B', 'C']], dtype=dtype))
393
+
394
+ a = np.array(['a', 'b', 'c', 'd'], dtype=dtype, order='F')
395
+ try:
396
+ f(a, n)
397
+ except ValueError as msg:
398
+ if not str(msg).endswith(
399
+ 'th dimension must be fixed to 3 but got 4'):
400
+ raise
401
+ else:
402
+ raise SystemError(
403
+ f'{f.__name__} should have failed on wrong input')
404
+
405
+ @pytest.mark.parametrize("dtype", ['c', 'S1'])
406
+ def test_2d_array_inout(self, dtype):
407
+ f = getattr(self.module, self.fprefix + '_2d_array_inout')
408
+ n = np.array([['A', 'B', 'C'],
409
+ ['D', 'E', 'F']],
410
+ dtype=dtype, order='F')
411
+ a = np.array([['a', 'b', 'c'],
412
+ ['d', 'e', 'f']],
413
+ dtype=dtype, order='F')
414
+ f(a, n)
415
+ assert_array_equal(a, n)
416
+
417
+ def test_return(self):
418
+ f = getattr(self.module, self.fprefix + '_return')
419
+
420
+ assert_equal(f('a'), b'a')
421
+
422
+ @pytest.mark.skip('fortran function returning array segfaults')
423
+ def test_array_return(self):
424
+ f = getattr(self.module, self.fprefix + '_array_return')
425
+
426
+ a = np.array(list('abc'), dtype='S1')
427
+ assert_array_equal(f(a), a)
428
+
429
+ def test_optional(self):
430
+ f = getattr(self.module, self.fprefix + '_optional')
431
+
432
+ assert_equal(f(), b"a")
433
+ assert_equal(f(b'B'), b"B")
434
+
435
+
436
+ @pytest.mark.slow
437
+ class TestMiscCharacter(util.F2PyTest):
438
+ # options = ['--debug-capi', '--build-dir', '/tmp/test-build-f2py']
439
+ suffix = '.f90'
440
+ fprefix = 'test_misc_character'
441
+
442
+ code = textwrap.dedent(f"""
443
+ subroutine {fprefix}_gh18684(x, y, m)
444
+ character(len=5), dimension(m), intent(in) :: x
445
+ character*5, dimension(m), intent(out) :: y
446
+ integer i, m
447
+ !f2py integer, intent(hide), depend(x) :: m = f2py_len(x)
448
+ do i=1,m
449
+ y(i) = x(i)
450
+ end do
451
+ end subroutine {fprefix}_gh18684
452
+
453
+ subroutine {fprefix}_gh6308(x, i)
454
+ integer i
455
+ !f2py check(i>=0 && i<12) i
456
+ character*5 name, x
457
+ common name(12)
458
+ name(i + 1) = x
459
+ end subroutine {fprefix}_gh6308
460
+
461
+ subroutine {fprefix}_gh4519(x)
462
+ character(len=*), intent(in) :: x(:)
463
+ !f2py intent(out) x
464
+ integer :: i
465
+ ! Uncomment for debug printing:
466
+ !do i=1, size(x)
467
+ ! print*, "x(",i,")=", x(i)
468
+ !end do
469
+ end subroutine {fprefix}_gh4519
470
+
471
+ pure function {fprefix}_gh3425(x) result (y)
472
+ character(len=*), intent(in) :: x
473
+ character(len=len(x)) :: y
474
+ integer :: i
475
+ do i = 1, len(x)
476
+ j = iachar(x(i:i))
477
+ if (j>=iachar("a") .and. j<=iachar("z") ) then
478
+ y(i:i) = achar(j-32)
479
+ else
480
+ y(i:i) = x(i:i)
481
+ endif
482
+ end do
483
+ end function {fprefix}_gh3425
484
+
485
+ subroutine {fprefix}_character_bc_new(x, y, z)
486
+ character, intent(in) :: x
487
+ character, intent(out) :: y
488
+ !f2py character, depend(x) :: y = x
489
+ !f2py character, dimension((x=='a'?1:2)), depend(x), intent(out) :: z
490
+ character, dimension(*) :: z
491
+ !f2py character, optional, check(x == 'a' || x == 'b') :: x = 'a'
492
+ !f2py callstatement (*f2py_func)(&x, &y, z)
493
+ !f2py callprotoargument character*, character*, character*
494
+ if (y.eq.x) then
495
+ y = x
496
+ else
497
+ y = 'e'
498
+ endif
499
+ z(1) = 'c'
500
+ end subroutine {fprefix}_character_bc_new
501
+
502
+ subroutine {fprefix}_character_bc_old(x, y, z)
503
+ character, intent(in) :: x
504
+ character, intent(out) :: y
505
+ !f2py character, depend(x) :: y = x[0]
506
+ !f2py character, dimension((*x=='a'?1:2)), depend(x), intent(out) :: z
507
+ character, dimension(*) :: z
508
+ !f2py character, optional, check(*x == 'a' || x[0] == 'b') :: x = 'a'
509
+ !f2py callstatement (*f2py_func)(x, y, z)
510
+ !f2py callprotoargument char*, char*, char*
511
+ if (y.eq.x) then
512
+ y = x
513
+ else
514
+ y = 'e'
515
+ endif
516
+ z(1) = 'c'
517
+ end subroutine {fprefix}_character_bc_old
518
+ """)
519
+
520
+ def test_gh18684(self):
521
+ # Test character(len=5) and character*5 usages
522
+ f = getattr(self.module, self.fprefix + '_gh18684')
523
+ x = np.array(["abcde", "fghij"], dtype='S5')
524
+ y = f(x)
525
+
526
+ assert_array_equal(x, y)
527
+
528
+ def test_gh6308(self):
529
+ # Test character string array in a common block
530
+ f = getattr(self.module, self.fprefix + '_gh6308')
531
+
532
+ assert_equal(self.module._BLNK_.name.dtype, np.dtype('S5'))
533
+ assert_equal(len(self.module._BLNK_.name), 12)
534
+ f("abcde", 0)
535
+ assert_equal(self.module._BLNK_.name[0], b"abcde")
536
+ f("12345", 5)
537
+ assert_equal(self.module._BLNK_.name[5], b"12345")
538
+
539
+ def test_gh4519(self):
540
+ # Test array of assumed length strings
541
+ f = getattr(self.module, self.fprefix + '_gh4519')
542
+
543
+ for x, expected in [
544
+ ('a', {'shape': (), 'dtype': np.dtype('S1')}),
545
+ ('text', {'shape': (), 'dtype': np.dtype('S4')}),
546
+ (np.array(['1', '2', '3'], dtype='S1'),
547
+ {'shape': (3,), 'dtype': np.dtype('S1')}),
548
+ (['1', '2', '34'],
549
+ {'shape': (3,), 'dtype': np.dtype('S2')}),
550
+ (['', ''], {'shape': (2,), 'dtype': np.dtype('S1')})]:
551
+ r = f(x)
552
+ for k, v in expected.items():
553
+ assert_equal(getattr(r, k), v)
554
+
555
+ def test_gh3425(self):
556
+ # Test returning a copy of assumed length string
557
+ f = getattr(self.module, self.fprefix + '_gh3425')
558
+ # f is equivalent to bytes.upper
559
+
560
+ assert_equal(f('abC'), b'ABC')
561
+ assert_equal(f(''), b'')
562
+ assert_equal(f('abC12d'), b'ABC12D')
563
+
564
+ @pytest.mark.parametrize("state", ['new', 'old'])
565
+ def test_character_bc(self, state):
566
+ f = getattr(self.module, self.fprefix + '_character_bc_' + state)
567
+
568
+ c, a = f()
569
+ assert_equal(c, b'a')
570
+ assert_equal(len(a), 1)
571
+
572
+ c, a = f(b'b')
573
+ assert_equal(c, b'b')
574
+ assert_equal(len(a), 2)
575
+
576
+ assert_raises(Exception, lambda: f(b'c'))
577
+
578
+
579
+ @pytest.mark.slow
580
+ class TestStringScalarArr(util.F2PyTest):
581
+ sources = [util.getpath("tests", "src", "string", "scalar_string.f90")]
582
+
583
+ def test_char(self):
584
+ for out in (self.module.string_test.string,
585
+ self.module.string_test.string77):
586
+ expected = ()
587
+ assert out.shape == expected
588
+ expected = '|S8'
589
+ assert out.dtype == expected
590
+
591
+ def test_char_arr(self):
592
+ for out in (self.module.string_test.strarr,
593
+ self.module.string_test.strarr77):
594
+ expected = (5, 7)
595
+ assert out.shape == expected
596
+ expected = '|S12'
597
+ assert out.dtype == expected
598
+
599
+ @pytest.mark.slow
600
+ class TestStringAssumedLength(util.F2PyTest):
601
+ sources = [util.getpath("tests", "src", "string", "gh24008.f")]
602
+
603
+ def test_gh24008(self):
604
+ self.module.greet("joe", "bob")
605
+
606
+ @pytest.mark.slow
607
+ class TestStringOptionalInOut(util.F2PyTest):
608
+ sources = [util.getpath("tests", "src", "string", "gh24662.f90")]
609
+
610
+ def test_gh24662(self):
611
+ self.module.string_inout_optional()
612
+ a = np.array('hi', dtype='S32')
613
+ self.module.string_inout_optional(a)
614
+ assert "output string" in a.tobytes().decode()
615
+ with pytest.raises(Exception): # noqa: B017
616
+ aa = "Hi"
617
+ self.module.string_inout_optional(aa)
618
+
619
+
620
+ @pytest.mark.slow
621
+ class TestNewCharHandling(util.F2PyTest):
622
+ # from v1.24 onwards, gh-19388
623
+ sources = [
624
+ util.getpath("tests", "src", "string", "gh25286.pyf"),
625
+ util.getpath("tests", "src", "string", "gh25286.f90")
626
+ ]
627
+ module_name = "_char_handling_test"
628
+
629
+ def test_gh25286(self):
630
+ info = self.module.charint('T')
631
+ assert info == 2
632
+
633
+ @pytest.mark.slow
634
+ class TestBCCharHandling(util.F2PyTest):
635
+ # SciPy style, "incorrect" bindings with a hook
636
+ sources = [
637
+ util.getpath("tests", "src", "string", "gh25286_bc.pyf"),
638
+ util.getpath("tests", "src", "string", "gh25286.f90")
639
+ ]
640
+ module_name = "_char_handling_test"
641
+
642
+ def test_gh25286(self):
643
+ info = self.module.charint('T')
644
+ assert info == 2
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_common.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ import numpy as np
4
+
5
+ from . import util
6
+
7
+
8
+ @pytest.mark.slow
9
+ class TestCommonBlock(util.F2PyTest):
10
+ sources = [util.getpath("tests", "src", "common", "block.f")]
11
+
12
+ def test_common_block(self):
13
+ self.module.initcb()
14
+ assert self.module.block.long_bn == np.array(1.0, dtype=np.float64)
15
+ assert self.module.block.string_bn == np.array("2", dtype="|S1")
16
+ assert self.module.block.ok == np.array(3, dtype=np.int32)
17
+
18
+
19
+ @pytest.mark.slow
20
+ class TestCommonWithUse(util.F2PyTest):
21
+ sources = [util.getpath("tests", "src", "common", "gh19161.f90")]
22
+
23
+ def test_common_gh19161(self):
24
+ assert self.module.data.x == 0
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import contextlib
2
+ import importlib
3
+ import io
4
+ import textwrap
5
+ import time
6
+
7
+ import pytest
8
+
9
+ import numpy as np
10
+ from numpy.f2py import crackfortran
11
+ from numpy.f2py.crackfortran import markinnerspaces, nameargspattern
12
+
13
+ from . import util
14
+
15
+
16
+ @pytest.mark.slow
17
+ class TestNoSpace(util.F2PyTest):
18
+ # issue gh-15035: add handling for endsubroutine, endfunction with no space
19
+ # between "end" and the block name
20
+ sources = [util.getpath("tests", "src", "crackfortran", "gh15035.f")]
21
+
22
+ def test_module(self):
23
+ k = np.array([1, 2, 3], dtype=np.float64)
24
+ w = np.array([1, 2, 3], dtype=np.float64)
25
+ self.module.subb(k)
26
+ assert np.allclose(k, w + 1)
27
+ self.module.subc([w, k])
28
+ assert np.allclose(k, w + 1)
29
+ assert self.module.t0("23") == b"2"
30
+
31
+
32
+ class TestPublicPrivate:
33
+ def test_defaultPrivate(self):
34
+ fpath = util.getpath("tests", "src", "crackfortran", "privatemod.f90")
35
+ mod = crackfortran.crackfortran([str(fpath)])
36
+ assert len(mod) == 1
37
+ mod = mod[0]
38
+ assert "private" in mod["vars"]["a"]["attrspec"]
39
+ assert "public" not in mod["vars"]["a"]["attrspec"]
40
+ assert "private" in mod["vars"]["b"]["attrspec"]
41
+ assert "public" not in mod["vars"]["b"]["attrspec"]
42
+ assert "private" not in mod["vars"]["seta"]["attrspec"]
43
+ assert "public" in mod["vars"]["seta"]["attrspec"]
44
+
45
+ def test_defaultPublic(self, tmp_path):
46
+ fpath = util.getpath("tests", "src", "crackfortran", "publicmod.f90")
47
+ mod = crackfortran.crackfortran([str(fpath)])
48
+ assert len(mod) == 1
49
+ mod = mod[0]
50
+ assert "private" in mod["vars"]["a"]["attrspec"]
51
+ assert "public" not in mod["vars"]["a"]["attrspec"]
52
+ assert "private" not in mod["vars"]["seta"]["attrspec"]
53
+ assert "public" in mod["vars"]["seta"]["attrspec"]
54
+
55
+ def test_access_type(self, tmp_path):
56
+ fpath = util.getpath("tests", "src", "crackfortran", "accesstype.f90")
57
+ mod = crackfortran.crackfortran([str(fpath)])
58
+ assert len(mod) == 1
59
+ tt = mod[0]['vars']
60
+ assert set(tt['a']['attrspec']) == {'private', 'bind(c)'}
61
+ assert set(tt['b_']['attrspec']) == {'public', 'bind(c)'}
62
+ assert set(tt['c']['attrspec']) == {'public'}
63
+
64
+ def test_nowrap_private_procedures(self, tmp_path):
65
+ fpath = util.getpath("tests", "src", "crackfortran", "gh23879.f90")
66
+ mod = crackfortran.crackfortran([str(fpath)])
67
+ assert len(mod) == 1
68
+ pyf = crackfortran.crack2fortran(mod)
69
+ assert 'bar1337baz' not in pyf
70
+
71
+ class TestModuleProcedure:
72
+ def test_moduleOperators(self, tmp_path):
73
+ fpath = util.getpath("tests", "src", "crackfortran", "operators.f90")
74
+ mod = crackfortran.crackfortran([str(fpath)])
75
+ assert len(mod) == 1
76
+ mod = mod[0]
77
+ assert "body" in mod and len(mod["body"]) == 9
78
+ assert mod["body"][1]["name"] == "operator(.item.)"
79
+ assert "implementedby" in mod["body"][1]
80
+ assert mod["body"][1]["implementedby"] == \
81
+ ["item_int", "item_real"]
82
+ assert mod["body"][2]["name"] == "operator(==)"
83
+ assert "implementedby" in mod["body"][2]
84
+ assert mod["body"][2]["implementedby"] == ["items_are_equal"]
85
+ assert mod["body"][3]["name"] == "assignment(=)"
86
+ assert "implementedby" in mod["body"][3]
87
+ assert mod["body"][3]["implementedby"] == \
88
+ ["get_int", "get_real"]
89
+
90
+ def test_notPublicPrivate(self, tmp_path):
91
+ fpath = util.getpath("tests", "src", "crackfortran", "pubprivmod.f90")
92
+ mod = crackfortran.crackfortran([str(fpath)])
93
+ assert len(mod) == 1
94
+ mod = mod[0]
95
+ assert mod['vars']['a']['attrspec'] == ['private', ]
96
+ assert mod['vars']['b']['attrspec'] == ['public', ]
97
+ assert mod['vars']['seta']['attrspec'] == ['public', ]
98
+
99
+
100
+ @pytest.mark.slow
101
+ class TestExternal(util.F2PyTest):
102
+ # issue gh-17859: add external attribute support
103
+ sources = [util.getpath("tests", "src", "crackfortran", "gh17859.f")]
104
+
105
+ def test_external_as_statement(self):
106
+ def incr(x):
107
+ return x + 123
108
+
109
+ r = self.module.external_as_statement(incr)
110
+ assert r == 123
111
+
112
+ def test_external_as_attribute(self):
113
+ def incr(x):
114
+ return x + 123
115
+
116
+ r = self.module.external_as_attribute(incr)
117
+ assert r == 123
118
+
119
+
120
+ @pytest.mark.slow
121
+ class TestCrackFortran(util.F2PyTest):
122
+ # gh-2848: commented lines between parameters in subroutine parameter lists
123
+ sources = [util.getpath("tests", "src", "crackfortran", "gh2848.f90"),
124
+ util.getpath("tests", "src", "crackfortran", "common_with_division.f")
125
+ ]
126
+
127
+ def test_gh2848(self):
128
+ r = self.module.gh2848(1, 2)
129
+ assert r == (1, 2)
130
+
131
+ def test_common_with_division(self):
132
+ assert len(self.module.mortmp.ctmp) == 11
133
+
134
+ class TestMarkinnerspaces:
135
+ # gh-14118: markinnerspaces does not handle multiple quotations
136
+
137
+ def test_do_not_touch_normal_spaces(self):
138
+ test_list = ["a ", " a", "a b c", "'abcdefghij'"]
139
+ for i in test_list:
140
+ assert markinnerspaces(i) == i
141
+
142
+ def test_one_relevant_space(self):
143
+ assert markinnerspaces("a 'b c' \\' \\'") == "a 'b@_@c' \\' \\'"
144
+ assert markinnerspaces(r'a "b c" \" \"') == r'a "b@_@c" \" \"'
145
+
146
+ def test_ignore_inner_quotes(self):
147
+ assert markinnerspaces("a 'b c\" \" d' e") == "a 'b@_@c\"@_@\"@_@d' e"
148
+ assert markinnerspaces("a \"b c' ' d\" e") == "a \"b@_@c'@_@'@_@d\" e"
149
+
150
+ def test_multiple_relevant_spaces(self):
151
+ assert markinnerspaces("a 'b c' 'd e'") == "a 'b@_@c' 'd@_@e'"
152
+ assert markinnerspaces(r'a "b c" "d e"') == r'a "b@_@c" "d@_@e"'
153
+
154
+
155
+ @pytest.mark.slow
156
+ class TestDimSpec(util.F2PyTest):
157
+ """This test suite tests various expressions that are used as dimension
158
+ specifications.
159
+
160
+ There exists two usage cases where analyzing dimensions
161
+ specifications are important.
162
+
163
+ In the first case, the size of output arrays must be defined based
164
+ on the inputs to a Fortran function. Because Fortran supports
165
+ arbitrary bases for indexing, for instance, `arr(lower:upper)`,
166
+ f2py has to evaluate an expression `upper - lower + 1` where
167
+ `lower` and `upper` are arbitrary expressions of input parameters.
168
+ The evaluation is performed in C, so f2py has to translate Fortran
169
+ expressions to valid C expressions (an alternative approach is
170
+ that a developer specifies the corresponding C expressions in a
171
+ .pyf file).
172
+
173
+ In the second case, when user provides an input array with a given
174
+ size but some hidden parameters used in dimensions specifications
175
+ need to be determined based on the input array size. This is a
176
+ harder problem because f2py has to solve the inverse problem: find
177
+ a parameter `p` such that `upper(p) - lower(p) + 1` equals to the
178
+ size of input array. In the case when this equation cannot be
179
+ solved (e.g. because the input array size is wrong), raise an
180
+ error before calling the Fortran function (that otherwise would
181
+ likely crash Python process when the size of input arrays is
182
+ wrong). f2py currently supports this case only when the equation
183
+ is linear with respect to unknown parameter.
184
+
185
+ """
186
+
187
+ suffix = ".f90"
188
+
189
+ code_template = textwrap.dedent("""
190
+ function get_arr_size_{count}(a, n) result (length)
191
+ integer, intent(in) :: n
192
+ integer, dimension({dimspec}), intent(out) :: a
193
+ integer length
194
+ length = size(a)
195
+ end function
196
+
197
+ subroutine get_inv_arr_size_{count}(a, n)
198
+ integer :: n
199
+ ! the value of n is computed in f2py wrapper
200
+ !f2py intent(out) n
201
+ integer, dimension({dimspec}), intent(in) :: a
202
+ if (a({first}).gt.0) then
203
+ ! print*, "a=", a
204
+ endif
205
+ end subroutine
206
+ """)
207
+
208
+ linear_dimspecs = [
209
+ "n", "2*n", "2:n", "n/2", "5 - n/2", "3*n:20", "n*(n+1):n*(n+5)",
210
+ "2*n, n"
211
+ ]
212
+ nonlinear_dimspecs = ["2*n:3*n*n+2*n"]
213
+ all_dimspecs = linear_dimspecs + nonlinear_dimspecs
214
+
215
+ code = ""
216
+ for count, dimspec in enumerate(all_dimspecs):
217
+ lst = [(d.split(":")[0] if ":" in d else "1") for d in dimspec.split(',')]
218
+ code += code_template.format(
219
+ count=count,
220
+ dimspec=dimspec,
221
+ first=", ".join(lst),
222
+ )
223
+
224
+ @pytest.mark.parametrize("dimspec", all_dimspecs)
225
+ def test_array_size(self, dimspec):
226
+
227
+ count = self.all_dimspecs.index(dimspec)
228
+ get_arr_size = getattr(self.module, f"get_arr_size_{count}")
229
+
230
+ for n in [1, 2, 3, 4, 5]:
231
+ sz, a = get_arr_size(n)
232
+ assert a.size == sz
233
+
234
+ @pytest.mark.parametrize("dimspec", all_dimspecs)
235
+ def test_inv_array_size(self, dimspec):
236
+
237
+ count = self.all_dimspecs.index(dimspec)
238
+ get_arr_size = getattr(self.module, f"get_arr_size_{count}")
239
+ get_inv_arr_size = getattr(self.module, f"get_inv_arr_size_{count}")
240
+
241
+ for n in [1, 2, 3, 4, 5]:
242
+ sz, a = get_arr_size(n)
243
+ if dimspec in self.nonlinear_dimspecs:
244
+ # one must specify n as input, the call we'll ensure
245
+ # that a and n are compatible:
246
+ n1 = get_inv_arr_size(a, n)
247
+ else:
248
+ # in case of linear dependence, n can be determined
249
+ # from the shape of a:
250
+ n1 = get_inv_arr_size(a)
251
+ # n1 may be different from n (for instance, when `a` size
252
+ # is a function of some `n` fraction) but it must produce
253
+ # the same sized array
254
+ sz1, _ = get_arr_size(n1)
255
+ assert sz == sz1, (n, n1, sz, sz1)
256
+
257
+
258
+ class TestModuleDeclaration:
259
+ def test_dependencies(self, tmp_path):
260
+ fpath = util.getpath("tests", "src", "crackfortran", "foo_deps.f90")
261
+ mod = crackfortran.crackfortran([str(fpath)])
262
+ assert len(mod) == 1
263
+ assert mod[0]["vars"]["abar"]["="] == "bar('abar')"
264
+
265
+
266
+ @pytest.mark.slow
267
+ class TestEval(util.F2PyTest):
268
+ def test_eval_scalar(self):
269
+ eval_scalar = crackfortran._eval_scalar
270
+
271
+ assert eval_scalar('123', {}) == '123'
272
+ assert eval_scalar('12 + 3', {}) == '15'
273
+ assert eval_scalar('a + b', {"a": 1, "b": 2}) == '3'
274
+ assert eval_scalar('"123"', {}) == "'123'"
275
+
276
+
277
+ @pytest.mark.slow
278
+ class TestFortranReader(util.F2PyTest):
279
+ @pytest.mark.parametrize("encoding",
280
+ ['ascii', 'utf-8', 'utf-16', 'utf-32'])
281
+ def test_input_encoding(self, tmp_path, encoding):
282
+ # gh-635
283
+ f_path = tmp_path / f"input_with_{encoding}_encoding.f90"
284
+ with f_path.open('w', encoding=encoding) as ff:
285
+ ff.write("""
286
+ subroutine foo()
287
+ end subroutine foo
288
+ """)
289
+ mod = crackfortran.crackfortran([str(f_path)])
290
+ assert mod[0]['name'] == 'foo'
291
+
292
+
293
+ @pytest.mark.slow
294
+ class TestUnicodeComment(util.F2PyTest):
295
+ sources = [util.getpath("tests", "src", "crackfortran", "unicode_comment.f90")]
296
+
297
+ @pytest.mark.skipif(
298
+ (importlib.util.find_spec("charset_normalizer") is None),
299
+ reason="test requires charset_normalizer which is not installed",
300
+ )
301
+ def test_encoding_comment(self):
302
+ self.module.foo(3)
303
+
304
+
305
+ class TestNameArgsPatternBacktracking:
306
+ @pytest.mark.parametrize(
307
+ ['adversary'],
308
+ [
309
+ ('@)@bind@(@',),
310
+ ('@)@bind @(@',),
311
+ ('@)@bind foo bar baz@(@',)
312
+ ]
313
+ )
314
+ def test_nameargspattern_backtracking(self, adversary):
315
+ '''address ReDOS vulnerability:
316
+ https://github.com/numpy/numpy/issues/23338'''
317
+ trials_per_batch = 12
318
+ batches_per_regex = 4
319
+ start_reps, end_reps = 15, 25
320
+ for ii in range(start_reps, end_reps):
321
+ repeated_adversary = adversary * ii
322
+ # test times in small batches.
323
+ # this gives us more chances to catch a bad regex
324
+ # while still catching it before too long if it is bad
325
+ for _ in range(batches_per_regex):
326
+ times = []
327
+ for _ in range(trials_per_batch):
328
+ t0 = time.perf_counter()
329
+ mtch = nameargspattern.search(repeated_adversary)
330
+ times.append(time.perf_counter() - t0)
331
+ # our pattern should be much faster than 0.2s per search
332
+ # it's unlikely that a bad regex will pass even on fast CPUs
333
+ assert np.median(times) < 0.2
334
+ assert not mtch
335
+ # if the adversary is capped with @)@, it becomes acceptable
336
+ # according to the old version of the regex.
337
+ # that should still be true.
338
+ good_version_of_adversary = repeated_adversary + '@)@'
339
+ assert nameargspattern.search(good_version_of_adversary)
340
+
341
+ @pytest.mark.slow
342
+ class TestFunctionReturn(util.F2PyTest):
343
+ sources = [util.getpath("tests", "src", "crackfortran", "gh23598.f90")]
344
+
345
+ def test_function_rettype(self):
346
+ # gh-23598
347
+ assert self.module.intproduct(3, 4) == 12
348
+
349
+
350
+ @pytest.mark.slow
351
+ class TestFortranGroupCounters(util.F2PyTest):
352
+ def test_end_if_comment(self):
353
+ # gh-23533
354
+ fpath = util.getpath("tests", "src", "crackfortran", "gh23533.f")
355
+ try:
356
+ crackfortran.crackfortran([str(fpath)])
357
+ except Exception as exc:
358
+ assert False, f"'crackfortran.crackfortran' raised an exception {exc}"
359
+
360
+
361
+ class TestF77CommonBlockReader:
362
+ def test_gh22648(self, tmp_path):
363
+ fpath = util.getpath("tests", "src", "crackfortran", "gh22648.pyf")
364
+ with contextlib.redirect_stdout(io.StringIO()) as stdout_f2py:
365
+ mod = crackfortran.crackfortran([str(fpath)])
366
+ assert "Mismatch" not in stdout_f2py.getvalue()
367
+
368
+ class TestParamEval:
369
+ # issue gh-11612, array parameter parsing
370
+ def test_param_eval_nested(self):
371
+ v = '(/3.14, 4./)'
372
+ g_params = {"kind": crackfortran._kind_func,
373
+ "selected_int_kind": crackfortran._selected_int_kind_func,
374
+ "selected_real_kind": crackfortran._selected_real_kind_func}
375
+ params = {'dp': 8, 'intparamarray': {1: 3, 2: 5},
376
+ 'nested': {1: 1, 2: 2, 3: 3}}
377
+ dimspec = '(2)'
378
+ ret = crackfortran.param_eval(v, g_params, params, dimspec=dimspec)
379
+ assert ret == {1: 3.14, 2: 4.0}
380
+
381
+ def test_param_eval_nonstandard_range(self):
382
+ v = '(/ 6, 3, 1 /)'
383
+ g_params = {"kind": crackfortran._kind_func,
384
+ "selected_int_kind": crackfortran._selected_int_kind_func,
385
+ "selected_real_kind": crackfortran._selected_real_kind_func}
386
+ params = {}
387
+ dimspec = '(-1:1)'
388
+ ret = crackfortran.param_eval(v, g_params, params, dimspec=dimspec)
389
+ assert ret == {-1: 6, 0: 3, 1: 1}
390
+
391
+ def test_param_eval_empty_range(self):
392
+ v = '6'
393
+ g_params = {"kind": crackfortran._kind_func,
394
+ "selected_int_kind": crackfortran._selected_int_kind_func,
395
+ "selected_real_kind": crackfortran._selected_real_kind_func}
396
+ params = {}
397
+ dimspec = ''
398
+ pytest.raises(ValueError, crackfortran.param_eval, v, g_params, params,
399
+ dimspec=dimspec)
400
+
401
+ def test_param_eval_non_array_param(self):
402
+ v = '3.14_dp'
403
+ g_params = {"kind": crackfortran._kind_func,
404
+ "selected_int_kind": crackfortran._selected_int_kind_func,
405
+ "selected_real_kind": crackfortran._selected_real_kind_func}
406
+ params = {}
407
+ ret = crackfortran.param_eval(v, g_params, params, dimspec=None)
408
+ assert ret == '3.14_dp'
409
+
410
+ def test_param_eval_too_many_dims(self):
411
+ v = 'reshape((/ (i, i=1, 250) /), (/5, 10, 5/))'
412
+ g_params = {"kind": crackfortran._kind_func,
413
+ "selected_int_kind": crackfortran._selected_int_kind_func,
414
+ "selected_real_kind": crackfortran._selected_real_kind_func}
415
+ params = {}
416
+ dimspec = '(0:4, 3:12, 5)'
417
+ pytest.raises(ValueError, crackfortran.param_eval, v, g_params, params,
418
+ dimspec=dimspec)
419
+
420
+ @pytest.mark.slow
421
+ class TestLowerF2PYDirective(util.F2PyTest):
422
+ sources = [util.getpath("tests", "src", "crackfortran", "gh27697.f90")]
423
+ options = ['--lower']
424
+
425
+ def test_no_lower_fail(self):
426
+ with pytest.raises(ValueError, match='aborting directly') as exc:
427
+ self.module.utils.my_abort('aborting directly')
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ import numpy as np
4
+ from numpy.f2py.crackfortran import crackfortran
5
+
6
+ from . import util
7
+
8
+
9
+ @pytest.mark.slow
10
+ class TestData(util.F2PyTest):
11
+ sources = [util.getpath("tests", "src", "crackfortran", "data_stmts.f90")]
12
+
13
+ # For gh-23276
14
+ def test_data_stmts(self):
15
+ assert self.module.cmplxdat.i == 2
16
+ assert self.module.cmplxdat.j == 3
17
+ assert self.module.cmplxdat.x == 1.5
18
+ assert self.module.cmplxdat.y == 2.0
19
+ assert self.module.cmplxdat.pi == 3.1415926535897932384626433832795028841971693993751058209749445923078164062
20
+ assert self.module.cmplxdat.medium_ref_index == np.array(1. + 0.j)
21
+ assert np.all(self.module.cmplxdat.z == np.array([3.5, 7.0]))
22
+ assert np.all(self.module.cmplxdat.my_array == np.array([ 1. + 2.j, -3. + 4.j]))
23
+ assert np.all(self.module.cmplxdat.my_real_array == np.array([ 1., 2., 3.]))
24
+ assert np.all(self.module.cmplxdat.ref_index_one == np.array([13.0 + 21.0j]))
25
+ assert np.all(self.module.cmplxdat.ref_index_two == np.array([-30.0 + 43.0j]))
26
+
27
+ def test_crackedlines(self):
28
+ mod = crackfortran(self.sources)
29
+ assert mod[0]['vars']['x']['='] == '1.5'
30
+ assert mod[0]['vars']['y']['='] == '2.0'
31
+ assert mod[0]['vars']['pi']['='] == '3.1415926535897932384626433832795028841971693993751058209749445923078164062d0'
32
+ assert mod[0]['vars']['my_real_array']['='] == '(/1.0d0, 2.0d0, 3.0d0/)'
33
+ assert mod[0]['vars']['ref_index_one']['='] == '(13.0d0, 21.0d0)'
34
+ assert mod[0]['vars']['ref_index_two']['='] == '(-30.0d0, 43.0d0)'
35
+ assert mod[0]['vars']['my_array']['='] == '(/(1.0d0, 2.0d0), (-3.0d0, 4.0d0)/)'
36
+ assert mod[0]['vars']['z']['='] == '(/3.5, 7.0/)'
37
+
38
+ @pytest.mark.slow
39
+ class TestDataF77(util.F2PyTest):
40
+ sources = [util.getpath("tests", "src", "crackfortran", "data_common.f")]
41
+
42
+ # For gh-23276
43
+ def test_data_stmts(self):
44
+ assert self.module.mycom.mydata == 0
45
+
46
+ def test_crackedlines(self):
47
+ mod = crackfortran(str(self.sources[0]))
48
+ print(mod[0]['vars'])
49
+ assert mod[0]['vars']['mydata']['='] == '0'
50
+
51
+
52
+ @pytest.mark.slow
53
+ class TestDataMultiplierF77(util.F2PyTest):
54
+ sources = [util.getpath("tests", "src", "crackfortran", "data_multiplier.f")]
55
+
56
+ # For gh-23276
57
+ def test_data_stmts(self):
58
+ assert self.module.mycom.ivar1 == 3
59
+ assert self.module.mycom.ivar2 == 3
60
+ assert self.module.mycom.ivar3 == 2
61
+ assert self.module.mycom.ivar4 == 2
62
+ assert self.module.mycom.evar5 == 0
63
+
64
+
65
+ @pytest.mark.slow
66
+ class TestDataWithCommentsF77(util.F2PyTest):
67
+ sources = [util.getpath("tests", "src", "crackfortran", "data_with_comments.f")]
68
+
69
+ # For gh-23276
70
+ def test_data_stmts(self):
71
+ assert len(self.module.mycom.mytab) == 3
72
+ assert self.module.mycom.mytab[0] == 0
73
+ assert self.module.mycom.mytab[1] == 4
74
+ assert self.module.mycom.mytab[2] == 0
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_docs.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+ from numpy.testing import assert_array_equal, assert_equal
7
+
8
+ from . import util
9
+
10
+
11
+ def get_docdir():
12
+ parents = Path(__file__).resolve().parents
13
+ try:
14
+ # Assumes that spin is used to run tests
15
+ nproot = parents[8]
16
+ except IndexError:
17
+ docdir = None
18
+ else:
19
+ docdir = nproot / "doc" / "source" / "f2py" / "code"
20
+ if docdir and docdir.is_dir():
21
+ return docdir
22
+ # Assumes that an editable install is used to run tests
23
+ return parents[3] / "doc" / "source" / "f2py" / "code"
24
+
25
+
26
+ pytestmark = pytest.mark.skipif(
27
+ not get_docdir().is_dir(),
28
+ reason=f"Could not find f2py documentation sources"
29
+ f"({get_docdir()} does not exist)",
30
+ )
31
+
32
+ def _path(*args):
33
+ return get_docdir().joinpath(*args)
34
+
35
+ @pytest.mark.slow
36
+ class TestDocAdvanced(util.F2PyTest):
37
+ # options = ['--debug-capi', '--build-dir', '/tmp/build-f2py']
38
+ sources = [_path('asterisk1.f90'), _path('asterisk2.f90'),
39
+ _path('ftype.f')]
40
+
41
+ def test_asterisk1(self):
42
+ foo = self.module.foo1
43
+ assert_equal(foo(), b'123456789A12')
44
+
45
+ def test_asterisk2(self):
46
+ foo = self.module.foo2
47
+ assert_equal(foo(2), b'12')
48
+ assert_equal(foo(12), b'123456789A12')
49
+ assert_equal(foo(20), b'123456789A123456789B')
50
+
51
+ def test_ftype(self):
52
+ ftype = self.module
53
+ ftype.foo()
54
+ assert_equal(ftype.data.a, 0)
55
+ ftype.data.a = 3
56
+ ftype.data.x = [1, 2, 3]
57
+ assert_equal(ftype.data.a, 3)
58
+ assert_array_equal(ftype.data.x,
59
+ np.array([1, 2, 3], dtype=np.float32))
60
+ ftype.data.x[1] = 45
61
+ assert_array_equal(ftype.data.x,
62
+ np.array([1, 45, 3], dtype=np.float32))
63
+ # gh-26718 Cleanup for repeated test runs
64
+ ftype.data.a = 0
65
+
66
+ # TODO: implement test methods for other example Fortran codes
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_f2cmap.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ import numpy as np
4
+
5
+ from . import util
6
+
7
+
8
+ @pytest.mark.slow
9
+ class TestF2Cmap(util.F2PyTest):
10
+ sources = [
11
+ util.getpath("tests", "src", "f2cmap", "isoFortranEnvMap.f90"),
12
+ util.getpath("tests", "src", "f2cmap", ".f2py_f2cmap")
13
+ ]
14
+
15
+ # gh-15095
16
+ def test_gh15095(self):
17
+ inp = np.ones(3)
18
+ out = self.module.func1(inp)
19
+ exp_out = 3
20
+ assert out == exp_out
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.py ADDED
@@ -0,0 +1,1006 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import platform
3
+ import re
4
+ import shlex
5
+ import subprocess
6
+ import sys
7
+ import textwrap
8
+ from collections import namedtuple
9
+ from pathlib import Path
10
+
11
+ import pytest
12
+
13
+ from numpy.f2py.f2py2e import main as f2pycli
14
+ from numpy.testing._private.utils import NOGIL_BUILD
15
+
16
+ from . import util
17
+
18
+ #######################
19
+ # F2PY Test utilities #
20
+ ######################
21
+
22
+ # Tests for CLI commands which call meson will fail if no compilers are present, these are to be skipped
23
+
24
+ def compiler_check_f2pycli():
25
+ if not util.has_fortran_compiler():
26
+ pytest.skip("CLI command needs a Fortran compiler")
27
+ else:
28
+ f2pycli()
29
+
30
+ #########################
31
+ # CLI utils and classes #
32
+ #########################
33
+
34
+
35
+ PPaths = namedtuple("PPaths", "finp, f90inp, pyf, wrap77, wrap90, cmodf")
36
+
37
+
38
+ def get_io_paths(fname_inp, mname="untitled"):
39
+ """Takes in a temporary file for testing and returns the expected output and input paths
40
+
41
+ Here expected output is essentially one of any of the possible generated
42
+ files.
43
+
44
+ ..note::
45
+
46
+ Since this does not actually run f2py, none of these are guaranteed to
47
+ exist, and module names are typically incorrect
48
+
49
+ Parameters
50
+ ----------
51
+ fname_inp : str
52
+ The input filename
53
+ mname : str, optional
54
+ The name of the module, untitled by default
55
+
56
+ Returns
57
+ -------
58
+ genp : NamedTuple PPaths
59
+ The possible paths which are generated, not all of which exist
60
+ """
61
+ bpath = Path(fname_inp)
62
+ return PPaths(
63
+ finp=bpath.with_suffix(".f"),
64
+ f90inp=bpath.with_suffix(".f90"),
65
+ pyf=bpath.with_suffix(".pyf"),
66
+ wrap77=bpath.with_name(f"{mname}-f2pywrappers.f"),
67
+ wrap90=bpath.with_name(f"{mname}-f2pywrappers2.f90"),
68
+ cmodf=bpath.with_name(f"{mname}module.c"),
69
+ )
70
+
71
+
72
+ ################
73
+ # CLI Fixtures #
74
+ ################
75
+
76
+
77
+ @pytest.fixture(scope="session")
78
+ def hello_world_f90(tmpdir_factory):
79
+ """Generates a single f90 file for testing"""
80
+ fdat = util.getpath("tests", "src", "cli", "hiworld.f90").read_text()
81
+ fn = tmpdir_factory.getbasetemp() / "hello.f90"
82
+ fn.write_text(fdat, encoding="ascii")
83
+ return fn
84
+
85
+
86
+ @pytest.fixture(scope="session")
87
+ def gh23598_warn(tmpdir_factory):
88
+ """F90 file for testing warnings in gh23598"""
89
+ fdat = util.getpath("tests", "src", "crackfortran", "gh23598Warn.f90").read_text()
90
+ fn = tmpdir_factory.getbasetemp() / "gh23598Warn.f90"
91
+ fn.write_text(fdat, encoding="ascii")
92
+ return fn
93
+
94
+
95
+ @pytest.fixture(scope="session")
96
+ def gh22819_cli(tmpdir_factory):
97
+ """F90 file for testing disallowed CLI arguments in ghff819"""
98
+ fdat = util.getpath("tests", "src", "cli", "gh_22819.pyf").read_text()
99
+ fn = tmpdir_factory.getbasetemp() / "gh_22819.pyf"
100
+ fn.write_text(fdat, encoding="ascii")
101
+ return fn
102
+
103
+
104
+ @pytest.fixture(scope="session")
105
+ def hello_world_f77(tmpdir_factory):
106
+ """Generates a single f77 file for testing"""
107
+ fdat = util.getpath("tests", "src", "cli", "hi77.f").read_text()
108
+ fn = tmpdir_factory.getbasetemp() / "hello.f"
109
+ fn.write_text(fdat, encoding="ascii")
110
+ return fn
111
+
112
+
113
+ @pytest.fixture(scope="session")
114
+ def retreal_f77(tmpdir_factory):
115
+ """Generates a single f77 file for testing"""
116
+ fdat = util.getpath("tests", "src", "return_real", "foo77.f").read_text()
117
+ fn = tmpdir_factory.getbasetemp() / "foo.f"
118
+ fn.write_text(fdat, encoding="ascii")
119
+ return fn
120
+
121
+ @pytest.fixture(scope="session")
122
+ def f2cmap_f90(tmpdir_factory):
123
+ """Generates a single f90 file for testing"""
124
+ fdat = util.getpath("tests", "src", "f2cmap", "isoFortranEnvMap.f90").read_text()
125
+ f2cmap = util.getpath("tests", "src", "f2cmap", ".f2py_f2cmap").read_text()
126
+ fn = tmpdir_factory.getbasetemp() / "f2cmap.f90"
127
+ fmap = tmpdir_factory.getbasetemp() / "mapfile"
128
+ fn.write_text(fdat, encoding="ascii")
129
+ fmap.write_text(f2cmap, encoding="ascii")
130
+ return fn
131
+
132
+ #########
133
+ # Tests #
134
+ #########
135
+
136
+ def test_gh22819_cli(capfd, gh22819_cli, monkeypatch):
137
+ """Check that module names are handled correctly
138
+ gh-22819
139
+ Essentially, the -m name cannot be used to import the module, so the module
140
+ named in the .pyf needs to be used instead
141
+
142
+ CLI :: -m and a .pyf file
143
+ """
144
+ ipath = Path(gh22819_cli)
145
+ monkeypatch.setattr(sys, "argv", f"f2py -m blah {ipath}".split())
146
+ with util.switchdir(ipath.parent):
147
+ f2pycli()
148
+ gen_paths = [item.name for item in ipath.parent.rglob("*") if item.is_file()]
149
+ assert "blahmodule.c" not in gen_paths # shouldn't be generated
150
+ assert "blah-f2pywrappers.f" not in gen_paths
151
+ assert "test_22819-f2pywrappers.f" in gen_paths
152
+ assert "test_22819module.c" in gen_paths
153
+
154
+
155
+ def test_gh22819_many_pyf(capfd, gh22819_cli, monkeypatch):
156
+ """Only one .pyf file allowed
157
+ gh-22819
158
+ CLI :: .pyf files
159
+ """
160
+ ipath = Path(gh22819_cli)
161
+ monkeypatch.setattr(sys, "argv", f"f2py -m blah {ipath} hello.pyf".split())
162
+ with util.switchdir(ipath.parent):
163
+ with pytest.raises(ValueError, match="Only one .pyf file per call"):
164
+ f2pycli()
165
+
166
+
167
+ def test_gh23598_warn(capfd, gh23598_warn, monkeypatch):
168
+ foutl = get_io_paths(gh23598_warn, mname="test")
169
+ ipath = foutl.f90inp
170
+ monkeypatch.setattr(
171
+ sys, "argv",
172
+ f'f2py {ipath} -m test'.split())
173
+
174
+ with util.switchdir(ipath.parent):
175
+ f2pycli() # Generate files
176
+ wrapper = foutl.wrap90.read_text()
177
+ assert "intproductf2pywrap, intpr" not in wrapper
178
+
179
+
180
+ def test_gen_pyf(capfd, hello_world_f90, monkeypatch):
181
+ """Ensures that a signature file is generated via the CLI
182
+ CLI :: -h
183
+ """
184
+ ipath = Path(hello_world_f90)
185
+ opath = Path(hello_world_f90).stem + ".pyf"
186
+ monkeypatch.setattr(sys, "argv", f'f2py -h {opath} {ipath}'.split())
187
+
188
+ with util.switchdir(ipath.parent):
189
+ f2pycli() # Generate wrappers
190
+ out, _ = capfd.readouterr()
191
+ assert "Saving signatures to file" in out
192
+ assert Path(f'{opath}').exists()
193
+
194
+
195
+ def test_gen_pyf_stdout(capfd, hello_world_f90, monkeypatch):
196
+ """Ensures that a signature file can be dumped to stdout
197
+ CLI :: -h
198
+ """
199
+ ipath = Path(hello_world_f90)
200
+ monkeypatch.setattr(sys, "argv", f'f2py -h stdout {ipath}'.split())
201
+ with util.switchdir(ipath.parent):
202
+ f2pycli()
203
+ out, _ = capfd.readouterr()
204
+ assert "Saving signatures to file" in out
205
+ assert "function hi() ! in " in out
206
+
207
+
208
+ def test_gen_pyf_no_overwrite(capfd, hello_world_f90, monkeypatch):
209
+ """Ensures that the CLI refuses to overwrite signature files
210
+ CLI :: -h without --overwrite-signature
211
+ """
212
+ ipath = Path(hello_world_f90)
213
+ monkeypatch.setattr(sys, "argv", f'f2py -h faker.pyf {ipath}'.split())
214
+
215
+ with util.switchdir(ipath.parent):
216
+ Path("faker.pyf").write_text("Fake news", encoding="ascii")
217
+ with pytest.raises(SystemExit):
218
+ f2pycli() # Refuse to overwrite
219
+ _, err = capfd.readouterr()
220
+ assert "Use --overwrite-signature to overwrite" in err
221
+
222
+
223
+ @pytest.mark.skipif(sys.version_info <= (3, 12), reason="Python 3.12 required")
224
+ @pytest.mark.slow
225
+ def test_untitled_cli(capfd, hello_world_f90, monkeypatch):
226
+ """Check that modules are named correctly
227
+
228
+ CLI :: defaults
229
+ """
230
+ ipath = Path(hello_world_f90)
231
+ monkeypatch.setattr(sys, "argv", f"f2py --backend meson -c {ipath}".split())
232
+ with util.switchdir(ipath.parent):
233
+ compiler_check_f2pycli()
234
+ out, _ = capfd.readouterr()
235
+ assert "untitledmodule.c" in out
236
+
237
+ @pytest.mark.slow
238
+ def test_no_distutils_backend(capfd, hello_world_f90, monkeypatch):
239
+ """Check that distutils backend and related options fail
240
+ CLI :: --fcompiler --help-link --backend distutils
241
+ """
242
+ MNAME = "hi"
243
+ foutl = get_io_paths(hello_world_f90, mname=MNAME)
244
+ ipath = foutl.f90inp
245
+ monkeypatch.setattr(
246
+ sys, "argv", f"f2py {ipath} -c --fcompiler=gfortran -m {MNAME}".split()
247
+ )
248
+ with util.switchdir(ipath.parent):
249
+ compiler_check_f2pycli()
250
+ out, _ = capfd.readouterr()
251
+ assert "--fcompiler cannot be used with meson" in out
252
+
253
+ monkeypatch.setattr(
254
+ sys, "argv", ["f2py", "--help-link"]
255
+ )
256
+ with pytest.raises(SystemExit):
257
+ f2pycli()
258
+ out, _ = capfd.readouterr()
259
+ assert "Unknown option --help-link" in out
260
+
261
+ monkeypatch.setattr(
262
+ sys, "argv", ["f2py", "--backend", "distutils"]
263
+ )
264
+ with pytest.raises(SystemExit):
265
+ compiler_check_f2pycli()
266
+ f2pycli()
267
+ out, _ = capfd.readouterr()
268
+ assert "'distutils' backend was removed" in out
269
+
270
+ @pytest.mark.xfail
271
+ def test_f2py_skip(capfd, retreal_f77, monkeypatch):
272
+ """Tests that functions can be skipped
273
+ CLI :: skip:
274
+ """
275
+ foutl = get_io_paths(retreal_f77, mname="test")
276
+ ipath = foutl.finp
277
+ toskip = "t0 t4 t8 sd s8 s4"
278
+ remaining = "td s0"
279
+ monkeypatch.setattr(
280
+ sys, "argv",
281
+ f'f2py {ipath} -m test skip: {toskip}'.split())
282
+
283
+ with util.switchdir(ipath.parent):
284
+ f2pycli()
285
+ out, err = capfd.readouterr()
286
+ for skey in toskip.split():
287
+ assert (
288
+ f'buildmodule: Could not found the body of interfaced routine "{skey}". Skipping.'
289
+ in err)
290
+ for rkey in remaining.split():
291
+ assert f'Constructing wrapper function "{rkey}"' in out
292
+
293
+
294
+ def test_f2py_only(capfd, retreal_f77, monkeypatch):
295
+ """Test that functions can be kept by only:
296
+ CLI :: only:
297
+ """
298
+ foutl = get_io_paths(retreal_f77, mname="test")
299
+ ipath = foutl.finp
300
+ toskip = "t0 t4 t8 sd s8 s4"
301
+ tokeep = "td s0"
302
+ monkeypatch.setattr(
303
+ sys, "argv",
304
+ f'f2py {ipath} -m test only: {tokeep}'.split())
305
+
306
+ with util.switchdir(ipath.parent):
307
+ f2pycli()
308
+ out, err = capfd.readouterr()
309
+ for skey in toskip.split():
310
+ assert (
311
+ f'buildmodule: Could not find the body of interfaced routine "{skey}". Skipping.'
312
+ in err)
313
+ for rkey in tokeep.split():
314
+ assert f'Constructing wrapper function "{rkey}"' in out
315
+
316
+
317
+ def test_file_processing_switch(capfd, hello_world_f90, retreal_f77,
318
+ monkeypatch):
319
+ """Tests that it is possible to return to file processing mode
320
+ CLI :: :
321
+ BUG: numpy-gh #20520
322
+ """
323
+ foutl = get_io_paths(retreal_f77, mname="test")
324
+ ipath = foutl.finp
325
+ toskip = "t0 t4 t8 sd s8 s4"
326
+ ipath2 = Path(hello_world_f90)
327
+ tokeep = "td s0 hi" # hi is in ipath2
328
+ mname = "blah"
329
+ monkeypatch.setattr(
330
+ sys,
331
+ "argv",
332
+ f'f2py {ipath} -m {mname} only: {tokeep} : {ipath2}'.split(
333
+ ),
334
+ )
335
+
336
+ with util.switchdir(ipath.parent):
337
+ f2pycli()
338
+ out, err = capfd.readouterr()
339
+ for skey in toskip.split():
340
+ assert (
341
+ f'buildmodule: Could not find the body of interfaced routine "{skey}". Skipping.'
342
+ in err)
343
+ for rkey in tokeep.split():
344
+ assert f'Constructing wrapper function "{rkey}"' in out
345
+
346
+
347
+ def test_mod_gen_f77(capfd, hello_world_f90, monkeypatch):
348
+ """Checks the generation of files based on a module name
349
+ CLI :: -m
350
+ """
351
+ MNAME = "hi"
352
+ foutl = get_io_paths(hello_world_f90, mname=MNAME)
353
+ ipath = foutl.f90inp
354
+ monkeypatch.setattr(sys, "argv", f'f2py {ipath} -m {MNAME}'.split())
355
+ with util.switchdir(ipath.parent):
356
+ f2pycli()
357
+
358
+ # Always generate C module
359
+ assert Path.exists(foutl.cmodf)
360
+ # File contains a function, check for F77 wrappers
361
+ assert Path.exists(foutl.wrap77)
362
+
363
+
364
+ def test_mod_gen_gh25263(capfd, hello_world_f77, monkeypatch):
365
+ """Check that pyf files are correctly generated with module structure
366
+ CLI :: -m <name> -h pyf_file
367
+ BUG: numpy-gh #20520
368
+ """
369
+ MNAME = "hi"
370
+ foutl = get_io_paths(hello_world_f77, mname=MNAME)
371
+ ipath = foutl.finp
372
+ monkeypatch.setattr(sys, "argv", f'f2py {ipath} -m {MNAME} -h hi.pyf'.split())
373
+ with util.switchdir(ipath.parent):
374
+ f2pycli()
375
+ with Path('hi.pyf').open() as hipyf:
376
+ pyfdat = hipyf.read()
377
+ assert "python module hi" in pyfdat
378
+
379
+
380
+ def test_lower_cmod(capfd, hello_world_f77, monkeypatch):
381
+ """Lowers cases by flag or when -h is present
382
+
383
+ CLI :: --[no-]lower
384
+ """
385
+ foutl = get_io_paths(hello_world_f77, mname="test")
386
+ ipath = foutl.finp
387
+ capshi = re.compile(r"HI\(\)")
388
+ capslo = re.compile(r"hi\(\)")
389
+ # Case I: --lower is passed
390
+ monkeypatch.setattr(sys, "argv", f'f2py {ipath} -m test --lower'.split())
391
+ with util.switchdir(ipath.parent):
392
+ f2pycli()
393
+ out, _ = capfd.readouterr()
394
+ assert capslo.search(out) is not None
395
+ assert capshi.search(out) is None
396
+ # Case II: --no-lower is passed
397
+ monkeypatch.setattr(sys, "argv",
398
+ f'f2py {ipath} -m test --no-lower'.split())
399
+ with util.switchdir(ipath.parent):
400
+ f2pycli()
401
+ out, _ = capfd.readouterr()
402
+ assert capslo.search(out) is None
403
+ assert capshi.search(out) is not None
404
+
405
+
406
+ def test_lower_sig(capfd, hello_world_f77, monkeypatch):
407
+ """Lowers cases in signature files by flag or when -h is present
408
+
409
+ CLI :: --[no-]lower -h
410
+ """
411
+ foutl = get_io_paths(hello_world_f77, mname="test")
412
+ ipath = foutl.finp
413
+ # Signature files
414
+ capshi = re.compile(r"Block: HI")
415
+ capslo = re.compile(r"Block: hi")
416
+ # Case I: --lower is implied by -h
417
+ # TODO: Clean up to prevent passing --overwrite-signature
418
+ monkeypatch.setattr(
419
+ sys,
420
+ "argv",
421
+ f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature'.split(),
422
+ )
423
+
424
+ with util.switchdir(ipath.parent):
425
+ f2pycli()
426
+ out, _ = capfd.readouterr()
427
+ assert capslo.search(out) is not None
428
+ assert capshi.search(out) is None
429
+
430
+ # Case II: --no-lower overrides -h
431
+ monkeypatch.setattr(
432
+ sys,
433
+ "argv",
434
+ f'f2py {ipath} -h {foutl.pyf} -m test --overwrite-signature --no-lower'
435
+ .split(),
436
+ )
437
+
438
+ with util.switchdir(ipath.parent):
439
+ f2pycli()
440
+ out, _ = capfd.readouterr()
441
+ assert capslo.search(out) is None
442
+ assert capshi.search(out) is not None
443
+
444
+
445
+ def test_build_dir(capfd, hello_world_f90, monkeypatch):
446
+ """Ensures that the build directory can be specified
447
+
448
+ CLI :: --build-dir
449
+ """
450
+ ipath = Path(hello_world_f90)
451
+ mname = "blah"
452
+ odir = "tttmp"
453
+ monkeypatch.setattr(sys, "argv",
454
+ f'f2py -m {mname} {ipath} --build-dir {odir}'.split())
455
+
456
+ with util.switchdir(ipath.parent):
457
+ f2pycli()
458
+ out, _ = capfd.readouterr()
459
+ assert f"Wrote C/API module \"{mname}\"" in out
460
+
461
+
462
+ def test_overwrite(capfd, hello_world_f90, monkeypatch):
463
+ """Ensures that the build directory can be specified
464
+
465
+ CLI :: --overwrite-signature
466
+ """
467
+ ipath = Path(hello_world_f90)
468
+ monkeypatch.setattr(
469
+ sys, "argv",
470
+ f'f2py -h faker.pyf {ipath} --overwrite-signature'.split())
471
+
472
+ with util.switchdir(ipath.parent):
473
+ Path("faker.pyf").write_text("Fake news", encoding="ascii")
474
+ f2pycli()
475
+ out, _ = capfd.readouterr()
476
+ assert "Saving signatures to file" in out
477
+
478
+
479
+ def test_latexdoc(capfd, hello_world_f90, monkeypatch):
480
+ """Ensures that TeX documentation is written out
481
+
482
+ CLI :: --latex-doc
483
+ """
484
+ ipath = Path(hello_world_f90)
485
+ mname = "blah"
486
+ monkeypatch.setattr(sys, "argv",
487
+ f'f2py -m {mname} {ipath} --latex-doc'.split())
488
+
489
+ with util.switchdir(ipath.parent):
490
+ f2pycli()
491
+ out, _ = capfd.readouterr()
492
+ assert "Documentation is saved to file" in out
493
+ with Path(f"{mname}module.tex").open() as otex:
494
+ assert "\\documentclass" in otex.read()
495
+
496
+
497
+ def test_nolatexdoc(capfd, hello_world_f90, monkeypatch):
498
+ """Ensures that TeX documentation is written out
499
+
500
+ CLI :: --no-latex-doc
501
+ """
502
+ ipath = Path(hello_world_f90)
503
+ mname = "blah"
504
+ monkeypatch.setattr(sys, "argv",
505
+ f'f2py -m {mname} {ipath} --no-latex-doc'.split())
506
+
507
+ with util.switchdir(ipath.parent):
508
+ f2pycli()
509
+ out, _ = capfd.readouterr()
510
+ assert "Documentation is saved to file" not in out
511
+
512
+ @pytest.mark.slow
513
+ def test_latex_doc_gh30268(tmp_path):
514
+
515
+ if not util.has_fortran_compiler():
516
+ pytest.skip("No Fortran compiler found")
517
+
518
+ fsource = textwrap.dedent("""
519
+ subroutine foo
520
+ end
521
+ """)
522
+
523
+ fpath = tmp_path / "test_latex.f90"
524
+ with open(fpath, "w") as f:
525
+ f.write(fsource)
526
+
527
+ cmd = [sys.executable, "-m", "numpy.f2py", "-c", str(fpath), "-m", "test_latex", "--latex-doc"]
528
+ subprocess.check_call(cmd, cwd=tmp_path)
529
+
530
+
531
+ def test_shortlatex(capfd, hello_world_f90, monkeypatch):
532
+ """Ensures that truncated documentation is written out
533
+
534
+ TODO: Test to ensure this has no effect without --latex-doc
535
+ CLI :: --latex-doc --short-latex
536
+ """
537
+ ipath = Path(hello_world_f90)
538
+ mname = "blah"
539
+ monkeypatch.setattr(
540
+ sys,
541
+ "argv",
542
+ f'f2py -m {mname} {ipath} --latex-doc --short-latex'.split(),
543
+ )
544
+
545
+ with util.switchdir(ipath.parent):
546
+ f2pycli()
547
+ out, _ = capfd.readouterr()
548
+ assert "Documentation is saved to file" in out
549
+ with Path(f"./{mname}module.tex").open() as otex:
550
+ assert "\\documentclass" not in otex.read()
551
+
552
+
553
+ def test_restdoc(capfd, hello_world_f90, monkeypatch):
554
+ """Ensures that RsT documentation is written out
555
+
556
+ CLI :: --rest-doc
557
+ """
558
+ ipath = Path(hello_world_f90)
559
+ mname = "blah"
560
+ monkeypatch.setattr(sys, "argv",
561
+ f'f2py -m {mname} {ipath} --rest-doc'.split())
562
+
563
+ with util.switchdir(ipath.parent):
564
+ f2pycli()
565
+ out, _ = capfd.readouterr()
566
+ assert "ReST Documentation is saved to file" in out
567
+ with Path(f"./{mname}module.rest").open() as orst:
568
+ assert r".. -*- rest -*-" in orst.read()
569
+
570
+
571
+ def test_norestexdoc(capfd, hello_world_f90, monkeypatch):
572
+ """Ensures that TeX documentation is written out
573
+
574
+ CLI :: --no-rest-doc
575
+ """
576
+ ipath = Path(hello_world_f90)
577
+ mname = "blah"
578
+ monkeypatch.setattr(sys, "argv",
579
+ f'f2py -m {mname} {ipath} --no-rest-doc'.split())
580
+
581
+ with util.switchdir(ipath.parent):
582
+ f2pycli()
583
+ out, _ = capfd.readouterr()
584
+ assert "ReST Documentation is saved to file" not in out
585
+
586
+
587
+ def test_debugcapi(capfd, hello_world_f90, monkeypatch):
588
+ """Ensures that debugging wrappers are written
589
+
590
+ CLI :: --debug-capi
591
+ """
592
+ ipath = Path(hello_world_f90)
593
+ mname = "blah"
594
+ monkeypatch.setattr(sys, "argv",
595
+ f'f2py -m {mname} {ipath} --debug-capi'.split())
596
+
597
+ with util.switchdir(ipath.parent):
598
+ f2pycli()
599
+ with Path(f"./{mname}module.c").open() as ocmod:
600
+ assert r"#define DEBUGCFUNCS" in ocmod.read()
601
+
602
+
603
+ @pytest.mark.skip(reason="Consistently fails on CI; noisy so skip not xfail.")
604
+ def test_debugcapi_bld(hello_world_f90, monkeypatch):
605
+ """Ensures that debugging wrappers work
606
+
607
+ CLI :: --debug-capi -c
608
+ """
609
+ ipath = Path(hello_world_f90)
610
+ mname = "blah"
611
+ monkeypatch.setattr(sys, "argv",
612
+ f'f2py -m {mname} {ipath} -c --debug-capi'.split())
613
+
614
+ with util.switchdir(ipath.parent):
615
+ f2pycli()
616
+ cmd_run = shlex.split(f"{sys.executable} -c \"import blah; blah.hi()\"")
617
+ rout = subprocess.run(cmd_run, capture_output=True, encoding='UTF-8')
618
+ eout = ' Hello World\n'
619
+ eerr = textwrap.dedent("""\
620
+ debug-capi:Python C/API function blah.hi()
621
+ debug-capi:float hi=:output,hidden,scalar
622
+ debug-capi:hi=0
623
+ debug-capi:Fortran subroutine `f2pywraphi(&hi)'
624
+ debug-capi:hi=0
625
+ debug-capi:Building return value.
626
+ debug-capi:Python C/API function blah.hi: successful.
627
+ debug-capi:Freeing memory.
628
+ """)
629
+ assert rout.stdout == eout
630
+ assert rout.stderr == eerr
631
+
632
+
633
+ def test_wrapfunc_def(capfd, hello_world_f90, monkeypatch):
634
+ """Ensures that fortran subroutine wrappers for F77 are included by default
635
+
636
+ CLI :: --[no]-wrap-functions
637
+ """
638
+ # Implied
639
+ ipath = Path(hello_world_f90)
640
+ mname = "blah"
641
+ monkeypatch.setattr(sys, "argv", f'f2py -m {mname} {ipath}'.split())
642
+
643
+ with util.switchdir(ipath.parent):
644
+ f2pycli()
645
+ out, _ = capfd.readouterr()
646
+ assert r"Fortran 77 wrappers are saved to" in out
647
+
648
+ # Explicit
649
+ monkeypatch.setattr(sys, "argv",
650
+ f'f2py -m {mname} {ipath} --wrap-functions'.split())
651
+
652
+ with util.switchdir(ipath.parent):
653
+ f2pycli()
654
+ out, _ = capfd.readouterr()
655
+ assert r"Fortran 77 wrappers are saved to" in out
656
+
657
+
658
+ def test_nowrapfunc(capfd, hello_world_f90, monkeypatch):
659
+ """Ensures that fortran subroutine wrappers for F77 can be disabled
660
+
661
+ CLI :: --no-wrap-functions
662
+ """
663
+ ipath = Path(hello_world_f90)
664
+ mname = "blah"
665
+ monkeypatch.setattr(sys, "argv",
666
+ f'f2py -m {mname} {ipath} --no-wrap-functions'.split())
667
+
668
+ with util.switchdir(ipath.parent):
669
+ f2pycli()
670
+ out, _ = capfd.readouterr()
671
+ assert r"Fortran 77 wrappers are saved to" not in out
672
+
673
+
674
+ def test_inclheader(capfd, hello_world_f90, monkeypatch):
675
+ """Add to the include directories
676
+
677
+ CLI :: -include
678
+ TODO: Document this in the help string
679
+ """
680
+ ipath = Path(hello_world_f90)
681
+ mname = "blah"
682
+ monkeypatch.setattr(
683
+ sys,
684
+ "argv",
685
+ f'f2py -m {mname} {ipath} -include<stdbool.h> -include<stdio.h> '.
686
+ split(),
687
+ )
688
+
689
+ with util.switchdir(ipath.parent):
690
+ f2pycli()
691
+ with Path(f"./{mname}module.c").open() as ocmod:
692
+ ocmr = ocmod.read()
693
+ assert "#include <stdbool.h>" in ocmr
694
+ assert "#include <stdio.h>" in ocmr
695
+
696
+ @pytest.mark.skipif((platform.system() != 'Linux'), reason='Compiler required')
697
+ @pytest.mark.slow
698
+ def test_cli_obj(capfd, hello_world_f90, monkeypatch):
699
+ """Ensures that the extra object can be specified when using meson backend
700
+ """
701
+ ipath = Path(hello_world_f90)
702
+ mname = "blah"
703
+ odir = "tttmp"
704
+ obj = "extra.o"
705
+ monkeypatch.setattr(sys, "argv",
706
+ f'f2py --backend meson --build-dir {odir} -m {mname} -c {obj} {ipath}'.split())
707
+
708
+ with util.switchdir(ipath.parent):
709
+ Path(obj).touch()
710
+ compiler_check_f2pycli()
711
+ with Path(f"{odir}/meson.build").open() as mesonbuild:
712
+ mbld = mesonbuild.read()
713
+ assert "objects:" in mbld
714
+ assert f"'''{obj}'''" in mbld
715
+
716
+
717
+ def test_inclpath():
718
+ """Add to the include directories
719
+
720
+ CLI :: --include-paths
721
+ """
722
+ # TODO: populate
723
+ pass
724
+
725
+
726
+ def test_hlink():
727
+ """Add to the include directories
728
+
729
+ CLI :: --help-link
730
+ """
731
+ # TODO: populate
732
+ pass
733
+
734
+
735
+ def test_f2cmap(capfd, f2cmap_f90, monkeypatch):
736
+ """Check that Fortran-to-Python KIND specs can be passed
737
+
738
+ CLI :: --f2cmap
739
+ """
740
+ ipath = Path(f2cmap_f90)
741
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} --f2cmap mapfile'.split())
742
+
743
+ with util.switchdir(ipath.parent):
744
+ f2pycli()
745
+ out, _ = capfd.readouterr()
746
+ assert "Reading f2cmap from 'mapfile' ..." in out
747
+ assert "Mapping \"real(kind=real32)\" to \"float\"" in out
748
+ assert "Mapping \"real(kind=real64)\" to \"double\"" in out
749
+ assert "Mapping \"integer(kind=int64)\" to \"long_long\"" in out
750
+ assert "Successfully applied user defined f2cmap changes" in out
751
+
752
+
753
+ def test_quiet(capfd, hello_world_f90, monkeypatch):
754
+ """Reduce verbosity
755
+
756
+ CLI :: --quiet
757
+ """
758
+ ipath = Path(hello_world_f90)
759
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} --quiet'.split())
760
+
761
+ with util.switchdir(ipath.parent):
762
+ f2pycli()
763
+ out, _ = capfd.readouterr()
764
+ assert len(out) == 0
765
+
766
+
767
+ def test_verbose(capfd, hello_world_f90, monkeypatch):
768
+ """Increase verbosity
769
+
770
+ CLI :: --verbose
771
+ """
772
+ ipath = Path(hello_world_f90)
773
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} --verbose'.split())
774
+
775
+ with util.switchdir(ipath.parent):
776
+ f2pycli()
777
+ out, _ = capfd.readouterr()
778
+ assert "analyzeline" in out
779
+
780
+
781
+ def test_version(capfd, monkeypatch):
782
+ """Ensure version
783
+
784
+ CLI :: -v
785
+ """
786
+ monkeypatch.setattr(sys, "argv", ["f2py", "-v"])
787
+ # TODO: f2py2e should not call sys.exit() after printing the version
788
+ with pytest.raises(SystemExit):
789
+ f2pycli()
790
+ out, _ = capfd.readouterr()
791
+ import numpy as np
792
+ assert np.__version__ == out.strip()
793
+
794
+
795
+ @pytest.mark.skip(reason="Consistently fails on CI; noisy so skip not xfail.")
796
+ def test_npdistop(hello_world_f90, monkeypatch):
797
+ """
798
+ CLI :: -c
799
+ """
800
+ ipath = Path(hello_world_f90)
801
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} -c'.split())
802
+
803
+ with util.switchdir(ipath.parent):
804
+ f2pycli()
805
+ cmd_run = shlex.split(f"{sys.executable} -c \"import blah; blah.hi()\"")
806
+ rout = subprocess.run(cmd_run, capture_output=True, encoding='UTF-8')
807
+ eout = ' Hello World\n'
808
+ assert rout.stdout == eout
809
+
810
+
811
+ @pytest.mark.skipif((platform.system() != 'Linux') or sys.version_info <= (3, 12),
812
+ reason='Compiler and Python 3.12 or newer required')
813
+ @pytest.mark.slow
814
+ def test_no_freethreading_compatible(hello_world_f90, monkeypatch):
815
+ """
816
+ CLI :: --no-freethreading-compatible
817
+ """
818
+ ipath = Path(hello_world_f90)
819
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} -c --no-freethreading-compatible'.split())
820
+
821
+ with util.switchdir(ipath.parent):
822
+ compiler_check_f2pycli()
823
+ cmd = f"{sys.executable} -c \"import blah; blah.hi();"
824
+ if NOGIL_BUILD:
825
+ cmd += "import sys; assert sys._is_gil_enabled() is True\""
826
+ else:
827
+ cmd += "\""
828
+ cmd_run = shlex.split(cmd)
829
+ rout = subprocess.run(cmd_run, capture_output=True, encoding='UTF-8')
830
+ eout = ' Hello World\n'
831
+ assert rout.stdout == eout
832
+ if NOGIL_BUILD:
833
+ assert "The global interpreter lock (GIL) has been enabled to load module 'blah'" in rout.stderr
834
+ assert rout.returncode == 0
835
+
836
+
837
+ @pytest.mark.skipif((platform.system() != 'Linux') or sys.version_info <= (3, 12),
838
+ reason='Compiler and Python 3.12 or newer required')
839
+ def test_freethreading_compatible(hello_world_f90, monkeypatch):
840
+ """
841
+ CLI :: --freethreading_compatible
842
+ """
843
+ ipath = Path(hello_world_f90)
844
+ monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} -c --freethreading-compatible'.split())
845
+
846
+ with util.switchdir(ipath.parent):
847
+ compiler_check_f2pycli()
848
+ cmd = f"{sys.executable} -c \"import blah; blah.hi();"
849
+ if NOGIL_BUILD:
850
+ cmd += "import sys; assert sys._is_gil_enabled() is False\""
851
+ else:
852
+ cmd += "\""
853
+ cmd_run = shlex.split(cmd)
854
+ rout = subprocess.run(cmd_run, capture_output=True, encoding='UTF-8')
855
+ eout = ' Hello World\n'
856
+ assert rout.stdout == eout
857
+ if "LSAN_OPTIONS" not in os.environ:
858
+ assert rout.stderr == ""
859
+ assert rout.returncode == 0
860
+
861
+
862
+ # Numpy distutils flags
863
+ # TODO: These should be tested separately
864
+
865
+ def test_npd_fcompiler():
866
+ """
867
+ CLI :: -c --fcompiler
868
+ """
869
+ # TODO: populate
870
+ pass
871
+
872
+
873
+ def test_npd_compiler():
874
+ """
875
+ CLI :: -c --compiler
876
+ """
877
+ # TODO: populate
878
+ pass
879
+
880
+
881
+ def test_npd_help_fcompiler():
882
+ """
883
+ CLI :: -c --help-fcompiler
884
+ """
885
+ # TODO: populate
886
+ pass
887
+
888
+
889
+ def test_npd_f77exec():
890
+ """
891
+ CLI :: -c --f77exec
892
+ """
893
+ # TODO: populate
894
+ pass
895
+
896
+
897
+ def test_npd_f90exec():
898
+ """
899
+ CLI :: -c --f90exec
900
+ """
901
+ # TODO: populate
902
+ pass
903
+
904
+
905
+ def test_npd_f77flags():
906
+ """
907
+ CLI :: -c --f77flags
908
+ """
909
+ # TODO: populate
910
+ pass
911
+
912
+
913
+ def test_npd_f90flags():
914
+ """
915
+ CLI :: -c --f90flags
916
+ """
917
+ # TODO: populate
918
+ pass
919
+
920
+
921
+ def test_npd_opt():
922
+ """
923
+ CLI :: -c --opt
924
+ """
925
+ # TODO: populate
926
+ pass
927
+
928
+
929
+ def test_npd_arch():
930
+ """
931
+ CLI :: -c --arch
932
+ """
933
+ # TODO: populate
934
+ pass
935
+
936
+
937
+ def test_npd_noopt():
938
+ """
939
+ CLI :: -c --noopt
940
+ """
941
+ # TODO: populate
942
+ pass
943
+
944
+
945
+ def test_npd_noarch():
946
+ """
947
+ CLI :: -c --noarch
948
+ """
949
+ # TODO: populate
950
+ pass
951
+
952
+
953
+ def test_npd_debug():
954
+ """
955
+ CLI :: -c --debug
956
+ """
957
+ # TODO: populate
958
+ pass
959
+
960
+
961
+ def test_npd_link_auto():
962
+ """
963
+ CLI :: -c --link-<resource>
964
+ """
965
+ # TODO: populate
966
+ pass
967
+
968
+
969
+ def test_npd_lib():
970
+ """
971
+ CLI :: -c -L/path/to/lib/ -l<libname>
972
+ """
973
+ # TODO: populate
974
+ pass
975
+
976
+
977
+ def test_npd_define():
978
+ """
979
+ CLI :: -D<define>
980
+ """
981
+ # TODO: populate
982
+ pass
983
+
984
+
985
+ def test_npd_undefine():
986
+ """
987
+ CLI :: -U<name>
988
+ """
989
+ # TODO: populate
990
+ pass
991
+
992
+
993
+ def test_npd_incl():
994
+ """
995
+ CLI :: -I/path/to/include/
996
+ """
997
+ # TODO: populate
998
+ pass
999
+
1000
+
1001
+ def test_npd_linker():
1002
+ """
1003
+ CLI :: <filename>.o <filename>.so <filename>.a
1004
+ """
1005
+ # TODO: populate
1006
+ pass
venv/lib/python3.14/site-packages/numpy/f2py/tests/test_inplace.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pytest
3
+
4
+ import numpy as np
5
+ from numpy.f2py.tests import util
6
+ from numpy.testing import assert_array_equal
7
+
8
+
9
+ @pytest.mark.slow
10
+ class TestInplace(util.F2PyTest):
11
+ sources = [util.getpath("tests", "src", "inplace", "foo.f")]
12
+
13
+ @pytest.mark.parametrize("func", ["inplace", "inplace_out"])
14
+ @pytest.mark.parametrize("writeable", ["writeable", "readonly"])
15
+ @pytest.mark.parametrize("view", [
16
+ None, (), (slice(None, 2, None), slice(None, None, 2))])
17
+ @pytest.mark.parametrize("dtype", ["f4", "f8"])
18
+ def test_inplace(self, dtype, view, writeable, func):
19
+ # Test inplace modifications of an input array.
20
+ a = np.arange(12.0, dtype=dtype).reshape((3, 4)).copy()
21
+ a.flags.writeable = writeable == "writeable"
22
+ k = a if view is None else a[view]
23
+
24
+ ffunc = getattr(self.module, func)
25
+ if not a.flags.writeable:
26
+ with pytest.raises(ValueError, match="WRITEBACKIFCOPY base is read-only"):
27
+ ffunc(k)
28
+ return
29
+
30
+ ref_k = k
31
+ exp_copy = k.copy()
32
+ exp_k = k ** 2
33
+ exp_a = a.copy()
34
+ exp_a[view or ()] = exp_k
35
+ if func == "inplace_out":
36
+ kout, copy = ffunc(k)
37
+ assert kout is k
38
+ else:
39
+ copy = ffunc(k)
40
+ assert_array_equal(copy, exp_copy)
41
+ assert k is ref_k
42
+ assert np.allclose(k, exp_k)
43
+ assert np.allclose(a, exp_a)
44
+
45
+ @pytest.mark.parametrize("func", ["inplace", "inplace_out"])
46
+ def test_inplace_error(self, func):
47
+ ffunc = getattr(self.module, func)
48
+ with pytest.raises(ValueError, match="input.*not compatible"):
49
+ ffunc(np.array([1 + 1j]))