Add loan-advisor-agent
Browse files- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/INSTALLER +1 -0
- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/METADATA +400 -0
- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/RECORD +7 -0
- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/REQUESTED +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/WHEEL +4 -0
- loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/licenses/LICENSE +24 -0
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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: thomas.moreau.2010@gmail.com
|
| 8 |
+
Requires-Python: >=3.9
|
| 9 |
+
Description-Content-Type: text/markdown
|
| 10 |
+
License: BSD-3-Clause
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 19 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 20 |
+
License-File: LICENSE
|
| 21 |
+
|
| 22 |
+
# Thread-pool Controls [](https://github.com/joblib/threadpoolctl/actions?query=branch%3Amaster) [](https://codecov.io/gh/joblib/threadpoolctl)
|
| 23 |
+
|
| 24 |
+
Python helpers to limit the number of threads used in the
|
| 25 |
+
threadpool-backed of common native libraries used for scientific
|
| 26 |
+
computing and data science (e.g. BLAS and OpenMP).
|
| 27 |
+
|
| 28 |
+
Fine control of the underlying thread-pool size can be useful in
|
| 29 |
+
workloads that involve nested parallelism so as to mitigate
|
| 30 |
+
oversubscription issues.
|
| 31 |
+
|
| 32 |
+
## Installation
|
| 33 |
+
|
| 34 |
+
- For users, install the last published version from PyPI:
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
pip install threadpoolctl
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
- For contributors, install from the source repository in developer
|
| 41 |
+
mode:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
pip install -r dev-requirements.txt
|
| 45 |
+
flit install --symlink
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
then you run the tests with pytest:
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
pytest
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
### Command Line Interface
|
| 57 |
+
|
| 58 |
+
Get a JSON description of thread-pools initialized when importing python
|
| 59 |
+
packages such as numpy or scipy for instance:
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
python -m threadpoolctl -i numpy scipy.linalg
|
| 63 |
+
[
|
| 64 |
+
{
|
| 65 |
+
"filepath": "/home/ogrisel/miniconda3/envs/tmp/lib/libmkl_rt.so",
|
| 66 |
+
"prefix": "libmkl_rt",
|
| 67 |
+
"user_api": "blas",
|
| 68 |
+
"internal_api": "mkl",
|
| 69 |
+
"version": "2019.0.4",
|
| 70 |
+
"num_threads": 2,
|
| 71 |
+
"threading_layer": "intel"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"filepath": "/home/ogrisel/miniconda3/envs/tmp/lib/libiomp5.so",
|
| 75 |
+
"prefix": "libiomp",
|
| 76 |
+
"user_api": "openmp",
|
| 77 |
+
"internal_api": "openmp",
|
| 78 |
+
"version": null,
|
| 79 |
+
"num_threads": 4
|
| 80 |
+
}
|
| 81 |
+
]
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
The JSON information is written on STDOUT. If some of the packages are missing,
|
| 85 |
+
a warning message is displayed on STDERR.
|
| 86 |
+
|
| 87 |
+
### Python Runtime Programmatic Introspection
|
| 88 |
+
|
| 89 |
+
Introspect the current state of the threadpool-enabled runtime libraries
|
| 90 |
+
that are loaded when importing Python packages:
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
>>> from threadpoolctl import threadpool_info
|
| 94 |
+
>>> from pprint import pprint
|
| 95 |
+
>>> pprint(threadpool_info())
|
| 96 |
+
[]
|
| 97 |
+
|
| 98 |
+
>>> import numpy
|
| 99 |
+
>>> pprint(threadpool_info())
|
| 100 |
+
[{'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libmkl_rt.so',
|
| 101 |
+
'internal_api': 'mkl',
|
| 102 |
+
'num_threads': 2,
|
| 103 |
+
'prefix': 'libmkl_rt',
|
| 104 |
+
'threading_layer': 'intel',
|
| 105 |
+
'user_api': 'blas',
|
| 106 |
+
'version': '2019.0.4'},
|
| 107 |
+
{'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libiomp5.so',
|
| 108 |
+
'internal_api': 'openmp',
|
| 109 |
+
'num_threads': 4,
|
| 110 |
+
'prefix': 'libiomp',
|
| 111 |
+
'user_api': 'openmp',
|
| 112 |
+
'version': None}]
|
| 113 |
+
|
| 114 |
+
>>> import xgboost
|
| 115 |
+
>>> pprint(threadpool_info())
|
| 116 |
+
[{'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libmkl_rt.so',
|
| 117 |
+
'internal_api': 'mkl',
|
| 118 |
+
'num_threads': 2,
|
| 119 |
+
'prefix': 'libmkl_rt',
|
| 120 |
+
'threading_layer': 'intel',
|
| 121 |
+
'user_api': 'blas',
|
| 122 |
+
'version': '2019.0.4'},
|
| 123 |
+
{'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libiomp5.so',
|
| 124 |
+
'internal_api': 'openmp',
|
| 125 |
+
'num_threads': 4,
|
| 126 |
+
'prefix': 'libiomp',
|
| 127 |
+
'user_api': 'openmp',
|
| 128 |
+
'version': None},
|
| 129 |
+
{'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libgomp.so.1.0.0',
|
| 130 |
+
'internal_api': 'openmp',
|
| 131 |
+
'num_threads': 4,
|
| 132 |
+
'prefix': 'libgomp',
|
| 133 |
+
'user_api': 'openmp',
|
| 134 |
+
'version': None}]
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
In the above example, `numpy` was installed from the default anaconda channel and comes
|
| 138 |
+
with MKL and its Intel OpenMP (`libiomp5`) implementation while `xgboost` was installed
|
| 139 |
+
from pypi.org and links against GNU OpenMP (`libgomp`) so both OpenMP runtimes are
|
| 140 |
+
loaded in the same Python program.
|
| 141 |
+
|
| 142 |
+
The state of these libraries is also accessible through the object oriented API:
|
| 143 |
+
|
| 144 |
+
```python
|
| 145 |
+
>>> from threadpoolctl import ThreadpoolController, threadpool_info
|
| 146 |
+
>>> from pprint import pprint
|
| 147 |
+
>>> import numpy
|
| 148 |
+
>>> controller = ThreadpoolController()
|
| 149 |
+
>>> pprint(controller.info())
|
| 150 |
+
[{'architecture': 'Haswell',
|
| 151 |
+
'filepath': '/home/jeremie/miniconda/envs/dev/lib/libopenblasp-r0.3.17.so',
|
| 152 |
+
'internal_api': 'openblas',
|
| 153 |
+
'num_threads': 4,
|
| 154 |
+
'prefix': 'libopenblas',
|
| 155 |
+
'threading_layer': 'pthreads',
|
| 156 |
+
'user_api': 'blas',
|
| 157 |
+
'version': '0.3.17'}]
|
| 158 |
+
|
| 159 |
+
>>> controller.info() == threadpool_info()
|
| 160 |
+
True
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
### Setting the Maximum Size of Thread-Pools
|
| 164 |
+
|
| 165 |
+
Control the number of threads used by the underlying runtime libraries
|
| 166 |
+
in specific sections of your Python program:
|
| 167 |
+
|
| 168 |
+
```python
|
| 169 |
+
>>> from threadpoolctl import threadpool_limits
|
| 170 |
+
>>> import numpy as np
|
| 171 |
+
|
| 172 |
+
>>> with threadpool_limits(limits=1, user_api='blas'):
|
| 173 |
+
... # In this block, calls to blas implementation (like openblas or MKL)
|
| 174 |
+
... # will be limited to use only one thread. They can thus be used jointly
|
| 175 |
+
... # with thread-parallelism.
|
| 176 |
+
... a = np.random.randn(1000, 1000)
|
| 177 |
+
... a_squared = a @ a
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
The threadpools can also be controlled via the object oriented API, which is especially
|
| 181 |
+
useful to avoid searching through all the loaded shared libraries each time. It will
|
| 182 |
+
however not act on libraries loaded after the instantiation of the
|
| 183 |
+
`ThreadpoolController`:
|
| 184 |
+
|
| 185 |
+
```python
|
| 186 |
+
>>> from threadpoolctl import ThreadpoolController
|
| 187 |
+
>>> import numpy as np
|
| 188 |
+
>>> controller = ThreadpoolController()
|
| 189 |
+
|
| 190 |
+
>>> with controller.limit(limits=1, user_api='blas'):
|
| 191 |
+
... a = np.random.randn(1000, 1000)
|
| 192 |
+
... a_squared = a @ a
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
### Restricting the limits to the scope of a function
|
| 196 |
+
|
| 197 |
+
`threadpool_limits` and `ThreadpoolController` can also be used as decorators to set
|
| 198 |
+
the maximum number of threads used by the supported libraries at a function level. The
|
| 199 |
+
decorators are accessible through their `wrap` method:
|
| 200 |
+
|
| 201 |
+
```python
|
| 202 |
+
>>> from threadpoolctl import ThreadpoolController, threadpool_limits
|
| 203 |
+
>>> import numpy as np
|
| 204 |
+
>>> controller = ThreadpoolController()
|
| 205 |
+
|
| 206 |
+
>>> @controller.wrap(limits=1, user_api='blas')
|
| 207 |
+
... # or @threadpool_limits.wrap(limits=1, user_api='blas')
|
| 208 |
+
... def my_func():
|
| 209 |
+
... # Inside this function, calls to blas implementation (like openblas or MKL)
|
| 210 |
+
... # will be limited to use only one thread.
|
| 211 |
+
... a = np.random.randn(1000, 1000)
|
| 212 |
+
... a_squared = a @ a
|
| 213 |
+
...
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
### Switching the FlexiBLAS backend
|
| 217 |
+
|
| 218 |
+
`FlexiBLAS` is a BLAS wrapper for which the BLAS backend can be switched at runtime.
|
| 219 |
+
`threadpoolctl` exposes python bindings for this feature. Here's an example but note
|
| 220 |
+
that this part of the API is experimental and subject to change without deprecation:
|
| 221 |
+
|
| 222 |
+
```python
|
| 223 |
+
>>> from threadpoolctl import ThreadpoolController
|
| 224 |
+
>>> import numpy as np
|
| 225 |
+
>>> controller = ThreadpoolController()
|
| 226 |
+
|
| 227 |
+
>>> controller.info()
|
| 228 |
+
[{'user_api': 'blas',
|
| 229 |
+
'internal_api': 'flexiblas',
|
| 230 |
+
'num_threads': 1,
|
| 231 |
+
'prefix': 'libflexiblas',
|
| 232 |
+
'filepath': '/usr/local/lib/libflexiblas.so.3.3',
|
| 233 |
+
'version': '3.3.1',
|
| 234 |
+
'available_backends': ['NETLIB', 'OPENBLASPTHREAD', 'ATLAS'],
|
| 235 |
+
'loaded_backends': ['NETLIB'],
|
| 236 |
+
'current_backend': 'NETLIB'}]
|
| 237 |
+
|
| 238 |
+
# Retrieve the flexiblas controller
|
| 239 |
+
>>> flexiblas_ct = controller.select(internal_api="flexiblas").lib_controllers[0]
|
| 240 |
+
|
| 241 |
+
# Switch the backend with one predefined at build time (listed in "available_backends")
|
| 242 |
+
>>> flexiblas_ct.switch_backend("OPENBLASPTHREAD")
|
| 243 |
+
>>> controller.info()
|
| 244 |
+
[{'user_api': 'blas',
|
| 245 |
+
'internal_api': 'flexiblas',
|
| 246 |
+
'num_threads': 4,
|
| 247 |
+
'prefix': 'libflexiblas',
|
| 248 |
+
'filepath': '/usr/local/lib/libflexiblas.so.3.3',
|
| 249 |
+
'version': '3.3.1',
|
| 250 |
+
'available_backends': ['NETLIB', 'OPENBLASPTHREAD', 'ATLAS'],
|
| 251 |
+
'loaded_backends': ['NETLIB', 'OPENBLASPTHREAD'],
|
| 252 |
+
'current_backend': 'OPENBLASPTHREAD'},
|
| 253 |
+
{'user_api': 'blas',
|
| 254 |
+
'internal_api': 'openblas',
|
| 255 |
+
'num_threads': 4,
|
| 256 |
+
'prefix': 'libopenblas',
|
| 257 |
+
'filepath': '/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so',
|
| 258 |
+
'version': '0.3.8',
|
| 259 |
+
'threading_layer': 'pthreads',
|
| 260 |
+
'architecture': 'Haswell'}]
|
| 261 |
+
|
| 262 |
+
# It's also possible to directly give the path to a shared library
|
| 263 |
+
>>> flexiblas_controller.switch_backend("/home/jeremie/miniforge/envs/flexiblas_threadpoolctl/lib/libmkl_rt.so")
|
| 264 |
+
>>> controller.info()
|
| 265 |
+
[{'user_api': 'blas',
|
| 266 |
+
'internal_api': 'flexiblas',
|
| 267 |
+
'num_threads': 2,
|
| 268 |
+
'prefix': 'libflexiblas',
|
| 269 |
+
'filepath': '/usr/local/lib/libflexiblas.so.3.3',
|
| 270 |
+
'version': '3.3.1',
|
| 271 |
+
'available_backends': ['NETLIB', 'OPENBLASPTHREAD', 'ATLAS'],
|
| 272 |
+
'loaded_backends': ['NETLIB',
|
| 273 |
+
'OPENBLASPTHREAD',
|
| 274 |
+
'/home/jeremie/miniforge/envs/flexiblas_threadpoolctl/lib/libmkl_rt.so'],
|
| 275 |
+
'current_backend': '/home/jeremie/miniforge/envs/flexiblas_threadpoolctl/lib/libmkl_rt.so'},
|
| 276 |
+
{'user_api': 'openmp',
|
| 277 |
+
'internal_api': 'openmp',
|
| 278 |
+
'num_threads': 4,
|
| 279 |
+
'prefix': 'libomp',
|
| 280 |
+
'filepath': '/home/jeremie/miniforge/envs/flexiblas_threadpoolctl/lib/libomp.so',
|
| 281 |
+
'version': None},
|
| 282 |
+
{'user_api': 'blas',
|
| 283 |
+
'internal_api': 'openblas',
|
| 284 |
+
'num_threads': 4,
|
| 285 |
+
'prefix': 'libopenblas',
|
| 286 |
+
'filepath': '/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so',
|
| 287 |
+
'version': '0.3.8',
|
| 288 |
+
'threading_layer': 'pthreads',
|
| 289 |
+
'architecture': 'Haswell'},
|
| 290 |
+
{'user_api': 'blas',
|
| 291 |
+
'internal_api': 'mkl',
|
| 292 |
+
'num_threads': 2,
|
| 293 |
+
'prefix': 'libmkl_rt',
|
| 294 |
+
'filepath': '/home/jeremie/miniforge/envs/flexiblas_threadpoolctl/lib/libmkl_rt.so.2',
|
| 295 |
+
'version': '2024.0-Product',
|
| 296 |
+
'threading_layer': 'gnu'}]
|
| 297 |
+
```
|
| 298 |
+
|
| 299 |
+
You can observe that the previously linked OpenBLAS shared object stays loaded by
|
| 300 |
+
the Python program indefinitely, but FlexiBLAS itself no longer delegates BLAS calls
|
| 301 |
+
to OpenBLAS as indicated by the `current_backend` attribute.
|
| 302 |
+
### Writing a custom library controller
|
| 303 |
+
|
| 304 |
+
Currently, `threadpoolctl` has support for `OpenMP` and the main `BLAS` libraries.
|
| 305 |
+
However it can also be used to control the threadpool of other native libraries,
|
| 306 |
+
provided that they expose an API to get and set the limit on the number of threads.
|
| 307 |
+
For that, one must implement a controller for this library and register it to
|
| 308 |
+
`threadpoolctl`.
|
| 309 |
+
|
| 310 |
+
A custom controller must be a subclass of the `LibController` class and implement
|
| 311 |
+
the attributes and methods described in the docstring of `LibController`. Then this
|
| 312 |
+
new controller class must be registered using the `threadpoolctl.register` function.
|
| 313 |
+
An complete example can be found [here](
|
| 314 |
+
https://github.com/joblib/threadpoolctl/blob/master/tests/_pyMylib/__init__.py).
|
| 315 |
+
|
| 316 |
+
### Sequential BLAS within OpenMP parallel region
|
| 317 |
+
|
| 318 |
+
When one wants to have sequential BLAS calls within an OpenMP parallel region, it's
|
| 319 |
+
safer to set `limits="sequential_blas_under_openmp"` since setting `limits=1` and
|
| 320 |
+
`user_api="blas"` might not lead to the expected behavior in some configurations
|
| 321 |
+
(e.g. OpenBLAS with the OpenMP threading layer
|
| 322 |
+
https://github.com/xianyi/OpenBLAS/issues/2985).
|
| 323 |
+
|
| 324 |
+
### Known Limitations
|
| 325 |
+
|
| 326 |
+
- `threadpool_limits` can fail to limit the number of inner threads when nesting
|
| 327 |
+
parallel loops managed by distinct OpenMP runtime implementations (for instance
|
| 328 |
+
libgomp from GCC and libomp from clang/llvm or libiomp from ICC).
|
| 329 |
+
|
| 330 |
+
See the `test_openmp_nesting` function in [tests/test_threadpoolctl.py](
|
| 331 |
+
https://github.com/joblib/threadpoolctl/blob/master/tests/test_threadpoolctl.py)
|
| 332 |
+
for an example. More information can be found at:
|
| 333 |
+
https://github.com/jeremiedbb/Nested_OpenMP
|
| 334 |
+
|
| 335 |
+
Note however that this problem does not happen when `threadpool_limits` is
|
| 336 |
+
used to limit the number of threads used internally by BLAS calls that are
|
| 337 |
+
themselves nested under OpenMP parallel loops. `threadpool_limits` works as
|
| 338 |
+
expected, even if the inner BLAS implementation relies on a distinct OpenMP
|
| 339 |
+
implementation.
|
| 340 |
+
|
| 341 |
+
- Using Intel OpenMP (ICC) and LLVM OpenMP (clang) in the same Python program
|
| 342 |
+
under Linux is known to cause problems. See the following guide for more details
|
| 343 |
+
and workarounds:
|
| 344 |
+
https://github.com/joblib/threadpoolctl/blob/master/multiple_openmp.md
|
| 345 |
+
|
| 346 |
+
- Setting the maximum number of threads of the OpenMP and BLAS libraries has a global
|
| 347 |
+
effect and impacts the whole Python process. There is no thread level isolation as
|
| 348 |
+
these libraries do not offer thread-local APIs to configure the number of threads to
|
| 349 |
+
use in nested parallel calls.
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
## Maintainers
|
| 353 |
+
|
| 354 |
+
To make a release:
|
| 355 |
+
|
| 356 |
+
- Bump the version number (`__version__`) in `threadpoolctl.py` and update the
|
| 357 |
+
release date in `CHANGES.md`.
|
| 358 |
+
|
| 359 |
+
- Build the distribution archives:
|
| 360 |
+
|
| 361 |
+
```bash
|
| 362 |
+
pip install flit
|
| 363 |
+
flit build
|
| 364 |
+
```
|
| 365 |
+
|
| 366 |
+
and check the contents of `dist/`.
|
| 367 |
+
|
| 368 |
+
- If everything is fine, make a commit for the release, tag it and push the
|
| 369 |
+
tag to github:
|
| 370 |
+
|
| 371 |
+
```bash
|
| 372 |
+
git tag -a X.Y.Z
|
| 373 |
+
git push git@github.com:joblib/threadpoolctl.git X.Y.Z
|
| 374 |
+
```
|
| 375 |
+
|
| 376 |
+
- Upload the wheels and source distribution to PyPI using flit. Since PyPI doesn't
|
| 377 |
+
allow password authentication anymore, the username needs to be changed to the
|
| 378 |
+
generic name `__token__`:
|
| 379 |
+
|
| 380 |
+
```bash
|
| 381 |
+
FLIT_USERNAME=__token__ flit publish
|
| 382 |
+
```
|
| 383 |
+
|
| 384 |
+
and a PyPI token has to be passed in place of the password.
|
| 385 |
+
|
| 386 |
+
- Create a PR for the release on the [conda-forge feedstock](https://github.com/conda-forge/threadpoolctl-feedstock) (or wait for the bot to make it).
|
| 387 |
+
|
| 388 |
+
- Publish the release on github.
|
| 389 |
+
|
| 390 |
+
### Credits
|
| 391 |
+
|
| 392 |
+
The initial dynamic library introspection code was written by @anton-malakhov
|
| 393 |
+
for the smp package available at https://github.com/IntelPython/smp .
|
| 394 |
+
|
| 395 |
+
threadpoolctl extends this for other operating systems. Contrary to smp,
|
| 396 |
+
threadpoolctl does not attempt to limit the size of Python multiprocessing
|
| 397 |
+
pools (threads or processes) or set operating system-level CPU affinity
|
| 398 |
+
constraints: threadpoolctl only interacts with native libraries via their
|
| 399 |
+
public runtime APIs.
|
| 400 |
+
|
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
threadpoolctl-3.6.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
threadpoolctl-3.6.0.dist-info/METADATA,sha256=pF340H6hiD13IYOlAdfVJgdqpw38_dsnaiy9wE3vU0E,13843
|
| 3 |
+
threadpoolctl-3.6.0.dist-info/RECORD,,
|
| 4 |
+
threadpoolctl-3.6.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
threadpoolctl-3.6.0.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
|
| 6 |
+
threadpoolctl-3.6.0.dist-info/licenses/LICENSE,sha256=gaxhkHUkiwblNmC2UtEOSF9GdfXQrg-X6iI3DaH34js,1507
|
| 7 |
+
threadpoolctl.py,sha256=EvuVJranTS5oa37BSNwWXDWHmZsU-oaYSqGA4QgCQAs,50722
|
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/REQUESTED
ADDED
|
File without changes
|
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: flit 3.11.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
loan-advisor-agent/.venv/Lib/site-packages/threadpoolctl-3.6.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2019, threadpoolctl contributors
|
| 2 |
+
|
| 3 |
+
Redistribution and use in source and binary forms, with or without
|
| 4 |
+
modification, are permitted provided that the following conditions are met:
|
| 5 |
+
|
| 6 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 7 |
+
this list of conditions and the following disclaimer.
|
| 8 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
documentation and/or other materials provided with the distribution.
|
| 11 |
+
* Neither the name of copyright holder nor the names of its contributors
|
| 12 |
+
may be used to endorse or promote products derived from this software
|
| 13 |
+
without specific prior written permission.
|
| 14 |
+
|
| 15 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 18 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
| 19 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 20 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 21 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 22 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 23 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 24 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|