Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +5 -0
- .venv/lib/python3.11/site-packages/blake3/blake3.cpython-311-x86_64-linux-gnu.so +3 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/INSTALLER +1 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/LICENSE +23 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/METADATA +75 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/RECORD +19 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/WHEEL +5 -0
- .venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/top_level.txt +1 -0
- .venv/lib/python3.11/site-packages/idna/__pycache__/idnadata.cpython-311.pyc +3 -0
- .venv/lib/python3.11/site-packages/idna/__pycache__/uts46data.cpython-311.pyc +3 -0
- .venv/lib/python3.11/site-packages/jiter/jiter.cpython-311-x86_64-linux-gnu.so +3 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/INSTALLER +1 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/License.txt +1568 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/METADATA +35 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/RECORD +17 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/WHEEL +5 -0
- .venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/top_level.txt +1 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/zipp.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__init__.py +36 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/__init__.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_adapters.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_common.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_compat.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_itertools.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_legacy.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/abc.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/readers.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/simple.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_adapters.py +170 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_common.py +104 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_compat.py +98 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/abc.py +137 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/readers.py +122 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/simple.py +116 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__init__.py +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/__init__.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/context.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/functools.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/context.py +213 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/functools.py +525 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/text/__init__.py +599 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/text/__pycache__/__init__.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__init__.py +4 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/__init__.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/recipes.cpython-311.pyc +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/more.py +0 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/recipes.py +698 -0
- .venv/lib/python3.11/site-packages/pkg_resources/_vendor/packaging/__about__.py +26 -0
.gitattributes
CHANGED
|
@@ -414,3 +414,8 @@ tuning-competition-baseline/.venv/lib/python3.11/site-packages/nvidia/cudnn/lib/
|
|
| 414 |
.venv/lib/python3.11/site-packages/cv2/cv2.abi3.so filter=lfs diff=lfs merge=lfs -text
|
| 415 |
.venv/lib/python3.11/site-packages/nvidia/cudnn/lib/libcudnn_engines_runtime_compiled.so.9 filter=lfs diff=lfs merge=lfs -text
|
| 416 |
.venv/lib/python3.11/site-packages/nvidia/cusolver/lib/libcusolverMg.so.11 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
.venv/lib/python3.11/site-packages/cv2/cv2.abi3.so filter=lfs diff=lfs merge=lfs -text
|
| 415 |
.venv/lib/python3.11/site-packages/nvidia/cudnn/lib/libcudnn_engines_runtime_compiled.so.9 filter=lfs diff=lfs merge=lfs -text
|
| 416 |
.venv/lib/python3.11/site-packages/nvidia/cusolver/lib/libcusolverMg.so.11 filter=lfs diff=lfs merge=lfs -text
|
| 417 |
+
.venv/lib/python3.11/site-packages/tokenizers/tokenizers.abi3.so filter=lfs diff=lfs merge=lfs -text
|
| 418 |
+
.venv/lib/python3.11/site-packages/blake3/blake3.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 419 |
+
.venv/lib/python3.11/site-packages/jiter/jiter.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 420 |
+
.venv/lib/python3.11/site-packages/idna/__pycache__/uts46data.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
|
| 421 |
+
.venv/lib/python3.11/site-packages/idna/__pycache__/idnadata.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
|
.venv/lib/python3.11/site-packages/blake3/blake3.cpython-311-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:859ec8e9dfc40a1b944a570a9f941f68d3744c38d834da744bdc5e7597b9bde7
|
| 3 |
+
size 964720
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Httplib2 Software License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2006 by Joe Gregorio
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person
|
| 6 |
+
obtaining a copy of this software and associated documentation
|
| 7 |
+
files (the "Software"), to deal in the Software without restriction,
|
| 8 |
+
including without limitation the rights to use, copy, modify, merge,
|
| 9 |
+
publish, distribute, sublicense, and/or sell copies of the Software,
|
| 10 |
+
and to permit persons to whom the Software is furnished to do so,
|
| 11 |
+
subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
| 18 |
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
| 20 |
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
| 21 |
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
| 22 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 23 |
+
SOFTWARE.
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: httplib2
|
| 3 |
+
Version: 0.22.0
|
| 4 |
+
Summary: A comprehensive HTTP client library.
|
| 5 |
+
Home-page: https://github.com/httplib2/httplib2
|
| 6 |
+
Author: Joe Gregorio
|
| 7 |
+
Author-email: joe@bitworking.org
|
| 8 |
+
License: MIT
|
| 9 |
+
Classifier: Development Status :: 4 - Beta
|
| 10 |
+
Classifier: Environment :: Web Environment
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 13 |
+
Classifier: Operating System :: OS Independent
|
| 14 |
+
Classifier: Programming Language :: Python
|
| 15 |
+
Classifier: Programming Language :: Python :: 2
|
| 16 |
+
Classifier: Programming Language :: Python :: 2.7
|
| 17 |
+
Classifier: Programming Language :: Python :: 3
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.4
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.5
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.6
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 26 |
+
Classifier: Topic :: Internet :: WWW/HTTP
|
| 27 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 28 |
+
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
|
| 29 |
+
License-File: LICENSE
|
| 30 |
+
Requires-Dist: pyparsing (<3,>=2.4.2) ; python_version < "3.0"
|
| 31 |
+
Requires-Dist: pyparsing (!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2) ; python_version > "3.0"
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
A comprehensive HTTP client library, ``httplib2`` supports many features left out of other HTTP libraries.
|
| 36 |
+
|
| 37 |
+
**HTTP and HTTPS**
|
| 38 |
+
HTTPS support is only available if the socket module was compiled with SSL support.
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
**Keep-Alive**
|
| 42 |
+
Supports HTTP 1.1 Keep-Alive, keeping the socket open and performing multiple requests over the same connection if possible.
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
**Authentication**
|
| 46 |
+
The following three types of HTTP Authentication are supported. These can be used over both HTTP and HTTPS.
|
| 47 |
+
|
| 48 |
+
* Digest
|
| 49 |
+
* Basic
|
| 50 |
+
* WSSE
|
| 51 |
+
|
| 52 |
+
**Caching**
|
| 53 |
+
The module can optionally operate with a private cache that understands the Cache-Control:
|
| 54 |
+
header and uses both the ETag and Last-Modified cache validators. Both file system
|
| 55 |
+
and memcached based caches are supported.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
**All Methods**
|
| 59 |
+
The module can handle any HTTP request method, not just GET and POST.
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
**Redirects**
|
| 63 |
+
Automatically follows 3XX redirects on GETs.
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
**Compression**
|
| 67 |
+
Handles both 'deflate' and 'gzip' types of compression.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
**Lost update support**
|
| 71 |
+
Automatically adds back ETags into PUT requests to resources we have already cached. This implements Section 3.2 of Detecting the Lost Update Problem Using Unreserved Checkout
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
**Unit Tested**
|
| 75 |
+
A large and growing set of unit tests.
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
httplib2-0.22.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
httplib2-0.22.0.dist-info/LICENSE,sha256=WJ7sOPct8r4gNxHTuMvs6bkIxef_ALw8q39juunjZrQ,1086
|
| 3 |
+
httplib2-0.22.0.dist-info/METADATA,sha256=KKy58CVIaYnc6oBjD0upeaA1dgTbB6z7JK5I6FmDSEM,2618
|
| 4 |
+
httplib2-0.22.0.dist-info/RECORD,,
|
| 5 |
+
httplib2-0.22.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
| 6 |
+
httplib2-0.22.0.dist-info/top_level.txt,sha256=BEY8ChKwagUWmu9x8yN9JObJpZKNeWCr1E-sIECb56I,9
|
| 7 |
+
httplib2/__init__.py,sha256=UOzaxGwGweHiLsxKBc39_Ez0N8aDHwAu--TkTbYLWCw,69396
|
| 8 |
+
httplib2/__pycache__/__init__.cpython-311.pyc,,
|
| 9 |
+
httplib2/__pycache__/auth.cpython-311.pyc,,
|
| 10 |
+
httplib2/__pycache__/certs.cpython-311.pyc,,
|
| 11 |
+
httplib2/__pycache__/error.cpython-311.pyc,,
|
| 12 |
+
httplib2/__pycache__/iri2uri.cpython-311.pyc,,
|
| 13 |
+
httplib2/__pycache__/socks.cpython-311.pyc,,
|
| 14 |
+
httplib2/auth.py,sha256=Fcb7KqrqRCpUaGD-5l84nT5F2aU6ore6ujWLk5idK0o,2158
|
| 15 |
+
httplib2/cacerts.txt,sha256=AbmYP54iGeKRQ1APtfQvHlo9wul2jVmznmbTzy2fTV4,137365
|
| 16 |
+
httplib2/certs.py,sha256=guhfjMNhDdKJEyYBb5ZyLxVO5q1I7Y_P-4BG8MniBk8,971
|
| 17 |
+
httplib2/error.py,sha256=GyqPUvZeKdVLq0f3xg0uX4rjtv7jVGJuPerAdyc-jfk,954
|
| 18 |
+
httplib2/iri2uri.py,sha256=PhIzEzeR6C73l7piwrNAJlVvlWgsqxtJTlFeXgznzQo,4153
|
| 19 |
+
httplib2/socks.py,sha256=oaeEOnT2rkTNm6wnn0CSdhWzVaVshnnkAKiP4kxKzzc,19701
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.40.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
.venv/lib/python3.11/site-packages/httplib2-0.22.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
httplib2
|
.venv/lib/python3.11/site-packages/idna/__pycache__/idnadata.cpython-311.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4921e03ee20ee695d4deb4b8dd20aefdaed193d9e132919db29f632cf56dfcf
|
| 3 |
+
size 101525
|
.venv/lib/python3.11/site-packages/idna/__pycache__/uts46data.cpython-311.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:645124158744aa51ea31bcde2a74f677aff393980f2a491fe0f2436733f1fbff
|
| 3 |
+
size 163155
|
.venv/lib/python3.11/site-packages/jiter/jiter.cpython-311-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:227acb07aa26025745fcabc2e60f436ead690b0bf9050835e73f38873ce18794
|
| 3 |
+
size 812104
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/License.txt
ADDED
|
@@ -0,0 +1,1568 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
End User License Agreement
|
| 2 |
+
--------------------------
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
Preface
|
| 6 |
+
-------
|
| 7 |
+
|
| 8 |
+
The Software License Agreement in Chapter 1 and the Supplement
|
| 9 |
+
in Chapter 2 contain license terms and conditions that govern
|
| 10 |
+
the use of NVIDIA software. By accepting this agreement, you
|
| 11 |
+
agree to comply with all the terms and conditions applicable
|
| 12 |
+
to the product(s) included herein.
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
NVIDIA Driver
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
Description
|
| 19 |
+
|
| 20 |
+
This package contains the operating system driver and
|
| 21 |
+
fundamental system software components for NVIDIA GPUs.
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
NVIDIA CUDA Toolkit
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
Description
|
| 28 |
+
|
| 29 |
+
The NVIDIA CUDA Toolkit provides command-line and graphical
|
| 30 |
+
tools for building, debugging and optimizing the performance
|
| 31 |
+
of applications accelerated by NVIDIA GPUs, runtime and math
|
| 32 |
+
libraries, and documentation including programming guides,
|
| 33 |
+
user manuals, and API references.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
Default Install Location of CUDA Toolkit
|
| 37 |
+
|
| 38 |
+
Windows platform:
|
| 39 |
+
|
| 40 |
+
%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.#
|
| 41 |
+
|
| 42 |
+
Linux platform:
|
| 43 |
+
|
| 44 |
+
/usr/local/cuda-#.#
|
| 45 |
+
|
| 46 |
+
Mac platform:
|
| 47 |
+
|
| 48 |
+
/Developer/NVIDIA/CUDA-#.#
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
NVIDIA CUDA Samples
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
Description
|
| 55 |
+
|
| 56 |
+
This package includes over 100+ CUDA examples that demonstrate
|
| 57 |
+
various CUDA programming principles, and efficient CUDA
|
| 58 |
+
implementation of algorithms in specific application domains.
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
Default Install Location of CUDA Samples
|
| 62 |
+
|
| 63 |
+
Windows platform:
|
| 64 |
+
|
| 65 |
+
%ProgramData%\NVIDIA Corporation\CUDA Samples\v#.#
|
| 66 |
+
|
| 67 |
+
Linux platform:
|
| 68 |
+
|
| 69 |
+
/usr/local/cuda-#.#/samples
|
| 70 |
+
|
| 71 |
+
and
|
| 72 |
+
|
| 73 |
+
$HOME/NVIDIA_CUDA-#.#_Samples
|
| 74 |
+
|
| 75 |
+
Mac platform:
|
| 76 |
+
|
| 77 |
+
/Developer/NVIDIA/CUDA-#.#/samples
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
NVIDIA Nsight Visual Studio Edition (Windows only)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
Description
|
| 84 |
+
|
| 85 |
+
NVIDIA Nsight Development Platform, Visual Studio Edition is a
|
| 86 |
+
development environment integrated into Microsoft Visual
|
| 87 |
+
Studio that provides tools for debugging, profiling, analyzing
|
| 88 |
+
and optimizing your GPU computing and graphics applications.
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
Default Install Location of Nsight Visual Studio Edition
|
| 92 |
+
|
| 93 |
+
Windows platform:
|
| 94 |
+
|
| 95 |
+
%ProgramFiles(x86)%\NVIDIA Corporation\Nsight Visual Studio Edition #.#
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
1. License Agreement for NVIDIA Software Development Kits
|
| 99 |
+
---------------------------------------------------------
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
Release Date: July 26, 2018
|
| 103 |
+
---------------------------
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
Important NoticeRead before downloading, installing,
|
| 107 |
+
copying or using the licensed software:
|
| 108 |
+
-------------------------------------------------------
|
| 109 |
+
|
| 110 |
+
This license agreement, including exhibits attached
|
| 111 |
+
("Agreement”) is a legal agreement between you and NVIDIA
|
| 112 |
+
Corporation ("NVIDIA") and governs your use of a NVIDIA
|
| 113 |
+
software development kit (“SDK”).
|
| 114 |
+
|
| 115 |
+
Each SDK has its own set of software and materials, but here
|
| 116 |
+
is a description of the types of items that may be included in
|
| 117 |
+
a SDK: source code, header files, APIs, data sets and assets
|
| 118 |
+
(examples include images, textures, models, scenes, videos,
|
| 119 |
+
native API input/output files), binary software, sample code,
|
| 120 |
+
libraries, utility programs, programming code and
|
| 121 |
+
documentation.
|
| 122 |
+
|
| 123 |
+
This Agreement can be accepted only by an adult of legal age
|
| 124 |
+
of majority in the country in which the SDK is used.
|
| 125 |
+
|
| 126 |
+
If you are entering into this Agreement on behalf of a company
|
| 127 |
+
or other legal entity, you represent that you have the legal
|
| 128 |
+
authority to bind the entity to this Agreement, in which case
|
| 129 |
+
“you” will mean the entity you represent.
|
| 130 |
+
|
| 131 |
+
If you don’t have the required age or authority to accept
|
| 132 |
+
this Agreement, or if you don’t accept all the terms and
|
| 133 |
+
conditions of this Agreement, do not download, install or use
|
| 134 |
+
the SDK.
|
| 135 |
+
|
| 136 |
+
You agree to use the SDK only for purposes that are permitted
|
| 137 |
+
by (a) this Agreement, and (b) any applicable law, regulation
|
| 138 |
+
or generally accepted practices or guidelines in the relevant
|
| 139 |
+
jurisdictions.
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
1.1. License
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
1.1.1. License Grant
|
| 146 |
+
|
| 147 |
+
Subject to the terms of this Agreement, NVIDIA hereby grants
|
| 148 |
+
you a non-exclusive, non-transferable license, without the
|
| 149 |
+
right to sublicense (except as expressly provided in this
|
| 150 |
+
Agreement) to:
|
| 151 |
+
|
| 152 |
+
1. Install and use the SDK,
|
| 153 |
+
|
| 154 |
+
2. Modify and create derivative works of sample source code
|
| 155 |
+
delivered in the SDK, and
|
| 156 |
+
|
| 157 |
+
3. Distribute those portions of the SDK that are identified
|
| 158 |
+
in this Agreement as distributable, as incorporated in
|
| 159 |
+
object code format into a software application that meets
|
| 160 |
+
the distribution requirements indicated in this Agreement.
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
1.1.2. Distribution Requirements
|
| 164 |
+
|
| 165 |
+
These are the distribution requirements for you to exercise
|
| 166 |
+
the distribution grant:
|
| 167 |
+
|
| 168 |
+
1. Your application must have material additional
|
| 169 |
+
functionality, beyond the included portions of the SDK.
|
| 170 |
+
|
| 171 |
+
2. The distributable portions of the SDK shall only be
|
| 172 |
+
accessed by your application.
|
| 173 |
+
|
| 174 |
+
3. The following notice shall be included in modifications
|
| 175 |
+
and derivative works of sample source code distributed:
|
| 176 |
+
“This software contains source code provided by NVIDIA
|
| 177 |
+
Corporation.”
|
| 178 |
+
|
| 179 |
+
4. Unless a developer tool is identified in this Agreement
|
| 180 |
+
as distributable, it is delivered for your internal use
|
| 181 |
+
only.
|
| 182 |
+
|
| 183 |
+
5. The terms under which you distribute your application
|
| 184 |
+
must be consistent with the terms of this Agreement,
|
| 185 |
+
including (without limitation) terms relating to the
|
| 186 |
+
license grant and license restrictions and protection of
|
| 187 |
+
NVIDIA’s intellectual property rights. Additionally, you
|
| 188 |
+
agree that you will protect the privacy, security and
|
| 189 |
+
legal rights of your application users.
|
| 190 |
+
|
| 191 |
+
6. You agree to notify NVIDIA in writing of any known or
|
| 192 |
+
suspected distribution or use of the SDK not in compliance
|
| 193 |
+
with the requirements of this Agreement, and to enforce
|
| 194 |
+
the terms of your agreements with respect to distributed
|
| 195 |
+
SDK.
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
1.1.3. Authorized Users
|
| 199 |
+
|
| 200 |
+
You may allow employees and contractors of your entity or of
|
| 201 |
+
your subsidiary(ies) to access and use the SDK from your
|
| 202 |
+
secure network to perform work on your behalf.
|
| 203 |
+
|
| 204 |
+
If you are an academic institution you may allow users
|
| 205 |
+
enrolled or employed by the academic institution to access and
|
| 206 |
+
use the SDK from your secure network.
|
| 207 |
+
|
| 208 |
+
You are responsible for the compliance with the terms of this
|
| 209 |
+
Agreement by your authorized users. If you become aware that
|
| 210 |
+
your authorized users didn’t follow the terms of this
|
| 211 |
+
Agreement, you agree to take reasonable steps to resolve the
|
| 212 |
+
non-compliance and prevent new occurrences.
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
1.1.4. Pre-Release SDK
|
| 216 |
+
|
| 217 |
+
The SDK versions identified as alpha, beta, preview or
|
| 218 |
+
otherwise as pre-release, may not be fully functional, may
|
| 219 |
+
contain errors or design flaws, and may have reduced or
|
| 220 |
+
different security, privacy, accessibility, availability, and
|
| 221 |
+
reliability standards relative to commercial versions of
|
| 222 |
+
NVIDIA software and materials. Use of a pre-release SDK may
|
| 223 |
+
result in unexpected results, loss of data, project delays or
|
| 224 |
+
other unpredictable damage or loss.
|
| 225 |
+
|
| 226 |
+
You may use a pre-release SDK at your own risk, understanding
|
| 227 |
+
that pre-release SDKs are not intended for use in production
|
| 228 |
+
or business-critical systems.
|
| 229 |
+
|
| 230 |
+
NVIDIA may choose not to make available a commercial version
|
| 231 |
+
of any pre-release SDK. NVIDIA may also choose to abandon
|
| 232 |
+
development and terminate the availability of a pre-release
|
| 233 |
+
SDK at any time without liability.
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
1.1.5. Updates
|
| 237 |
+
|
| 238 |
+
NVIDIA may, at its option, make available patches, workarounds
|
| 239 |
+
or other updates to this SDK. Unless the updates are provided
|
| 240 |
+
with their separate governing terms, they are deemed part of
|
| 241 |
+
the SDK licensed to you as provided in this Agreement. You
|
| 242 |
+
agree that the form and content of the SDK that NVIDIA
|
| 243 |
+
provides may change without prior notice to you. While NVIDIA
|
| 244 |
+
generally maintains compatibility between versions, NVIDIA may
|
| 245 |
+
in some cases make changes that introduce incompatibilities in
|
| 246 |
+
future versions of the SDK.
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
1.1.6. Third Party Licenses
|
| 250 |
+
|
| 251 |
+
The SDK may come bundled with, or otherwise include or be
|
| 252 |
+
distributed with, third party software licensed by a NVIDIA
|
| 253 |
+
supplier and/or open source software provided under an open
|
| 254 |
+
source license. Use of third party software is subject to the
|
| 255 |
+
third-party license terms, or in the absence of third party
|
| 256 |
+
terms, the terms of this Agreement. Copyright to third party
|
| 257 |
+
software is held by the copyright holders indicated in the
|
| 258 |
+
third-party software or license.
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
1.1.7. Reservation of Rights
|
| 262 |
+
|
| 263 |
+
NVIDIA reserves all rights, title, and interest in and to the
|
| 264 |
+
SDK, not expressly granted to you under this Agreement.
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
1.2. Limitations
|
| 268 |
+
|
| 269 |
+
The following license limitations apply to your use of the
|
| 270 |
+
SDK:
|
| 271 |
+
|
| 272 |
+
1. You may not reverse engineer, decompile or disassemble,
|
| 273 |
+
or remove copyright or other proprietary notices from any
|
| 274 |
+
portion of the SDK or copies of the SDK.
|
| 275 |
+
|
| 276 |
+
2. Except as expressly provided in this Agreement, you may
|
| 277 |
+
not copy, sell, rent, sublicense, transfer, distribute,
|
| 278 |
+
modify, or create derivative works of any portion of the
|
| 279 |
+
SDK. For clarity, you may not distribute or sublicense the
|
| 280 |
+
SDK as a stand-alone product.
|
| 281 |
+
|
| 282 |
+
3. Unless you have an agreement with NVIDIA for this
|
| 283 |
+
purpose, you may not indicate that an application created
|
| 284 |
+
with the SDK is sponsored or endorsed by NVIDIA.
|
| 285 |
+
|
| 286 |
+
4. You may not bypass, disable, or circumvent any
|
| 287 |
+
encryption, security, digital rights management or
|
| 288 |
+
authentication mechanism in the SDK.
|
| 289 |
+
|
| 290 |
+
5. You may not use the SDK in any manner that would cause it
|
| 291 |
+
to become subject to an open source software license. As
|
| 292 |
+
examples, licenses that require as a condition of use,
|
| 293 |
+
modification, and/or distribution that the SDK be:
|
| 294 |
+
|
| 295 |
+
a. Disclosed or distributed in source code form;
|
| 296 |
+
|
| 297 |
+
b. Licensed for the purpose of making derivative works;
|
| 298 |
+
or
|
| 299 |
+
|
| 300 |
+
c. Redistributable at no charge.
|
| 301 |
+
|
| 302 |
+
6. Unless you have an agreement with NVIDIA for this
|
| 303 |
+
purpose, you may not use the SDK with any system or
|
| 304 |
+
application where the use or failure of the system or
|
| 305 |
+
application can reasonably be expected to threaten or
|
| 306 |
+
result in personal injury, death, or catastrophic loss.
|
| 307 |
+
Examples include use in avionics, navigation, military,
|
| 308 |
+
medical, life support or other life critical applications.
|
| 309 |
+
NVIDIA does not design, test or manufacture the SDK for
|
| 310 |
+
these critical uses and NVIDIA shall not be liable to you
|
| 311 |
+
or any third party, in whole or in part, for any claims or
|
| 312 |
+
damages arising from such uses.
|
| 313 |
+
|
| 314 |
+
7. You agree to defend, indemnify and hold harmless NVIDIA
|
| 315 |
+
and its affiliates, and their respective employees,
|
| 316 |
+
contractors, agents, officers and directors, from and
|
| 317 |
+
against any and all claims, damages, obligations, losses,
|
| 318 |
+
liabilities, costs or debt, fines, restitutions and
|
| 319 |
+
expenses (including but not limited to attorney’s fees
|
| 320 |
+
and costs incident to establishing the right of
|
| 321 |
+
indemnification) arising out of or related to your use of
|
| 322 |
+
the SDK outside of the scope of this Agreement, or not in
|
| 323 |
+
compliance with its terms.
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
1.3. Ownership
|
| 327 |
+
|
| 328 |
+
1. NVIDIA or its licensors hold all rights, title and
|
| 329 |
+
interest in and to the SDK and its modifications and
|
| 330 |
+
derivative works, including their respective intellectual
|
| 331 |
+
property rights, subject to your rights described in this
|
| 332 |
+
section. This SDK may include software and materials from
|
| 333 |
+
NVIDIA’s licensors, and these licensors are intended
|
| 334 |
+
third party beneficiaries that may enforce this Agreement
|
| 335 |
+
with respect to their intellectual property rights.
|
| 336 |
+
|
| 337 |
+
2. You hold all rights, title and interest in and to your
|
| 338 |
+
applications and your derivative works of the sample
|
| 339 |
+
source code delivered in the SDK, including their
|
| 340 |
+
respective intellectual property rights, subject to
|
| 341 |
+
NVIDIA’s rights described in this section.
|
| 342 |
+
|
| 343 |
+
3. You may, but don’t have to, provide to NVIDIA
|
| 344 |
+
suggestions, feature requests or other feedback regarding
|
| 345 |
+
the SDK, including possible enhancements or modifications
|
| 346 |
+
to the SDK. For any feedback that you voluntarily provide,
|
| 347 |
+
you hereby grant NVIDIA and its affiliates a perpetual,
|
| 348 |
+
non-exclusive, worldwide, irrevocable license to use,
|
| 349 |
+
reproduce, modify, license, sublicense (through multiple
|
| 350 |
+
tiers of sublicensees), and distribute (through multiple
|
| 351 |
+
tiers of distributors) it without the payment of any
|
| 352 |
+
royalties or fees to you. NVIDIA will use feedback at its
|
| 353 |
+
choice. NVIDIA is constantly looking for ways to improve
|
| 354 |
+
its products, so you may send feedback to NVIDIA through
|
| 355 |
+
the developer portal at https://developer.nvidia.com.
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
1.4. No Warranties
|
| 359 |
+
|
| 360 |
+
THE SDK IS PROVIDED BY NVIDIA “AS IS” AND “WITH ALL
|
| 361 |
+
FAULTS.” TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND
|
| 362 |
+
ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND
|
| 363 |
+
OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING,
|
| 364 |
+
BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
| 365 |
+
FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE
|
| 366 |
+
ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO
|
| 367 |
+
WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF
|
| 368 |
+
DEALING OR COURSE OF TRADE.
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
1.5. Limitation of Liability
|
| 372 |
+
|
| 373 |
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS
|
| 374 |
+
AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
| 375 |
+
PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS
|
| 376 |
+
OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF
|
| 377 |
+
PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION
|
| 378 |
+
WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF THE SDK,
|
| 379 |
+
WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH
|
| 380 |
+
OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE),
|
| 381 |
+
PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF
|
| 382 |
+
LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES
|
| 383 |
+
TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS
|
| 384 |
+
AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE
|
| 385 |
+
NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS
|
| 386 |
+
LIMIT.
|
| 387 |
+
|
| 388 |
+
These exclusions and limitations of liability shall apply
|
| 389 |
+
regardless if NVIDIA or its affiliates have been advised of
|
| 390 |
+
the possibility of such damages, and regardless of whether a
|
| 391 |
+
remedy fails its essential purpose. These exclusions and
|
| 392 |
+
limitations of liability form an essential basis of the
|
| 393 |
+
bargain between the parties, and, absent any of these
|
| 394 |
+
exclusions or limitations of liability, the provisions of this
|
| 395 |
+
Agreement, including, without limitation, the economic terms,
|
| 396 |
+
would be substantially different.
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
1.6. Termination
|
| 400 |
+
|
| 401 |
+
1. This Agreement will continue to apply until terminated by
|
| 402 |
+
either you or NVIDIA as described below.
|
| 403 |
+
|
| 404 |
+
2. If you want to terminate this Agreement, you may do so by
|
| 405 |
+
stopping to use the SDK.
|
| 406 |
+
|
| 407 |
+
3. NVIDIA may, at any time, terminate this Agreement if:
|
| 408 |
+
|
| 409 |
+
a. (i) you fail to comply with any term of this
|
| 410 |
+
Agreement and the non-compliance is not fixed within
|
| 411 |
+
thirty (30) days following notice from NVIDIA (or
|
| 412 |
+
immediately if you violate NVIDIA’s intellectual
|
| 413 |
+
property rights);
|
| 414 |
+
|
| 415 |
+
b. (ii) you commence or participate in any legal
|
| 416 |
+
proceeding against NVIDIA with respect to the SDK; or
|
| 417 |
+
|
| 418 |
+
c. (iii) NVIDIA decides to no longer provide the SDK in
|
| 419 |
+
a country or, in NVIDIA’s sole discretion, the
|
| 420 |
+
continued use of it is no longer commercially viable.
|
| 421 |
+
|
| 422 |
+
4. Upon any termination of this Agreement, you agree to
|
| 423 |
+
promptly discontinue use of the SDK and destroy all copies
|
| 424 |
+
in your possession or control. Your prior distributions in
|
| 425 |
+
accordance with this Agreement are not affected by the
|
| 426 |
+
termination of this Agreement. Upon written request, you
|
| 427 |
+
will certify in writing that you have complied with your
|
| 428 |
+
commitments under this section. Upon any termination of
|
| 429 |
+
this Agreement all provisions survive except for the
|
| 430 |
+
license grant provisions.
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
1.7. General
|
| 434 |
+
|
| 435 |
+
If you wish to assign this Agreement or your rights and
|
| 436 |
+
obligations, including by merger, consolidation, dissolution
|
| 437 |
+
or operation of law, contact NVIDIA to ask for permission. Any
|
| 438 |
+
attempted assignment not approved by NVIDIA in writing shall
|
| 439 |
+
be void and of no effect. NVIDIA may assign, delegate or
|
| 440 |
+
transfer this Agreement and its rights and obligations, and if
|
| 441 |
+
to a non-affiliate you will be notified.
|
| 442 |
+
|
| 443 |
+
You agree to cooperate with NVIDIA and provide reasonably
|
| 444 |
+
requested information to verify your compliance with this
|
| 445 |
+
Agreement.
|
| 446 |
+
|
| 447 |
+
This Agreement will be governed in all respects by the laws of
|
| 448 |
+
the United States and of the State of Delaware as those laws
|
| 449 |
+
are applied to contracts entered into and performed entirely
|
| 450 |
+
within Delaware by Delaware residents, without regard to the
|
| 451 |
+
conflicts of laws principles. The United Nations Convention on
|
| 452 |
+
Contracts for the International Sale of Goods is specifically
|
| 453 |
+
disclaimed. You agree to all terms of this Agreement in the
|
| 454 |
+
English language.
|
| 455 |
+
|
| 456 |
+
The state or federal courts residing in Santa Clara County,
|
| 457 |
+
California shall have exclusive jurisdiction over any dispute
|
| 458 |
+
or claim arising out of this Agreement. Notwithstanding this,
|
| 459 |
+
you agree that NVIDIA shall still be allowed to apply for
|
| 460 |
+
injunctive remedies or an equivalent type of urgent legal
|
| 461 |
+
relief in any jurisdiction.
|
| 462 |
+
|
| 463 |
+
If any court of competent jurisdiction determines that any
|
| 464 |
+
provision of this Agreement is illegal, invalid or
|
| 465 |
+
unenforceable, such provision will be construed as limited to
|
| 466 |
+
the extent necessary to be consistent with and fully
|
| 467 |
+
enforceable under the law and the remaining provisions will
|
| 468 |
+
remain in full force and effect. Unless otherwise specified,
|
| 469 |
+
remedies are cumulative.
|
| 470 |
+
|
| 471 |
+
Each party acknowledges and agrees that the other is an
|
| 472 |
+
independent contractor in the performance of this Agreement.
|
| 473 |
+
|
| 474 |
+
The SDK has been developed entirely at private expense and is
|
| 475 |
+
“commercial items” consisting of “commercial computer
|
| 476 |
+
software” and “commercial computer software
|
| 477 |
+
documentation” provided with RESTRICTED RIGHTS. Use,
|
| 478 |
+
duplication or disclosure by the U.S. Government or a U.S.
|
| 479 |
+
Government subcontractor is subject to the restrictions in
|
| 480 |
+
this Agreement pursuant to DFARS 227.7202-3(a) or as set forth
|
| 481 |
+
in subparagraphs (c)(1) and (2) of the Commercial Computer
|
| 482 |
+
Software - Restricted Rights clause at FAR 52.227-19, as
|
| 483 |
+
applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas
|
| 484 |
+
Expressway, Santa Clara, CA 95051.
|
| 485 |
+
|
| 486 |
+
The SDK is subject to United States export laws and
|
| 487 |
+
regulations. You agree that you will not ship, transfer or
|
| 488 |
+
export the SDK into any country, or use the SDK in any manner,
|
| 489 |
+
prohibited by the United States Bureau of Industry and
|
| 490 |
+
Security or economic sanctions regulations administered by the
|
| 491 |
+
U.S. Department of Treasury’s Office of Foreign Assets
|
| 492 |
+
Control (OFAC), or any applicable export laws, restrictions or
|
| 493 |
+
regulations. These laws include restrictions on destinations,
|
| 494 |
+
end users and end use. By accepting this Agreement, you
|
| 495 |
+
confirm that you are not a resident or citizen of any country
|
| 496 |
+
currently embargoed by the U.S. and that you are not otherwise
|
| 497 |
+
prohibited from receiving the SDK.
|
| 498 |
+
|
| 499 |
+
Any notice delivered by NVIDIA to you under this Agreement
|
| 500 |
+
will be delivered via mail, email or fax. You agree that any
|
| 501 |
+
notices that NVIDIA sends you electronically will satisfy any
|
| 502 |
+
legal communication requirements. Please direct your legal
|
| 503 |
+
notices or other correspondence to NVIDIA Corporation, 2788
|
| 504 |
+
San Tomas Expressway, Santa Clara, California 95051, United
|
| 505 |
+
States of America, Attention: Legal Department.
|
| 506 |
+
|
| 507 |
+
This Agreement and any exhibits incorporated into this
|
| 508 |
+
Agreement constitute the entire agreement of the parties with
|
| 509 |
+
respect to the subject matter of this Agreement and supersede
|
| 510 |
+
all prior negotiations or documentation exchanged between the
|
| 511 |
+
parties relating to this SDK license. Any additional and/or
|
| 512 |
+
conflicting terms on documents issued by you are null, void,
|
| 513 |
+
and invalid. Any amendment or waiver under this Agreement
|
| 514 |
+
shall be in writing and signed by representatives of both
|
| 515 |
+
parties.
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
2. CUDA Toolkit Supplement to Software License Agreement for
|
| 519 |
+
NVIDIA Software Development Kits
|
| 520 |
+
------------------------------------------------------------
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
Release date: August 16, 2018
|
| 524 |
+
-----------------------------
|
| 525 |
+
|
| 526 |
+
The terms in this supplement govern your use of the NVIDIA
|
| 527 |
+
CUDA Toolkit SDK under the terms of your license agreement
|
| 528 |
+
(“Agreement”) as modified by this supplement. Capitalized
|
| 529 |
+
terms used but not defined below have the meaning assigned to
|
| 530 |
+
them in the Agreement.
|
| 531 |
+
|
| 532 |
+
This supplement is an exhibit to the Agreement and is
|
| 533 |
+
incorporated as an integral part of the Agreement. In the
|
| 534 |
+
event of conflict between the terms in this supplement and the
|
| 535 |
+
terms in the Agreement, the terms in this supplement govern.
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
2.1. License Scope
|
| 539 |
+
|
| 540 |
+
The SDK is licensed for you to develop applications only for
|
| 541 |
+
use in systems with NVIDIA GPUs.
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
2.2. Distribution
|
| 545 |
+
|
| 546 |
+
The portions of the SDK that are distributable under the
|
| 547 |
+
Agreement are listed in Attachment A.
|
| 548 |
+
|
| 549 |
+
|
| 550 |
+
2.3. Operating Systems
|
| 551 |
+
|
| 552 |
+
Those portions of the SDK designed exclusively for use on the
|
| 553 |
+
Linux or FreeBSD operating systems, or other operating systems
|
| 554 |
+
derived from the source code to these operating systems, may
|
| 555 |
+
be copied and redistributed for use in accordance with this
|
| 556 |
+
Agreement, provided that the object code files are not
|
| 557 |
+
modified in any way (except for unzipping of compressed
|
| 558 |
+
files).
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
2.4. Audio and Video Encoders and Decoders
|
| 562 |
+
|
| 563 |
+
You acknowledge and agree that it is your sole responsibility
|
| 564 |
+
to obtain any additional third-party licenses required to
|
| 565 |
+
make, have made, use, have used, sell, import, and offer for
|
| 566 |
+
sale your products or services that include or incorporate any
|
| 567 |
+
third-party software and content relating to audio and/or
|
| 568 |
+
video encoders and decoders from, including but not limited
|
| 569 |
+
to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A.,
|
| 570 |
+
MPEG-LA, and Coding Technologies. NVIDIA does not grant to you
|
| 571 |
+
under this Agreement any necessary patent or other rights with
|
| 572 |
+
respect to any audio and/or video encoders and decoders.
|
| 573 |
+
|
| 574 |
+
|
| 575 |
+
2.5. Licensing
|
| 576 |
+
|
| 577 |
+
If the distribution terms in this Agreement are not suitable
|
| 578 |
+
for your organization, or for any questions regarding this
|
| 579 |
+
Agreement, please contact NVIDIA at
|
| 580 |
+
nvidia-compute-license-questions@nvidia.com.
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
2.6. Attachment A
|
| 584 |
+
|
| 585 |
+
The following portions of the SDK are distributable under the
|
| 586 |
+
Agreement:
|
| 587 |
+
|
| 588 |
+
Component
|
| 589 |
+
|
| 590 |
+
CUDA Runtime
|
| 591 |
+
|
| 592 |
+
Windows
|
| 593 |
+
|
| 594 |
+
cudart.dll, cudart_static.lib, cudadevrt.lib
|
| 595 |
+
|
| 596 |
+
Mac OSX
|
| 597 |
+
|
| 598 |
+
libcudart.dylib, libcudart_static.a, libcudadevrt.a
|
| 599 |
+
|
| 600 |
+
Linux
|
| 601 |
+
|
| 602 |
+
libcudart.so, libcudart_static.a, libcudadevrt.a
|
| 603 |
+
|
| 604 |
+
Android
|
| 605 |
+
|
| 606 |
+
libcudart.so, libcudart_static.a, libcudadevrt.a
|
| 607 |
+
|
| 608 |
+
Component
|
| 609 |
+
|
| 610 |
+
CUDA FFT Library
|
| 611 |
+
|
| 612 |
+
Windows
|
| 613 |
+
|
| 614 |
+
cufft.dll, cufftw.dll, cufft.lib, cufftw.lib
|
| 615 |
+
|
| 616 |
+
Mac OSX
|
| 617 |
+
|
| 618 |
+
libcufft.dylib, libcufft_static.a, libcufftw.dylib,
|
| 619 |
+
libcufftw_static.a
|
| 620 |
+
|
| 621 |
+
Linux
|
| 622 |
+
|
| 623 |
+
libcufft.so, libcufft_static.a, libcufftw.so,
|
| 624 |
+
libcufftw_static.a
|
| 625 |
+
|
| 626 |
+
Android
|
| 627 |
+
|
| 628 |
+
libcufft.so, libcufft_static.a, libcufftw.so,
|
| 629 |
+
libcufftw_static.a
|
| 630 |
+
|
| 631 |
+
Component
|
| 632 |
+
|
| 633 |
+
CUDA BLAS Library
|
| 634 |
+
|
| 635 |
+
Windows
|
| 636 |
+
|
| 637 |
+
cublas.dll, cublasLt.dll
|
| 638 |
+
|
| 639 |
+
Mac OSX
|
| 640 |
+
|
| 641 |
+
libcublas.dylib, libcublasLt.dylib, libcublas_static.a,
|
| 642 |
+
libcublasLt_static.a
|
| 643 |
+
|
| 644 |
+
Linux
|
| 645 |
+
|
| 646 |
+
libcublas.so, libcublasLt.so, libcublas_static.a,
|
| 647 |
+
libcublasLt_static.a
|
| 648 |
+
|
| 649 |
+
Android
|
| 650 |
+
|
| 651 |
+
libcublas.so, libcublasLt.so, libcublas_static.a,
|
| 652 |
+
libcublasLt_static.a
|
| 653 |
+
|
| 654 |
+
Component
|
| 655 |
+
|
| 656 |
+
NVIDIA "Drop-in" BLAS Library
|
| 657 |
+
|
| 658 |
+
Windows
|
| 659 |
+
|
| 660 |
+
nvblas.dll
|
| 661 |
+
|
| 662 |
+
Mac OSX
|
| 663 |
+
|
| 664 |
+
libnvblas.dylib
|
| 665 |
+
|
| 666 |
+
Linux
|
| 667 |
+
|
| 668 |
+
libnvblas.so
|
| 669 |
+
|
| 670 |
+
Component
|
| 671 |
+
|
| 672 |
+
CUDA Sparse Matrix Library
|
| 673 |
+
|
| 674 |
+
Windows
|
| 675 |
+
|
| 676 |
+
cusparse.dll, cusparse.lib
|
| 677 |
+
|
| 678 |
+
Mac OSX
|
| 679 |
+
|
| 680 |
+
libcusparse.dylib, libcusparse_static.a
|
| 681 |
+
|
| 682 |
+
Linux
|
| 683 |
+
|
| 684 |
+
libcusparse.so, libcusparse_static.a
|
| 685 |
+
|
| 686 |
+
Android
|
| 687 |
+
|
| 688 |
+
libcusparse.so, libcusparse_static.a
|
| 689 |
+
|
| 690 |
+
Component
|
| 691 |
+
|
| 692 |
+
CUDA Linear Solver Library
|
| 693 |
+
|
| 694 |
+
Windows
|
| 695 |
+
|
| 696 |
+
cusolver.dll, cusolver.lib
|
| 697 |
+
|
| 698 |
+
Mac OSX
|
| 699 |
+
|
| 700 |
+
libcusolver.dylib, libcusolver_static.a
|
| 701 |
+
|
| 702 |
+
Linux
|
| 703 |
+
|
| 704 |
+
libcusolver.so, libcusolver_static.a
|
| 705 |
+
|
| 706 |
+
Android
|
| 707 |
+
|
| 708 |
+
libcusolver.so, libcusolver_static.a
|
| 709 |
+
|
| 710 |
+
Component
|
| 711 |
+
|
| 712 |
+
CUDA Random Number Generation Library
|
| 713 |
+
|
| 714 |
+
Windows
|
| 715 |
+
|
| 716 |
+
curand.dll, curand.lib
|
| 717 |
+
|
| 718 |
+
Mac OSX
|
| 719 |
+
|
| 720 |
+
libcurand.dylib, libcurand_static.a
|
| 721 |
+
|
| 722 |
+
Linux
|
| 723 |
+
|
| 724 |
+
libcurand.so, libcurand_static.a
|
| 725 |
+
|
| 726 |
+
Android
|
| 727 |
+
|
| 728 |
+
libcurand.so, libcurand_static.a
|
| 729 |
+
|
| 730 |
+
Component
|
| 731 |
+
|
| 732 |
+
CUDA Accelerated Graph Library
|
| 733 |
+
|
| 734 |
+
Component
|
| 735 |
+
|
| 736 |
+
NVIDIA Performance Primitives Library
|
| 737 |
+
|
| 738 |
+
Windows
|
| 739 |
+
|
| 740 |
+
nppc.dll, nppc.lib, nppial.dll, nppial.lib, nppicc.dll,
|
| 741 |
+
nppicc.lib, nppicom.dll, nppicom.lib, nppidei.dll,
|
| 742 |
+
nppidei.lib, nppif.dll, nppif.lib, nppig.dll, nppig.lib,
|
| 743 |
+
nppim.dll, nppim.lib, nppist.dll, nppist.lib, nppisu.dll,
|
| 744 |
+
nppisu.lib, nppitc.dll, nppitc.lib, npps.dll, npps.lib
|
| 745 |
+
|
| 746 |
+
Mac OSX
|
| 747 |
+
|
| 748 |
+
libnppc.dylib, libnppc_static.a, libnppial.dylib,
|
| 749 |
+
libnppial_static.a, libnppicc.dylib, libnppicc_static.a,
|
| 750 |
+
libnppicom.dylib, libnppicom_static.a, libnppidei.dylib,
|
| 751 |
+
libnppidei_static.a, libnppif.dylib, libnppif_static.a,
|
| 752 |
+
libnppig.dylib, libnppig_static.a, libnppim.dylib,
|
| 753 |
+
libnppisu_static.a, libnppitc.dylib, libnppitc_static.a,
|
| 754 |
+
libnpps.dylib, libnpps_static.a
|
| 755 |
+
|
| 756 |
+
Linux
|
| 757 |
+
|
| 758 |
+
libnppc.so, libnppc_static.a, libnppial.so,
|
| 759 |
+
libnppial_static.a, libnppicc.so, libnppicc_static.a,
|
| 760 |
+
libnppicom.so, libnppicom_static.a, libnppidei.so,
|
| 761 |
+
libnppidei_static.a, libnppif.so, libnppif_static.a
|
| 762 |
+
libnppig.so, libnppig_static.a, libnppim.so,
|
| 763 |
+
libnppim_static.a, libnppist.so, libnppist_static.a,
|
| 764 |
+
libnppisu.so, libnppisu_static.a, libnppitc.so
|
| 765 |
+
libnppitc_static.a, libnpps.so, libnpps_static.a
|
| 766 |
+
|
| 767 |
+
Android
|
| 768 |
+
|
| 769 |
+
libnppc.so, libnppc_static.a, libnppial.so,
|
| 770 |
+
libnppial_static.a, libnppicc.so, libnppicc_static.a,
|
| 771 |
+
libnppicom.so, libnppicom_static.a, libnppidei.so,
|
| 772 |
+
libnppidei_static.a, libnppif.so, libnppif_static.a
|
| 773 |
+
libnppig.so, libnppig_static.a, libnppim.so,
|
| 774 |
+
libnppim_static.a, libnppist.so, libnppist_static.a,
|
| 775 |
+
libnppisu.so, libnppisu_static.a, libnppitc.so
|
| 776 |
+
libnppitc_static.a, libnpps.so, libnpps_static.a
|
| 777 |
+
|
| 778 |
+
Component
|
| 779 |
+
|
| 780 |
+
NVIDIA JPEG Library
|
| 781 |
+
|
| 782 |
+
Linux
|
| 783 |
+
|
| 784 |
+
libnvjpeg.so, libnvjpeg_static.a
|
| 785 |
+
|
| 786 |
+
Component
|
| 787 |
+
|
| 788 |
+
Internal common library required for statically linking to
|
| 789 |
+
cuBLAS, cuSPARSE, cuFFT, cuRAND, nvJPEG and NPP
|
| 790 |
+
|
| 791 |
+
Mac OSX
|
| 792 |
+
|
| 793 |
+
libculibos.a
|
| 794 |
+
|
| 795 |
+
Linux
|
| 796 |
+
|
| 797 |
+
libculibos.a
|
| 798 |
+
|
| 799 |
+
Component
|
| 800 |
+
|
| 801 |
+
NVIDIA Runtime Compilation Library and Header
|
| 802 |
+
|
| 803 |
+
All
|
| 804 |
+
|
| 805 |
+
nvrtc.h
|
| 806 |
+
|
| 807 |
+
Windows
|
| 808 |
+
|
| 809 |
+
nvrtc.dll, nvrtc-builtins.dll
|
| 810 |
+
|
| 811 |
+
Mac OSX
|
| 812 |
+
|
| 813 |
+
libnvrtc.dylib, libnvrtc-builtins.dylib
|
| 814 |
+
|
| 815 |
+
Linux
|
| 816 |
+
|
| 817 |
+
libnvrtc.so, libnvrtc-builtins.so
|
| 818 |
+
|
| 819 |
+
Component
|
| 820 |
+
|
| 821 |
+
NVIDIA Optimizing Compiler Library
|
| 822 |
+
|
| 823 |
+
Windows
|
| 824 |
+
|
| 825 |
+
nvvm.dll
|
| 826 |
+
|
| 827 |
+
Mac OSX
|
| 828 |
+
|
| 829 |
+
libnvvm.dylib
|
| 830 |
+
|
| 831 |
+
Linux
|
| 832 |
+
|
| 833 |
+
libnvvm.so
|
| 834 |
+
|
| 835 |
+
Component
|
| 836 |
+
|
| 837 |
+
NVIDIA Common Device Math Functions Library
|
| 838 |
+
|
| 839 |
+
Windows
|
| 840 |
+
|
| 841 |
+
libdevice.10.bc
|
| 842 |
+
|
| 843 |
+
Mac OSX
|
| 844 |
+
|
| 845 |
+
libdevice.10.bc
|
| 846 |
+
|
| 847 |
+
Linux
|
| 848 |
+
|
| 849 |
+
libdevice.10.bc
|
| 850 |
+
|
| 851 |
+
Component
|
| 852 |
+
|
| 853 |
+
CUDA Occupancy Calculation Header Library
|
| 854 |
+
|
| 855 |
+
All
|
| 856 |
+
|
| 857 |
+
cuda_occupancy.h
|
| 858 |
+
|
| 859 |
+
Component
|
| 860 |
+
|
| 861 |
+
CUDA Half Precision Headers
|
| 862 |
+
|
| 863 |
+
All
|
| 864 |
+
|
| 865 |
+
cuda_fp16.h, cuda_fp16.hpp
|
| 866 |
+
|
| 867 |
+
Component
|
| 868 |
+
|
| 869 |
+
CUDA Profiling Tools Interface (CUPTI) Library
|
| 870 |
+
|
| 871 |
+
Windows
|
| 872 |
+
|
| 873 |
+
cupti.dll
|
| 874 |
+
|
| 875 |
+
Mac OSX
|
| 876 |
+
|
| 877 |
+
libcupti.dylib
|
| 878 |
+
|
| 879 |
+
Linux
|
| 880 |
+
|
| 881 |
+
libcupti.so
|
| 882 |
+
|
| 883 |
+
Component
|
| 884 |
+
|
| 885 |
+
NVIDIA Tools Extension Library
|
| 886 |
+
|
| 887 |
+
Windows
|
| 888 |
+
|
| 889 |
+
nvToolsExt.dll, nvToolsExt.lib
|
| 890 |
+
|
| 891 |
+
Mac OSX
|
| 892 |
+
|
| 893 |
+
libnvToolsExt.dylib
|
| 894 |
+
|
| 895 |
+
Linux
|
| 896 |
+
|
| 897 |
+
libnvToolsExt.so
|
| 898 |
+
|
| 899 |
+
Component
|
| 900 |
+
|
| 901 |
+
NVIDIA CUDA Driver Libraries
|
| 902 |
+
|
| 903 |
+
Linux
|
| 904 |
+
|
| 905 |
+
libcuda.so, libnvidia-fatbinaryloader.so,
|
| 906 |
+
libnvidia-ptxjitcompiler.so
|
| 907 |
+
|
| 908 |
+
The NVIDIA CUDA Driver Libraries are only distributable in
|
| 909 |
+
applications that meet this criteria:
|
| 910 |
+
|
| 911 |
+
1. The application was developed starting from a NVIDIA CUDA
|
| 912 |
+
container obtained from Docker Hub or the NVIDIA GPU
|
| 913 |
+
Cloud, and
|
| 914 |
+
|
| 915 |
+
2. The resulting application is packaged as a Docker
|
| 916 |
+
container and distributed to users on Docker Hub or the
|
| 917 |
+
NVIDIA GPU Cloud only.
|
| 918 |
+
|
| 919 |
+
|
| 920 |
+
2.7. Attachment B
|
| 921 |
+
|
| 922 |
+
|
| 923 |
+
Additional Licensing Obligations
|
| 924 |
+
|
| 925 |
+
The following third party components included in the SOFTWARE
|
| 926 |
+
are licensed to Licensee pursuant to the following terms and
|
| 927 |
+
conditions:
|
| 928 |
+
|
| 929 |
+
1. Licensee's use of the GDB third party component is
|
| 930 |
+
subject to the terms and conditions of GNU GPL v3:
|
| 931 |
+
|
| 932 |
+
This product includes copyrighted third-party software licensed
|
| 933 |
+
under the terms of the GNU General Public License v3 ("GPL v3").
|
| 934 |
+
All third-party software packages are copyright by their respective
|
| 935 |
+
authors. GPL v3 terms and conditions are hereby incorporated into
|
| 936 |
+
the Agreement by this reference: http://www.gnu.org/licenses/gpl.txt
|
| 937 |
+
|
| 938 |
+
Consistent with these licensing requirements, the software
|
| 939 |
+
listed below is provided under the terms of the specified
|
| 940 |
+
open source software licenses. To obtain source code for
|
| 941 |
+
software provided under licenses that require
|
| 942 |
+
redistribution of source code, including the GNU General
|
| 943 |
+
Public License (GPL) and GNU Lesser General Public License
|
| 944 |
+
(LGPL), contact oss-requests@nvidia.com. This offer is
|
| 945 |
+
valid for a period of three (3) years from the date of the
|
| 946 |
+
distribution of this product by NVIDIA CORPORATION.
|
| 947 |
+
|
| 948 |
+
Component License
|
| 949 |
+
CUDA-GDB GPL v3
|
| 950 |
+
|
| 951 |
+
2. Licensee represents and warrants that any and all third
|
| 952 |
+
party licensing and/or royalty payment obligations in
|
| 953 |
+
connection with Licensee's use of the H.264 video codecs
|
| 954 |
+
are solely the responsibility of Licensee.
|
| 955 |
+
|
| 956 |
+
3. Licensee's use of the Thrust library is subject to the
|
| 957 |
+
terms and conditions of the Apache License Version 2.0.
|
| 958 |
+
All third-party software packages are copyright by their
|
| 959 |
+
respective authors. Apache License Version 2.0 terms and
|
| 960 |
+
conditions are hereby incorporated into the Agreement by
|
| 961 |
+
this reference.
|
| 962 |
+
http://www.apache.org/licenses/LICENSE-2.0.html
|
| 963 |
+
|
| 964 |
+
In addition, Licensee acknowledges the following notice:
|
| 965 |
+
Thrust includes source code from the Boost Iterator,
|
| 966 |
+
Tuple, System, and Random Number libraries.
|
| 967 |
+
|
| 968 |
+
Boost Software License - Version 1.0 - August 17th, 2003
|
| 969 |
+
. . . .
|
| 970 |
+
|
| 971 |
+
Permission is hereby granted, free of charge, to any person or
|
| 972 |
+
organization obtaining a copy of the software and accompanying
|
| 973 |
+
documentation covered by this license (the "Software") to use,
|
| 974 |
+
reproduce, display, distribute, execute, and transmit the Software,
|
| 975 |
+
and to prepare derivative works of the Software, and to permit
|
| 976 |
+
third-parties to whom the Software is furnished to do so, all
|
| 977 |
+
subject to the following:
|
| 978 |
+
|
| 979 |
+
The copyright notices in the Software and this entire statement,
|
| 980 |
+
including the above license grant, this restriction and the following
|
| 981 |
+
disclaimer, must be included in all copies of the Software, in whole
|
| 982 |
+
or in part, and all derivative works of the Software, unless such
|
| 983 |
+
copies or derivative works are solely in the form of machine-executable
|
| 984 |
+
object code generated by a source language processor.
|
| 985 |
+
|
| 986 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 987 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 988 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
| 989 |
+
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
| 990 |
+
ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
| 991 |
+
OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
|
| 992 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 993 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
| 994 |
+
|
| 995 |
+
4. Licensee's use of the LLVM third party component is
|
| 996 |
+
subject to the following terms and conditions:
|
| 997 |
+
|
| 998 |
+
======================================================
|
| 999 |
+
LLVM Release License
|
| 1000 |
+
======================================================
|
| 1001 |
+
University of Illinois/NCSA
|
| 1002 |
+
Open Source License
|
| 1003 |
+
|
| 1004 |
+
Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign.
|
| 1005 |
+
All rights reserved.
|
| 1006 |
+
|
| 1007 |
+
Developed by:
|
| 1008 |
+
|
| 1009 |
+
LLVM Team
|
| 1010 |
+
|
| 1011 |
+
University of Illinois at Urbana-Champaign
|
| 1012 |
+
|
| 1013 |
+
http://llvm.org
|
| 1014 |
+
|
| 1015 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 1016 |
+
of this software and associated documentation files (the "Software"), to
|
| 1017 |
+
deal with the Software without restriction, including without limitation the
|
| 1018 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 1019 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 1020 |
+
furnished to do so, subject to the following conditions:
|
| 1021 |
+
|
| 1022 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 1023 |
+
this list of conditions and the following disclaimers.
|
| 1024 |
+
|
| 1025 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1026 |
+
notice, this list of conditions and the following disclaimers in the
|
| 1027 |
+
documentation and/or other materials provided with the distribution.
|
| 1028 |
+
|
| 1029 |
+
* Neither the names of the LLVM Team, University of Illinois at Urbana-
|
| 1030 |
+
Champaign, nor the names of its contributors may be used to endorse or
|
| 1031 |
+
promote products derived from this Software without specific prior
|
| 1032 |
+
written permission.
|
| 1033 |
+
|
| 1034 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 1035 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1036 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 1037 |
+
THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
| 1038 |
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
| 1039 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 1040 |
+
DEALINGS WITH THE SOFTWARE.
|
| 1041 |
+
|
| 1042 |
+
5. Licensee's use (e.g. nvprof) of the PCRE third party
|
| 1043 |
+
component is subject to the following terms and
|
| 1044 |
+
conditions:
|
| 1045 |
+
|
| 1046 |
+
------------
|
| 1047 |
+
PCRE LICENCE
|
| 1048 |
+
------------
|
| 1049 |
+
PCRE is a library of functions to support regular expressions whose syntax
|
| 1050 |
+
and semantics are as close as possible to those of the Perl 5 language.
|
| 1051 |
+
Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
|
| 1052 |
+
specified below. The documentation for PCRE, supplied in the "doc"
|
| 1053 |
+
directory, is distributed under the same terms as the software itself. The
|
| 1054 |
+
basic library functions are written in C and are freestanding. Also
|
| 1055 |
+
included in the distribution is a set of C++ wrapper functions, and a just-
|
| 1056 |
+
in-time compiler that can be used to optimize pattern matching. These are
|
| 1057 |
+
both optional features that can be omitted when the library is built.
|
| 1058 |
+
|
| 1059 |
+
THE BASIC LIBRARY FUNCTIONS
|
| 1060 |
+
---------------------------
|
| 1061 |
+
Written by: Philip Hazel
|
| 1062 |
+
Email local part: ph10
|
| 1063 |
+
Email domain: cam.ac.uk
|
| 1064 |
+
University of Cambridge Computing Service,
|
| 1065 |
+
Cambridge, England.
|
| 1066 |
+
Copyright (c) 1997-2012 University of Cambridge
|
| 1067 |
+
All rights reserved.
|
| 1068 |
+
|
| 1069 |
+
PCRE JUST-IN-TIME COMPILATION SUPPORT
|
| 1070 |
+
-------------------------------------
|
| 1071 |
+
Written by: Zoltan Herczeg
|
| 1072 |
+
Email local part: hzmester
|
| 1073 |
+
Emain domain: freemail.hu
|
| 1074 |
+
Copyright(c) 2010-2012 Zoltan Herczeg
|
| 1075 |
+
All rights reserved.
|
| 1076 |
+
|
| 1077 |
+
STACK-LESS JUST-IN-TIME COMPILER
|
| 1078 |
+
--------------------------------
|
| 1079 |
+
Written by: Zoltan Herczeg
|
| 1080 |
+
Email local part: hzmester
|
| 1081 |
+
Emain domain: freemail.hu
|
| 1082 |
+
Copyright(c) 2009-2012 Zoltan Herczeg
|
| 1083 |
+
All rights reserved.
|
| 1084 |
+
|
| 1085 |
+
THE C++ WRAPPER FUNCTIONS
|
| 1086 |
+
-------------------------
|
| 1087 |
+
Contributed by: Google Inc.
|
| 1088 |
+
Copyright (c) 2007-2012, Google Inc.
|
| 1089 |
+
All rights reserved.
|
| 1090 |
+
|
| 1091 |
+
THE "BSD" LICENCE
|
| 1092 |
+
-----------------
|
| 1093 |
+
Redistribution and use in source and binary forms, with or without
|
| 1094 |
+
modification, are permitted provided that the following conditions are met:
|
| 1095 |
+
|
| 1096 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 1097 |
+
this list of conditions and the following disclaimer.
|
| 1098 |
+
|
| 1099 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1100 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1101 |
+
documentation and/or other materials provided with the distribution.
|
| 1102 |
+
|
| 1103 |
+
* Neither the name of the University of Cambridge nor the name of Google
|
| 1104 |
+
Inc. nor the names of their contributors may be used to endorse or
|
| 1105 |
+
promote products derived from this software without specific prior
|
| 1106 |
+
written permission.
|
| 1107 |
+
|
| 1108 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 1109 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 1110 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 1111 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
| 1112 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 1113 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 1114 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 1115 |
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 1116 |
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 1117 |
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1118 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1119 |
+
|
| 1120 |
+
6. Some of the cuBLAS library routines were written by or
|
| 1121 |
+
derived from code written by Vasily Volkov and are subject
|
| 1122 |
+
to the Modified Berkeley Software Distribution License as
|
| 1123 |
+
follows:
|
| 1124 |
+
|
| 1125 |
+
Copyright (c) 2007-2009, Regents of the University of California
|
| 1126 |
+
|
| 1127 |
+
All rights reserved.
|
| 1128 |
+
|
| 1129 |
+
Redistribution and use in source and binary forms, with or without
|
| 1130 |
+
modification, are permitted provided that the following conditions are
|
| 1131 |
+
met:
|
| 1132 |
+
* Redistributions of source code must retain the above copyright
|
| 1133 |
+
notice, this list of conditions and the following disclaimer.
|
| 1134 |
+
* Redistributions in binary form must reproduce the above
|
| 1135 |
+
copyright notice, this list of conditions and the following
|
| 1136 |
+
disclaimer in the documentation and/or other materials provided
|
| 1137 |
+
with the distribution.
|
| 1138 |
+
* Neither the name of the University of California, Berkeley nor
|
| 1139 |
+
the names of its contributors may be used to endorse or promote
|
| 1140 |
+
products derived from this software without specific prior
|
| 1141 |
+
written permission.
|
| 1142 |
+
|
| 1143 |
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
| 1144 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 1145 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 1146 |
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
| 1147 |
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 1148 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 1149 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 1150 |
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
| 1151 |
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
| 1152 |
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1153 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1154 |
+
|
| 1155 |
+
7. Some of the cuBLAS library routines were written by or
|
| 1156 |
+
derived from code written by Davide Barbieri and are
|
| 1157 |
+
subject to the Modified Berkeley Software Distribution
|
| 1158 |
+
License as follows:
|
| 1159 |
+
|
| 1160 |
+
Copyright (c) 2008-2009 Davide Barbieri @ University of Rome Tor Vergata.
|
| 1161 |
+
|
| 1162 |
+
All rights reserved.
|
| 1163 |
+
|
| 1164 |
+
Redistribution and use in source and binary forms, with or without
|
| 1165 |
+
modification, are permitted provided that the following conditions are
|
| 1166 |
+
met:
|
| 1167 |
+
* Redistributions of source code must retain the above copyright
|
| 1168 |
+
notice, this list of conditions and the following disclaimer.
|
| 1169 |
+
* Redistributions in binary form must reproduce the above
|
| 1170 |
+
copyright notice, this list of conditions and the following
|
| 1171 |
+
disclaimer in the documentation and/or other materials provided
|
| 1172 |
+
with the distribution.
|
| 1173 |
+
* The name of the author may not be used to endorse or promote
|
| 1174 |
+
products derived from this software without specific prior
|
| 1175 |
+
written permission.
|
| 1176 |
+
|
| 1177 |
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
| 1178 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 1179 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 1180 |
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
| 1181 |
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 1182 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 1183 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 1184 |
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
| 1185 |
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
| 1186 |
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1187 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1188 |
+
|
| 1189 |
+
8. Some of the cuBLAS library routines were derived from
|
| 1190 |
+
code developed by the University of Tennessee and are
|
| 1191 |
+
subject to the Modified Berkeley Software Distribution
|
| 1192 |
+
License as follows:
|
| 1193 |
+
|
| 1194 |
+
Copyright (c) 2010 The University of Tennessee.
|
| 1195 |
+
|
| 1196 |
+
All rights reserved.
|
| 1197 |
+
|
| 1198 |
+
Redistribution and use in source and binary forms, with or without
|
| 1199 |
+
modification, are permitted provided that the following conditions are
|
| 1200 |
+
met:
|
| 1201 |
+
* Redistributions of source code must retain the above copyright
|
| 1202 |
+
notice, this list of conditions and the following disclaimer.
|
| 1203 |
+
* Redistributions in binary form must reproduce the above
|
| 1204 |
+
copyright notice, this list of conditions and the following
|
| 1205 |
+
disclaimer listed in this license in the documentation and/or
|
| 1206 |
+
other materials provided with the distribution.
|
| 1207 |
+
* Neither the name of the copyright holders nor the names of its
|
| 1208 |
+
contributors may be used to endorse or promote products derived
|
| 1209 |
+
from this software without specific prior written permission.
|
| 1210 |
+
|
| 1211 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1212 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1213 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1214 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1215 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1216 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1217 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1218 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1219 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1220 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1221 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1222 |
+
|
| 1223 |
+
9. Some of the cuBLAS library routines were written by or
|
| 1224 |
+
derived from code written by Jonathan Hogg and are subject
|
| 1225 |
+
to the Modified Berkeley Software Distribution License as
|
| 1226 |
+
follows:
|
| 1227 |
+
|
| 1228 |
+
Copyright (c) 2012, The Science and Technology Facilities Council (STFC).
|
| 1229 |
+
|
| 1230 |
+
All rights reserved.
|
| 1231 |
+
|
| 1232 |
+
Redistribution and use in source and binary forms, with or without
|
| 1233 |
+
modification, are permitted provided that the following conditions are
|
| 1234 |
+
met:
|
| 1235 |
+
* Redistributions of source code must retain the above copyright
|
| 1236 |
+
notice, this list of conditions and the following disclaimer.
|
| 1237 |
+
* Redistributions in binary form must reproduce the above
|
| 1238 |
+
copyright notice, this list of conditions and the following
|
| 1239 |
+
disclaimer in the documentation and/or other materials provided
|
| 1240 |
+
with the distribution.
|
| 1241 |
+
* Neither the name of the STFC nor the names of its contributors
|
| 1242 |
+
may be used to endorse or promote products derived from this
|
| 1243 |
+
software without specific prior written permission.
|
| 1244 |
+
|
| 1245 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1246 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1247 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1248 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE STFC BE
|
| 1249 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 1250 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 1251 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
| 1252 |
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
| 1253 |
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
| 1254 |
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
| 1255 |
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1256 |
+
|
| 1257 |
+
10. Some of the cuBLAS library routines were written by or
|
| 1258 |
+
derived from code written by Ahmad M. Abdelfattah, David
|
| 1259 |
+
Keyes, and Hatem Ltaief, and are subject to the Apache
|
| 1260 |
+
License, Version 2.0, as follows:
|
| 1261 |
+
|
| 1262 |
+
-- (C) Copyright 2013 King Abdullah University of Science and Technology
|
| 1263 |
+
Authors:
|
| 1264 |
+
Ahmad Abdelfattah (ahmad.ahmad@kaust.edu.sa)
|
| 1265 |
+
David Keyes (david.keyes@kaust.edu.sa)
|
| 1266 |
+
Hatem Ltaief (hatem.ltaief@kaust.edu.sa)
|
| 1267 |
+
|
| 1268 |
+
Redistribution and use in source and binary forms, with or without
|
| 1269 |
+
modification, are permitted provided that the following conditions
|
| 1270 |
+
are met:
|
| 1271 |
+
|
| 1272 |
+
* Redistributions of source code must retain the above copyright
|
| 1273 |
+
notice, this list of conditions and the following disclaimer.
|
| 1274 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1275 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1276 |
+
documentation and/or other materials provided with the distribution.
|
| 1277 |
+
* Neither the name of the King Abdullah University of Science and
|
| 1278 |
+
Technology nor the names of its contributors may be used to endorse
|
| 1279 |
+
or promote products derived from this software without specific prior
|
| 1280 |
+
written permission.
|
| 1281 |
+
|
| 1282 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1283 |
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1284 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1285 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1286 |
+
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1287 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1288 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1289 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1290 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1291 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1292 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
|
| 1293 |
+
|
| 1294 |
+
11. Some of the cuSPARSE library routines were written by or
|
| 1295 |
+
derived from code written by Li-Wen Chang and are subject
|
| 1296 |
+
to the NCSA Open Source License as follows:
|
| 1297 |
+
|
| 1298 |
+
Copyright (c) 2012, University of Illinois.
|
| 1299 |
+
|
| 1300 |
+
All rights reserved.
|
| 1301 |
+
|
| 1302 |
+
Developed by: IMPACT Group, University of Illinois, http://impact.crhc.illinois.edu
|
| 1303 |
+
|
| 1304 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 1305 |
+
a copy of this software and associated documentation files (the
|
| 1306 |
+
"Software"), to deal with the Software without restriction, including
|
| 1307 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 1308 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 1309 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 1310 |
+
the following conditions:
|
| 1311 |
+
* Redistributions of source code must retain the above copyright
|
| 1312 |
+
notice, this list of conditions and the following disclaimer.
|
| 1313 |
+
* Redistributions in binary form must reproduce the above
|
| 1314 |
+
copyright notice, this list of conditions and the following
|
| 1315 |
+
disclaimers in the documentation and/or other materials provided
|
| 1316 |
+
with the distribution.
|
| 1317 |
+
* Neither the names of IMPACT Group, University of Illinois, nor
|
| 1318 |
+
the names of its contributors may be used to endorse or promote
|
| 1319 |
+
products derived from this Software without specific prior
|
| 1320 |
+
written permission.
|
| 1321 |
+
|
| 1322 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1323 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 1324 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 1325 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
|
| 1326 |
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 1327 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
| 1328 |
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
| 1329 |
+
SOFTWARE.
|
| 1330 |
+
|
| 1331 |
+
12. Some of the cuRAND library routines were written by or
|
| 1332 |
+
derived from code written by Mutsuo Saito and Makoto
|
| 1333 |
+
Matsumoto and are subject to the following license:
|
| 1334 |
+
|
| 1335 |
+
Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima
|
| 1336 |
+
University. All rights reserved.
|
| 1337 |
+
|
| 1338 |
+
Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
|
| 1339 |
+
University and University of Tokyo. All rights reserved.
|
| 1340 |
+
|
| 1341 |
+
Redistribution and use in source and binary forms, with or without
|
| 1342 |
+
modification, are permitted provided that the following conditions are
|
| 1343 |
+
met:
|
| 1344 |
+
* Redistributions of source code must retain the above copyright
|
| 1345 |
+
notice, this list of conditions and the following disclaimer.
|
| 1346 |
+
* Redistributions in binary form must reproduce the above
|
| 1347 |
+
copyright notice, this list of conditions and the following
|
| 1348 |
+
disclaimer in the documentation and/or other materials provided
|
| 1349 |
+
with the distribution.
|
| 1350 |
+
* Neither the name of the Hiroshima University nor the names of
|
| 1351 |
+
its contributors may be used to endorse or promote products
|
| 1352 |
+
derived from this software without specific prior written
|
| 1353 |
+
permission.
|
| 1354 |
+
|
| 1355 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1356 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1357 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1358 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1359 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1360 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1361 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1362 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1363 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1364 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1365 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1366 |
+
|
| 1367 |
+
13. Some of the cuRAND library routines were derived from
|
| 1368 |
+
code developed by D. E. Shaw Research and are subject to
|
| 1369 |
+
the following license:
|
| 1370 |
+
|
| 1371 |
+
Copyright 2010-2011, D. E. Shaw Research.
|
| 1372 |
+
|
| 1373 |
+
All rights reserved.
|
| 1374 |
+
|
| 1375 |
+
Redistribution and use in source and binary forms, with or without
|
| 1376 |
+
modification, are permitted provided that the following conditions are
|
| 1377 |
+
met:
|
| 1378 |
+
* Redistributions of source code must retain the above copyright
|
| 1379 |
+
notice, this list of conditions, and the following disclaimer.
|
| 1380 |
+
* Redistributions in binary form must reproduce the above
|
| 1381 |
+
copyright notice, this list of conditions, and the following
|
| 1382 |
+
disclaimer in the documentation and/or other materials provided
|
| 1383 |
+
with the distribution.
|
| 1384 |
+
* Neither the name of D. E. Shaw Research nor the names of its
|
| 1385 |
+
contributors may be used to endorse or promote products derived
|
| 1386 |
+
from this software without specific prior written permission.
|
| 1387 |
+
|
| 1388 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1389 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1390 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1391 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1392 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1393 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1394 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1395 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1396 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1397 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1398 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1399 |
+
|
| 1400 |
+
14. Some of the Math library routines were written by or
|
| 1401 |
+
derived from code developed by Norbert Juffa and are
|
| 1402 |
+
subject to the following license:
|
| 1403 |
+
|
| 1404 |
+
Copyright (c) 2015-2017, Norbert Juffa
|
| 1405 |
+
All rights reserved.
|
| 1406 |
+
|
| 1407 |
+
Redistribution and use in source and binary forms, with or without
|
| 1408 |
+
modification, are permitted provided that the following conditions
|
| 1409 |
+
are met:
|
| 1410 |
+
|
| 1411 |
+
1. Redistributions of source code must retain the above copyright
|
| 1412 |
+
notice, this list of conditions and the following disclaimer.
|
| 1413 |
+
|
| 1414 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 1415 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1416 |
+
documentation and/or other materials provided with the distribution.
|
| 1417 |
+
|
| 1418 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1419 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1420 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1421 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1422 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1423 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1424 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1425 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1426 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1427 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1428 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1429 |
+
|
| 1430 |
+
15. Licensee's use of the lz4 third party component is
|
| 1431 |
+
subject to the following terms and conditions:
|
| 1432 |
+
|
| 1433 |
+
Copyright (C) 2011-2013, Yann Collet.
|
| 1434 |
+
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
| 1435 |
+
|
| 1436 |
+
Redistribution and use in source and binary forms, with or without
|
| 1437 |
+
modification, are permitted provided that the following conditions are
|
| 1438 |
+
met:
|
| 1439 |
+
|
| 1440 |
+
* Redistributions of source code must retain the above copyright
|
| 1441 |
+
notice, this list of conditions and the following disclaimer.
|
| 1442 |
+
* Redistributions in binary form must reproduce the above
|
| 1443 |
+
copyright notice, this list of conditions and the following disclaimer
|
| 1444 |
+
in the documentation and/or other materials provided with the
|
| 1445 |
+
distribution.
|
| 1446 |
+
|
| 1447 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1448 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1449 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1450 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1451 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1452 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1453 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1454 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1455 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1456 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1457 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1458 |
+
|
| 1459 |
+
16. The NPP library uses code from the Boost Math Toolkit,
|
| 1460 |
+
and is subject to the following license:
|
| 1461 |
+
|
| 1462 |
+
Boost Software License - Version 1.0 - August 17th, 2003
|
| 1463 |
+
. . . .
|
| 1464 |
+
|
| 1465 |
+
Permission is hereby granted, free of charge, to any person or
|
| 1466 |
+
organization obtaining a copy of the software and accompanying
|
| 1467 |
+
documentation covered by this license (the "Software") to use,
|
| 1468 |
+
reproduce, display, distribute, execute, and transmit the Software,
|
| 1469 |
+
and to prepare derivative works of the Software, and to permit
|
| 1470 |
+
third-parties to whom the Software is furnished to do so, all
|
| 1471 |
+
subject to the following:
|
| 1472 |
+
|
| 1473 |
+
The copyright notices in the Software and this entire statement,
|
| 1474 |
+
including the above license grant, this restriction and the following
|
| 1475 |
+
disclaimer, must be included in all copies of the Software, in whole
|
| 1476 |
+
or in part, and all derivative works of the Software, unless such
|
| 1477 |
+
copies or derivative works are solely in the form of machine-executable
|
| 1478 |
+
object code generated by a source language processor.
|
| 1479 |
+
|
| 1480 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1481 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 1482 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
| 1483 |
+
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
| 1484 |
+
ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
| 1485 |
+
OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
|
| 1486 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 1487 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
| 1488 |
+
|
| 1489 |
+
17. Portions of the Nsight Eclipse Edition is subject to the
|
| 1490 |
+
following license:
|
| 1491 |
+
|
| 1492 |
+
The Eclipse Foundation makes available all content in this plug-in
|
| 1493 |
+
("Content"). Unless otherwise indicated below, the Content is provided
|
| 1494 |
+
to you under the terms and conditions of the Eclipse Public License
|
| 1495 |
+
Version 1.0 ("EPL"). A copy of the EPL is available at http://
|
| 1496 |
+
www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program"
|
| 1497 |
+
will mean the Content.
|
| 1498 |
+
|
| 1499 |
+
If you did not receive this Content directly from the Eclipse
|
| 1500 |
+
Foundation, the Content is being redistributed by another party
|
| 1501 |
+
("Redistributor") and different terms and conditions may apply to your
|
| 1502 |
+
use of any object code in the Content. Check the Redistributor's
|
| 1503 |
+
license that was provided with the Content. If no such license exists,
|
| 1504 |
+
contact the Redistributor. Unless otherwise indicated below, the terms
|
| 1505 |
+
and conditions of the EPL still apply to any source code in the
|
| 1506 |
+
Content and such source code may be obtained at http://www.eclipse.org.
|
| 1507 |
+
|
| 1508 |
+
18. Some of the cuBLAS library routines uses code from
|
| 1509 |
+
OpenAI, which is subject to the following license:
|
| 1510 |
+
|
| 1511 |
+
License URL
|
| 1512 |
+
https://github.com/openai/openai-gemm/blob/master/LICENSE
|
| 1513 |
+
|
| 1514 |
+
License Text
|
| 1515 |
+
The MIT License
|
| 1516 |
+
|
| 1517 |
+
Copyright (c) 2016 OpenAI (http://openai.com), 2016 Google Inc.
|
| 1518 |
+
|
| 1519 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 1520 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 1521 |
+
in the Software without restriction, including without limitation the rights
|
| 1522 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 1523 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 1524 |
+
furnished to do so, subject to the following conditions:
|
| 1525 |
+
|
| 1526 |
+
The above copyright notice and this permission notice shall be included in
|
| 1527 |
+
all copies or substantial portions of the Software.
|
| 1528 |
+
|
| 1529 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 1530 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1531 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 1532 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 1533 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 1534 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 1535 |
+
THE SOFTWARE.
|
| 1536 |
+
|
| 1537 |
+
19. Licensee's use of the Visual Studio Setup Configuration
|
| 1538 |
+
Samples is subject to the following license:
|
| 1539 |
+
|
| 1540 |
+
The MIT License (MIT)
|
| 1541 |
+
Copyright (C) Microsoft Corporation. All rights reserved.
|
| 1542 |
+
|
| 1543 |
+
Permission is hereby granted, free of charge, to any person
|
| 1544 |
+
obtaining a copy of this software and associated documentation
|
| 1545 |
+
files (the "Software"), to deal in the Software without restriction,
|
| 1546 |
+
including without limitation the rights to use, copy, modify, merge,
|
| 1547 |
+
publish, distribute, sublicense, and/or sell copies of the Software,
|
| 1548 |
+
and to permit persons to whom the Software is furnished to do so,
|
| 1549 |
+
subject to the following conditions:
|
| 1550 |
+
|
| 1551 |
+
The above copyright notice and this permission notice shall be included
|
| 1552 |
+
in all copies or substantial portions of the Software.
|
| 1553 |
+
|
| 1554 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 1555 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1556 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 1557 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 1558 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 1559 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 1560 |
+
|
| 1561 |
+
20. Licensee's use of linmath.h header for CPU functions for
|
| 1562 |
+
GL vector/matrix operations from lunarG is subject to the
|
| 1563 |
+
Apache License Version 2.0.
|
| 1564 |
+
|
| 1565 |
+
21. The DX12-CUDA sample uses the d3dx12.h header, which is
|
| 1566 |
+
subject to the MIT license .
|
| 1567 |
+
|
| 1568 |
+
-----------------
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/METADATA
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: nvidia-cuda-nvrtc-cu12
|
| 3 |
+
Version: 12.4.127
|
| 4 |
+
Summary: NVRTC native runtime libraries
|
| 5 |
+
Home-page: https://developer.nvidia.com/cuda-zone
|
| 6 |
+
Author: Nvidia CUDA Installer Team
|
| 7 |
+
Author-email: cuda_installer@nvidia.com
|
| 8 |
+
License: NVIDIA Proprietary Software
|
| 9 |
+
Keywords: cuda,nvidia,runtime,machine learning,deep learning
|
| 10 |
+
Classifier: Development Status :: 4 - Beta
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: Intended Audience :: Education
|
| 13 |
+
Classifier: Intended Audience :: Science/Research
|
| 14 |
+
Classifier: License :: Other/Proprietary License
|
| 15 |
+
Classifier: Natural Language :: English
|
| 16 |
+
Classifier: Programming Language :: Python :: 3
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.5
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.6
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 24 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 25 |
+
Classifier: Topic :: Scientific/Engineering
|
| 26 |
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
| 27 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
| 28 |
+
Classifier: Topic :: Software Development
|
| 29 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 30 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 31 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 32 |
+
Requires-Python: >=3
|
| 33 |
+
License-File: License.txt
|
| 34 |
+
|
| 35 |
+
NVRTC native runtime libraries
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/RECORD
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
nvidia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 2 |
+
nvidia/__pycache__/__init__.cpython-311.pyc,,
|
| 3 |
+
nvidia/cuda_nvrtc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 4 |
+
nvidia/cuda_nvrtc/__pycache__/__init__.cpython-311.pyc,,
|
| 5 |
+
nvidia/cuda_nvrtc/include/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
nvidia/cuda_nvrtc/include/__pycache__/__init__.cpython-311.pyc,,
|
| 7 |
+
nvidia/cuda_nvrtc/include/nvrtc.h,sha256=K3X9i14crxxUBVAdXyNFIW0BVYUdxTqM6TfOffDXL7U,36119
|
| 8 |
+
nvidia/cuda_nvrtc/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 9 |
+
nvidia/cuda_nvrtc/lib/__pycache__/__init__.cpython-311.pyc,,
|
| 10 |
+
nvidia/cuda_nvrtc/lib/libnvrtc-builtins.so.12.4,sha256=RCVWGjGdoHu94NwYCpBCLjUbNkw9xPaj6h5pkl1i23I,5343112
|
| 11 |
+
nvidia/cuda_nvrtc/lib/libnvrtc.so.12,sha256=Rm1vFNbP3pmDihMs-noj-Qugis-tqk2eTJ3v4Sd_e_E,60418376
|
| 12 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 13 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/License.txt,sha256=rW9YU_ugyg0VnQ9Y1JrkmDDC-Mk_epJki5zpCttMbM0,59262
|
| 14 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/METADATA,sha256=ZFn72NXguvRFDpzLRoJbcR4F9zUzHvokH8XSt3lduNs,1507
|
| 15 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/RECORD,,
|
| 16 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/WHEEL,sha256=XDTs3wIbcE-BcRO08VJlZpA6z9OaC1mOKPCGGGwuM2g,109
|
| 17 |
+
nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/top_level.txt,sha256=fTkAtiFuL16nUrB9ytDDtpytz2t0B4NvYTnRzwAhO14,7
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.42.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-manylinux2014_x86_64
|
| 5 |
+
|
.venv/lib/python3.11/site-packages/nvidia_cuda_nvrtc_cu12-12.4.127.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
nvidia
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (194 Bytes). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-311.pyc
ADDED
|
Binary file (29.4 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/__pycache__/zipp.cpython-311.pyc
ADDED
|
Binary file (16 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Read resources contained within a package."""
|
| 2 |
+
|
| 3 |
+
from ._common import (
|
| 4 |
+
as_file,
|
| 5 |
+
files,
|
| 6 |
+
Package,
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
from ._legacy import (
|
| 10 |
+
contents,
|
| 11 |
+
open_binary,
|
| 12 |
+
read_binary,
|
| 13 |
+
open_text,
|
| 14 |
+
read_text,
|
| 15 |
+
is_resource,
|
| 16 |
+
path,
|
| 17 |
+
Resource,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
from .abc import ResourceReader
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
__all__ = [
|
| 24 |
+
'Package',
|
| 25 |
+
'Resource',
|
| 26 |
+
'ResourceReader',
|
| 27 |
+
'as_file',
|
| 28 |
+
'contents',
|
| 29 |
+
'files',
|
| 30 |
+
'is_resource',
|
| 31 |
+
'open_binary',
|
| 32 |
+
'open_text',
|
| 33 |
+
'path',
|
| 34 |
+
'read_binary',
|
| 35 |
+
'read_text',
|
| 36 |
+
]
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (828 Bytes). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_adapters.cpython-311.pyc
ADDED
|
Binary file (10.7 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_common.cpython-311.pyc
ADDED
|
Binary file (4.27 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_compat.cpython-311.pyc
ADDED
|
Binary file (5.56 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_itertools.cpython-311.pyc
ADDED
|
Binary file (1.39 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/_legacy.cpython-311.pyc
ADDED
|
Binary file (6.49 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/abc.cpython-311.pyc
ADDED
|
Binary file (7.49 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/readers.cpython-311.pyc
ADDED
|
Binary file (8.36 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/__pycache__/simple.cpython-311.pyc
ADDED
|
Binary file (6.39 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_adapters.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from contextlib import suppress
|
| 2 |
+
from io import TextIOWrapper
|
| 3 |
+
|
| 4 |
+
from . import abc
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class SpecLoaderAdapter:
|
| 8 |
+
"""
|
| 9 |
+
Adapt a package spec to adapt the underlying loader.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
def __init__(self, spec, adapter=lambda spec: spec.loader):
|
| 13 |
+
self.spec = spec
|
| 14 |
+
self.loader = adapter(spec)
|
| 15 |
+
|
| 16 |
+
def __getattr__(self, name):
|
| 17 |
+
return getattr(self.spec, name)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class TraversableResourcesLoader:
|
| 21 |
+
"""
|
| 22 |
+
Adapt a loader to provide TraversableResources.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(self, spec):
|
| 26 |
+
self.spec = spec
|
| 27 |
+
|
| 28 |
+
def get_resource_reader(self, name):
|
| 29 |
+
return CompatibilityFiles(self.spec)._native()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def _io_wrapper(file, mode='r', *args, **kwargs):
|
| 33 |
+
if mode == 'r':
|
| 34 |
+
return TextIOWrapper(file, *args, **kwargs)
|
| 35 |
+
elif mode == 'rb':
|
| 36 |
+
return file
|
| 37 |
+
raise ValueError(
|
| 38 |
+
"Invalid mode value '{}', only 'r' and 'rb' are supported".format(mode)
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class CompatibilityFiles:
|
| 43 |
+
"""
|
| 44 |
+
Adapter for an existing or non-existent resource reader
|
| 45 |
+
to provide a compatibility .files().
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
class SpecPath(abc.Traversable):
|
| 49 |
+
"""
|
| 50 |
+
Path tied to a module spec.
|
| 51 |
+
Can be read and exposes the resource reader children.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
def __init__(self, spec, reader):
|
| 55 |
+
self._spec = spec
|
| 56 |
+
self._reader = reader
|
| 57 |
+
|
| 58 |
+
def iterdir(self):
|
| 59 |
+
if not self._reader:
|
| 60 |
+
return iter(())
|
| 61 |
+
return iter(
|
| 62 |
+
CompatibilityFiles.ChildPath(self._reader, path)
|
| 63 |
+
for path in self._reader.contents()
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
def is_file(self):
|
| 67 |
+
return False
|
| 68 |
+
|
| 69 |
+
is_dir = is_file
|
| 70 |
+
|
| 71 |
+
def joinpath(self, other):
|
| 72 |
+
if not self._reader:
|
| 73 |
+
return CompatibilityFiles.OrphanPath(other)
|
| 74 |
+
return CompatibilityFiles.ChildPath(self._reader, other)
|
| 75 |
+
|
| 76 |
+
@property
|
| 77 |
+
def name(self):
|
| 78 |
+
return self._spec.name
|
| 79 |
+
|
| 80 |
+
def open(self, mode='r', *args, **kwargs):
|
| 81 |
+
return _io_wrapper(self._reader.open_resource(None), mode, *args, **kwargs)
|
| 82 |
+
|
| 83 |
+
class ChildPath(abc.Traversable):
|
| 84 |
+
"""
|
| 85 |
+
Path tied to a resource reader child.
|
| 86 |
+
Can be read but doesn't expose any meaningful children.
|
| 87 |
+
"""
|
| 88 |
+
|
| 89 |
+
def __init__(self, reader, name):
|
| 90 |
+
self._reader = reader
|
| 91 |
+
self._name = name
|
| 92 |
+
|
| 93 |
+
def iterdir(self):
|
| 94 |
+
return iter(())
|
| 95 |
+
|
| 96 |
+
def is_file(self):
|
| 97 |
+
return self._reader.is_resource(self.name)
|
| 98 |
+
|
| 99 |
+
def is_dir(self):
|
| 100 |
+
return not self.is_file()
|
| 101 |
+
|
| 102 |
+
def joinpath(self, other):
|
| 103 |
+
return CompatibilityFiles.OrphanPath(self.name, other)
|
| 104 |
+
|
| 105 |
+
@property
|
| 106 |
+
def name(self):
|
| 107 |
+
return self._name
|
| 108 |
+
|
| 109 |
+
def open(self, mode='r', *args, **kwargs):
|
| 110 |
+
return _io_wrapper(
|
| 111 |
+
self._reader.open_resource(self.name), mode, *args, **kwargs
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
class OrphanPath(abc.Traversable):
|
| 115 |
+
"""
|
| 116 |
+
Orphan path, not tied to a module spec or resource reader.
|
| 117 |
+
Can't be read and doesn't expose any meaningful children.
|
| 118 |
+
"""
|
| 119 |
+
|
| 120 |
+
def __init__(self, *path_parts):
|
| 121 |
+
if len(path_parts) < 1:
|
| 122 |
+
raise ValueError('Need at least one path part to construct a path')
|
| 123 |
+
self._path = path_parts
|
| 124 |
+
|
| 125 |
+
def iterdir(self):
|
| 126 |
+
return iter(())
|
| 127 |
+
|
| 128 |
+
def is_file(self):
|
| 129 |
+
return False
|
| 130 |
+
|
| 131 |
+
is_dir = is_file
|
| 132 |
+
|
| 133 |
+
def joinpath(self, other):
|
| 134 |
+
return CompatibilityFiles.OrphanPath(*self._path, other)
|
| 135 |
+
|
| 136 |
+
@property
|
| 137 |
+
def name(self):
|
| 138 |
+
return self._path[-1]
|
| 139 |
+
|
| 140 |
+
def open(self, mode='r', *args, **kwargs):
|
| 141 |
+
raise FileNotFoundError("Can't open orphan path")
|
| 142 |
+
|
| 143 |
+
def __init__(self, spec):
|
| 144 |
+
self.spec = spec
|
| 145 |
+
|
| 146 |
+
@property
|
| 147 |
+
def _reader(self):
|
| 148 |
+
with suppress(AttributeError):
|
| 149 |
+
return self.spec.loader.get_resource_reader(self.spec.name)
|
| 150 |
+
|
| 151 |
+
def _native(self):
|
| 152 |
+
"""
|
| 153 |
+
Return the native reader if it supports files().
|
| 154 |
+
"""
|
| 155 |
+
reader = self._reader
|
| 156 |
+
return reader if hasattr(reader, 'files') else self
|
| 157 |
+
|
| 158 |
+
def __getattr__(self, attr):
|
| 159 |
+
return getattr(self._reader, attr)
|
| 160 |
+
|
| 161 |
+
def files(self):
|
| 162 |
+
return CompatibilityFiles.SpecPath(self.spec, self._reader)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def wrap_spec(package):
|
| 166 |
+
"""
|
| 167 |
+
Construct a package spec with traversable compatibility
|
| 168 |
+
on the spec/loader/reader.
|
| 169 |
+
"""
|
| 170 |
+
return SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_common.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pathlib
|
| 3 |
+
import tempfile
|
| 4 |
+
import functools
|
| 5 |
+
import contextlib
|
| 6 |
+
import types
|
| 7 |
+
import importlib
|
| 8 |
+
|
| 9 |
+
from typing import Union, Optional
|
| 10 |
+
from .abc import ResourceReader, Traversable
|
| 11 |
+
|
| 12 |
+
from ._compat import wrap_spec
|
| 13 |
+
|
| 14 |
+
Package = Union[types.ModuleType, str]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def files(package):
|
| 18 |
+
# type: (Package) -> Traversable
|
| 19 |
+
"""
|
| 20 |
+
Get a Traversable resource from a package
|
| 21 |
+
"""
|
| 22 |
+
return from_package(get_package(package))
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def get_resource_reader(package):
|
| 26 |
+
# type: (types.ModuleType) -> Optional[ResourceReader]
|
| 27 |
+
"""
|
| 28 |
+
Return the package's loader if it's a ResourceReader.
|
| 29 |
+
"""
|
| 30 |
+
# We can't use
|
| 31 |
+
# a issubclass() check here because apparently abc.'s __subclasscheck__()
|
| 32 |
+
# hook wants to create a weak reference to the object, but
|
| 33 |
+
# zipimport.zipimporter does not support weak references, resulting in a
|
| 34 |
+
# TypeError. That seems terrible.
|
| 35 |
+
spec = package.__spec__
|
| 36 |
+
reader = getattr(spec.loader, 'get_resource_reader', None) # type: ignore
|
| 37 |
+
if reader is None:
|
| 38 |
+
return None
|
| 39 |
+
return reader(spec.name) # type: ignore
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def resolve(cand):
|
| 43 |
+
# type: (Package) -> types.ModuleType
|
| 44 |
+
return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def get_package(package):
|
| 48 |
+
# type: (Package) -> types.ModuleType
|
| 49 |
+
"""Take a package name or module object and return the module.
|
| 50 |
+
|
| 51 |
+
Raise an exception if the resolved module is not a package.
|
| 52 |
+
"""
|
| 53 |
+
resolved = resolve(package)
|
| 54 |
+
if wrap_spec(resolved).submodule_search_locations is None:
|
| 55 |
+
raise TypeError(f'{package!r} is not a package')
|
| 56 |
+
return resolved
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def from_package(package):
|
| 60 |
+
"""
|
| 61 |
+
Return a Traversable object for the given package.
|
| 62 |
+
|
| 63 |
+
"""
|
| 64 |
+
spec = wrap_spec(package)
|
| 65 |
+
reader = spec.loader.get_resource_reader(spec.name)
|
| 66 |
+
return reader.files()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
@contextlib.contextmanager
|
| 70 |
+
def _tempfile(reader, suffix=''):
|
| 71 |
+
# Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
|
| 72 |
+
# blocks due to the need to close the temporary file to work on Windows
|
| 73 |
+
# properly.
|
| 74 |
+
fd, raw_path = tempfile.mkstemp(suffix=suffix)
|
| 75 |
+
try:
|
| 76 |
+
try:
|
| 77 |
+
os.write(fd, reader())
|
| 78 |
+
finally:
|
| 79 |
+
os.close(fd)
|
| 80 |
+
del reader
|
| 81 |
+
yield pathlib.Path(raw_path)
|
| 82 |
+
finally:
|
| 83 |
+
try:
|
| 84 |
+
os.remove(raw_path)
|
| 85 |
+
except FileNotFoundError:
|
| 86 |
+
pass
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
@functools.singledispatch
|
| 90 |
+
def as_file(path):
|
| 91 |
+
"""
|
| 92 |
+
Given a Traversable object, return that object as a
|
| 93 |
+
path on the local file system in a context manager.
|
| 94 |
+
"""
|
| 95 |
+
return _tempfile(path.read_bytes, suffix=path.name)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
@as_file.register(pathlib.Path)
|
| 99 |
+
@contextlib.contextmanager
|
| 100 |
+
def _(path):
|
| 101 |
+
"""
|
| 102 |
+
Degenerate behavior for pathlib.Path objects.
|
| 103 |
+
"""
|
| 104 |
+
yield path
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/_compat.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# flake8: noqa
|
| 2 |
+
|
| 3 |
+
import abc
|
| 4 |
+
import sys
|
| 5 |
+
import pathlib
|
| 6 |
+
from contextlib import suppress
|
| 7 |
+
|
| 8 |
+
if sys.version_info >= (3, 10):
|
| 9 |
+
from zipfile import Path as ZipPath # type: ignore
|
| 10 |
+
else:
|
| 11 |
+
from ..zipp import Path as ZipPath # type: ignore
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
try:
|
| 15 |
+
from typing import runtime_checkable # type: ignore
|
| 16 |
+
except ImportError:
|
| 17 |
+
|
| 18 |
+
def runtime_checkable(cls): # type: ignore
|
| 19 |
+
return cls
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
try:
|
| 23 |
+
from typing import Protocol # type: ignore
|
| 24 |
+
except ImportError:
|
| 25 |
+
Protocol = abc.ABC # type: ignore
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class TraversableResourcesLoader:
|
| 29 |
+
"""
|
| 30 |
+
Adapt loaders to provide TraversableResources and other
|
| 31 |
+
compatibility.
|
| 32 |
+
|
| 33 |
+
Used primarily for Python 3.9 and earlier where the native
|
| 34 |
+
loaders do not yet implement TraversableResources.
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
def __init__(self, spec):
|
| 38 |
+
self.spec = spec
|
| 39 |
+
|
| 40 |
+
@property
|
| 41 |
+
def path(self):
|
| 42 |
+
return self.spec.origin
|
| 43 |
+
|
| 44 |
+
def get_resource_reader(self, name):
|
| 45 |
+
from . import readers, _adapters
|
| 46 |
+
|
| 47 |
+
def _zip_reader(spec):
|
| 48 |
+
with suppress(AttributeError):
|
| 49 |
+
return readers.ZipReader(spec.loader, spec.name)
|
| 50 |
+
|
| 51 |
+
def _namespace_reader(spec):
|
| 52 |
+
with suppress(AttributeError, ValueError):
|
| 53 |
+
return readers.NamespaceReader(spec.submodule_search_locations)
|
| 54 |
+
|
| 55 |
+
def _available_reader(spec):
|
| 56 |
+
with suppress(AttributeError):
|
| 57 |
+
return spec.loader.get_resource_reader(spec.name)
|
| 58 |
+
|
| 59 |
+
def _native_reader(spec):
|
| 60 |
+
reader = _available_reader(spec)
|
| 61 |
+
return reader if hasattr(reader, 'files') else None
|
| 62 |
+
|
| 63 |
+
def _file_reader(spec):
|
| 64 |
+
try:
|
| 65 |
+
path = pathlib.Path(self.path)
|
| 66 |
+
except TypeError:
|
| 67 |
+
return None
|
| 68 |
+
if path.exists():
|
| 69 |
+
return readers.FileReader(self)
|
| 70 |
+
|
| 71 |
+
return (
|
| 72 |
+
# native reader if it supplies 'files'
|
| 73 |
+
_native_reader(self.spec)
|
| 74 |
+
or
|
| 75 |
+
# local ZipReader if a zip module
|
| 76 |
+
_zip_reader(self.spec)
|
| 77 |
+
or
|
| 78 |
+
# local NamespaceReader if a namespace module
|
| 79 |
+
_namespace_reader(self.spec)
|
| 80 |
+
or
|
| 81 |
+
# local FileReader
|
| 82 |
+
_file_reader(self.spec)
|
| 83 |
+
# fallback - adapt the spec ResourceReader to TraversableReader
|
| 84 |
+
or _adapters.CompatibilityFiles(self.spec)
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def wrap_spec(package):
|
| 89 |
+
"""
|
| 90 |
+
Construct a package spec with traversable compatibility
|
| 91 |
+
on the spec/loader/reader.
|
| 92 |
+
|
| 93 |
+
Supersedes _adapters.wrap_spec to use TraversableResourcesLoader
|
| 94 |
+
from above for older Python compatibility (<3.10).
|
| 95 |
+
"""
|
| 96 |
+
from . import _adapters
|
| 97 |
+
|
| 98 |
+
return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/abc.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import abc
|
| 2 |
+
from typing import BinaryIO, Iterable, Text
|
| 3 |
+
|
| 4 |
+
from ._compat import runtime_checkable, Protocol
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class ResourceReader(metaclass=abc.ABCMeta):
|
| 8 |
+
"""Abstract base class for loaders to provide resource reading support."""
|
| 9 |
+
|
| 10 |
+
@abc.abstractmethod
|
| 11 |
+
def open_resource(self, resource: Text) -> BinaryIO:
|
| 12 |
+
"""Return an opened, file-like object for binary reading.
|
| 13 |
+
|
| 14 |
+
The 'resource' argument is expected to represent only a file name.
|
| 15 |
+
If the resource cannot be found, FileNotFoundError is raised.
|
| 16 |
+
"""
|
| 17 |
+
# This deliberately raises FileNotFoundError instead of
|
| 18 |
+
# NotImplementedError so that if this method is accidentally called,
|
| 19 |
+
# it'll still do the right thing.
|
| 20 |
+
raise FileNotFoundError
|
| 21 |
+
|
| 22 |
+
@abc.abstractmethod
|
| 23 |
+
def resource_path(self, resource: Text) -> Text:
|
| 24 |
+
"""Return the file system path to the specified resource.
|
| 25 |
+
|
| 26 |
+
The 'resource' argument is expected to represent only a file name.
|
| 27 |
+
If the resource does not exist on the file system, raise
|
| 28 |
+
FileNotFoundError.
|
| 29 |
+
"""
|
| 30 |
+
# This deliberately raises FileNotFoundError instead of
|
| 31 |
+
# NotImplementedError so that if this method is accidentally called,
|
| 32 |
+
# it'll still do the right thing.
|
| 33 |
+
raise FileNotFoundError
|
| 34 |
+
|
| 35 |
+
@abc.abstractmethod
|
| 36 |
+
def is_resource(self, path: Text) -> bool:
|
| 37 |
+
"""Return True if the named 'path' is a resource.
|
| 38 |
+
|
| 39 |
+
Files are resources, directories are not.
|
| 40 |
+
"""
|
| 41 |
+
raise FileNotFoundError
|
| 42 |
+
|
| 43 |
+
@abc.abstractmethod
|
| 44 |
+
def contents(self) -> Iterable[str]:
|
| 45 |
+
"""Return an iterable of entries in `package`."""
|
| 46 |
+
raise FileNotFoundError
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
@runtime_checkable
|
| 50 |
+
class Traversable(Protocol):
|
| 51 |
+
"""
|
| 52 |
+
An object with a subset of pathlib.Path methods suitable for
|
| 53 |
+
traversing directories and opening files.
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
@abc.abstractmethod
|
| 57 |
+
def iterdir(self):
|
| 58 |
+
"""
|
| 59 |
+
Yield Traversable objects in self
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
def read_bytes(self):
|
| 63 |
+
"""
|
| 64 |
+
Read contents of self as bytes
|
| 65 |
+
"""
|
| 66 |
+
with self.open('rb') as strm:
|
| 67 |
+
return strm.read()
|
| 68 |
+
|
| 69 |
+
def read_text(self, encoding=None):
|
| 70 |
+
"""
|
| 71 |
+
Read contents of self as text
|
| 72 |
+
"""
|
| 73 |
+
with self.open(encoding=encoding) as strm:
|
| 74 |
+
return strm.read()
|
| 75 |
+
|
| 76 |
+
@abc.abstractmethod
|
| 77 |
+
def is_dir(self) -> bool:
|
| 78 |
+
"""
|
| 79 |
+
Return True if self is a directory
|
| 80 |
+
"""
|
| 81 |
+
|
| 82 |
+
@abc.abstractmethod
|
| 83 |
+
def is_file(self) -> bool:
|
| 84 |
+
"""
|
| 85 |
+
Return True if self is a file
|
| 86 |
+
"""
|
| 87 |
+
|
| 88 |
+
@abc.abstractmethod
|
| 89 |
+
def joinpath(self, child):
|
| 90 |
+
"""
|
| 91 |
+
Return Traversable child in self
|
| 92 |
+
"""
|
| 93 |
+
|
| 94 |
+
def __truediv__(self, child):
|
| 95 |
+
"""
|
| 96 |
+
Return Traversable child in self
|
| 97 |
+
"""
|
| 98 |
+
return self.joinpath(child)
|
| 99 |
+
|
| 100 |
+
@abc.abstractmethod
|
| 101 |
+
def open(self, mode='r', *args, **kwargs):
|
| 102 |
+
"""
|
| 103 |
+
mode may be 'r' or 'rb' to open as text or binary. Return a handle
|
| 104 |
+
suitable for reading (same as pathlib.Path.open).
|
| 105 |
+
|
| 106 |
+
When opening as text, accepts encoding parameters such as those
|
| 107 |
+
accepted by io.TextIOWrapper.
|
| 108 |
+
"""
|
| 109 |
+
|
| 110 |
+
@abc.abstractproperty
|
| 111 |
+
def name(self) -> str:
|
| 112 |
+
"""
|
| 113 |
+
The base name of this object without any parent references.
|
| 114 |
+
"""
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class TraversableResources(ResourceReader):
|
| 118 |
+
"""
|
| 119 |
+
The required interface for providing traversable
|
| 120 |
+
resources.
|
| 121 |
+
"""
|
| 122 |
+
|
| 123 |
+
@abc.abstractmethod
|
| 124 |
+
def files(self):
|
| 125 |
+
"""Return a Traversable object for the loaded package."""
|
| 126 |
+
|
| 127 |
+
def open_resource(self, resource):
|
| 128 |
+
return self.files().joinpath(resource).open('rb')
|
| 129 |
+
|
| 130 |
+
def resource_path(self, resource):
|
| 131 |
+
raise FileNotFoundError(resource)
|
| 132 |
+
|
| 133 |
+
def is_resource(self, path):
|
| 134 |
+
return self.files().joinpath(path).is_file()
|
| 135 |
+
|
| 136 |
+
def contents(self):
|
| 137 |
+
return (item.name for item in self.files().iterdir())
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/readers.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import collections
|
| 2 |
+
import pathlib
|
| 3 |
+
import operator
|
| 4 |
+
|
| 5 |
+
from . import abc
|
| 6 |
+
|
| 7 |
+
from ._itertools import unique_everseen
|
| 8 |
+
from ._compat import ZipPath
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def remove_duplicates(items):
|
| 12 |
+
return iter(collections.OrderedDict.fromkeys(items))
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class FileReader(abc.TraversableResources):
|
| 16 |
+
def __init__(self, loader):
|
| 17 |
+
self.path = pathlib.Path(loader.path).parent
|
| 18 |
+
|
| 19 |
+
def resource_path(self, resource):
|
| 20 |
+
"""
|
| 21 |
+
Return the file system path to prevent
|
| 22 |
+
`resources.path()` from creating a temporary
|
| 23 |
+
copy.
|
| 24 |
+
"""
|
| 25 |
+
return str(self.path.joinpath(resource))
|
| 26 |
+
|
| 27 |
+
def files(self):
|
| 28 |
+
return self.path
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class ZipReader(abc.TraversableResources):
|
| 32 |
+
def __init__(self, loader, module):
|
| 33 |
+
_, _, name = module.rpartition('.')
|
| 34 |
+
self.prefix = loader.prefix.replace('\\', '/') + name + '/'
|
| 35 |
+
self.archive = loader.archive
|
| 36 |
+
|
| 37 |
+
def open_resource(self, resource):
|
| 38 |
+
try:
|
| 39 |
+
return super().open_resource(resource)
|
| 40 |
+
except KeyError as exc:
|
| 41 |
+
raise FileNotFoundError(exc.args[0])
|
| 42 |
+
|
| 43 |
+
def is_resource(self, path):
|
| 44 |
+
# workaround for `zipfile.Path.is_file` returning true
|
| 45 |
+
# for non-existent paths.
|
| 46 |
+
target = self.files().joinpath(path)
|
| 47 |
+
return target.is_file() and target.exists()
|
| 48 |
+
|
| 49 |
+
def files(self):
|
| 50 |
+
return ZipPath(self.archive, self.prefix)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class MultiplexedPath(abc.Traversable):
|
| 54 |
+
"""
|
| 55 |
+
Given a series of Traversable objects, implement a merged
|
| 56 |
+
version of the interface across all objects. Useful for
|
| 57 |
+
namespace packages which may be multihomed at a single
|
| 58 |
+
name.
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
def __init__(self, *paths):
|
| 62 |
+
self._paths = list(map(pathlib.Path, remove_duplicates(paths)))
|
| 63 |
+
if not self._paths:
|
| 64 |
+
message = 'MultiplexedPath must contain at least one path'
|
| 65 |
+
raise FileNotFoundError(message)
|
| 66 |
+
if not all(path.is_dir() for path in self._paths):
|
| 67 |
+
raise NotADirectoryError('MultiplexedPath only supports directories')
|
| 68 |
+
|
| 69 |
+
def iterdir(self):
|
| 70 |
+
files = (file for path in self._paths for file in path.iterdir())
|
| 71 |
+
return unique_everseen(files, key=operator.attrgetter('name'))
|
| 72 |
+
|
| 73 |
+
def read_bytes(self):
|
| 74 |
+
raise FileNotFoundError(f'{self} is not a file')
|
| 75 |
+
|
| 76 |
+
def read_text(self, *args, **kwargs):
|
| 77 |
+
raise FileNotFoundError(f'{self} is not a file')
|
| 78 |
+
|
| 79 |
+
def is_dir(self):
|
| 80 |
+
return True
|
| 81 |
+
|
| 82 |
+
def is_file(self):
|
| 83 |
+
return False
|
| 84 |
+
|
| 85 |
+
def joinpath(self, child):
|
| 86 |
+
# first try to find child in current paths
|
| 87 |
+
for file in self.iterdir():
|
| 88 |
+
if file.name == child:
|
| 89 |
+
return file
|
| 90 |
+
# if it does not exist, construct it with the first path
|
| 91 |
+
return self._paths[0] / child
|
| 92 |
+
|
| 93 |
+
__truediv__ = joinpath
|
| 94 |
+
|
| 95 |
+
def open(self, *args, **kwargs):
|
| 96 |
+
raise FileNotFoundError(f'{self} is not a file')
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def name(self):
|
| 100 |
+
return self._paths[0].name
|
| 101 |
+
|
| 102 |
+
def __repr__(self):
|
| 103 |
+
paths = ', '.join(f"'{path}'" for path in self._paths)
|
| 104 |
+
return f'MultiplexedPath({paths})'
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class NamespaceReader(abc.TraversableResources):
|
| 108 |
+
def __init__(self, namespace_path):
|
| 109 |
+
if 'NamespacePath' not in str(namespace_path):
|
| 110 |
+
raise ValueError('Invalid path')
|
| 111 |
+
self.path = MultiplexedPath(*list(namespace_path))
|
| 112 |
+
|
| 113 |
+
def resource_path(self, resource):
|
| 114 |
+
"""
|
| 115 |
+
Return the file system path to prevent
|
| 116 |
+
`resources.path()` from creating a temporary
|
| 117 |
+
copy.
|
| 118 |
+
"""
|
| 119 |
+
return str(self.path.joinpath(resource))
|
| 120 |
+
|
| 121 |
+
def files(self):
|
| 122 |
+
return self.path
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/importlib_resources/simple.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Interface adapters for low-level readers.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import abc
|
| 6 |
+
import io
|
| 7 |
+
import itertools
|
| 8 |
+
from typing import BinaryIO, List
|
| 9 |
+
|
| 10 |
+
from .abc import Traversable, TraversableResources
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class SimpleReader(abc.ABC):
|
| 14 |
+
"""
|
| 15 |
+
The minimum, low-level interface required from a resource
|
| 16 |
+
provider.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
@abc.abstractproperty
|
| 20 |
+
def package(self):
|
| 21 |
+
# type: () -> str
|
| 22 |
+
"""
|
| 23 |
+
The name of the package for which this reader loads resources.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
@abc.abstractmethod
|
| 27 |
+
def children(self):
|
| 28 |
+
# type: () -> List['SimpleReader']
|
| 29 |
+
"""
|
| 30 |
+
Obtain an iterable of SimpleReader for available
|
| 31 |
+
child containers (e.g. directories).
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
@abc.abstractmethod
|
| 35 |
+
def resources(self):
|
| 36 |
+
# type: () -> List[str]
|
| 37 |
+
"""
|
| 38 |
+
Obtain available named resources for this virtual package.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
@abc.abstractmethod
|
| 42 |
+
def open_binary(self, resource):
|
| 43 |
+
# type: (str) -> BinaryIO
|
| 44 |
+
"""
|
| 45 |
+
Obtain a File-like for a named resource.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def name(self):
|
| 50 |
+
return self.package.split('.')[-1]
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class ResourceHandle(Traversable):
|
| 54 |
+
"""
|
| 55 |
+
Handle to a named resource in a ResourceReader.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
def __init__(self, parent, name):
|
| 59 |
+
# type: (ResourceContainer, str) -> None
|
| 60 |
+
self.parent = parent
|
| 61 |
+
self.name = name # type: ignore
|
| 62 |
+
|
| 63 |
+
def is_file(self):
|
| 64 |
+
return True
|
| 65 |
+
|
| 66 |
+
def is_dir(self):
|
| 67 |
+
return False
|
| 68 |
+
|
| 69 |
+
def open(self, mode='r', *args, **kwargs):
|
| 70 |
+
stream = self.parent.reader.open_binary(self.name)
|
| 71 |
+
if 'b' not in mode:
|
| 72 |
+
stream = io.TextIOWrapper(*args, **kwargs)
|
| 73 |
+
return stream
|
| 74 |
+
|
| 75 |
+
def joinpath(self, name):
|
| 76 |
+
raise RuntimeError("Cannot traverse into a resource")
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
class ResourceContainer(Traversable):
|
| 80 |
+
"""
|
| 81 |
+
Traversable container for a package's resources via its reader.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
def __init__(self, reader):
|
| 85 |
+
# type: (SimpleReader) -> None
|
| 86 |
+
self.reader = reader
|
| 87 |
+
|
| 88 |
+
def is_dir(self):
|
| 89 |
+
return True
|
| 90 |
+
|
| 91 |
+
def is_file(self):
|
| 92 |
+
return False
|
| 93 |
+
|
| 94 |
+
def iterdir(self):
|
| 95 |
+
files = (ResourceHandle(self, name) for name in self.reader.resources)
|
| 96 |
+
dirs = map(ResourceContainer, self.reader.children())
|
| 97 |
+
return itertools.chain(files, dirs)
|
| 98 |
+
|
| 99 |
+
def open(self, *args, **kwargs):
|
| 100 |
+
raise IsADirectoryError()
|
| 101 |
+
|
| 102 |
+
def joinpath(self, name):
|
| 103 |
+
return next(
|
| 104 |
+
traversable for traversable in self.iterdir() if traversable.name == name
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class TraversableReader(TraversableResources, SimpleReader):
|
| 109 |
+
"""
|
| 110 |
+
A TraversableResources based on SimpleReader. Resource providers
|
| 111 |
+
may derive from this class to provide the TraversableResources
|
| 112 |
+
interface by supplying the SimpleReader interface.
|
| 113 |
+
"""
|
| 114 |
+
|
| 115 |
+
def files(self):
|
| 116 |
+
return ResourceContainer(self)
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__init__.py
ADDED
|
File without changes
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (201 Bytes). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/context.cpython-311.pyc
ADDED
|
Binary file (9.42 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/__pycache__/functools.cpython-311.pyc
ADDED
|
Binary file (20.3 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/context.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import contextlib
|
| 4 |
+
import functools
|
| 5 |
+
import tempfile
|
| 6 |
+
import shutil
|
| 7 |
+
import operator
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@contextlib.contextmanager
|
| 11 |
+
def pushd(dir):
|
| 12 |
+
orig = os.getcwd()
|
| 13 |
+
os.chdir(dir)
|
| 14 |
+
try:
|
| 15 |
+
yield dir
|
| 16 |
+
finally:
|
| 17 |
+
os.chdir(orig)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@contextlib.contextmanager
|
| 21 |
+
def tarball_context(url, target_dir=None, runner=None, pushd=pushd):
|
| 22 |
+
"""
|
| 23 |
+
Get a tarball, extract it, change to that directory, yield, then
|
| 24 |
+
clean up.
|
| 25 |
+
`runner` is the function to invoke commands.
|
| 26 |
+
`pushd` is a context manager for changing the directory.
|
| 27 |
+
"""
|
| 28 |
+
if target_dir is None:
|
| 29 |
+
target_dir = os.path.basename(url).replace('.tar.gz', '').replace('.tgz', '')
|
| 30 |
+
if runner is None:
|
| 31 |
+
runner = functools.partial(subprocess.check_call, shell=True)
|
| 32 |
+
# In the tar command, use --strip-components=1 to strip the first path and
|
| 33 |
+
# then
|
| 34 |
+
# use -C to cause the files to be extracted to {target_dir}. This ensures
|
| 35 |
+
# that we always know where the files were extracted.
|
| 36 |
+
runner('mkdir {target_dir}'.format(**vars()))
|
| 37 |
+
try:
|
| 38 |
+
getter = 'wget {url} -O -'
|
| 39 |
+
extract = 'tar x{compression} --strip-components=1 -C {target_dir}'
|
| 40 |
+
cmd = ' | '.join((getter, extract))
|
| 41 |
+
runner(cmd.format(compression=infer_compression(url), **vars()))
|
| 42 |
+
with pushd(target_dir):
|
| 43 |
+
yield target_dir
|
| 44 |
+
finally:
|
| 45 |
+
runner('rm -Rf {target_dir}'.format(**vars()))
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def infer_compression(url):
|
| 49 |
+
"""
|
| 50 |
+
Given a URL or filename, infer the compression code for tar.
|
| 51 |
+
"""
|
| 52 |
+
# cheat and just assume it's the last two characters
|
| 53 |
+
compression_indicator = url[-2:]
|
| 54 |
+
mapping = dict(gz='z', bz='j', xz='J')
|
| 55 |
+
# Assume 'z' (gzip) if no match
|
| 56 |
+
return mapping.get(compression_indicator, 'z')
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@contextlib.contextmanager
|
| 60 |
+
def temp_dir(remover=shutil.rmtree):
|
| 61 |
+
"""
|
| 62 |
+
Create a temporary directory context. Pass a custom remover
|
| 63 |
+
to override the removal behavior.
|
| 64 |
+
"""
|
| 65 |
+
temp_dir = tempfile.mkdtemp()
|
| 66 |
+
try:
|
| 67 |
+
yield temp_dir
|
| 68 |
+
finally:
|
| 69 |
+
remover(temp_dir)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
@contextlib.contextmanager
|
| 73 |
+
def repo_context(url, branch=None, quiet=True, dest_ctx=temp_dir):
|
| 74 |
+
"""
|
| 75 |
+
Check out the repo indicated by url.
|
| 76 |
+
|
| 77 |
+
If dest_ctx is supplied, it should be a context manager
|
| 78 |
+
to yield the target directory for the check out.
|
| 79 |
+
"""
|
| 80 |
+
exe = 'git' if 'git' in url else 'hg'
|
| 81 |
+
with dest_ctx() as repo_dir:
|
| 82 |
+
cmd = [exe, 'clone', url, repo_dir]
|
| 83 |
+
if branch:
|
| 84 |
+
cmd.extend(['--branch', branch])
|
| 85 |
+
devnull = open(os.path.devnull, 'w')
|
| 86 |
+
stdout = devnull if quiet else None
|
| 87 |
+
subprocess.check_call(cmd, stdout=stdout)
|
| 88 |
+
yield repo_dir
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
@contextlib.contextmanager
|
| 92 |
+
def null():
|
| 93 |
+
yield
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class ExceptionTrap:
|
| 97 |
+
"""
|
| 98 |
+
A context manager that will catch certain exceptions and provide an
|
| 99 |
+
indication they occurred.
|
| 100 |
+
|
| 101 |
+
>>> with ExceptionTrap() as trap:
|
| 102 |
+
... raise Exception()
|
| 103 |
+
>>> bool(trap)
|
| 104 |
+
True
|
| 105 |
+
|
| 106 |
+
>>> with ExceptionTrap() as trap:
|
| 107 |
+
... pass
|
| 108 |
+
>>> bool(trap)
|
| 109 |
+
False
|
| 110 |
+
|
| 111 |
+
>>> with ExceptionTrap(ValueError) as trap:
|
| 112 |
+
... raise ValueError("1 + 1 is not 3")
|
| 113 |
+
>>> bool(trap)
|
| 114 |
+
True
|
| 115 |
+
|
| 116 |
+
>>> with ExceptionTrap(ValueError) as trap:
|
| 117 |
+
... raise Exception()
|
| 118 |
+
Traceback (most recent call last):
|
| 119 |
+
...
|
| 120 |
+
Exception
|
| 121 |
+
|
| 122 |
+
>>> bool(trap)
|
| 123 |
+
False
|
| 124 |
+
"""
|
| 125 |
+
|
| 126 |
+
exc_info = None, None, None
|
| 127 |
+
|
| 128 |
+
def __init__(self, exceptions=(Exception,)):
|
| 129 |
+
self.exceptions = exceptions
|
| 130 |
+
|
| 131 |
+
def __enter__(self):
|
| 132 |
+
return self
|
| 133 |
+
|
| 134 |
+
@property
|
| 135 |
+
def type(self):
|
| 136 |
+
return self.exc_info[0]
|
| 137 |
+
|
| 138 |
+
@property
|
| 139 |
+
def value(self):
|
| 140 |
+
return self.exc_info[1]
|
| 141 |
+
|
| 142 |
+
@property
|
| 143 |
+
def tb(self):
|
| 144 |
+
return self.exc_info[2]
|
| 145 |
+
|
| 146 |
+
def __exit__(self, *exc_info):
|
| 147 |
+
type = exc_info[0]
|
| 148 |
+
matches = type and issubclass(type, self.exceptions)
|
| 149 |
+
if matches:
|
| 150 |
+
self.exc_info = exc_info
|
| 151 |
+
return matches
|
| 152 |
+
|
| 153 |
+
def __bool__(self):
|
| 154 |
+
return bool(self.type)
|
| 155 |
+
|
| 156 |
+
def raises(self, func, *, _test=bool):
|
| 157 |
+
"""
|
| 158 |
+
Wrap func and replace the result with the truth
|
| 159 |
+
value of the trap (True if an exception occurred).
|
| 160 |
+
|
| 161 |
+
First, give the decorator an alias to support Python 3.8
|
| 162 |
+
Syntax.
|
| 163 |
+
|
| 164 |
+
>>> raises = ExceptionTrap(ValueError).raises
|
| 165 |
+
|
| 166 |
+
Now decorate a function that always fails.
|
| 167 |
+
|
| 168 |
+
>>> @raises
|
| 169 |
+
... def fail():
|
| 170 |
+
... raise ValueError('failed')
|
| 171 |
+
>>> fail()
|
| 172 |
+
True
|
| 173 |
+
"""
|
| 174 |
+
|
| 175 |
+
@functools.wraps(func)
|
| 176 |
+
def wrapper(*args, **kwargs):
|
| 177 |
+
with ExceptionTrap(self.exceptions) as trap:
|
| 178 |
+
func(*args, **kwargs)
|
| 179 |
+
return _test(trap)
|
| 180 |
+
|
| 181 |
+
return wrapper
|
| 182 |
+
|
| 183 |
+
def passes(self, func):
|
| 184 |
+
"""
|
| 185 |
+
Wrap func and replace the result with the truth
|
| 186 |
+
value of the trap (True if no exception).
|
| 187 |
+
|
| 188 |
+
First, give the decorator an alias to support Python 3.8
|
| 189 |
+
Syntax.
|
| 190 |
+
|
| 191 |
+
>>> passes = ExceptionTrap(ValueError).passes
|
| 192 |
+
|
| 193 |
+
Now decorate a function that always fails.
|
| 194 |
+
|
| 195 |
+
>>> @passes
|
| 196 |
+
... def fail():
|
| 197 |
+
... raise ValueError('failed')
|
| 198 |
+
|
| 199 |
+
>>> fail()
|
| 200 |
+
False
|
| 201 |
+
"""
|
| 202 |
+
return self.raises(func, _test=operator.not_)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
class suppress(contextlib.suppress, contextlib.ContextDecorator):
|
| 206 |
+
"""
|
| 207 |
+
A version of contextlib.suppress with decorator support.
|
| 208 |
+
|
| 209 |
+
>>> @suppress(KeyError)
|
| 210 |
+
... def key_error():
|
| 211 |
+
... {}['']
|
| 212 |
+
>>> key_error()
|
| 213 |
+
"""
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/functools.py
ADDED
|
@@ -0,0 +1,525 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import time
|
| 3 |
+
import inspect
|
| 4 |
+
import collections
|
| 5 |
+
import types
|
| 6 |
+
import itertools
|
| 7 |
+
|
| 8 |
+
import pkg_resources.extern.more_itertools
|
| 9 |
+
|
| 10 |
+
from typing import Callable, TypeVar
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
CallableT = TypeVar("CallableT", bound=Callable[..., object])
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def compose(*funcs):
|
| 17 |
+
"""
|
| 18 |
+
Compose any number of unary functions into a single unary function.
|
| 19 |
+
|
| 20 |
+
>>> import textwrap
|
| 21 |
+
>>> expected = str.strip(textwrap.dedent(compose.__doc__))
|
| 22 |
+
>>> strip_and_dedent = compose(str.strip, textwrap.dedent)
|
| 23 |
+
>>> strip_and_dedent(compose.__doc__) == expected
|
| 24 |
+
True
|
| 25 |
+
|
| 26 |
+
Compose also allows the innermost function to take arbitrary arguments.
|
| 27 |
+
|
| 28 |
+
>>> round_three = lambda x: round(x, ndigits=3)
|
| 29 |
+
>>> f = compose(round_three, int.__truediv__)
|
| 30 |
+
>>> [f(3*x, x+1) for x in range(1,10)]
|
| 31 |
+
[1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
def compose_two(f1, f2):
|
| 35 |
+
return lambda *args, **kwargs: f1(f2(*args, **kwargs))
|
| 36 |
+
|
| 37 |
+
return functools.reduce(compose_two, funcs)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def method_caller(method_name, *args, **kwargs):
|
| 41 |
+
"""
|
| 42 |
+
Return a function that will call a named method on the
|
| 43 |
+
target object with optional positional and keyword
|
| 44 |
+
arguments.
|
| 45 |
+
|
| 46 |
+
>>> lower = method_caller('lower')
|
| 47 |
+
>>> lower('MyString')
|
| 48 |
+
'mystring'
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
def call_method(target):
|
| 52 |
+
func = getattr(target, method_name)
|
| 53 |
+
return func(*args, **kwargs)
|
| 54 |
+
|
| 55 |
+
return call_method
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def once(func):
|
| 59 |
+
"""
|
| 60 |
+
Decorate func so it's only ever called the first time.
|
| 61 |
+
|
| 62 |
+
This decorator can ensure that an expensive or non-idempotent function
|
| 63 |
+
will not be expensive on subsequent calls and is idempotent.
|
| 64 |
+
|
| 65 |
+
>>> add_three = once(lambda a: a+3)
|
| 66 |
+
>>> add_three(3)
|
| 67 |
+
6
|
| 68 |
+
>>> add_three(9)
|
| 69 |
+
6
|
| 70 |
+
>>> add_three('12')
|
| 71 |
+
6
|
| 72 |
+
|
| 73 |
+
To reset the stored value, simply clear the property ``saved_result``.
|
| 74 |
+
|
| 75 |
+
>>> del add_three.saved_result
|
| 76 |
+
>>> add_three(9)
|
| 77 |
+
12
|
| 78 |
+
>>> add_three(8)
|
| 79 |
+
12
|
| 80 |
+
|
| 81 |
+
Or invoke 'reset()' on it.
|
| 82 |
+
|
| 83 |
+
>>> add_three.reset()
|
| 84 |
+
>>> add_three(-3)
|
| 85 |
+
0
|
| 86 |
+
>>> add_three(0)
|
| 87 |
+
0
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
@functools.wraps(func)
|
| 91 |
+
def wrapper(*args, **kwargs):
|
| 92 |
+
if not hasattr(wrapper, 'saved_result'):
|
| 93 |
+
wrapper.saved_result = func(*args, **kwargs)
|
| 94 |
+
return wrapper.saved_result
|
| 95 |
+
|
| 96 |
+
wrapper.reset = lambda: vars(wrapper).__delitem__('saved_result')
|
| 97 |
+
return wrapper
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def method_cache(
|
| 101 |
+
method: CallableT,
|
| 102 |
+
cache_wrapper: Callable[
|
| 103 |
+
[CallableT], CallableT
|
| 104 |
+
] = functools.lru_cache(), # type: ignore[assignment]
|
| 105 |
+
) -> CallableT:
|
| 106 |
+
"""
|
| 107 |
+
Wrap lru_cache to support storing the cache data in the object instances.
|
| 108 |
+
|
| 109 |
+
Abstracts the common paradigm where the method explicitly saves an
|
| 110 |
+
underscore-prefixed protected property on first call and returns that
|
| 111 |
+
subsequently.
|
| 112 |
+
|
| 113 |
+
>>> class MyClass:
|
| 114 |
+
... calls = 0
|
| 115 |
+
...
|
| 116 |
+
... @method_cache
|
| 117 |
+
... def method(self, value):
|
| 118 |
+
... self.calls += 1
|
| 119 |
+
... return value
|
| 120 |
+
|
| 121 |
+
>>> a = MyClass()
|
| 122 |
+
>>> a.method(3)
|
| 123 |
+
3
|
| 124 |
+
>>> for x in range(75):
|
| 125 |
+
... res = a.method(x)
|
| 126 |
+
>>> a.calls
|
| 127 |
+
75
|
| 128 |
+
|
| 129 |
+
Note that the apparent behavior will be exactly like that of lru_cache
|
| 130 |
+
except that the cache is stored on each instance, so values in one
|
| 131 |
+
instance will not flush values from another, and when an instance is
|
| 132 |
+
deleted, so are the cached values for that instance.
|
| 133 |
+
|
| 134 |
+
>>> b = MyClass()
|
| 135 |
+
>>> for x in range(35):
|
| 136 |
+
... res = b.method(x)
|
| 137 |
+
>>> b.calls
|
| 138 |
+
35
|
| 139 |
+
>>> a.method(0)
|
| 140 |
+
0
|
| 141 |
+
>>> a.calls
|
| 142 |
+
75
|
| 143 |
+
|
| 144 |
+
Note that if method had been decorated with ``functools.lru_cache()``,
|
| 145 |
+
a.calls would have been 76 (due to the cached value of 0 having been
|
| 146 |
+
flushed by the 'b' instance).
|
| 147 |
+
|
| 148 |
+
Clear the cache with ``.cache_clear()``
|
| 149 |
+
|
| 150 |
+
>>> a.method.cache_clear()
|
| 151 |
+
|
| 152 |
+
Same for a method that hasn't yet been called.
|
| 153 |
+
|
| 154 |
+
>>> c = MyClass()
|
| 155 |
+
>>> c.method.cache_clear()
|
| 156 |
+
|
| 157 |
+
Another cache wrapper may be supplied:
|
| 158 |
+
|
| 159 |
+
>>> cache = functools.lru_cache(maxsize=2)
|
| 160 |
+
>>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
|
| 161 |
+
>>> a = MyClass()
|
| 162 |
+
>>> a.method2()
|
| 163 |
+
3
|
| 164 |
+
|
| 165 |
+
Caution - do not subsequently wrap the method with another decorator, such
|
| 166 |
+
as ``@property``, which changes the semantics of the function.
|
| 167 |
+
|
| 168 |
+
See also
|
| 169 |
+
http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
|
| 170 |
+
for another implementation and additional justification.
|
| 171 |
+
"""
|
| 172 |
+
|
| 173 |
+
def wrapper(self: object, *args: object, **kwargs: object) -> object:
|
| 174 |
+
# it's the first call, replace the method with a cached, bound method
|
| 175 |
+
bound_method: CallableT = types.MethodType( # type: ignore[assignment]
|
| 176 |
+
method, self
|
| 177 |
+
)
|
| 178 |
+
cached_method = cache_wrapper(bound_method)
|
| 179 |
+
setattr(self, method.__name__, cached_method)
|
| 180 |
+
return cached_method(*args, **kwargs)
|
| 181 |
+
|
| 182 |
+
# Support cache clear even before cache has been created.
|
| 183 |
+
wrapper.cache_clear = lambda: None # type: ignore[attr-defined]
|
| 184 |
+
|
| 185 |
+
return ( # type: ignore[return-value]
|
| 186 |
+
_special_method_cache(method, cache_wrapper) or wrapper
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
def _special_method_cache(method, cache_wrapper):
|
| 191 |
+
"""
|
| 192 |
+
Because Python treats special methods differently, it's not
|
| 193 |
+
possible to use instance attributes to implement the cached
|
| 194 |
+
methods.
|
| 195 |
+
|
| 196 |
+
Instead, install the wrapper method under a different name
|
| 197 |
+
and return a simple proxy to that wrapper.
|
| 198 |
+
|
| 199 |
+
https://github.com/jaraco/jaraco.functools/issues/5
|
| 200 |
+
"""
|
| 201 |
+
name = method.__name__
|
| 202 |
+
special_names = '__getattr__', '__getitem__'
|
| 203 |
+
if name not in special_names:
|
| 204 |
+
return
|
| 205 |
+
|
| 206 |
+
wrapper_name = '__cached' + name
|
| 207 |
+
|
| 208 |
+
def proxy(self, *args, **kwargs):
|
| 209 |
+
if wrapper_name not in vars(self):
|
| 210 |
+
bound = types.MethodType(method, self)
|
| 211 |
+
cache = cache_wrapper(bound)
|
| 212 |
+
setattr(self, wrapper_name, cache)
|
| 213 |
+
else:
|
| 214 |
+
cache = getattr(self, wrapper_name)
|
| 215 |
+
return cache(*args, **kwargs)
|
| 216 |
+
|
| 217 |
+
return proxy
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
def apply(transform):
|
| 221 |
+
"""
|
| 222 |
+
Decorate a function with a transform function that is
|
| 223 |
+
invoked on results returned from the decorated function.
|
| 224 |
+
|
| 225 |
+
>>> @apply(reversed)
|
| 226 |
+
... def get_numbers(start):
|
| 227 |
+
... "doc for get_numbers"
|
| 228 |
+
... return range(start, start+3)
|
| 229 |
+
>>> list(get_numbers(4))
|
| 230 |
+
[6, 5, 4]
|
| 231 |
+
>>> get_numbers.__doc__
|
| 232 |
+
'doc for get_numbers'
|
| 233 |
+
"""
|
| 234 |
+
|
| 235 |
+
def wrap(func):
|
| 236 |
+
return functools.wraps(func)(compose(transform, func))
|
| 237 |
+
|
| 238 |
+
return wrap
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def result_invoke(action):
|
| 242 |
+
r"""
|
| 243 |
+
Decorate a function with an action function that is
|
| 244 |
+
invoked on the results returned from the decorated
|
| 245 |
+
function (for its side-effect), then return the original
|
| 246 |
+
result.
|
| 247 |
+
|
| 248 |
+
>>> @result_invoke(print)
|
| 249 |
+
... def add_two(a, b):
|
| 250 |
+
... return a + b
|
| 251 |
+
>>> x = add_two(2, 3)
|
| 252 |
+
5
|
| 253 |
+
>>> x
|
| 254 |
+
5
|
| 255 |
+
"""
|
| 256 |
+
|
| 257 |
+
def wrap(func):
|
| 258 |
+
@functools.wraps(func)
|
| 259 |
+
def wrapper(*args, **kwargs):
|
| 260 |
+
result = func(*args, **kwargs)
|
| 261 |
+
action(result)
|
| 262 |
+
return result
|
| 263 |
+
|
| 264 |
+
return wrapper
|
| 265 |
+
|
| 266 |
+
return wrap
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def call_aside(f, *args, **kwargs):
|
| 270 |
+
"""
|
| 271 |
+
Call a function for its side effect after initialization.
|
| 272 |
+
|
| 273 |
+
>>> @call_aside
|
| 274 |
+
... def func(): print("called")
|
| 275 |
+
called
|
| 276 |
+
>>> func()
|
| 277 |
+
called
|
| 278 |
+
|
| 279 |
+
Use functools.partial to pass parameters to the initial call
|
| 280 |
+
|
| 281 |
+
>>> @functools.partial(call_aside, name='bingo')
|
| 282 |
+
... def func(name): print("called with", name)
|
| 283 |
+
called with bingo
|
| 284 |
+
"""
|
| 285 |
+
f(*args, **kwargs)
|
| 286 |
+
return f
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
class Throttler:
|
| 290 |
+
"""
|
| 291 |
+
Rate-limit a function (or other callable)
|
| 292 |
+
"""
|
| 293 |
+
|
| 294 |
+
def __init__(self, func, max_rate=float('Inf')):
|
| 295 |
+
if isinstance(func, Throttler):
|
| 296 |
+
func = func.func
|
| 297 |
+
self.func = func
|
| 298 |
+
self.max_rate = max_rate
|
| 299 |
+
self.reset()
|
| 300 |
+
|
| 301 |
+
def reset(self):
|
| 302 |
+
self.last_called = 0
|
| 303 |
+
|
| 304 |
+
def __call__(self, *args, **kwargs):
|
| 305 |
+
self._wait()
|
| 306 |
+
return self.func(*args, **kwargs)
|
| 307 |
+
|
| 308 |
+
def _wait(self):
|
| 309 |
+
"ensure at least 1/max_rate seconds from last call"
|
| 310 |
+
elapsed = time.time() - self.last_called
|
| 311 |
+
must_wait = 1 / self.max_rate - elapsed
|
| 312 |
+
time.sleep(max(0, must_wait))
|
| 313 |
+
self.last_called = time.time()
|
| 314 |
+
|
| 315 |
+
def __get__(self, obj, type=None):
|
| 316 |
+
return first_invoke(self._wait, functools.partial(self.func, obj))
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
def first_invoke(func1, func2):
|
| 320 |
+
"""
|
| 321 |
+
Return a function that when invoked will invoke func1 without
|
| 322 |
+
any parameters (for its side-effect) and then invoke func2
|
| 323 |
+
with whatever parameters were passed, returning its result.
|
| 324 |
+
"""
|
| 325 |
+
|
| 326 |
+
def wrapper(*args, **kwargs):
|
| 327 |
+
func1()
|
| 328 |
+
return func2(*args, **kwargs)
|
| 329 |
+
|
| 330 |
+
return wrapper
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
|
| 334 |
+
"""
|
| 335 |
+
Given a callable func, trap the indicated exceptions
|
| 336 |
+
for up to 'retries' times, invoking cleanup on the
|
| 337 |
+
exception. On the final attempt, allow any exceptions
|
| 338 |
+
to propagate.
|
| 339 |
+
"""
|
| 340 |
+
attempts = itertools.count() if retries == float('inf') else range(retries)
|
| 341 |
+
for attempt in attempts:
|
| 342 |
+
try:
|
| 343 |
+
return func()
|
| 344 |
+
except trap:
|
| 345 |
+
cleanup()
|
| 346 |
+
|
| 347 |
+
return func()
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def retry(*r_args, **r_kwargs):
|
| 351 |
+
"""
|
| 352 |
+
Decorator wrapper for retry_call. Accepts arguments to retry_call
|
| 353 |
+
except func and then returns a decorator for the decorated function.
|
| 354 |
+
|
| 355 |
+
Ex:
|
| 356 |
+
|
| 357 |
+
>>> @retry(retries=3)
|
| 358 |
+
... def my_func(a, b):
|
| 359 |
+
... "this is my funk"
|
| 360 |
+
... print(a, b)
|
| 361 |
+
>>> my_func.__doc__
|
| 362 |
+
'this is my funk'
|
| 363 |
+
"""
|
| 364 |
+
|
| 365 |
+
def decorate(func):
|
| 366 |
+
@functools.wraps(func)
|
| 367 |
+
def wrapper(*f_args, **f_kwargs):
|
| 368 |
+
bound = functools.partial(func, *f_args, **f_kwargs)
|
| 369 |
+
return retry_call(bound, *r_args, **r_kwargs)
|
| 370 |
+
|
| 371 |
+
return wrapper
|
| 372 |
+
|
| 373 |
+
return decorate
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
def print_yielded(func):
|
| 377 |
+
"""
|
| 378 |
+
Convert a generator into a function that prints all yielded elements
|
| 379 |
+
|
| 380 |
+
>>> @print_yielded
|
| 381 |
+
... def x():
|
| 382 |
+
... yield 3; yield None
|
| 383 |
+
>>> x()
|
| 384 |
+
3
|
| 385 |
+
None
|
| 386 |
+
"""
|
| 387 |
+
print_all = functools.partial(map, print)
|
| 388 |
+
print_results = compose(more_itertools.consume, print_all, func)
|
| 389 |
+
return functools.wraps(func)(print_results)
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
def pass_none(func):
|
| 393 |
+
"""
|
| 394 |
+
Wrap func so it's not called if its first param is None
|
| 395 |
+
|
| 396 |
+
>>> print_text = pass_none(print)
|
| 397 |
+
>>> print_text('text')
|
| 398 |
+
text
|
| 399 |
+
>>> print_text(None)
|
| 400 |
+
"""
|
| 401 |
+
|
| 402 |
+
@functools.wraps(func)
|
| 403 |
+
def wrapper(param, *args, **kwargs):
|
| 404 |
+
if param is not None:
|
| 405 |
+
return func(param, *args, **kwargs)
|
| 406 |
+
|
| 407 |
+
return wrapper
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
def assign_params(func, namespace):
|
| 411 |
+
"""
|
| 412 |
+
Assign parameters from namespace where func solicits.
|
| 413 |
+
|
| 414 |
+
>>> def func(x, y=3):
|
| 415 |
+
... print(x, y)
|
| 416 |
+
>>> assigned = assign_params(func, dict(x=2, z=4))
|
| 417 |
+
>>> assigned()
|
| 418 |
+
2 3
|
| 419 |
+
|
| 420 |
+
The usual errors are raised if a function doesn't receive
|
| 421 |
+
its required parameters:
|
| 422 |
+
|
| 423 |
+
>>> assigned = assign_params(func, dict(y=3, z=4))
|
| 424 |
+
>>> assigned()
|
| 425 |
+
Traceback (most recent call last):
|
| 426 |
+
TypeError: func() ...argument...
|
| 427 |
+
|
| 428 |
+
It even works on methods:
|
| 429 |
+
|
| 430 |
+
>>> class Handler:
|
| 431 |
+
... def meth(self, arg):
|
| 432 |
+
... print(arg)
|
| 433 |
+
>>> assign_params(Handler().meth, dict(arg='crystal', foo='clear'))()
|
| 434 |
+
crystal
|
| 435 |
+
"""
|
| 436 |
+
sig = inspect.signature(func)
|
| 437 |
+
params = sig.parameters.keys()
|
| 438 |
+
call_ns = {k: namespace[k] for k in params if k in namespace}
|
| 439 |
+
return functools.partial(func, **call_ns)
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
def save_method_args(method):
|
| 443 |
+
"""
|
| 444 |
+
Wrap a method such that when it is called, the args and kwargs are
|
| 445 |
+
saved on the method.
|
| 446 |
+
|
| 447 |
+
>>> class MyClass:
|
| 448 |
+
... @save_method_args
|
| 449 |
+
... def method(self, a, b):
|
| 450 |
+
... print(a, b)
|
| 451 |
+
>>> my_ob = MyClass()
|
| 452 |
+
>>> my_ob.method(1, 2)
|
| 453 |
+
1 2
|
| 454 |
+
>>> my_ob._saved_method.args
|
| 455 |
+
(1, 2)
|
| 456 |
+
>>> my_ob._saved_method.kwargs
|
| 457 |
+
{}
|
| 458 |
+
>>> my_ob.method(a=3, b='foo')
|
| 459 |
+
3 foo
|
| 460 |
+
>>> my_ob._saved_method.args
|
| 461 |
+
()
|
| 462 |
+
>>> my_ob._saved_method.kwargs == dict(a=3, b='foo')
|
| 463 |
+
True
|
| 464 |
+
|
| 465 |
+
The arguments are stored on the instance, allowing for
|
| 466 |
+
different instance to save different args.
|
| 467 |
+
|
| 468 |
+
>>> your_ob = MyClass()
|
| 469 |
+
>>> your_ob.method({str('x'): 3}, b=[4])
|
| 470 |
+
{'x': 3} [4]
|
| 471 |
+
>>> your_ob._saved_method.args
|
| 472 |
+
({'x': 3},)
|
| 473 |
+
>>> my_ob._saved_method.args
|
| 474 |
+
()
|
| 475 |
+
"""
|
| 476 |
+
args_and_kwargs = collections.namedtuple('args_and_kwargs', 'args kwargs')
|
| 477 |
+
|
| 478 |
+
@functools.wraps(method)
|
| 479 |
+
def wrapper(self, *args, **kwargs):
|
| 480 |
+
attr_name = '_saved_' + method.__name__
|
| 481 |
+
attr = args_and_kwargs(args, kwargs)
|
| 482 |
+
setattr(self, attr_name, attr)
|
| 483 |
+
return method(self, *args, **kwargs)
|
| 484 |
+
|
| 485 |
+
return wrapper
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
def except_(*exceptions, replace=None, use=None):
|
| 489 |
+
"""
|
| 490 |
+
Replace the indicated exceptions, if raised, with the indicated
|
| 491 |
+
literal replacement or evaluated expression (if present).
|
| 492 |
+
|
| 493 |
+
>>> safe_int = except_(ValueError)(int)
|
| 494 |
+
>>> safe_int('five')
|
| 495 |
+
>>> safe_int('5')
|
| 496 |
+
5
|
| 497 |
+
|
| 498 |
+
Specify a literal replacement with ``replace``.
|
| 499 |
+
|
| 500 |
+
>>> safe_int_r = except_(ValueError, replace=0)(int)
|
| 501 |
+
>>> safe_int_r('five')
|
| 502 |
+
0
|
| 503 |
+
|
| 504 |
+
Provide an expression to ``use`` to pass through particular parameters.
|
| 505 |
+
|
| 506 |
+
>>> safe_int_pt = except_(ValueError, use='args[0]')(int)
|
| 507 |
+
>>> safe_int_pt('five')
|
| 508 |
+
'five'
|
| 509 |
+
|
| 510 |
+
"""
|
| 511 |
+
|
| 512 |
+
def decorate(func):
|
| 513 |
+
@functools.wraps(func)
|
| 514 |
+
def wrapper(*args, **kwargs):
|
| 515 |
+
try:
|
| 516 |
+
return func(*args, **kwargs)
|
| 517 |
+
except exceptions:
|
| 518 |
+
try:
|
| 519 |
+
return eval(use)
|
| 520 |
+
except TypeError:
|
| 521 |
+
return replace
|
| 522 |
+
|
| 523 |
+
return wrapper
|
| 524 |
+
|
| 525 |
+
return decorate
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/text/__init__.py
ADDED
|
@@ -0,0 +1,599 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
except ImportError: # pragma: nocover
|
| 9 |
+
from pkg_resources.extern.importlib_resources import files # type: ignore
|
| 10 |
+
|
| 11 |
+
from pkg_resources.extern.jaraco.functools import compose, method_cache
|
| 12 |
+
from pkg_resources.extern.jaraco.context import ExceptionTrap
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def substitution(old, new):
|
| 16 |
+
"""
|
| 17 |
+
Return a function that will perform a substitution on a string
|
| 18 |
+
"""
|
| 19 |
+
return lambda s: s.replace(old, new)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def multi_substitution(*substitutions):
|
| 23 |
+
"""
|
| 24 |
+
Take a sequence of pairs specifying substitutions, and create
|
| 25 |
+
a function that performs those substitutions.
|
| 26 |
+
|
| 27 |
+
>>> multi_substitution(('foo', 'bar'), ('bar', 'baz'))('foo')
|
| 28 |
+
'baz'
|
| 29 |
+
"""
|
| 30 |
+
substitutions = itertools.starmap(substitution, substitutions)
|
| 31 |
+
# compose function applies last function first, so reverse the
|
| 32 |
+
# substitutions to get the expected order.
|
| 33 |
+
substitutions = reversed(tuple(substitutions))
|
| 34 |
+
return compose(*substitutions)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class FoldedCase(str):
|
| 38 |
+
"""
|
| 39 |
+
A case insensitive string class; behaves just like str
|
| 40 |
+
except compares equal when the only variation is case.
|
| 41 |
+
|
| 42 |
+
>>> s = FoldedCase('hello world')
|
| 43 |
+
|
| 44 |
+
>>> s == 'Hello World'
|
| 45 |
+
True
|
| 46 |
+
|
| 47 |
+
>>> 'Hello World' == s
|
| 48 |
+
True
|
| 49 |
+
|
| 50 |
+
>>> s != 'Hello World'
|
| 51 |
+
False
|
| 52 |
+
|
| 53 |
+
>>> s.index('O')
|
| 54 |
+
4
|
| 55 |
+
|
| 56 |
+
>>> s.split('O')
|
| 57 |
+
['hell', ' w', 'rld']
|
| 58 |
+
|
| 59 |
+
>>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
|
| 60 |
+
['alpha', 'Beta', 'GAMMA']
|
| 61 |
+
|
| 62 |
+
Sequence membership is straightforward.
|
| 63 |
+
|
| 64 |
+
>>> "Hello World" in [s]
|
| 65 |
+
True
|
| 66 |
+
>>> s in ["Hello World"]
|
| 67 |
+
True
|
| 68 |
+
|
| 69 |
+
You may test for set inclusion, but candidate and elements
|
| 70 |
+
must both be folded.
|
| 71 |
+
|
| 72 |
+
>>> FoldedCase("Hello World") in {s}
|
| 73 |
+
True
|
| 74 |
+
>>> s in {FoldedCase("Hello World")}
|
| 75 |
+
True
|
| 76 |
+
|
| 77 |
+
String inclusion works as long as the FoldedCase object
|
| 78 |
+
is on the right.
|
| 79 |
+
|
| 80 |
+
>>> "hello" in FoldedCase("Hello World")
|
| 81 |
+
True
|
| 82 |
+
|
| 83 |
+
But not if the FoldedCase object is on the left:
|
| 84 |
+
|
| 85 |
+
>>> FoldedCase('hello') in 'Hello World'
|
| 86 |
+
False
|
| 87 |
+
|
| 88 |
+
In that case, use ``in_``:
|
| 89 |
+
|
| 90 |
+
>>> FoldedCase('hello').in_('Hello World')
|
| 91 |
+
True
|
| 92 |
+
|
| 93 |
+
>>> FoldedCase('hello') > FoldedCase('Hello')
|
| 94 |
+
False
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
def __lt__(self, other):
|
| 98 |
+
return self.lower() < other.lower()
|
| 99 |
+
|
| 100 |
+
def __gt__(self, other):
|
| 101 |
+
return self.lower() > other.lower()
|
| 102 |
+
|
| 103 |
+
def __eq__(self, other):
|
| 104 |
+
return self.lower() == other.lower()
|
| 105 |
+
|
| 106 |
+
def __ne__(self, other):
|
| 107 |
+
return self.lower() != other.lower()
|
| 108 |
+
|
| 109 |
+
def __hash__(self):
|
| 110 |
+
return hash(self.lower())
|
| 111 |
+
|
| 112 |
+
def __contains__(self, other):
|
| 113 |
+
return super().lower().__contains__(other.lower())
|
| 114 |
+
|
| 115 |
+
def in_(self, other):
|
| 116 |
+
"Does self appear in other?"
|
| 117 |
+
return self in FoldedCase(other)
|
| 118 |
+
|
| 119 |
+
# cache lower since it's likely to be called frequently.
|
| 120 |
+
@method_cache
|
| 121 |
+
def lower(self):
|
| 122 |
+
return super().lower()
|
| 123 |
+
|
| 124 |
+
def index(self, sub):
|
| 125 |
+
return self.lower().index(sub.lower())
|
| 126 |
+
|
| 127 |
+
def split(self, splitter=' ', maxsplit=0):
|
| 128 |
+
pattern = re.compile(re.escape(splitter), re.I)
|
| 129 |
+
return pattern.split(self, maxsplit)
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# Python 3.8 compatibility
|
| 133 |
+
_unicode_trap = ExceptionTrap(UnicodeDecodeError)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
@_unicode_trap.passes
|
| 137 |
+
def is_decodable(value):
|
| 138 |
+
r"""
|
| 139 |
+
Return True if the supplied value is decodable (using the default
|
| 140 |
+
encoding).
|
| 141 |
+
|
| 142 |
+
>>> is_decodable(b'\xff')
|
| 143 |
+
False
|
| 144 |
+
>>> is_decodable(b'\x32')
|
| 145 |
+
True
|
| 146 |
+
"""
|
| 147 |
+
value.decode()
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def is_binary(value):
|
| 151 |
+
r"""
|
| 152 |
+
Return True if the value appears to be binary (that is, it's a byte
|
| 153 |
+
string and isn't decodable).
|
| 154 |
+
|
| 155 |
+
>>> is_binary(b'\xff')
|
| 156 |
+
True
|
| 157 |
+
>>> is_binary('\xff')
|
| 158 |
+
False
|
| 159 |
+
"""
|
| 160 |
+
return isinstance(value, bytes) and not is_decodable(value)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def trim(s):
|
| 164 |
+
r"""
|
| 165 |
+
Trim something like a docstring to remove the whitespace that
|
| 166 |
+
is common due to indentation and formatting.
|
| 167 |
+
|
| 168 |
+
>>> trim("\n\tfoo = bar\n\t\tbar = baz\n")
|
| 169 |
+
'foo = bar\n\tbar = baz'
|
| 170 |
+
"""
|
| 171 |
+
return textwrap.dedent(s).strip()
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
def wrap(s):
|
| 175 |
+
"""
|
| 176 |
+
Wrap lines of text, retaining existing newlines as
|
| 177 |
+
paragraph markers.
|
| 178 |
+
|
| 179 |
+
>>> print(wrap(lorem_ipsum))
|
| 180 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
| 181 |
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
| 182 |
+
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
| 183 |
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
| 184 |
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
| 185 |
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
| 186 |
+
culpa qui officia deserunt mollit anim id est laborum.
|
| 187 |
+
<BLANKLINE>
|
| 188 |
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
|
| 189 |
+
varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
|
| 190 |
+
magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
|
| 191 |
+
gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
|
| 192 |
+
risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
|
| 193 |
+
eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
|
| 194 |
+
fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla
|
| 195 |
+
a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis,
|
| 196 |
+
neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing
|
| 197 |
+
sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque
|
| 198 |
+
nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus
|
| 199 |
+
quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis,
|
| 200 |
+
molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
|
| 201 |
+
"""
|
| 202 |
+
paragraphs = s.splitlines()
|
| 203 |
+
wrapped = ('\n'.join(textwrap.wrap(para)) for para in paragraphs)
|
| 204 |
+
return '\n\n'.join(wrapped)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def unwrap(s):
|
| 208 |
+
r"""
|
| 209 |
+
Given a multi-line string, return an unwrapped version.
|
| 210 |
+
|
| 211 |
+
>>> wrapped = wrap(lorem_ipsum)
|
| 212 |
+
>>> wrapped.count('\n')
|
| 213 |
+
20
|
| 214 |
+
>>> unwrapped = unwrap(wrapped)
|
| 215 |
+
>>> unwrapped.count('\n')
|
| 216 |
+
1
|
| 217 |
+
>>> print(unwrapped)
|
| 218 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing ...
|
| 219 |
+
Curabitur pretium tincidunt lacus. Nulla gravida orci ...
|
| 220 |
+
|
| 221 |
+
"""
|
| 222 |
+
paragraphs = re.split(r'\n\n+', s)
|
| 223 |
+
cleaned = (para.replace('\n', ' ') for para in paragraphs)
|
| 224 |
+
return '\n'.join(cleaned)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
class Splitter(object):
|
| 230 |
+
"""object that will split a string with the given arguments for each call
|
| 231 |
+
|
| 232 |
+
>>> s = Splitter(',')
|
| 233 |
+
>>> s('hello, world, this is your, master calling')
|
| 234 |
+
['hello', ' world', ' this is your', ' master calling']
|
| 235 |
+
"""
|
| 236 |
+
|
| 237 |
+
def __init__(self, *args):
|
| 238 |
+
self.args = args
|
| 239 |
+
|
| 240 |
+
def __call__(self, s):
|
| 241 |
+
return s.split(*self.args)
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def indent(string, prefix=' ' * 4):
|
| 245 |
+
"""
|
| 246 |
+
>>> indent('foo')
|
| 247 |
+
' foo'
|
| 248 |
+
"""
|
| 249 |
+
return prefix + string
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
class WordSet(tuple):
|
| 253 |
+
"""
|
| 254 |
+
Given an identifier, return the words that identifier represents,
|
| 255 |
+
whether in camel case, underscore-separated, etc.
|
| 256 |
+
|
| 257 |
+
>>> WordSet.parse("camelCase")
|
| 258 |
+
('camel', 'Case')
|
| 259 |
+
|
| 260 |
+
>>> WordSet.parse("under_sep")
|
| 261 |
+
('under', 'sep')
|
| 262 |
+
|
| 263 |
+
Acronyms should be retained
|
| 264 |
+
|
| 265 |
+
>>> WordSet.parse("firstSNL")
|
| 266 |
+
('first', 'SNL')
|
| 267 |
+
|
| 268 |
+
>>> WordSet.parse("you_and_I")
|
| 269 |
+
('you', 'and', 'I')
|
| 270 |
+
|
| 271 |
+
>>> WordSet.parse("A simple test")
|
| 272 |
+
('A', 'simple', 'test')
|
| 273 |
+
|
| 274 |
+
Multiple caps should not interfere with the first cap of another word.
|
| 275 |
+
|
| 276 |
+
>>> WordSet.parse("myABCClass")
|
| 277 |
+
('my', 'ABC', 'Class')
|
| 278 |
+
|
| 279 |
+
The result is a WordSet, so you can get the form you need.
|
| 280 |
+
|
| 281 |
+
>>> WordSet.parse("myABCClass").underscore_separated()
|
| 282 |
+
'my_ABC_Class'
|
| 283 |
+
|
| 284 |
+
>>> WordSet.parse('a-command').camel_case()
|
| 285 |
+
'ACommand'
|
| 286 |
+
|
| 287 |
+
>>> WordSet.parse('someIdentifier').lowered().space_separated()
|
| 288 |
+
'some identifier'
|
| 289 |
+
|
| 290 |
+
Slices of the result should return another WordSet.
|
| 291 |
+
|
| 292 |
+
>>> WordSet.parse('taken-out-of-context')[1:].underscore_separated()
|
| 293 |
+
'out_of_context'
|
| 294 |
+
|
| 295 |
+
>>> WordSet.from_class_name(WordSet()).lowered().space_separated()
|
| 296 |
+
'word set'
|
| 297 |
+
|
| 298 |
+
>>> example = WordSet.parse('figured it out')
|
| 299 |
+
>>> example.headless_camel_case()
|
| 300 |
+
'figuredItOut'
|
| 301 |
+
>>> example.dash_separated()
|
| 302 |
+
'figured-it-out'
|
| 303 |
+
|
| 304 |
+
"""
|
| 305 |
+
|
| 306 |
+
_pattern = re.compile('([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))')
|
| 307 |
+
|
| 308 |
+
def capitalized(self):
|
| 309 |
+
return WordSet(word.capitalize() for word in self)
|
| 310 |
+
|
| 311 |
+
def lowered(self):
|
| 312 |
+
return WordSet(word.lower() for word in self)
|
| 313 |
+
|
| 314 |
+
def camel_case(self):
|
| 315 |
+
return ''.join(self.capitalized())
|
| 316 |
+
|
| 317 |
+
def headless_camel_case(self):
|
| 318 |
+
words = iter(self)
|
| 319 |
+
first = next(words).lower()
|
| 320 |
+
new_words = itertools.chain((first,), WordSet(words).camel_case())
|
| 321 |
+
return ''.join(new_words)
|
| 322 |
+
|
| 323 |
+
def underscore_separated(self):
|
| 324 |
+
return '_'.join(self)
|
| 325 |
+
|
| 326 |
+
def dash_separated(self):
|
| 327 |
+
return '-'.join(self)
|
| 328 |
+
|
| 329 |
+
def space_separated(self):
|
| 330 |
+
return ' '.join(self)
|
| 331 |
+
|
| 332 |
+
def trim_right(self, item):
|
| 333 |
+
"""
|
| 334 |
+
Remove the item from the end of the set.
|
| 335 |
+
|
| 336 |
+
>>> WordSet.parse('foo bar').trim_right('foo')
|
| 337 |
+
('foo', 'bar')
|
| 338 |
+
>>> WordSet.parse('foo bar').trim_right('bar')
|
| 339 |
+
('foo',)
|
| 340 |
+
>>> WordSet.parse('').trim_right('bar')
|
| 341 |
+
()
|
| 342 |
+
"""
|
| 343 |
+
return self[:-1] if self and self[-1] == item else self
|
| 344 |
+
|
| 345 |
+
def trim_left(self, item):
|
| 346 |
+
"""
|
| 347 |
+
Remove the item from the beginning of the set.
|
| 348 |
+
|
| 349 |
+
>>> WordSet.parse('foo bar').trim_left('foo')
|
| 350 |
+
('bar',)
|
| 351 |
+
>>> WordSet.parse('foo bar').trim_left('bar')
|
| 352 |
+
('foo', 'bar')
|
| 353 |
+
>>> WordSet.parse('').trim_left('bar')
|
| 354 |
+
()
|
| 355 |
+
"""
|
| 356 |
+
return self[1:] if self and self[0] == item else self
|
| 357 |
+
|
| 358 |
+
def trim(self, item):
|
| 359 |
+
"""
|
| 360 |
+
>>> WordSet.parse('foo bar').trim('foo')
|
| 361 |
+
('bar',)
|
| 362 |
+
"""
|
| 363 |
+
return self.trim_left(item).trim_right(item)
|
| 364 |
+
|
| 365 |
+
def __getitem__(self, item):
|
| 366 |
+
result = super(WordSet, self).__getitem__(item)
|
| 367 |
+
if isinstance(item, slice):
|
| 368 |
+
result = WordSet(result)
|
| 369 |
+
return result
|
| 370 |
+
|
| 371 |
+
@classmethod
|
| 372 |
+
def parse(cls, identifier):
|
| 373 |
+
matches = cls._pattern.finditer(identifier)
|
| 374 |
+
return WordSet(match.group(0) for match in matches)
|
| 375 |
+
|
| 376 |
+
@classmethod
|
| 377 |
+
def from_class_name(cls, subject):
|
| 378 |
+
return cls.parse(subject.__class__.__name__)
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
# for backward compatibility
|
| 382 |
+
words = WordSet.parse
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
def simple_html_strip(s):
|
| 386 |
+
r"""
|
| 387 |
+
Remove HTML from the string `s`.
|
| 388 |
+
|
| 389 |
+
>>> str(simple_html_strip(''))
|
| 390 |
+
''
|
| 391 |
+
|
| 392 |
+
>>> print(simple_html_strip('A <bold>stormy</bold> day in paradise'))
|
| 393 |
+
A stormy day in paradise
|
| 394 |
+
|
| 395 |
+
>>> print(simple_html_strip('Somebody <!-- do not --> tell the truth.'))
|
| 396 |
+
Somebody tell the truth.
|
| 397 |
+
|
| 398 |
+
>>> print(simple_html_strip('What about<br/>\nmultiple lines?'))
|
| 399 |
+
What about
|
| 400 |
+
multiple lines?
|
| 401 |
+
"""
|
| 402 |
+
html_stripper = re.compile('(<!--.*?-->)|(<[^>]*>)|([^<]+)', re.DOTALL)
|
| 403 |
+
texts = (match.group(3) or '' for match in html_stripper.finditer(s))
|
| 404 |
+
return ''.join(texts)
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
class SeparatedValues(str):
|
| 408 |
+
"""
|
| 409 |
+
A string separated by a separator. Overrides __iter__ for getting
|
| 410 |
+
the values.
|
| 411 |
+
|
| 412 |
+
>>> list(SeparatedValues('a,b,c'))
|
| 413 |
+
['a', 'b', 'c']
|
| 414 |
+
|
| 415 |
+
Whitespace is stripped and empty values are discarded.
|
| 416 |
+
|
| 417 |
+
>>> list(SeparatedValues(' a, b , c, '))
|
| 418 |
+
['a', 'b', 'c']
|
| 419 |
+
"""
|
| 420 |
+
|
| 421 |
+
separator = ','
|
| 422 |
+
|
| 423 |
+
def __iter__(self):
|
| 424 |
+
parts = self.split(self.separator)
|
| 425 |
+
return filter(None, (part.strip() for part in parts))
|
| 426 |
+
|
| 427 |
+
|
| 428 |
+
class Stripper:
|
| 429 |
+
r"""
|
| 430 |
+
Given a series of lines, find the common prefix and strip it from them.
|
| 431 |
+
|
| 432 |
+
>>> lines = [
|
| 433 |
+
... 'abcdefg\n',
|
| 434 |
+
... 'abc\n',
|
| 435 |
+
... 'abcde\n',
|
| 436 |
+
... ]
|
| 437 |
+
>>> res = Stripper.strip_prefix(lines)
|
| 438 |
+
>>> res.prefix
|
| 439 |
+
'abc'
|
| 440 |
+
>>> list(res.lines)
|
| 441 |
+
['defg\n', '\n', 'de\n']
|
| 442 |
+
|
| 443 |
+
If no prefix is common, nothing should be stripped.
|
| 444 |
+
|
| 445 |
+
>>> lines = [
|
| 446 |
+
... 'abcd\n',
|
| 447 |
+
... '1234\n',
|
| 448 |
+
... ]
|
| 449 |
+
>>> res = Stripper.strip_prefix(lines)
|
| 450 |
+
>>> res.prefix = ''
|
| 451 |
+
>>> list(res.lines)
|
| 452 |
+
['abcd\n', '1234\n']
|
| 453 |
+
"""
|
| 454 |
+
|
| 455 |
+
def __init__(self, prefix, lines):
|
| 456 |
+
self.prefix = prefix
|
| 457 |
+
self.lines = map(self, lines)
|
| 458 |
+
|
| 459 |
+
@classmethod
|
| 460 |
+
def strip_prefix(cls, lines):
|
| 461 |
+
prefix_lines, lines = itertools.tee(lines)
|
| 462 |
+
prefix = functools.reduce(cls.common_prefix, prefix_lines)
|
| 463 |
+
return cls(prefix, lines)
|
| 464 |
+
|
| 465 |
+
def __call__(self, line):
|
| 466 |
+
if not self.prefix:
|
| 467 |
+
return line
|
| 468 |
+
null, prefix, rest = line.partition(self.prefix)
|
| 469 |
+
return rest
|
| 470 |
+
|
| 471 |
+
@staticmethod
|
| 472 |
+
def common_prefix(s1, s2):
|
| 473 |
+
"""
|
| 474 |
+
Return the common prefix of two lines.
|
| 475 |
+
"""
|
| 476 |
+
index = min(len(s1), len(s2))
|
| 477 |
+
while s1[:index] != s2[:index]:
|
| 478 |
+
index -= 1
|
| 479 |
+
return s1[:index]
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
def remove_prefix(text, prefix):
|
| 483 |
+
"""
|
| 484 |
+
Remove the prefix from the text if it exists.
|
| 485 |
+
|
| 486 |
+
>>> remove_prefix('underwhelming performance', 'underwhelming ')
|
| 487 |
+
'performance'
|
| 488 |
+
|
| 489 |
+
>>> remove_prefix('something special', 'sample')
|
| 490 |
+
'something special'
|
| 491 |
+
"""
|
| 492 |
+
null, prefix, rest = text.rpartition(prefix)
|
| 493 |
+
return rest
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
def remove_suffix(text, suffix):
|
| 497 |
+
"""
|
| 498 |
+
Remove the suffix from the text if it exists.
|
| 499 |
+
|
| 500 |
+
>>> remove_suffix('name.git', '.git')
|
| 501 |
+
'name'
|
| 502 |
+
|
| 503 |
+
>>> remove_suffix('something special', 'sample')
|
| 504 |
+
'something special'
|
| 505 |
+
"""
|
| 506 |
+
rest, suffix, null = text.partition(suffix)
|
| 507 |
+
return rest
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
def normalize_newlines(text):
|
| 511 |
+
r"""
|
| 512 |
+
Replace alternate newlines with the canonical newline.
|
| 513 |
+
|
| 514 |
+
>>> normalize_newlines('Lorem Ipsum\u2029')
|
| 515 |
+
'Lorem Ipsum\n'
|
| 516 |
+
>>> normalize_newlines('Lorem Ipsum\r\n')
|
| 517 |
+
'Lorem Ipsum\n'
|
| 518 |
+
>>> normalize_newlines('Lorem Ipsum\x85')
|
| 519 |
+
'Lorem Ipsum\n'
|
| 520 |
+
"""
|
| 521 |
+
newlines = ['\r\n', '\r', '\n', '\u0085', '\u2028', '\u2029']
|
| 522 |
+
pattern = '|'.join(newlines)
|
| 523 |
+
return re.sub(pattern, '\n', text)
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
def _nonblank(str):
|
| 527 |
+
return str and not str.startswith('#')
|
| 528 |
+
|
| 529 |
+
|
| 530 |
+
@functools.singledispatch
|
| 531 |
+
def yield_lines(iterable):
|
| 532 |
+
r"""
|
| 533 |
+
Yield valid lines of a string or iterable.
|
| 534 |
+
|
| 535 |
+
>>> list(yield_lines(''))
|
| 536 |
+
[]
|
| 537 |
+
>>> list(yield_lines(['foo', 'bar']))
|
| 538 |
+
['foo', 'bar']
|
| 539 |
+
>>> list(yield_lines('foo\nbar'))
|
| 540 |
+
['foo', 'bar']
|
| 541 |
+
>>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
|
| 542 |
+
['foo', 'baz #comment']
|
| 543 |
+
>>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
|
| 544 |
+
['foo', 'bar', 'baz', 'bing']
|
| 545 |
+
"""
|
| 546 |
+
return itertools.chain.from_iterable(map(yield_lines, iterable))
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
@yield_lines.register(str)
|
| 550 |
+
def _(text):
|
| 551 |
+
return filter(_nonblank, map(str.strip, text.splitlines()))
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
def drop_comment(line):
|
| 555 |
+
"""
|
| 556 |
+
Drop comments.
|
| 557 |
+
|
| 558 |
+
>>> drop_comment('foo # bar')
|
| 559 |
+
'foo'
|
| 560 |
+
|
| 561 |
+
A hash without a space may be in a URL.
|
| 562 |
+
|
| 563 |
+
>>> drop_comment('http://example.com/foo#bar')
|
| 564 |
+
'http://example.com/foo#bar'
|
| 565 |
+
"""
|
| 566 |
+
return line.partition(' #')[0]
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
def join_continuation(lines):
|
| 570 |
+
r"""
|
| 571 |
+
Join lines continued by a trailing backslash.
|
| 572 |
+
|
| 573 |
+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
|
| 574 |
+
['foobar', 'baz']
|
| 575 |
+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
|
| 576 |
+
['foobar', 'baz']
|
| 577 |
+
>>> list(join_continuation(['foo \\', 'bar \\', 'baz']))
|
| 578 |
+
['foobarbaz']
|
| 579 |
+
|
| 580 |
+
Not sure why, but...
|
| 581 |
+
The character preceeding the backslash is also elided.
|
| 582 |
+
|
| 583 |
+
>>> list(join_continuation(['goo\\', 'dly']))
|
| 584 |
+
['godly']
|
| 585 |
+
|
| 586 |
+
A terrible idea, but...
|
| 587 |
+
If no line is available to continue, suppress the lines.
|
| 588 |
+
|
| 589 |
+
>>> list(join_continuation(['foo', 'bar\\', 'baz\\']))
|
| 590 |
+
['foo']
|
| 591 |
+
"""
|
| 592 |
+
lines = iter(lines)
|
| 593 |
+
for item in lines:
|
| 594 |
+
while item.endswith('\\'):
|
| 595 |
+
try:
|
| 596 |
+
item = item[:-2].strip() + next(lines)
|
| 597 |
+
except StopIteration:
|
| 598 |
+
return
|
| 599 |
+
yield item
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/jaraco/text/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (26.6 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .more import * # noqa
|
| 2 |
+
from .recipes import * # noqa
|
| 3 |
+
|
| 4 |
+
__version__ = '8.12.0'
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (295 Bytes). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/recipes.cpython-311.pyc
ADDED
|
Binary file (26.9 kB). View file
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/more.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/recipes.py
ADDED
|
@@ -0,0 +1,698 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Imported from the recipes section of the itertools documentation.
|
| 2 |
+
|
| 3 |
+
All functions taken from the recipes section of the itertools library docs
|
| 4 |
+
[1]_.
|
| 5 |
+
Some backward-compatible usability improvements have been made.
|
| 6 |
+
|
| 7 |
+
.. [1] http://docs.python.org/library/itertools.html#recipes
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
import warnings
|
| 11 |
+
from collections import deque
|
| 12 |
+
from itertools import (
|
| 13 |
+
chain,
|
| 14 |
+
combinations,
|
| 15 |
+
count,
|
| 16 |
+
cycle,
|
| 17 |
+
groupby,
|
| 18 |
+
islice,
|
| 19 |
+
repeat,
|
| 20 |
+
starmap,
|
| 21 |
+
tee,
|
| 22 |
+
zip_longest,
|
| 23 |
+
)
|
| 24 |
+
import operator
|
| 25 |
+
from random import randrange, sample, choice
|
| 26 |
+
|
| 27 |
+
__all__ = [
|
| 28 |
+
'all_equal',
|
| 29 |
+
'before_and_after',
|
| 30 |
+
'consume',
|
| 31 |
+
'convolve',
|
| 32 |
+
'dotproduct',
|
| 33 |
+
'first_true',
|
| 34 |
+
'flatten',
|
| 35 |
+
'grouper',
|
| 36 |
+
'iter_except',
|
| 37 |
+
'ncycles',
|
| 38 |
+
'nth',
|
| 39 |
+
'nth_combination',
|
| 40 |
+
'padnone',
|
| 41 |
+
'pad_none',
|
| 42 |
+
'pairwise',
|
| 43 |
+
'partition',
|
| 44 |
+
'powerset',
|
| 45 |
+
'prepend',
|
| 46 |
+
'quantify',
|
| 47 |
+
'random_combination_with_replacement',
|
| 48 |
+
'random_combination',
|
| 49 |
+
'random_permutation',
|
| 50 |
+
'random_product',
|
| 51 |
+
'repeatfunc',
|
| 52 |
+
'roundrobin',
|
| 53 |
+
'sliding_window',
|
| 54 |
+
'tabulate',
|
| 55 |
+
'tail',
|
| 56 |
+
'take',
|
| 57 |
+
'triplewise',
|
| 58 |
+
'unique_everseen',
|
| 59 |
+
'unique_justseen',
|
| 60 |
+
]
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def take(n, iterable):
|
| 64 |
+
"""Return first *n* items of the iterable as a list.
|
| 65 |
+
|
| 66 |
+
>>> take(3, range(10))
|
| 67 |
+
[0, 1, 2]
|
| 68 |
+
|
| 69 |
+
If there are fewer than *n* items in the iterable, all of them are
|
| 70 |
+
returned.
|
| 71 |
+
|
| 72 |
+
>>> take(10, range(3))
|
| 73 |
+
[0, 1, 2]
|
| 74 |
+
|
| 75 |
+
"""
|
| 76 |
+
return list(islice(iterable, n))
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def tabulate(function, start=0):
|
| 80 |
+
"""Return an iterator over the results of ``func(start)``,
|
| 81 |
+
``func(start + 1)``, ``func(start + 2)``...
|
| 82 |
+
|
| 83 |
+
*func* should be a function that accepts one integer argument.
|
| 84 |
+
|
| 85 |
+
If *start* is not specified it defaults to 0. It will be incremented each
|
| 86 |
+
time the iterator is advanced.
|
| 87 |
+
|
| 88 |
+
>>> square = lambda x: x ** 2
|
| 89 |
+
>>> iterator = tabulate(square, -3)
|
| 90 |
+
>>> take(4, iterator)
|
| 91 |
+
[9, 4, 1, 0]
|
| 92 |
+
|
| 93 |
+
"""
|
| 94 |
+
return map(function, count(start))
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def tail(n, iterable):
|
| 98 |
+
"""Return an iterator over the last *n* items of *iterable*.
|
| 99 |
+
|
| 100 |
+
>>> t = tail(3, 'ABCDEFG')
|
| 101 |
+
>>> list(t)
|
| 102 |
+
['E', 'F', 'G']
|
| 103 |
+
|
| 104 |
+
"""
|
| 105 |
+
return iter(deque(iterable, maxlen=n))
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def consume(iterator, n=None):
|
| 109 |
+
"""Advance *iterable* by *n* steps. If *n* is ``None``, consume it
|
| 110 |
+
entirely.
|
| 111 |
+
|
| 112 |
+
Efficiently exhausts an iterator without returning values. Defaults to
|
| 113 |
+
consuming the whole iterator, but an optional second argument may be
|
| 114 |
+
provided to limit consumption.
|
| 115 |
+
|
| 116 |
+
>>> i = (x for x in range(10))
|
| 117 |
+
>>> next(i)
|
| 118 |
+
0
|
| 119 |
+
>>> consume(i, 3)
|
| 120 |
+
>>> next(i)
|
| 121 |
+
4
|
| 122 |
+
>>> consume(i)
|
| 123 |
+
>>> next(i)
|
| 124 |
+
Traceback (most recent call last):
|
| 125 |
+
File "<stdin>", line 1, in <module>
|
| 126 |
+
StopIteration
|
| 127 |
+
|
| 128 |
+
If the iterator has fewer items remaining than the provided limit, the
|
| 129 |
+
whole iterator will be consumed.
|
| 130 |
+
|
| 131 |
+
>>> i = (x for x in range(3))
|
| 132 |
+
>>> consume(i, 5)
|
| 133 |
+
>>> next(i)
|
| 134 |
+
Traceback (most recent call last):
|
| 135 |
+
File "<stdin>", line 1, in <module>
|
| 136 |
+
StopIteration
|
| 137 |
+
|
| 138 |
+
"""
|
| 139 |
+
# Use functions that consume iterators at C speed.
|
| 140 |
+
if n is None:
|
| 141 |
+
# feed the entire iterator into a zero-length deque
|
| 142 |
+
deque(iterator, maxlen=0)
|
| 143 |
+
else:
|
| 144 |
+
# advance to the empty slice starting at position n
|
| 145 |
+
next(islice(iterator, n, n), None)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def nth(iterable, n, default=None):
|
| 149 |
+
"""Returns the nth item or a default value.
|
| 150 |
+
|
| 151 |
+
>>> l = range(10)
|
| 152 |
+
>>> nth(l, 3)
|
| 153 |
+
3
|
| 154 |
+
>>> nth(l, 20, "zebra")
|
| 155 |
+
'zebra'
|
| 156 |
+
|
| 157 |
+
"""
|
| 158 |
+
return next(islice(iterable, n, None), default)
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def all_equal(iterable):
|
| 162 |
+
"""
|
| 163 |
+
Returns ``True`` if all the elements are equal to each other.
|
| 164 |
+
|
| 165 |
+
>>> all_equal('aaaa')
|
| 166 |
+
True
|
| 167 |
+
>>> all_equal('aaab')
|
| 168 |
+
False
|
| 169 |
+
|
| 170 |
+
"""
|
| 171 |
+
g = groupby(iterable)
|
| 172 |
+
return next(g, True) and not next(g, False)
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
def quantify(iterable, pred=bool):
|
| 176 |
+
"""Return the how many times the predicate is true.
|
| 177 |
+
|
| 178 |
+
>>> quantify([True, False, True])
|
| 179 |
+
2
|
| 180 |
+
|
| 181 |
+
"""
|
| 182 |
+
return sum(map(pred, iterable))
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def pad_none(iterable):
|
| 186 |
+
"""Returns the sequence of elements and then returns ``None`` indefinitely.
|
| 187 |
+
|
| 188 |
+
>>> take(5, pad_none(range(3)))
|
| 189 |
+
[0, 1, 2, None, None]
|
| 190 |
+
|
| 191 |
+
Useful for emulating the behavior of the built-in :func:`map` function.
|
| 192 |
+
|
| 193 |
+
See also :func:`padded`.
|
| 194 |
+
|
| 195 |
+
"""
|
| 196 |
+
return chain(iterable, repeat(None))
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
padnone = pad_none
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def ncycles(iterable, n):
|
| 203 |
+
"""Returns the sequence elements *n* times
|
| 204 |
+
|
| 205 |
+
>>> list(ncycles(["a", "b"], 3))
|
| 206 |
+
['a', 'b', 'a', 'b', 'a', 'b']
|
| 207 |
+
|
| 208 |
+
"""
|
| 209 |
+
return chain.from_iterable(repeat(tuple(iterable), n))
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def dotproduct(vec1, vec2):
|
| 213 |
+
"""Returns the dot product of the two iterables.
|
| 214 |
+
|
| 215 |
+
>>> dotproduct([10, 10], [20, 20])
|
| 216 |
+
400
|
| 217 |
+
|
| 218 |
+
"""
|
| 219 |
+
return sum(map(operator.mul, vec1, vec2))
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
def flatten(listOfLists):
|
| 223 |
+
"""Return an iterator flattening one level of nesting in a list of lists.
|
| 224 |
+
|
| 225 |
+
>>> list(flatten([[0, 1], [2, 3]]))
|
| 226 |
+
[0, 1, 2, 3]
|
| 227 |
+
|
| 228 |
+
See also :func:`collapse`, which can flatten multiple levels of nesting.
|
| 229 |
+
|
| 230 |
+
"""
|
| 231 |
+
return chain.from_iterable(listOfLists)
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
def repeatfunc(func, times=None, *args):
|
| 235 |
+
"""Call *func* with *args* repeatedly, returning an iterable over the
|
| 236 |
+
results.
|
| 237 |
+
|
| 238 |
+
If *times* is specified, the iterable will terminate after that many
|
| 239 |
+
repetitions:
|
| 240 |
+
|
| 241 |
+
>>> from operator import add
|
| 242 |
+
>>> times = 4
|
| 243 |
+
>>> args = 3, 5
|
| 244 |
+
>>> list(repeatfunc(add, times, *args))
|
| 245 |
+
[8, 8, 8, 8]
|
| 246 |
+
|
| 247 |
+
If *times* is ``None`` the iterable will not terminate:
|
| 248 |
+
|
| 249 |
+
>>> from random import randrange
|
| 250 |
+
>>> times = None
|
| 251 |
+
>>> args = 1, 11
|
| 252 |
+
>>> take(6, repeatfunc(randrange, times, *args)) # doctest:+SKIP
|
| 253 |
+
[2, 4, 8, 1, 8, 4]
|
| 254 |
+
|
| 255 |
+
"""
|
| 256 |
+
if times is None:
|
| 257 |
+
return starmap(func, repeat(args))
|
| 258 |
+
return starmap(func, repeat(args, times))
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def _pairwise(iterable):
|
| 262 |
+
"""Returns an iterator of paired items, overlapping, from the original
|
| 263 |
+
|
| 264 |
+
>>> take(4, pairwise(count()))
|
| 265 |
+
[(0, 1), (1, 2), (2, 3), (3, 4)]
|
| 266 |
+
|
| 267 |
+
On Python 3.10 and above, this is an alias for :func:`itertools.pairwise`.
|
| 268 |
+
|
| 269 |
+
"""
|
| 270 |
+
a, b = tee(iterable)
|
| 271 |
+
next(b, None)
|
| 272 |
+
yield from zip(a, b)
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
try:
|
| 276 |
+
from itertools import pairwise as itertools_pairwise
|
| 277 |
+
except ImportError:
|
| 278 |
+
pairwise = _pairwise
|
| 279 |
+
else:
|
| 280 |
+
|
| 281 |
+
def pairwise(iterable):
|
| 282 |
+
yield from itertools_pairwise(iterable)
|
| 283 |
+
|
| 284 |
+
pairwise.__doc__ = _pairwise.__doc__
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def grouper(iterable, n, fillvalue=None):
|
| 288 |
+
"""Collect data into fixed-length chunks or blocks.
|
| 289 |
+
|
| 290 |
+
>>> list(grouper('ABCDEFG', 3, 'x'))
|
| 291 |
+
[('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')]
|
| 292 |
+
|
| 293 |
+
"""
|
| 294 |
+
if isinstance(iterable, int):
|
| 295 |
+
warnings.warn(
|
| 296 |
+
"grouper expects iterable as first parameter", DeprecationWarning
|
| 297 |
+
)
|
| 298 |
+
n, iterable = iterable, n
|
| 299 |
+
args = [iter(iterable)] * n
|
| 300 |
+
return zip_longest(fillvalue=fillvalue, *args)
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
def roundrobin(*iterables):
|
| 304 |
+
"""Yields an item from each iterable, alternating between them.
|
| 305 |
+
|
| 306 |
+
>>> list(roundrobin('ABC', 'D', 'EF'))
|
| 307 |
+
['A', 'D', 'E', 'B', 'F', 'C']
|
| 308 |
+
|
| 309 |
+
This function produces the same output as :func:`interleave_longest`, but
|
| 310 |
+
may perform better for some inputs (in particular when the number of
|
| 311 |
+
iterables is small).
|
| 312 |
+
|
| 313 |
+
"""
|
| 314 |
+
# Recipe credited to George Sakkis
|
| 315 |
+
pending = len(iterables)
|
| 316 |
+
nexts = cycle(iter(it).__next__ for it in iterables)
|
| 317 |
+
while pending:
|
| 318 |
+
try:
|
| 319 |
+
for next in nexts:
|
| 320 |
+
yield next()
|
| 321 |
+
except StopIteration:
|
| 322 |
+
pending -= 1
|
| 323 |
+
nexts = cycle(islice(nexts, pending))
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
def partition(pred, iterable):
|
| 327 |
+
"""
|
| 328 |
+
Returns a 2-tuple of iterables derived from the input iterable.
|
| 329 |
+
The first yields the items that have ``pred(item) == False``.
|
| 330 |
+
The second yields the items that have ``pred(item) == True``.
|
| 331 |
+
|
| 332 |
+
>>> is_odd = lambda x: x % 2 != 0
|
| 333 |
+
>>> iterable = range(10)
|
| 334 |
+
>>> even_items, odd_items = partition(is_odd, iterable)
|
| 335 |
+
>>> list(even_items), list(odd_items)
|
| 336 |
+
([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
|
| 337 |
+
|
| 338 |
+
If *pred* is None, :func:`bool` is used.
|
| 339 |
+
|
| 340 |
+
>>> iterable = [0, 1, False, True, '', ' ']
|
| 341 |
+
>>> false_items, true_items = partition(None, iterable)
|
| 342 |
+
>>> list(false_items), list(true_items)
|
| 343 |
+
([0, False, ''], [1, True, ' '])
|
| 344 |
+
|
| 345 |
+
"""
|
| 346 |
+
if pred is None:
|
| 347 |
+
pred = bool
|
| 348 |
+
|
| 349 |
+
evaluations = ((pred(x), x) for x in iterable)
|
| 350 |
+
t1, t2 = tee(evaluations)
|
| 351 |
+
return (
|
| 352 |
+
(x for (cond, x) in t1 if not cond),
|
| 353 |
+
(x for (cond, x) in t2 if cond),
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def powerset(iterable):
|
| 358 |
+
"""Yields all possible subsets of the iterable.
|
| 359 |
+
|
| 360 |
+
>>> list(powerset([1, 2, 3]))
|
| 361 |
+
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
|
| 362 |
+
|
| 363 |
+
:func:`powerset` will operate on iterables that aren't :class:`set`
|
| 364 |
+
instances, so repeated elements in the input will produce repeated elements
|
| 365 |
+
in the output. Use :func:`unique_everseen` on the input to avoid generating
|
| 366 |
+
duplicates:
|
| 367 |
+
|
| 368 |
+
>>> seq = [1, 1, 0]
|
| 369 |
+
>>> list(powerset(seq))
|
| 370 |
+
[(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)]
|
| 371 |
+
>>> from more_itertools import unique_everseen
|
| 372 |
+
>>> list(powerset(unique_everseen(seq)))
|
| 373 |
+
[(), (1,), (0,), (1, 0)]
|
| 374 |
+
|
| 375 |
+
"""
|
| 376 |
+
s = list(iterable)
|
| 377 |
+
return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
def unique_everseen(iterable, key=None):
|
| 381 |
+
"""
|
| 382 |
+
Yield unique elements, preserving order.
|
| 383 |
+
|
| 384 |
+
>>> list(unique_everseen('AAAABBBCCDAABBB'))
|
| 385 |
+
['A', 'B', 'C', 'D']
|
| 386 |
+
>>> list(unique_everseen('ABBCcAD', str.lower))
|
| 387 |
+
['A', 'B', 'C', 'D']
|
| 388 |
+
|
| 389 |
+
Sequences with a mix of hashable and unhashable items can be used.
|
| 390 |
+
The function will be slower (i.e., `O(n^2)`) for unhashable items.
|
| 391 |
+
|
| 392 |
+
Remember that ``list`` objects are unhashable - you can use the *key*
|
| 393 |
+
parameter to transform the list to a tuple (which is hashable) to
|
| 394 |
+
avoid a slowdown.
|
| 395 |
+
|
| 396 |
+
>>> iterable = ([1, 2], [2, 3], [1, 2])
|
| 397 |
+
>>> list(unique_everseen(iterable)) # Slow
|
| 398 |
+
[[1, 2], [2, 3]]
|
| 399 |
+
>>> list(unique_everseen(iterable, key=tuple)) # Faster
|
| 400 |
+
[[1, 2], [2, 3]]
|
| 401 |
+
|
| 402 |
+
Similary, you may want to convert unhashable ``set`` objects with
|
| 403 |
+
``key=frozenset``. For ``dict`` objects,
|
| 404 |
+
``key=lambda x: frozenset(x.items())`` can be used.
|
| 405 |
+
|
| 406 |
+
"""
|
| 407 |
+
seenset = set()
|
| 408 |
+
seenset_add = seenset.add
|
| 409 |
+
seenlist = []
|
| 410 |
+
seenlist_add = seenlist.append
|
| 411 |
+
use_key = key is not None
|
| 412 |
+
|
| 413 |
+
for element in iterable:
|
| 414 |
+
k = key(element) if use_key else element
|
| 415 |
+
try:
|
| 416 |
+
if k not in seenset:
|
| 417 |
+
seenset_add(k)
|
| 418 |
+
yield element
|
| 419 |
+
except TypeError:
|
| 420 |
+
if k not in seenlist:
|
| 421 |
+
seenlist_add(k)
|
| 422 |
+
yield element
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def unique_justseen(iterable, key=None):
|
| 426 |
+
"""Yields elements in order, ignoring serial duplicates
|
| 427 |
+
|
| 428 |
+
>>> list(unique_justseen('AAAABBBCCDAABBB'))
|
| 429 |
+
['A', 'B', 'C', 'D', 'A', 'B']
|
| 430 |
+
>>> list(unique_justseen('ABBCcAD', str.lower))
|
| 431 |
+
['A', 'B', 'C', 'A', 'D']
|
| 432 |
+
|
| 433 |
+
"""
|
| 434 |
+
return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def iter_except(func, exception, first=None):
|
| 438 |
+
"""Yields results from a function repeatedly until an exception is raised.
|
| 439 |
+
|
| 440 |
+
Converts a call-until-exception interface to an iterator interface.
|
| 441 |
+
Like ``iter(func, sentinel)``, but uses an exception instead of a sentinel
|
| 442 |
+
to end the loop.
|
| 443 |
+
|
| 444 |
+
>>> l = [0, 1, 2]
|
| 445 |
+
>>> list(iter_except(l.pop, IndexError))
|
| 446 |
+
[2, 1, 0]
|
| 447 |
+
|
| 448 |
+
Multiple exceptions can be specified as a stopping condition:
|
| 449 |
+
|
| 450 |
+
>>> l = [1, 2, 3, '...', 4, 5, 6]
|
| 451 |
+
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
| 452 |
+
[7, 6, 5]
|
| 453 |
+
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
| 454 |
+
[4, 3, 2]
|
| 455 |
+
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
| 456 |
+
[]
|
| 457 |
+
|
| 458 |
+
"""
|
| 459 |
+
try:
|
| 460 |
+
if first is not None:
|
| 461 |
+
yield first()
|
| 462 |
+
while 1:
|
| 463 |
+
yield func()
|
| 464 |
+
except exception:
|
| 465 |
+
pass
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
def first_true(iterable, default=None, pred=None):
|
| 469 |
+
"""
|
| 470 |
+
Returns the first true value in the iterable.
|
| 471 |
+
|
| 472 |
+
If no true value is found, returns *default*
|
| 473 |
+
|
| 474 |
+
If *pred* is not None, returns the first item for which
|
| 475 |
+
``pred(item) == True`` .
|
| 476 |
+
|
| 477 |
+
>>> first_true(range(10))
|
| 478 |
+
1
|
| 479 |
+
>>> first_true(range(10), pred=lambda x: x > 5)
|
| 480 |
+
6
|
| 481 |
+
>>> first_true(range(10), default='missing', pred=lambda x: x > 9)
|
| 482 |
+
'missing'
|
| 483 |
+
|
| 484 |
+
"""
|
| 485 |
+
return next(filter(pred, iterable), default)
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
def random_product(*args, repeat=1):
|
| 489 |
+
"""Draw an item at random from each of the input iterables.
|
| 490 |
+
|
| 491 |
+
>>> random_product('abc', range(4), 'XYZ') # doctest:+SKIP
|
| 492 |
+
('c', 3, 'Z')
|
| 493 |
+
|
| 494 |
+
If *repeat* is provided as a keyword argument, that many items will be
|
| 495 |
+
drawn from each iterable.
|
| 496 |
+
|
| 497 |
+
>>> random_product('abcd', range(4), repeat=2) # doctest:+SKIP
|
| 498 |
+
('a', 2, 'd', 3)
|
| 499 |
+
|
| 500 |
+
This equivalent to taking a random selection from
|
| 501 |
+
``itertools.product(*args, **kwarg)``.
|
| 502 |
+
|
| 503 |
+
"""
|
| 504 |
+
pools = [tuple(pool) for pool in args] * repeat
|
| 505 |
+
return tuple(choice(pool) for pool in pools)
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
def random_permutation(iterable, r=None):
|
| 509 |
+
"""Return a random *r* length permutation of the elements in *iterable*.
|
| 510 |
+
|
| 511 |
+
If *r* is not specified or is ``None``, then *r* defaults to the length of
|
| 512 |
+
*iterable*.
|
| 513 |
+
|
| 514 |
+
>>> random_permutation(range(5)) # doctest:+SKIP
|
| 515 |
+
(3, 4, 0, 1, 2)
|
| 516 |
+
|
| 517 |
+
This equivalent to taking a random selection from
|
| 518 |
+
``itertools.permutations(iterable, r)``.
|
| 519 |
+
|
| 520 |
+
"""
|
| 521 |
+
pool = tuple(iterable)
|
| 522 |
+
r = len(pool) if r is None else r
|
| 523 |
+
return tuple(sample(pool, r))
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
def random_combination(iterable, r):
|
| 527 |
+
"""Return a random *r* length subsequence of the elements in *iterable*.
|
| 528 |
+
|
| 529 |
+
>>> random_combination(range(5), 3) # doctest:+SKIP
|
| 530 |
+
(2, 3, 4)
|
| 531 |
+
|
| 532 |
+
This equivalent to taking a random selection from
|
| 533 |
+
``itertools.combinations(iterable, r)``.
|
| 534 |
+
|
| 535 |
+
"""
|
| 536 |
+
pool = tuple(iterable)
|
| 537 |
+
n = len(pool)
|
| 538 |
+
indices = sorted(sample(range(n), r))
|
| 539 |
+
return tuple(pool[i] for i in indices)
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
def random_combination_with_replacement(iterable, r):
|
| 543 |
+
"""Return a random *r* length subsequence of elements in *iterable*,
|
| 544 |
+
allowing individual elements to be repeated.
|
| 545 |
+
|
| 546 |
+
>>> random_combination_with_replacement(range(3), 5) # doctest:+SKIP
|
| 547 |
+
(0, 0, 1, 2, 2)
|
| 548 |
+
|
| 549 |
+
This equivalent to taking a random selection from
|
| 550 |
+
``itertools.combinations_with_replacement(iterable, r)``.
|
| 551 |
+
|
| 552 |
+
"""
|
| 553 |
+
pool = tuple(iterable)
|
| 554 |
+
n = len(pool)
|
| 555 |
+
indices = sorted(randrange(n) for i in range(r))
|
| 556 |
+
return tuple(pool[i] for i in indices)
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
def nth_combination(iterable, r, index):
|
| 560 |
+
"""Equivalent to ``list(combinations(iterable, r))[index]``.
|
| 561 |
+
|
| 562 |
+
The subsequences of *iterable* that are of length *r* can be ordered
|
| 563 |
+
lexicographically. :func:`nth_combination` computes the subsequence at
|
| 564 |
+
sort position *index* directly, without computing the previous
|
| 565 |
+
subsequences.
|
| 566 |
+
|
| 567 |
+
>>> nth_combination(range(5), 3, 5)
|
| 568 |
+
(0, 3, 4)
|
| 569 |
+
|
| 570 |
+
``ValueError`` will be raised If *r* is negative or greater than the length
|
| 571 |
+
of *iterable*.
|
| 572 |
+
``IndexError`` will be raised if the given *index* is invalid.
|
| 573 |
+
"""
|
| 574 |
+
pool = tuple(iterable)
|
| 575 |
+
n = len(pool)
|
| 576 |
+
if (r < 0) or (r > n):
|
| 577 |
+
raise ValueError
|
| 578 |
+
|
| 579 |
+
c = 1
|
| 580 |
+
k = min(r, n - r)
|
| 581 |
+
for i in range(1, k + 1):
|
| 582 |
+
c = c * (n - k + i) // i
|
| 583 |
+
|
| 584 |
+
if index < 0:
|
| 585 |
+
index += c
|
| 586 |
+
|
| 587 |
+
if (index < 0) or (index >= c):
|
| 588 |
+
raise IndexError
|
| 589 |
+
|
| 590 |
+
result = []
|
| 591 |
+
while r:
|
| 592 |
+
c, n, r = c * r // n, n - 1, r - 1
|
| 593 |
+
while index >= c:
|
| 594 |
+
index -= c
|
| 595 |
+
c, n = c * (n - r) // n, n - 1
|
| 596 |
+
result.append(pool[-1 - n])
|
| 597 |
+
|
| 598 |
+
return tuple(result)
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
def prepend(value, iterator):
|
| 602 |
+
"""Yield *value*, followed by the elements in *iterator*.
|
| 603 |
+
|
| 604 |
+
>>> value = '0'
|
| 605 |
+
>>> iterator = ['1', '2', '3']
|
| 606 |
+
>>> list(prepend(value, iterator))
|
| 607 |
+
['0', '1', '2', '3']
|
| 608 |
+
|
| 609 |
+
To prepend multiple values, see :func:`itertools.chain`
|
| 610 |
+
or :func:`value_chain`.
|
| 611 |
+
|
| 612 |
+
"""
|
| 613 |
+
return chain([value], iterator)
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
def convolve(signal, kernel):
|
| 617 |
+
"""Convolve the iterable *signal* with the iterable *kernel*.
|
| 618 |
+
|
| 619 |
+
>>> signal = (1, 2, 3, 4, 5)
|
| 620 |
+
>>> kernel = [3, 2, 1]
|
| 621 |
+
>>> list(convolve(signal, kernel))
|
| 622 |
+
[3, 8, 14, 20, 26, 14, 5]
|
| 623 |
+
|
| 624 |
+
Note: the input arguments are not interchangeable, as the *kernel*
|
| 625 |
+
is immediately consumed and stored.
|
| 626 |
+
|
| 627 |
+
"""
|
| 628 |
+
kernel = tuple(kernel)[::-1]
|
| 629 |
+
n = len(kernel)
|
| 630 |
+
window = deque([0], maxlen=n) * n
|
| 631 |
+
for x in chain(signal, repeat(0, n - 1)):
|
| 632 |
+
window.append(x)
|
| 633 |
+
yield sum(map(operator.mul, kernel, window))
|
| 634 |
+
|
| 635 |
+
|
| 636 |
+
def before_and_after(predicate, it):
|
| 637 |
+
"""A variant of :func:`takewhile` that allows complete access to the
|
| 638 |
+
remainder of the iterator.
|
| 639 |
+
|
| 640 |
+
>>> it = iter('ABCdEfGhI')
|
| 641 |
+
>>> all_upper, remainder = before_and_after(str.isupper, it)
|
| 642 |
+
>>> ''.join(all_upper)
|
| 643 |
+
'ABC'
|
| 644 |
+
>>> ''.join(remainder) # takewhile() would lose the 'd'
|
| 645 |
+
'dEfGhI'
|
| 646 |
+
|
| 647 |
+
Note that the first iterator must be fully consumed before the second
|
| 648 |
+
iterator can generate valid results.
|
| 649 |
+
"""
|
| 650 |
+
it = iter(it)
|
| 651 |
+
transition = []
|
| 652 |
+
|
| 653 |
+
def true_iterator():
|
| 654 |
+
for elem in it:
|
| 655 |
+
if predicate(elem):
|
| 656 |
+
yield elem
|
| 657 |
+
else:
|
| 658 |
+
transition.append(elem)
|
| 659 |
+
return
|
| 660 |
+
|
| 661 |
+
def remainder_iterator():
|
| 662 |
+
yield from transition
|
| 663 |
+
yield from it
|
| 664 |
+
|
| 665 |
+
return true_iterator(), remainder_iterator()
|
| 666 |
+
|
| 667 |
+
|
| 668 |
+
def triplewise(iterable):
|
| 669 |
+
"""Return overlapping triplets from *iterable*.
|
| 670 |
+
|
| 671 |
+
>>> list(triplewise('ABCDE'))
|
| 672 |
+
[('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E')]
|
| 673 |
+
|
| 674 |
+
"""
|
| 675 |
+
for (a, _), (b, c) in pairwise(pairwise(iterable)):
|
| 676 |
+
yield a, b, c
|
| 677 |
+
|
| 678 |
+
|
| 679 |
+
def sliding_window(iterable, n):
|
| 680 |
+
"""Return a sliding window of width *n* over *iterable*.
|
| 681 |
+
|
| 682 |
+
>>> list(sliding_window(range(6), 4))
|
| 683 |
+
[(0, 1, 2, 3), (1, 2, 3, 4), (2, 3, 4, 5)]
|
| 684 |
+
|
| 685 |
+
If *iterable* has fewer than *n* items, then nothing is yielded:
|
| 686 |
+
|
| 687 |
+
>>> list(sliding_window(range(3), 4))
|
| 688 |
+
[]
|
| 689 |
+
|
| 690 |
+
For a variant with more features, see :func:`windowed`.
|
| 691 |
+
"""
|
| 692 |
+
it = iter(iterable)
|
| 693 |
+
window = deque(islice(it, n), maxlen=n)
|
| 694 |
+
if len(window) == n:
|
| 695 |
+
yield tuple(window)
|
| 696 |
+
for x in it:
|
| 697 |
+
window.append(x)
|
| 698 |
+
yield tuple(window)
|
.venv/lib/python3.11/site-packages/pkg_resources/_vendor/packaging/__about__.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
__all__ = [
|
| 6 |
+
"__title__",
|
| 7 |
+
"__summary__",
|
| 8 |
+
"__uri__",
|
| 9 |
+
"__version__",
|
| 10 |
+
"__author__",
|
| 11 |
+
"__email__",
|
| 12 |
+
"__license__",
|
| 13 |
+
"__copyright__",
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
__title__ = "packaging"
|
| 17 |
+
__summary__ = "Core utilities for Python packages"
|
| 18 |
+
__uri__ = "https://github.com/pypa/packaging"
|
| 19 |
+
|
| 20 |
+
__version__ = "21.3"
|
| 21 |
+
|
| 22 |
+
__author__ = "Donald Stufft and individual contributors"
|
| 23 |
+
__email__ = "donald@stufft.io"
|
| 24 |
+
|
| 25 |
+
__license__ = "BSD-2-Clause or Apache-2.0"
|
| 26 |
+
__copyright__ = "2014-2019 %s" % __author__
|