Add loan-advisor-agent (part 2)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/tests/test_umath_complex.py +631 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/tests/test_unicode.py +369 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/umath.py +60 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/umath.pyi +232 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_distributor_init.py +15 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_distributor_init.pyi +1 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_expired_attrs_2_0.py +78 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_expired_attrs_2_0.pyi +61 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_globals.py +121 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_globals.pyi +17 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/__init__.py +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/__init__.pyi +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/hook-numpy.py +36 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/hook-numpy.pyi +6 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/__init__.py +16 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py +32 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py +35 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pytesttester.py +201 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_pytesttester.pyi +18 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__init__.py +173 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/__init__.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_add_docstring.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_array_like.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_char_codes.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_dtype_like.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nbit.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nbit_base.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nested_sequence.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_scalars.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_shape.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_ufunc.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_add_docstring.py +153 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_array_like.py +106 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_char_codes.py +213 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_dtype_like.py +114 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_extended_precision.py +15 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit.py +19 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit_base.py +94 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit_base.pyi +39 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nested_sequence.py +79 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_scalars.py +20 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_shape.py +8 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_ufunc.py +7 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_ufunc.pyi +975 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__init__.py +95 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__init__.pyi +28 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/__init__.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/_convertions.cpython-312.pyc +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/_inspect.cpython-312.pyc +0 -0
.gitattributes
CHANGED
|
@@ -448,3 +448,4 @@ loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/__pycache__/fromnumeric.c
|
|
| 448 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/_multiarray_umath.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
|
| 449 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/_simd.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
|
| 450 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/lib/npymath.lib filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 448 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/_multiarray_umath.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
|
| 449 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/_simd.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
|
| 450 |
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/lib/npymath.lib filter=lfs diff=lfs merge=lfs -text
|
| 451 |
+
loan-advisor-agent/.venv/Lib/site-packages/numpy/f2py/__pycache__/crackfortran.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/tests/test_umath_complex.py
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import platform
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
|
| 8 |
+
# import the c-extension module directly since _arg is not exported via umath
|
| 9 |
+
import numpy._core._multiarray_umath as ncu
|
| 10 |
+
from numpy.testing import (
|
| 11 |
+
assert_almost_equal,
|
| 12 |
+
assert_array_equal,
|
| 13 |
+
assert_array_max_ulp,
|
| 14 |
+
assert_equal,
|
| 15 |
+
assert_raises,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# TODO: branch cuts (use Pauli code)
|
| 19 |
+
# TODO: conj 'symmetry'
|
| 20 |
+
# TODO: FPU exceptions
|
| 21 |
+
|
| 22 |
+
# At least on Windows the results of many complex functions are not conforming
|
| 23 |
+
# to the C99 standard. See ticket 1574.
|
| 24 |
+
# Ditto for Solaris (ticket 1642) and OS X on PowerPC.
|
| 25 |
+
# FIXME: this will probably change when we require full C99 compatibility
|
| 26 |
+
with np.errstate(all='ignore'):
|
| 27 |
+
functions_seem_flaky = ((np.exp(complex(np.inf, 0)).imag != 0)
|
| 28 |
+
or (np.log(complex(ncu.NZERO, 0)).imag != np.pi))
|
| 29 |
+
# TODO: replace with a check on whether platform-provided C99 funcs are used
|
| 30 |
+
xfail_complex_tests = (not sys.platform.startswith('linux') or functions_seem_flaky)
|
| 31 |
+
|
| 32 |
+
# TODO This can be xfail when the generator functions are got rid of.
|
| 33 |
+
platform_skip = pytest.mark.skipif(xfail_complex_tests,
|
| 34 |
+
reason="Inadequate C99 complex support")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class TestCexp:
|
| 38 |
+
def test_simple(self):
|
| 39 |
+
check = check_complex_value
|
| 40 |
+
f = np.exp
|
| 41 |
+
|
| 42 |
+
check(f, 1, 0, np.exp(1), 0, False)
|
| 43 |
+
check(f, 0, 1, np.cos(1), np.sin(1), False)
|
| 44 |
+
|
| 45 |
+
ref = np.exp(1) * complex(np.cos(1), np.sin(1))
|
| 46 |
+
check(f, 1, 1, ref.real, ref.imag, False)
|
| 47 |
+
|
| 48 |
+
@platform_skip
|
| 49 |
+
def test_special_values(self):
|
| 50 |
+
# C99: Section G 6.3.1
|
| 51 |
+
|
| 52 |
+
check = check_complex_value
|
| 53 |
+
f = np.exp
|
| 54 |
+
|
| 55 |
+
# cexp(+-0 + 0i) is 1 + 0i
|
| 56 |
+
check(f, ncu.PZERO, 0, 1, 0, False)
|
| 57 |
+
check(f, ncu.NZERO, 0, 1, 0, False)
|
| 58 |
+
|
| 59 |
+
# cexp(x + infi) is nan + nani for finite x and raises 'invalid' FPU
|
| 60 |
+
# exception
|
| 61 |
+
check(f, 1, np.inf, np.nan, np.nan)
|
| 62 |
+
check(f, -1, np.inf, np.nan, np.nan)
|
| 63 |
+
check(f, 0, np.inf, np.nan, np.nan)
|
| 64 |
+
|
| 65 |
+
# cexp(inf + 0i) is inf + 0i
|
| 66 |
+
check(f, np.inf, 0, np.inf, 0)
|
| 67 |
+
|
| 68 |
+
# cexp(-inf + yi) is +0 * (cos(y) + i sin(y)) for finite y
|
| 69 |
+
check(f, -np.inf, 1, ncu.PZERO, ncu.PZERO)
|
| 70 |
+
check(f, -np.inf, 0.75 * np.pi, ncu.NZERO, ncu.PZERO)
|
| 71 |
+
|
| 72 |
+
# cexp(inf + yi) is +inf * (cos(y) + i sin(y)) for finite y
|
| 73 |
+
check(f, np.inf, 1, np.inf, np.inf)
|
| 74 |
+
check(f, np.inf, 0.75 * np.pi, -np.inf, np.inf)
|
| 75 |
+
|
| 76 |
+
# cexp(-inf + inf i) is +-0 +- 0i (signs unspecified)
|
| 77 |
+
def _check_ninf_inf(dummy):
|
| 78 |
+
msgform = "cexp(-inf, inf) is (%f, %f), expected (+-0, +-0)"
|
| 79 |
+
with np.errstate(invalid='ignore'):
|
| 80 |
+
z = f(np.array(complex(-np.inf, np.inf)))
|
| 81 |
+
if z.real != 0 or z.imag != 0:
|
| 82 |
+
raise AssertionError(msgform % (z.real, z.imag))
|
| 83 |
+
|
| 84 |
+
_check_ninf_inf(None)
|
| 85 |
+
|
| 86 |
+
# cexp(inf + inf i) is +-inf + NaNi and raised invalid FPU ex.
|
| 87 |
+
def _check_inf_inf(dummy):
|
| 88 |
+
msgform = "cexp(inf, inf) is (%f, %f), expected (+-inf, nan)"
|
| 89 |
+
with np.errstate(invalid='ignore'):
|
| 90 |
+
z = f(np.array(complex(np.inf, np.inf)))
|
| 91 |
+
if not np.isinf(z.real) or not np.isnan(z.imag):
|
| 92 |
+
raise AssertionError(msgform % (z.real, z.imag))
|
| 93 |
+
|
| 94 |
+
_check_inf_inf(None)
|
| 95 |
+
|
| 96 |
+
# cexp(-inf + nan i) is +-0 +- 0i
|
| 97 |
+
def _check_ninf_nan(dummy):
|
| 98 |
+
msgform = "cexp(-inf, nan) is (%f, %f), expected (+-0, +-0)"
|
| 99 |
+
with np.errstate(invalid='ignore'):
|
| 100 |
+
z = f(np.array(complex(-np.inf, np.nan)))
|
| 101 |
+
if z.real != 0 or z.imag != 0:
|
| 102 |
+
raise AssertionError(msgform % (z.real, z.imag))
|
| 103 |
+
|
| 104 |
+
_check_ninf_nan(None)
|
| 105 |
+
|
| 106 |
+
# cexp(inf + nan i) is +-inf + nan
|
| 107 |
+
def _check_inf_nan(dummy):
|
| 108 |
+
msgform = "cexp(-inf, nan) is (%f, %f), expected (+-inf, nan)"
|
| 109 |
+
with np.errstate(invalid='ignore'):
|
| 110 |
+
z = f(np.array(complex(np.inf, np.nan)))
|
| 111 |
+
if not np.isinf(z.real) or not np.isnan(z.imag):
|
| 112 |
+
raise AssertionError(msgform % (z.real, z.imag))
|
| 113 |
+
|
| 114 |
+
_check_inf_nan(None)
|
| 115 |
+
|
| 116 |
+
# cexp(nan + yi) is nan + nani for y != 0 (optional: raises invalid FPU
|
| 117 |
+
# ex)
|
| 118 |
+
check(f, np.nan, 1, np.nan, np.nan)
|
| 119 |
+
check(f, np.nan, -1, np.nan, np.nan)
|
| 120 |
+
|
| 121 |
+
check(f, np.nan, np.inf, np.nan, np.nan)
|
| 122 |
+
check(f, np.nan, -np.inf, np.nan, np.nan)
|
| 123 |
+
|
| 124 |
+
# cexp(nan + nani) is nan + nani
|
| 125 |
+
check(f, np.nan, np.nan, np.nan, np.nan)
|
| 126 |
+
|
| 127 |
+
# TODO This can be xfail when the generator functions are got rid of.
|
| 128 |
+
@pytest.mark.skip(reason="cexp(nan + 0I) is wrong on most platforms")
|
| 129 |
+
def test_special_values2(self):
|
| 130 |
+
# XXX: most implementations get it wrong here (including glibc <= 2.10)
|
| 131 |
+
# cexp(nan + 0i) is nan + 0i
|
| 132 |
+
check = check_complex_value
|
| 133 |
+
f = np.exp
|
| 134 |
+
|
| 135 |
+
check(f, np.nan, 0, np.nan, 0)
|
| 136 |
+
|
| 137 |
+
class TestClog:
|
| 138 |
+
def test_simple(self):
|
| 139 |
+
x = np.array([1 + 0j, 1 + 2j])
|
| 140 |
+
y_r = np.log(np.abs(x)) + 1j * np.angle(x)
|
| 141 |
+
y = np.log(x)
|
| 142 |
+
assert_almost_equal(y, y_r)
|
| 143 |
+
|
| 144 |
+
@platform_skip
|
| 145 |
+
@pytest.mark.skipif(platform.machine() == "armv5tel", reason="See gh-413.")
|
| 146 |
+
def test_special_values(self):
|
| 147 |
+
xl = []
|
| 148 |
+
yl = []
|
| 149 |
+
|
| 150 |
+
# From C99 std (Sec 6.3.2)
|
| 151 |
+
# XXX: check exceptions raised
|
| 152 |
+
# --- raise for invalid fails.
|
| 153 |
+
|
| 154 |
+
# clog(-0 + i0) returns -inf + i pi and raises the 'divide-by-zero'
|
| 155 |
+
# floating-point exception.
|
| 156 |
+
with np.errstate(divide='raise'):
|
| 157 |
+
x = np.array([ncu.NZERO], dtype=complex)
|
| 158 |
+
y = complex(-np.inf, np.pi)
|
| 159 |
+
assert_raises(FloatingPointError, np.log, x)
|
| 160 |
+
with np.errstate(divide='ignore'):
|
| 161 |
+
assert_almost_equal(np.log(x), y)
|
| 162 |
+
|
| 163 |
+
xl.append(x)
|
| 164 |
+
yl.append(y)
|
| 165 |
+
|
| 166 |
+
# clog(+0 + i0) returns -inf + i0 and raises the 'divide-by-zero'
|
| 167 |
+
# floating-point exception.
|
| 168 |
+
with np.errstate(divide='raise'):
|
| 169 |
+
x = np.array([0], dtype=complex)
|
| 170 |
+
y = complex(-np.inf, 0)
|
| 171 |
+
assert_raises(FloatingPointError, np.log, x)
|
| 172 |
+
with np.errstate(divide='ignore'):
|
| 173 |
+
assert_almost_equal(np.log(x), y)
|
| 174 |
+
|
| 175 |
+
xl.append(x)
|
| 176 |
+
yl.append(y)
|
| 177 |
+
|
| 178 |
+
# clog(x + i inf returns +inf + i pi /2, for finite x.
|
| 179 |
+
x = np.array([complex(1, np.inf)], dtype=complex)
|
| 180 |
+
y = complex(np.inf, 0.5 * np.pi)
|
| 181 |
+
assert_almost_equal(np.log(x), y)
|
| 182 |
+
xl.append(x)
|
| 183 |
+
yl.append(y)
|
| 184 |
+
|
| 185 |
+
x = np.array([complex(-1, np.inf)], dtype=complex)
|
| 186 |
+
assert_almost_equal(np.log(x), y)
|
| 187 |
+
xl.append(x)
|
| 188 |
+
yl.append(y)
|
| 189 |
+
|
| 190 |
+
# clog(x + iNaN) returns NaN + iNaN and optionally raises the
|
| 191 |
+
# 'invalid' floating- point exception, for finite x.
|
| 192 |
+
with np.errstate(invalid='raise'):
|
| 193 |
+
x = np.array([complex(1., np.nan)], dtype=complex)
|
| 194 |
+
y = complex(np.nan, np.nan)
|
| 195 |
+
#assert_raises(FloatingPointError, np.log, x)
|
| 196 |
+
with np.errstate(invalid='ignore'):
|
| 197 |
+
assert_almost_equal(np.log(x), y)
|
| 198 |
+
|
| 199 |
+
xl.append(x)
|
| 200 |
+
yl.append(y)
|
| 201 |
+
|
| 202 |
+
with np.errstate(invalid='raise'):
|
| 203 |
+
x = np.array([np.inf + 1j * np.nan], dtype=complex)
|
| 204 |
+
#assert_raises(FloatingPointError, np.log, x)
|
| 205 |
+
with np.errstate(invalid='ignore'):
|
| 206 |
+
assert_almost_equal(np.log(x), y)
|
| 207 |
+
|
| 208 |
+
xl.append(x)
|
| 209 |
+
yl.append(y)
|
| 210 |
+
|
| 211 |
+
# clog(- inf + iy) returns +inf + ipi , for finite positive-signed y.
|
| 212 |
+
x = np.array([-np.inf + 1j], dtype=complex)
|
| 213 |
+
y = complex(np.inf, np.pi)
|
| 214 |
+
assert_almost_equal(np.log(x), y)
|
| 215 |
+
xl.append(x)
|
| 216 |
+
yl.append(y)
|
| 217 |
+
|
| 218 |
+
# clog(+ inf + iy) returns +inf + i0, for finite positive-signed y.
|
| 219 |
+
x = np.array([np.inf + 1j], dtype=complex)
|
| 220 |
+
y = complex(np.inf, 0)
|
| 221 |
+
assert_almost_equal(np.log(x), y)
|
| 222 |
+
xl.append(x)
|
| 223 |
+
yl.append(y)
|
| 224 |
+
|
| 225 |
+
# clog(- inf + i inf) returns +inf + i3pi /4.
|
| 226 |
+
x = np.array([complex(-np.inf, np.inf)], dtype=complex)
|
| 227 |
+
y = complex(np.inf, 0.75 * np.pi)
|
| 228 |
+
assert_almost_equal(np.log(x), y)
|
| 229 |
+
xl.append(x)
|
| 230 |
+
yl.append(y)
|
| 231 |
+
|
| 232 |
+
# clog(+ inf + i inf) returns +inf + ipi /4.
|
| 233 |
+
x = np.array([complex(np.inf, np.inf)], dtype=complex)
|
| 234 |
+
y = complex(np.inf, 0.25 * np.pi)
|
| 235 |
+
assert_almost_equal(np.log(x), y)
|
| 236 |
+
xl.append(x)
|
| 237 |
+
yl.append(y)
|
| 238 |
+
|
| 239 |
+
# clog(+/- inf + iNaN) returns +inf + iNaN.
|
| 240 |
+
x = np.array([complex(np.inf, np.nan)], dtype=complex)
|
| 241 |
+
y = complex(np.inf, np.nan)
|
| 242 |
+
assert_almost_equal(np.log(x), y)
|
| 243 |
+
xl.append(x)
|
| 244 |
+
yl.append(y)
|
| 245 |
+
|
| 246 |
+
x = np.array([complex(-np.inf, np.nan)], dtype=complex)
|
| 247 |
+
assert_almost_equal(np.log(x), y)
|
| 248 |
+
xl.append(x)
|
| 249 |
+
yl.append(y)
|
| 250 |
+
|
| 251 |
+
# clog(NaN + iy) returns NaN + iNaN and optionally raises the
|
| 252 |
+
# 'invalid' floating-point exception, for finite y.
|
| 253 |
+
x = np.array([complex(np.nan, 1)], dtype=complex)
|
| 254 |
+
y = complex(np.nan, np.nan)
|
| 255 |
+
assert_almost_equal(np.log(x), y)
|
| 256 |
+
xl.append(x)
|
| 257 |
+
yl.append(y)
|
| 258 |
+
|
| 259 |
+
# clog(NaN + i inf) returns +inf + iNaN.
|
| 260 |
+
x = np.array([complex(np.nan, np.inf)], dtype=complex)
|
| 261 |
+
y = complex(np.inf, np.nan)
|
| 262 |
+
assert_almost_equal(np.log(x), y)
|
| 263 |
+
xl.append(x)
|
| 264 |
+
yl.append(y)
|
| 265 |
+
|
| 266 |
+
# clog(NaN + iNaN) returns NaN + iNaN.
|
| 267 |
+
x = np.array([complex(np.nan, np.nan)], dtype=complex)
|
| 268 |
+
y = complex(np.nan, np.nan)
|
| 269 |
+
assert_almost_equal(np.log(x), y)
|
| 270 |
+
xl.append(x)
|
| 271 |
+
yl.append(y)
|
| 272 |
+
|
| 273 |
+
# clog(conj(z)) = conj(clog(z)).
|
| 274 |
+
xa = np.array(xl, dtype=complex)
|
| 275 |
+
ya = np.array(yl, dtype=complex)
|
| 276 |
+
with np.errstate(divide='ignore'):
|
| 277 |
+
for i in range(len(xa)):
|
| 278 |
+
assert_almost_equal(np.log(xa[i].conj()), ya[i].conj())
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
class TestCsqrt:
|
| 282 |
+
|
| 283 |
+
def test_simple(self):
|
| 284 |
+
# sqrt(1)
|
| 285 |
+
check_complex_value(np.sqrt, 1, 0, 1, 0)
|
| 286 |
+
|
| 287 |
+
# sqrt(1i)
|
| 288 |
+
rres = 0.5 * np.sqrt(2)
|
| 289 |
+
ires = rres
|
| 290 |
+
check_complex_value(np.sqrt, 0, 1, rres, ires, False)
|
| 291 |
+
|
| 292 |
+
# sqrt(-1)
|
| 293 |
+
check_complex_value(np.sqrt, -1, 0, 0, 1)
|
| 294 |
+
|
| 295 |
+
def test_simple_conjugate(self):
|
| 296 |
+
ref = np.conj(np.sqrt(complex(1, 1)))
|
| 297 |
+
|
| 298 |
+
def f(z):
|
| 299 |
+
return np.sqrt(np.conj(z))
|
| 300 |
+
|
| 301 |
+
check_complex_value(f, 1, 1, ref.real, ref.imag, False)
|
| 302 |
+
|
| 303 |
+
#def test_branch_cut(self):
|
| 304 |
+
# _check_branch_cut(f, -1, 0, 1, -1)
|
| 305 |
+
|
| 306 |
+
@platform_skip
|
| 307 |
+
def test_special_values(self):
|
| 308 |
+
# C99: Sec G 6.4.2
|
| 309 |
+
|
| 310 |
+
check = check_complex_value
|
| 311 |
+
f = np.sqrt
|
| 312 |
+
|
| 313 |
+
# csqrt(+-0 + 0i) is 0 + 0i
|
| 314 |
+
check(f, ncu.PZERO, 0, 0, 0)
|
| 315 |
+
check(f, ncu.NZERO, 0, 0, 0)
|
| 316 |
+
|
| 317 |
+
# csqrt(x + infi) is inf + infi for any x (including NaN)
|
| 318 |
+
check(f, 1, np.inf, np.inf, np.inf)
|
| 319 |
+
check(f, -1, np.inf, np.inf, np.inf)
|
| 320 |
+
|
| 321 |
+
check(f, ncu.PZERO, np.inf, np.inf, np.inf)
|
| 322 |
+
check(f, ncu.NZERO, np.inf, np.inf, np.inf)
|
| 323 |
+
check(f, np.inf, np.inf, np.inf, np.inf)
|
| 324 |
+
check(f, -np.inf, np.inf, np.inf, np.inf) # noqa: E221
|
| 325 |
+
check(f, -np.nan, np.inf, np.inf, np.inf) # noqa: E221
|
| 326 |
+
|
| 327 |
+
# csqrt(x + nani) is nan + nani for any finite x
|
| 328 |
+
check(f, 1, np.nan, np.nan, np.nan)
|
| 329 |
+
check(f, -1, np.nan, np.nan, np.nan)
|
| 330 |
+
check(f, 0, np.nan, np.nan, np.nan)
|
| 331 |
+
|
| 332 |
+
# csqrt(-inf + yi) is +0 + infi for any finite y > 0
|
| 333 |
+
check(f, -np.inf, 1, ncu.PZERO, np.inf)
|
| 334 |
+
|
| 335 |
+
# csqrt(inf + yi) is +inf + 0i for any finite y > 0
|
| 336 |
+
check(f, np.inf, 1, np.inf, ncu.PZERO)
|
| 337 |
+
|
| 338 |
+
# csqrt(-inf + nani) is nan +- infi (both +i infi are valid)
|
| 339 |
+
def _check_ninf_nan(dummy):
|
| 340 |
+
msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)"
|
| 341 |
+
z = np.sqrt(np.array(complex(-np.inf, np.nan)))
|
| 342 |
+
# FIXME: ugly workaround for isinf bug.
|
| 343 |
+
with np.errstate(invalid='ignore'):
|
| 344 |
+
if not (np.isnan(z.real) and np.isinf(z.imag)):
|
| 345 |
+
raise AssertionError(msgform % (z.real, z.imag))
|
| 346 |
+
|
| 347 |
+
_check_ninf_nan(None)
|
| 348 |
+
|
| 349 |
+
# csqrt(+inf + nani) is inf + nani
|
| 350 |
+
check(f, np.inf, np.nan, np.inf, np.nan)
|
| 351 |
+
|
| 352 |
+
# csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x
|
| 353 |
+
# + nani)
|
| 354 |
+
check(f, np.nan, 0, np.nan, np.nan)
|
| 355 |
+
check(f, np.nan, 1, np.nan, np.nan)
|
| 356 |
+
check(f, np.nan, np.nan, np.nan, np.nan)
|
| 357 |
+
|
| 358 |
+
# XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch
|
| 359 |
+
# cuts first)
|
| 360 |
+
|
| 361 |
+
class TestCpow:
|
| 362 |
+
def setup_method(self):
|
| 363 |
+
self.olderr = np.seterr(invalid='ignore')
|
| 364 |
+
|
| 365 |
+
def teardown_method(self):
|
| 366 |
+
np.seterr(**self.olderr)
|
| 367 |
+
|
| 368 |
+
def test_simple(self):
|
| 369 |
+
x = np.array([1 + 1j, 0 + 2j, 1 + 2j, np.inf, np.nan])
|
| 370 |
+
y_r = x ** 2
|
| 371 |
+
y = np.power(x, 2)
|
| 372 |
+
assert_almost_equal(y, y_r)
|
| 373 |
+
|
| 374 |
+
def test_scalar(self):
|
| 375 |
+
x = np.array([1, 1j, 2, 2.5 + .37j, np.inf, np.nan])
|
| 376 |
+
y = np.array([1, 1j, -0.5 + 1.5j, -0.5 + 1.5j, 2, 3])
|
| 377 |
+
lx = list(range(len(x)))
|
| 378 |
+
|
| 379 |
+
# Hardcode the expected `builtins.complex` values,
|
| 380 |
+
# as complex exponentiation is broken as of bpo-44698
|
| 381 |
+
p_r = [
|
| 382 |
+
1 + 0j,
|
| 383 |
+
0.20787957635076193 + 0j,
|
| 384 |
+
0.35812203996480685 + 0.6097119028618724j,
|
| 385 |
+
0.12659112128185032 + 0.48847676699581527j,
|
| 386 |
+
complex(np.inf, np.nan),
|
| 387 |
+
complex(np.nan, np.nan),
|
| 388 |
+
]
|
| 389 |
+
|
| 390 |
+
n_r = [x[i] ** y[i] for i in lx]
|
| 391 |
+
for i in lx:
|
| 392 |
+
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
|
| 393 |
+
|
| 394 |
+
def test_array(self):
|
| 395 |
+
x = np.array([1, 1j, 2, 2.5 + .37j, np.inf, np.nan])
|
| 396 |
+
y = np.array([1, 1j, -0.5 + 1.5j, -0.5 + 1.5j, 2, 3])
|
| 397 |
+
lx = list(range(len(x)))
|
| 398 |
+
|
| 399 |
+
# Hardcode the expected `builtins.complex` values,
|
| 400 |
+
# as complex exponentiation is broken as of bpo-44698
|
| 401 |
+
p_r = [
|
| 402 |
+
1 + 0j,
|
| 403 |
+
0.20787957635076193 + 0j,
|
| 404 |
+
0.35812203996480685 + 0.6097119028618724j,
|
| 405 |
+
0.12659112128185032 + 0.48847676699581527j,
|
| 406 |
+
complex(np.inf, np.nan),
|
| 407 |
+
complex(np.nan, np.nan),
|
| 408 |
+
]
|
| 409 |
+
|
| 410 |
+
n_r = x ** y
|
| 411 |
+
for i in lx:
|
| 412 |
+
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
|
| 413 |
+
|
| 414 |
+
class TestCabs:
|
| 415 |
+
def setup_method(self):
|
| 416 |
+
self.olderr = np.seterr(invalid='ignore')
|
| 417 |
+
|
| 418 |
+
def teardown_method(self):
|
| 419 |
+
np.seterr(**self.olderr)
|
| 420 |
+
|
| 421 |
+
def test_simple(self):
|
| 422 |
+
x = np.array([1 + 1j, 0 + 2j, 1 + 2j, np.inf, np.nan])
|
| 423 |
+
y_r = np.array([np.sqrt(2.), 2, np.sqrt(5), np.inf, np.nan])
|
| 424 |
+
y = np.abs(x)
|
| 425 |
+
assert_almost_equal(y, y_r)
|
| 426 |
+
|
| 427 |
+
def test_fabs(self):
|
| 428 |
+
# Test that np.abs(x +- 0j) == np.abs(x) (as mandated by C99 for cabs)
|
| 429 |
+
x = np.array([1 + 0j], dtype=complex)
|
| 430 |
+
assert_array_equal(np.abs(x), np.real(x))
|
| 431 |
+
|
| 432 |
+
x = np.array([complex(1, ncu.NZERO)], dtype=complex)
|
| 433 |
+
assert_array_equal(np.abs(x), np.real(x))
|
| 434 |
+
|
| 435 |
+
x = np.array([complex(np.inf, ncu.NZERO)], dtype=complex)
|
| 436 |
+
assert_array_equal(np.abs(x), np.real(x))
|
| 437 |
+
|
| 438 |
+
x = np.array([complex(np.nan, ncu.NZERO)], dtype=complex)
|
| 439 |
+
assert_array_equal(np.abs(x), np.real(x))
|
| 440 |
+
|
| 441 |
+
def test_cabs_inf_nan(self):
|
| 442 |
+
x, y = [], []
|
| 443 |
+
|
| 444 |
+
# cabs(+-nan + nani) returns nan
|
| 445 |
+
x.append(np.nan)
|
| 446 |
+
y.append(np.nan)
|
| 447 |
+
check_real_value(np.abs, np.nan, np.nan, np.nan)
|
| 448 |
+
|
| 449 |
+
x.append(np.nan)
|
| 450 |
+
y.append(-np.nan)
|
| 451 |
+
check_real_value(np.abs, -np.nan, np.nan, np.nan)
|
| 452 |
+
|
| 453 |
+
# According to C99 standard, if exactly one of the real/part is inf and
|
| 454 |
+
# the other nan, then cabs should return inf
|
| 455 |
+
x.append(np.inf)
|
| 456 |
+
y.append(np.nan)
|
| 457 |
+
check_real_value(np.abs, np.inf, np.nan, np.inf)
|
| 458 |
+
|
| 459 |
+
x.append(-np.inf)
|
| 460 |
+
y.append(np.nan)
|
| 461 |
+
check_real_value(np.abs, -np.inf, np.nan, np.inf)
|
| 462 |
+
|
| 463 |
+
# cabs(conj(z)) == conj(cabs(z)) (= cabs(z))
|
| 464 |
+
def f(a):
|
| 465 |
+
return np.abs(np.conj(a))
|
| 466 |
+
|
| 467 |
+
def g(a, b):
|
| 468 |
+
return np.abs(complex(a, b))
|
| 469 |
+
|
| 470 |
+
xa = np.array(x, dtype=complex)
|
| 471 |
+
assert len(xa) == len(x) == len(y)
|
| 472 |
+
for xi, yi in zip(x, y):
|
| 473 |
+
ref = g(xi, yi)
|
| 474 |
+
check_real_value(f, xi, yi, ref)
|
| 475 |
+
|
| 476 |
+
class TestCarg:
|
| 477 |
+
def test_simple(self):
|
| 478 |
+
check_real_value(ncu._arg, 1, 0, 0, False)
|
| 479 |
+
check_real_value(ncu._arg, 0, 1, 0.5 * np.pi, False)
|
| 480 |
+
|
| 481 |
+
check_real_value(ncu._arg, 1, 1, 0.25 * np.pi, False)
|
| 482 |
+
check_real_value(ncu._arg, ncu.PZERO, ncu.PZERO, ncu.PZERO)
|
| 483 |
+
|
| 484 |
+
# TODO This can be xfail when the generator functions are got rid of.
|
| 485 |
+
@pytest.mark.skip(
|
| 486 |
+
reason="Complex arithmetic with signed zero fails on most platforms")
|
| 487 |
+
def test_zero(self):
|
| 488 |
+
# carg(-0 +- 0i) returns +- pi
|
| 489 |
+
check_real_value(ncu._arg, ncu.NZERO, ncu.PZERO, np.pi, False)
|
| 490 |
+
check_real_value(ncu._arg, ncu.NZERO, ncu.NZERO, -np.pi, False)
|
| 491 |
+
|
| 492 |
+
# carg(+0 +- 0i) returns +- 0
|
| 493 |
+
check_real_value(ncu._arg, ncu.PZERO, ncu.PZERO, ncu.PZERO)
|
| 494 |
+
check_real_value(ncu._arg, ncu.PZERO, ncu.NZERO, ncu.NZERO)
|
| 495 |
+
|
| 496 |
+
# carg(x +- 0i) returns +- 0 for x > 0
|
| 497 |
+
check_real_value(ncu._arg, 1, ncu.PZERO, ncu.PZERO, False)
|
| 498 |
+
check_real_value(ncu._arg, 1, ncu.NZERO, ncu.NZERO, False)
|
| 499 |
+
|
| 500 |
+
# carg(x +- 0i) returns +- pi for x < 0
|
| 501 |
+
check_real_value(ncu._arg, -1, ncu.PZERO, np.pi, False)
|
| 502 |
+
check_real_value(ncu._arg, -1, ncu.NZERO, -np.pi, False)
|
| 503 |
+
|
| 504 |
+
# carg(+- 0 + yi) returns pi/2 for y > 0
|
| 505 |
+
check_real_value(ncu._arg, ncu.PZERO, 1, 0.5 * np.pi, False)
|
| 506 |
+
check_real_value(ncu._arg, ncu.NZERO, 1, 0.5 * np.pi, False)
|
| 507 |
+
|
| 508 |
+
# carg(+- 0 + yi) returns -pi/2 for y < 0
|
| 509 |
+
check_real_value(ncu._arg, ncu.PZERO, -1, 0.5 * np.pi, False)
|
| 510 |
+
check_real_value(ncu._arg, ncu.NZERO, -1, -0.5 * np.pi, False)
|
| 511 |
+
|
| 512 |
+
#def test_branch_cuts(self):
|
| 513 |
+
# _check_branch_cut(ncu._arg, -1, 1j, -1, 1)
|
| 514 |
+
|
| 515 |
+
def test_special_values(self):
|
| 516 |
+
# carg(-np.inf +- yi) returns +-pi for finite y > 0
|
| 517 |
+
check_real_value(ncu._arg, -np.inf, 1, np.pi, False)
|
| 518 |
+
check_real_value(ncu._arg, -np.inf, -1, -np.pi, False)
|
| 519 |
+
|
| 520 |
+
# carg(np.inf +- yi) returns +-0 for finite y > 0
|
| 521 |
+
check_real_value(ncu._arg, np.inf, 1, ncu.PZERO, False)
|
| 522 |
+
check_real_value(ncu._arg, np.inf, -1, ncu.NZERO, False)
|
| 523 |
+
|
| 524 |
+
# carg(x +- np.infi) returns +-pi/2 for finite x
|
| 525 |
+
check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False)
|
| 526 |
+
check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False)
|
| 527 |
+
|
| 528 |
+
# carg(-np.inf +- np.infi) returns +-3pi/4
|
| 529 |
+
check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False)
|
| 530 |
+
check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False)
|
| 531 |
+
|
| 532 |
+
# carg(np.inf +- np.infi) returns +-pi/4
|
| 533 |
+
check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False)
|
| 534 |
+
check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False)
|
| 535 |
+
|
| 536 |
+
# carg(x + yi) returns np.nan if x or y is nan
|
| 537 |
+
check_real_value(ncu._arg, np.nan, 0, np.nan, False)
|
| 538 |
+
check_real_value(ncu._arg, 0, np.nan, np.nan, False)
|
| 539 |
+
|
| 540 |
+
check_real_value(ncu._arg, np.nan, np.inf, np.nan, False)
|
| 541 |
+
check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
def check_real_value(f, x1, y1, x, exact=True):
|
| 545 |
+
z1 = np.array([complex(x1, y1)])
|
| 546 |
+
if exact:
|
| 547 |
+
assert_equal(f(z1), x)
|
| 548 |
+
else:
|
| 549 |
+
assert_almost_equal(f(z1), x)
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
def check_complex_value(f, x1, y1, x2, y2, exact=True):
|
| 553 |
+
z1 = np.array([complex(x1, y1)])
|
| 554 |
+
z2 = complex(x2, y2)
|
| 555 |
+
with np.errstate(invalid='ignore'):
|
| 556 |
+
if exact:
|
| 557 |
+
assert_equal(f(z1), z2)
|
| 558 |
+
else:
|
| 559 |
+
assert_almost_equal(f(z1), z2)
|
| 560 |
+
|
| 561 |
+
class TestSpecialComplexAVX:
|
| 562 |
+
@pytest.mark.parametrize("stride", [-4, -2, -1, 1, 2, 4])
|
| 563 |
+
@pytest.mark.parametrize("astype", [np.complex64, np.complex128])
|
| 564 |
+
def test_array(self, stride, astype):
|
| 565 |
+
nan = np.nan
|
| 566 |
+
inf = np.inf
|
| 567 |
+
arr = np.array([complex(nan, nan),
|
| 568 |
+
complex(nan, inf),
|
| 569 |
+
complex(inf, nan),
|
| 570 |
+
complex(inf, inf),
|
| 571 |
+
complex(0., inf),
|
| 572 |
+
complex(inf, 0.),
|
| 573 |
+
complex(0., 0.),
|
| 574 |
+
complex(0., nan),
|
| 575 |
+
complex(nan, 0.)], dtype=astype)
|
| 576 |
+
abs_true = np.array([nan, inf, inf, inf, inf, inf, 0., nan, nan],
|
| 577 |
+
dtype=arr.real.dtype)
|
| 578 |
+
sq_true = np.array([complex(nan, nan),
|
| 579 |
+
complex(nan, nan),
|
| 580 |
+
complex(nan, nan),
|
| 581 |
+
complex(nan, inf),
|
| 582 |
+
complex(-inf, nan),
|
| 583 |
+
complex(inf, nan),
|
| 584 |
+
complex(0., 0.),
|
| 585 |
+
complex(nan, nan),
|
| 586 |
+
complex(nan, nan)], dtype=astype)
|
| 587 |
+
with np.errstate(invalid='ignore'):
|
| 588 |
+
assert_equal(np.abs(arr[::stride]), abs_true[::stride])
|
| 589 |
+
assert_equal(np.square(arr[::stride]), sq_true[::stride])
|
| 590 |
+
|
| 591 |
+
class TestComplexAbsoluteAVX:
|
| 592 |
+
@pytest.mark.parametrize("arraysize",
|
| 593 |
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 18, 19])
|
| 594 |
+
@pytest.mark.parametrize("stride", [-4, -3, -2, -1, 1, 2, 3, 4])
|
| 595 |
+
@pytest.mark.parametrize("astype", [np.complex64, np.complex128])
|
| 596 |
+
# test to ensure masking and strides work as intended in the AVX implementation
|
| 597 |
+
def test_array(self, arraysize, stride, astype):
|
| 598 |
+
arr = np.ones(arraysize, dtype=astype)
|
| 599 |
+
abs_true = np.ones(arraysize, dtype=arr.real.dtype)
|
| 600 |
+
assert_equal(np.abs(arr[::stride]), abs_true[::stride])
|
| 601 |
+
|
| 602 |
+
# Testcase taken as is from https://github.com/numpy/numpy/issues/16660
|
| 603 |
+
class TestComplexAbsoluteMixedDTypes:
|
| 604 |
+
@pytest.mark.parametrize("stride", [-4, -3, -2, -1, 1, 2, 3, 4])
|
| 605 |
+
@pytest.mark.parametrize("astype", [np.complex64, np.complex128])
|
| 606 |
+
@pytest.mark.parametrize("func", ['abs', 'square', 'conjugate'])
|
| 607 |
+
def test_array(self, stride, astype, func):
|
| 608 |
+
dtype = [('template_id', '<i8'), ('bank_chisq', '<f4'),
|
| 609 |
+
('bank_chisq_dof', '<i8'), ('chisq', '<f4'), ('chisq_dof', '<i8'),
|
| 610 |
+
('cont_chisq', '<f4'), ('psd_var_val', '<f4'), ('sg_chisq', '<f4'),
|
| 611 |
+
('mycomplex', astype), ('time_index', '<i8')]
|
| 612 |
+
vec = np.array([
|
| 613 |
+
(0, 0., 0, -31.666483, 200, 0., 0., 1. , 3.0 + 4.0j , 613090), # noqa: E203,E501
|
| 614 |
+
(1, 0., 0, 260.91525 , 42, 0., 0., 1. , 5.0 + 12.0j , 787315), # noqa: E203,E501
|
| 615 |
+
(1, 0., 0, 52.15155 , 42, 0., 0., 1. , 8.0 + 15.0j , 806641), # noqa: E203,E501
|
| 616 |
+
(1, 0., 0, 52.430195, 42, 0., 0., 1. , 7.0 + 24.0j , 1363540), # noqa: E203,E501
|
| 617 |
+
(2, 0., 0, 304.43646 , 58, 0., 0., 1. , 20.0 + 21.0j, 787323), # noqa: E203,E501
|
| 618 |
+
(3, 0., 0, 299.42108 , 52, 0., 0., 1. , 12.0 + 35.0j, 787332), # noqa: E203,E501
|
| 619 |
+
(4, 0., 0, 39.4836 , 28, 0., 0., 9.182192, 9.0 + 40.0j , 787304), # noqa: E203,E501
|
| 620 |
+
(4, 0., 0, 76.83787 , 28, 0., 0., 1. , 28.0 + 45.0j, 1321869), # noqa: E203,E501
|
| 621 |
+
(5, 0., 0, 143.26366 , 24, 0., 0., 10.996129, 11.0 + 60.0j, 787299)], # noqa: E203,E501
|
| 622 |
+
dtype=dtype)
|
| 623 |
+
myfunc = getattr(np, func)
|
| 624 |
+
a = vec['mycomplex']
|
| 625 |
+
g = myfunc(a[::stride])
|
| 626 |
+
|
| 627 |
+
b = vec['mycomplex'].copy()
|
| 628 |
+
h = myfunc(b[::stride])
|
| 629 |
+
|
| 630 |
+
assert_array_max_ulp(h.real, g.real, 1)
|
| 631 |
+
assert_array_max_ulp(h.imag, g.imag, 1)
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/tests/test_unicode.py
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import numpy as np
|
| 3 |
+
from numpy.testing import assert_, assert_array_equal, assert_equal
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def buffer_length(arr):
|
| 7 |
+
if isinstance(arr, str):
|
| 8 |
+
if not arr:
|
| 9 |
+
charmax = 0
|
| 10 |
+
else:
|
| 11 |
+
charmax = max(ord(c) for c in arr)
|
| 12 |
+
if charmax < 256:
|
| 13 |
+
size = 1
|
| 14 |
+
elif charmax < 65536:
|
| 15 |
+
size = 2
|
| 16 |
+
else:
|
| 17 |
+
size = 4
|
| 18 |
+
return size * len(arr)
|
| 19 |
+
v = memoryview(arr)
|
| 20 |
+
if v.shape is None:
|
| 21 |
+
return len(v) * v.itemsize
|
| 22 |
+
else:
|
| 23 |
+
return np.prod(v.shape) * v.itemsize
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# In both cases below we need to make sure that the byte swapped value (as
|
| 27 |
+
# UCS4) is still a valid unicode:
|
| 28 |
+
# Value that can be represented in UCS2 interpreters
|
| 29 |
+
ucs2_value = '\u0900'
|
| 30 |
+
# Value that cannot be represented in UCS2 interpreters (but can in UCS4)
|
| 31 |
+
ucs4_value = '\U00100900'
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_string_cast():
|
| 35 |
+
str_arr = np.array(["1234", "1234\0\0"], dtype='S')
|
| 36 |
+
uni_arr1 = str_arr.astype('>U')
|
| 37 |
+
uni_arr2 = str_arr.astype('<U')
|
| 38 |
+
|
| 39 |
+
assert_array_equal(str_arr != uni_arr1, np.ones(2, dtype=bool))
|
| 40 |
+
assert_array_equal(uni_arr1 != str_arr, np.ones(2, dtype=bool))
|
| 41 |
+
assert_array_equal(str_arr == uni_arr1, np.zeros(2, dtype=bool))
|
| 42 |
+
assert_array_equal(uni_arr1 == str_arr, np.zeros(2, dtype=bool))
|
| 43 |
+
|
| 44 |
+
assert_array_equal(uni_arr1, uni_arr2)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
############################################################
|
| 48 |
+
# Creation tests
|
| 49 |
+
############################################################
|
| 50 |
+
|
| 51 |
+
class CreateZeros:
|
| 52 |
+
"""Check the creation of zero-valued arrays"""
|
| 53 |
+
|
| 54 |
+
def content_check(self, ua, ua_scalar, nbytes):
|
| 55 |
+
|
| 56 |
+
# Check the length of the unicode base type
|
| 57 |
+
assert_(int(ua.dtype.str[2:]) == self.ulen)
|
| 58 |
+
# Check the length of the data buffer
|
| 59 |
+
assert_(buffer_length(ua) == nbytes)
|
| 60 |
+
# Small check that data in array element is ok
|
| 61 |
+
assert_(ua_scalar == '')
|
| 62 |
+
# Encode to ascii and double check
|
| 63 |
+
assert_(ua_scalar.encode('ascii') == b'')
|
| 64 |
+
# Check buffer lengths for scalars
|
| 65 |
+
assert_(buffer_length(ua_scalar) == 0)
|
| 66 |
+
|
| 67 |
+
def test_zeros0D(self):
|
| 68 |
+
# Check creation of 0-dimensional objects
|
| 69 |
+
ua = np.zeros((), dtype=f'U{self.ulen}')
|
| 70 |
+
self.content_check(ua, ua[()], 4 * self.ulen)
|
| 71 |
+
|
| 72 |
+
def test_zerosSD(self):
|
| 73 |
+
# Check creation of single-dimensional objects
|
| 74 |
+
ua = np.zeros((2,), dtype=f'U{self.ulen}')
|
| 75 |
+
self.content_check(ua, ua[0], 4 * self.ulen * 2)
|
| 76 |
+
self.content_check(ua, ua[1], 4 * self.ulen * 2)
|
| 77 |
+
|
| 78 |
+
def test_zerosMD(self):
|
| 79 |
+
# Check creation of multi-dimensional objects
|
| 80 |
+
ua = np.zeros((2, 3, 4), dtype=f'U{self.ulen}')
|
| 81 |
+
self.content_check(ua, ua[0, 0, 0], 4 * self.ulen * 2 * 3 * 4)
|
| 82 |
+
self.content_check(ua, ua[-1, -1, -1], 4 * self.ulen * 2 * 3 * 4)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class TestCreateZeros_1(CreateZeros):
|
| 86 |
+
"""Check the creation of zero-valued arrays (size 1)"""
|
| 87 |
+
ulen = 1
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class TestCreateZeros_2(CreateZeros):
|
| 91 |
+
"""Check the creation of zero-valued arrays (size 2)"""
|
| 92 |
+
ulen = 2
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class TestCreateZeros_1009(CreateZeros):
|
| 96 |
+
"""Check the creation of zero-valued arrays (size 1009)"""
|
| 97 |
+
ulen = 1009
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class CreateValues:
|
| 101 |
+
"""Check the creation of unicode arrays with values"""
|
| 102 |
+
|
| 103 |
+
def content_check(self, ua, ua_scalar, nbytes):
|
| 104 |
+
|
| 105 |
+
# Check the length of the unicode base type
|
| 106 |
+
assert_(int(ua.dtype.str[2:]) == self.ulen)
|
| 107 |
+
# Check the length of the data buffer
|
| 108 |
+
assert_(buffer_length(ua) == nbytes)
|
| 109 |
+
# Small check that data in array element is ok
|
| 110 |
+
assert_(ua_scalar == self.ucs_value * self.ulen)
|
| 111 |
+
# Encode to UTF-8 and double check
|
| 112 |
+
assert_(ua_scalar.encode('utf-8') ==
|
| 113 |
+
(self.ucs_value * self.ulen).encode('utf-8'))
|
| 114 |
+
# Check buffer lengths for scalars
|
| 115 |
+
if self.ucs_value == ucs4_value:
|
| 116 |
+
# In UCS2, the \U0010FFFF will be represented using a
|
| 117 |
+
# surrogate *pair*
|
| 118 |
+
assert_(buffer_length(ua_scalar) == 2 * 2 * self.ulen)
|
| 119 |
+
else:
|
| 120 |
+
# In UCS2, the \uFFFF will be represented using a
|
| 121 |
+
# regular 2-byte word
|
| 122 |
+
assert_(buffer_length(ua_scalar) == 2 * self.ulen)
|
| 123 |
+
|
| 124 |
+
def test_values0D(self):
|
| 125 |
+
# Check creation of 0-dimensional objects with values
|
| 126 |
+
ua = np.array(self.ucs_value * self.ulen, dtype=f'U{self.ulen}')
|
| 127 |
+
self.content_check(ua, ua[()], 4 * self.ulen)
|
| 128 |
+
|
| 129 |
+
def test_valuesSD(self):
|
| 130 |
+
# Check creation of single-dimensional objects with values
|
| 131 |
+
ua = np.array([self.ucs_value * self.ulen] * 2, dtype=f'U{self.ulen}')
|
| 132 |
+
self.content_check(ua, ua[0], 4 * self.ulen * 2)
|
| 133 |
+
self.content_check(ua, ua[1], 4 * self.ulen * 2)
|
| 134 |
+
|
| 135 |
+
def test_valuesMD(self):
|
| 136 |
+
# Check creation of multi-dimensional objects with values
|
| 137 |
+
data = [[[self.ucs_value * self.ulen] * 2] * 3] * 4
|
| 138 |
+
ua = np.array(data, dtype=f'U{self.ulen}')
|
| 139 |
+
self.content_check(ua, ua[0, 0, 0], 4 * self.ulen * 2 * 3 * 4)
|
| 140 |
+
self.content_check(ua, ua[-1, -1, -1], 4 * self.ulen * 2 * 3 * 4)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class TestCreateValues_1_UCS2(CreateValues):
|
| 144 |
+
"""Check the creation of valued arrays (size 1, UCS2 values)"""
|
| 145 |
+
ulen = 1
|
| 146 |
+
ucs_value = ucs2_value
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
class TestCreateValues_1_UCS4(CreateValues):
|
| 150 |
+
"""Check the creation of valued arrays (size 1, UCS4 values)"""
|
| 151 |
+
ulen = 1
|
| 152 |
+
ucs_value = ucs4_value
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class TestCreateValues_2_UCS2(CreateValues):
|
| 156 |
+
"""Check the creation of valued arrays (size 2, UCS2 values)"""
|
| 157 |
+
ulen = 2
|
| 158 |
+
ucs_value = ucs2_value
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
class TestCreateValues_2_UCS4(CreateValues):
|
| 162 |
+
"""Check the creation of valued arrays (size 2, UCS4 values)"""
|
| 163 |
+
ulen = 2
|
| 164 |
+
ucs_value = ucs4_value
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
class TestCreateValues_1009_UCS2(CreateValues):
|
| 168 |
+
"""Check the creation of valued arrays (size 1009, UCS2 values)"""
|
| 169 |
+
ulen = 1009
|
| 170 |
+
ucs_value = ucs2_value
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class TestCreateValues_1009_UCS4(CreateValues):
|
| 174 |
+
"""Check the creation of valued arrays (size 1009, UCS4 values)"""
|
| 175 |
+
ulen = 1009
|
| 176 |
+
ucs_value = ucs4_value
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
############################################################
|
| 180 |
+
# Assignment tests
|
| 181 |
+
############################################################
|
| 182 |
+
|
| 183 |
+
class AssignValues:
|
| 184 |
+
"""Check the assignment of unicode arrays with values"""
|
| 185 |
+
|
| 186 |
+
def content_check(self, ua, ua_scalar, nbytes):
|
| 187 |
+
|
| 188 |
+
# Check the length of the unicode base type
|
| 189 |
+
assert_(int(ua.dtype.str[2:]) == self.ulen)
|
| 190 |
+
# Check the length of the data buffer
|
| 191 |
+
assert_(buffer_length(ua) == nbytes)
|
| 192 |
+
# Small check that data in array element is ok
|
| 193 |
+
assert_(ua_scalar == self.ucs_value * self.ulen)
|
| 194 |
+
# Encode to UTF-8 and double check
|
| 195 |
+
assert_(ua_scalar.encode('utf-8') ==
|
| 196 |
+
(self.ucs_value * self.ulen).encode('utf-8'))
|
| 197 |
+
# Check buffer lengths for scalars
|
| 198 |
+
if self.ucs_value == ucs4_value:
|
| 199 |
+
# In UCS2, the \U0010FFFF will be represented using a
|
| 200 |
+
# surrogate *pair*
|
| 201 |
+
assert_(buffer_length(ua_scalar) == 2 * 2 * self.ulen)
|
| 202 |
+
else:
|
| 203 |
+
# In UCS2, the \uFFFF will be represented using a
|
| 204 |
+
# regular 2-byte word
|
| 205 |
+
assert_(buffer_length(ua_scalar) == 2 * self.ulen)
|
| 206 |
+
|
| 207 |
+
def test_values0D(self):
|
| 208 |
+
# Check assignment of 0-dimensional objects with values
|
| 209 |
+
ua = np.zeros((), dtype=f'U{self.ulen}')
|
| 210 |
+
ua[()] = self.ucs_value * self.ulen
|
| 211 |
+
self.content_check(ua, ua[()], 4 * self.ulen)
|
| 212 |
+
|
| 213 |
+
def test_valuesSD(self):
|
| 214 |
+
# Check assignment of single-dimensional objects with values
|
| 215 |
+
ua = np.zeros((2,), dtype=f'U{self.ulen}')
|
| 216 |
+
ua[0] = self.ucs_value * self.ulen
|
| 217 |
+
self.content_check(ua, ua[0], 4 * self.ulen * 2)
|
| 218 |
+
ua[1] = self.ucs_value * self.ulen
|
| 219 |
+
self.content_check(ua, ua[1], 4 * self.ulen * 2)
|
| 220 |
+
|
| 221 |
+
def test_valuesMD(self):
|
| 222 |
+
# Check assignment of multi-dimensional objects with values
|
| 223 |
+
ua = np.zeros((2, 3, 4), dtype=f'U{self.ulen}')
|
| 224 |
+
ua[0, 0, 0] = self.ucs_value * self.ulen
|
| 225 |
+
self.content_check(ua, ua[0, 0, 0], 4 * self.ulen * 2 * 3 * 4)
|
| 226 |
+
ua[-1, -1, -1] = self.ucs_value * self.ulen
|
| 227 |
+
self.content_check(ua, ua[-1, -1, -1], 4 * self.ulen * 2 * 3 * 4)
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
class TestAssignValues_1_UCS2(AssignValues):
|
| 231 |
+
"""Check the assignment of valued arrays (size 1, UCS2 values)"""
|
| 232 |
+
ulen = 1
|
| 233 |
+
ucs_value = ucs2_value
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
class TestAssignValues_1_UCS4(AssignValues):
|
| 237 |
+
"""Check the assignment of valued arrays (size 1, UCS4 values)"""
|
| 238 |
+
ulen = 1
|
| 239 |
+
ucs_value = ucs4_value
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
class TestAssignValues_2_UCS2(AssignValues):
|
| 243 |
+
"""Check the assignment of valued arrays (size 2, UCS2 values)"""
|
| 244 |
+
ulen = 2
|
| 245 |
+
ucs_value = ucs2_value
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
class TestAssignValues_2_UCS4(AssignValues):
|
| 249 |
+
"""Check the assignment of valued arrays (size 2, UCS4 values)"""
|
| 250 |
+
ulen = 2
|
| 251 |
+
ucs_value = ucs4_value
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
class TestAssignValues_1009_UCS2(AssignValues):
|
| 255 |
+
"""Check the assignment of valued arrays (size 1009, UCS2 values)"""
|
| 256 |
+
ulen = 1009
|
| 257 |
+
ucs_value = ucs2_value
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class TestAssignValues_1009_UCS4(AssignValues):
|
| 261 |
+
"""Check the assignment of valued arrays (size 1009, UCS4 values)"""
|
| 262 |
+
ulen = 1009
|
| 263 |
+
ucs_value = ucs4_value
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
############################################################
|
| 267 |
+
# Byteorder tests
|
| 268 |
+
############################################################
|
| 269 |
+
|
| 270 |
+
class ByteorderValues:
|
| 271 |
+
"""Check the byteorder of unicode arrays in round-trip conversions"""
|
| 272 |
+
|
| 273 |
+
def test_values0D(self):
|
| 274 |
+
# Check byteorder of 0-dimensional objects
|
| 275 |
+
ua = np.array(self.ucs_value * self.ulen, dtype=f'U{self.ulen}')
|
| 276 |
+
ua2 = ua.view(ua.dtype.newbyteorder())
|
| 277 |
+
# This changes the interpretation of the data region (but not the
|
| 278 |
+
# actual data), therefore the returned scalars are not
|
| 279 |
+
# the same (they are byte-swapped versions of each other).
|
| 280 |
+
assert_(ua[()] != ua2[()])
|
| 281 |
+
ua3 = ua2.view(ua2.dtype.newbyteorder())
|
| 282 |
+
# Arrays must be equal after the round-trip
|
| 283 |
+
assert_equal(ua, ua3)
|
| 284 |
+
|
| 285 |
+
def test_valuesSD(self):
|
| 286 |
+
# Check byteorder of single-dimensional objects
|
| 287 |
+
ua = np.array([self.ucs_value * self.ulen] * 2, dtype=f'U{self.ulen}')
|
| 288 |
+
ua2 = ua.view(ua.dtype.newbyteorder())
|
| 289 |
+
assert_((ua != ua2).all())
|
| 290 |
+
assert_(ua[-1] != ua2[-1])
|
| 291 |
+
ua3 = ua2.view(ua2.dtype.newbyteorder())
|
| 292 |
+
# Arrays must be equal after the round-trip
|
| 293 |
+
assert_equal(ua, ua3)
|
| 294 |
+
|
| 295 |
+
def test_valuesMD(self):
|
| 296 |
+
# Check byteorder of multi-dimensional objects
|
| 297 |
+
ua = np.array([[[self.ucs_value * self.ulen] * 2] * 3] * 4,
|
| 298 |
+
dtype=f'U{self.ulen}')
|
| 299 |
+
ua2 = ua.view(ua.dtype.newbyteorder())
|
| 300 |
+
assert_((ua != ua2).all())
|
| 301 |
+
assert_(ua[-1, -1, -1] != ua2[-1, -1, -1])
|
| 302 |
+
ua3 = ua2.view(ua2.dtype.newbyteorder())
|
| 303 |
+
# Arrays must be equal after the round-trip
|
| 304 |
+
assert_equal(ua, ua3)
|
| 305 |
+
|
| 306 |
+
def test_values_cast(self):
|
| 307 |
+
# Check byteorder of when casting the array for a strided and
|
| 308 |
+
# contiguous array:
|
| 309 |
+
test1 = np.array([self.ucs_value * self.ulen] * 2, dtype=f'U{self.ulen}')
|
| 310 |
+
test2 = np.repeat(test1, 2)[::2]
|
| 311 |
+
for ua in (test1, test2):
|
| 312 |
+
ua2 = ua.astype(dtype=ua.dtype.newbyteorder())
|
| 313 |
+
assert_((ua == ua2).all())
|
| 314 |
+
assert_(ua[-1] == ua2[-1])
|
| 315 |
+
ua3 = ua2.astype(dtype=ua.dtype)
|
| 316 |
+
# Arrays must be equal after the round-trip
|
| 317 |
+
assert_equal(ua, ua3)
|
| 318 |
+
|
| 319 |
+
def test_values_updowncast(self):
|
| 320 |
+
# Check byteorder of when casting the array to a longer and shorter
|
| 321 |
+
# string length for strided and contiguous arrays
|
| 322 |
+
test1 = np.array([self.ucs_value * self.ulen] * 2, dtype=f'U{self.ulen}')
|
| 323 |
+
test2 = np.repeat(test1, 2)[::2]
|
| 324 |
+
for ua in (test1, test2):
|
| 325 |
+
# Cast to a longer type with zero padding
|
| 326 |
+
longer_type = np.dtype(f'U{self.ulen + 1}').newbyteorder()
|
| 327 |
+
ua2 = ua.astype(dtype=longer_type)
|
| 328 |
+
assert_((ua == ua2).all())
|
| 329 |
+
assert_(ua[-1] == ua2[-1])
|
| 330 |
+
# Cast back again with truncating:
|
| 331 |
+
ua3 = ua2.astype(dtype=ua.dtype)
|
| 332 |
+
# Arrays must be equal after the round-trip
|
| 333 |
+
assert_equal(ua, ua3)
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
class TestByteorder_1_UCS2(ByteorderValues):
|
| 337 |
+
"""Check the byteorder in unicode (size 1, UCS2 values)"""
|
| 338 |
+
ulen = 1
|
| 339 |
+
ucs_value = ucs2_value
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
class TestByteorder_1_UCS4(ByteorderValues):
|
| 343 |
+
"""Check the byteorder in unicode (size 1, UCS4 values)"""
|
| 344 |
+
ulen = 1
|
| 345 |
+
ucs_value = ucs4_value
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
class TestByteorder_2_UCS2(ByteorderValues):
|
| 349 |
+
"""Check the byteorder in unicode (size 2, UCS2 values)"""
|
| 350 |
+
ulen = 2
|
| 351 |
+
ucs_value = ucs2_value
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
class TestByteorder_2_UCS4(ByteorderValues):
|
| 355 |
+
"""Check the byteorder in unicode (size 2, UCS4 values)"""
|
| 356 |
+
ulen = 2
|
| 357 |
+
ucs_value = ucs4_value
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
class TestByteorder_1009_UCS2(ByteorderValues):
|
| 361 |
+
"""Check the byteorder in unicode (size 1009, UCS2 values)"""
|
| 362 |
+
ulen = 1009
|
| 363 |
+
ucs_value = ucs2_value
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
class TestByteorder_1009_UCS4(ByteorderValues):
|
| 367 |
+
"""Check the byteorder in unicode (size 1009, UCS4 values)"""
|
| 368 |
+
ulen = 1009
|
| 369 |
+
ucs_value = ucs4_value
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/umath.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Create the numpy._core.umath namespace for backward compatibility. In v1.16
|
| 3 |
+
the multiarray and umath c-extension modules were merged into a single
|
| 4 |
+
_multiarray_umath extension module. So we replicate the old namespace
|
| 5 |
+
by importing from the extension module.
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import numpy
|
| 10 |
+
|
| 11 |
+
from . import _multiarray_umath
|
| 12 |
+
from ._multiarray_umath import *
|
| 13 |
+
|
| 14 |
+
# These imports are needed for backward compatibility,
|
| 15 |
+
# do not change them. issue gh-11862
|
| 16 |
+
# _ones_like is semi-public, on purpose not added to __all__
|
| 17 |
+
# These imports are needed for the strip & replace implementations
|
| 18 |
+
from ._multiarray_umath import (
|
| 19 |
+
_UFUNC_API,
|
| 20 |
+
_add_newdoc_ufunc,
|
| 21 |
+
_center,
|
| 22 |
+
_expandtabs,
|
| 23 |
+
_expandtabs_length,
|
| 24 |
+
_extobj_contextvar,
|
| 25 |
+
_get_extobj_dict,
|
| 26 |
+
_ljust,
|
| 27 |
+
_lstrip_chars,
|
| 28 |
+
_lstrip_whitespace,
|
| 29 |
+
_make_extobj,
|
| 30 |
+
_ones_like,
|
| 31 |
+
_partition,
|
| 32 |
+
_partition_index,
|
| 33 |
+
_replace,
|
| 34 |
+
_rjust,
|
| 35 |
+
_rpartition,
|
| 36 |
+
_rpartition_index,
|
| 37 |
+
_rstrip_chars,
|
| 38 |
+
_rstrip_whitespace,
|
| 39 |
+
_slice,
|
| 40 |
+
_strip_chars,
|
| 41 |
+
_strip_whitespace,
|
| 42 |
+
_zfill,
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
__all__ = [
|
| 46 |
+
'absolute', 'add',
|
| 47 |
+
'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh',
|
| 48 |
+
'bitwise_and', 'bitwise_or', 'bitwise_xor', 'cbrt', 'ceil', 'conj',
|
| 49 |
+
'conjugate', 'copysign', 'cos', 'cosh', 'bitwise_count', 'deg2rad',
|
| 50 |
+
'degrees', 'divide', 'divmod', 'e', 'equal', 'euler_gamma', 'exp', 'exp2',
|
| 51 |
+
'expm1', 'fabs', 'floor', 'floor_divide', 'float_power', 'fmax', 'fmin',
|
| 52 |
+
'fmod', 'frexp', 'frompyfunc', 'gcd', 'greater', 'greater_equal',
|
| 53 |
+
'heaviside', 'hypot', 'invert', 'isfinite', 'isinf', 'isnan', 'isnat',
|
| 54 |
+
'lcm', 'ldexp', 'left_shift', 'less', 'less_equal', 'log', 'log10',
|
| 55 |
+
'log1p', 'log2', 'logaddexp', 'logaddexp2', 'logical_and', 'logical_not',
|
| 56 |
+
'logical_or', 'logical_xor', 'matmul', 'matvec', 'maximum', 'minimum', 'mod',
|
| 57 |
+
'modf', 'multiply', 'negative', 'nextafter', 'not_equal', 'pi', 'positive',
|
| 58 |
+
'power', 'rad2deg', 'radians', 'reciprocal', 'remainder', 'right_shift',
|
| 59 |
+
'rint', 'sign', 'signbit', 'sin', 'sinh', 'spacing', 'sqrt', 'square',
|
| 60 |
+
'subtract', 'tan', 'tanh', 'true_divide', 'trunc', 'vecdot', 'vecmat']
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_core/umath.pyi
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import contextvars
|
| 2 |
+
from _typeshed import SupportsWrite
|
| 3 |
+
from collections.abc import Callable
|
| 4 |
+
from typing import Any, Final, Literal, TypeAlias, TypedDict, Unpack, type_check_only
|
| 5 |
+
from typing_extensions import CapsuleType
|
| 6 |
+
|
| 7 |
+
from numpy import (
|
| 8 |
+
absolute,
|
| 9 |
+
add,
|
| 10 |
+
arccos,
|
| 11 |
+
arccosh,
|
| 12 |
+
arcsin,
|
| 13 |
+
arcsinh,
|
| 14 |
+
arctan,
|
| 15 |
+
arctan2,
|
| 16 |
+
arctanh,
|
| 17 |
+
bitwise_and,
|
| 18 |
+
bitwise_count,
|
| 19 |
+
bitwise_or,
|
| 20 |
+
bitwise_xor,
|
| 21 |
+
cbrt,
|
| 22 |
+
ceil,
|
| 23 |
+
conj,
|
| 24 |
+
conjugate,
|
| 25 |
+
copysign,
|
| 26 |
+
cos,
|
| 27 |
+
cosh,
|
| 28 |
+
deg2rad,
|
| 29 |
+
degrees,
|
| 30 |
+
divide,
|
| 31 |
+
divmod,
|
| 32 |
+
e,
|
| 33 |
+
equal,
|
| 34 |
+
euler_gamma,
|
| 35 |
+
exp,
|
| 36 |
+
exp2,
|
| 37 |
+
expm1,
|
| 38 |
+
fabs,
|
| 39 |
+
float_power,
|
| 40 |
+
floor,
|
| 41 |
+
floor_divide,
|
| 42 |
+
fmax,
|
| 43 |
+
fmin,
|
| 44 |
+
fmod,
|
| 45 |
+
frexp,
|
| 46 |
+
frompyfunc,
|
| 47 |
+
gcd,
|
| 48 |
+
greater,
|
| 49 |
+
greater_equal,
|
| 50 |
+
heaviside,
|
| 51 |
+
hypot,
|
| 52 |
+
invert,
|
| 53 |
+
isfinite,
|
| 54 |
+
isinf,
|
| 55 |
+
isnan,
|
| 56 |
+
isnat,
|
| 57 |
+
lcm,
|
| 58 |
+
ldexp,
|
| 59 |
+
left_shift,
|
| 60 |
+
less,
|
| 61 |
+
less_equal,
|
| 62 |
+
log,
|
| 63 |
+
log1p,
|
| 64 |
+
log2,
|
| 65 |
+
log10,
|
| 66 |
+
logaddexp,
|
| 67 |
+
logaddexp2,
|
| 68 |
+
logical_and,
|
| 69 |
+
logical_not,
|
| 70 |
+
logical_or,
|
| 71 |
+
logical_xor,
|
| 72 |
+
matmul,
|
| 73 |
+
matvec,
|
| 74 |
+
maximum,
|
| 75 |
+
minimum,
|
| 76 |
+
mod,
|
| 77 |
+
modf,
|
| 78 |
+
multiply,
|
| 79 |
+
negative,
|
| 80 |
+
nextafter,
|
| 81 |
+
not_equal,
|
| 82 |
+
pi,
|
| 83 |
+
positive,
|
| 84 |
+
power,
|
| 85 |
+
rad2deg,
|
| 86 |
+
radians,
|
| 87 |
+
reciprocal,
|
| 88 |
+
remainder,
|
| 89 |
+
right_shift,
|
| 90 |
+
rint,
|
| 91 |
+
sign,
|
| 92 |
+
signbit,
|
| 93 |
+
sin,
|
| 94 |
+
sinh,
|
| 95 |
+
spacing,
|
| 96 |
+
sqrt,
|
| 97 |
+
square,
|
| 98 |
+
subtract,
|
| 99 |
+
tan,
|
| 100 |
+
tanh,
|
| 101 |
+
true_divide,
|
| 102 |
+
trunc,
|
| 103 |
+
vecdot,
|
| 104 |
+
vecmat,
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
__all__ = [
|
| 108 |
+
"absolute",
|
| 109 |
+
"add",
|
| 110 |
+
"arccos",
|
| 111 |
+
"arccosh",
|
| 112 |
+
"arcsin",
|
| 113 |
+
"arcsinh",
|
| 114 |
+
"arctan",
|
| 115 |
+
"arctan2",
|
| 116 |
+
"arctanh",
|
| 117 |
+
"bitwise_and",
|
| 118 |
+
"bitwise_count",
|
| 119 |
+
"bitwise_or",
|
| 120 |
+
"bitwise_xor",
|
| 121 |
+
"cbrt",
|
| 122 |
+
"ceil",
|
| 123 |
+
"conj",
|
| 124 |
+
"conjugate",
|
| 125 |
+
"copysign",
|
| 126 |
+
"cos",
|
| 127 |
+
"cosh",
|
| 128 |
+
"deg2rad",
|
| 129 |
+
"degrees",
|
| 130 |
+
"divide",
|
| 131 |
+
"divmod",
|
| 132 |
+
"e",
|
| 133 |
+
"equal",
|
| 134 |
+
"euler_gamma",
|
| 135 |
+
"exp",
|
| 136 |
+
"exp2",
|
| 137 |
+
"expm1",
|
| 138 |
+
"fabs",
|
| 139 |
+
"float_power",
|
| 140 |
+
"floor",
|
| 141 |
+
"floor_divide",
|
| 142 |
+
"fmax",
|
| 143 |
+
"fmin",
|
| 144 |
+
"fmod",
|
| 145 |
+
"frexp",
|
| 146 |
+
"frompyfunc",
|
| 147 |
+
"gcd",
|
| 148 |
+
"greater",
|
| 149 |
+
"greater_equal",
|
| 150 |
+
"heaviside",
|
| 151 |
+
"hypot",
|
| 152 |
+
"invert",
|
| 153 |
+
"isfinite",
|
| 154 |
+
"isinf",
|
| 155 |
+
"isnan",
|
| 156 |
+
"isnat",
|
| 157 |
+
"lcm",
|
| 158 |
+
"ldexp",
|
| 159 |
+
"left_shift",
|
| 160 |
+
"less",
|
| 161 |
+
"less_equal",
|
| 162 |
+
"log",
|
| 163 |
+
"log1p",
|
| 164 |
+
"log2",
|
| 165 |
+
"log10",
|
| 166 |
+
"logaddexp",
|
| 167 |
+
"logaddexp2",
|
| 168 |
+
"logical_and",
|
| 169 |
+
"logical_not",
|
| 170 |
+
"logical_or",
|
| 171 |
+
"logical_xor",
|
| 172 |
+
"matmul",
|
| 173 |
+
"matvec",
|
| 174 |
+
"maximum",
|
| 175 |
+
"minimum",
|
| 176 |
+
"mod",
|
| 177 |
+
"modf",
|
| 178 |
+
"multiply",
|
| 179 |
+
"negative",
|
| 180 |
+
"nextafter",
|
| 181 |
+
"not_equal",
|
| 182 |
+
"pi",
|
| 183 |
+
"positive",
|
| 184 |
+
"power",
|
| 185 |
+
"rad2deg",
|
| 186 |
+
"radians",
|
| 187 |
+
"reciprocal",
|
| 188 |
+
"remainder",
|
| 189 |
+
"right_shift",
|
| 190 |
+
"rint",
|
| 191 |
+
"sign",
|
| 192 |
+
"signbit",
|
| 193 |
+
"sin",
|
| 194 |
+
"sinh",
|
| 195 |
+
"spacing",
|
| 196 |
+
"sqrt",
|
| 197 |
+
"square",
|
| 198 |
+
"subtract",
|
| 199 |
+
"tan",
|
| 200 |
+
"tanh",
|
| 201 |
+
"true_divide",
|
| 202 |
+
"trunc",
|
| 203 |
+
"vecdot",
|
| 204 |
+
"vecmat",
|
| 205 |
+
]
|
| 206 |
+
|
| 207 |
+
###
|
| 208 |
+
|
| 209 |
+
_ErrKind: TypeAlias = Literal["ignore", "warn", "raise", "call", "print", "log"]
|
| 210 |
+
_ErrCall: TypeAlias = Callable[[str, int], Any] | SupportsWrite[str]
|
| 211 |
+
|
| 212 |
+
@type_check_only
|
| 213 |
+
class _ExtOjbDict(TypedDict, total=False):
|
| 214 |
+
divide: _ErrKind
|
| 215 |
+
over: _ErrKind
|
| 216 |
+
under: _ErrKind
|
| 217 |
+
invalid: _ErrKind
|
| 218 |
+
call: _ErrCall | None
|
| 219 |
+
bufsize: int
|
| 220 |
+
|
| 221 |
+
# re-exports from `_core._multiarray_umath` that are used by `_core._ufunc_config`
|
| 222 |
+
|
| 223 |
+
NAN: Final[float] = float("nan")
|
| 224 |
+
PINF: Final[float] = float("+inf")
|
| 225 |
+
NINF: Final[float] = float("-inf")
|
| 226 |
+
PZERO: Final[float] = +0.0
|
| 227 |
+
NZERO: Final[float] = -0.0
|
| 228 |
+
_UFUNC_API: Final[CapsuleType] = ...
|
| 229 |
+
_extobj_contextvar: Final[contextvars.ContextVar[CapsuleType]] = ...
|
| 230 |
+
|
| 231 |
+
def _get_extobj_dict() -> _ExtOjbDict: ...
|
| 232 |
+
def _make_extobj(*, all: _ErrKind = ..., **kwargs: Unpack[_ExtOjbDict]) -> CapsuleType: ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_distributor_init.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" Distributor init file
|
| 2 |
+
|
| 3 |
+
Distributors: you can add custom code here to support particular distributions
|
| 4 |
+
of numpy.
|
| 5 |
+
|
| 6 |
+
For example, this is a good place to put any BLAS/LAPACK initialization code.
|
| 7 |
+
|
| 8 |
+
The numpy standard source distribution will not put code in this file, so you
|
| 9 |
+
can safely replace this file with your own version.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
try:
|
| 13 |
+
from . import _distributor_init_local # noqa: F401
|
| 14 |
+
except ImportError:
|
| 15 |
+
pass
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_distributor_init.pyi
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# intentionally left blank
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_expired_attrs_2_0.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Dict of expired attributes that are discontinued since 2.0 release.
|
| 3 |
+
Each item is associated with a migration note.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
__expired_attributes__ = {
|
| 7 |
+
"geterrobj": "Use the np.errstate context manager instead.",
|
| 8 |
+
"seterrobj": "Use the np.errstate context manager instead.",
|
| 9 |
+
"cast": "Use `np.asarray(arr, dtype=dtype)` instead.",
|
| 10 |
+
"source": "Use `inspect.getsource` instead.",
|
| 11 |
+
"lookfor": "Search NumPy's documentation directly.",
|
| 12 |
+
"who": "Use an IDE variable explorer or `locals()` instead.",
|
| 13 |
+
"fastCopyAndTranspose": "Use `arr.T.copy()` instead.",
|
| 14 |
+
"set_numeric_ops":
|
| 15 |
+
"For the general case, use `PyUFunc_ReplaceLoopBySignature`. "
|
| 16 |
+
"For ndarray subclasses, define the ``__array_ufunc__`` method "
|
| 17 |
+
"and override the relevant ufunc.",
|
| 18 |
+
"NINF": "Use `-np.inf` instead.",
|
| 19 |
+
"PINF": "Use `np.inf` instead.",
|
| 20 |
+
"NZERO": "Use `-0.0` instead.",
|
| 21 |
+
"PZERO": "Use `0.0` instead.",
|
| 22 |
+
"add_newdoc":
|
| 23 |
+
"It's still available as `np.lib.add_newdoc`.",
|
| 24 |
+
"add_docstring":
|
| 25 |
+
"It's still available as `np.lib.add_docstring`.",
|
| 26 |
+
"add_newdoc_ufunc":
|
| 27 |
+
"It's an internal function and doesn't have a replacement.",
|
| 28 |
+
"safe_eval": "Use `ast.literal_eval` instead.",
|
| 29 |
+
"float_": "Use `np.float64` instead.",
|
| 30 |
+
"complex_": "Use `np.complex128` instead.",
|
| 31 |
+
"longfloat": "Use `np.longdouble` instead.",
|
| 32 |
+
"singlecomplex": "Use `np.complex64` instead.",
|
| 33 |
+
"cfloat": "Use `np.complex128` instead.",
|
| 34 |
+
"longcomplex": "Use `np.clongdouble` instead.",
|
| 35 |
+
"clongfloat": "Use `np.clongdouble` instead.",
|
| 36 |
+
"string_": "Use `np.bytes_` instead.",
|
| 37 |
+
"unicode_": "Use `np.str_` instead.",
|
| 38 |
+
"Inf": "Use `np.inf` instead.",
|
| 39 |
+
"Infinity": "Use `np.inf` instead.",
|
| 40 |
+
"NaN": "Use `np.nan` instead.",
|
| 41 |
+
"infty": "Use `np.inf` instead.",
|
| 42 |
+
"issctype": "Use `issubclass(rep, np.generic)` instead.",
|
| 43 |
+
"maximum_sctype":
|
| 44 |
+
"Use a specific dtype instead. You should avoid relying "
|
| 45 |
+
"on any implicit mechanism and select the largest dtype of "
|
| 46 |
+
"a kind explicitly in the code.",
|
| 47 |
+
"obj2sctype": "Use `np.dtype(obj).type` instead.",
|
| 48 |
+
"sctype2char": "Use `np.dtype(obj).char` instead.",
|
| 49 |
+
"sctypes": "Access dtypes explicitly instead.",
|
| 50 |
+
"issubsctype": "Use `np.issubdtype` instead.",
|
| 51 |
+
"set_string_function":
|
| 52 |
+
"Use `np.set_printoptions` instead with a formatter for "
|
| 53 |
+
"custom printing of NumPy objects.",
|
| 54 |
+
"asfarray": "Use `np.asarray` with a proper dtype instead.",
|
| 55 |
+
"issubclass_": "Use `issubclass` builtin instead.",
|
| 56 |
+
"tracemalloc_domain": "It's now available from `np.lib`.",
|
| 57 |
+
"mat": "Use `np.asmatrix` instead.",
|
| 58 |
+
"recfromcsv": "Use `np.genfromtxt` with comma delimiter instead.",
|
| 59 |
+
"recfromtxt": "Use `np.genfromtxt` instead.",
|
| 60 |
+
"deprecate": "Emit `DeprecationWarning` with `warnings.warn` directly, "
|
| 61 |
+
"or use `typing.deprecated`.",
|
| 62 |
+
"deprecate_with_doc": "Emit `DeprecationWarning` with `warnings.warn` "
|
| 63 |
+
"directly, or use `typing.deprecated`.",
|
| 64 |
+
"find_common_type":
|
| 65 |
+
"Use `numpy.promote_types` or `numpy.result_type` instead. "
|
| 66 |
+
"To achieve semantics for the `scalar_types` argument, use "
|
| 67 |
+
"`numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`.",
|
| 68 |
+
"round_": "Use `np.round` instead.",
|
| 69 |
+
"get_array_wrap": "",
|
| 70 |
+
"DataSource": "It's still available as `np.lib.npyio.DataSource`.",
|
| 71 |
+
"nbytes": "Use `np.dtype(<dtype>).itemsize` instead.",
|
| 72 |
+
"byte_bounds": "Now it's available under `np.lib.array_utils.byte_bounds`",
|
| 73 |
+
"compare_chararrays":
|
| 74 |
+
"It's still available as `np.char.compare_chararrays`.",
|
| 75 |
+
"format_parser": "It's still available as `np.rec.format_parser`.",
|
| 76 |
+
"alltrue": "Use `np.all` instead.",
|
| 77 |
+
"sometrue": "Use `np.any` instead.",
|
| 78 |
+
}
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_expired_attrs_2_0.pyi
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Final, TypedDict, final, type_check_only
|
| 2 |
+
|
| 3 |
+
@final
|
| 4 |
+
@type_check_only
|
| 5 |
+
class _ExpiredAttributesType(TypedDict):
|
| 6 |
+
geterrobj: str
|
| 7 |
+
seterrobj: str
|
| 8 |
+
cast: str
|
| 9 |
+
source: str
|
| 10 |
+
lookfor: str
|
| 11 |
+
who: str
|
| 12 |
+
fastCopyAndTranspose: str
|
| 13 |
+
set_numeric_ops: str
|
| 14 |
+
NINF: str
|
| 15 |
+
PINF: str
|
| 16 |
+
NZERO: str
|
| 17 |
+
PZERO: str
|
| 18 |
+
add_newdoc: str
|
| 19 |
+
add_docstring: str
|
| 20 |
+
add_newdoc_ufunc: str
|
| 21 |
+
safe_eval: str
|
| 22 |
+
float_: str
|
| 23 |
+
complex_: str
|
| 24 |
+
longfloat: str
|
| 25 |
+
singlecomplex: str
|
| 26 |
+
cfloat: str
|
| 27 |
+
longcomplex: str
|
| 28 |
+
clongfloat: str
|
| 29 |
+
string_: str
|
| 30 |
+
unicode_: str
|
| 31 |
+
Inf: str
|
| 32 |
+
Infinity: str
|
| 33 |
+
NaN: str
|
| 34 |
+
infty: str
|
| 35 |
+
issctype: str
|
| 36 |
+
maximum_sctype: str
|
| 37 |
+
obj2sctype: str
|
| 38 |
+
sctype2char: str
|
| 39 |
+
sctypes: str
|
| 40 |
+
issubsctype: str
|
| 41 |
+
set_string_function: str
|
| 42 |
+
asfarray: str
|
| 43 |
+
issubclass_: str
|
| 44 |
+
tracemalloc_domain: str
|
| 45 |
+
mat: str
|
| 46 |
+
recfromcsv: str
|
| 47 |
+
recfromtxt: str
|
| 48 |
+
deprecate: str
|
| 49 |
+
deprecate_with_doc: str
|
| 50 |
+
find_common_type: str
|
| 51 |
+
round_: str
|
| 52 |
+
get_array_wrap: str
|
| 53 |
+
DataSource: str
|
| 54 |
+
nbytes: str
|
| 55 |
+
byte_bounds: str
|
| 56 |
+
compare_chararrays: str
|
| 57 |
+
format_parser: str
|
| 58 |
+
alltrue: str
|
| 59 |
+
sometrue: str
|
| 60 |
+
|
| 61 |
+
__expired_attributes__: Final[_ExpiredAttributesType] = ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_globals.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module defining global singleton classes.
|
| 3 |
+
|
| 4 |
+
This module raises a RuntimeError if an attempt to reload it is made. In that
|
| 5 |
+
way the identities of the classes defined here are fixed and will remain so
|
| 6 |
+
even if numpy itself is reloaded. In particular, a function like the following
|
| 7 |
+
will still work correctly after numpy is reloaded::
|
| 8 |
+
|
| 9 |
+
def foo(arg=np._NoValue):
|
| 10 |
+
if arg is np._NoValue:
|
| 11 |
+
...
|
| 12 |
+
|
| 13 |
+
That was not the case when the singleton classes were defined in the numpy
|
| 14 |
+
``__init__.py`` file. See gh-7844 for a discussion of the reload problem that
|
| 15 |
+
motivated this module.
|
| 16 |
+
|
| 17 |
+
"""
|
| 18 |
+
import enum
|
| 19 |
+
|
| 20 |
+
from ._utils import set_module as _set_module
|
| 21 |
+
|
| 22 |
+
__all__ = ['_NoValue', '_CopyMode']
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Disallow reloading this module so as to preserve the identities of the
|
| 26 |
+
# classes defined here.
|
| 27 |
+
if '_is_loaded' in globals():
|
| 28 |
+
raise RuntimeError('Reloading numpy._globals is not allowed')
|
| 29 |
+
_is_loaded = True
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class _NoValueType:
|
| 33 |
+
"""Special keyword value.
|
| 34 |
+
|
| 35 |
+
The instance of this class may be used as the default value assigned to a
|
| 36 |
+
keyword if no other obvious default (e.g., `None`) is suitable,
|
| 37 |
+
|
| 38 |
+
Common reasons for using this keyword are:
|
| 39 |
+
|
| 40 |
+
- A new keyword is added to a function, and that function forwards its
|
| 41 |
+
inputs to another function or method which can be defined outside of
|
| 42 |
+
NumPy. For example, ``np.std(x)`` calls ``x.std``, so when a ``keepdims``
|
| 43 |
+
keyword was added that could only be forwarded if the user explicitly
|
| 44 |
+
specified ``keepdims``; downstream array libraries may not have added
|
| 45 |
+
the same keyword, so adding ``x.std(..., keepdims=keepdims)``
|
| 46 |
+
unconditionally could have broken previously working code.
|
| 47 |
+
- A keyword is being deprecated, and a deprecation warning must only be
|
| 48 |
+
emitted when the keyword is used.
|
| 49 |
+
|
| 50 |
+
"""
|
| 51 |
+
__instance = None
|
| 52 |
+
|
| 53 |
+
def __new__(cls):
|
| 54 |
+
# ensure that only one instance exists
|
| 55 |
+
if not cls.__instance:
|
| 56 |
+
cls.__instance = super().__new__(cls)
|
| 57 |
+
return cls.__instance
|
| 58 |
+
|
| 59 |
+
def __repr__(self):
|
| 60 |
+
return "<no value>"
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
_NoValue = _NoValueType()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
@_set_module("numpy")
|
| 67 |
+
class _CopyMode(enum.Enum):
|
| 68 |
+
"""
|
| 69 |
+
An enumeration for the copy modes supported
|
| 70 |
+
by numpy.copy() and numpy.array(). The following three modes are supported,
|
| 71 |
+
|
| 72 |
+
- ALWAYS: This means that a deep copy of the input
|
| 73 |
+
array will always be taken.
|
| 74 |
+
- IF_NEEDED: This means that a deep copy of the input
|
| 75 |
+
array will be taken only if necessary.
|
| 76 |
+
- NEVER: This means that the deep copy will never be taken.
|
| 77 |
+
If a copy cannot be avoided then a `ValueError` will be
|
| 78 |
+
raised.
|
| 79 |
+
|
| 80 |
+
Note that the buffer-protocol could in theory do copies. NumPy currently
|
| 81 |
+
assumes an object exporting the buffer protocol will never do this.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
ALWAYS = True
|
| 85 |
+
NEVER = False
|
| 86 |
+
IF_NEEDED = 2
|
| 87 |
+
|
| 88 |
+
def __bool__(self):
|
| 89 |
+
# For backwards compatibility
|
| 90 |
+
if self == _CopyMode.ALWAYS:
|
| 91 |
+
return True
|
| 92 |
+
|
| 93 |
+
if self == _CopyMode.NEVER:
|
| 94 |
+
return False
|
| 95 |
+
|
| 96 |
+
raise ValueError(f"{self} is neither True nor False.")
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class _SignatureDescriptor:
|
| 100 |
+
# A descriptor to store on the ufunc __dict__ that avoids definig a
|
| 101 |
+
# signature for the ufunc class/type but allows the instance to have one.
|
| 102 |
+
# This is needed because inspect.signature() chokes on normal properties
|
| 103 |
+
# (as of 3.14 at least).
|
| 104 |
+
# We could also set __signature__ on the instance but this allows deferred
|
| 105 |
+
# computation of the signature.
|
| 106 |
+
def __get__(self, obj, objtype=None):
|
| 107 |
+
# Delay import, not a critical path but need to avoid circular import.
|
| 108 |
+
from numpy._core._internal import _ufunc_inspect_signature_builder
|
| 109 |
+
|
| 110 |
+
if obj is None:
|
| 111 |
+
# could also return None, which is accepted as "not set" by
|
| 112 |
+
# inspect.signature().
|
| 113 |
+
raise AttributeError(
|
| 114 |
+
"type object 'numpy.ufunc' has no attribute '__signature__'")
|
| 115 |
+
|
| 116 |
+
# Store on the instance, after this the descriptor won't be used.
|
| 117 |
+
obj.__signature__ = _ufunc_inspect_signature_builder(obj)
|
| 118 |
+
return obj.__signature__
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
_signature_descriptor = _SignatureDescriptor()
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_globals.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = ["_CopyMode", "_NoValue"]
|
| 2 |
+
|
| 3 |
+
import enum
|
| 4 |
+
from typing import Final, final
|
| 5 |
+
|
| 6 |
+
@final
|
| 7 |
+
class _CopyMode(enum.Enum):
|
| 8 |
+
ALWAYS = True
|
| 9 |
+
NEVER = False
|
| 10 |
+
IF_NEEDED = 2
|
| 11 |
+
|
| 12 |
+
def __bool__(self, /) -> bool: ...
|
| 13 |
+
|
| 14 |
+
@final
|
| 15 |
+
class _NoValueType: ...
|
| 16 |
+
|
| 17 |
+
_NoValue: Final[_NoValueType] = ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/__init__.py
ADDED
|
File without changes
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/__init__.pyi
ADDED
|
File without changes
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/hook-numpy.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""This hook should collect all binary files and any hidden modules that numpy
|
| 2 |
+
needs.
|
| 3 |
+
|
| 4 |
+
Our (some-what inadequate) docs for writing PyInstaller hooks are kept here:
|
| 5 |
+
https://pyinstaller.readthedocs.io/en/stable/hooks.html
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
from PyInstaller.compat import is_pure_conda
|
| 9 |
+
from PyInstaller.utils.hooks import collect_dynamic_libs
|
| 10 |
+
|
| 11 |
+
# Collect all DLLs inside numpy's installation folder, dump them into built
|
| 12 |
+
# app's root.
|
| 13 |
+
binaries = collect_dynamic_libs("numpy", ".")
|
| 14 |
+
|
| 15 |
+
# If using Conda without any non-conda virtual environment manager:
|
| 16 |
+
if is_pure_conda:
|
| 17 |
+
# Assume running the NumPy from Conda-forge and collect it's DLLs from the
|
| 18 |
+
# communal Conda bin directory. DLLs from NumPy's dependencies must also be
|
| 19 |
+
# collected to capture MKL, OpenBlas, OpenMP, etc.
|
| 20 |
+
from PyInstaller.utils.hooks import conda_support
|
| 21 |
+
datas = conda_support.collect_dynamic_libs("numpy", dependencies=True)
|
| 22 |
+
|
| 23 |
+
# Submodules PyInstaller cannot detect. `_dtype_ctypes` is only imported
|
| 24 |
+
# from C and `_multiarray_tests` is used in tests (which are not packed).
|
| 25 |
+
hiddenimports = ['numpy._core._dtype_ctypes', 'numpy._core._multiarray_tests']
|
| 26 |
+
|
| 27 |
+
# Remove testing and building code and packages that are referenced throughout
|
| 28 |
+
# NumPy but are not really dependencies.
|
| 29 |
+
excludedimports = [
|
| 30 |
+
"scipy",
|
| 31 |
+
"pytest",
|
| 32 |
+
"f2py",
|
| 33 |
+
"setuptools",
|
| 34 |
+
"distutils",
|
| 35 |
+
"numpy.distutils",
|
| 36 |
+
]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/hook-numpy.pyi
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Final
|
| 2 |
+
|
| 3 |
+
binaries: Final[list[tuple[str, str]]] = ...
|
| 4 |
+
|
| 5 |
+
hiddenimports: Final[list[str]] = ...
|
| 6 |
+
excludedimports: Final[list[str]] = ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
|
| 3 |
+
from numpy.testing import IS_EDITABLE, IS_WASM
|
| 4 |
+
|
| 5 |
+
if IS_WASM:
|
| 6 |
+
pytest.skip(
|
| 7 |
+
"WASM/Pyodide does not use or support Fortran",
|
| 8 |
+
allow_module_level=True
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if IS_EDITABLE:
|
| 13 |
+
pytest.skip(
|
| 14 |
+
"Editable install doesn't support tests with a compile step",
|
| 15 |
+
allow_module_level=True
|
| 16 |
+
)
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A crude *bit of everything* smoke test to verify PyInstaller compatibility.
|
| 2 |
+
|
| 3 |
+
PyInstaller typically goes wrong by forgetting to package modules, extension
|
| 4 |
+
modules or shared libraries. This script should aim to touch as many of those
|
| 5 |
+
as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
|
| 6 |
+
due to an uncollected resource. Missing resources are unlikely to lead to
|
| 7 |
+
arithmetic errors so there's generally no need to verify any calculation's
|
| 8 |
+
output - merely that it made it to the end OK. This script should not
|
| 9 |
+
explicitly import any of numpy's submodules as that gives PyInstaller undue
|
| 10 |
+
hints that those submodules exist and should be collected (accessing implicitly
|
| 11 |
+
loaded submodules is OK).
|
| 12 |
+
|
| 13 |
+
"""
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
a = np.arange(1., 10.).reshape((3, 3)) % 5
|
| 17 |
+
np.linalg.det(a)
|
| 18 |
+
a @ a
|
| 19 |
+
a @ a.T
|
| 20 |
+
np.linalg.inv(a)
|
| 21 |
+
np.sin(np.exp(a))
|
| 22 |
+
np.linalg.svd(a)
|
| 23 |
+
np.linalg.eigh(a)
|
| 24 |
+
|
| 25 |
+
np.unique(np.random.randint(0, 10, 100))
|
| 26 |
+
np.sort(np.random.uniform(0, 10, 100))
|
| 27 |
+
|
| 28 |
+
np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
|
| 29 |
+
np.ma.masked_array(np.arange(10), np.random.rand(10) < .5).sum()
|
| 30 |
+
np.polynomial.Legendre([7, 8, 9]).roots()
|
| 31 |
+
|
| 32 |
+
print("I made it!")
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# PyInstaller has been very unproactive about replacing 'imp' with 'importlib'.
|
| 8 |
+
@pytest.mark.filterwarnings('ignore::DeprecationWarning')
|
| 9 |
+
# It also leaks io.BytesIO()s.
|
| 10 |
+
@pytest.mark.filterwarnings('ignore::ResourceWarning')
|
| 11 |
+
@pytest.mark.parametrize("mode", ["--onedir", "--onefile"])
|
| 12 |
+
@pytest.mark.slow
|
| 13 |
+
def test_pyinstaller(mode, tmp_path):
|
| 14 |
+
"""Compile and run pyinstaller-smoke.py using PyInstaller."""
|
| 15 |
+
|
| 16 |
+
pyinstaller_cli = pytest.importorskip("PyInstaller.__main__").run
|
| 17 |
+
|
| 18 |
+
source = Path(__file__).with_name("pyinstaller-smoke.py").resolve()
|
| 19 |
+
args = [
|
| 20 |
+
# Place all generated files in ``tmp_path``.
|
| 21 |
+
'--workpath', str(tmp_path / "build"),
|
| 22 |
+
'--distpath', str(tmp_path / "dist"),
|
| 23 |
+
'--specpath', str(tmp_path),
|
| 24 |
+
mode,
|
| 25 |
+
str(source),
|
| 26 |
+
]
|
| 27 |
+
pyinstaller_cli(args)
|
| 28 |
+
|
| 29 |
+
if mode == "--onefile":
|
| 30 |
+
exe = tmp_path / "dist" / source.stem
|
| 31 |
+
else:
|
| 32 |
+
exe = tmp_path / "dist" / source.stem / source.stem
|
| 33 |
+
|
| 34 |
+
p = subprocess.run([str(exe)], check=True, stdout=subprocess.PIPE)
|
| 35 |
+
assert p.stdout.strip() == b"I made it!"
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pytesttester.py
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pytest test running.
|
| 3 |
+
|
| 4 |
+
This module implements the ``test()`` function for NumPy modules. The usual
|
| 5 |
+
boiler plate for doing that is to put the following in the module
|
| 6 |
+
``__init__.py`` file::
|
| 7 |
+
|
| 8 |
+
from numpy._pytesttester import PytestTester
|
| 9 |
+
test = PytestTester(__name__)
|
| 10 |
+
del PytestTester
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
Warnings filtering and other runtime settings should be dealt with in the
|
| 14 |
+
``pytest.ini`` file in the numpy repo root. The behavior of the test depends on
|
| 15 |
+
whether or not that file is found as follows:
|
| 16 |
+
|
| 17 |
+
* ``pytest.ini`` is present (develop mode)
|
| 18 |
+
All warnings except those explicitly filtered out are raised as error.
|
| 19 |
+
* ``pytest.ini`` is absent (release mode)
|
| 20 |
+
DeprecationWarnings and PendingDeprecationWarnings are ignored, other
|
| 21 |
+
warnings are passed through.
|
| 22 |
+
|
| 23 |
+
In practice, tests run from the numpy repo are run in development mode with
|
| 24 |
+
``spin``, through the standard ``spin test`` invocation or from an inplace
|
| 25 |
+
build with ``pytest numpy``.
|
| 26 |
+
|
| 27 |
+
This module is imported by every numpy subpackage, so lies at the top level to
|
| 28 |
+
simplify circular import issues. For the same reason, it contains no numpy
|
| 29 |
+
imports at module scope, instead importing numpy within function calls.
|
| 30 |
+
"""
|
| 31 |
+
import os
|
| 32 |
+
import sys
|
| 33 |
+
|
| 34 |
+
__all__ = ['PytestTester']
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def _show_numpy_info():
|
| 38 |
+
import numpy as np
|
| 39 |
+
|
| 40 |
+
print(f"NumPy version {np.__version__}")
|
| 41 |
+
info = np.lib._utils_impl._opt_info()
|
| 42 |
+
print("NumPy CPU features: ", (info or 'nothing enabled'))
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class PytestTester:
|
| 46 |
+
"""
|
| 47 |
+
Pytest test runner.
|
| 48 |
+
|
| 49 |
+
A test function is typically added to a package's __init__.py like so::
|
| 50 |
+
|
| 51 |
+
from numpy._pytesttester import PytestTester
|
| 52 |
+
test = PytestTester(__name__).test
|
| 53 |
+
del PytestTester
|
| 54 |
+
|
| 55 |
+
Calling this test function finds and runs all tests associated with the
|
| 56 |
+
module and all its sub-modules.
|
| 57 |
+
|
| 58 |
+
Attributes
|
| 59 |
+
----------
|
| 60 |
+
module_name : str
|
| 61 |
+
Full path to the package to test.
|
| 62 |
+
|
| 63 |
+
Parameters
|
| 64 |
+
----------
|
| 65 |
+
module_name : module name
|
| 66 |
+
The name of the module to test.
|
| 67 |
+
|
| 68 |
+
Notes
|
| 69 |
+
-----
|
| 70 |
+
Unlike the previous ``nose``-based implementation, this class is not
|
| 71 |
+
publicly exposed as it performs some ``numpy``-specific warning
|
| 72 |
+
suppression.
|
| 73 |
+
|
| 74 |
+
"""
|
| 75 |
+
def __init__(self, module_name):
|
| 76 |
+
self.module_name = module_name
|
| 77 |
+
self.__module__ = module_name
|
| 78 |
+
|
| 79 |
+
def __call__(self, label='fast', verbose=1, extra_argv=None,
|
| 80 |
+
doctests=False, coverage=False, durations=-1, tests=None):
|
| 81 |
+
"""
|
| 82 |
+
Run tests for module using pytest.
|
| 83 |
+
|
| 84 |
+
Parameters
|
| 85 |
+
----------
|
| 86 |
+
label : {'fast', 'full'}, optional
|
| 87 |
+
Identifies the tests to run. When set to 'fast', tests decorated
|
| 88 |
+
with `pytest.mark.slow` are skipped, when 'full', the slow marker
|
| 89 |
+
is ignored.
|
| 90 |
+
verbose : int, optional
|
| 91 |
+
Verbosity value for test outputs, in the range 1-3. Default is 1.
|
| 92 |
+
extra_argv : list, optional
|
| 93 |
+
List with any extra arguments to pass to pytests.
|
| 94 |
+
doctests : bool, optional
|
| 95 |
+
.. note:: Not supported
|
| 96 |
+
coverage : bool, optional
|
| 97 |
+
If True, report coverage of NumPy code. Default is False.
|
| 98 |
+
Requires installation of (pip) pytest-cov.
|
| 99 |
+
durations : int, optional
|
| 100 |
+
If < 0, do nothing, If 0, report time of all tests, if > 0,
|
| 101 |
+
report the time of the slowest `timer` tests. Default is -1.
|
| 102 |
+
tests : test or list of tests
|
| 103 |
+
Tests to be executed with pytest '--pyargs'
|
| 104 |
+
|
| 105 |
+
Returns
|
| 106 |
+
-------
|
| 107 |
+
result : bool
|
| 108 |
+
Return True on success, false otherwise.
|
| 109 |
+
|
| 110 |
+
Notes
|
| 111 |
+
-----
|
| 112 |
+
Each NumPy module exposes `test` in its namespace to run all tests for
|
| 113 |
+
it. For example, to run all tests for numpy.lib:
|
| 114 |
+
|
| 115 |
+
>>> np.lib.test() #doctest: +SKIP
|
| 116 |
+
|
| 117 |
+
Examples
|
| 118 |
+
--------
|
| 119 |
+
>>> result = np.lib.test() #doctest: +SKIP
|
| 120 |
+
...
|
| 121 |
+
1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds
|
| 122 |
+
>>> result
|
| 123 |
+
True
|
| 124 |
+
|
| 125 |
+
"""
|
| 126 |
+
import warnings
|
| 127 |
+
|
| 128 |
+
import pytest
|
| 129 |
+
|
| 130 |
+
module = sys.modules[self.module_name]
|
| 131 |
+
module_path = os.path.abspath(module.__path__[0])
|
| 132 |
+
|
| 133 |
+
# setup the pytest arguments
|
| 134 |
+
pytest_args = ["-l"]
|
| 135 |
+
|
| 136 |
+
# offset verbosity. The "-q" cancels a "-v".
|
| 137 |
+
pytest_args += ["-q"]
|
| 138 |
+
|
| 139 |
+
if sys.version_info < (3, 12):
|
| 140 |
+
with warnings.catch_warnings():
|
| 141 |
+
warnings.simplefilter("always")
|
| 142 |
+
# Filter out distutils cpu warnings (could be localized to
|
| 143 |
+
# distutils tests). ASV has problems with top level import,
|
| 144 |
+
# so fetch module for suppression here.
|
| 145 |
+
from numpy.distutils import cpuinfo # noqa: F401
|
| 146 |
+
|
| 147 |
+
# Filter out annoying import messages. Want these in both develop and
|
| 148 |
+
# release mode.
|
| 149 |
+
pytest_args += [
|
| 150 |
+
"-W ignore:Not importing directory",
|
| 151 |
+
"-W ignore:numpy.dtype size changed",
|
| 152 |
+
"-W ignore:numpy.ufunc size changed",
|
| 153 |
+
"-W ignore::UserWarning:cpuinfo",
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
# When testing matrices, ignore their PendingDeprecationWarnings
|
| 157 |
+
pytest_args += [
|
| 158 |
+
"-W ignore:the matrix subclass is not",
|
| 159 |
+
"-W ignore:Importing from numpy.matlib is",
|
| 160 |
+
]
|
| 161 |
+
|
| 162 |
+
if doctests:
|
| 163 |
+
pytest_args += ["--doctest-modules"]
|
| 164 |
+
|
| 165 |
+
if extra_argv:
|
| 166 |
+
pytest_args += list(extra_argv)
|
| 167 |
+
|
| 168 |
+
if verbose > 1:
|
| 169 |
+
pytest_args += ["-" + "v" * (verbose - 1)]
|
| 170 |
+
|
| 171 |
+
if coverage:
|
| 172 |
+
pytest_args += ["--cov=" + module_path]
|
| 173 |
+
|
| 174 |
+
if label == "fast":
|
| 175 |
+
# not importing at the top level to avoid circular import of module
|
| 176 |
+
from numpy.testing import IS_PYPY
|
| 177 |
+
if IS_PYPY:
|
| 178 |
+
pytest_args += ["-m", "not slow and not slow_pypy"]
|
| 179 |
+
else:
|
| 180 |
+
pytest_args += ["-m", "not slow"]
|
| 181 |
+
|
| 182 |
+
elif label != "full":
|
| 183 |
+
pytest_args += ["-m", label]
|
| 184 |
+
|
| 185 |
+
if durations >= 0:
|
| 186 |
+
pytest_args += [f"--durations={durations}"]
|
| 187 |
+
|
| 188 |
+
if tests is None:
|
| 189 |
+
tests = [self.module_name]
|
| 190 |
+
|
| 191 |
+
pytest_args += ["--pyargs"] + list(tests)
|
| 192 |
+
|
| 193 |
+
# run tests.
|
| 194 |
+
_show_numpy_info()
|
| 195 |
+
|
| 196 |
+
try:
|
| 197 |
+
code = pytest.main(pytest_args)
|
| 198 |
+
except SystemExit as exc:
|
| 199 |
+
code = exc.code
|
| 200 |
+
|
| 201 |
+
return code == 0
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_pytesttester.pyi
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Iterable
|
| 2 |
+
from typing import Literal as L
|
| 3 |
+
|
| 4 |
+
__all__ = ["PytestTester"]
|
| 5 |
+
|
| 6 |
+
class PytestTester:
|
| 7 |
+
module_name: str
|
| 8 |
+
def __init__(self, module_name: str) -> None: ...
|
| 9 |
+
def __call__(
|
| 10 |
+
self,
|
| 11 |
+
label: L["fast", "full"] = "fast",
|
| 12 |
+
verbose: int = 1,
|
| 13 |
+
extra_argv: Iterable[str] | None = None,
|
| 14 |
+
doctests: L[False] = False,
|
| 15 |
+
coverage: bool = False,
|
| 16 |
+
durations: int = -1,
|
| 17 |
+
tests: Iterable[str] | None = None,
|
| 18 |
+
) -> bool: ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__init__.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Private counterpart of ``numpy.typing``."""
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from ._array_like import (
|
| 6 |
+
NDArray as NDArray,
|
| 7 |
+
_ArrayLike as _ArrayLike,
|
| 8 |
+
_ArrayLikeAnyString_co as _ArrayLikeAnyString_co,
|
| 9 |
+
_ArrayLikeBool_co as _ArrayLikeBool_co,
|
| 10 |
+
_ArrayLikeBytes_co as _ArrayLikeBytes_co,
|
| 11 |
+
_ArrayLikeComplex128_co as _ArrayLikeComplex128_co,
|
| 12 |
+
_ArrayLikeComplex_co as _ArrayLikeComplex_co,
|
| 13 |
+
_ArrayLikeDT64_co as _ArrayLikeDT64_co,
|
| 14 |
+
_ArrayLikeFloat64_co as _ArrayLikeFloat64_co,
|
| 15 |
+
_ArrayLikeFloat_co as _ArrayLikeFloat_co,
|
| 16 |
+
_ArrayLikeInt as _ArrayLikeInt,
|
| 17 |
+
_ArrayLikeInt_co as _ArrayLikeInt_co,
|
| 18 |
+
_ArrayLikeNumber_co as _ArrayLikeNumber_co,
|
| 19 |
+
_ArrayLikeObject_co as _ArrayLikeObject_co,
|
| 20 |
+
_ArrayLikeStr_co as _ArrayLikeStr_co,
|
| 21 |
+
_ArrayLikeString_co as _ArrayLikeString_co,
|
| 22 |
+
_ArrayLikeTD64_co as _ArrayLikeTD64_co,
|
| 23 |
+
_ArrayLikeUInt_co as _ArrayLikeUInt_co,
|
| 24 |
+
_ArrayLikeVoid_co as _ArrayLikeVoid_co,
|
| 25 |
+
_FiniteNestedSequence as _FiniteNestedSequence,
|
| 26 |
+
_SupportsArray as _SupportsArray,
|
| 27 |
+
_SupportsArrayFunc as _SupportsArrayFunc,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
#
|
| 31 |
+
from ._char_codes import (
|
| 32 |
+
_BoolCodes as _BoolCodes,
|
| 33 |
+
_ByteCodes as _ByteCodes,
|
| 34 |
+
_BytesCodes as _BytesCodes,
|
| 35 |
+
_CDoubleCodes as _CDoubleCodes,
|
| 36 |
+
_CharacterCodes as _CharacterCodes,
|
| 37 |
+
_CLongDoubleCodes as _CLongDoubleCodes,
|
| 38 |
+
_Complex64Codes as _Complex64Codes,
|
| 39 |
+
_Complex128Codes as _Complex128Codes,
|
| 40 |
+
_ComplexFloatingCodes as _ComplexFloatingCodes,
|
| 41 |
+
_CSingleCodes as _CSingleCodes,
|
| 42 |
+
_DoubleCodes as _DoubleCodes,
|
| 43 |
+
_DT64Codes as _DT64Codes,
|
| 44 |
+
_FlexibleCodes as _FlexibleCodes,
|
| 45 |
+
_Float16Codes as _Float16Codes,
|
| 46 |
+
_Float32Codes as _Float32Codes,
|
| 47 |
+
_Float64Codes as _Float64Codes,
|
| 48 |
+
_FloatingCodes as _FloatingCodes,
|
| 49 |
+
_GenericCodes as _GenericCodes,
|
| 50 |
+
_HalfCodes as _HalfCodes,
|
| 51 |
+
_InexactCodes as _InexactCodes,
|
| 52 |
+
_Int8Codes as _Int8Codes,
|
| 53 |
+
_Int16Codes as _Int16Codes,
|
| 54 |
+
_Int32Codes as _Int32Codes,
|
| 55 |
+
_Int64Codes as _Int64Codes,
|
| 56 |
+
_IntCCodes as _IntCCodes,
|
| 57 |
+
_IntCodes as _IntCodes,
|
| 58 |
+
_IntegerCodes as _IntegerCodes,
|
| 59 |
+
_IntPCodes as _IntPCodes,
|
| 60 |
+
_LongCodes as _LongCodes,
|
| 61 |
+
_LongDoubleCodes as _LongDoubleCodes,
|
| 62 |
+
_LongLongCodes as _LongLongCodes,
|
| 63 |
+
_NumberCodes as _NumberCodes,
|
| 64 |
+
_ObjectCodes as _ObjectCodes,
|
| 65 |
+
_ShortCodes as _ShortCodes,
|
| 66 |
+
_SignedIntegerCodes as _SignedIntegerCodes,
|
| 67 |
+
_SingleCodes as _SingleCodes,
|
| 68 |
+
_StrCodes as _StrCodes,
|
| 69 |
+
_StringCodes as _StringCodes,
|
| 70 |
+
_TD64Codes as _TD64Codes,
|
| 71 |
+
_UByteCodes as _UByteCodes,
|
| 72 |
+
_UInt8Codes as _UInt8Codes,
|
| 73 |
+
_UInt16Codes as _UInt16Codes,
|
| 74 |
+
_UInt32Codes as _UInt32Codes,
|
| 75 |
+
_UInt64Codes as _UInt64Codes,
|
| 76 |
+
_UIntCCodes as _UIntCCodes,
|
| 77 |
+
_UIntCodes as _UIntCodes,
|
| 78 |
+
_UIntPCodes as _UIntPCodes,
|
| 79 |
+
_ULongCodes as _ULongCodes,
|
| 80 |
+
_ULongLongCodes as _ULongLongCodes,
|
| 81 |
+
_UnsignedIntegerCodes as _UnsignedIntegerCodes,
|
| 82 |
+
_UShortCodes as _UShortCodes,
|
| 83 |
+
_VoidCodes as _VoidCodes,
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
#
|
| 87 |
+
from ._dtype_like import (
|
| 88 |
+
_DTypeLike as _DTypeLike,
|
| 89 |
+
_DTypeLikeBool as _DTypeLikeBool,
|
| 90 |
+
_DTypeLikeBytes as _DTypeLikeBytes,
|
| 91 |
+
_DTypeLikeComplex as _DTypeLikeComplex,
|
| 92 |
+
_DTypeLikeComplex_co as _DTypeLikeComplex_co,
|
| 93 |
+
_DTypeLikeDT64 as _DTypeLikeDT64,
|
| 94 |
+
_DTypeLikeFloat as _DTypeLikeFloat,
|
| 95 |
+
_DTypeLikeInt as _DTypeLikeInt,
|
| 96 |
+
_DTypeLikeObject as _DTypeLikeObject,
|
| 97 |
+
_DTypeLikeStr as _DTypeLikeStr,
|
| 98 |
+
_DTypeLikeTD64 as _DTypeLikeTD64,
|
| 99 |
+
_DTypeLikeUInt as _DTypeLikeUInt,
|
| 100 |
+
_DTypeLikeVoid as _DTypeLikeVoid,
|
| 101 |
+
_HasDType as _HasDType,
|
| 102 |
+
_SupportsDType as _SupportsDType,
|
| 103 |
+
_VoidDTypeLike as _VoidDTypeLike,
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
#
|
| 107 |
+
from ._nbit import (
|
| 108 |
+
_NBitByte as _NBitByte,
|
| 109 |
+
_NBitDouble as _NBitDouble,
|
| 110 |
+
_NBitHalf as _NBitHalf,
|
| 111 |
+
_NBitInt as _NBitInt,
|
| 112 |
+
_NBitIntC as _NBitIntC,
|
| 113 |
+
_NBitIntP as _NBitIntP,
|
| 114 |
+
_NBitLong as _NBitLong,
|
| 115 |
+
_NBitLongDouble as _NBitLongDouble,
|
| 116 |
+
_NBitLongLong as _NBitLongLong,
|
| 117 |
+
_NBitShort as _NBitShort,
|
| 118 |
+
_NBitSingle as _NBitSingle,
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
#
|
| 122 |
+
from ._nbit_base import ( # type: ignore[deprecated]
|
| 123 |
+
NBitBase as NBitBase, # pyright: ignore[reportDeprecated]
|
| 124 |
+
_8Bit as _8Bit,
|
| 125 |
+
_16Bit as _16Bit,
|
| 126 |
+
_32Bit as _32Bit,
|
| 127 |
+
_64Bit as _64Bit,
|
| 128 |
+
_96Bit as _96Bit,
|
| 129 |
+
_128Bit as _128Bit,
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
#
|
| 133 |
+
from ._nested_sequence import _NestedSequence as _NestedSequence
|
| 134 |
+
|
| 135 |
+
#
|
| 136 |
+
from ._scalars import (
|
| 137 |
+
_BoolLike_co as _BoolLike_co,
|
| 138 |
+
_CharLike_co as _CharLike_co,
|
| 139 |
+
_ComplexLike_co as _ComplexLike_co,
|
| 140 |
+
_FloatLike_co as _FloatLike_co,
|
| 141 |
+
_IntLike_co as _IntLike_co,
|
| 142 |
+
_NumberLike_co as _NumberLike_co,
|
| 143 |
+
_ScalarLike_co as _ScalarLike_co,
|
| 144 |
+
_TD64Like_co as _TD64Like_co,
|
| 145 |
+
_UIntLike_co as _UIntLike_co,
|
| 146 |
+
_VoidLike_co as _VoidLike_co,
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
#
|
| 150 |
+
from ._shape import _AnyShape as _AnyShape, _Shape as _Shape, _ShapeLike as _ShapeLike
|
| 151 |
+
|
| 152 |
+
#
|
| 153 |
+
from ._ufunc import (
|
| 154 |
+
_GUFunc_Nin2_Nout1 as _GUFunc_Nin2_Nout1,
|
| 155 |
+
_UFunc_Nin1_Nout1 as _UFunc_Nin1_Nout1,
|
| 156 |
+
_UFunc_Nin1_Nout2 as _UFunc_Nin1_Nout2,
|
| 157 |
+
_UFunc_Nin2_Nout1 as _UFunc_Nin2_Nout1,
|
| 158 |
+
_UFunc_Nin2_Nout2 as _UFunc_Nin2_Nout2,
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
# wrapping the public aliases in `TypeAliasType` helps with introspection readability
|
| 162 |
+
if sys.version_info >= (3, 12):
|
| 163 |
+
from typing import TypeAliasType
|
| 164 |
+
|
| 165 |
+
from ._array_like import ArrayLike as _ArrayLikeAlias
|
| 166 |
+
from ._dtype_like import DTypeLike as _DTypeLikeAlias
|
| 167 |
+
|
| 168 |
+
ArrayLike = TypeAliasType("ArrayLike", _ArrayLikeAlias)
|
| 169 |
+
DTypeLike = TypeAliasType("DTypeLike", _DTypeLikeAlias)
|
| 170 |
+
|
| 171 |
+
else:
|
| 172 |
+
from ._array_like import ArrayLike as ArrayLike
|
| 173 |
+
from ._dtype_like import DTypeLike as DTypeLike
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (4.05 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_add_docstring.cpython-312.pyc
ADDED
|
Binary file (4.79 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_array_like.cpython-312.pyc
ADDED
|
Binary file (5.8 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_char_codes.cpython-312.pyc
ADDED
|
Binary file (7.08 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_dtype_like.cpython-312.pyc
ADDED
|
Binary file (4.34 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nbit.cpython-312.pyc
ADDED
|
Binary file (966 Bytes). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nbit_base.cpython-312.pyc
ADDED
|
Binary file (3.88 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_nested_sequence.cpython-312.pyc
ADDED
|
Binary file (3.41 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_scalars.cpython-312.pyc
ADDED
|
Binary file (1.43 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_shape.cpython-312.pyc
ADDED
|
Binary file (531 Bytes). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/__pycache__/_ufunc.cpython-312.pyc
ADDED
|
Binary file (372 Bytes). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_add_docstring.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module for creating docstrings for sphinx ``data`` domains."""
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
from ._array_like import NDArray
|
| 7 |
+
|
| 8 |
+
_docstrings_list = []
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def add_newdoc(name: str, value: str, doc: str) -> None:
|
| 12 |
+
"""Append ``_docstrings_list`` with a docstring for `name`.
|
| 13 |
+
|
| 14 |
+
Parameters
|
| 15 |
+
----------
|
| 16 |
+
name : str
|
| 17 |
+
The name of the object.
|
| 18 |
+
value : str
|
| 19 |
+
A string-representation of the object.
|
| 20 |
+
doc : str
|
| 21 |
+
The docstring of the object.
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
_docstrings_list.append((name, value, doc))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _parse_docstrings() -> str:
|
| 28 |
+
"""Convert all docstrings in ``_docstrings_list`` into a single
|
| 29 |
+
sphinx-legible text block.
|
| 30 |
+
|
| 31 |
+
"""
|
| 32 |
+
type_list_ret = []
|
| 33 |
+
for name, value, doc in _docstrings_list:
|
| 34 |
+
s = textwrap.dedent(doc).replace("\n", "\n ")
|
| 35 |
+
|
| 36 |
+
# Replace sections by rubrics
|
| 37 |
+
lines = s.split("\n")
|
| 38 |
+
new_lines = []
|
| 39 |
+
indent = ""
|
| 40 |
+
for line in lines:
|
| 41 |
+
m = re.match(r'^(\s+)[-=]+\s*$', line)
|
| 42 |
+
if m and new_lines:
|
| 43 |
+
prev = textwrap.dedent(new_lines.pop())
|
| 44 |
+
if prev == "Examples":
|
| 45 |
+
indent = ""
|
| 46 |
+
new_lines.append(f'{m.group(1)}.. rubric:: {prev}')
|
| 47 |
+
else:
|
| 48 |
+
indent = 4 * " "
|
| 49 |
+
new_lines.append(f'{m.group(1)}.. admonition:: {prev}')
|
| 50 |
+
new_lines.append("")
|
| 51 |
+
else:
|
| 52 |
+
new_lines.append(f"{indent}{line}")
|
| 53 |
+
|
| 54 |
+
s = "\n".join(new_lines)
|
| 55 |
+
s_block = f""".. data:: {name}\n :value: {value}\n {s}"""
|
| 56 |
+
type_list_ret.append(s_block)
|
| 57 |
+
return "\n".join(type_list_ret)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
add_newdoc('ArrayLike', 'typing.Union[...]',
|
| 61 |
+
"""
|
| 62 |
+
A `~typing.Union` representing objects that can be coerced
|
| 63 |
+
into an `~numpy.ndarray`.
|
| 64 |
+
|
| 65 |
+
Among others this includes the likes of:
|
| 66 |
+
|
| 67 |
+
* Scalars.
|
| 68 |
+
* (Nested) sequences.
|
| 69 |
+
* Objects implementing the `~class.__array__` protocol.
|
| 70 |
+
|
| 71 |
+
.. versionadded:: 1.20
|
| 72 |
+
|
| 73 |
+
See Also
|
| 74 |
+
--------
|
| 75 |
+
:term:`array_like`:
|
| 76 |
+
Any scalar or sequence that can be interpreted as an ndarray.
|
| 77 |
+
|
| 78 |
+
Examples
|
| 79 |
+
--------
|
| 80 |
+
.. code-block:: python
|
| 81 |
+
|
| 82 |
+
>>> import numpy as np
|
| 83 |
+
>>> import numpy.typing as npt
|
| 84 |
+
|
| 85 |
+
>>> def as_array(a: npt.ArrayLike) -> np.ndarray:
|
| 86 |
+
... return np.array(a)
|
| 87 |
+
|
| 88 |
+
""")
|
| 89 |
+
|
| 90 |
+
add_newdoc('DTypeLike', 'typing.Union[...]',
|
| 91 |
+
"""
|
| 92 |
+
A `~typing.Union` representing objects that can be coerced
|
| 93 |
+
into a `~numpy.dtype`.
|
| 94 |
+
|
| 95 |
+
Among others this includes the likes of:
|
| 96 |
+
|
| 97 |
+
* :class:`type` objects.
|
| 98 |
+
* Character codes or the names of :class:`type` objects.
|
| 99 |
+
* Objects with the ``.dtype`` attribute.
|
| 100 |
+
|
| 101 |
+
.. versionadded:: 1.20
|
| 102 |
+
|
| 103 |
+
See Also
|
| 104 |
+
--------
|
| 105 |
+
:ref:`Specifying and constructing data types <arrays.dtypes.constructing>`
|
| 106 |
+
A comprehensive overview of all objects that can be coerced
|
| 107 |
+
into data types.
|
| 108 |
+
|
| 109 |
+
Examples
|
| 110 |
+
--------
|
| 111 |
+
.. code-block:: python
|
| 112 |
+
|
| 113 |
+
>>> import numpy as np
|
| 114 |
+
>>> import numpy.typing as npt
|
| 115 |
+
|
| 116 |
+
>>> def as_dtype(d: npt.DTypeLike) -> np.dtype:
|
| 117 |
+
... return np.dtype(d)
|
| 118 |
+
|
| 119 |
+
""")
|
| 120 |
+
|
| 121 |
+
add_newdoc('NDArray', repr(NDArray),
|
| 122 |
+
"""
|
| 123 |
+
A `np.ndarray[tuple[Any, ...], np.dtype[ScalarT]] <numpy.ndarray>`
|
| 124 |
+
type alias :term:`generic <generic type>` w.r.t. its
|
| 125 |
+
`dtype.type <numpy.dtype.type>`.
|
| 126 |
+
|
| 127 |
+
Can be used during runtime for typing arrays with a given dtype
|
| 128 |
+
and unspecified shape.
|
| 129 |
+
|
| 130 |
+
.. versionadded:: 1.21
|
| 131 |
+
|
| 132 |
+
Examples
|
| 133 |
+
--------
|
| 134 |
+
.. code-block:: python
|
| 135 |
+
|
| 136 |
+
>>> import numpy as np
|
| 137 |
+
>>> import numpy.typing as npt
|
| 138 |
+
|
| 139 |
+
>>> print(npt.NDArray)
|
| 140 |
+
numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]]
|
| 141 |
+
|
| 142 |
+
>>> print(npt.NDArray[np.float64])
|
| 143 |
+
numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]
|
| 144 |
+
|
| 145 |
+
>>> NDArrayInt = npt.NDArray[np.int_]
|
| 146 |
+
>>> a: NDArrayInt = np.arange(10)
|
| 147 |
+
|
| 148 |
+
>>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]:
|
| 149 |
+
... return np.array(a)
|
| 150 |
+
|
| 151 |
+
""")
|
| 152 |
+
|
| 153 |
+
_docstrings = _parse_docstrings()
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_array_like.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from collections.abc import Callable, Collection, Sequence
|
| 3 |
+
from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, TypeVar, runtime_checkable
|
| 4 |
+
|
| 5 |
+
import numpy as np
|
| 6 |
+
from numpy import dtype
|
| 7 |
+
|
| 8 |
+
from ._nbit_base import _32Bit, _64Bit
|
| 9 |
+
from ._nested_sequence import _NestedSequence
|
| 10 |
+
from ._shape import _AnyShape
|
| 11 |
+
|
| 12 |
+
if TYPE_CHECKING:
|
| 13 |
+
StringDType = np.dtypes.StringDType
|
| 14 |
+
else:
|
| 15 |
+
# at runtime outside of type checking importing this from numpy.dtypes
|
| 16 |
+
# would lead to a circular import
|
| 17 |
+
from numpy._core.multiarray import StringDType
|
| 18 |
+
|
| 19 |
+
_T = TypeVar("_T")
|
| 20 |
+
_ScalarT = TypeVar("_ScalarT", bound=np.generic)
|
| 21 |
+
_DTypeT = TypeVar("_DTypeT", bound=dtype[Any])
|
| 22 |
+
_DTypeT_co = TypeVar("_DTypeT_co", covariant=True, bound=dtype[Any])
|
| 23 |
+
|
| 24 |
+
NDArray: TypeAlias = np.ndarray[_AnyShape, dtype[_ScalarT]]
|
| 25 |
+
|
| 26 |
+
# The `_SupportsArray` protocol only cares about the default dtype
|
| 27 |
+
# (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned
|
| 28 |
+
# array.
|
| 29 |
+
# Concrete implementations of the protocol are responsible for adding
|
| 30 |
+
# any and all remaining overloads
|
| 31 |
+
@runtime_checkable
|
| 32 |
+
class _SupportsArray(Protocol[_DTypeT_co]):
|
| 33 |
+
def __array__(self) -> np.ndarray[Any, _DTypeT_co]: ...
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
@runtime_checkable
|
| 37 |
+
class _SupportsArrayFunc(Protocol):
|
| 38 |
+
"""A protocol class representing `~class.__array_function__`."""
|
| 39 |
+
def __array_function__(
|
| 40 |
+
self,
|
| 41 |
+
func: Callable[..., Any],
|
| 42 |
+
types: Collection[type[Any]],
|
| 43 |
+
args: tuple[Any, ...],
|
| 44 |
+
kwargs: dict[str, Any],
|
| 45 |
+
) -> object: ...
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
# TODO: Wait until mypy supports recursive objects in combination with typevars
|
| 49 |
+
_FiniteNestedSequence: TypeAlias = (
|
| 50 |
+
_T
|
| 51 |
+
| Sequence[_T]
|
| 52 |
+
| Sequence[Sequence[_T]]
|
| 53 |
+
| Sequence[Sequence[Sequence[_T]]]
|
| 54 |
+
| Sequence[Sequence[Sequence[Sequence[_T]]]]
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
# A subset of `npt.ArrayLike` that can be parametrized w.r.t. `np.generic`
|
| 58 |
+
_ArrayLike: TypeAlias = (
|
| 59 |
+
_SupportsArray[dtype[_ScalarT]]
|
| 60 |
+
| _NestedSequence[_SupportsArray[dtype[_ScalarT]]]
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
# A union representing array-like objects; consists of two typevars:
|
| 64 |
+
# One representing types that can be parametrized w.r.t. `np.dtype`
|
| 65 |
+
# and another one for the rest
|
| 66 |
+
_DualArrayLike: TypeAlias = (
|
| 67 |
+
_SupportsArray[_DTypeT]
|
| 68 |
+
| _NestedSequence[_SupportsArray[_DTypeT]]
|
| 69 |
+
| _T
|
| 70 |
+
| _NestedSequence[_T]
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
if sys.version_info >= (3, 12):
|
| 74 |
+
from collections.abc import Buffer as _Buffer
|
| 75 |
+
else:
|
| 76 |
+
@runtime_checkable
|
| 77 |
+
class _Buffer(Protocol):
|
| 78 |
+
def __buffer__(self, flags: int, /) -> memoryview: ...
|
| 79 |
+
|
| 80 |
+
ArrayLike: TypeAlias = _Buffer | _DualArrayLike[dtype[Any], complex | bytes | str]
|
| 81 |
+
|
| 82 |
+
# `ArrayLike<X>_co`: array-like objects that can be coerced into `X`
|
| 83 |
+
# given the casting rules `same_kind`
|
| 84 |
+
_ArrayLikeBool_co: TypeAlias = _DualArrayLike[dtype[np.bool], bool]
|
| 85 |
+
_ArrayLikeUInt_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.unsignedinteger], bool]
|
| 86 |
+
_ArrayLikeInt_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer], int]
|
| 87 |
+
_ArrayLikeFloat_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer | np.floating], float]
|
| 88 |
+
_ArrayLikeComplex_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.number], complex]
|
| 89 |
+
_ArrayLikeNumber_co: TypeAlias = _ArrayLikeComplex_co
|
| 90 |
+
_ArrayLikeTD64_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer | np.timedelta64], int]
|
| 91 |
+
_ArrayLikeDT64_co: TypeAlias = _ArrayLike[np.datetime64]
|
| 92 |
+
_ArrayLikeObject_co: TypeAlias = _ArrayLike[np.object_]
|
| 93 |
+
|
| 94 |
+
_ArrayLikeVoid_co: TypeAlias = _ArrayLike[np.void]
|
| 95 |
+
_ArrayLikeBytes_co: TypeAlias = _DualArrayLike[dtype[np.bytes_], bytes]
|
| 96 |
+
_ArrayLikeStr_co: TypeAlias = _DualArrayLike[dtype[np.str_], str]
|
| 97 |
+
_ArrayLikeString_co: TypeAlias = _DualArrayLike[StringDType, str]
|
| 98 |
+
_ArrayLikeAnyString_co: TypeAlias = _DualArrayLike[dtype[np.character] | StringDType, bytes | str]
|
| 99 |
+
|
| 100 |
+
__Float64_co: TypeAlias = np.floating[_64Bit] | np.float32 | np.float16 | np.integer | np.bool
|
| 101 |
+
__Complex128_co: TypeAlias = np.number[_64Bit] | np.number[_32Bit] | np.float16 | np.integer | np.bool
|
| 102 |
+
_ArrayLikeFloat64_co: TypeAlias = _DualArrayLike[dtype[__Float64_co], float]
|
| 103 |
+
_ArrayLikeComplex128_co: TypeAlias = _DualArrayLike[dtype[__Complex128_co], complex]
|
| 104 |
+
|
| 105 |
+
# NOTE: This includes `builtins.bool`, but not `numpy.bool`.
|
| 106 |
+
_ArrayLikeInt: TypeAlias = _DualArrayLike[dtype[np.integer], int]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_char_codes.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
_BoolCodes = Literal[
|
| 4 |
+
"bool", "bool_",
|
| 5 |
+
"?", "|?", "=?", "<?", ">?",
|
| 6 |
+
"b1", "|b1", "=b1", "<b1", ">b1",
|
| 7 |
+
] # fmt: skip
|
| 8 |
+
|
| 9 |
+
_UInt8Codes = Literal["uint8", "u1", "|u1", "=u1", "<u1", ">u1"]
|
| 10 |
+
_UInt16Codes = Literal["uint16", "u2", "|u2", "=u2", "<u2", ">u2"]
|
| 11 |
+
_UInt32Codes = Literal["uint32", "u4", "|u4", "=u4", "<u4", ">u4"]
|
| 12 |
+
_UInt64Codes = Literal["uint64", "u8", "|u8", "=u8", "<u8", ">u8"]
|
| 13 |
+
|
| 14 |
+
_Int8Codes = Literal["int8", "i1", "|i1", "=i1", "<i1", ">i1"]
|
| 15 |
+
_Int16Codes = Literal["int16", "i2", "|i2", "=i2", "<i2", ">i2"]
|
| 16 |
+
_Int32Codes = Literal["int32", "i4", "|i4", "=i4", "<i4", ">i4"]
|
| 17 |
+
_Int64Codes = Literal["int64", "i8", "|i8", "=i8", "<i8", ">i8"]
|
| 18 |
+
|
| 19 |
+
_Float16Codes = Literal["float16", "f2", "|f2", "=f2", "<f2", ">f2"]
|
| 20 |
+
_Float32Codes = Literal["float32", "f4", "|f4", "=f4", "<f4", ">f4"]
|
| 21 |
+
_Float64Codes = Literal["float64", "f8", "|f8", "=f8", "<f8", ">f8"]
|
| 22 |
+
|
| 23 |
+
_Complex64Codes = Literal["complex64", "c8", "|c8", "=c8", "<c8", ">c8"]
|
| 24 |
+
_Complex128Codes = Literal["complex128", "c16", "|c16", "=c16", "<c16", ">c16"]
|
| 25 |
+
|
| 26 |
+
_ByteCodes = Literal["byte", "b", "|b", "=b", "<b", ">b"]
|
| 27 |
+
_ShortCodes = Literal["short", "h", "|h", "=h", "<h", ">h"]
|
| 28 |
+
_IntCCodes = Literal["intc", "i", "|i", "=i", "<i", ">i"]
|
| 29 |
+
_IntPCodes = Literal["intp", "int", "int_", "n", "|n", "=n", "<n", ">n"]
|
| 30 |
+
_LongCodes = Literal["long", "l", "|l", "=l", "<l", ">l"]
|
| 31 |
+
_IntCodes = _IntPCodes
|
| 32 |
+
_LongLongCodes = Literal["longlong", "q", "|q", "=q", "<q", ">q"]
|
| 33 |
+
|
| 34 |
+
_UByteCodes = Literal["ubyte", "B", "|B", "=B", "<B", ">B"]
|
| 35 |
+
_UShortCodes = Literal["ushort", "H", "|H", "=H", "<H", ">H"]
|
| 36 |
+
_UIntCCodes = Literal["uintc", "I", "|I", "=I", "<I", ">I"]
|
| 37 |
+
_UIntPCodes = Literal["uintp", "uint", "N", "|N", "=N", "<N", ">N"]
|
| 38 |
+
_ULongCodes = Literal["ulong", "L", "|L", "=L", "<L", ">L"]
|
| 39 |
+
_UIntCodes = _UIntPCodes
|
| 40 |
+
_ULongLongCodes = Literal["ulonglong", "Q", "|Q", "=Q", "<Q", ">Q"]
|
| 41 |
+
|
| 42 |
+
_HalfCodes = Literal["half", "e", "|e", "=e", "<e", ">e"]
|
| 43 |
+
_SingleCodes = Literal["single", "f", "|f", "=f", "<f", ">f"]
|
| 44 |
+
_DoubleCodes = Literal["double", "float", "d", "|d", "=d", "<d", ">d"]
|
| 45 |
+
_LongDoubleCodes = Literal["longdouble", "g", "|g", "=g", "<g", ">g"]
|
| 46 |
+
|
| 47 |
+
_CSingleCodes = Literal["csingle", "F", "|F", "=F", "<F", ">F"]
|
| 48 |
+
_CDoubleCodes = Literal["cdouble", "complex", "D", "|D", "=D", "<D", ">D"]
|
| 49 |
+
_CLongDoubleCodes = Literal["clongdouble", "G", "|G", "=G", "<G", ">G"]
|
| 50 |
+
|
| 51 |
+
_StrCodes = Literal["str", "str_", "unicode", "U", "|U", "=U", "<U", ">U"]
|
| 52 |
+
_BytesCodes = Literal["bytes", "bytes_", "S", "|S", "=S", "<S", ">S"]
|
| 53 |
+
_VoidCodes = Literal["void", "V", "|V", "=V", "<V", ">V"]
|
| 54 |
+
_ObjectCodes = Literal["object", "object_", "O", "|O", "=O", "<O", ">O"]
|
| 55 |
+
|
| 56 |
+
_DT64Codes = Literal[
|
| 57 |
+
"datetime64", "|datetime64", "=datetime64",
|
| 58 |
+
"<datetime64", ">datetime64",
|
| 59 |
+
"datetime64[Y]", "|datetime64[Y]", "=datetime64[Y]",
|
| 60 |
+
"<datetime64[Y]", ">datetime64[Y]",
|
| 61 |
+
"datetime64[M]", "|datetime64[M]", "=datetime64[M]",
|
| 62 |
+
"<datetime64[M]", ">datetime64[M]",
|
| 63 |
+
"datetime64[W]", "|datetime64[W]", "=datetime64[W]",
|
| 64 |
+
"<datetime64[W]", ">datetime64[W]",
|
| 65 |
+
"datetime64[D]", "|datetime64[D]", "=datetime64[D]",
|
| 66 |
+
"<datetime64[D]", ">datetime64[D]",
|
| 67 |
+
"datetime64[h]", "|datetime64[h]", "=datetime64[h]",
|
| 68 |
+
"<datetime64[h]", ">datetime64[h]",
|
| 69 |
+
"datetime64[m]", "|datetime64[m]", "=datetime64[m]",
|
| 70 |
+
"<datetime64[m]", ">datetime64[m]",
|
| 71 |
+
"datetime64[s]", "|datetime64[s]", "=datetime64[s]",
|
| 72 |
+
"<datetime64[s]", ">datetime64[s]",
|
| 73 |
+
"datetime64[ms]", "|datetime64[ms]", "=datetime64[ms]",
|
| 74 |
+
"<datetime64[ms]", ">datetime64[ms]",
|
| 75 |
+
"datetime64[us]", "|datetime64[us]", "=datetime64[us]",
|
| 76 |
+
"<datetime64[us]", ">datetime64[us]",
|
| 77 |
+
"datetime64[ns]", "|datetime64[ns]", "=datetime64[ns]",
|
| 78 |
+
"<datetime64[ns]", ">datetime64[ns]",
|
| 79 |
+
"datetime64[ps]", "|datetime64[ps]", "=datetime64[ps]",
|
| 80 |
+
"<datetime64[ps]", ">datetime64[ps]",
|
| 81 |
+
"datetime64[fs]", "|datetime64[fs]", "=datetime64[fs]",
|
| 82 |
+
"<datetime64[fs]", ">datetime64[fs]",
|
| 83 |
+
"datetime64[as]", "|datetime64[as]", "=datetime64[as]",
|
| 84 |
+
"<datetime64[as]", ">datetime64[as]",
|
| 85 |
+
"M", "|M", "=M", "<M", ">M",
|
| 86 |
+
"M8", "|M8", "=M8", "<M8", ">M8",
|
| 87 |
+
"M8[Y]", "|M8[Y]", "=M8[Y]", "<M8[Y]", ">M8[Y]",
|
| 88 |
+
"M8[M]", "|M8[M]", "=M8[M]", "<M8[M]", ">M8[M]",
|
| 89 |
+
"M8[W]", "|M8[W]", "=M8[W]", "<M8[W]", ">M8[W]",
|
| 90 |
+
"M8[D]", "|M8[D]", "=M8[D]", "<M8[D]", ">M8[D]",
|
| 91 |
+
"M8[h]", "|M8[h]", "=M8[h]", "<M8[h]", ">M8[h]",
|
| 92 |
+
"M8[m]", "|M8[m]", "=M8[m]", "<M8[m]", ">M8[m]",
|
| 93 |
+
"M8[s]", "|M8[s]", "=M8[s]", "<M8[s]", ">M8[s]",
|
| 94 |
+
"M8[ms]", "|M8[ms]", "=M8[ms]", "<M8[ms]", ">M8[ms]",
|
| 95 |
+
"M8[us]", "|M8[us]", "=M8[us]", "<M8[us]", ">M8[us]",
|
| 96 |
+
"M8[ns]", "|M8[ns]", "=M8[ns]", "<M8[ns]", ">M8[ns]",
|
| 97 |
+
"M8[ps]", "|M8[ps]", "=M8[ps]", "<M8[ps]", ">M8[ps]",
|
| 98 |
+
"M8[fs]", "|M8[fs]", "=M8[fs]", "<M8[fs]", ">M8[fs]",
|
| 99 |
+
"M8[as]", "|M8[as]", "=M8[as]", "<M8[as]", ">M8[as]",
|
| 100 |
+
]
|
| 101 |
+
_TD64Codes = Literal[
|
| 102 |
+
"timedelta64", "|timedelta64", "=timedelta64",
|
| 103 |
+
"<timedelta64", ">timedelta64",
|
| 104 |
+
"timedelta64[Y]", "|timedelta64[Y]", "=timedelta64[Y]",
|
| 105 |
+
"<timedelta64[Y]", ">timedelta64[Y]",
|
| 106 |
+
"timedelta64[M]", "|timedelta64[M]", "=timedelta64[M]",
|
| 107 |
+
"<timedelta64[M]", ">timedelta64[M]",
|
| 108 |
+
"timedelta64[W]", "|timedelta64[W]", "=timedelta64[W]",
|
| 109 |
+
"<timedelta64[W]", ">timedelta64[W]",
|
| 110 |
+
"timedelta64[D]", "|timedelta64[D]", "=timedelta64[D]",
|
| 111 |
+
"<timedelta64[D]", ">timedelta64[D]",
|
| 112 |
+
"timedelta64[h]", "|timedelta64[h]", "=timedelta64[h]",
|
| 113 |
+
"<timedelta64[h]", ">timedelta64[h]",
|
| 114 |
+
"timedelta64[m]", "|timedelta64[m]", "=timedelta64[m]",
|
| 115 |
+
"<timedelta64[m]", ">timedelta64[m]",
|
| 116 |
+
"timedelta64[s]", "|timedelta64[s]", "=timedelta64[s]",
|
| 117 |
+
"<timedelta64[s]", ">timedelta64[s]",
|
| 118 |
+
"timedelta64[ms]", "|timedelta64[ms]", "=timedelta64[ms]",
|
| 119 |
+
"<timedelta64[ms]", ">timedelta64[ms]",
|
| 120 |
+
"timedelta64[us]", "|timedelta64[us]", "=timedelta64[us]",
|
| 121 |
+
"<timedelta64[us]", ">timedelta64[us]",
|
| 122 |
+
"timedelta64[ns]", "|timedelta64[ns]", "=timedelta64[ns]",
|
| 123 |
+
"<timedelta64[ns]", ">timedelta64[ns]",
|
| 124 |
+
"timedelta64[ps]", "|timedelta64[ps]", "=timedelta64[ps]",
|
| 125 |
+
"<timedelta64[ps]", ">timedelta64[ps]",
|
| 126 |
+
"timedelta64[fs]", "|timedelta64[fs]", "=timedelta64[fs]",
|
| 127 |
+
"<timedelta64[fs]", ">timedelta64[fs]",
|
| 128 |
+
"timedelta64[as]", "|timedelta64[as]", "=timedelta64[as]",
|
| 129 |
+
"<timedelta64[as]", ">timedelta64[as]",
|
| 130 |
+
"m", "|m", "=m", "<m", ">m",
|
| 131 |
+
"m8", "|m8", "=m8", "<m8", ">m8",
|
| 132 |
+
"m8[Y]", "|m8[Y]", "=m8[Y]", "<m8[Y]", ">m8[Y]",
|
| 133 |
+
"m8[M]", "|m8[M]", "=m8[M]", "<m8[M]", ">m8[M]",
|
| 134 |
+
"m8[W]", "|m8[W]", "=m8[W]", "<m8[W]", ">m8[W]",
|
| 135 |
+
"m8[D]", "|m8[D]", "=m8[D]", "<m8[D]", ">m8[D]",
|
| 136 |
+
"m8[h]", "|m8[h]", "=m8[h]", "<m8[h]", ">m8[h]",
|
| 137 |
+
"m8[m]", "|m8[m]", "=m8[m]", "<m8[m]", ">m8[m]",
|
| 138 |
+
"m8[s]", "|m8[s]", "=m8[s]", "<m8[s]", ">m8[s]",
|
| 139 |
+
"m8[ms]", "|m8[ms]", "=m8[ms]", "<m8[ms]", ">m8[ms]",
|
| 140 |
+
"m8[us]", "|m8[us]", "=m8[us]", "<m8[us]", ">m8[us]",
|
| 141 |
+
"m8[ns]", "|m8[ns]", "=m8[ns]", "<m8[ns]", ">m8[ns]",
|
| 142 |
+
"m8[ps]", "|m8[ps]", "=m8[ps]", "<m8[ps]", ">m8[ps]",
|
| 143 |
+
"m8[fs]", "|m8[fs]", "=m8[fs]", "<m8[fs]", ">m8[fs]",
|
| 144 |
+
"m8[as]", "|m8[as]", "=m8[as]", "<m8[as]", ">m8[as]",
|
| 145 |
+
]
|
| 146 |
+
|
| 147 |
+
# NOTE: `StringDType' has no scalar type, and therefore has no name that can
|
| 148 |
+
# be passed to the `dtype` constructor
|
| 149 |
+
_StringCodes = Literal["T", "|T", "=T", "<T", ">T"]
|
| 150 |
+
|
| 151 |
+
# NOTE: Nested literals get flattened and de-duplicated at runtime, which isn't
|
| 152 |
+
# the case for a `Union` of `Literal`s.
|
| 153 |
+
# So even though they're equivalent when type-checking, they differ at runtime.
|
| 154 |
+
# Another advantage of nesting, is that they always have a "flat"
|
| 155 |
+
# `Literal.__args__`, which is a tuple of *literally* all its literal values.
|
| 156 |
+
|
| 157 |
+
_UnsignedIntegerCodes = Literal[
|
| 158 |
+
_UInt8Codes,
|
| 159 |
+
_UInt16Codes,
|
| 160 |
+
_UInt32Codes,
|
| 161 |
+
_UInt64Codes,
|
| 162 |
+
_UIntCodes,
|
| 163 |
+
_UByteCodes,
|
| 164 |
+
_UShortCodes,
|
| 165 |
+
_UIntCCodes,
|
| 166 |
+
_ULongCodes,
|
| 167 |
+
_ULongLongCodes,
|
| 168 |
+
]
|
| 169 |
+
_SignedIntegerCodes = Literal[
|
| 170 |
+
_Int8Codes,
|
| 171 |
+
_Int16Codes,
|
| 172 |
+
_Int32Codes,
|
| 173 |
+
_Int64Codes,
|
| 174 |
+
_IntCodes,
|
| 175 |
+
_ByteCodes,
|
| 176 |
+
_ShortCodes,
|
| 177 |
+
_IntCCodes,
|
| 178 |
+
_LongCodes,
|
| 179 |
+
_LongLongCodes,
|
| 180 |
+
]
|
| 181 |
+
_FloatingCodes = Literal[
|
| 182 |
+
_Float16Codes,
|
| 183 |
+
_Float32Codes,
|
| 184 |
+
_Float64Codes,
|
| 185 |
+
_HalfCodes,
|
| 186 |
+
_SingleCodes,
|
| 187 |
+
_DoubleCodes,
|
| 188 |
+
_LongDoubleCodes
|
| 189 |
+
]
|
| 190 |
+
_ComplexFloatingCodes = Literal[
|
| 191 |
+
_Complex64Codes,
|
| 192 |
+
_Complex128Codes,
|
| 193 |
+
_CSingleCodes,
|
| 194 |
+
_CDoubleCodes,
|
| 195 |
+
_CLongDoubleCodes,
|
| 196 |
+
]
|
| 197 |
+
_IntegerCodes = Literal[_UnsignedIntegerCodes, _SignedIntegerCodes]
|
| 198 |
+
_InexactCodes = Literal[_FloatingCodes, _ComplexFloatingCodes]
|
| 199 |
+
_NumberCodes = Literal[_IntegerCodes, _InexactCodes]
|
| 200 |
+
|
| 201 |
+
_CharacterCodes = Literal[_StrCodes, _BytesCodes]
|
| 202 |
+
_FlexibleCodes = Literal[_VoidCodes, _CharacterCodes]
|
| 203 |
+
|
| 204 |
+
_GenericCodes = Literal[
|
| 205 |
+
_BoolCodes,
|
| 206 |
+
_NumberCodes,
|
| 207 |
+
_FlexibleCodes,
|
| 208 |
+
_DT64Codes,
|
| 209 |
+
_TD64Codes,
|
| 210 |
+
_ObjectCodes,
|
| 211 |
+
# TODO: add `_StringCodes` once it has a scalar type
|
| 212 |
+
# _StringCodes,
|
| 213 |
+
]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_dtype_like.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence # noqa: F811
|
| 2 |
+
from typing import Any, Protocol, TypeAlias, TypedDict, TypeVar
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from ._char_codes import (
|
| 7 |
+
_BoolCodes,
|
| 8 |
+
_BytesCodes,
|
| 9 |
+
_ComplexFloatingCodes,
|
| 10 |
+
_DT64Codes,
|
| 11 |
+
_FloatingCodes,
|
| 12 |
+
_NumberCodes,
|
| 13 |
+
_ObjectCodes,
|
| 14 |
+
_SignedIntegerCodes,
|
| 15 |
+
_StrCodes,
|
| 16 |
+
_TD64Codes,
|
| 17 |
+
_UnsignedIntegerCodes,
|
| 18 |
+
_VoidCodes,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
_ScalarT = TypeVar("_ScalarT", bound=np.generic)
|
| 22 |
+
_DTypeT = TypeVar("_DTypeT", bound=np.dtype)
|
| 23 |
+
_DTypeT_co = TypeVar("_DTypeT_co", bound=np.dtype, covariant=True)
|
| 24 |
+
|
| 25 |
+
_DTypeLikeNested: TypeAlias = Any # TODO: wait for support for recursive types
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# Mandatory keys
|
| 29 |
+
class _DTypeDictBase(TypedDict):
|
| 30 |
+
names: Sequence[str]
|
| 31 |
+
formats: Sequence[_DTypeLikeNested]
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Mandatory + optional keys
|
| 35 |
+
class _DTypeDict(_DTypeDictBase, total=False):
|
| 36 |
+
# Only `str` elements are usable as indexing aliases,
|
| 37 |
+
# but `titles` can in principle accept any object
|
| 38 |
+
offsets: Sequence[int]
|
| 39 |
+
titles: Sequence[Any]
|
| 40 |
+
itemsize: int
|
| 41 |
+
aligned: bool
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class _HasDType(Protocol[_DTypeT_co]):
|
| 45 |
+
@property
|
| 46 |
+
def dtype(self) -> _DTypeT_co: ...
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class _HasNumPyDType(Protocol[_DTypeT_co]):
|
| 50 |
+
@property
|
| 51 |
+
def __numpy_dtype__(self, /) -> _DTypeT_co: ...
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
_SupportsDType: TypeAlias = _HasDType[_DTypeT] | _HasNumPyDType[_DTypeT]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
|
| 58 |
+
_DTypeLike: TypeAlias = type[_ScalarT] | np.dtype[_ScalarT] | _SupportsDType[np.dtype[_ScalarT]]
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
# Would create a dtype[np.void]
|
| 62 |
+
_VoidDTypeLike: TypeAlias = (
|
| 63 |
+
# If a tuple, then it can be either:
|
| 64 |
+
# - (flexible_dtype, itemsize)
|
| 65 |
+
# - (fixed_dtype, shape)
|
| 66 |
+
# - (base_dtype, new_dtype)
|
| 67 |
+
# But because `_DTypeLikeNested = Any`, the first two cases are redundant
|
| 68 |
+
|
| 69 |
+
# tuple[_DTypeLikeNested, int] | tuple[_DTypeLikeNested, _ShapeLike] |
|
| 70 |
+
tuple[_DTypeLikeNested, _DTypeLikeNested]
|
| 71 |
+
|
| 72 |
+
# [(field_name, field_dtype, field_shape), ...]
|
| 73 |
+
# The type here is quite broad because NumPy accepts quite a wide
|
| 74 |
+
# range of inputs inside the list; see the tests for some examples.
|
| 75 |
+
| list[Any]
|
| 76 |
+
|
| 77 |
+
# {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ..., 'itemsize': ...}
|
| 78 |
+
| _DTypeDict
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
# Aliases for commonly used dtype-like objects.
|
| 82 |
+
# Note that the precision of `np.number` subclasses is ignored herein.
|
| 83 |
+
_DTypeLikeBool: TypeAlias = type[bool] | _DTypeLike[np.bool] | _BoolCodes
|
| 84 |
+
_DTypeLikeInt: TypeAlias = (
|
| 85 |
+
type[int] | _DTypeLike[np.signedinteger] | _SignedIntegerCodes
|
| 86 |
+
)
|
| 87 |
+
_DTypeLikeUInt: TypeAlias = _DTypeLike[np.unsignedinteger] | _UnsignedIntegerCodes
|
| 88 |
+
_DTypeLikeFloat: TypeAlias = type[float] | _DTypeLike[np.floating] | _FloatingCodes
|
| 89 |
+
_DTypeLikeComplex: TypeAlias = (
|
| 90 |
+
type[complex] | _DTypeLike[np.complexfloating] | _ComplexFloatingCodes
|
| 91 |
+
)
|
| 92 |
+
_DTypeLikeComplex_co: TypeAlias = (
|
| 93 |
+
type[complex] | _DTypeLike[np.bool | np.number] | _BoolCodes | _NumberCodes
|
| 94 |
+
)
|
| 95 |
+
_DTypeLikeDT64: TypeAlias = _DTypeLike[np.timedelta64] | _TD64Codes
|
| 96 |
+
_DTypeLikeTD64: TypeAlias = _DTypeLike[np.datetime64] | _DT64Codes
|
| 97 |
+
_DTypeLikeBytes: TypeAlias = type[bytes] | _DTypeLike[np.bytes_] | _BytesCodes
|
| 98 |
+
_DTypeLikeStr: TypeAlias = type[str] | _DTypeLike[np.str_] | _StrCodes
|
| 99 |
+
_DTypeLikeVoid: TypeAlias = (
|
| 100 |
+
type[memoryview] | _DTypeLike[np.void] | _VoidDTypeLike | _VoidCodes
|
| 101 |
+
)
|
| 102 |
+
_DTypeLikeObject: TypeAlias = type[object] | _DTypeLike[np.object_] | _ObjectCodes
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# Anything that can be coerced into numpy.dtype.
|
| 106 |
+
# Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
|
| 107 |
+
DTypeLike: TypeAlias = _DTypeLike[Any] | _VoidDTypeLike | str
|
| 108 |
+
|
| 109 |
+
# NOTE: while it is possible to provide the dtype as a dict of
|
| 110 |
+
# dtype-like objects (e.g. `{'field1': ..., 'field2': ..., ...}`),
|
| 111 |
+
# this syntax is officially discouraged and
|
| 112 |
+
# therefore not included in the type-union defining `DTypeLike`.
|
| 113 |
+
#
|
| 114 |
+
# See https://github.com/numpy/numpy/issues/16891 for more details.
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_extended_precision.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with platform-specific extended precision
|
| 2 |
+
`numpy.number` subclasses.
|
| 3 |
+
|
| 4 |
+
The subclasses are defined here (instead of ``__init__.pyi``) such
|
| 5 |
+
that they can be imported conditionally via the numpy's mypy plugin.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
from . import _96Bit, _128Bit
|
| 11 |
+
|
| 12 |
+
float96 = np.floating[_96Bit]
|
| 13 |
+
float128 = np.floating[_128Bit]
|
| 14 |
+
complex192 = np.complexfloating[_96Bit, _96Bit]
|
| 15 |
+
complex256 = np.complexfloating[_128Bit, _128Bit]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with the precisions of platform-specific `~numpy.number`s."""
|
| 2 |
+
|
| 3 |
+
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
+
from ._nbit_base import _8Bit, _16Bit, _32Bit, _64Bit, _96Bit, _128Bit
|
| 6 |
+
|
| 7 |
+
# To-be replaced with a `npt.NBitBase` subclass by numpy's mypy plugin
|
| 8 |
+
_NBitByte: TypeAlias = _8Bit
|
| 9 |
+
_NBitShort: TypeAlias = _16Bit
|
| 10 |
+
_NBitIntC: TypeAlias = _32Bit
|
| 11 |
+
_NBitIntP: TypeAlias = _32Bit | _64Bit
|
| 12 |
+
_NBitInt: TypeAlias = _NBitIntP
|
| 13 |
+
_NBitLong: TypeAlias = _32Bit | _64Bit
|
| 14 |
+
_NBitLongLong: TypeAlias = _64Bit
|
| 15 |
+
|
| 16 |
+
_NBitHalf: TypeAlias = _16Bit
|
| 17 |
+
_NBitSingle: TypeAlias = _32Bit
|
| 18 |
+
_NBitDouble: TypeAlias = _64Bit
|
| 19 |
+
_NBitLongDouble: TypeAlias = _64Bit | _96Bit | _128Bit
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit_base.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with the precisions of generic `~numpy.number` types."""
|
| 2 |
+
from typing import final
|
| 3 |
+
|
| 4 |
+
from numpy._utils import set_module
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
@final # Disallow the creation of arbitrary `NBitBase` subclasses
|
| 8 |
+
@set_module("numpy.typing")
|
| 9 |
+
class NBitBase:
|
| 10 |
+
"""
|
| 11 |
+
A type representing `numpy.number` precision during static type checking.
|
| 12 |
+
|
| 13 |
+
Used exclusively for the purpose of static type checking, `NBitBase`
|
| 14 |
+
represents the base of a hierarchical set of subclasses.
|
| 15 |
+
Each subsequent subclass is herein used for representing a lower level
|
| 16 |
+
of precision, *e.g.* ``64Bit > 32Bit > 16Bit``.
|
| 17 |
+
|
| 18 |
+
.. versionadded:: 1.20
|
| 19 |
+
|
| 20 |
+
.. deprecated:: 2.3
|
| 21 |
+
Use ``@typing.overload`` or a ``TypeVar`` with a scalar-type as upper
|
| 22 |
+
bound, instead.
|
| 23 |
+
|
| 24 |
+
Examples
|
| 25 |
+
--------
|
| 26 |
+
Below is a typical usage example: `NBitBase` is herein used for annotating
|
| 27 |
+
a function that takes a float and integer of arbitrary precision
|
| 28 |
+
as arguments and returns a new float of whichever precision is largest
|
| 29 |
+
(*e.g.* ``np.float16 + np.int64 -> np.float64``).
|
| 30 |
+
|
| 31 |
+
.. code-block:: python
|
| 32 |
+
|
| 33 |
+
>>> from typing import TypeVar, TYPE_CHECKING
|
| 34 |
+
>>> import numpy as np
|
| 35 |
+
>>> import numpy.typing as npt
|
| 36 |
+
|
| 37 |
+
>>> S = TypeVar("S", bound=npt.NBitBase)
|
| 38 |
+
>>> T = TypeVar("T", bound=npt.NBitBase)
|
| 39 |
+
|
| 40 |
+
>>> def add(a: np.floating[S], b: np.integer[T]) -> np.floating[S | T]:
|
| 41 |
+
... return a + b
|
| 42 |
+
|
| 43 |
+
>>> a = np.float16()
|
| 44 |
+
>>> b = np.int64()
|
| 45 |
+
>>> out = add(a, b)
|
| 46 |
+
|
| 47 |
+
>>> if TYPE_CHECKING:
|
| 48 |
+
... reveal_locals()
|
| 49 |
+
... # note: Revealed local types are:
|
| 50 |
+
... # note: a: numpy.floating[numpy.typing._16Bit*]
|
| 51 |
+
... # note: b: numpy.signedinteger[numpy.typing._64Bit*]
|
| 52 |
+
... # note: out: numpy.floating[numpy.typing._64Bit*]
|
| 53 |
+
|
| 54 |
+
"""
|
| 55 |
+
# Deprecated in NumPy 2.3, 2025-05-01
|
| 56 |
+
|
| 57 |
+
def __init_subclass__(cls) -> None:
|
| 58 |
+
allowed_names = {
|
| 59 |
+
"NBitBase", "_128Bit", "_96Bit", "_64Bit", "_32Bit", "_16Bit", "_8Bit"
|
| 60 |
+
}
|
| 61 |
+
if cls.__name__ not in allowed_names:
|
| 62 |
+
raise TypeError('cannot inherit from final class "NBitBase"')
|
| 63 |
+
super().__init_subclass__()
|
| 64 |
+
|
| 65 |
+
@final
|
| 66 |
+
@set_module("numpy._typing")
|
| 67 |
+
# Silence errors about subclassing a `@final`-decorated class
|
| 68 |
+
class _128Bit(NBitBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
@final
|
| 72 |
+
@set_module("numpy._typing")
|
| 73 |
+
class _96Bit(_128Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 74 |
+
pass
|
| 75 |
+
|
| 76 |
+
@final
|
| 77 |
+
@set_module("numpy._typing")
|
| 78 |
+
class _64Bit(_96Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 79 |
+
pass
|
| 80 |
+
|
| 81 |
+
@final
|
| 82 |
+
@set_module("numpy._typing")
|
| 83 |
+
class _32Bit(_64Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 84 |
+
pass
|
| 85 |
+
|
| 86 |
+
@final
|
| 87 |
+
@set_module("numpy._typing")
|
| 88 |
+
class _16Bit(_32Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
@final
|
| 92 |
+
@set_module("numpy._typing")
|
| 93 |
+
class _8Bit(_16Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 94 |
+
pass
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nbit_base.pyi
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# pyright: reportDeprecated=false
|
| 2 |
+
# pyright: reportGeneralTypeIssues=false
|
| 3 |
+
# mypy: disable-error-code=misc
|
| 4 |
+
|
| 5 |
+
from typing import final
|
| 6 |
+
from typing_extensions import deprecated
|
| 7 |
+
|
| 8 |
+
# Deprecated in NumPy 2.3, 2025-05-01
|
| 9 |
+
@deprecated(
|
| 10 |
+
"`NBitBase` is deprecated and will be removed from numpy.typing in the "
|
| 11 |
+
"future. Use `@typing.overload` or a `TypeVar` with a scalar-type as upper "
|
| 12 |
+
"bound, instead. (deprecated in NumPy 2.3)",
|
| 13 |
+
)
|
| 14 |
+
@final
|
| 15 |
+
class NBitBase: ...
|
| 16 |
+
|
| 17 |
+
@final
|
| 18 |
+
class _256Bit(NBitBase): ...
|
| 19 |
+
|
| 20 |
+
@final
|
| 21 |
+
class _128Bit(_256Bit): ...
|
| 22 |
+
|
| 23 |
+
@final
|
| 24 |
+
class _96Bit(_128Bit): ...
|
| 25 |
+
|
| 26 |
+
@final
|
| 27 |
+
class _80Bit(_96Bit): ...
|
| 28 |
+
|
| 29 |
+
@final
|
| 30 |
+
class _64Bit(_80Bit): ...
|
| 31 |
+
|
| 32 |
+
@final
|
| 33 |
+
class _32Bit(_64Bit): ...
|
| 34 |
+
|
| 35 |
+
@final
|
| 36 |
+
class _16Bit(_32Bit): ...
|
| 37 |
+
|
| 38 |
+
@final
|
| 39 |
+
class _8Bit(_16Bit): ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_nested_sequence.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module containing the `_NestedSequence` protocol."""
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Any, Protocol, TypeVar, runtime_checkable
|
| 4 |
+
|
| 5 |
+
if TYPE_CHECKING:
|
| 6 |
+
from collections.abc import Iterator
|
| 7 |
+
|
| 8 |
+
__all__ = ["_NestedSequence"]
|
| 9 |
+
|
| 10 |
+
_T_co = TypeVar("_T_co", covariant=True)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@runtime_checkable
|
| 14 |
+
class _NestedSequence(Protocol[_T_co]):
|
| 15 |
+
"""A protocol for representing nested sequences.
|
| 16 |
+
|
| 17 |
+
Warning
|
| 18 |
+
-------
|
| 19 |
+
`_NestedSequence` currently does not work in combination with typevars,
|
| 20 |
+
*e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.
|
| 21 |
+
|
| 22 |
+
See Also
|
| 23 |
+
--------
|
| 24 |
+
collections.abc.Sequence
|
| 25 |
+
ABCs for read-only and mutable :term:`sequences`.
|
| 26 |
+
|
| 27 |
+
Examples
|
| 28 |
+
--------
|
| 29 |
+
.. code-block:: python
|
| 30 |
+
|
| 31 |
+
>>> from typing import TYPE_CHECKING
|
| 32 |
+
>>> import numpy as np
|
| 33 |
+
>>> from numpy._typing import _NestedSequence
|
| 34 |
+
|
| 35 |
+
>>> def get_dtype(seq: _NestedSequence[float]) -> np.dtype[np.float64]:
|
| 36 |
+
... return np.asarray(seq).dtype
|
| 37 |
+
|
| 38 |
+
>>> a = get_dtype([1.0])
|
| 39 |
+
>>> b = get_dtype([[1.0]])
|
| 40 |
+
>>> c = get_dtype([[[1.0]]])
|
| 41 |
+
>>> d = get_dtype([[[[1.0]]]])
|
| 42 |
+
|
| 43 |
+
>>> if TYPE_CHECKING:
|
| 44 |
+
... reveal_locals()
|
| 45 |
+
... # note: Revealed local types are:
|
| 46 |
+
... # note: a: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 47 |
+
... # note: b: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 48 |
+
... # note: c: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 49 |
+
... # note: d: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
|
| 50 |
+
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
def __len__(self, /) -> int:
|
| 54 |
+
"""Implement ``len(self)``."""
|
| 55 |
+
raise NotImplementedError
|
| 56 |
+
|
| 57 |
+
def __getitem__(self, index: int, /) -> "_T_co | _NestedSequence[_T_co]":
|
| 58 |
+
"""Implement ``self[x]``."""
|
| 59 |
+
raise NotImplementedError
|
| 60 |
+
|
| 61 |
+
def __contains__(self, x: object, /) -> bool:
|
| 62 |
+
"""Implement ``x in self``."""
|
| 63 |
+
raise NotImplementedError
|
| 64 |
+
|
| 65 |
+
def __iter__(self, /) -> "Iterator[_T_co | _NestedSequence[_T_co]]":
|
| 66 |
+
"""Implement ``iter(self)``."""
|
| 67 |
+
raise NotImplementedError
|
| 68 |
+
|
| 69 |
+
def __reversed__(self, /) -> "Iterator[_T_co | _NestedSequence[_T_co]]":
|
| 70 |
+
"""Implement ``reversed(self)``."""
|
| 71 |
+
raise NotImplementedError
|
| 72 |
+
|
| 73 |
+
def count(self, value: Any, /) -> int:
|
| 74 |
+
"""Return the number of occurrences of `value`."""
|
| 75 |
+
raise NotImplementedError
|
| 76 |
+
|
| 77 |
+
def index(self, value: Any, /) -> int:
|
| 78 |
+
"""Return the first index of `value`."""
|
| 79 |
+
raise NotImplementedError
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_scalars.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, TypeAlias
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and
|
| 6 |
+
# `np.bytes_` are already subclasses of their builtin counterpart
|
| 7 |
+
_CharLike_co: TypeAlias = str | bytes
|
| 8 |
+
|
| 9 |
+
# The `<X>Like_co` type-aliases below represent all scalars that can be
|
| 10 |
+
# coerced into `<X>` (with the casting rule `same_kind`)
|
| 11 |
+
_BoolLike_co: TypeAlias = bool | np.bool
|
| 12 |
+
_UIntLike_co: TypeAlias = bool | np.unsignedinteger | np.bool
|
| 13 |
+
_IntLike_co: TypeAlias = int | np.integer | np.bool
|
| 14 |
+
_FloatLike_co: TypeAlias = float | np.floating | np.integer | np.bool
|
| 15 |
+
_ComplexLike_co: TypeAlias = complex | np.number | np.bool
|
| 16 |
+
_NumberLike_co: TypeAlias = _ComplexLike_co
|
| 17 |
+
_TD64Like_co: TypeAlias = int | np.timedelta64 | np.integer | np.bool
|
| 18 |
+
# `_VoidLike_co` is technically not a scalar, but it's close enough
|
| 19 |
+
_VoidLike_co: TypeAlias = tuple[Any, ...] | np.void
|
| 20 |
+
_ScalarLike_co: TypeAlias = complex | str | bytes | np.generic
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_shape.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence
|
| 2 |
+
from typing import Any, SupportsIndex, TypeAlias
|
| 3 |
+
|
| 4 |
+
_Shape: TypeAlias = tuple[int, ...]
|
| 5 |
+
_AnyShape: TypeAlias = tuple[Any, ...]
|
| 6 |
+
|
| 7 |
+
# Anything that can be coerced to a shape tuple
|
| 8 |
+
_ShapeLike: TypeAlias = SupportsIndex | Sequence[SupportsIndex]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_ufunc.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy import ufunc
|
| 2 |
+
|
| 3 |
+
_UFunc_Nin1_Nout1 = ufunc
|
| 4 |
+
_UFunc_Nin2_Nout1 = ufunc
|
| 5 |
+
_UFunc_Nin1_Nout2 = ufunc
|
| 6 |
+
_UFunc_Nin2_Nout2 = ufunc
|
| 7 |
+
_GUFunc_Nin2_Nout1 = ufunc
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_typing/_ufunc.pyi
ADDED
|
@@ -0,0 +1,975 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module with private type-check-only `numpy.ufunc` subclasses.
|
| 2 |
+
|
| 3 |
+
The signatures of the ufuncs are too varied to reasonably type
|
| 4 |
+
with a single class. So instead, `ufunc` has been expanded into
|
| 5 |
+
four private subclasses, one for each combination of
|
| 6 |
+
`~ufunc.nin` and `~ufunc.nout`.
|
| 7 |
+
""" # noqa: PYI021
|
| 8 |
+
|
| 9 |
+
from _typeshed import Incomplete
|
| 10 |
+
from types import EllipsisType
|
| 11 |
+
from typing import (
|
| 12 |
+
Any,
|
| 13 |
+
Generic,
|
| 14 |
+
Literal,
|
| 15 |
+
LiteralString,
|
| 16 |
+
Never,
|
| 17 |
+
NoReturn,
|
| 18 |
+
Protocol,
|
| 19 |
+
SupportsIndex,
|
| 20 |
+
TypeAlias,
|
| 21 |
+
TypedDict,
|
| 22 |
+
TypeVar,
|
| 23 |
+
Unpack,
|
| 24 |
+
overload,
|
| 25 |
+
type_check_only,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
import numpy as np
|
| 29 |
+
from numpy import _CastingKind, _OrderKACF, ufunc
|
| 30 |
+
from numpy.typing import NDArray
|
| 31 |
+
|
| 32 |
+
from ._array_like import ArrayLike, _ArrayLikeBool_co, _ArrayLikeInt_co
|
| 33 |
+
from ._dtype_like import DTypeLike
|
| 34 |
+
from ._scalars import _ScalarLike_co
|
| 35 |
+
from ._shape import _ShapeLike
|
| 36 |
+
|
| 37 |
+
_T = TypeVar("_T")
|
| 38 |
+
_2Tuple: TypeAlias = tuple[_T, _T]
|
| 39 |
+
_3Tuple: TypeAlias = tuple[_T, _T, _T]
|
| 40 |
+
_4Tuple: TypeAlias = tuple[_T, _T, _T, _T]
|
| 41 |
+
|
| 42 |
+
_2PTuple: TypeAlias = tuple[_T, _T, *tuple[_T, ...]]
|
| 43 |
+
_3PTuple: TypeAlias = tuple[_T, _T, _T, *tuple[_T, ...]]
|
| 44 |
+
_4PTuple: TypeAlias = tuple[_T, _T, _T, _T, *tuple[_T, ...]]
|
| 45 |
+
|
| 46 |
+
_NTypes = TypeVar("_NTypes", bound=int, covariant=True)
|
| 47 |
+
_IDType = TypeVar("_IDType", covariant=True)
|
| 48 |
+
_NameType = TypeVar("_NameType", bound=LiteralString, covariant=True)
|
| 49 |
+
_Signature = TypeVar("_Signature", bound=LiteralString, covariant=True)
|
| 50 |
+
|
| 51 |
+
_NIn = TypeVar("_NIn", bound=int, covariant=True)
|
| 52 |
+
_NOut = TypeVar("_NOut", bound=int, covariant=True)
|
| 53 |
+
_ReturnType_co = TypeVar("_ReturnType_co", covariant=True)
|
| 54 |
+
_ArrayT = TypeVar("_ArrayT", bound=np.ndarray)
|
| 55 |
+
|
| 56 |
+
@type_check_only
|
| 57 |
+
class _SupportsArrayUFunc(Protocol):
|
| 58 |
+
def __array_ufunc__(
|
| 59 |
+
self,
|
| 60 |
+
ufunc: ufunc,
|
| 61 |
+
method: Literal["__call__", "reduce", "reduceat", "accumulate", "outer", "at"],
|
| 62 |
+
*inputs: Any,
|
| 63 |
+
**kwargs: Any,
|
| 64 |
+
) -> Any: ...
|
| 65 |
+
|
| 66 |
+
@type_check_only
|
| 67 |
+
class _UFunc3Kwargs(TypedDict, total=False):
|
| 68 |
+
where: _ArrayLikeBool_co | None
|
| 69 |
+
casting: _CastingKind
|
| 70 |
+
order: _OrderKACF
|
| 71 |
+
subok: bool
|
| 72 |
+
signature: _3Tuple[str | None] | str | None
|
| 73 |
+
|
| 74 |
+
@type_check_only
|
| 75 |
+
class _ReduceKwargs(TypedDict, total=False):
|
| 76 |
+
initial: Incomplete # = <no value>
|
| 77 |
+
where: _ArrayLikeBool_co | None # = True
|
| 78 |
+
|
| 79 |
+
# NOTE: `reduce`, `accumulate`, `reduceat` and `outer` raise a ValueError for
|
| 80 |
+
# ufuncs that don't accept two input arguments and return one output argument.
|
| 81 |
+
# In such cases the respective methods return `NoReturn`
|
| 82 |
+
|
| 83 |
+
# NOTE: Similarly, `at` won't be defined for ufuncs that return
|
| 84 |
+
# multiple outputs; in such cases `at` is typed to return `NoReturn`
|
| 85 |
+
|
| 86 |
+
# NOTE: If 2 output types are returned then `out` must be a
|
| 87 |
+
# 2-tuple of arrays. Otherwise `None` or a plain array are also acceptable
|
| 88 |
+
|
| 89 |
+
# pyright: reportIncompatibleMethodOverride=false
|
| 90 |
+
|
| 91 |
+
@type_check_only
|
| 92 |
+
class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 93 |
+
@property
|
| 94 |
+
def __name__(self) -> _NameType: ...
|
| 95 |
+
@property
|
| 96 |
+
def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
|
| 97 |
+
@property
|
| 98 |
+
def ntypes(self) -> _NTypes: ...
|
| 99 |
+
@property
|
| 100 |
+
def identity(self) -> _IDType: ...
|
| 101 |
+
@property
|
| 102 |
+
def nin(self) -> Literal[1]: ...
|
| 103 |
+
@property
|
| 104 |
+
def nout(self) -> Literal[1]: ...
|
| 105 |
+
@property
|
| 106 |
+
def nargs(self) -> Literal[2]: ...
|
| 107 |
+
@property
|
| 108 |
+
def signature(self) -> None: ...
|
| 109 |
+
|
| 110 |
+
@overload
|
| 111 |
+
def __call__(
|
| 112 |
+
self,
|
| 113 |
+
x1: _ScalarLike_co,
|
| 114 |
+
/,
|
| 115 |
+
out: None = None,
|
| 116 |
+
*,
|
| 117 |
+
dtype: DTypeLike | None = None,
|
| 118 |
+
where: _ArrayLikeBool_co | None = True,
|
| 119 |
+
casting: _CastingKind = ...,
|
| 120 |
+
order: _OrderKACF = ...,
|
| 121 |
+
subok: bool = ...,
|
| 122 |
+
signature: str | _2Tuple[str | None] = ...,
|
| 123 |
+
) -> Incomplete: ...
|
| 124 |
+
@overload
|
| 125 |
+
def __call__(
|
| 126 |
+
self,
|
| 127 |
+
x1: ArrayLike,
|
| 128 |
+
/,
|
| 129 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 130 |
+
*,
|
| 131 |
+
dtype: DTypeLike | None = None,
|
| 132 |
+
where: _ArrayLikeBool_co | None = True,
|
| 133 |
+
casting: _CastingKind = ...,
|
| 134 |
+
order: _OrderKACF = ...,
|
| 135 |
+
subok: bool = ...,
|
| 136 |
+
signature: str | _2Tuple[str | None] = ...,
|
| 137 |
+
) -> NDArray[Incomplete]: ...
|
| 138 |
+
@overload
|
| 139 |
+
def __call__(
|
| 140 |
+
self,
|
| 141 |
+
x1: _SupportsArrayUFunc,
|
| 142 |
+
/,
|
| 143 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 144 |
+
*,
|
| 145 |
+
dtype: DTypeLike | None = None,
|
| 146 |
+
where: _ArrayLikeBool_co | None = True,
|
| 147 |
+
casting: _CastingKind = ...,
|
| 148 |
+
order: _OrderKACF = ...,
|
| 149 |
+
subok: bool = ...,
|
| 150 |
+
signature: str | _2Tuple[str | None] = ...,
|
| 151 |
+
) -> Incomplete: ...
|
| 152 |
+
|
| 153 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 154 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 155 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 156 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 157 |
+
|
| 158 |
+
def at(self, a: np.ndarray | _SupportsArrayUFunc, indices: _ArrayLikeInt_co, /) -> None: ... # type: ignore[override]
|
| 159 |
+
|
| 160 |
+
@type_check_only
|
| 161 |
+
class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 162 |
+
@property
|
| 163 |
+
def __name__(self) -> _NameType: ...
|
| 164 |
+
@property
|
| 165 |
+
def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
|
| 166 |
+
@property
|
| 167 |
+
def ntypes(self) -> _NTypes: ...
|
| 168 |
+
@property
|
| 169 |
+
def identity(self) -> _IDType: ...
|
| 170 |
+
@property
|
| 171 |
+
def nin(self) -> Literal[2]: ...
|
| 172 |
+
@property
|
| 173 |
+
def nout(self) -> Literal[1]: ...
|
| 174 |
+
@property
|
| 175 |
+
def nargs(self) -> Literal[3]: ...
|
| 176 |
+
@property
|
| 177 |
+
def signature(self) -> None: ...
|
| 178 |
+
|
| 179 |
+
@overload # (scalar, scalar) -> scalar
|
| 180 |
+
def __call__(
|
| 181 |
+
self,
|
| 182 |
+
x1: _ScalarLike_co,
|
| 183 |
+
x2: _ScalarLike_co,
|
| 184 |
+
/,
|
| 185 |
+
out: EllipsisType | None = None,
|
| 186 |
+
*,
|
| 187 |
+
dtype: DTypeLike | None = None,
|
| 188 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 189 |
+
) -> Incomplete: ...
|
| 190 |
+
@overload # (array-like, array) -> array
|
| 191 |
+
def __call__(
|
| 192 |
+
self,
|
| 193 |
+
x1: ArrayLike,
|
| 194 |
+
x2: np.ndarray,
|
| 195 |
+
/,
|
| 196 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 197 |
+
*,
|
| 198 |
+
dtype: DTypeLike | None = None,
|
| 199 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 200 |
+
) -> NDArray[Incomplete]: ...
|
| 201 |
+
@overload # (array, array-like) -> array
|
| 202 |
+
def __call__(
|
| 203 |
+
self,
|
| 204 |
+
x1: np.ndarray,
|
| 205 |
+
x2: ArrayLike,
|
| 206 |
+
/,
|
| 207 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 208 |
+
*,
|
| 209 |
+
dtype: DTypeLike | None = None,
|
| 210 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 211 |
+
) -> NDArray[Incomplete]: ...
|
| 212 |
+
@overload # (array-like, array-like, out=array) -> array
|
| 213 |
+
def __call__(
|
| 214 |
+
self,
|
| 215 |
+
x1: ArrayLike,
|
| 216 |
+
x2: ArrayLike,
|
| 217 |
+
/,
|
| 218 |
+
out: np.ndarray | tuple[np.ndarray],
|
| 219 |
+
*,
|
| 220 |
+
dtype: DTypeLike | None = None,
|
| 221 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 222 |
+
) -> NDArray[Incomplete]: ...
|
| 223 |
+
@overload # (array-like, array-like) -> array | scalar
|
| 224 |
+
def __call__(
|
| 225 |
+
self,
|
| 226 |
+
x1: ArrayLike,
|
| 227 |
+
x2: ArrayLike,
|
| 228 |
+
/,
|
| 229 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 230 |
+
*,
|
| 231 |
+
dtype: DTypeLike | None = None,
|
| 232 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 233 |
+
) -> NDArray[Incomplete] | Incomplete: ...
|
| 234 |
+
|
| 235 |
+
def accumulate(
|
| 236 |
+
self,
|
| 237 |
+
array: ArrayLike,
|
| 238 |
+
/,
|
| 239 |
+
axis: SupportsIndex = 0,
|
| 240 |
+
dtype: DTypeLike | None = None,
|
| 241 |
+
out: np.ndarray | EllipsisType | None = None,
|
| 242 |
+
) -> NDArray[Incomplete]: ...
|
| 243 |
+
|
| 244 |
+
@overload # type: ignore[override]
|
| 245 |
+
def reduce( # out=None (default), keepdims=False (default)
|
| 246 |
+
self,
|
| 247 |
+
array: ArrayLike,
|
| 248 |
+
/,
|
| 249 |
+
axis: _ShapeLike | None = 0,
|
| 250 |
+
dtype: DTypeLike | None = None,
|
| 251 |
+
out: None = None,
|
| 252 |
+
*,
|
| 253 |
+
keepdims: Literal[False] = False,
|
| 254 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 255 |
+
) -> Incomplete: ...
|
| 256 |
+
@overload # out=ndarray or out=...
|
| 257 |
+
def reduce(
|
| 258 |
+
self,
|
| 259 |
+
array: ArrayLike,
|
| 260 |
+
/,
|
| 261 |
+
axis: _ShapeLike | None = 0,
|
| 262 |
+
dtype: DTypeLike | None = None,
|
| 263 |
+
*,
|
| 264 |
+
out: np.ndarray | EllipsisType,
|
| 265 |
+
keepdims: bool = False,
|
| 266 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 267 |
+
) -> NDArray[Incomplete]: ...
|
| 268 |
+
@overload # keepdims=True
|
| 269 |
+
def reduce(
|
| 270 |
+
self,
|
| 271 |
+
array: ArrayLike,
|
| 272 |
+
/,
|
| 273 |
+
axis: _ShapeLike | None = 0,
|
| 274 |
+
dtype: DTypeLike | None = None,
|
| 275 |
+
out: np.ndarray | EllipsisType | None = None,
|
| 276 |
+
*,
|
| 277 |
+
keepdims: Literal[True],
|
| 278 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 279 |
+
) -> NDArray[Incomplete]: ...
|
| 280 |
+
|
| 281 |
+
def reduceat(
|
| 282 |
+
self,
|
| 283 |
+
array: ArrayLike,
|
| 284 |
+
/,
|
| 285 |
+
indices: _ArrayLikeInt_co,
|
| 286 |
+
axis: SupportsIndex = 0,
|
| 287 |
+
dtype: DTypeLike | None = None,
|
| 288 |
+
out: np.ndarray | EllipsisType | None = None,
|
| 289 |
+
) -> NDArray[Incomplete]: ...
|
| 290 |
+
|
| 291 |
+
@overload # type: ignore[override]
|
| 292 |
+
def outer( # (scalar, scalar) -> scalar
|
| 293 |
+
self,
|
| 294 |
+
A: _ScalarLike_co,
|
| 295 |
+
B: _ScalarLike_co,
|
| 296 |
+
/,
|
| 297 |
+
*,
|
| 298 |
+
out: None = None,
|
| 299 |
+
dtype: DTypeLike | None = None,
|
| 300 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 301 |
+
) -> Incomplete: ...
|
| 302 |
+
@overload # (array-like, array) -> array
|
| 303 |
+
def outer(
|
| 304 |
+
self,
|
| 305 |
+
A: ArrayLike,
|
| 306 |
+
B: np.ndarray,
|
| 307 |
+
/,
|
| 308 |
+
*,
|
| 309 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 310 |
+
dtype: DTypeLike | None = None,
|
| 311 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 312 |
+
) -> NDArray[Incomplete]: ...
|
| 313 |
+
@overload # (array, array-like) -> array
|
| 314 |
+
def outer(
|
| 315 |
+
self,
|
| 316 |
+
A: np.ndarray,
|
| 317 |
+
B: ArrayLike,
|
| 318 |
+
/,
|
| 319 |
+
*,
|
| 320 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 321 |
+
dtype: DTypeLike | None = None,
|
| 322 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 323 |
+
) -> NDArray[Incomplete]: ...
|
| 324 |
+
@overload # (array-like, array-like, out=array) -> array
|
| 325 |
+
def outer(
|
| 326 |
+
self,
|
| 327 |
+
A: ArrayLike,
|
| 328 |
+
B: ArrayLike,
|
| 329 |
+
/,
|
| 330 |
+
*,
|
| 331 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType,
|
| 332 |
+
dtype: DTypeLike | None = None,
|
| 333 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 334 |
+
) -> NDArray[Incomplete]: ...
|
| 335 |
+
@overload # (array-like, array-like) -> array | scalar
|
| 336 |
+
def outer(
|
| 337 |
+
self,
|
| 338 |
+
A: ArrayLike,
|
| 339 |
+
B: ArrayLike,
|
| 340 |
+
/,
|
| 341 |
+
*,
|
| 342 |
+
out: None = None,
|
| 343 |
+
dtype: DTypeLike | None = None,
|
| 344 |
+
**kwds: Unpack[_UFunc3Kwargs],
|
| 345 |
+
) -> NDArray[Incomplete] | Incomplete: ...
|
| 346 |
+
|
| 347 |
+
def at( # type: ignore[override]
|
| 348 |
+
self,
|
| 349 |
+
a: np.ndarray | _SupportsArrayUFunc,
|
| 350 |
+
indices: _ArrayLikeInt_co,
|
| 351 |
+
b: ArrayLike,
|
| 352 |
+
/,
|
| 353 |
+
) -> None: ...
|
| 354 |
+
|
| 355 |
+
@type_check_only
|
| 356 |
+
class _UFunc_Nin1_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 357 |
+
@property
|
| 358 |
+
def __name__(self) -> _NameType: ...
|
| 359 |
+
@property
|
| 360 |
+
def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
|
| 361 |
+
@property
|
| 362 |
+
def ntypes(self) -> _NTypes: ...
|
| 363 |
+
@property
|
| 364 |
+
def identity(self) -> _IDType: ...
|
| 365 |
+
@property
|
| 366 |
+
def nin(self) -> Literal[1]: ...
|
| 367 |
+
@property
|
| 368 |
+
def nout(self) -> Literal[2]: ...
|
| 369 |
+
@property
|
| 370 |
+
def nargs(self) -> Literal[3]: ...
|
| 371 |
+
@property
|
| 372 |
+
def signature(self) -> None: ...
|
| 373 |
+
|
| 374 |
+
@overload
|
| 375 |
+
def __call__(
|
| 376 |
+
self,
|
| 377 |
+
x1: _ScalarLike_co,
|
| 378 |
+
out1: EllipsisType | None = ...,
|
| 379 |
+
out2: None = None,
|
| 380 |
+
/,
|
| 381 |
+
*,
|
| 382 |
+
out: EllipsisType | None = ...,
|
| 383 |
+
dtype: DTypeLike | None = None,
|
| 384 |
+
where: _ArrayLikeBool_co | None = True,
|
| 385 |
+
casting: _CastingKind = ...,
|
| 386 |
+
order: _OrderKACF = ...,
|
| 387 |
+
subok: bool = ...,
|
| 388 |
+
signature: str | _3Tuple[str | None] = ...,
|
| 389 |
+
) -> _2Tuple[Incomplete]: ...
|
| 390 |
+
@overload
|
| 391 |
+
def __call__(
|
| 392 |
+
self,
|
| 393 |
+
x1: ArrayLike,
|
| 394 |
+
out1: np.ndarray | EllipsisType | None = ...,
|
| 395 |
+
out2: np.ndarray | None = ...,
|
| 396 |
+
/,
|
| 397 |
+
*,
|
| 398 |
+
out: _2Tuple[np.ndarray] | EllipsisType = ...,
|
| 399 |
+
dtype: DTypeLike | None = None,
|
| 400 |
+
where: _ArrayLikeBool_co | None = True,
|
| 401 |
+
casting: _CastingKind = ...,
|
| 402 |
+
order: _OrderKACF = ...,
|
| 403 |
+
subok: bool = ...,
|
| 404 |
+
signature: str | _3Tuple[str | None] = ...,
|
| 405 |
+
) -> _2Tuple[NDArray[Incomplete]]: ...
|
| 406 |
+
@overload
|
| 407 |
+
def __call__(
|
| 408 |
+
self,
|
| 409 |
+
x1: _SupportsArrayUFunc,
|
| 410 |
+
out1: np.ndarray | EllipsisType | None = ...,
|
| 411 |
+
out2: np.ndarray | None = ...,
|
| 412 |
+
/,
|
| 413 |
+
*,
|
| 414 |
+
out: _2Tuple[np.ndarray] | EllipsisType = ...,
|
| 415 |
+
dtype: DTypeLike | None = None,
|
| 416 |
+
where: _ArrayLikeBool_co | None = True,
|
| 417 |
+
casting: _CastingKind = ...,
|
| 418 |
+
order: _OrderKACF = ...,
|
| 419 |
+
subok: bool = ...,
|
| 420 |
+
signature: str | _3Tuple[str | None] = ...,
|
| 421 |
+
) -> _2Tuple[Incomplete]: ...
|
| 422 |
+
|
| 423 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 424 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 425 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 426 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 427 |
+
def at(self, a: Never, indices: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 428 |
+
|
| 429 |
+
@type_check_only
|
| 430 |
+
class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
|
| 431 |
+
@property
|
| 432 |
+
def __name__(self) -> _NameType: ...
|
| 433 |
+
@property
|
| 434 |
+
def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
|
| 435 |
+
@property
|
| 436 |
+
def ntypes(self) -> _NTypes: ...
|
| 437 |
+
@property
|
| 438 |
+
def identity(self) -> _IDType: ...
|
| 439 |
+
@property
|
| 440 |
+
def nin(self) -> Literal[2]: ...
|
| 441 |
+
@property
|
| 442 |
+
def nout(self) -> Literal[2]: ...
|
| 443 |
+
@property
|
| 444 |
+
def nargs(self) -> Literal[4]: ...
|
| 445 |
+
@property
|
| 446 |
+
def signature(self) -> None: ...
|
| 447 |
+
|
| 448 |
+
@overload
|
| 449 |
+
def __call__(
|
| 450 |
+
self,
|
| 451 |
+
x1: _ScalarLike_co,
|
| 452 |
+
x2: _ScalarLike_co,
|
| 453 |
+
out1: EllipsisType | None = ...,
|
| 454 |
+
out2: None = None,
|
| 455 |
+
/,
|
| 456 |
+
*,
|
| 457 |
+
out: EllipsisType | None = ...,
|
| 458 |
+
dtype: DTypeLike | None = None,
|
| 459 |
+
where: _ArrayLikeBool_co | None = True,
|
| 460 |
+
casting: _CastingKind = ...,
|
| 461 |
+
order: _OrderKACF = ...,
|
| 462 |
+
subok: bool = ...,
|
| 463 |
+
signature: str | _4Tuple[str | None] = ...,
|
| 464 |
+
) -> _2Tuple[Incomplete]: ...
|
| 465 |
+
@overload
|
| 466 |
+
def __call__(
|
| 467 |
+
self,
|
| 468 |
+
x1: ArrayLike,
|
| 469 |
+
x2: ArrayLike,
|
| 470 |
+
out1: np.ndarray | EllipsisType | None = ...,
|
| 471 |
+
out2: np.ndarray | None = ...,
|
| 472 |
+
/,
|
| 473 |
+
*,
|
| 474 |
+
out: _2Tuple[np.ndarray] | EllipsisType = ...,
|
| 475 |
+
dtype: DTypeLike | None = None,
|
| 476 |
+
where: _ArrayLikeBool_co | None = True,
|
| 477 |
+
casting: _CastingKind = ...,
|
| 478 |
+
order: _OrderKACF = ...,
|
| 479 |
+
subok: bool = ...,
|
| 480 |
+
signature: str | _4Tuple[str | None] = ...,
|
| 481 |
+
) -> _2Tuple[NDArray[Incomplete]]: ...
|
| 482 |
+
|
| 483 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 484 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 485 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 486 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 487 |
+
def at(self, a: Never, indices: Never, b: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 488 |
+
|
| 489 |
+
@type_check_only
|
| 490 |
+
class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType, _Signature]): # type: ignore[misc]
|
| 491 |
+
@property
|
| 492 |
+
def __name__(self) -> _NameType: ...
|
| 493 |
+
@property
|
| 494 |
+
def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
|
| 495 |
+
@property
|
| 496 |
+
def ntypes(self) -> _NTypes: ...
|
| 497 |
+
@property
|
| 498 |
+
def identity(self) -> _IDType: ...
|
| 499 |
+
@property
|
| 500 |
+
def nin(self) -> Literal[2]: ...
|
| 501 |
+
@property
|
| 502 |
+
def nout(self) -> Literal[1]: ...
|
| 503 |
+
@property
|
| 504 |
+
def nargs(self) -> Literal[3]: ...
|
| 505 |
+
@property
|
| 506 |
+
def signature(self) -> _Signature: ...
|
| 507 |
+
|
| 508 |
+
# Scalar for 1D array-likes; ndarray otherwise
|
| 509 |
+
@overload
|
| 510 |
+
def __call__(
|
| 511 |
+
self,
|
| 512 |
+
x1: ArrayLike,
|
| 513 |
+
x2: ArrayLike,
|
| 514 |
+
/,
|
| 515 |
+
out: EllipsisType | None = None,
|
| 516 |
+
*,
|
| 517 |
+
dtype: DTypeLike | None = None,
|
| 518 |
+
casting: _CastingKind = ...,
|
| 519 |
+
order: _OrderKACF = ...,
|
| 520 |
+
subok: bool = ...,
|
| 521 |
+
signature: str | _3Tuple[str | None] = ...,
|
| 522 |
+
axes: list[_2Tuple[SupportsIndex]] = ...,
|
| 523 |
+
) -> Incomplete: ...
|
| 524 |
+
@overload
|
| 525 |
+
def __call__(
|
| 526 |
+
self,
|
| 527 |
+
x1: ArrayLike,
|
| 528 |
+
x2: ArrayLike,
|
| 529 |
+
/,
|
| 530 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType,
|
| 531 |
+
*,
|
| 532 |
+
dtype: DTypeLike | None = None,
|
| 533 |
+
casting: _CastingKind = ...,
|
| 534 |
+
order: _OrderKACF = ...,
|
| 535 |
+
subok: bool = ...,
|
| 536 |
+
signature: str | _3Tuple[str | None] = ...,
|
| 537 |
+
axes: list[_2Tuple[SupportsIndex]] = ...,
|
| 538 |
+
) -> NDArray[Incomplete]: ...
|
| 539 |
+
|
| 540 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 541 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 542 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 543 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 544 |
+
def at(self, a: Never, indices: Never, b: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 545 |
+
|
| 546 |
+
@type_check_only
|
| 547 |
+
class _PyFunc_Kwargs_Nargs2(TypedDict, total=False):
|
| 548 |
+
where: _ArrayLikeBool_co | None
|
| 549 |
+
casting: _CastingKind
|
| 550 |
+
order: _OrderKACF
|
| 551 |
+
dtype: DTypeLike
|
| 552 |
+
subok: bool
|
| 553 |
+
signature: str | tuple[DTypeLike, DTypeLike]
|
| 554 |
+
|
| 555 |
+
@type_check_only
|
| 556 |
+
class _PyFunc_Kwargs_Nargs3(TypedDict, total=False):
|
| 557 |
+
where: _ArrayLikeBool_co | None
|
| 558 |
+
casting: _CastingKind
|
| 559 |
+
order: _OrderKACF
|
| 560 |
+
dtype: DTypeLike
|
| 561 |
+
subok: bool
|
| 562 |
+
signature: str | tuple[DTypeLike, DTypeLike, DTypeLike]
|
| 563 |
+
|
| 564 |
+
@type_check_only
|
| 565 |
+
class _PyFunc_Kwargs_Nargs3P(TypedDict, total=False):
|
| 566 |
+
where: _ArrayLikeBool_co | None
|
| 567 |
+
casting: _CastingKind
|
| 568 |
+
order: _OrderKACF
|
| 569 |
+
dtype: DTypeLike
|
| 570 |
+
subok: bool
|
| 571 |
+
signature: str | _3PTuple[DTypeLike]
|
| 572 |
+
|
| 573 |
+
@type_check_only
|
| 574 |
+
class _PyFunc_Kwargs_Nargs4P(TypedDict, total=False):
|
| 575 |
+
where: _ArrayLikeBool_co | None
|
| 576 |
+
casting: _CastingKind
|
| 577 |
+
order: _OrderKACF
|
| 578 |
+
dtype: DTypeLike
|
| 579 |
+
subok: bool
|
| 580 |
+
signature: str | _4PTuple[DTypeLike]
|
| 581 |
+
|
| 582 |
+
@type_check_only
|
| 583 |
+
class _PyFunc_Nin1_Nout1(ufunc, Generic[_ReturnType_co, _IDType]): # type: ignore[misc]
|
| 584 |
+
@property
|
| 585 |
+
def identity(self) -> _IDType: ...
|
| 586 |
+
@property
|
| 587 |
+
def nin(self) -> Literal[1]: ...
|
| 588 |
+
@property
|
| 589 |
+
def nout(self) -> Literal[1]: ...
|
| 590 |
+
@property
|
| 591 |
+
def nargs(self) -> Literal[2]: ...
|
| 592 |
+
@property
|
| 593 |
+
def ntypes(self) -> Literal[1]: ...
|
| 594 |
+
@property
|
| 595 |
+
def signature(self) -> None: ...
|
| 596 |
+
|
| 597 |
+
@overload
|
| 598 |
+
def __call__(
|
| 599 |
+
self,
|
| 600 |
+
x1: _ScalarLike_co,
|
| 601 |
+
/,
|
| 602 |
+
out: EllipsisType | None = None,
|
| 603 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
|
| 604 |
+
) -> _ReturnType_co: ...
|
| 605 |
+
@overload
|
| 606 |
+
def __call__(
|
| 607 |
+
self,
|
| 608 |
+
x1: ArrayLike,
|
| 609 |
+
/,
|
| 610 |
+
out: EllipsisType | None = None,
|
| 611 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
|
| 612 |
+
) -> _ReturnType_co | NDArray[np.object_]: ...
|
| 613 |
+
@overload
|
| 614 |
+
def __call__(
|
| 615 |
+
self,
|
| 616 |
+
x1: ArrayLike,
|
| 617 |
+
/,
|
| 618 |
+
out: _ArrayT | tuple[_ArrayT],
|
| 619 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
|
| 620 |
+
) -> _ArrayT: ...
|
| 621 |
+
@overload
|
| 622 |
+
def __call__(
|
| 623 |
+
self,
|
| 624 |
+
x1: _SupportsArrayUFunc,
|
| 625 |
+
/,
|
| 626 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 627 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
|
| 628 |
+
) -> Incomplete: ...
|
| 629 |
+
|
| 630 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 631 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 632 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 633 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 634 |
+
|
| 635 |
+
def at(self, a: np.ndarray | _SupportsArrayUFunc, indices: _ArrayLikeInt_co, /) -> None: ... # type: ignore[override]
|
| 636 |
+
|
| 637 |
+
@type_check_only
|
| 638 |
+
class _PyFunc_Nin2_Nout1(ufunc, Generic[_ReturnType_co, _IDType]): # type: ignore[misc]
|
| 639 |
+
@property
|
| 640 |
+
def identity(self) -> _IDType: ...
|
| 641 |
+
@property
|
| 642 |
+
def nin(self) -> Literal[2]: ...
|
| 643 |
+
@property
|
| 644 |
+
def nout(self) -> Literal[1]: ...
|
| 645 |
+
@property
|
| 646 |
+
def nargs(self) -> Literal[3]: ...
|
| 647 |
+
@property
|
| 648 |
+
def ntypes(self) -> Literal[1]: ...
|
| 649 |
+
@property
|
| 650 |
+
def signature(self) -> None: ...
|
| 651 |
+
|
| 652 |
+
@overload
|
| 653 |
+
def __call__(
|
| 654 |
+
self,
|
| 655 |
+
x1: _ScalarLike_co,
|
| 656 |
+
x2: _ScalarLike_co,
|
| 657 |
+
/,
|
| 658 |
+
out: EllipsisType | None = None,
|
| 659 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 660 |
+
) -> _ReturnType_co: ...
|
| 661 |
+
@overload
|
| 662 |
+
def __call__(
|
| 663 |
+
self,
|
| 664 |
+
x1: ArrayLike,
|
| 665 |
+
x2: ArrayLike,
|
| 666 |
+
/,
|
| 667 |
+
out: EllipsisType | None = ...,
|
| 668 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 669 |
+
) -> _ReturnType_co | NDArray[np.object_]: ...
|
| 670 |
+
@overload
|
| 671 |
+
def __call__(
|
| 672 |
+
self,
|
| 673 |
+
x1: ArrayLike,
|
| 674 |
+
x2: ArrayLike,
|
| 675 |
+
/,
|
| 676 |
+
out: _ArrayT | tuple[_ArrayT],
|
| 677 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 678 |
+
) -> _ArrayT: ...
|
| 679 |
+
@overload
|
| 680 |
+
def __call__(
|
| 681 |
+
self,
|
| 682 |
+
x1: _SupportsArrayUFunc,
|
| 683 |
+
x2: _SupportsArrayUFunc | ArrayLike,
|
| 684 |
+
/,
|
| 685 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 686 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 687 |
+
) -> Incomplete: ...
|
| 688 |
+
@overload
|
| 689 |
+
def __call__(
|
| 690 |
+
self,
|
| 691 |
+
x1: ArrayLike,
|
| 692 |
+
x2: _SupportsArrayUFunc,
|
| 693 |
+
/,
|
| 694 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 695 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 696 |
+
) -> Incomplete: ...
|
| 697 |
+
|
| 698 |
+
@overload # type: ignore[override]
|
| 699 |
+
def accumulate(
|
| 700 |
+
self,
|
| 701 |
+
array: ArrayLike,
|
| 702 |
+
/,
|
| 703 |
+
axis: SupportsIndex = 0,
|
| 704 |
+
dtype: DTypeLike | None = None,
|
| 705 |
+
out: EllipsisType | None = None,
|
| 706 |
+
) -> NDArray[np.object_]: ...
|
| 707 |
+
@overload
|
| 708 |
+
def accumulate(
|
| 709 |
+
self,
|
| 710 |
+
array: ArrayLike,
|
| 711 |
+
/,
|
| 712 |
+
axis: SupportsIndex = 0,
|
| 713 |
+
dtype: DTypeLike | None = None,
|
| 714 |
+
*,
|
| 715 |
+
out: _ArrayT,
|
| 716 |
+
) -> _ArrayT: ...
|
| 717 |
+
|
| 718 |
+
@overload # type: ignore[override]
|
| 719 |
+
def reduce( # out=array
|
| 720 |
+
self,
|
| 721 |
+
array: ArrayLike,
|
| 722 |
+
/,
|
| 723 |
+
axis: _ShapeLike | None = 0,
|
| 724 |
+
dtype: DTypeLike | None = None,
|
| 725 |
+
*,
|
| 726 |
+
out: _ArrayT | tuple[_ArrayT],
|
| 727 |
+
keepdims: bool = False,
|
| 728 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 729 |
+
) -> _ArrayT: ...
|
| 730 |
+
@overload # out=...
|
| 731 |
+
def reduce(
|
| 732 |
+
self,
|
| 733 |
+
array: ArrayLike,
|
| 734 |
+
/,
|
| 735 |
+
axis: _ShapeLike | None = 0,
|
| 736 |
+
dtype: DTypeLike | None = None,
|
| 737 |
+
*,
|
| 738 |
+
out: EllipsisType,
|
| 739 |
+
keepdims: bool = False,
|
| 740 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 741 |
+
) -> NDArray[np.object_]: ...
|
| 742 |
+
@overload # keepdims=True
|
| 743 |
+
def reduce(
|
| 744 |
+
self,
|
| 745 |
+
array: ArrayLike,
|
| 746 |
+
/,
|
| 747 |
+
axis: _ShapeLike | None = 0,
|
| 748 |
+
dtype: DTypeLike | None = None,
|
| 749 |
+
out: EllipsisType | None = None,
|
| 750 |
+
*,
|
| 751 |
+
keepdims: Literal[True],
|
| 752 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 753 |
+
) -> NDArray[np.object_]: ...
|
| 754 |
+
@overload
|
| 755 |
+
def reduce(
|
| 756 |
+
self,
|
| 757 |
+
array: ArrayLike,
|
| 758 |
+
/,
|
| 759 |
+
axis: _ShapeLike | None = 0,
|
| 760 |
+
dtype: DTypeLike | None = None,
|
| 761 |
+
out: EllipsisType | None = None,
|
| 762 |
+
keepdims: bool = False,
|
| 763 |
+
**kwargs: Unpack[_ReduceKwargs],
|
| 764 |
+
) -> _ReturnType_co | NDArray[np.object_]: ...
|
| 765 |
+
|
| 766 |
+
@overload # type: ignore[override]
|
| 767 |
+
def reduceat(
|
| 768 |
+
self,
|
| 769 |
+
array: ArrayLike,
|
| 770 |
+
/,
|
| 771 |
+
indices: _ArrayLikeInt_co,
|
| 772 |
+
axis: SupportsIndex = 0,
|
| 773 |
+
dtype: DTypeLike | None = None,
|
| 774 |
+
*,
|
| 775 |
+
out: _ArrayT | tuple[_ArrayT],
|
| 776 |
+
) -> _ArrayT: ...
|
| 777 |
+
@overload
|
| 778 |
+
def reduceat(
|
| 779 |
+
self,
|
| 780 |
+
array: ArrayLike,
|
| 781 |
+
/,
|
| 782 |
+
indices: _ArrayLikeInt_co,
|
| 783 |
+
axis: SupportsIndex = 0,
|
| 784 |
+
dtype: DTypeLike | None = None,
|
| 785 |
+
out: EllipsisType | None = None,
|
| 786 |
+
) -> NDArray[np.object_]: ...
|
| 787 |
+
@overload
|
| 788 |
+
def reduceat(
|
| 789 |
+
self,
|
| 790 |
+
array: _SupportsArrayUFunc,
|
| 791 |
+
/,
|
| 792 |
+
indices: _ArrayLikeInt_co,
|
| 793 |
+
axis: SupportsIndex = 0,
|
| 794 |
+
dtype: DTypeLike | None = None,
|
| 795 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
|
| 796 |
+
) -> Incomplete: ...
|
| 797 |
+
|
| 798 |
+
@overload # type: ignore[override]
|
| 799 |
+
def outer(
|
| 800 |
+
self,
|
| 801 |
+
A: _ScalarLike_co,
|
| 802 |
+
B: _ScalarLike_co,
|
| 803 |
+
/,
|
| 804 |
+
*,
|
| 805 |
+
out: EllipsisType | None = None,
|
| 806 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 807 |
+
) -> _ReturnType_co: ...
|
| 808 |
+
@overload
|
| 809 |
+
def outer(
|
| 810 |
+
self,
|
| 811 |
+
A: ArrayLike,
|
| 812 |
+
B: ArrayLike,
|
| 813 |
+
/,
|
| 814 |
+
*,
|
| 815 |
+
out: EllipsisType | None = None,
|
| 816 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 817 |
+
) -> _ReturnType_co | NDArray[np.object_]: ...
|
| 818 |
+
@overload
|
| 819 |
+
def outer(
|
| 820 |
+
self,
|
| 821 |
+
A: ArrayLike,
|
| 822 |
+
B: ArrayLike,
|
| 823 |
+
/,
|
| 824 |
+
*,
|
| 825 |
+
out: _ArrayT,
|
| 826 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 827 |
+
) -> _ArrayT: ...
|
| 828 |
+
@overload
|
| 829 |
+
def outer(
|
| 830 |
+
self,
|
| 831 |
+
A: _SupportsArrayUFunc,
|
| 832 |
+
B: _SupportsArrayUFunc | ArrayLike,
|
| 833 |
+
/,
|
| 834 |
+
*,
|
| 835 |
+
out: EllipsisType | None = None,
|
| 836 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 837 |
+
) -> Incomplete: ...
|
| 838 |
+
@overload
|
| 839 |
+
def outer(
|
| 840 |
+
self,
|
| 841 |
+
A: _ScalarLike_co,
|
| 842 |
+
B: _SupportsArrayUFunc | ArrayLike,
|
| 843 |
+
/,
|
| 844 |
+
*,
|
| 845 |
+
out: EllipsisType | None = None,
|
| 846 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
|
| 847 |
+
) -> Incomplete: ...
|
| 848 |
+
|
| 849 |
+
def at( # type: ignore[override]
|
| 850 |
+
self,
|
| 851 |
+
a: np.ndarray | _SupportsArrayUFunc,
|
| 852 |
+
indices: _ArrayLikeInt_co,
|
| 853 |
+
b: ArrayLike,
|
| 854 |
+
/,
|
| 855 |
+
) -> None: ...
|
| 856 |
+
|
| 857 |
+
@type_check_only
|
| 858 |
+
class _PyFunc_Nin3P_Nout1(ufunc, Generic[_ReturnType_co, _IDType, _NIn]): # type: ignore[misc]
|
| 859 |
+
@property
|
| 860 |
+
def identity(self) -> _IDType: ...
|
| 861 |
+
@property
|
| 862 |
+
def nin(self) -> _NIn: ...
|
| 863 |
+
@property
|
| 864 |
+
def nout(self) -> Literal[1]: ...
|
| 865 |
+
@property
|
| 866 |
+
def ntypes(self) -> Literal[1]: ...
|
| 867 |
+
@property
|
| 868 |
+
def signature(self) -> None: ...
|
| 869 |
+
|
| 870 |
+
@overload
|
| 871 |
+
def __call__(
|
| 872 |
+
self,
|
| 873 |
+
x1: _ScalarLike_co,
|
| 874 |
+
x2: _ScalarLike_co,
|
| 875 |
+
x3: _ScalarLike_co,
|
| 876 |
+
/,
|
| 877 |
+
*xs: _ScalarLike_co,
|
| 878 |
+
out: EllipsisType | None = ...,
|
| 879 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
|
| 880 |
+
) -> _ReturnType_co: ...
|
| 881 |
+
@overload
|
| 882 |
+
def __call__(
|
| 883 |
+
self,
|
| 884 |
+
x1: ArrayLike,
|
| 885 |
+
x2: ArrayLike,
|
| 886 |
+
x3: ArrayLike,
|
| 887 |
+
/,
|
| 888 |
+
*xs: ArrayLike,
|
| 889 |
+
out: EllipsisType | None = ...,
|
| 890 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
|
| 891 |
+
) -> _ReturnType_co | NDArray[np.object_]: ...
|
| 892 |
+
@overload
|
| 893 |
+
def __call__(
|
| 894 |
+
self,
|
| 895 |
+
x1: ArrayLike,
|
| 896 |
+
x2: ArrayLike,
|
| 897 |
+
x3: ArrayLike,
|
| 898 |
+
/,
|
| 899 |
+
*xs: ArrayLike,
|
| 900 |
+
out: _ArrayT | tuple[_ArrayT],
|
| 901 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
|
| 902 |
+
) -> _ArrayT: ...
|
| 903 |
+
@overload
|
| 904 |
+
def __call__(
|
| 905 |
+
self,
|
| 906 |
+
x1: _SupportsArrayUFunc | ArrayLike,
|
| 907 |
+
x2: _SupportsArrayUFunc | ArrayLike,
|
| 908 |
+
x3: _SupportsArrayUFunc | ArrayLike,
|
| 909 |
+
/,
|
| 910 |
+
*xs: _SupportsArrayUFunc | ArrayLike,
|
| 911 |
+
out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = ...,
|
| 912 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
|
| 913 |
+
) -> Incomplete: ...
|
| 914 |
+
|
| 915 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 916 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 917 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 918 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 919 |
+
def at(self, a: Never, indices: Never, /, *args: Never) -> NoReturn: ... # type: ignore[override]
|
| 920 |
+
|
| 921 |
+
@type_check_only
|
| 922 |
+
class _PyFunc_Nin1P_Nout2P(ufunc, Generic[_ReturnType_co, _IDType, _NIn, _NOut]): # type: ignore[misc]
|
| 923 |
+
@property
|
| 924 |
+
def identity(self) -> _IDType: ...
|
| 925 |
+
@property
|
| 926 |
+
def nin(self) -> _NIn: ...
|
| 927 |
+
@property
|
| 928 |
+
def nout(self) -> _NOut: ...
|
| 929 |
+
@property
|
| 930 |
+
def ntypes(self) -> Literal[1]: ...
|
| 931 |
+
@property
|
| 932 |
+
def signature(self) -> None: ...
|
| 933 |
+
|
| 934 |
+
@overload
|
| 935 |
+
def __call__(
|
| 936 |
+
self,
|
| 937 |
+
x1: _ScalarLike_co,
|
| 938 |
+
/,
|
| 939 |
+
*xs: _ScalarLike_co,
|
| 940 |
+
out: EllipsisType | None = ...,
|
| 941 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
|
| 942 |
+
) -> _2PTuple[_ReturnType_co]: ...
|
| 943 |
+
@overload
|
| 944 |
+
def __call__(
|
| 945 |
+
self,
|
| 946 |
+
x1: ArrayLike,
|
| 947 |
+
/,
|
| 948 |
+
*xs: ArrayLike,
|
| 949 |
+
out: EllipsisType | None = ...,
|
| 950 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
|
| 951 |
+
) -> _2PTuple[_ReturnType_co | NDArray[np.object_]]: ...
|
| 952 |
+
@overload
|
| 953 |
+
def __call__(
|
| 954 |
+
self,
|
| 955 |
+
x1: ArrayLike,
|
| 956 |
+
/,
|
| 957 |
+
*xs: ArrayLike,
|
| 958 |
+
out: _2PTuple[_ArrayT],
|
| 959 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
|
| 960 |
+
) -> _2PTuple[_ArrayT]: ...
|
| 961 |
+
@overload
|
| 962 |
+
def __call__(
|
| 963 |
+
self,
|
| 964 |
+
x1: _SupportsArrayUFunc | ArrayLike,
|
| 965 |
+
/,
|
| 966 |
+
*xs: _SupportsArrayUFunc | ArrayLike,
|
| 967 |
+
out: _2PTuple[np.ndarray] | EllipsisType | None = ...,
|
| 968 |
+
**kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
|
| 969 |
+
) -> Incomplete: ...
|
| 970 |
+
|
| 971 |
+
def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 972 |
+
def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 973 |
+
def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
|
| 974 |
+
def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
|
| 975 |
+
def at(self, a: Never, indices: Never, /, *args: Never) -> NoReturn: ... # type: ignore[override]
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__init__.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This is a module for defining private helpers which do not depend on the
|
| 3 |
+
rest of NumPy.
|
| 4 |
+
|
| 5 |
+
Everything in here must be self-contained so that it can be
|
| 6 |
+
imported anywhere else without creating circular imports.
|
| 7 |
+
If a utility requires the import of NumPy, it probably belongs
|
| 8 |
+
in ``numpy._core``.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import functools
|
| 12 |
+
import warnings
|
| 13 |
+
|
| 14 |
+
from ._convertions import asbytes, asunicode
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def set_module(module):
|
| 18 |
+
"""Private decorator for overriding __module__ on a function or class.
|
| 19 |
+
|
| 20 |
+
Example usage::
|
| 21 |
+
|
| 22 |
+
@set_module('numpy')
|
| 23 |
+
def example():
|
| 24 |
+
pass
|
| 25 |
+
|
| 26 |
+
assert example.__module__ == 'numpy'
|
| 27 |
+
"""
|
| 28 |
+
def decorator(func):
|
| 29 |
+
if module is not None:
|
| 30 |
+
if isinstance(func, type):
|
| 31 |
+
try:
|
| 32 |
+
func._module_source = func.__module__
|
| 33 |
+
except (AttributeError):
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
+
func.__module__ = module
|
| 37 |
+
return func
|
| 38 |
+
return decorator
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def _rename_parameter(old_names, new_names, dep_version=None):
|
| 42 |
+
"""
|
| 43 |
+
Generate decorator for backward-compatible keyword renaming.
|
| 44 |
+
|
| 45 |
+
Apply the decorator generated by `_rename_parameter` to functions with a
|
| 46 |
+
renamed parameter to maintain backward-compatibility.
|
| 47 |
+
|
| 48 |
+
After decoration, the function behaves as follows:
|
| 49 |
+
If only the new parameter is passed into the function, behave as usual.
|
| 50 |
+
If only the old parameter is passed into the function (as a keyword), raise
|
| 51 |
+
a DeprecationWarning if `dep_version` is provided, and behave as usual
|
| 52 |
+
otherwise.
|
| 53 |
+
If both old and new parameters are passed into the function, raise a
|
| 54 |
+
DeprecationWarning if `dep_version` is provided, and raise the appropriate
|
| 55 |
+
TypeError (function got multiple values for argument).
|
| 56 |
+
|
| 57 |
+
Parameters
|
| 58 |
+
----------
|
| 59 |
+
old_names : list of str
|
| 60 |
+
Old names of parameters
|
| 61 |
+
new_name : list of str
|
| 62 |
+
New names of parameters
|
| 63 |
+
dep_version : str, optional
|
| 64 |
+
Version of NumPy in which old parameter was deprecated in the format
|
| 65 |
+
'X.Y.Z'. If supplied, the deprecation message will indicate that
|
| 66 |
+
support for the old parameter will be removed in version 'X.Y+2.Z'
|
| 67 |
+
|
| 68 |
+
Notes
|
| 69 |
+
-----
|
| 70 |
+
Untested with functions that accept *args. Probably won't work as written.
|
| 71 |
+
|
| 72 |
+
"""
|
| 73 |
+
def decorator(fun):
|
| 74 |
+
@functools.wraps(fun)
|
| 75 |
+
def wrapper(*args, **kwargs):
|
| 76 |
+
__tracebackhide__ = True # Hide traceback for py.test
|
| 77 |
+
for old_name, new_name in zip(old_names, new_names):
|
| 78 |
+
if old_name in kwargs:
|
| 79 |
+
if dep_version:
|
| 80 |
+
end_version = dep_version.split('.')
|
| 81 |
+
end_version[1] = str(int(end_version[1]) + 2)
|
| 82 |
+
end_version = '.'.join(end_version)
|
| 83 |
+
msg = (f"Use of keyword argument `{old_name}` is "
|
| 84 |
+
f"deprecated and replaced by `{new_name}`. "
|
| 85 |
+
f"Support for `{old_name}` will be removed "
|
| 86 |
+
f"in NumPy {end_version}.")
|
| 87 |
+
warnings.warn(msg, DeprecationWarning, stacklevel=2)
|
| 88 |
+
if new_name in kwargs:
|
| 89 |
+
msg = (f"{fun.__name__}() got multiple values for "
|
| 90 |
+
f"argument now known as `{new_name}`")
|
| 91 |
+
raise TypeError(msg)
|
| 92 |
+
kwargs[new_name] = kwargs.pop(old_name)
|
| 93 |
+
return fun(*args, **kwargs)
|
| 94 |
+
return wrapper
|
| 95 |
+
return decorator
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__init__.pyi
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from _typeshed import IdentityFunction
|
| 2 |
+
from collections.abc import Callable, Iterable
|
| 3 |
+
from typing import Protocol, TypeVar, overload, type_check_only
|
| 4 |
+
|
| 5 |
+
from ._convertions import asbytes as asbytes, asunicode as asunicode
|
| 6 |
+
|
| 7 |
+
###
|
| 8 |
+
|
| 9 |
+
_T = TypeVar("_T")
|
| 10 |
+
_HasModuleT = TypeVar("_HasModuleT", bound=_HasModule)
|
| 11 |
+
|
| 12 |
+
@type_check_only
|
| 13 |
+
class _HasModule(Protocol):
|
| 14 |
+
__module__: str
|
| 15 |
+
|
| 16 |
+
###
|
| 17 |
+
|
| 18 |
+
@overload
|
| 19 |
+
def set_module(module: None) -> IdentityFunction: ...
|
| 20 |
+
@overload
|
| 21 |
+
def set_module(module: str) -> Callable[[_HasModuleT], _HasModuleT]: ...
|
| 22 |
+
|
| 23 |
+
#
|
| 24 |
+
def _rename_parameter(
|
| 25 |
+
old_names: Iterable[str],
|
| 26 |
+
new_names: Iterable[str],
|
| 27 |
+
dep_version: str | None = None,
|
| 28 |
+
) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (4.18 kB). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/_convertions.cpython-312.pyc
ADDED
|
Binary file (836 Bytes). View file
|
|
|
loan-advisor-agent/.venv/Lib/site-packages/numpy/_utils/__pycache__/_inspect.cpython-312.pyc
ADDED
|
Binary file (9.41 kB). View file
|
|
|