ZTWHHH commited on
Commit
b72b75a
·
verified ·
1 Parent(s): 31b8dfb

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/INSTALLER +1 -0
  2. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/LICENSE +201 -0
  3. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/METADATA +375 -0
  4. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/RECORD +173 -0
  5. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/REQUESTED +0 -0
  6. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/WHEEL +5 -0
  7. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/entry_points.txt +6 -0
  8. falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/top_level.txt +1 -0
  9. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/INSTALLER +1 -0
  10. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/LICENSE.TXT +279 -0
  11. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/METADATA +88 -0
  12. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/RECORD +67 -0
  13. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/REQUESTED +0 -0
  14. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/WHEEL +5 -0
  15. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/entry_points.txt +2 -0
  16. falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/top_level.txt +1 -0
  17. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/INSTALLER +1 -0
  18. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/License.txt +1568 -0
  19. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/METADATA +37 -0
  20. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/RECORD +16 -0
  21. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/REQUESTED +0 -0
  22. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/WHEEL +5 -0
  23. falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/top_level.txt +1 -0
  24. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/AUTHORS +98 -0
  25. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/INSTALLER +1 -0
  26. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/LICENSE +20 -0
  27. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/METADATA +37 -0
  28. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/RECORD +30 -0
  29. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/REQUESTED +0 -0
  30. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/WHEEL +6 -0
  31. falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/top_level.txt +1 -0
  32. falcon/lib/python3.10/site-packages/referencing/__init__.py +7 -0
  33. falcon/lib/python3.10/site-packages/referencing/__pycache__/__init__.cpython-310.pyc +0 -0
  34. falcon/lib/python3.10/site-packages/referencing/_attrs.py +31 -0
  35. falcon/lib/python3.10/site-packages/referencing/_attrs.pyi +20 -0
  36. falcon/lib/python3.10/site-packages/referencing/_core.py +729 -0
  37. falcon/lib/python3.10/site-packages/referencing/exceptions.py +165 -0
  38. falcon/lib/python3.10/site-packages/referencing/jsonschema.py +642 -0
  39. falcon/lib/python3.10/site-packages/referencing/py.typed +0 -0
  40. falcon/lib/python3.10/site-packages/referencing/retrieval.py +87 -0
  41. falcon/lib/python3.10/site-packages/referencing/tests/__init__.py +0 -0
  42. falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-310.pyc +0 -0
  43. falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-310.pyc +0 -0
  44. falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-310.pyc +0 -0
  45. falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-310.pyc +0 -0
  46. falcon/lib/python3.10/site-packages/referencing/tests/test_core.py +1057 -0
  47. falcon/lib/python3.10/site-packages/referencing/tests/test_jsonschema.py +382 -0
  48. falcon/lib/python3.10/site-packages/referencing/tests/test_referencing_suite.py +66 -0
  49. falcon/lib/python3.10/site-packages/referencing/tests/test_retrieval.py +106 -0
  50. falcon/lib/python3.10/site-packages/referencing/typing.py +63 -0
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/METADATA ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: accelerate
3
+ Version: 1.2.1
4
+ Summary: Accelerate
5
+ Home-page: https://github.com/huggingface/accelerate
6
+ Author: The HuggingFace team
7
+ Author-email: zach.mueller@huggingface.co
8
+ License: Apache
9
+ Keywords: deep learning
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.9.0
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy<3.0.0,>=1.17
23
+ Requires-Dist: packaging>=20.0
24
+ Requires-Dist: psutil
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: torch>=1.10.0
27
+ Requires-Dist: huggingface-hub>=0.21.0
28
+ Requires-Dist: safetensors>=0.4.3
29
+ Provides-Extra: deepspeed
30
+ Requires-Dist: deepspeed; extra == "deepspeed"
31
+ Provides-Extra: dev
32
+ Requires-Dist: black~=23.1; extra == "dev"
33
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "dev"
34
+ Requires-Dist: ruff~=0.6.4; extra == "dev"
35
+ Requires-Dist: pytest<=8.0.0,>=7.2.0; extra == "dev"
36
+ Requires-Dist: pytest-xdist; extra == "dev"
37
+ Requires-Dist: pytest-subtests; extra == "dev"
38
+ Requires-Dist: parameterized; extra == "dev"
39
+ Requires-Dist: datasets; extra == "dev"
40
+ Requires-Dist: diffusers; extra == "dev"
41
+ Requires-Dist: evaluate; extra == "dev"
42
+ Requires-Dist: torchdata>=0.8.0; extra == "dev"
43
+ Requires-Dist: torchpippy>=0.2.0; extra == "dev"
44
+ Requires-Dist: transformers; extra == "dev"
45
+ Requires-Dist: scipy; extra == "dev"
46
+ Requires-Dist: scikit-learn; extra == "dev"
47
+ Requires-Dist: tqdm; extra == "dev"
48
+ Requires-Dist: bitsandbytes; extra == "dev"
49
+ Requires-Dist: timm; extra == "dev"
50
+ Requires-Dist: rich; extra == "dev"
51
+ Provides-Extra: docs
52
+ Provides-Extra: quality
53
+ Requires-Dist: black~=23.1; extra == "quality"
54
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "quality"
55
+ Requires-Dist: ruff~=0.6.4; extra == "quality"
56
+ Provides-Extra: rich
57
+ Requires-Dist: rich; extra == "rich"
58
+ Provides-Extra: sagemaker
59
+ Requires-Dist: sagemaker; extra == "sagemaker"
60
+ Provides-Extra: test_dev
61
+ Requires-Dist: datasets; extra == "test-dev"
62
+ Requires-Dist: diffusers; extra == "test-dev"
63
+ Requires-Dist: evaluate; extra == "test-dev"
64
+ Requires-Dist: torchdata>=0.8.0; extra == "test-dev"
65
+ Requires-Dist: torchpippy>=0.2.0; extra == "test-dev"
66
+ Requires-Dist: transformers; extra == "test-dev"
67
+ Requires-Dist: scipy; extra == "test-dev"
68
+ Requires-Dist: scikit-learn; extra == "test-dev"
69
+ Requires-Dist: tqdm; extra == "test-dev"
70
+ Requires-Dist: bitsandbytes; extra == "test-dev"
71
+ Requires-Dist: timm; extra == "test-dev"
72
+ Provides-Extra: test_prod
73
+ Requires-Dist: pytest<=8.0.0,>=7.2.0; extra == "test-prod"
74
+ Requires-Dist: pytest-xdist; extra == "test-prod"
75
+ Requires-Dist: pytest-subtests; extra == "test-prod"
76
+ Requires-Dist: parameterized; extra == "test-prod"
77
+ Provides-Extra: test_trackers
78
+ Requires-Dist: wandb; extra == "test-trackers"
79
+ Requires-Dist: comet-ml; extra == "test-trackers"
80
+ Requires-Dist: tensorboard; extra == "test-trackers"
81
+ Requires-Dist: dvclive; extra == "test-trackers"
82
+ Provides-Extra: testing
83
+ Requires-Dist: pytest<=8.0.0,>=7.2.0; extra == "testing"
84
+ Requires-Dist: pytest-xdist; extra == "testing"
85
+ Requires-Dist: pytest-subtests; extra == "testing"
86
+ Requires-Dist: parameterized; extra == "testing"
87
+ Requires-Dist: datasets; extra == "testing"
88
+ Requires-Dist: diffusers; extra == "testing"
89
+ Requires-Dist: evaluate; extra == "testing"
90
+ Requires-Dist: torchdata>=0.8.0; extra == "testing"
91
+ Requires-Dist: torchpippy>=0.2.0; extra == "testing"
92
+ Requires-Dist: transformers; extra == "testing"
93
+ Requires-Dist: scipy; extra == "testing"
94
+ Requires-Dist: scikit-learn; extra == "testing"
95
+ Requires-Dist: tqdm; extra == "testing"
96
+ Requires-Dist: bitsandbytes; extra == "testing"
97
+ Requires-Dist: timm; extra == "testing"
98
+
99
+ <!---
100
+ Copyright 2021 The HuggingFace Team. All rights reserved.
101
+
102
+ Licensed under the Apache License, Version 2.0 (the "License");
103
+ you may not use this file except in compliance with the License.
104
+ You may obtain a copy of the License at
105
+
106
+ http://www.apache.org/licenses/LICENSE-2.0
107
+
108
+ Unless required by applicable law or agreed to in writing, software
109
+ distributed under the License is distributed on an "AS IS" BASIS,
110
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111
+ See the License for the specific language governing permissions and
112
+ limitations under the License.
113
+ -->
114
+
115
+ <p align="center">
116
+ <br>
117
+ <img src="https://raw.githubusercontent.com/huggingface/accelerate/main/docs/source/imgs/accelerate_logo.png" width="400"/>
118
+ <br>
119
+ <p>
120
+
121
+ <p align="center">
122
+ <!-- Uncomment when CircleCI is set up
123
+ <a href="https://circleci.com/gh/huggingface/accelerate"><img alt="Build" src="https://img.shields.io/circleci/build/github/huggingface/transformers/master"></a>
124
+ -->
125
+ <a href="https://github.com/huggingface/accelerate/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/huggingface/accelerate.svg?color=blue"></a>
126
+ <a href="https://huggingface.co/docs/accelerate/index.html"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/accelerate/index.html.svg?down_color=red&down_message=offline&up_message=online"></a>
127
+ <a href="https://github.com/huggingface/accelerate/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/accelerate.svg"></a>
128
+ <a href="https://github.com/huggingface/accelerate/blob/main/CODE_OF_CONDUCT.md"><img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg"></a>
129
+ </p>
130
+
131
+ <h3 align="center">
132
+ <p>Run your *raw* PyTorch training script on any kind of device
133
+ </h3>
134
+
135
+ <h3 align="center">
136
+ <a href="https://hf.co/course"><img src="https://raw.githubusercontent.com/huggingface/accelerate/main/docs/source/imgs/course_banner.png"></a>
137
+ </h3>
138
+
139
+ ## Easy to integrate
140
+
141
+ 🤗 Accelerate was created for PyTorch users who like to write the training loop of PyTorch models but are reluctant to write and maintain the boilerplate code needed to use multi-GPUs/TPU/fp16.
142
+
143
+ 🤗 Accelerate abstracts exactly and only the boilerplate code related to multi-GPUs/TPU/fp16 and leaves the rest of your code unchanged.
144
+
145
+ Here is an example:
146
+
147
+ ```diff
148
+ import torch
149
+ import torch.nn.functional as F
150
+ from datasets import load_dataset
151
+ + from accelerate import Accelerator
152
+
153
+ + accelerator = Accelerator()
154
+ - device = 'cpu'
155
+ + device = accelerator.device
156
+
157
+ model = torch.nn.Transformer().to(device)
158
+ optimizer = torch.optim.Adam(model.parameters())
159
+
160
+ dataset = load_dataset('my_dataset')
161
+ data = torch.utils.data.DataLoader(dataset, shuffle=True)
162
+
163
+ + model, optimizer, data = accelerator.prepare(model, optimizer, data)
164
+
165
+ model.train()
166
+ for epoch in range(10):
167
+ for source, targets in data:
168
+ source = source.to(device)
169
+ targets = targets.to(device)
170
+
171
+ optimizer.zero_grad()
172
+
173
+ output = model(source)
174
+ loss = F.cross_entropy(output, targets)
175
+
176
+ - loss.backward()
177
+ + accelerator.backward(loss)
178
+
179
+ optimizer.step()
180
+ ```
181
+
182
+ As you can see in this example, by adding 5-lines to any standard PyTorch training script you can now run on any kind of single or distributed node setting (single CPU, single GPU, multi-GPUs and TPUs) as well as with or without mixed precision (fp8, fp16, bf16).
183
+
184
+ In particular, the same code can then be run without modification on your local machine for debugging or your training environment.
185
+
186
+ 🤗 Accelerate even handles the device placement for you (which requires a few more changes to your code, but is safer in general), so you can even simplify your training loop further:
187
+
188
+ ```diff
189
+ import torch
190
+ import torch.nn.functional as F
191
+ from datasets import load_dataset
192
+ + from accelerate import Accelerator
193
+
194
+ - device = 'cpu'
195
+ + accelerator = Accelerator()
196
+
197
+ - model = torch.nn.Transformer().to(device)
198
+ + model = torch.nn.Transformer()
199
+ optimizer = torch.optim.Adam(model.parameters())
200
+
201
+ dataset = load_dataset('my_dataset')
202
+ data = torch.utils.data.DataLoader(dataset, shuffle=True)
203
+
204
+ + model, optimizer, data = accelerator.prepare(model, optimizer, data)
205
+
206
+ model.train()
207
+ for epoch in range(10):
208
+ for source, targets in data:
209
+ - source = source.to(device)
210
+ - targets = targets.to(device)
211
+
212
+ optimizer.zero_grad()
213
+
214
+ output = model(source)
215
+ loss = F.cross_entropy(output, targets)
216
+
217
+ - loss.backward()
218
+ + accelerator.backward(loss)
219
+
220
+ optimizer.step()
221
+ ```
222
+
223
+ Want to learn more? Check out the [documentation](https://huggingface.co/docs/accelerate) or have a look at our [examples](https://github.com/huggingface/accelerate/tree/main/examples).
224
+
225
+ ## Launching script
226
+
227
+ 🤗 Accelerate also provides an optional CLI tool that allows you to quickly configure and test your training environment before launching the scripts. No need to remember how to use `torch.distributed.run` or to write a specific launcher for TPU training!
228
+ On your machine(s) just run:
229
+
230
+ ```bash
231
+ accelerate config
232
+ ```
233
+
234
+ and answer the questions asked. This will generate a config file that will be used automatically to properly set the default options when doing
235
+
236
+ ```bash
237
+ accelerate launch my_script.py --args_to_my_script
238
+ ```
239
+
240
+ For instance, here is how you would run the GLUE example on the MRPC task (from the root of the repo):
241
+
242
+ ```bash
243
+ accelerate launch examples/nlp_example.py
244
+ ```
245
+
246
+ This CLI tool is **optional**, and you can still use `python my_script.py` or `python -m torchrun my_script.py` at your convenience.
247
+
248
+ You can also directly pass in the arguments you would to `torchrun` as arguments to `accelerate launch` if you wish to not run` accelerate config`.
249
+
250
+ For example, here is how to launch on two GPUs:
251
+
252
+ ```bash
253
+ accelerate launch --multi_gpu --num_processes 2 examples/nlp_example.py
254
+ ```
255
+
256
+ To learn more, check the CLI documentation available [here](https://huggingface.co/docs/accelerate/package_reference/cli).
257
+
258
+ Or view the configuration zoo [here](https://github.com/huggingface/accelerate/blob/main/examples/config_yaml_templates/)
259
+
260
+ ## Launching multi-CPU run using MPI
261
+
262
+ 🤗 Here is another way to launch multi-CPU run using MPI. You can learn how to install Open MPI on [this page](https://www.open-mpi.org/faq/?category=building#easy-build). You can use Intel MPI or MVAPICH as well.
263
+ Once you have MPI setup on your cluster, just run:
264
+ ```bash
265
+ accelerate config
266
+ ```
267
+ Answer the questions that are asked, selecting to run using multi-CPU, and answer "yes" when asked if you want accelerate to launch mpirun.
268
+ Then, use `accelerate launch` with your script like:
269
+ ```bash
270
+ accelerate launch examples/nlp_example.py
271
+ ```
272
+ Alternatively, you can use mpirun directly, without using the CLI like:
273
+ ```bash
274
+ mpirun -np 2 python examples/nlp_example.py
275
+ ```
276
+
277
+ ## Launching training using DeepSpeed
278
+
279
+ 🤗 Accelerate supports training on single/multiple GPUs using DeepSpeed. To use it, you don't need to change anything in your training code; you can set everything using just `accelerate config`. However, if you desire to tweak your DeepSpeed related args from your Python script, we provide you the `DeepSpeedPlugin`.
280
+
281
+ ```python
282
+ from accelerate import Accelerator, DeepSpeedPlugin
283
+
284
+ # deepspeed needs to know your gradient accumulation steps beforehand, so don't forget to pass it
285
+ # Remember you still need to do gradient accumulation by yourself, just like you would have done without deepspeed
286
+ deepspeed_plugin = DeepSpeedPlugin(zero_stage=2, gradient_accumulation_steps=2)
287
+ accelerator = Accelerator(mixed_precision='fp16', deepspeed_plugin=deepspeed_plugin)
288
+
289
+ # How to save your 🤗 Transformer?
290
+ accelerator.wait_for_everyone()
291
+ unwrapped_model = accelerator.unwrap_model(model)
292
+ unwrapped_model.save_pretrained(save_dir, save_function=accelerator.save, state_dict=accelerator.get_state_dict(model))
293
+ ```
294
+
295
+ Note: DeepSpeed support is experimental for now. In case you get into some problem, please open an issue.
296
+
297
+ ## Launching your training from a notebook
298
+
299
+ 🤗 Accelerate also provides a `notebook_launcher` function you can use in a notebook to launch a distributed training. This is especially useful for Colab or Kaggle notebooks with a TPU backend. Just define your training loop in a `training_function` then in your last cell, add:
300
+
301
+ ```python
302
+ from accelerate import notebook_launcher
303
+
304
+ notebook_launcher(training_function)
305
+ ```
306
+
307
+ An example can be found in [this notebook](https://github.com/huggingface/notebooks/blob/main/examples/accelerate_examples/simple_nlp_example.ipynb). [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/accelerate_examples/simple_nlp_example.ipynb)
308
+
309
+ ## Why should I use 🤗 Accelerate?
310
+
311
+ You should use 🤗 Accelerate when you want to easily run your training scripts in a distributed environment without having to renounce full control over your training loop. This is not a high-level framework above PyTorch, just a thin wrapper so you don't have to learn a new library. In fact, the whole API of 🤗 Accelerate is in one class, the `Accelerator` object.
312
+
313
+ ## Why shouldn't I use 🤗 Accelerate?
314
+
315
+ You shouldn't use 🤗 Accelerate if you don't want to write a training loop yourself. There are plenty of high-level libraries above PyTorch that will offer you that, 🤗 Accelerate is not one of them.
316
+
317
+ ## Frameworks using 🤗 Accelerate
318
+
319
+ If you like the simplicity of 🤗 Accelerate but would prefer a higher-level abstraction around its capabilities, some frameworks and libraries that are built on top of 🤗 Accelerate are listed below:
320
+
321
+ * [Amphion](https://github.com/open-mmlab/Amphion) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.
322
+ * [Animus](https://github.com/Scitator/animus) is a minimalistic framework to run machine learning experiments. Animus highlights common "breakpoints" in ML experiments and provides a unified interface for them within [IExperiment](https://github.com/Scitator/animus/blob/main/animus/core.py#L76).
323
+ * [Catalyst](https://github.com/catalyst-team/catalyst#getting-started) is a PyTorch framework for Deep Learning Research and Development. It focuses on reproducibility, rapid experimentation, and codebase reuse so you can create something new rather than write yet another train loop. Catalyst provides a [Runner](https://catalyst-team.github.io/catalyst/api/core.html#runner) to connect all parts of the experiment: hardware backend, data transformations, model training, and inference logic.
324
+ * [fastai](https://github.com/fastai/fastai#installing) is a PyTorch framework for Deep Learning that simplifies training fast and accurate neural nets using modern best practices. fastai provides a [Learner](https://docs.fast.ai/learner.html#Learner) to handle the training, fine-tuning, and inference of deep learning algorithms.
325
+ * [Finetuner](https://github.com/jina-ai/finetuner) is a service that enables models to create higher-quality embeddings for semantic search, visual similarity search, cross-modal text<->image search, recommendation systems, clustering, duplication detection, anomaly detection, or other uses.
326
+ * [InvokeAI](https://github.com/invoke-ai/InvokeAI) is a creative engine for Stable Diffusion models, offering industry-leading WebUI, terminal usage support, and serves as the foundation for many commercial products.
327
+ * [Kornia](https://kornia.readthedocs.io/en/latest/get-started/introduction.html) is a differentiable library that allows classical computer vision to be integrated into deep learning models. Kornia provides a [Trainer](https://kornia.readthedocs.io/en/latest/x.html#kornia.x.Trainer) with the specific purpose to train and fine-tune the supported deep learning algorithms within the library.
328
+ * [Open Assistant](https://projects.laion.ai/Open-Assistant/) is a chat-based assistant that understands tasks, can interact with their party systems, and retrieve information dynamically to do so.
329
+ * [pytorch-accelerated](https://github.com/Chris-hughes10/pytorch-accelerated) is a lightweight training library, with a streamlined feature set centered around a general-purpose [Trainer](https://pytorch-accelerated.readthedocs.io/en/latest/trainer.html), that places a huge emphasis on simplicity and transparency; enabling users to understand exactly what is going on under the hood, but without having to write and maintain the boilerplate themselves!
330
+ * [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) is an open-source browser-based easy-to-use interface based on the Gradio library for Stable Diffusion.
331
+ * [torchkeras](https://github.com/lyhue1991/torchkeras) is a simple tool for training pytorch model just in a keras style, a dynamic and beautiful plot is provided in notebook to monitor your loss or metric.
332
+ * [transformers](https://github.com/huggingface/transformers) as a tool for helping train state-of-the-art machine learning models in PyTorch, Tensorflow, and JAX. (Accelerate is the backend for the PyTorch side).
333
+
334
+
335
+ ## Installation
336
+
337
+ This repository is tested on Python 3.8+ and PyTorch 1.10.0+
338
+
339
+ You should install 🤗 Accelerate in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, check out the [user guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
340
+
341
+ First, create a virtual environment with the version of Python you're going to use and activate it.
342
+
343
+ Then, you will need to install PyTorch: refer to the [official installation page](https://pytorch.org/get-started/locally/#start-locally) regarding the specific install command for your platform. Then 🤗 Accelerate can be installed using pip as follows:
344
+
345
+ ```bash
346
+ pip install accelerate
347
+ ```
348
+
349
+ ## Supported integrations
350
+
351
+ - CPU only
352
+ - multi-CPU on one node (machine)
353
+ - multi-CPU on several nodes (machines)
354
+ - single GPU
355
+ - multi-GPU on one node (machine)
356
+ - multi-GPU on several nodes (machines)
357
+ - TPU
358
+ - FP16/BFloat16 mixed precision
359
+ - FP8 mixed precision with [Transformer Engine](https://github.com/NVIDIA/TransformerEngine) or [MS-AMP](https://github.com/Azure/MS-AMP/)
360
+ - DeepSpeed support (Experimental)
361
+ - PyTorch Fully Sharded Data Parallel (FSDP) support (Experimental)
362
+ - Megatron-LM support (Experimental)
363
+
364
+ ## Citing 🤗 Accelerate
365
+
366
+ If you use 🤗 Accelerate in your publication, please cite it by using the following BibTeX entry.
367
+
368
+ ```bibtex
369
+ @Misc{accelerate,
370
+ title = {Accelerate: Training and inference at scale made simple, efficient and adaptable.},
371
+ author = {Sylvain Gugger and Lysandre Debut and Thomas Wolf and Philipp Schmid and Zachary Mueller and Sourab Mangrulkar and Marc Sun and Benjamin Bossan},
372
+ howpublished = {\url{https://github.com/huggingface/accelerate}},
373
+ year = {2022}
374
+ }
375
+ ```
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/RECORD ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ../../../bin/accelerate,sha256=GPgTNrp3Cbc22O69wctpf3CgRyRCPE_Wa98Pk-0zdrw,245
2
+ ../../../bin/accelerate-config,sha256=scgzoHj1kduB8CZKCLjCmz2mxkPm37IDJY-zIVnvPTc,237
3
+ ../../../bin/accelerate-estimate-memory,sha256=wMP7Wi916wmE0YiuVQceBcvdVbb39viP39-Ni4TUMhw,239
4
+ ../../../bin/accelerate-launch,sha256=5GEhsIAyjgNfOA-5qvMiuPd_Yp0mvwEgz2-RJ2skCCE,237
5
+ ../../../bin/accelerate-merge-weights,sha256=VN5TBczUixe6Z0mnYSOT1gCTYILgEMYT60B_NFXiiXg,236
6
+ accelerate-1.2.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
7
+ accelerate-1.2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ accelerate-1.2.1.dist-info/METADATA,sha256=fNLbXzvJfyB5uEpohux1coAc5rA_VpDu9RrOHlVffjQ,19178
9
+ accelerate-1.2.1.dist-info/RECORD,,
10
+ accelerate-1.2.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ accelerate-1.2.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
12
+ accelerate-1.2.1.dist-info/entry_points.txt,sha256=Vpy8gUGfZ-1VnM2229fb8CpJNLBdMH_wtJ9PQ7b_2tQ,296
13
+ accelerate-1.2.1.dist-info/top_level.txt,sha256=esVfdxTidsjQ90zsN_rPpjLFJ4ijRlx4mnLrG09hlt4,11
14
+ accelerate/__init__.py,sha256=4ht0Ky7GWh9OVs3YLKPUShdq7paA-vKk2qH8YsWlTYo,1504
15
+ accelerate/__pycache__/__init__.cpython-310.pyc,,
16
+ accelerate/__pycache__/accelerator.cpython-310.pyc,,
17
+ accelerate/__pycache__/big_modeling.cpython-310.pyc,,
18
+ accelerate/__pycache__/checkpointing.cpython-310.pyc,,
19
+ accelerate/__pycache__/data_loader.cpython-310.pyc,,
20
+ accelerate/__pycache__/hooks.cpython-310.pyc,,
21
+ accelerate/__pycache__/inference.cpython-310.pyc,,
22
+ accelerate/__pycache__/launchers.cpython-310.pyc,,
23
+ accelerate/__pycache__/local_sgd.cpython-310.pyc,,
24
+ accelerate/__pycache__/logging.cpython-310.pyc,,
25
+ accelerate/__pycache__/memory_utils.cpython-310.pyc,,
26
+ accelerate/__pycache__/optimizer.cpython-310.pyc,,
27
+ accelerate/__pycache__/scheduler.cpython-310.pyc,,
28
+ accelerate/__pycache__/state.cpython-310.pyc,,
29
+ accelerate/__pycache__/tracking.cpython-310.pyc,,
30
+ accelerate/accelerator.py,sha256=zw8FuMyzBDokxc7YUtZWvOLyxYG1CcSzFd3Aiiy-clI,161482
31
+ accelerate/big_modeling.py,sha256=hn8R3_z3yvEizHuLrARWqTU_vx4M_gb0ehmDVpJPhBs,29758
32
+ accelerate/checkpointing.py,sha256=PUL5cBbFFR0AO1Y0OyXCzqSmZ5vaUaceGeDnWmTQk-U,13002
33
+ accelerate/commands/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
34
+ accelerate/commands/__pycache__/__init__.cpython-310.pyc,,
35
+ accelerate/commands/__pycache__/accelerate_cli.cpython-310.pyc,,
36
+ accelerate/commands/__pycache__/env.cpython-310.pyc,,
37
+ accelerate/commands/__pycache__/estimate.cpython-310.pyc,,
38
+ accelerate/commands/__pycache__/launch.cpython-310.pyc,,
39
+ accelerate/commands/__pycache__/merge.cpython-310.pyc,,
40
+ accelerate/commands/__pycache__/test.cpython-310.pyc,,
41
+ accelerate/commands/__pycache__/tpu.cpython-310.pyc,,
42
+ accelerate/commands/__pycache__/utils.cpython-310.pyc,,
43
+ accelerate/commands/accelerate_cli.py,sha256=aaqbgTuvtj0N4FPFI0KBpPTiVtWTPUWSlbSBzsy58l8,1856
44
+ accelerate/commands/config/__init__.py,sha256=iJK8dgj3pc5Vdr1E7UuGoFu-BlybyXLxYDoTg9gXngE,1645
45
+ accelerate/commands/config/__pycache__/__init__.cpython-310.pyc,,
46
+ accelerate/commands/config/__pycache__/cluster.cpython-310.pyc,,
47
+ accelerate/commands/config/__pycache__/config.cpython-310.pyc,,
48
+ accelerate/commands/config/__pycache__/config_args.cpython-310.pyc,,
49
+ accelerate/commands/config/__pycache__/config_utils.cpython-310.pyc,,
50
+ accelerate/commands/config/__pycache__/default.cpython-310.pyc,,
51
+ accelerate/commands/config/__pycache__/sagemaker.cpython-310.pyc,,
52
+ accelerate/commands/config/__pycache__/update.cpython-310.pyc,,
53
+ accelerate/commands/config/cluster.py,sha256=n1HGGAN0VVVX1yHONf0xgO6LZ5ZBpou_xfmvPOnItIM,35700
54
+ accelerate/commands/config/config.py,sha256=FuRlQvOjgATEtyqOSsGD-KEtOCvACOHjs2C-krrtldk,3035
55
+ accelerate/commands/config/config_args.py,sha256=-fPg3nj4F_6Bp87dHS25fF6_3U2vP2rzllSd1Mj3TSw,9976
56
+ accelerate/commands/config/config_utils.py,sha256=beW-Hc-ka1NqSfId73L9ThnMxUf7K9otXsuxIuif9-A,3141
57
+ accelerate/commands/config/default.py,sha256=GI7Q9Asy7Cr81ditzNA6hOjIf6doinynz6-cO0GZwZ4,5705
58
+ accelerate/commands/config/sagemaker.py,sha256=GjHE2-h4tRr1P_PFtMF3miiAtJlzkbHbMb6kFXqn8eo,10341
59
+ accelerate/commands/config/update.py,sha256=NXW1J7GkUHpg71QlIXsmMB_0z8S8IZo2FWax5POwrhc,2395
60
+ accelerate/commands/env.py,sha256=VrG8ufBRMfP0R3sLyN0c8Fe3iPhyqGvLNKtQHX_uGBQ,3871
61
+ accelerate/commands/estimate.py,sha256=Ro0jeYOQPlQdR1XjqrUaUpyGFiUpX0cfW-pTgUwio1Q,12409
62
+ accelerate/commands/launch.py,sha256=637e9E68218PupSngacKKIX6kxWtM2spjMh5r8p792U,45429
63
+ accelerate/commands/menu/__init__.py,sha256=uqSlBM0TFHBwzdv3p3SXfpAk1lZFp4h1a7mbBdscPHs,645
64
+ accelerate/commands/menu/__pycache__/__init__.cpython-310.pyc,,
65
+ accelerate/commands/menu/__pycache__/cursor.cpython-310.pyc,,
66
+ accelerate/commands/menu/__pycache__/helpers.cpython-310.pyc,,
67
+ accelerate/commands/menu/__pycache__/input.cpython-310.pyc,,
68
+ accelerate/commands/menu/__pycache__/keymap.cpython-310.pyc,,
69
+ accelerate/commands/menu/__pycache__/selection_menu.cpython-310.pyc,,
70
+ accelerate/commands/menu/cursor.py,sha256=-lmpJVAzvNc0c3EOtSuLoKB59zqylVCbYyWLPnrOmvQ,2028
71
+ accelerate/commands/menu/helpers.py,sha256=KrSB5fJjH4MUEUAQJ6bYaN16AYcnl9UalDrPD3DYeeg,1483
72
+ accelerate/commands/menu/input.py,sha256=Uj9eDp8-Mb0Fe49nuogqo9W_RCfYd6udfjiPKx7Wjmg,2537
73
+ accelerate/commands/menu/keymap.py,sha256=eXj-suyYs1m5dEHoUKN4mKAMLc8DWHnwhP6G6JSU0jQ,4086
74
+ accelerate/commands/menu/selection_menu.py,sha256=bxy-DHaKKC6SCToOlMBv5_z0MdUzylEg6Sio9OuV3GM,4921
75
+ accelerate/commands/merge.py,sha256=quDKckN3vKn9nsGjdwfoojnfTMFdKRRUkY1DYuuNNmc,2388
76
+ accelerate/commands/test.py,sha256=YrPYEaAACOGZ6btn2MV6NbMSEdBUcMWADLbQWaZSHtk,2149
77
+ accelerate/commands/tpu.py,sha256=KyxDP7IuveidZrbW4rx2s8Ku3o_ptI6tzwr_R7ck0os,5548
78
+ accelerate/commands/utils.py,sha256=ilcfE32oHh28EToM00nc_SR6upfZiuxUI0AjjZu8KYY,3995
79
+ accelerate/data_loader.py,sha256=fPag1dn23dtlZYZSwfSG8XwSAKZPloSSPNPbz4Os7Kk,58955
80
+ accelerate/hooks.py,sha256=uwCizAOaYROLK_LdifR9ai2FrF7WMgzudrKOY5TmGIs,31732
81
+ accelerate/inference.py,sha256=LdFo8N0ivRxYrzrCXQN6oPFzyaRyxmHZ55eJaKOH9cM,7687
82
+ accelerate/launchers.py,sha256=g7RBD9QRSsIJBYLaCmaIjVXHKeiSIvgq2TOW0q9R9z0,13763
83
+ accelerate/local_sgd.py,sha256=33g8YE1FFJ9CZAhWHReczGZ2CLu-7f817VECzjMCNMg,4081
84
+ accelerate/logging.py,sha256=4XcgY_BV7Qn_enh2tZ-8fNtuaE_3n-LsYJbgwhRx_PI,5042
85
+ accelerate/memory_utils.py,sha256=3R5LoeHl6GgTZ-IMPrDZMdaEehWarGdPqODushb-6pg,862
86
+ accelerate/optimizer.py,sha256=QfgCkQ5dA-fLSi_Z7CBPRCObXA1rL9zxHg4tyKCEg2A,8113
87
+ accelerate/scheduler.py,sha256=des_4M_Tt1W8gCYZZbLla0GHBEgJY3Wx2EGBQPTzeiY,4238
88
+ accelerate/state.py,sha256=6jOGPqHUyjrGCfaWdVgBrPLz3Y8p2Brm0FlhKXAdMrw,52098
89
+ accelerate/test_utils/__init__.py,sha256=OuXzYTvyikwGYXkN_Jc7HVnYG8RlLQojOGlsZ0i2KYI,1559
90
+ accelerate/test_utils/__pycache__/__init__.cpython-310.pyc,,
91
+ accelerate/test_utils/__pycache__/examples.cpython-310.pyc,,
92
+ accelerate/test_utils/__pycache__/testing.cpython-310.pyc,,
93
+ accelerate/test_utils/__pycache__/training.cpython-310.pyc,,
94
+ accelerate/test_utils/examples.py,sha256=jRm1S9TkmeoLaqprBvtVFN4LesiaDZtKMNIoLNY2euw,7281
95
+ accelerate/test_utils/scripts/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
96
+ accelerate/test_utils/scripts/__pycache__/__init__.cpython-310.pyc,,
97
+ accelerate/test_utils/scripts/__pycache__/test_cli.cpython-310.pyc,,
98
+ accelerate/test_utils/scripts/__pycache__/test_ddp_comm_hook.cpython-310.pyc,,
99
+ accelerate/test_utils/scripts/__pycache__/test_distributed_data_loop.cpython-310.pyc,,
100
+ accelerate/test_utils/scripts/__pycache__/test_merge_weights.cpython-310.pyc,,
101
+ accelerate/test_utils/scripts/__pycache__/test_notebook.cpython-310.pyc,,
102
+ accelerate/test_utils/scripts/__pycache__/test_ops.cpython-310.pyc,,
103
+ accelerate/test_utils/scripts/__pycache__/test_script.cpython-310.pyc,,
104
+ accelerate/test_utils/scripts/__pycache__/test_sync.cpython-310.pyc,,
105
+ accelerate/test_utils/scripts/external_deps/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
106
+ accelerate/test_utils/scripts/external_deps/__pycache__/__init__.cpython-310.pyc,,
107
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_checkpointing.cpython-310.pyc,,
108
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_ds_multiple_model.cpython-310.pyc,,
109
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_metrics.cpython-310.pyc,,
110
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_peak_memory_usage.cpython-310.pyc,,
111
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_performance.cpython-310.pyc,,
112
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_pippy.cpython-310.pyc,,
113
+ accelerate/test_utils/scripts/external_deps/__pycache__/test_zero3_integration.cpython-310.pyc,,
114
+ accelerate/test_utils/scripts/external_deps/test_checkpointing.py,sha256=GukYgSZClft38oMlIh-K9bjkT1BAP-SnRp2Q673BmgQ,10699
115
+ accelerate/test_utils/scripts/external_deps/test_ds_multiple_model.py,sha256=Cg4-h0B4UcOQ5CxXjIdrsPVR5fFsWCv24DqZGjXEwW8,13790
116
+ accelerate/test_utils/scripts/external_deps/test_metrics.py,sha256=UIvyYY6uQq6GK_QZTkOiIYF31qFITzARjNct79rsc50,12164
117
+ accelerate/test_utils/scripts/external_deps/test_peak_memory_usage.py,sha256=ggwLWntGfA0in1Qo1OdlvYV7LA1l4Sjn3GX9ULWGddk,11536
118
+ accelerate/test_utils/scripts/external_deps/test_performance.py,sha256=-fQ_OLKSgMrCtBgT1qJufQHom8lXsTwZVDKEuoR3TZc,10120
119
+ accelerate/test_utils/scripts/external_deps/test_pippy.py,sha256=-nvZsNOe8UEjmAF-hTS1dQBfbPcNpcuvIH6sPNYJ4to,4670
120
+ accelerate/test_utils/scripts/external_deps/test_zero3_integration.py,sha256=lXWL9hUE1N7TNDQP5UTSALZVTHvdHs-Blimp18nuUac,1575
121
+ accelerate/test_utils/scripts/test_cli.py,sha256=qfk1aYFtdvYFCYPkl05602SNGvk08QTv0xZVVcFVtzM,833
122
+ accelerate/test_utils/scripts/test_ddp_comm_hook.py,sha256=3tq_XA0t64GzzqQ818kOy7q86VlR0ibVhd9FsVOQxTk,3153
123
+ accelerate/test_utils/scripts/test_distributed_data_loop.py,sha256=4jrjyq9URiKrxN119FNssfbPV6iHpLKwnHMTbuolnDU,15090
124
+ accelerate/test_utils/scripts/test_merge_weights.py,sha256=DsbcNX_yxKdP9--YexlVjMyT36_7CA_hwieBd5ZbDGs,6054
125
+ accelerate/test_utils/scripts/test_notebook.py,sha256=qfIy3IvH74-kGn8nadBn_k7qrviqvsxy5ijsnUhuY6o,3894
126
+ accelerate/test_utils/scripts/test_ops.py,sha256=1kQxHkLu16lT17Xj7C666BUG-G1u8rdI59c3taFK2tM,6204
127
+ accelerate/test_utils/scripts/test_script.py,sha256=6OY3y2JlkCcOyFgTaBeYmNFeXb4Rcu1TPOr98b1IMnk,34253
128
+ accelerate/test_utils/scripts/test_sync.py,sha256=GrYmYWxR06O7_aG_QAsEzuKvAQX_sXsg_-RhfppYy4g,18602
129
+ accelerate/test_utils/testing.py,sha256=vk4MZT_CGwxhPcmS50Glu_IQFyoW8V1IwQS0aaBT9JM,23456
130
+ accelerate/test_utils/training.py,sha256=8k_YAQ21MzUdb2aFWq1t2fihW1b-iBGh1OJSL3whY68,4019
131
+ accelerate/tracking.py,sha256=WLY-H1DTsxrz4BVzle7QZMp0Irg84yFMbA1e6JaY3pM,39789
132
+ accelerate/utils/__init__.py,sha256=w2XQxUqMc5nHSS2yHFXkdoKl09oWi-Bcg5MvNmxSJMs,7263
133
+ accelerate/utils/__pycache__/__init__.cpython-310.pyc,,
134
+ accelerate/utils/__pycache__/bnb.cpython-310.pyc,,
135
+ accelerate/utils/__pycache__/constants.cpython-310.pyc,,
136
+ accelerate/utils/__pycache__/dataclasses.cpython-310.pyc,,
137
+ accelerate/utils/__pycache__/deepspeed.cpython-310.pyc,,
138
+ accelerate/utils/__pycache__/environment.cpython-310.pyc,,
139
+ accelerate/utils/__pycache__/fsdp_utils.cpython-310.pyc,,
140
+ accelerate/utils/__pycache__/imports.cpython-310.pyc,,
141
+ accelerate/utils/__pycache__/launch.cpython-310.pyc,,
142
+ accelerate/utils/__pycache__/megatron_lm.cpython-310.pyc,,
143
+ accelerate/utils/__pycache__/memory.cpython-310.pyc,,
144
+ accelerate/utils/__pycache__/modeling.cpython-310.pyc,,
145
+ accelerate/utils/__pycache__/offload.cpython-310.pyc,,
146
+ accelerate/utils/__pycache__/operations.cpython-310.pyc,,
147
+ accelerate/utils/__pycache__/other.cpython-310.pyc,,
148
+ accelerate/utils/__pycache__/random.cpython-310.pyc,,
149
+ accelerate/utils/__pycache__/rich.cpython-310.pyc,,
150
+ accelerate/utils/__pycache__/torch_xla.cpython-310.pyc,,
151
+ accelerate/utils/__pycache__/tqdm.cpython-310.pyc,,
152
+ accelerate/utils/__pycache__/transformer_engine.cpython-310.pyc,,
153
+ accelerate/utils/__pycache__/versions.cpython-310.pyc,,
154
+ accelerate/utils/bnb.py,sha256=3i59dy8EcBYJEnT2alJ5_M-zeIpFsrceQ4bImiJJKOk,20570
155
+ accelerate/utils/constants.py,sha256=wTMK0MHmNTEquQEP-KR7daUPd6WQlNBHk3dSv2cj1KA,3032
156
+ accelerate/utils/dataclasses.py,sha256=nbETUDHoAowHWNynHEoRoeBVlwBTMoX5YXgDwkjzY4M,120386
157
+ accelerate/utils/deepspeed.py,sha256=NMRMHcc56dO9AbFPYKhrHo3HEMvVyCEEaIu1ldg8HRg,13300
158
+ accelerate/utils/environment.py,sha256=5FEX5DH0nEqSKp12NpJO_v6bCNVYUyLhlFS0RKV5AZM,14729
159
+ accelerate/utils/fsdp_utils.py,sha256=1kel83Xrp65Q-MAyombm1OfgSvl7VsVejBuX9uJiLzM,18177
160
+ accelerate/utils/imports.py,sha256=0TWsPqUbeQqRcfFqUVJD7sUwEPq5JKmOihCICGLIG8I,14019
161
+ accelerate/utils/launch.py,sha256=U-SrduXgI366tk9BZS6ywpmfqFEyQ1VlVf86QFRrPuc,29533
162
+ accelerate/utils/megatron_lm.py,sha256=L8dAqLeVf7XjjX4VH1jQKk1gBYaVpnEdo6M3MQ8CWkI,58087
163
+ accelerate/utils/memory.py,sha256=jYGcK70LAruVoD-faXr5GVF6vuIOFsCdfnSgWSD9bPo,5939
164
+ accelerate/utils/modeling.py,sha256=JHX_hSX8rWcEMRxT2PHY5B9Gue6pKliI1I-d1WsaRwk,92691
165
+ accelerate/utils/offload.py,sha256=qjaVai81wbkA0YH2WkmOXvZT0BRphygfRV_4Ua4j4U4,7837
166
+ accelerate/utils/operations.py,sha256=eyaf1s5f6kkDTX_wGaxFOXQJaeaD8LArtxXDwyLA2Wc,31380
167
+ accelerate/utils/other.py,sha256=5oGbDA_1z2Qq2cFpVexKqzKm4-dc1hWCBkpSQOomEDU,12365
168
+ accelerate/utils/random.py,sha256=ssRk26FiM0f2yMiBIwpDkdH5STCsD_WelZDoEGObDis,5373
169
+ accelerate/utils/rich.py,sha256=8JZX_uGMQX-BufdXxJpdne7BWd1KyLHSgbiGxrDMYr8,847
170
+ accelerate/utils/torch_xla.py,sha256=Pq1tuqN0X_pWDVza6YgjfO45uoJdoRVRForLeLQzFus,1908
171
+ accelerate/utils/tqdm.py,sha256=k8e9JnieTEQHCCNBaiBys7hPxWlEbyRASdIma-qy_X8,1657
172
+ accelerate/utils/transformer_engine.py,sha256=b7x4Y9DKcgNNVAJzPiryxWlhvRExZfIW2Y0qEErGzms,5883
173
+ accelerate/utils/versions.py,sha256=UgmcbjBm--6CIx1ZamSAMjAK_B_2l48LbeaNygqej8M,2149
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.44.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/entry_points.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ [console_scripts]
2
+ accelerate = accelerate.commands.accelerate_cli:main
3
+ accelerate-config = accelerate.commands.config:main
4
+ accelerate-estimate-memory = accelerate.commands.estimate:main
5
+ accelerate-launch = accelerate.commands.launch:main
6
+ accelerate-merge-weights = accelerate.commands.merge:main
falcon/lib/python3.10/site-packages/accelerate-1.2.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ accelerate
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/LICENSE.TXT ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ==============================================================================
2
+ The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
3
+ ==============================================================================
4
+
5
+ Apache License
6
+ Version 2.0, January 2004
7
+ http://www.apache.org/licenses/
8
+
9
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
+
11
+ 1. Definitions.
12
+
13
+ "License" shall mean the terms and conditions for use, reproduction,
14
+ and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ "Licensor" shall mean the copyright owner or entity authorized by
17
+ the copyright owner that is granting the License.
18
+
19
+ "Legal Entity" shall mean the union of the acting entity and all
20
+ other entities that control, are controlled by, or are under common
21
+ control with that entity. For the purposes of this definition,
22
+ "control" means (i) the power, direct or indirect, to cause the
23
+ direction or management of such entity, whether by contract or
24
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
25
+ outstanding shares, or (iii) beneficial ownership of such entity.
26
+
27
+ "You" (or "Your") shall mean an individual or Legal Entity
28
+ exercising permissions granted by this License.
29
+
30
+ "Source" form shall mean the preferred form for making modifications,
31
+ including but not limited to software source code, documentation
32
+ source, and configuration files.
33
+
34
+ "Object" form shall mean any form resulting from mechanical
35
+ transformation or translation of a Source form, including but
36
+ not limited to compiled object code, generated documentation,
37
+ and conversions to other media types.
38
+
39
+ "Work" shall mean the work of authorship, whether in Source or
40
+ Object form, made available under the License, as indicated by a
41
+ copyright notice that is included in or attached to the work
42
+ (an example is provided in the Appendix below).
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object
45
+ form, that is based on (or derived from) the Work and for which the
46
+ editorial revisions, annotations, elaborations, or other modifications
47
+ represent, as a whole, an original work of authorship. For the purposes
48
+ of this License, Derivative Works shall not include works that remain
49
+ separable from, or merely link (or bind by name) to the interfaces of,
50
+ the Work and Derivative Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including
53
+ the original version of the Work and any modifications or additions
54
+ to that Work or Derivative Works thereof, that is intentionally
55
+ submitted to Licensor for inclusion in the Work by the copyright owner
56
+ or by an individual or Legal Entity authorized to submit on behalf of
57
+ the copyright owner. For the purposes of this definition, "submitted"
58
+ means any form of electronic, verbal, or written communication sent
59
+ to the Licensor or its representatives, including but not limited to
60
+ communication on electronic mailing lists, source code control systems,
61
+ and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but
63
+ excluding communication that is conspicuously marked or otherwise
64
+ designated in writing by the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
138
+ Notwithstanding the above, nothing herein shall supersede or modify
139
+ the terms of any separate license agreement you may have executed
140
+ with Licensor regarding such Contributions.
141
+
142
+ 6. Trademarks. This License does not grant permission to use the trade
143
+ names, trademarks, service marks, or product names of the Licensor,
144
+ except as required for reasonable and customary use in describing the
145
+ origin of the Work and reproducing the content of the NOTICE file.
146
+
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+
157
+ 8. Limitation of Liability. In no event and under no legal theory,
158
+ whether in tort (including negligence), contract, or otherwise,
159
+ unless required by applicable law (such as deliberate and grossly
160
+ negligent acts) or agreed to in writing, shall any Contributor be
161
+ liable to You for damages, including any direct, indirect, special,
162
+ incidental, or consequential damages of any character arising as a
163
+ result of this License or out of the use or inability to use the
164
+ Work (including but not limited to damages for loss of goodwill,
165
+ work stoppage, computer failure or malfunction, or any and all
166
+ other commercial damages or losses), even if such Contributor
167
+ has been advised of the possibility of such damages.
168
+
169
+ 9. Accepting Warranty or Additional Liability. While redistributing
170
+ the Work or Derivative Works thereof, You may choose to offer,
171
+ and charge a fee for, acceptance of support, warranty, indemnity,
172
+ or other liability obligations and/or rights consistent with this
173
+ License. However, in accepting such obligations, You may act only
174
+ on Your own behalf and on Your sole responsibility, not on behalf
175
+ of any other Contributor, and only if You agree to indemnify,
176
+ defend, and hold each Contributor harmless for any liability
177
+ incurred by, or claims asserted against, such Contributor by reason
178
+ of your accepting any such warranty or additional liability.
179
+
180
+ END OF TERMS AND CONDITIONS
181
+
182
+ APPENDIX: How to apply the Apache License to your work.
183
+
184
+ To apply the Apache License to your work, attach the following
185
+ boilerplate notice, with the fields enclosed by brackets "[]"
186
+ replaced with your own identifying information. (Don't include
187
+ the brackets!) The text should be enclosed in the appropriate
188
+ comment syntax for the file format. We also recommend that a
189
+ file or class name and description of purpose be included on the
190
+ same "printed page" as the copyright notice for easier
191
+ identification within third-party archives.
192
+
193
+ Copyright [yyyy] [name of copyright owner]
194
+
195
+ Licensed under the Apache License, Version 2.0 (the "License");
196
+ you may not use this file except in compliance with the License.
197
+ You may obtain a copy of the License at
198
+
199
+ http://www.apache.org/licenses/LICENSE-2.0
200
+
201
+ Unless required by applicable law or agreed to in writing, software
202
+ distributed under the License is distributed on an "AS IS" BASIS,
203
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
+ See the License for the specific language governing permissions and
205
+ limitations under the License.
206
+
207
+
208
+ ---- LLVM Exceptions to the Apache 2.0 License ----
209
+
210
+ As an exception, if, as a result of your compiling your source code, portions
211
+ of this Software are embedded into an Object form of such source code, you
212
+ may redistribute such embedded portions in such Object form without complying
213
+ with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
214
+
215
+ In addition, if you combine or link compiled forms of this Software with
216
+ software that is licensed under the GPLv2 ("Combined Software") and if a
217
+ court of competent jurisdiction determines that the patent provision (Section
218
+ 3), the indemnity provision (Section 9) or other Section of the License
219
+ conflicts with the conditions of the GPLv2, you may retroactively and
220
+ prospectively choose to deem waived or otherwise exclude such Section(s) of
221
+ the License, but only in their entirety and only with respect to the Combined
222
+ Software.
223
+
224
+ ==============================================================================
225
+ Software from third parties included in the LLVM Project:
226
+ ==============================================================================
227
+ The LLVM Project contains third party software which is under different license
228
+ terms. All such code will be identified clearly using at least one of two
229
+ mechanisms:
230
+ 1) It will be in a separate directory tree with its own `LICENSE.txt` or
231
+ `LICENSE` file at the top containing the specific license and restrictions
232
+ which apply to that software, or
233
+ 2) It will contain specific license and restriction terms at the top of every
234
+ file.
235
+
236
+ ==============================================================================
237
+ Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
238
+ ==============================================================================
239
+ University of Illinois/NCSA
240
+ Open Source License
241
+
242
+ Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
243
+ All rights reserved.
244
+
245
+ Developed by:
246
+
247
+ LLVM Team
248
+
249
+ University of Illinois at Urbana-Champaign
250
+
251
+ http://llvm.org
252
+
253
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
254
+ this software and associated documentation files (the "Software"), to deal with
255
+ the Software without restriction, including without limitation the rights to
256
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
257
+ of the Software, and to permit persons to whom the Software is furnished to do
258
+ so, subject to the following conditions:
259
+
260
+ * Redistributions of source code must retain the above copyright notice,
261
+ this list of conditions and the following disclaimers.
262
+
263
+ * Redistributions in binary form must reproduce the above copyright notice,
264
+ this list of conditions and the following disclaimers in the
265
+ documentation and/or other materials provided with the distribution.
266
+
267
+ * Neither the names of the LLVM Team, University of Illinois at
268
+ Urbana-Champaign, nor the names of its contributors may be used to
269
+ endorse or promote products derived from this Software without specific
270
+ prior written permission.
271
+
272
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
273
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
274
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
275
+ CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
276
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
277
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
278
+ SOFTWARE.
279
+
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/METADATA ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: lit
3
+ Version: 18.1.8
4
+ Summary: A Software Testing Tool
5
+ Home-page: http://llvm.org
6
+ Author: Daniel Dunbar
7
+ Author-email: daniel@minormatter.com
8
+ License: Apache-2.0 with LLVM exception
9
+ Keywords: test C++ automatic discovery
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Topic :: Software Development :: Testing
18
+ License-File: LICENSE.TXT
19
+
20
+ ===============================
21
+ lit - A Software Testing Tool
22
+ ===============================
23
+
24
+ About
25
+ =====
26
+
27
+ *lit* is a portable tool for executing LLVM and Clang style test suites,
28
+ summarizing their results, and providing indication of failures. *lit* is
29
+ designed to be a lightweight testing tool with as simple a user interface as
30
+ possible.
31
+
32
+
33
+ Features
34
+ ========
35
+
36
+ * Portable!
37
+ * Flexible test discovery.
38
+ * Parallel test execution.
39
+ * Support for multiple test formats and test suite designs.
40
+
41
+
42
+ Documentation
43
+ =============
44
+
45
+ The official *lit* documentation is in the man page, available online at the LLVM
46
+ Command Guide: http://llvm.org/cmds/lit.html.
47
+
48
+
49
+ Source
50
+ ======
51
+
52
+ The *lit* source is available as part of LLVM, in the LLVM source repository:
53
+ https://github.com/llvm/llvm-project/tree/main/llvm/utils/lit
54
+
55
+
56
+ Contributing to lit
57
+ ===================
58
+
59
+ Please browse the issues labeled *tools:llvm-lit* in LLVM's issue tracker for
60
+ ideas on what to work on:
61
+ https://github.com/llvm/llvm-project/labels/tools%3Allvm-lit
62
+
63
+ Before submitting patches, run the test suite to ensure nothing has regressed::
64
+
65
+ # From within your LLVM source directory.
66
+ utils/lit/lit.py \
67
+ --path /path/to/your/llvm/build/bin \
68
+ utils/lit/tests
69
+
70
+ Note that lit's tests depend on ``not`` and ``FileCheck``, LLVM utilities.
71
+ You will need to have built LLVM tools in order to run lit's test suite
72
+ successfully.
73
+
74
+ You'll also want to confirm that lit continues to work when testing LLVM.
75
+ Follow the instructions in http://llvm.org/docs/TestingGuide.html to run the
76
+ regression test suite:
77
+
78
+ make check-llvm
79
+
80
+ And be sure to run the llvm-lit wrapper script as well:
81
+
82
+ /path/to/your/llvm/build/bin/llvm-lit utils/lit/tests
83
+
84
+ Finally, make sure lit works when installed via setuptools:
85
+
86
+ python utils/lit/setup.py install
87
+ lit --path /path/to/your/llvm/build/bin utils/lit/tests
88
+
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/RECORD ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ../../../bin/lit,sha256=gt2uRcToDvlM5VrNtjGW8jSA_SMBcGLIJ2zrVr303Jk,219
2
+ lit-18.1.8.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
3
+ lit-18.1.8.dist-info/LICENSE.TXT,sha256=jYXBBX10Lll5hcfU5jILAVqROThc_0y64G_8Dr6Jr-4,15141
4
+ lit-18.1.8.dist-info/METADATA,sha256=wWTOEzjFOnByj9vUpg-7m6z4w6wOxxQm0bV8JKtErgA,2516
5
+ lit-18.1.8.dist-info/RECORD,,
6
+ lit-18.1.8.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ lit-18.1.8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
8
+ lit-18.1.8.dist-info/entry_points.txt,sha256=VkD2kCAmwO0d87cx0ZmqEiJ9Pw_38l-E9bWJ_cV-eRw,38
9
+ lit-18.1.8.dist-info/top_level.txt,sha256=re7FJOS-i0hzk2jilipjbt2x1XAfweNrDeWsfDbiraw,4
10
+ lit/BooleanExpression.py,sha256=au2js-cvxFZf9IIyHsHZK86FSejNDAvP9qxIbJ3BHZ4,12039
11
+ lit/LitConfig.py,sha256=p5--IGnsVhbNmcOCXUGUvEC0ItnYWq44jg10GMxIszM,8431
12
+ lit/LitTestCase.py,sha256=X9QmPKZ43_ynMVagmqQyx9UbmOP8O4GofApCFCfTsVY,1593
13
+ lit/ProgressBar.py,sha256=1S0AM7Zl9A-2vOPTDr_mYzqTCYkef0ZdyZxK7DzjR7k,11087
14
+ lit/ShCommands.py,sha256=2C6r-4Mf-z3axTpsLtFlq3sulf1A6YEmozv9Xnv1DTk,3242
15
+ lit/ShUtil.py,sha256=pRRwmMkTlXdipvKXEkHnB2HNL4ssfzDkj_89ckKy8lA,8811
16
+ lit/Test.py,sha256=WI24gogrtizHfk_H2Hxddu291QTGBTMkn6134KSjYkU,13734
17
+ lit/TestRunner.py,sha256=t37BiqWKwOLnuC3rn0d0UNEe8PD84kPCAjTAq2DTlD4,84905
18
+ lit/TestTimes.py,sha256=L1n8NDZCZBxTv9tpIm9-kz9RdQfa-VHwsG_0vkvFXiQ,1629
19
+ lit/TestingConfig.py,sha256=Nb68jG6vMibHfn3oTU4CvPWVOPnzSRRStbBriP_kFRU,8690
20
+ lit/__init__.py,sha256=B53XbNxbmy10HEpv2uSfm0oR4JDIY1yGDba2wZA86Ug,191
21
+ lit/__pycache__/BooleanExpression.cpython-310.pyc,,
22
+ lit/__pycache__/LitConfig.cpython-310.pyc,,
23
+ lit/__pycache__/LitTestCase.cpython-310.pyc,,
24
+ lit/__pycache__/ProgressBar.cpython-310.pyc,,
25
+ lit/__pycache__/ShCommands.cpython-310.pyc,,
26
+ lit/__pycache__/ShUtil.cpython-310.pyc,,
27
+ lit/__pycache__/Test.cpython-310.pyc,,
28
+ lit/__pycache__/TestRunner.cpython-310.pyc,,
29
+ lit/__pycache__/TestTimes.cpython-310.pyc,,
30
+ lit/__pycache__/TestingConfig.cpython-310.pyc,,
31
+ lit/__pycache__/__init__.cpython-310.pyc,,
32
+ lit/__pycache__/cl_arguments.cpython-310.pyc,,
33
+ lit/__pycache__/discovery.cpython-310.pyc,,
34
+ lit/__pycache__/display.cpython-310.pyc,,
35
+ lit/__pycache__/main.cpython-310.pyc,,
36
+ lit/__pycache__/reports.cpython-310.pyc,,
37
+ lit/__pycache__/run.cpython-310.pyc,,
38
+ lit/__pycache__/util.cpython-310.pyc,,
39
+ lit/__pycache__/worker.cpython-310.pyc,,
40
+ lit/builtin_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ lit/builtin_commands/__pycache__/__init__.cpython-310.pyc,,
42
+ lit/builtin_commands/__pycache__/cat.cpython-310.pyc,,
43
+ lit/builtin_commands/__pycache__/diff.cpython-310.pyc,,
44
+ lit/builtin_commands/cat.py,sha256=SSu5cLp93tFTxb4i6qtuF5JhGa5ce4AvUOPLklKaObM,1892
45
+ lit/builtin_commands/diff.py,sha256=DgPO2kTHKZwfxn1oNp-S2T1cjpQJtf4EcLeMGX5RgtE,9802
46
+ lit/cl_arguments.py,sha256=TP0MW8TImuPM31tX-E4Z4azhkNk-ChmcVBhhIBzJLyE,11174
47
+ lit/discovery.py,sha256=f_Ze7eIqLlSBew7pcvLOxRHiPqAvkQnFrD5Dc4qRjMI,9618
48
+ lit/display.py,sha256=iDzxhcDR-qGgOga-fYh-N8JlsBZqKNNomTj4HldWr4s,5987
49
+ lit/formats/__init__.py,sha256=N8-_QUMtwIKB_2sg_AxT7fTjfrvygb4xtzeAy6gUZxU,215
50
+ lit/formats/__pycache__/__init__.cpython-310.pyc,,
51
+ lit/formats/__pycache__/base.cpython-310.pyc,,
52
+ lit/formats/__pycache__/googletest.cpython-310.pyc,,
53
+ lit/formats/__pycache__/shtest.cpython-310.pyc,,
54
+ lit/formats/base.py,sha256=WfzVSdoMxwWEw864_nTNRP0MJFvYC483jMuFd0GEJiM,2299
55
+ lit/formats/googletest.py,sha256=u_YLpvDyMG9jnoD2zXNEgKe91IHlNNE97oyCnVrXqW4,14953
56
+ lit/formats/shtest.py,sha256=0TqWvzIgO-wAdPVAdc3ZObn5LgPWRwIZHECxQkNXR18,992
57
+ lit/llvm/__init__.py,sha256=dRYTMMuZZ8AbNmUbAu7tF0oGyiEGKsg08Za2V_i-7KU,176
58
+ lit/llvm/__pycache__/__init__.cpython-310.pyc,,
59
+ lit/llvm/__pycache__/config.cpython-310.pyc,,
60
+ lit/llvm/__pycache__/subst.cpython-310.pyc,,
61
+ lit/llvm/config.py,sha256=w61DQA3aEKzlaxfvS45pCk6NjlFMlsXCUVu0N8GzkG4,32023
62
+ lit/llvm/subst.py,sha256=tcNyKU9DnjpmJK5nPg4OY3PwTpq-yPtWYew2ihrOXVA,5430
63
+ lit/main.py,sha256=6-zVGJg4k8Zsew36foQ_ZyJC5spD_07_DkrimoNpC1E,11855
64
+ lit/reports.py,sha256=z_tW12WmBsib4utxqPUqWCeuCMxqwcLlh4619teM2sI,11056
65
+ lit/run.py,sha256=ElgAxiSVweS5X-O0dw4zytjdq7Uyb5B7MNHh-abneB8,4692
66
+ lit/util.py,sha256=BFYG2BA7keivLMrU8uFeDurBgrA2CXxQYfQcM6iRjTE,17299
67
+ lit/worker.py,sha256=734wH1gJsGPgioa6vHydMhEzWNsH0ceqrzCcBjjcNxI,2666
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [console_scripts]
2
+ lit = lit.main:main
falcon/lib/python3.10/site-packages/lit-18.1.8.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ lit
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/License.txt ADDED
@@ -0,0 +1,1568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ -----------------
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/METADATA ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: nvidia-cublas-cu11
3
+ Version: 11.10.3.66
4
+ Summary: CUBLAS 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 :: POSIX :: Linux
31
+ Classifier: Operating System :: Microsoft :: Windows
32
+ Requires-Python: >=3
33
+ License-File: License.txt
34
+ Requires-Dist: setuptools
35
+ Requires-Dist: wheel
36
+
37
+ CUBLAS native runtime libraries
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/RECORD ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nvidia/cublas/include/cublas.h,sha256=a0lLqy-k47NuwyDjuueC3W0Mpc908MTU7o5sMJqE-1w,41246
2
+ nvidia/cublas/include/cublasLt.h,sha256=FeRzOTFwOl0TPCMgnF6qH7RB_3gyJk6D18wodbWE2jM,69858
3
+ nvidia/cublas/include/cublasXt.h,sha256=CW9dyXYGSUW1wEXrVVyhU6OxBK1PUvMoYdVGlQT7L9A,37380
4
+ nvidia/cublas/include/cublas_api.h,sha256=NzuoObejh0gJfney-ufSeL8aZKHNF9I-V52bqtMcmHQ,220682
5
+ nvidia/cublas/include/cublas_v2.h,sha256=DrT-TOKePZcfL_ld1ECGv2F30_9KznXxj5WXoABe2v4,8811
6
+ nvidia/cublas/include/nvblas.h,sha256=dXCLR-2oUiJFzLsDtIAK09m42ct4G0HWdYzBUuDPXpc,23341
7
+ nvidia/cublas/lib/libcublas.so.11,sha256=8VRUT5B05j14BHbR6N9mtBAAjGurzUTHGA9rXhGwjRc,151346592
8
+ nvidia/cublas/lib/libcublasLt.so.11,sha256=hfFE3-ey71iNK2iKvz_dUajiahTkGgEcEtQf6K_JoEE,332762424
9
+ nvidia/cublas/lib/libnvblas.so.11,sha256=eX1B5mULurQr_r_5l-tYnOcm7S_P7Y55WHtkcUIyVDA,733032
10
+ nvidia_cublas_cu11-11.10.3.66.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
11
+ nvidia_cublas_cu11-11.10.3.66.dist-info/License.txt,sha256=rW9YU_ugyg0VnQ9Y1JrkmDDC-Mk_epJki5zpCttMbM0,59262
12
+ nvidia_cublas_cu11-11.10.3.66.dist-info/METADATA,sha256=jBjkDirkcXbmo4mvN540Y-WdlX5SWynVAhl7MRzlMd4,1554
13
+ nvidia_cublas_cu11-11.10.3.66.dist-info/RECORD,,
14
+ nvidia_cublas_cu11-11.10.3.66.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ nvidia_cublas_cu11-11.10.3.66.dist-info/WHEEL,sha256=-kQi_VMfvRQozZJT7HUPMfY-5vLo0LVTmAylNJ3Ft98,106
16
+ nvidia_cublas_cu11-11.10.3.66.dist-info/top_level.txt,sha256=R64cT8LTfPfNCPStolkkVMRTsUQTajy66oibURM4Loc,14
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.37.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-manylinux1_x86_64
5
+
falcon/lib/python3.10/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ nvidia/cublas
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/AUTHORS ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ James Robert
2
+ github: jiaaro
3
+ twitter: @jiaaro
4
+ web: jiaaro.com
5
+ email: pydub@jiaaro.com
6
+
7
+ Marc Webbie
8
+ github: marcwebbie
9
+
10
+ Jean-philippe Serafin
11
+ github: jeanphix
12
+
13
+ Anurag Ramdasan
14
+ github: AnuragRamdasan
15
+
16
+ Choongmin Lee
17
+ github: clee704
18
+
19
+ Patrick Pittman
20
+ github: ptpittman
21
+
22
+ Hunter Lang
23
+ github: hunterlang
24
+
25
+ Alexey
26
+ github: nihisil
27
+
28
+ Jaymz Campbell
29
+ github: jaymzcd
30
+
31
+ Ross McFarland
32
+ github: ross
33
+
34
+ John McMellen
35
+ github: jmcmellen
36
+
37
+ Johan Lövgren
38
+ github: dashj
39
+
40
+ Joachim Krüger
41
+ github: jkrgr
42
+
43
+ Shichao An
44
+ github: shichao-an
45
+
46
+ Michael Bortnyck
47
+ github: mbortnyck
48
+
49
+ André Cloete
50
+ github: aj-cloete
51
+
52
+ David Acacio
53
+ github: dacacioa
54
+
55
+ Thiago Abdnur
56
+ github: bolaum
57
+
58
+ Aurélien Ooms
59
+ github: aureooms
60
+
61
+ Mike Mattozzi
62
+ github: mmattozzi
63
+
64
+ Marcio Mazza
65
+ github: marciomazza
66
+
67
+ Sungsu Lim
68
+ github: proflim
69
+
70
+ Evandro Myller
71
+ github: emyller
72
+
73
+ Sérgio Agostinho
74
+ github: SergioRAgostinho
75
+
76
+ Antonio Larrosa
77
+ github: antlarr
78
+
79
+ Aaron Craig
80
+ github: craigthelinguist
81
+
82
+ Carlos del Castillo
83
+ github: greyalien502
84
+
85
+ Yudong Sun
86
+ github: sunjerry019
87
+
88
+ Jorge Perianez
89
+ github: JPery
90
+
91
+ Chendi Luo
92
+ github: Creonalia
93
+
94
+ Daniel Lefevre
95
+ gitHub: dplefevre
96
+
97
+ Grzegorz Kotfis
98
+ github: gkotfis
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2011 James Robert, http://jiaaro.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/METADATA ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: pydub
3
+ Version: 0.25.1
4
+ Summary: Manipulate audio with an simple and easy high level interface
5
+ Home-page: http://pydub.com
6
+ Author: James Robert
7
+ Author-email: jiaaro@gmail.com
8
+ License: MIT
9
+ Keywords: audio sound high-level
10
+ Platform: UNKNOWN
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 2
15
+ Classifier: Programming Language :: Python :: 2.7
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.4
18
+ Classifier: Programming Language :: Python :: 3.5
19
+ Classifier: Programming Language :: Python :: 3.6
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Intended Audience :: Developers
23
+ Classifier: Operating System :: OS Independent
24
+ Classifier: Topic :: Multimedia :: Sound/Audio
25
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
26
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
27
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Editors
28
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Mixers
29
+ Classifier: Topic :: Software Development :: Libraries
30
+ Classifier: Topic :: Utilities
31
+
32
+
33
+ Manipulate audio with an simple and easy high level interface.
34
+
35
+ See the README file for details, usage info, and a list of gotchas.
36
+
37
+
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/RECORD ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pydub-0.25.1.dist-info/AUTHORS,sha256=AyY2PS9I2enOyBnUnxcpeAX-NnMNWLQT4yDtg8IIy78,1250
2
+ pydub-0.25.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
3
+ pydub-0.25.1.dist-info/LICENSE,sha256=roVlNiJMx6OJ6Wh3H8XyWYFL3Q2mNTnPcigq2672iXo,1074
4
+ pydub-0.25.1.dist-info/METADATA,sha256=f0M8_ZVtbiYoUI9ejXIeJ03Jo9A5Nbi-0V1bVqs5iYk,1406
5
+ pydub-0.25.1.dist-info/RECORD,,
6
+ pydub-0.25.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ pydub-0.25.1.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110
8
+ pydub-0.25.1.dist-info/top_level.txt,sha256=PHhiDCQVZdycZxfKL2lQozruBT6ZhvyZAwqjRrw3t0w,6
9
+ pydub/__init__.py,sha256=w1Xv1awbaR3fMhTNE1-grnfswgARTNQrKpBzfZ--VBA,39
10
+ pydub/__pycache__/__init__.cpython-310.pyc,,
11
+ pydub/__pycache__/audio_segment.cpython-310.pyc,,
12
+ pydub/__pycache__/effects.cpython-310.pyc,,
13
+ pydub/__pycache__/exceptions.cpython-310.pyc,,
14
+ pydub/__pycache__/generators.cpython-310.pyc,,
15
+ pydub/__pycache__/logging_utils.cpython-310.pyc,,
16
+ pydub/__pycache__/playback.cpython-310.pyc,,
17
+ pydub/__pycache__/pyaudioop.cpython-310.pyc,,
18
+ pydub/__pycache__/scipy_effects.cpython-310.pyc,,
19
+ pydub/__pycache__/silence.cpython-310.pyc,,
20
+ pydub/__pycache__/utils.cpython-310.pyc,,
21
+ pydub/audio_segment.py,sha256=Nf5VkHGY1v9Jqb7NtEYfwRpLrfqusfBdPGOZsi7R5Cg,49185
22
+ pydub/effects.py,sha256=1HUMzhefrwG_E1rTnzvbl-P0-KNuwHklCnu8QCGS7jA,11507
23
+ pydub/exceptions.py,sha256=osgXoUujwpH8K6hr80iYpW30CMBDFwqyaRD-5d7ZpKs,455
24
+ pydub/generators.py,sha256=u6q7J8JLOY-uEZqMPUTzakxyua3XNQcPiDsuiK2-lLA,4045
25
+ pydub/logging_utils.py,sha256=WuSqfzn4zyT7PxXHGV-PXMDynufeM6sC6eSmVlGX2RU,374
26
+ pydub/playback.py,sha256=zFngVclUL_7oDipjzKC8b7jToPNV11DV28rGyH8pio0,1987
27
+ pydub/pyaudioop.py,sha256=Dp_cQgAyYjD4OV2ZHuxtKI2KABuPi9YYNRUF8giR80Q,13094
28
+ pydub/scipy_effects.py,sha256=U2p8AQuVreTp5MrtUAzRbWgOHUc6Dwq0TAG_RtEg-7g,6637
29
+ pydub/silence.py,sha256=F6MV0VlaO6mtuisjLGks_UR-GVmzO1v87_NKvzwRc30,6457
30
+ pydub/utils.py,sha256=W71pgJFbbNP3adH63yn0Eo0CLLVgzXG7WHYSXpWvdyc,12368
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/WHEEL ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.36.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
6
+
falcon/lib/python3.10/site-packages/pydub-0.25.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pydub
falcon/lib/python3.10/site-packages/referencing/__init__.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ """
2
+ Cross-specification, implementation-agnostic JSON referencing.
3
+ """
4
+
5
+ from referencing._core import Anchor, Registry, Resource, Specification
6
+
7
+ __all__ = ["Anchor", "Registry", "Resource", "Specification"]
falcon/lib/python3.10/site-packages/referencing/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (373 Bytes). View file
 
falcon/lib/python3.10/site-packages/referencing/_attrs.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import NoReturn, TypeVar
4
+
5
+ from attrs import define as _define, frozen as _frozen
6
+
7
+ _T = TypeVar("_T")
8
+
9
+
10
+ def define(cls: type[_T]) -> type[_T]: # pragma: no cover
11
+ cls.__init_subclass__ = _do_not_subclass
12
+ return _define(cls)
13
+
14
+
15
+ def frozen(cls: type[_T]) -> type[_T]:
16
+ cls.__init_subclass__ = _do_not_subclass
17
+ return _frozen(cls)
18
+
19
+
20
+ class UnsupportedSubclassing(Exception):
21
+ def __str__(self):
22
+ return (
23
+ "Subclassing is not part of referencing's public API. "
24
+ "If no other suitable API exists for what you're trying to do, "
25
+ "feel free to file an issue asking for one."
26
+ )
27
+
28
+
29
+ @staticmethod
30
+ def _do_not_subclass() -> NoReturn: # pragma: no cover
31
+ raise UnsupportedSubclassing()
falcon/lib/python3.10/site-packages/referencing/_attrs.pyi ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Callable, TypeVar, Union
2
+
3
+ from attr import attrib, field
4
+
5
+ class UnsupportedSubclassing(Exception): ...
6
+
7
+ _T = TypeVar("_T")
8
+
9
+ def __dataclass_transform__(
10
+ *,
11
+ frozen_default: bool = False,
12
+ field_descriptors: tuple[Union[type, Callable[..., Any]], ...] = ...,
13
+ ) -> Callable[[_T], _T]: ...
14
+ @__dataclass_transform__(field_descriptors=(attrib, field))
15
+ def define(cls: type[_T]) -> type[_T]: ...
16
+ @__dataclass_transform__(
17
+ frozen_default=True,
18
+ field_descriptors=(attrib, field),
19
+ )
20
+ def frozen(cls: type[_T]) -> type[_T]: ...
falcon/lib/python3.10/site-packages/referencing/_core.py ADDED
@@ -0,0 +1,729 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Iterable, Iterator, Sequence
4
+ from enum import Enum
5
+ from typing import Any, Callable, ClassVar, Generic, Protocol, TypeVar
6
+ from urllib.parse import unquote, urldefrag, urljoin
7
+
8
+ from attrs import evolve, field
9
+ from rpds import HashTrieMap, HashTrieSet, List
10
+
11
+ from referencing import exceptions
12
+ from referencing._attrs import frozen
13
+ from referencing.typing import URI, Anchor as AnchorType, D, Mapping, Retrieve
14
+
15
+ EMPTY_UNCRAWLED: HashTrieSet[URI] = HashTrieSet()
16
+ EMPTY_PREVIOUS_RESOLVERS: List[URI] = List()
17
+
18
+
19
+ class _Unset(Enum):
20
+ """
21
+ What sillyness...
22
+ """
23
+
24
+ SENTINEL = 1
25
+
26
+
27
+ _UNSET = _Unset.SENTINEL
28
+
29
+
30
+ class _MaybeInSubresource(Protocol[D]):
31
+ def __call__(
32
+ self,
33
+ segments: Sequence[int | str],
34
+ resolver: Resolver[D],
35
+ subresource: Resource[D],
36
+ ) -> Resolver[D]: ...
37
+
38
+
39
+ def _detect_or_error(contents: D) -> Specification[D]:
40
+ if not isinstance(contents, Mapping):
41
+ raise exceptions.CannotDetermineSpecification(contents)
42
+
43
+ jsonschema_dialect_id = contents.get("$schema") # type: ignore[reportUnknownMemberType]
44
+ if not isinstance(jsonschema_dialect_id, str):
45
+ raise exceptions.CannotDetermineSpecification(contents)
46
+
47
+ from referencing.jsonschema import specification_with
48
+
49
+ return specification_with(jsonschema_dialect_id)
50
+
51
+
52
+ def _detect_or_default(
53
+ default: Specification[D],
54
+ ) -> Callable[[D], Specification[D]]:
55
+ def _detect(contents: D) -> Specification[D]:
56
+ if not isinstance(contents, Mapping):
57
+ return default
58
+
59
+ jsonschema_dialect_id = contents.get("$schema") # type: ignore[reportUnknownMemberType]
60
+ if jsonschema_dialect_id is None:
61
+ return default
62
+
63
+ from referencing.jsonschema import specification_with
64
+
65
+ return specification_with(
66
+ jsonschema_dialect_id, # type: ignore[reportUnknownArgumentType]
67
+ default=default,
68
+ )
69
+
70
+ return _detect
71
+
72
+
73
+ class _SpecificationDetector:
74
+ def __get__(
75
+ self,
76
+ instance: Specification[D] | None,
77
+ cls: type[Specification[D]],
78
+ ) -> Callable[[D], Specification[D]]:
79
+ if instance is None:
80
+ return _detect_or_error
81
+ else:
82
+ return _detect_or_default(instance)
83
+
84
+
85
+ @frozen
86
+ class Specification(Generic[D]):
87
+ """
88
+ A specification which defines referencing behavior.
89
+
90
+ The various methods of a `Specification` allow for varying referencing
91
+ behavior across JSON Schema specification versions, etc.
92
+ """
93
+
94
+ #: A short human-readable name for the specification, used for debugging.
95
+ name: str
96
+
97
+ #: Find the ID of a given document.
98
+ id_of: Callable[[D], URI | None]
99
+
100
+ #: Retrieve the subresources of the given document (without traversing into
101
+ #: the subresources themselves).
102
+ subresources_of: Callable[[D], Iterable[D]]
103
+
104
+ #: While resolving a JSON pointer, conditionally enter a subresource
105
+ #: (if e.g. we have just entered a keyword whose value is a subresource)
106
+ maybe_in_subresource: _MaybeInSubresource[D]
107
+
108
+ #: Retrieve the anchors contained in the given document.
109
+ _anchors_in: Callable[
110
+ [Specification[D], D],
111
+ Iterable[AnchorType[D]],
112
+ ] = field(alias="anchors_in")
113
+
114
+ #: An opaque specification where resources have no subresources
115
+ #: nor internal identifiers.
116
+ OPAQUE: ClassVar[Specification[Any]]
117
+
118
+ #: Attempt to discern which specification applies to the given contents.
119
+ #:
120
+ #: May be called either as an instance method or as a class method, with
121
+ #: slightly different behavior in the following case:
122
+ #:
123
+ #: Recall that not all contents contains enough internal information about
124
+ #: which specification it is written for -- the JSON Schema ``{}``,
125
+ #: for instance, is valid under many different dialects and may be
126
+ #: interpreted as any one of them.
127
+ #:
128
+ #: When this method is used as an instance method (i.e. called on a
129
+ #: specific specification), that specification is used as the default
130
+ #: if the given contents are unidentifiable.
131
+ #:
132
+ #: On the other hand when called as a class method, an error is raised.
133
+ #:
134
+ #: To reiterate, ``DRAFT202012.detect({})`` will return ``DRAFT202012``
135
+ #: whereas the class method ``Specification.detect({})`` will raise an
136
+ #: error.
137
+ #:
138
+ #: (Note that of course ``DRAFT202012.detect(...)`` may return some other
139
+ #: specification when given a schema which *does* identify as being for
140
+ #: another version).
141
+ #:
142
+ #: Raises:
143
+ #:
144
+ #: `CannotDetermineSpecification`
145
+ #:
146
+ #: if the given contents don't have any discernible
147
+ #: information which could be used to guess which
148
+ #: specification they identify as
149
+ detect = _SpecificationDetector()
150
+
151
+ def __repr__(self) -> str:
152
+ return f"<Specification name={self.name!r}>"
153
+
154
+ def anchors_in(self, contents: D):
155
+ """
156
+ Retrieve the anchors contained in the given document.
157
+ """
158
+ return self._anchors_in(self, contents)
159
+
160
+ def create_resource(self, contents: D) -> Resource[D]:
161
+ """
162
+ Create a resource which is interpreted using this specification.
163
+ """
164
+ return Resource(contents=contents, specification=self)
165
+
166
+
167
+ Specification.OPAQUE = Specification(
168
+ name="opaque",
169
+ id_of=lambda contents: None,
170
+ subresources_of=lambda contents: [],
171
+ anchors_in=lambda specification, contents: [],
172
+ maybe_in_subresource=lambda segments, resolver, subresource: resolver,
173
+ )
174
+
175
+
176
+ @frozen
177
+ class Resource(Generic[D]):
178
+ r"""
179
+ A document (deserialized JSON) with a concrete interpretation under a spec.
180
+
181
+ In other words, a Python object, along with an instance of `Specification`
182
+ which describes how the document interacts with referencing -- both
183
+ internally (how it refers to other `Resource`\ s) and externally (how it
184
+ should be identified such that it is referenceable by other documents).
185
+ """
186
+
187
+ contents: D
188
+ _specification: Specification[D] = field(alias="specification")
189
+
190
+ @classmethod
191
+ def from_contents(
192
+ cls,
193
+ contents: D,
194
+ default_specification: (
195
+ type[Specification[D]] | Specification[D]
196
+ ) = Specification,
197
+ ) -> Resource[D]:
198
+ """
199
+ Create a resource guessing which specification applies to the contents.
200
+
201
+ Raises:
202
+
203
+ `CannotDetermineSpecification`
204
+
205
+ if the given contents don't have any discernible
206
+ information which could be used to guess which
207
+ specification they identify as
208
+
209
+ """
210
+ specification = default_specification.detect(contents)
211
+ return specification.create_resource(contents=contents)
212
+
213
+ @classmethod
214
+ def opaque(cls, contents: D) -> Resource[D]:
215
+ """
216
+ Create an opaque `Resource` -- i.e. one with opaque specification.
217
+
218
+ See `Specification.OPAQUE` for details.
219
+ """
220
+ return Specification.OPAQUE.create_resource(contents=contents)
221
+
222
+ def id(self) -> URI | None:
223
+ """
224
+ Retrieve this resource's (specification-specific) identifier.
225
+ """
226
+ id = self._specification.id_of(self.contents)
227
+ if id is None:
228
+ return
229
+ return id.rstrip("#")
230
+
231
+ def subresources(self) -> Iterable[Resource[D]]:
232
+ """
233
+ Retrieve this resource's subresources.
234
+ """
235
+ return (
236
+ Resource.from_contents(
237
+ each,
238
+ default_specification=self._specification,
239
+ )
240
+ for each in self._specification.subresources_of(self.contents)
241
+ )
242
+
243
+ def anchors(self) -> Iterable[AnchorType[D]]:
244
+ """
245
+ Retrieve this resource's (specification-specific) identifier.
246
+ """
247
+ return self._specification.anchors_in(self.contents)
248
+
249
+ def pointer(self, pointer: str, resolver: Resolver[D]) -> Resolved[D]:
250
+ """
251
+ Resolve the given JSON pointer.
252
+
253
+ Raises:
254
+
255
+ `exceptions.PointerToNowhere`
256
+
257
+ if the pointer points to a location not present in the document
258
+
259
+ """
260
+ if not pointer:
261
+ return Resolved(contents=self.contents, resolver=resolver)
262
+
263
+ contents = self.contents
264
+ segments: list[int | str] = []
265
+ for segment in unquote(pointer[1:]).split("/"):
266
+ if isinstance(contents, Sequence):
267
+ segment = int(segment)
268
+ else:
269
+ segment = segment.replace("~1", "/").replace("~0", "~")
270
+ try:
271
+ contents = contents[segment] # type: ignore[reportUnknownArgumentType]
272
+ except LookupError as lookup_error:
273
+ error = exceptions.PointerToNowhere(ref=pointer, resource=self)
274
+ raise error from lookup_error
275
+
276
+ segments.append(segment)
277
+ last = resolver
278
+ resolver = self._specification.maybe_in_subresource(
279
+ segments=segments,
280
+ resolver=resolver,
281
+ subresource=self._specification.create_resource(contents),
282
+ )
283
+ if resolver is not last:
284
+ segments = []
285
+ return Resolved(contents=contents, resolver=resolver) # type: ignore[reportUnknownArgumentType]
286
+
287
+
288
+ def _fail_to_retrieve(uri: URI):
289
+ raise exceptions.NoSuchResource(ref=uri)
290
+
291
+
292
+ @frozen
293
+ class Registry(Mapping[URI, Resource[D]]):
294
+ r"""
295
+ A registry of `Resource`\ s, each identified by their canonical URIs.
296
+
297
+ Registries store a collection of in-memory resources, and optionally
298
+ enable additional resources which may be stored elsewhere (e.g. in a
299
+ database, a separate set of files, over the network, etc.).
300
+
301
+ They also lazily walk their known resources, looking for subresources
302
+ within them. In other words, subresources contained within any added
303
+ resources will be retrievable via their own IDs (though this discovery of
304
+ subresources will be delayed until necessary).
305
+
306
+ Registries are immutable, and their methods return new instances of the
307
+ registry with the additional resources added to them.
308
+
309
+ The ``retrieve`` argument can be used to configure retrieval of resources
310
+ dynamically, either over the network, from a database, or the like.
311
+ Pass it a callable which will be called if any URI not present in the
312
+ registry is accessed. It must either return a `Resource` or else raise a
313
+ `NoSuchResource` exception indicating that the resource does not exist
314
+ even according to the retrieval logic.
315
+ """
316
+
317
+ _resources: HashTrieMap[URI, Resource[D]] = field(
318
+ default=HashTrieMap(),
319
+ converter=HashTrieMap.convert, # type: ignore[reportGeneralTypeIssues]
320
+ alias="resources",
321
+ )
322
+ _anchors: HashTrieMap[tuple[URI, str], AnchorType[D]] = HashTrieMap()
323
+ _uncrawled: HashTrieSet[URI] = EMPTY_UNCRAWLED
324
+ _retrieve: Retrieve[D] = field(default=_fail_to_retrieve, alias="retrieve")
325
+
326
+ def __getitem__(self, uri: URI) -> Resource[D]:
327
+ """
328
+ Return the (already crawled) `Resource` identified by the given URI.
329
+ """
330
+ try:
331
+ return self._resources[uri.rstrip("#")]
332
+ except KeyError:
333
+ raise exceptions.NoSuchResource(ref=uri) from None
334
+
335
+ def __iter__(self) -> Iterator[URI]:
336
+ """
337
+ Iterate over all crawled URIs in the registry.
338
+ """
339
+ return iter(self._resources)
340
+
341
+ def __len__(self) -> int:
342
+ """
343
+ Count the total number of fully crawled resources in this registry.
344
+ """
345
+ return len(self._resources)
346
+
347
+ def __rmatmul__(
348
+ self,
349
+ new: Resource[D] | Iterable[Resource[D]],
350
+ ) -> Registry[D]:
351
+ """
352
+ Create a new registry with resource(s) added using their internal IDs.
353
+
354
+ Resources must have a internal IDs (e.g. the :kw:`$id` keyword in
355
+ modern JSON Schema versions), otherwise an error will be raised.
356
+
357
+ Both a single resource as well as an iterable of resources works, i.e.:
358
+
359
+ * ``resource @ registry`` or
360
+
361
+ * ``[iterable, of, multiple, resources] @ registry``
362
+
363
+ which -- again, assuming the resources have internal IDs -- is
364
+ equivalent to calling `Registry.with_resources` as such:
365
+
366
+ .. code:: python
367
+
368
+ registry.with_resources(
369
+ (resource.id(), resource) for resource in new_resources
370
+ )
371
+
372
+ Raises:
373
+
374
+ `NoInternalID`
375
+
376
+ if the resource(s) in fact do not have IDs
377
+
378
+ """
379
+ if isinstance(new, Resource):
380
+ new = (new,)
381
+
382
+ resources = self._resources
383
+ uncrawled = self._uncrawled
384
+ for resource in new:
385
+ id = resource.id()
386
+ if id is None:
387
+ raise exceptions.NoInternalID(resource=resource)
388
+ uncrawled = uncrawled.insert(id)
389
+ resources = resources.insert(id, resource)
390
+ return evolve(self, resources=resources, uncrawled=uncrawled)
391
+
392
+ def __repr__(self) -> str:
393
+ size = len(self)
394
+ pluralized = "resource" if size == 1 else "resources"
395
+ if self._uncrawled:
396
+ uncrawled = len(self._uncrawled)
397
+ if uncrawled == size:
398
+ summary = f"uncrawled {pluralized}"
399
+ else:
400
+ summary = f"{pluralized}, {uncrawled} uncrawled"
401
+ else:
402
+ summary = f"{pluralized}"
403
+ return f"<Registry ({size} {summary})>"
404
+
405
+ def get_or_retrieve(self, uri: URI) -> Retrieved[D, Resource[D]]:
406
+ """
407
+ Get a resource from the registry, crawling or retrieving if necessary.
408
+
409
+ May involve crawling to find the given URI if it is not already known,
410
+ so the returned object is a `Retrieved` object which contains both the
411
+ resource value as well as the registry which ultimately contained it.
412
+ """
413
+ resource = self._resources.get(uri)
414
+ if resource is not None:
415
+ return Retrieved(registry=self, value=resource)
416
+
417
+ registry = self.crawl()
418
+ resource = registry._resources.get(uri)
419
+ if resource is not None:
420
+ return Retrieved(registry=registry, value=resource)
421
+
422
+ try:
423
+ resource = registry._retrieve(uri)
424
+ except (
425
+ exceptions.CannotDetermineSpecification,
426
+ exceptions.NoSuchResource,
427
+ ):
428
+ raise
429
+ except Exception as error:
430
+ raise exceptions.Unretrievable(ref=uri) from error
431
+ else:
432
+ registry = registry.with_resource(uri, resource)
433
+ return Retrieved(registry=registry, value=resource)
434
+
435
+ def remove(self, uri: URI):
436
+ """
437
+ Return a registry with the resource identified by a given URI removed.
438
+ """
439
+ if uri not in self._resources:
440
+ raise exceptions.NoSuchResource(ref=uri)
441
+
442
+ return evolve(
443
+ self,
444
+ resources=self._resources.remove(uri),
445
+ uncrawled=self._uncrawled.discard(uri),
446
+ anchors=HashTrieMap(
447
+ (k, v) for k, v in self._anchors.items() if k[0] != uri
448
+ ),
449
+ )
450
+
451
+ def anchor(self, uri: URI, name: str):
452
+ """
453
+ Retrieve a given anchor from a resource which must already be crawled.
454
+ """
455
+ value = self._anchors.get((uri, name))
456
+ if value is not None:
457
+ return Retrieved(value=value, registry=self)
458
+
459
+ registry = self.crawl()
460
+ value = registry._anchors.get((uri, name))
461
+ if value is not None:
462
+ return Retrieved(value=value, registry=registry)
463
+
464
+ resource = self[uri]
465
+ canonical_uri = resource.id()
466
+ if canonical_uri is not None:
467
+ value = registry._anchors.get((canonical_uri, name))
468
+ if value is not None:
469
+ return Retrieved(value=value, registry=registry)
470
+
471
+ if "/" in name:
472
+ raise exceptions.InvalidAnchor(
473
+ ref=uri,
474
+ resource=resource,
475
+ anchor=name,
476
+ )
477
+ raise exceptions.NoSuchAnchor(ref=uri, resource=resource, anchor=name)
478
+
479
+ def contents(self, uri: URI) -> D:
480
+ """
481
+ Retrieve the (already crawled) contents identified by the given URI.
482
+ """
483
+ return self[uri].contents
484
+
485
+ def crawl(self) -> Registry[D]:
486
+ """
487
+ Crawl all added resources, discovering subresources.
488
+ """
489
+ resources = self._resources
490
+ anchors = self._anchors
491
+ uncrawled = [(uri, resources[uri]) for uri in self._uncrawled]
492
+ while uncrawled:
493
+ uri, resource = uncrawled.pop()
494
+
495
+ id = resource.id()
496
+ if id is not None:
497
+ uri = urljoin(uri, id)
498
+ resources = resources.insert(uri, resource)
499
+ for each in resource.anchors():
500
+ anchors = anchors.insert((uri, each.name), each)
501
+ uncrawled.extend((uri, each) for each in resource.subresources())
502
+ return evolve(
503
+ self,
504
+ resources=resources,
505
+ anchors=anchors,
506
+ uncrawled=EMPTY_UNCRAWLED,
507
+ )
508
+
509
+ def with_resource(self, uri: URI, resource: Resource[D]):
510
+ """
511
+ Add the given `Resource` to the registry, without crawling it.
512
+ """
513
+ return self.with_resources([(uri, resource)])
514
+
515
+ def with_resources(
516
+ self,
517
+ pairs: Iterable[tuple[URI, Resource[D]]],
518
+ ) -> Registry[D]:
519
+ r"""
520
+ Add the given `Resource`\ s to the registry, without crawling them.
521
+ """
522
+ resources = self._resources
523
+ uncrawled = self._uncrawled
524
+ for uri, resource in pairs:
525
+ # Empty fragment URIs are equivalent to URIs without the fragment.
526
+ # TODO: Is this true for non JSON Schema resources? Probably not.
527
+ uri = uri.rstrip("#")
528
+ uncrawled = uncrawled.insert(uri)
529
+ resources = resources.insert(uri, resource)
530
+ return evolve(self, resources=resources, uncrawled=uncrawled)
531
+
532
+ def with_contents(
533
+ self,
534
+ pairs: Iterable[tuple[URI, D]],
535
+ **kwargs: Any,
536
+ ) -> Registry[D]:
537
+ r"""
538
+ Add the given contents to the registry, autodetecting when necessary.
539
+ """
540
+ return self.with_resources(
541
+ (uri, Resource.from_contents(each, **kwargs))
542
+ for uri, each in pairs
543
+ )
544
+
545
+ def combine(self, *registries: Registry[D]) -> Registry[D]:
546
+ """
547
+ Combine together one or more other registries, producing a unified one.
548
+ """
549
+ if registries == (self,):
550
+ return self
551
+ resources = self._resources
552
+ anchors = self._anchors
553
+ uncrawled = self._uncrawled
554
+ retrieve = self._retrieve
555
+ for registry in registries:
556
+ resources = resources.update(registry._resources)
557
+ anchors = anchors.update(registry._anchors)
558
+ uncrawled = uncrawled.update(registry._uncrawled)
559
+
560
+ if registry._retrieve is not _fail_to_retrieve:
561
+ if registry._retrieve is not retrieve is not _fail_to_retrieve:
562
+ raise ValueError( # noqa: TRY003
563
+ "Cannot combine registries with conflicting retrieval "
564
+ "functions.",
565
+ )
566
+ retrieve = registry._retrieve
567
+ return evolve(
568
+ self,
569
+ anchors=anchors,
570
+ resources=resources,
571
+ uncrawled=uncrawled,
572
+ retrieve=retrieve,
573
+ )
574
+
575
+ def resolver(self, base_uri: URI = "") -> Resolver[D]:
576
+ """
577
+ Return a `Resolver` which resolves references against this registry.
578
+ """
579
+ return Resolver(base_uri=base_uri, registry=self)
580
+
581
+ def resolver_with_root(self, resource: Resource[D]) -> Resolver[D]:
582
+ """
583
+ Return a `Resolver` with a specific root resource.
584
+ """
585
+ uri = resource.id() or ""
586
+ return Resolver(
587
+ base_uri=uri,
588
+ registry=self.with_resource(uri, resource),
589
+ )
590
+
591
+
592
+ #: An anchor or resource.
593
+ AnchorOrResource = TypeVar("AnchorOrResource", AnchorType[Any], Resource[Any])
594
+
595
+
596
+ @frozen
597
+ class Retrieved(Generic[D, AnchorOrResource]):
598
+ """
599
+ A value retrieved from a `Registry`.
600
+ """
601
+
602
+ value: AnchorOrResource
603
+ registry: Registry[D]
604
+
605
+
606
+ @frozen
607
+ class Resolved(Generic[D]):
608
+ """
609
+ A reference resolved to its contents by a `Resolver`.
610
+ """
611
+
612
+ contents: D
613
+ resolver: Resolver[D]
614
+
615
+
616
+ @frozen
617
+ class Resolver(Generic[D]):
618
+ """
619
+ A reference resolver.
620
+
621
+ Resolvers help resolve references (including relative ones) by
622
+ pairing a fixed base URI with a `Registry`.
623
+
624
+ This object, under normal circumstances, is expected to be used by
625
+ *implementers of libraries* built on top of `referencing` (e.g. JSON Schema
626
+ implementations or other libraries resolving JSON references),
627
+ not directly by end-users populating registries or while writing
628
+ schemas or other resources.
629
+
630
+ References are resolved against the base URI, and the combined URI
631
+ is then looked up within the registry.
632
+
633
+ The process of resolving a reference may itself involve calculating
634
+ a *new* base URI for future reference resolution (e.g. if an
635
+ intermediate resource sets a new base URI), or may involve encountering
636
+ additional subresources and adding them to a new registry.
637
+ """
638
+
639
+ _base_uri: URI = field(alias="base_uri")
640
+ _registry: Registry[D] = field(alias="registry")
641
+ _previous: List[URI] = field(default=List(), repr=False, alias="previous")
642
+
643
+ def lookup(self, ref: URI) -> Resolved[D]:
644
+ """
645
+ Resolve the given reference to the resource it points to.
646
+
647
+ Raises:
648
+
649
+ `exceptions.Unresolvable`
650
+
651
+ or a subclass thereof (see below) if the reference isn't
652
+ resolvable
653
+
654
+ `exceptions.NoSuchAnchor`
655
+
656
+ if the reference is to a URI where a resource exists but
657
+ contains a plain name fragment which does not exist within
658
+ the resource
659
+
660
+ `exceptions.PointerToNowhere`
661
+
662
+ if the reference is to a URI where a resource exists but
663
+ contains a JSON pointer to a location within the resource
664
+ that does not exist
665
+
666
+ """
667
+ if ref.startswith("#"):
668
+ uri, fragment = self._base_uri, ref[1:]
669
+ else:
670
+ uri, fragment = urldefrag(urljoin(self._base_uri, ref))
671
+ try:
672
+ retrieved = self._registry.get_or_retrieve(uri)
673
+ except exceptions.NoSuchResource:
674
+ raise exceptions.Unresolvable(ref=ref) from None
675
+ except exceptions.Unretrievable as error:
676
+ raise exceptions.Unresolvable(ref=ref) from error
677
+
678
+ if fragment.startswith("/"):
679
+ resolver = self._evolve(registry=retrieved.registry, base_uri=uri)
680
+ return retrieved.value.pointer(pointer=fragment, resolver=resolver)
681
+
682
+ if fragment:
683
+ retrieved = retrieved.registry.anchor(uri, fragment)
684
+ resolver = self._evolve(registry=retrieved.registry, base_uri=uri)
685
+ return retrieved.value.resolve(resolver=resolver)
686
+
687
+ resolver = self._evolve(registry=retrieved.registry, base_uri=uri)
688
+ return Resolved(contents=retrieved.value.contents, resolver=resolver)
689
+
690
+ def in_subresource(self, subresource: Resource[D]) -> Resolver[D]:
691
+ """
692
+ Create a resolver for a subresource (which may have a new base URI).
693
+ """
694
+ id = subresource.id()
695
+ if id is None:
696
+ return self
697
+ return evolve(self, base_uri=urljoin(self._base_uri, id))
698
+
699
+ def dynamic_scope(self) -> Iterable[tuple[URI, Registry[D]]]:
700
+ """
701
+ In specs with such a notion, return the URIs in the dynamic scope.
702
+ """
703
+ for uri in self._previous:
704
+ yield uri, self._registry
705
+
706
+ def _evolve(self, base_uri: URI, **kwargs: Any):
707
+ """
708
+ Evolve, appending to the dynamic scope.
709
+ """
710
+ previous = self._previous
711
+ if self._base_uri and (not previous or base_uri != self._base_uri):
712
+ previous = previous.push_front(self._base_uri)
713
+ return evolve(self, base_uri=base_uri, previous=previous, **kwargs)
714
+
715
+
716
+ @frozen
717
+ class Anchor(Generic[D]):
718
+ """
719
+ A simple anchor in a `Resource`.
720
+ """
721
+
722
+ name: str
723
+ resource: Resource[D]
724
+
725
+ def resolve(self, resolver: Resolver[D]):
726
+ """
727
+ Return the resource for this anchor.
728
+ """
729
+ return Resolved(contents=self.resource.contents, resolver=resolver)
falcon/lib/python3.10/site-packages/referencing/exceptions.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Errors, oh no!
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import TYPE_CHECKING, Any
8
+
9
+ import attrs
10
+
11
+ from referencing._attrs import frozen
12
+
13
+ if TYPE_CHECKING:
14
+ from referencing import Resource
15
+ from referencing.typing import URI
16
+
17
+
18
+ @frozen
19
+ class NoSuchResource(KeyError):
20
+ """
21
+ The given URI is not present in a registry.
22
+
23
+ Unlike most exceptions, this class *is* intended to be publicly
24
+ instantiable and *is* part of the public API of the package.
25
+ """
26
+
27
+ ref: URI
28
+
29
+ def __eq__(self, other: object) -> bool:
30
+ if self.__class__ is not other.__class__:
31
+ return NotImplemented
32
+ return attrs.astuple(self) == attrs.astuple(other)
33
+
34
+ def __hash__(self) -> int:
35
+ return hash(attrs.astuple(self))
36
+
37
+
38
+ @frozen
39
+ class NoInternalID(Exception):
40
+ """
41
+ A resource has no internal ID, but one is needed.
42
+
43
+ E.g. in modern JSON Schema drafts, this is the :kw:`$id` keyword.
44
+
45
+ One might be needed if a resource was to-be added to a registry but no
46
+ other URI is available, and the resource doesn't declare its canonical URI.
47
+ """
48
+
49
+ resource: Resource[Any]
50
+
51
+ def __eq__(self, other: object) -> bool:
52
+ if self.__class__ is not other.__class__:
53
+ return NotImplemented
54
+ return attrs.astuple(self) == attrs.astuple(other)
55
+
56
+ def __hash__(self) -> int:
57
+ return hash(attrs.astuple(self))
58
+
59
+
60
+ @frozen
61
+ class Unretrievable(KeyError):
62
+ """
63
+ The given URI is not present in a registry, and retrieving it failed.
64
+ """
65
+
66
+ ref: URI
67
+
68
+ def __eq__(self, other: object) -> bool:
69
+ if self.__class__ is not other.__class__:
70
+ return NotImplemented
71
+ return attrs.astuple(self) == attrs.astuple(other)
72
+
73
+ def __hash__(self) -> int:
74
+ return hash(attrs.astuple(self))
75
+
76
+
77
+ @frozen
78
+ class CannotDetermineSpecification(Exception):
79
+ """
80
+ Attempting to detect the appropriate `Specification` failed.
81
+
82
+ This happens if no discernible information is found in the contents of the
83
+ new resource which would help identify it.
84
+ """
85
+
86
+ contents: Any
87
+
88
+ def __eq__(self, other: object) -> bool:
89
+ if self.__class__ is not other.__class__:
90
+ return NotImplemented
91
+ return attrs.astuple(self) == attrs.astuple(other)
92
+
93
+ def __hash__(self) -> int:
94
+ return hash(attrs.astuple(self))
95
+
96
+
97
+ @attrs.frozen # Because here we allow subclassing below.
98
+ class Unresolvable(Exception):
99
+ """
100
+ A reference was unresolvable.
101
+ """
102
+
103
+ ref: URI
104
+
105
+ def __eq__(self, other: object) -> bool:
106
+ if self.__class__ is not other.__class__:
107
+ return NotImplemented
108
+ return attrs.astuple(self) == attrs.astuple(other)
109
+
110
+ def __hash__(self) -> int:
111
+ return hash(attrs.astuple(self))
112
+
113
+
114
+ @frozen
115
+ class PointerToNowhere(Unresolvable):
116
+ """
117
+ A JSON Pointer leads to a part of a document that does not exist.
118
+ """
119
+
120
+ resource: Resource[Any]
121
+
122
+ def __str__(self) -> str:
123
+ msg = f"{self.ref!r} does not exist within {self.resource.contents!r}"
124
+ if self.ref == "/":
125
+ msg += (
126
+ ". The pointer '/' is a valid JSON Pointer but it points to "
127
+ "an empty string property ''. If you intended to point "
128
+ "to the entire resource, you should use '#'."
129
+ )
130
+ return msg
131
+
132
+
133
+ @frozen
134
+ class NoSuchAnchor(Unresolvable):
135
+ """
136
+ An anchor does not exist within a particular resource.
137
+ """
138
+
139
+ resource: Resource[Any]
140
+ anchor: str
141
+
142
+ def __str__(self) -> str:
143
+ return (
144
+ f"{self.anchor!r} does not exist within {self.resource.contents!r}"
145
+ )
146
+
147
+
148
+ @frozen
149
+ class InvalidAnchor(Unresolvable):
150
+ """
151
+ An anchor which could never exist in a resource was dereferenced.
152
+
153
+ It is somehow syntactically invalid.
154
+ """
155
+
156
+ resource: Resource[Any]
157
+ anchor: str
158
+
159
+ def __str__(self) -> str:
160
+ return (
161
+ f"'#{self.anchor}' is not a valid anchor, neither as a "
162
+ "plain name anchor nor as a JSON Pointer. You may have intended "
163
+ f"to use '#/{self.anchor}', as the slash is required *before each "
164
+ "segment* of a JSON pointer."
165
+ )
falcon/lib/python3.10/site-packages/referencing/jsonschema.py ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Referencing implementations for JSON Schema specs (historic & current).
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from collections.abc import Sequence, Set
8
+ from typing import Any, Iterable, Union
9
+
10
+ from referencing import Anchor, Registry, Resource, Specification, exceptions
11
+ from referencing._attrs import frozen
12
+ from referencing._core import (
13
+ _UNSET, # type: ignore[reportPrivateUsage]
14
+ Resolved as _Resolved,
15
+ Resolver as _Resolver,
16
+ _Unset, # type: ignore[reportPrivateUsage]
17
+ )
18
+ from referencing.typing import URI, Anchor as AnchorType, Mapping
19
+
20
+ #: A JSON Schema which is a JSON object
21
+ ObjectSchema = Mapping[str, Any]
22
+
23
+ #: A JSON Schema of any kind
24
+ Schema = Union[bool, ObjectSchema]
25
+
26
+ #: A Resource whose contents are JSON Schemas
27
+ SchemaResource = Resource[Schema]
28
+
29
+ #: A JSON Schema Registry
30
+ SchemaRegistry = Registry[Schema]
31
+
32
+ #: The empty JSON Schema Registry
33
+ EMPTY_REGISTRY: SchemaRegistry = Registry()
34
+
35
+
36
+ @frozen
37
+ class UnknownDialect(Exception):
38
+ """
39
+ A dialect identifier was found for a dialect unknown by this library.
40
+
41
+ If it's a custom ("unofficial") dialect, be sure you've registered it.
42
+ """
43
+
44
+ uri: URI
45
+
46
+
47
+ def _dollar_id(contents: Schema) -> URI | None:
48
+ if isinstance(contents, bool):
49
+ return
50
+ return contents.get("$id")
51
+
52
+
53
+ def _legacy_dollar_id(contents: Schema) -> URI | None:
54
+ if isinstance(contents, bool) or "$ref" in contents:
55
+ return
56
+ id = contents.get("$id")
57
+ if id is not None and not id.startswith("#"):
58
+ return id
59
+
60
+
61
+ def _legacy_id(contents: ObjectSchema) -> URI | None:
62
+ if "$ref" in contents:
63
+ return
64
+ id = contents.get("id")
65
+ if id is not None and not id.startswith("#"):
66
+ return id
67
+
68
+
69
+ def _anchor(
70
+ specification: Specification[Schema],
71
+ contents: Schema,
72
+ ) -> Iterable[AnchorType[Schema]]:
73
+ if isinstance(contents, bool):
74
+ return
75
+ anchor = contents.get("$anchor")
76
+ if anchor is not None:
77
+ yield Anchor(
78
+ name=anchor,
79
+ resource=specification.create_resource(contents),
80
+ )
81
+
82
+ dynamic_anchor = contents.get("$dynamicAnchor")
83
+ if dynamic_anchor is not None:
84
+ yield DynamicAnchor(
85
+ name=dynamic_anchor,
86
+ resource=specification.create_resource(contents),
87
+ )
88
+
89
+
90
+ def _anchor_2019(
91
+ specification: Specification[Schema],
92
+ contents: Schema,
93
+ ) -> Iterable[Anchor[Schema]]:
94
+ if isinstance(contents, bool):
95
+ return []
96
+ anchor = contents.get("$anchor")
97
+ if anchor is None:
98
+ return []
99
+ return [
100
+ Anchor(
101
+ name=anchor,
102
+ resource=specification.create_resource(contents),
103
+ ),
104
+ ]
105
+
106
+
107
+ def _legacy_anchor_in_dollar_id(
108
+ specification: Specification[Schema],
109
+ contents: Schema,
110
+ ) -> Iterable[Anchor[Schema]]:
111
+ if isinstance(contents, bool):
112
+ return []
113
+ id = contents.get("$id", "")
114
+ if not id.startswith("#"):
115
+ return []
116
+ return [
117
+ Anchor(
118
+ name=id[1:],
119
+ resource=specification.create_resource(contents),
120
+ ),
121
+ ]
122
+
123
+
124
+ def _legacy_anchor_in_id(
125
+ specification: Specification[ObjectSchema],
126
+ contents: ObjectSchema,
127
+ ) -> Iterable[Anchor[ObjectSchema]]:
128
+ id = contents.get("id", "")
129
+ if not id.startswith("#"):
130
+ return []
131
+ return [
132
+ Anchor(
133
+ name=id[1:],
134
+ resource=specification.create_resource(contents),
135
+ ),
136
+ ]
137
+
138
+
139
+ def _subresources_of(
140
+ in_value: Set[str] = frozenset(),
141
+ in_subvalues: Set[str] = frozenset(),
142
+ in_subarray: Set[str] = frozenset(),
143
+ ):
144
+ """
145
+ Create a callable returning JSON Schema specification-style subschemas.
146
+
147
+ Relies on specifying the set of keywords containing subschemas in their
148
+ values, in a subobject's values, or in a subarray.
149
+ """
150
+
151
+ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
152
+ if isinstance(contents, bool):
153
+ return
154
+ for each in in_value:
155
+ if each in contents:
156
+ yield contents[each]
157
+ for each in in_subarray:
158
+ if each in contents:
159
+ yield from contents[each]
160
+ for each in in_subvalues:
161
+ if each in contents:
162
+ yield from contents[each].values()
163
+
164
+ return subresources_of
165
+
166
+
167
+ def _subresources_of_with_crazy_items(
168
+ in_value: Set[str] = frozenset(),
169
+ in_subvalues: Set[str] = frozenset(),
170
+ in_subarray: Set[str] = frozenset(),
171
+ ):
172
+ """
173
+ Specifically handle older drafts where there are some funky keywords.
174
+ """
175
+
176
+ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
177
+ if isinstance(contents, bool):
178
+ return
179
+ for each in in_value:
180
+ if each in contents:
181
+ yield contents[each]
182
+ for each in in_subarray:
183
+ if each in contents:
184
+ yield from contents[each]
185
+ for each in in_subvalues:
186
+ if each in contents:
187
+ yield from contents[each].values()
188
+
189
+ items = contents.get("items")
190
+ if items is not None:
191
+ if isinstance(items, Sequence):
192
+ yield from items
193
+ else:
194
+ yield items
195
+
196
+ return subresources_of
197
+
198
+
199
+ def _subresources_of_with_crazy_items_dependencies(
200
+ in_value: Set[str] = frozenset(),
201
+ in_subvalues: Set[str] = frozenset(),
202
+ in_subarray: Set[str] = frozenset(),
203
+ ):
204
+ """
205
+ Specifically handle older drafts where there are some funky keywords.
206
+ """
207
+
208
+ def subresources_of(contents: Schema) -> Iterable[ObjectSchema]:
209
+ if isinstance(contents, bool):
210
+ return
211
+ for each in in_value:
212
+ if each in contents:
213
+ yield contents[each]
214
+ for each in in_subarray:
215
+ if each in contents:
216
+ yield from contents[each]
217
+ for each in in_subvalues:
218
+ if each in contents:
219
+ yield from contents[each].values()
220
+
221
+ items = contents.get("items")
222
+ if items is not None:
223
+ if isinstance(items, Sequence):
224
+ yield from items
225
+ else:
226
+ yield items
227
+ dependencies = contents.get("dependencies")
228
+ if dependencies is not None:
229
+ values = iter(dependencies.values())
230
+ value = next(values, None)
231
+ if isinstance(value, Mapping):
232
+ yield value
233
+ yield from values
234
+
235
+ return subresources_of
236
+
237
+
238
+ def _subresources_of_with_crazy_aP_items_dependencies(
239
+ in_value: Set[str] = frozenset(),
240
+ in_subvalues: Set[str] = frozenset(),
241
+ in_subarray: Set[str] = frozenset(),
242
+ ):
243
+ """
244
+ Specifically handle even older drafts where there are some funky keywords.
245
+ """
246
+
247
+ def subresources_of(contents: ObjectSchema) -> Iterable[ObjectSchema]:
248
+ for each in in_value:
249
+ if each in contents:
250
+ yield contents[each]
251
+ for each in in_subarray:
252
+ if each in contents:
253
+ yield from contents[each]
254
+ for each in in_subvalues:
255
+ if each in contents:
256
+ yield from contents[each].values()
257
+
258
+ items = contents.get("items")
259
+ if items is not None:
260
+ if isinstance(items, Sequence):
261
+ yield from items
262
+ else:
263
+ yield items
264
+ dependencies = contents.get("dependencies")
265
+ if dependencies is not None:
266
+ values = iter(dependencies.values())
267
+ value = next(values, None)
268
+ if isinstance(value, Mapping):
269
+ yield value
270
+ yield from values
271
+
272
+ for each in "additionalItems", "additionalProperties":
273
+ value = contents.get(each)
274
+ if isinstance(value, Mapping):
275
+ yield value
276
+
277
+ return subresources_of
278
+
279
+
280
+ def _maybe_in_subresource(
281
+ in_value: Set[str] = frozenset(),
282
+ in_subvalues: Set[str] = frozenset(),
283
+ in_subarray: Set[str] = frozenset(),
284
+ ):
285
+ in_child = in_subvalues | in_subarray
286
+
287
+ def maybe_in_subresource(
288
+ segments: Sequence[int | str],
289
+ resolver: _Resolver[Any],
290
+ subresource: Resource[Any],
291
+ ) -> _Resolver[Any]:
292
+ _segments = iter(segments)
293
+ for segment in _segments:
294
+ if segment not in in_value and (
295
+ segment not in in_child or next(_segments, None) is None
296
+ ):
297
+ return resolver
298
+ return resolver.in_subresource(subresource)
299
+
300
+ return maybe_in_subresource
301
+
302
+
303
+ def _maybe_in_subresource_crazy_items(
304
+ in_value: Set[str] = frozenset(),
305
+ in_subvalues: Set[str] = frozenset(),
306
+ in_subarray: Set[str] = frozenset(),
307
+ ):
308
+ in_child = in_subvalues | in_subarray
309
+
310
+ def maybe_in_subresource(
311
+ segments: Sequence[int | str],
312
+ resolver: _Resolver[Any],
313
+ subresource: Resource[Any],
314
+ ) -> _Resolver[Any]:
315
+ _segments = iter(segments)
316
+ for segment in _segments:
317
+ if segment == "items" and isinstance(
318
+ subresource.contents,
319
+ Mapping,
320
+ ):
321
+ return resolver.in_subresource(subresource)
322
+ if segment not in in_value and (
323
+ segment not in in_child or next(_segments, None) is None
324
+ ):
325
+ return resolver
326
+ return resolver.in_subresource(subresource)
327
+
328
+ return maybe_in_subresource
329
+
330
+
331
+ def _maybe_in_subresource_crazy_items_dependencies(
332
+ in_value: Set[str] = frozenset(),
333
+ in_subvalues: Set[str] = frozenset(),
334
+ in_subarray: Set[str] = frozenset(),
335
+ ):
336
+ in_child = in_subvalues | in_subarray
337
+
338
+ def maybe_in_subresource(
339
+ segments: Sequence[int | str],
340
+ resolver: _Resolver[Any],
341
+ subresource: Resource[Any],
342
+ ) -> _Resolver[Any]:
343
+ _segments = iter(segments)
344
+ for segment in _segments:
345
+ if segment in {"items", "dependencies"} and isinstance(
346
+ subresource.contents,
347
+ Mapping,
348
+ ):
349
+ return resolver.in_subresource(subresource)
350
+ if segment not in in_value and (
351
+ segment not in in_child or next(_segments, None) is None
352
+ ):
353
+ return resolver
354
+ return resolver.in_subresource(subresource)
355
+
356
+ return maybe_in_subresource
357
+
358
+
359
+ #: JSON Schema draft 2020-12
360
+ DRAFT202012 = Specification(
361
+ name="draft2020-12",
362
+ id_of=_dollar_id,
363
+ subresources_of=_subresources_of(
364
+ in_value={
365
+ "additionalProperties",
366
+ "contains",
367
+ "contentSchema",
368
+ "else",
369
+ "if",
370
+ "items",
371
+ "not",
372
+ "propertyNames",
373
+ "then",
374
+ "unevaluatedItems",
375
+ "unevaluatedProperties",
376
+ },
377
+ in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"},
378
+ in_subvalues={
379
+ "$defs",
380
+ "definitions",
381
+ "dependentSchemas",
382
+ "patternProperties",
383
+ "properties",
384
+ },
385
+ ),
386
+ anchors_in=_anchor,
387
+ maybe_in_subresource=_maybe_in_subresource(
388
+ in_value={
389
+ "additionalProperties",
390
+ "contains",
391
+ "contentSchema",
392
+ "else",
393
+ "if",
394
+ "items",
395
+ "not",
396
+ "propertyNames",
397
+ "then",
398
+ "unevaluatedItems",
399
+ "unevaluatedProperties",
400
+ },
401
+ in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"},
402
+ in_subvalues={
403
+ "$defs",
404
+ "definitions",
405
+ "dependentSchemas",
406
+ "patternProperties",
407
+ "properties",
408
+ },
409
+ ),
410
+ )
411
+ #: JSON Schema draft 2019-09
412
+ DRAFT201909 = Specification(
413
+ name="draft2019-09",
414
+ id_of=_dollar_id,
415
+ subresources_of=_subresources_of_with_crazy_items(
416
+ in_value={
417
+ "additionalItems",
418
+ "additionalProperties",
419
+ "contains",
420
+ "contentSchema",
421
+ "else",
422
+ "if",
423
+ "not",
424
+ "propertyNames",
425
+ "then",
426
+ "unevaluatedItems",
427
+ "unevaluatedProperties",
428
+ },
429
+ in_subarray={"allOf", "anyOf", "oneOf"},
430
+ in_subvalues={
431
+ "$defs",
432
+ "definitions",
433
+ "dependentSchemas",
434
+ "patternProperties",
435
+ "properties",
436
+ },
437
+ ),
438
+ anchors_in=_anchor_2019, # type: ignore[reportGeneralTypeIssues] # TODO: check whether this is real
439
+ maybe_in_subresource=_maybe_in_subresource_crazy_items(
440
+ in_value={
441
+ "additionalItems",
442
+ "additionalProperties",
443
+ "contains",
444
+ "contentSchema",
445
+ "else",
446
+ "if",
447
+ "not",
448
+ "propertyNames",
449
+ "then",
450
+ "unevaluatedItems",
451
+ "unevaluatedProperties",
452
+ },
453
+ in_subarray={"allOf", "anyOf", "oneOf"},
454
+ in_subvalues={
455
+ "$defs",
456
+ "definitions",
457
+ "dependentSchemas",
458
+ "patternProperties",
459
+ "properties",
460
+ },
461
+ ),
462
+ )
463
+ #: JSON Schema draft 7
464
+ DRAFT7 = Specification(
465
+ name="draft-07",
466
+ id_of=_legacy_dollar_id,
467
+ subresources_of=_subresources_of_with_crazy_items_dependencies(
468
+ in_value={
469
+ "additionalItems",
470
+ "additionalProperties",
471
+ "contains",
472
+ "else",
473
+ "if",
474
+ "not",
475
+ "propertyNames",
476
+ "then",
477
+ },
478
+ in_subarray={"allOf", "anyOf", "oneOf"},
479
+ in_subvalues={"definitions", "patternProperties", "properties"},
480
+ ),
481
+ anchors_in=_legacy_anchor_in_dollar_id, # type: ignore[reportGeneralTypeIssues] # TODO: check whether this is real
482
+ maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies(
483
+ in_value={
484
+ "additionalItems",
485
+ "additionalProperties",
486
+ "contains",
487
+ "else",
488
+ "if",
489
+ "not",
490
+ "propertyNames",
491
+ "then",
492
+ },
493
+ in_subarray={"allOf", "anyOf", "oneOf"},
494
+ in_subvalues={"definitions", "patternProperties", "properties"},
495
+ ),
496
+ )
497
+ #: JSON Schema draft 6
498
+ DRAFT6 = Specification(
499
+ name="draft-06",
500
+ id_of=_legacy_dollar_id,
501
+ subresources_of=_subresources_of_with_crazy_items_dependencies(
502
+ in_value={
503
+ "additionalItems",
504
+ "additionalProperties",
505
+ "contains",
506
+ "not",
507
+ "propertyNames",
508
+ },
509
+ in_subarray={"allOf", "anyOf", "oneOf"},
510
+ in_subvalues={"definitions", "patternProperties", "properties"},
511
+ ),
512
+ anchors_in=_legacy_anchor_in_dollar_id, # type: ignore[reportGeneralTypeIssues] # TODO: check whether this is real
513
+ maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies(
514
+ in_value={
515
+ "additionalItems",
516
+ "additionalProperties",
517
+ "contains",
518
+ "not",
519
+ "propertyNames",
520
+ },
521
+ in_subarray={"allOf", "anyOf", "oneOf"},
522
+ in_subvalues={"definitions", "patternProperties", "properties"},
523
+ ),
524
+ )
525
+ #: JSON Schema draft 4
526
+ DRAFT4 = Specification(
527
+ name="draft-04",
528
+ id_of=_legacy_id,
529
+ subresources_of=_subresources_of_with_crazy_aP_items_dependencies(
530
+ in_value={"not"},
531
+ in_subarray={"allOf", "anyOf", "oneOf"},
532
+ in_subvalues={"definitions", "patternProperties", "properties"},
533
+ ),
534
+ anchors_in=_legacy_anchor_in_id,
535
+ maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies(
536
+ in_value={"additionalItems", "additionalProperties", "not"},
537
+ in_subarray={"allOf", "anyOf", "oneOf"},
538
+ in_subvalues={"definitions", "patternProperties", "properties"},
539
+ ),
540
+ )
541
+ #: JSON Schema draft 3
542
+ DRAFT3 = Specification(
543
+ name="draft-03",
544
+ id_of=_legacy_id,
545
+ subresources_of=_subresources_of_with_crazy_aP_items_dependencies(
546
+ in_subarray={"extends"},
547
+ in_subvalues={"definitions", "patternProperties", "properties"},
548
+ ),
549
+ anchors_in=_legacy_anchor_in_id,
550
+ maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies(
551
+ in_value={"additionalItems", "additionalProperties"},
552
+ in_subarray={"extends"},
553
+ in_subvalues={"definitions", "patternProperties", "properties"},
554
+ ),
555
+ )
556
+
557
+
558
+ _SPECIFICATIONS: Registry[Specification[Schema]] = Registry(
559
+ { # type: ignore[reportGeneralTypeIssues] # :/ internal vs external types
560
+ dialect_id: Resource.opaque(specification)
561
+ for dialect_id, specification in [
562
+ ("https://json-schema.org/draft/2020-12/schema", DRAFT202012),
563
+ ("https://json-schema.org/draft/2019-09/schema", DRAFT201909),
564
+ ("http://json-schema.org/draft-07/schema", DRAFT7),
565
+ ("http://json-schema.org/draft-06/schema", DRAFT6),
566
+ ("http://json-schema.org/draft-04/schema", DRAFT4),
567
+ ("http://json-schema.org/draft-03/schema", DRAFT3),
568
+ ]
569
+ },
570
+ )
571
+
572
+
573
+ def specification_with(
574
+ dialect_id: URI,
575
+ default: Specification[Any] | _Unset = _UNSET,
576
+ ) -> Specification[Any]:
577
+ """
578
+ Retrieve the `Specification` with the given dialect identifier.
579
+
580
+ Raises:
581
+
582
+ `UnknownDialect`
583
+
584
+ if the given ``dialect_id`` isn't known
585
+
586
+ """
587
+ resource = _SPECIFICATIONS.get(dialect_id.rstrip("#"))
588
+ if resource is not None:
589
+ return resource.contents
590
+ if default is _UNSET:
591
+ raise UnknownDialect(dialect_id)
592
+ return default
593
+
594
+
595
+ @frozen
596
+ class DynamicAnchor:
597
+ """
598
+ Dynamic anchors, introduced in draft 2020.
599
+ """
600
+
601
+ name: str
602
+ resource: SchemaResource
603
+
604
+ def resolve(self, resolver: _Resolver[Schema]) -> _Resolved[Schema]:
605
+ """
606
+ Resolve this anchor dynamically.
607
+ """
608
+ last = self.resource
609
+ for uri, registry in resolver.dynamic_scope():
610
+ try:
611
+ anchor = registry.anchor(uri, self.name).value
612
+ except exceptions.NoSuchAnchor:
613
+ continue
614
+ if isinstance(anchor, DynamicAnchor):
615
+ last = anchor.resource
616
+ return _Resolved(
617
+ contents=last.contents,
618
+ resolver=resolver.in_subresource(last),
619
+ )
620
+
621
+
622
+ def lookup_recursive_ref(resolver: _Resolver[Schema]) -> _Resolved[Schema]:
623
+ """
624
+ Recursive references (via recursive anchors), present only in draft 2019.
625
+
626
+ As per the 2019 specification (§ 8.2.4.2.1), only the ``#`` recursive
627
+ reference is supported (and is therefore assumed to be the relevant
628
+ reference).
629
+ """
630
+ resolved = resolver.lookup("#")
631
+ if isinstance(resolved.contents, Mapping) and resolved.contents.get(
632
+ "$recursiveAnchor",
633
+ ):
634
+ for uri, _ in resolver.dynamic_scope():
635
+ next_resolved = resolver.lookup(uri)
636
+ if not isinstance(
637
+ next_resolved.contents,
638
+ Mapping,
639
+ ) or not next_resolved.contents.get("$recursiveAnchor"):
640
+ break
641
+ resolved = next_resolved
642
+ return resolved
falcon/lib/python3.10/site-packages/referencing/py.typed ADDED
File without changes
falcon/lib/python3.10/site-packages/referencing/retrieval.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Helpers related to (dynamic) resource retrieval.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from functools import lru_cache
8
+ from typing import TYPE_CHECKING, Callable, TypeVar
9
+ import json
10
+
11
+ from referencing import Resource
12
+
13
+ if TYPE_CHECKING:
14
+ from referencing.typing import URI, D, Retrieve
15
+
16
+ #: A serialized document (e.g. a JSON string)
17
+ _T = TypeVar("_T")
18
+
19
+
20
+ def to_cached_resource(
21
+ cache: Callable[[Retrieve[D]], Retrieve[D]] | None = None,
22
+ loads: Callable[[_T], D] = json.loads,
23
+ from_contents: Callable[[D], Resource[D]] = Resource.from_contents,
24
+ ) -> Callable[[Callable[[URI], _T]], Retrieve[D]]:
25
+ """
26
+ Create a retriever which caches its return values from a simpler callable.
27
+
28
+ Takes a function which returns things like serialized JSON (strings) and
29
+ returns something suitable for passing to `Registry` as a retrieve
30
+ function.
31
+
32
+ This decorator both reduces a small bit of boilerplate for a common case
33
+ (deserializing JSON from strings and creating `Resource` objects from the
34
+ result) as well as makes the probable need for caching a bit easier.
35
+ Retrievers which otherwise do expensive operations (like hitting the
36
+ network) might otherwise be called repeatedly.
37
+
38
+ Examples
39
+ --------
40
+
41
+ .. testcode::
42
+
43
+ from referencing import Registry
44
+ from referencing.typing import URI
45
+ import referencing.retrieval
46
+
47
+
48
+ @referencing.retrieval.to_cached_resource()
49
+ def retrieve(uri: URI):
50
+ print(f"Retrieved {uri}")
51
+
52
+ # Normally, go get some expensive JSON from the network, a file ...
53
+ return '''
54
+ {
55
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
56
+ "foo": "bar"
57
+ }
58
+ '''
59
+
60
+ one = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo")
61
+ print(one.value.contents["foo"])
62
+
63
+ # Retrieving the same URI again reuses the same value (and thus doesn't
64
+ # print another retrieval message here)
65
+ two = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo")
66
+ print(two.value.contents["foo"])
67
+
68
+ .. testoutput::
69
+
70
+ Retrieved urn:example:foo
71
+ bar
72
+ bar
73
+
74
+ """
75
+ if cache is None:
76
+ cache = lru_cache(maxsize=None)
77
+
78
+ def decorator(retrieve: Callable[[URI], _T]):
79
+ @cache
80
+ def cached_retrieve(uri: URI):
81
+ response = retrieve(uri)
82
+ contents = loads(response)
83
+ return from_contents(contents)
84
+
85
+ return cached_retrieve
86
+
87
+ return decorator
falcon/lib/python3.10/site-packages/referencing/tests/__init__.py ADDED
File without changes
falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-310.pyc ADDED
Binary file (1.88 kB). View file
 
falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-310.pyc ADDED
Binary file (6.72 kB). View file
 
falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-310.pyc ADDED
Binary file (2.55 kB). View file
 
falcon/lib/python3.10/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-310.pyc ADDED
Binary file (3.58 kB). View file
 
falcon/lib/python3.10/site-packages/referencing/tests/test_core.py ADDED
@@ -0,0 +1,1057 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from rpds import HashTrieMap
2
+ import pytest
3
+
4
+ from referencing import Anchor, Registry, Resource, Specification, exceptions
5
+ from referencing.jsonschema import DRAFT202012
6
+
7
+ ID_AND_CHILDREN = Specification(
8
+ name="id-and-children",
9
+ id_of=lambda contents: contents.get("ID"),
10
+ subresources_of=lambda contents: contents.get("children", []),
11
+ anchors_in=lambda specification, contents: [
12
+ Anchor(
13
+ name=name,
14
+ resource=specification.create_resource(contents=each),
15
+ )
16
+ for name, each in contents.get("anchors", {}).items()
17
+ ],
18
+ maybe_in_subresource=lambda segments, resolver, subresource: (
19
+ resolver.in_subresource(subresource)
20
+ if not len(segments) % 2
21
+ and all(each == "children" for each in segments[::2])
22
+ else resolver
23
+ ),
24
+ )
25
+
26
+
27
+ def blow_up(uri): # pragma: no cover
28
+ """
29
+ A retriever suitable for use in tests which expect it never to be used.
30
+ """
31
+ raise RuntimeError("This retrieve function expects to never be called!")
32
+
33
+
34
+ class TestRegistry:
35
+ def test_with_resource(self):
36
+ """
37
+ Adding a resource to the registry then allows re-retrieving it.
38
+ """
39
+
40
+ resource = Resource.opaque(contents={"foo": "bar"})
41
+ uri = "urn:example"
42
+ registry = Registry().with_resource(uri=uri, resource=resource)
43
+ assert registry[uri] is resource
44
+
45
+ def test_with_resources(self):
46
+ """
47
+ Adding multiple resources to the registry is like adding each one.
48
+ """
49
+
50
+ one = Resource.opaque(contents={})
51
+ two = Resource(contents={"foo": "bar"}, specification=ID_AND_CHILDREN)
52
+ registry = Registry().with_resources(
53
+ [
54
+ ("http://example.com/1", one),
55
+ ("http://example.com/foo/bar", two),
56
+ ],
57
+ )
58
+ assert registry == Registry().with_resource(
59
+ uri="http://example.com/1",
60
+ resource=one,
61
+ ).with_resource(
62
+ uri="http://example.com/foo/bar",
63
+ resource=two,
64
+ )
65
+
66
+ def test_matmul_resource(self):
67
+ uri = "urn:example:resource"
68
+ resource = ID_AND_CHILDREN.create_resource({"ID": uri, "foo": 12})
69
+ registry = resource @ Registry()
70
+ assert registry == Registry().with_resource(uri, resource)
71
+
72
+ def test_matmul_many_resources(self):
73
+ one_uri = "urn:example:one"
74
+ one = ID_AND_CHILDREN.create_resource({"ID": one_uri, "foo": 12})
75
+
76
+ two_uri = "urn:example:two"
77
+ two = ID_AND_CHILDREN.create_resource({"ID": two_uri, "foo": 12})
78
+
79
+ registry = [one, two] @ Registry()
80
+ assert registry == Registry().with_resources(
81
+ [(one_uri, one), (two_uri, two)],
82
+ )
83
+
84
+ def test_matmul_resource_without_id(self):
85
+ resource = Resource.opaque(contents={"foo": "bar"})
86
+ with pytest.raises(exceptions.NoInternalID) as e:
87
+ resource @ Registry()
88
+ assert e.value == exceptions.NoInternalID(resource=resource)
89
+
90
+ def test_with_contents_from_json_schema(self):
91
+ uri = "urn:example"
92
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
93
+ registry = Registry().with_contents([(uri, schema)])
94
+
95
+ expected = Resource(contents=schema, specification=DRAFT202012)
96
+ assert registry[uri] == expected
97
+
98
+ def test_with_contents_and_default_specification(self):
99
+ uri = "urn:example"
100
+ registry = Registry().with_contents(
101
+ [(uri, {"foo": "bar"})],
102
+ default_specification=Specification.OPAQUE,
103
+ )
104
+ assert registry[uri] == Resource.opaque({"foo": "bar"})
105
+
106
+ def test_len(self):
107
+ total = 5
108
+ registry = Registry().with_contents(
109
+ [(str(i), {"foo": "bar"}) for i in range(total)],
110
+ default_specification=Specification.OPAQUE,
111
+ )
112
+ assert len(registry) == total
113
+
114
+ def test_bool_empty(self):
115
+ assert not Registry()
116
+
117
+ def test_bool_not_empty(self):
118
+ registry = Registry().with_contents(
119
+ [(str(i), {"foo": "bar"}) for i in range(3)],
120
+ default_specification=Specification.OPAQUE,
121
+ )
122
+ assert registry
123
+
124
+ def test_iter(self):
125
+ registry = Registry().with_contents(
126
+ [(str(i), {"foo": "bar"}) for i in range(8)],
127
+ default_specification=Specification.OPAQUE,
128
+ )
129
+ assert set(registry) == {str(i) for i in range(8)}
130
+
131
+ def test_crawl_still_has_top_level_resource(self):
132
+ resource = Resource.opaque({"foo": "bar"})
133
+ uri = "urn:example"
134
+ registry = Registry({uri: resource}).crawl()
135
+ assert registry[uri] is resource
136
+
137
+ def test_crawl_finds_a_subresource(self):
138
+ child_id = "urn:child"
139
+ root = ID_AND_CHILDREN.create_resource(
140
+ {"ID": "urn:root", "children": [{"ID": child_id, "foo": 12}]},
141
+ )
142
+ registry = root @ Registry()
143
+ with pytest.raises(LookupError):
144
+ registry[child_id]
145
+
146
+ expected = ID_AND_CHILDREN.create_resource({"ID": child_id, "foo": 12})
147
+ assert registry.crawl()[child_id] == expected
148
+
149
+ def test_crawl_finds_anchors_with_id(self):
150
+ resource = ID_AND_CHILDREN.create_resource(
151
+ {"ID": "urn:bar", "anchors": {"foo": 12}},
152
+ )
153
+ registry = resource @ Registry()
154
+
155
+ assert registry.crawl().anchor(resource.id(), "foo").value == Anchor(
156
+ name="foo",
157
+ resource=ID_AND_CHILDREN.create_resource(12),
158
+ )
159
+
160
+ def test_crawl_finds_anchors_no_id(self):
161
+ resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}})
162
+ registry = Registry().with_resource("urn:root", resource)
163
+
164
+ assert registry.crawl().anchor("urn:root", "foo").value == Anchor(
165
+ name="foo",
166
+ resource=ID_AND_CHILDREN.create_resource(12),
167
+ )
168
+
169
+ def test_contents(self):
170
+ resource = Resource.opaque({"foo": "bar"})
171
+ uri = "urn:example"
172
+ registry = Registry().with_resource(uri, resource)
173
+ assert registry.contents(uri) == {"foo": "bar"}
174
+
175
+ def test_getitem_strips_empty_fragments(self):
176
+ uri = "http://example.com/"
177
+ resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"})
178
+ registry = resource @ Registry()
179
+ assert registry[uri] == registry[uri + "#"] == resource
180
+
181
+ def test_contents_strips_empty_fragments(self):
182
+ uri = "http://example.com/"
183
+ resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"})
184
+ registry = resource @ Registry()
185
+ assert (
186
+ registry.contents(uri)
187
+ == registry.contents(uri + "#")
188
+ == {"ID": uri + "#"}
189
+ )
190
+
191
+ def test_contents_nonexistent_resource(self):
192
+ registry = Registry()
193
+ with pytest.raises(exceptions.NoSuchResource) as e:
194
+ registry.contents("urn:example")
195
+ assert e.value == exceptions.NoSuchResource(ref="urn:example")
196
+
197
+ def test_crawled_anchor(self):
198
+ resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}})
199
+ registry = Registry().with_resource("urn:example", resource)
200
+ retrieved = registry.anchor("urn:example", "foo")
201
+ assert retrieved.value == Anchor(
202
+ name="foo",
203
+ resource=ID_AND_CHILDREN.create_resource("bar"),
204
+ )
205
+ assert retrieved.registry == registry.crawl()
206
+
207
+ def test_anchor_in_nonexistent_resource(self):
208
+ registry = Registry()
209
+ with pytest.raises(exceptions.NoSuchResource) as e:
210
+ registry.anchor("urn:example", "foo")
211
+ assert e.value == exceptions.NoSuchResource(ref="urn:example")
212
+
213
+ def test_init(self):
214
+ one = Resource.opaque(contents={})
215
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
216
+ registry = Registry(
217
+ {
218
+ "http://example.com/1": one,
219
+ "http://example.com/foo/bar": two,
220
+ },
221
+ )
222
+ assert (
223
+ registry
224
+ == Registry()
225
+ .with_resources(
226
+ [
227
+ ("http://example.com/1", one),
228
+ ("http://example.com/foo/bar", two),
229
+ ],
230
+ )
231
+ .crawl()
232
+ )
233
+
234
+ def test_dict_conversion(self):
235
+ """
236
+ Passing a `dict` to `Registry` gets converted to a `HashTrieMap`.
237
+
238
+ So continuing to use the registry works.
239
+ """
240
+
241
+ one = Resource.opaque(contents={})
242
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
243
+ registry = Registry(
244
+ {"http://example.com/1": one},
245
+ ).with_resource("http://example.com/foo/bar", two)
246
+ assert (
247
+ registry.crawl()
248
+ == Registry()
249
+ .with_resources(
250
+ [
251
+ ("http://example.com/1", one),
252
+ ("http://example.com/foo/bar", two),
253
+ ],
254
+ )
255
+ .crawl()
256
+ )
257
+
258
+ def test_no_such_resource(self):
259
+ registry = Registry()
260
+ with pytest.raises(exceptions.NoSuchResource) as e:
261
+ registry["urn:bigboom"]
262
+ assert e.value == exceptions.NoSuchResource(ref="urn:bigboom")
263
+
264
+ def test_combine(self):
265
+ one = Resource.opaque(contents={})
266
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
267
+ three = ID_AND_CHILDREN.create_resource({"baz": "quux"})
268
+ four = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}})
269
+
270
+ first = Registry({"http://example.com/1": one})
271
+ second = Registry().with_resource("http://example.com/foo/bar", two)
272
+ third = Registry(
273
+ {
274
+ "http://example.com/1": one,
275
+ "http://example.com/baz": three,
276
+ },
277
+ )
278
+ fourth = (
279
+ Registry()
280
+ .with_resource(
281
+ "http://example.com/foo/quux",
282
+ four,
283
+ )
284
+ .crawl()
285
+ )
286
+ assert first.combine(second, third, fourth) == Registry(
287
+ [
288
+ ("http://example.com/1", one),
289
+ ("http://example.com/baz", three),
290
+ ("http://example.com/foo/quux", four),
291
+ ],
292
+ anchors=HashTrieMap(
293
+ {
294
+ ("http://example.com/foo/quux", "foo"): Anchor(
295
+ name="foo",
296
+ resource=ID_AND_CHILDREN.create_resource(12),
297
+ ),
298
+ },
299
+ ),
300
+ ).with_resource("http://example.com/foo/bar", two)
301
+
302
+ def test_combine_self(self):
303
+ """
304
+ Combining a registry with itself short-circuits.
305
+
306
+ This is a performance optimization -- otherwise we do lots more work
307
+ (in jsonschema this seems to correspond to making the test suite take
308
+ *3x* longer).
309
+ """
310
+
311
+ registry = Registry({"urn:foo": "bar"})
312
+ assert registry.combine(registry) is registry
313
+
314
+ def test_combine_with_uncrawled_resources(self):
315
+ one = Resource.opaque(contents={})
316
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
317
+ three = ID_AND_CHILDREN.create_resource({"baz": "quux"})
318
+
319
+ first = Registry().with_resource("http://example.com/1", one)
320
+ second = Registry().with_resource("http://example.com/foo/bar", two)
321
+ third = Registry(
322
+ {
323
+ "http://example.com/1": one,
324
+ "http://example.com/baz": three,
325
+ },
326
+ )
327
+ expected = Registry(
328
+ [
329
+ ("http://example.com/1", one),
330
+ ("http://example.com/foo/bar", two),
331
+ ("http://example.com/baz", three),
332
+ ],
333
+ )
334
+ combined = first.combine(second, third)
335
+ assert combined != expected
336
+ assert combined.crawl() == expected
337
+
338
+ def test_combine_with_single_retrieve(self):
339
+ one = Resource.opaque(contents={})
340
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
341
+ three = ID_AND_CHILDREN.create_resource({"baz": "quux"})
342
+
343
+ def retrieve(uri): # pragma: no cover
344
+ pass
345
+
346
+ first = Registry().with_resource("http://example.com/1", one)
347
+ second = Registry(
348
+ retrieve=retrieve,
349
+ ).with_resource("http://example.com/2", two)
350
+ third = Registry().with_resource("http://example.com/3", three)
351
+
352
+ assert first.combine(second, third) == Registry(
353
+ retrieve=retrieve,
354
+ ).with_resources(
355
+ [
356
+ ("http://example.com/1", one),
357
+ ("http://example.com/2", two),
358
+ ("http://example.com/3", three),
359
+ ],
360
+ )
361
+ assert second.combine(first, third) == Registry(
362
+ retrieve=retrieve,
363
+ ).with_resources(
364
+ [
365
+ ("http://example.com/1", one),
366
+ ("http://example.com/2", two),
367
+ ("http://example.com/3", three),
368
+ ],
369
+ )
370
+
371
+ def test_combine_with_common_retrieve(self):
372
+ one = Resource.opaque(contents={})
373
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
374
+ three = ID_AND_CHILDREN.create_resource({"baz": "quux"})
375
+
376
+ def retrieve(uri): # pragma: no cover
377
+ pass
378
+
379
+ first = Registry(retrieve=retrieve).with_resource(
380
+ "http://example.com/1",
381
+ one,
382
+ )
383
+ second = Registry(
384
+ retrieve=retrieve,
385
+ ).with_resource("http://example.com/2", two)
386
+ third = Registry(retrieve=retrieve).with_resource(
387
+ "http://example.com/3",
388
+ three,
389
+ )
390
+
391
+ assert first.combine(second, third) == Registry(
392
+ retrieve=retrieve,
393
+ ).with_resources(
394
+ [
395
+ ("http://example.com/1", one),
396
+ ("http://example.com/2", two),
397
+ ("http://example.com/3", three),
398
+ ],
399
+ )
400
+ assert second.combine(first, third) == Registry(
401
+ retrieve=retrieve,
402
+ ).with_resources(
403
+ [
404
+ ("http://example.com/1", one),
405
+ ("http://example.com/2", two),
406
+ ("http://example.com/3", three),
407
+ ],
408
+ )
409
+
410
+ def test_combine_conflicting_retrieve(self):
411
+ one = Resource.opaque(contents={})
412
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
413
+ three = ID_AND_CHILDREN.create_resource({"baz": "quux"})
414
+
415
+ def foo_retrieve(uri): # pragma: no cover
416
+ pass
417
+
418
+ def bar_retrieve(uri): # pragma: no cover
419
+ pass
420
+
421
+ first = Registry(retrieve=foo_retrieve).with_resource(
422
+ "http://example.com/1",
423
+ one,
424
+ )
425
+ second = Registry().with_resource("http://example.com/2", two)
426
+ third = Registry(retrieve=bar_retrieve).with_resource(
427
+ "http://example.com/3",
428
+ three,
429
+ )
430
+
431
+ with pytest.raises(Exception, match="conflict.*retriev"):
432
+ first.combine(second, third)
433
+
434
+ def test_remove(self):
435
+ one = Resource.opaque(contents={})
436
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
437
+ registry = Registry({"urn:foo": one, "urn:bar": two})
438
+ assert registry.remove("urn:foo") == Registry({"urn:bar": two})
439
+
440
+ def test_remove_uncrawled(self):
441
+ one = Resource.opaque(contents={})
442
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
443
+ registry = Registry().with_resources(
444
+ [("urn:foo", one), ("urn:bar", two)],
445
+ )
446
+ assert registry.remove("urn:foo") == Registry().with_resource(
447
+ "urn:bar",
448
+ two,
449
+ )
450
+
451
+ def test_remove_with_anchors(self):
452
+ one = Resource.opaque(contents={})
453
+ two = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}})
454
+ registry = (
455
+ Registry()
456
+ .with_resources(
457
+ [("urn:foo", one), ("urn:bar", two)],
458
+ )
459
+ .crawl()
460
+ )
461
+ assert (
462
+ registry.remove("urn:bar")
463
+ == Registry()
464
+ .with_resource(
465
+ "urn:foo",
466
+ one,
467
+ )
468
+ .crawl()
469
+ )
470
+
471
+ def test_remove_nonexistent_uri(self):
472
+ with pytest.raises(exceptions.NoSuchResource) as e:
473
+ Registry().remove("urn:doesNotExist")
474
+ assert e.value == exceptions.NoSuchResource(ref="urn:doesNotExist")
475
+
476
+ def test_retrieve(self):
477
+ foo = Resource.opaque({"foo": "bar"})
478
+ registry = Registry(retrieve=lambda uri: foo)
479
+ assert registry.get_or_retrieve("urn:example").value == foo
480
+
481
+ def test_retrieve_arbitrary_exception(self):
482
+ foo = Resource.opaque({"foo": "bar"})
483
+
484
+ def retrieve(uri):
485
+ if uri == "urn:succeed":
486
+ return foo
487
+ raise Exception("Oh no!")
488
+
489
+ registry = Registry(retrieve=retrieve)
490
+ assert registry.get_or_retrieve("urn:succeed").value == foo
491
+ with pytest.raises(exceptions.Unretrievable):
492
+ registry.get_or_retrieve("urn:uhoh")
493
+
494
+ def test_retrieve_no_such_resource(self):
495
+ foo = Resource.opaque({"foo": "bar"})
496
+
497
+ def retrieve(uri):
498
+ if uri == "urn:succeed":
499
+ return foo
500
+ raise exceptions.NoSuchResource(ref=uri)
501
+
502
+ registry = Registry(retrieve=retrieve)
503
+ assert registry.get_or_retrieve("urn:succeed").value == foo
504
+ with pytest.raises(exceptions.NoSuchResource):
505
+ registry.get_or_retrieve("urn:uhoh")
506
+
507
+ def test_retrieve_cannot_determine_specification(self):
508
+ def retrieve(uri):
509
+ return Resource.from_contents({})
510
+
511
+ registry = Registry(retrieve=retrieve)
512
+ with pytest.raises(exceptions.CannotDetermineSpecification):
513
+ registry.get_or_retrieve("urn:uhoh")
514
+
515
+ def test_retrieve_already_available_resource(self):
516
+ foo = Resource.opaque({"foo": "bar"})
517
+ registry = Registry({"urn:example": foo}, retrieve=blow_up)
518
+ assert registry["urn:example"] == foo
519
+ assert registry.get_or_retrieve("urn:example").value == foo
520
+
521
+ def test_retrieve_first_checks_crawlable_resource(self):
522
+ child = ID_AND_CHILDREN.create_resource({"ID": "urn:child", "foo": 12})
523
+ root = ID_AND_CHILDREN.create_resource({"children": [child.contents]})
524
+ registry = Registry(retrieve=blow_up).with_resource("urn:root", root)
525
+ assert registry.crawl()["urn:child"] == child
526
+
527
+ def test_resolver(self):
528
+ one = Resource.opaque(contents={})
529
+ registry = Registry({"http://example.com": one})
530
+ resolver = registry.resolver(base_uri="http://example.com")
531
+ assert resolver.lookup("#").contents == {}
532
+
533
+ def test_resolver_with_root_identified(self):
534
+ root = ID_AND_CHILDREN.create_resource({"ID": "http://example.com"})
535
+ resolver = Registry().resolver_with_root(root)
536
+ assert resolver.lookup("http://example.com").contents == root.contents
537
+ assert resolver.lookup("#").contents == root.contents
538
+
539
+ def test_resolver_with_root_unidentified(self):
540
+ root = Resource.opaque(contents={})
541
+ resolver = Registry().resolver_with_root(root)
542
+ assert resolver.lookup("#").contents == root.contents
543
+
544
+ def test_repr(self):
545
+ one = Resource.opaque(contents={})
546
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
547
+ registry = Registry().with_resources(
548
+ [
549
+ ("http://example.com/1", one),
550
+ ("http://example.com/foo/bar", two),
551
+ ],
552
+ )
553
+ assert repr(registry) == "<Registry (2 uncrawled resources)>"
554
+ assert repr(registry.crawl()) == "<Registry (2 resources)>"
555
+
556
+ def test_repr_mixed_crawled(self):
557
+ one = Resource.opaque(contents={})
558
+ two = ID_AND_CHILDREN.create_resource({"foo": "bar"})
559
+ registry = (
560
+ Registry(
561
+ {"http://example.com/1": one},
562
+ )
563
+ .crawl()
564
+ .with_resource(uri="http://example.com/foo/bar", resource=two)
565
+ )
566
+ assert repr(registry) == "<Registry (2 resources, 1 uncrawled)>"
567
+
568
+ def test_repr_one_resource(self):
569
+ registry = Registry().with_resource(
570
+ uri="http://example.com/1",
571
+ resource=Resource.opaque(contents={}),
572
+ )
573
+ assert repr(registry) == "<Registry (1 uncrawled resource)>"
574
+
575
+ def test_repr_empty(self):
576
+ assert repr(Registry()) == "<Registry (0 resources)>"
577
+
578
+
579
+ class TestResource:
580
+ def test_from_contents_from_json_schema(self):
581
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
582
+ resource = Resource.from_contents(schema)
583
+ assert resource == Resource(contents=schema, specification=DRAFT202012)
584
+
585
+ def test_from_contents_with_no_discernible_information(self):
586
+ """
587
+ Creating a resource with no discernible way to see what
588
+ specification it belongs to (e.g. no ``$schema`` keyword for JSON
589
+ Schema) raises an error.
590
+ """
591
+
592
+ with pytest.raises(exceptions.CannotDetermineSpecification):
593
+ Resource.from_contents({"foo": "bar"})
594
+
595
+ def test_from_contents_with_no_discernible_information_and_default(self):
596
+ resource = Resource.from_contents(
597
+ {"foo": "bar"},
598
+ default_specification=Specification.OPAQUE,
599
+ )
600
+ assert resource == Resource.opaque(contents={"foo": "bar"})
601
+
602
+ def test_from_contents_unneeded_default(self):
603
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
604
+ resource = Resource.from_contents(
605
+ schema,
606
+ default_specification=Specification.OPAQUE,
607
+ )
608
+ assert resource == Resource(
609
+ contents=schema,
610
+ specification=DRAFT202012,
611
+ )
612
+
613
+ def test_non_mapping_from_contents(self):
614
+ resource = Resource.from_contents(
615
+ True,
616
+ default_specification=ID_AND_CHILDREN,
617
+ )
618
+ assert resource == Resource(
619
+ contents=True,
620
+ specification=ID_AND_CHILDREN,
621
+ )
622
+
623
+ def test_from_contents_with_fallback(self):
624
+ resource = Resource.from_contents(
625
+ {"foo": "bar"},
626
+ default_specification=Specification.OPAQUE,
627
+ )
628
+ assert resource == Resource.opaque(contents={"foo": "bar"})
629
+
630
+ def test_id_delegates_to_specification(self):
631
+ specification = Specification(
632
+ name="",
633
+ id_of=lambda contents: "urn:fixedID",
634
+ subresources_of=lambda contents: [],
635
+ anchors_in=lambda specification, contents: [],
636
+ maybe_in_subresource=(
637
+ lambda segments, resolver, subresource: resolver
638
+ ),
639
+ )
640
+ resource = Resource(
641
+ contents={"foo": "baz"},
642
+ specification=specification,
643
+ )
644
+ assert resource.id() == "urn:fixedID"
645
+
646
+ def test_id_strips_empty_fragment(self):
647
+ uri = "http://example.com/"
648
+ root = ID_AND_CHILDREN.create_resource({"ID": uri + "#"})
649
+ assert root.id() == uri
650
+
651
+ def test_subresources_delegates_to_specification(self):
652
+ resource = ID_AND_CHILDREN.create_resource({"children": [{}, 12]})
653
+ assert list(resource.subresources()) == [
654
+ ID_AND_CHILDREN.create_resource(each) for each in [{}, 12]
655
+ ]
656
+
657
+ def test_subresource_with_different_specification(self):
658
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
659
+ resource = ID_AND_CHILDREN.create_resource({"children": [schema]})
660
+ assert list(resource.subresources()) == [
661
+ DRAFT202012.create_resource(schema),
662
+ ]
663
+
664
+ def test_anchors_delegates_to_specification(self):
665
+ resource = ID_AND_CHILDREN.create_resource(
666
+ {"anchors": {"foo": {}, "bar": 1, "baz": ""}},
667
+ )
668
+ assert list(resource.anchors()) == [
669
+ Anchor(name="foo", resource=ID_AND_CHILDREN.create_resource({})),
670
+ Anchor(name="bar", resource=ID_AND_CHILDREN.create_resource(1)),
671
+ Anchor(name="baz", resource=ID_AND_CHILDREN.create_resource("")),
672
+ ]
673
+
674
+ def test_pointer_to_mapping(self):
675
+ resource = Resource.opaque(contents={"foo": "baz"})
676
+ resolver = Registry().resolver()
677
+ assert resource.pointer("/foo", resolver=resolver).contents == "baz"
678
+
679
+ def test_pointer_to_array(self):
680
+ resource = Resource.opaque(contents={"foo": {"bar": [3]}})
681
+ resolver = Registry().resolver()
682
+ assert resource.pointer("/foo/bar/0", resolver=resolver).contents == 3
683
+
684
+ def test_root_pointer(self):
685
+ contents = {"foo": "baz"}
686
+ resource = Resource.opaque(contents=contents)
687
+ resolver = Registry().resolver()
688
+ assert resource.pointer("", resolver=resolver).contents == contents
689
+
690
+ def test_opaque(self):
691
+ contents = {"foo": "bar"}
692
+ assert Resource.opaque(contents) == Resource(
693
+ contents=contents,
694
+ specification=Specification.OPAQUE,
695
+ )
696
+
697
+
698
+ class TestResolver:
699
+ def test_lookup_exact_uri(self):
700
+ resource = Resource.opaque(contents={"foo": "baz"})
701
+ resolver = Registry({"http://example.com/1": resource}).resolver()
702
+ resolved = resolver.lookup("http://example.com/1")
703
+ assert resolved.contents == resource.contents
704
+
705
+ def test_lookup_subresource(self):
706
+ root = ID_AND_CHILDREN.create_resource(
707
+ {
708
+ "ID": "http://example.com/",
709
+ "children": [
710
+ {"ID": "http://example.com/a", "foo": 12},
711
+ ],
712
+ },
713
+ )
714
+ registry = root @ Registry()
715
+ resolved = registry.resolver().lookup("http://example.com/a")
716
+ assert resolved.contents == {"ID": "http://example.com/a", "foo": 12}
717
+
718
+ def test_lookup_anchor_with_id(self):
719
+ root = ID_AND_CHILDREN.create_resource(
720
+ {
721
+ "ID": "http://example.com/",
722
+ "anchors": {"foo": 12},
723
+ },
724
+ )
725
+ registry = root @ Registry()
726
+ resolved = registry.resolver().lookup("http://example.com/#foo")
727
+ assert resolved.contents == 12
728
+
729
+ def test_lookup_anchor_without_id(self):
730
+ root = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}})
731
+ resolver = Registry().with_resource("urn:example", root).resolver()
732
+ resolved = resolver.lookup("urn:example#foo")
733
+ assert resolved.contents == 12
734
+
735
+ def test_lookup_unknown_reference(self):
736
+ resolver = Registry().resolver()
737
+ ref = "http://example.com/does/not/exist"
738
+ with pytest.raises(exceptions.Unresolvable) as e:
739
+ resolver.lookup(ref)
740
+ assert e.value == exceptions.Unresolvable(ref=ref)
741
+
742
+ def test_lookup_non_existent_pointer(self):
743
+ resource = Resource.opaque({"foo": {}})
744
+ resolver = Registry({"http://example.com/1": resource}).resolver()
745
+ ref = "http://example.com/1#/foo/bar"
746
+ with pytest.raises(exceptions.Unresolvable) as e:
747
+ resolver.lookup(ref)
748
+ assert e.value == exceptions.PointerToNowhere(
749
+ ref="/foo/bar",
750
+ resource=resource,
751
+ )
752
+ assert str(e.value) == "'/foo/bar' does not exist within {'foo': {}}"
753
+
754
+ def test_lookup_non_existent_pointer_to_array_index(self):
755
+ resource = Resource.opaque([1, 2, 4, 8])
756
+ resolver = Registry({"http://example.com/1": resource}).resolver()
757
+ ref = "http://example.com/1#/10"
758
+ with pytest.raises(exceptions.Unresolvable) as e:
759
+ resolver.lookup(ref)
760
+ assert e.value == exceptions.PointerToNowhere(
761
+ ref="/10",
762
+ resource=resource,
763
+ )
764
+
765
+ def test_lookup_pointer_to_empty_string(self):
766
+ resolver = Registry().resolver_with_root(Resource.opaque({"": {}}))
767
+ assert resolver.lookup("#/").contents == {}
768
+
769
+ def test_lookup_non_existent_pointer_to_empty_string(self):
770
+ resource = Resource.opaque({"foo": {}})
771
+ resolver = Registry().resolver_with_root(resource)
772
+ with pytest.raises(
773
+ exceptions.Unresolvable,
774
+ match="^'/' does not exist within {'foo': {}}.*'#'",
775
+ ) as e:
776
+ resolver.lookup("#/")
777
+ assert e.value == exceptions.PointerToNowhere(
778
+ ref="/",
779
+ resource=resource,
780
+ )
781
+
782
+ def test_lookup_non_existent_anchor(self):
783
+ root = ID_AND_CHILDREN.create_resource({"anchors": {}})
784
+ resolver = Registry().with_resource("urn:example", root).resolver()
785
+ resolved = resolver.lookup("urn:example")
786
+ assert resolved.contents == root.contents
787
+
788
+ ref = "urn:example#noSuchAnchor"
789
+ with pytest.raises(exceptions.Unresolvable) as e:
790
+ resolver.lookup(ref)
791
+ assert "'noSuchAnchor' does not exist" in str(e.value)
792
+ assert e.value == exceptions.NoSuchAnchor(
793
+ ref="urn:example",
794
+ resource=root,
795
+ anchor="noSuchAnchor",
796
+ )
797
+
798
+ def test_lookup_invalid_JSON_pointerish_anchor(self):
799
+ resolver = Registry().resolver_with_root(
800
+ ID_AND_CHILDREN.create_resource(
801
+ {
802
+ "ID": "http://example.com/",
803
+ "foo": {"bar": 12},
804
+ },
805
+ ),
806
+ )
807
+
808
+ valid = resolver.lookup("#/foo/bar")
809
+ assert valid.contents == 12
810
+
811
+ with pytest.raises(exceptions.InvalidAnchor) as e:
812
+ resolver.lookup("#foo/bar")
813
+ assert " '#/foo/bar'" in str(e.value)
814
+
815
+ def test_lookup_retrieved_resource(self):
816
+ resource = Resource.opaque(contents={"foo": "baz"})
817
+ resolver = Registry(retrieve=lambda uri: resource).resolver()
818
+ resolved = resolver.lookup("http://example.com/")
819
+ assert resolved.contents == resource.contents
820
+
821
+ def test_lookup_failed_retrieved_resource(self):
822
+ """
823
+ Unretrievable exceptions are also wrapped in Unresolvable.
824
+ """
825
+
826
+ uri = "http://example.com/"
827
+
828
+ registry = Registry(retrieve=blow_up)
829
+ with pytest.raises(exceptions.Unretrievable):
830
+ registry.get_or_retrieve(uri)
831
+
832
+ resolver = registry.resolver()
833
+ with pytest.raises(exceptions.Unresolvable):
834
+ resolver.lookup(uri)
835
+
836
+ def test_repeated_lookup_from_retrieved_resource(self):
837
+ """
838
+ A (custom-)retrieved resource is added to the registry returned by
839
+ looking it up.
840
+ """
841
+ resource = Resource.opaque(contents={"foo": "baz"})
842
+ once = [resource]
843
+
844
+ def retrieve(uri):
845
+ return once.pop()
846
+
847
+ resolver = Registry(retrieve=retrieve).resolver()
848
+ resolved = resolver.lookup("http://example.com/")
849
+ assert resolved.contents == resource.contents
850
+
851
+ resolved = resolved.resolver.lookup("http://example.com/")
852
+ assert resolved.contents == resource.contents
853
+
854
+ def test_repeated_anchor_lookup_from_retrieved_resource(self):
855
+ resource = Resource.opaque(contents={"foo": "baz"})
856
+ once = [resource]
857
+
858
+ def retrieve(uri):
859
+ return once.pop()
860
+
861
+ resolver = Registry(retrieve=retrieve).resolver()
862
+ resolved = resolver.lookup("http://example.com/")
863
+ assert resolved.contents == resource.contents
864
+
865
+ resolved = resolved.resolver.lookup("#")
866
+ assert resolved.contents == resource.contents
867
+
868
+ # FIXME: The tests below aren't really representable in the current
869
+ # suite, though we should probably think of ways to do so.
870
+
871
+ def test_in_subresource(self):
872
+ root = ID_AND_CHILDREN.create_resource(
873
+ {
874
+ "ID": "http://example.com/",
875
+ "children": [
876
+ {
877
+ "ID": "child/",
878
+ "children": [{"ID": "grandchild"}],
879
+ },
880
+ ],
881
+ },
882
+ )
883
+ registry = root @ Registry()
884
+
885
+ resolver = registry.resolver()
886
+ first = resolver.lookup("http://example.com/")
887
+ assert first.contents == root.contents
888
+
889
+ with pytest.raises(exceptions.Unresolvable):
890
+ first.resolver.lookup("grandchild")
891
+
892
+ sub = first.resolver.in_subresource(
893
+ ID_AND_CHILDREN.create_resource(first.contents["children"][0]),
894
+ )
895
+ second = sub.lookup("grandchild")
896
+ assert second.contents == {"ID": "grandchild"}
897
+
898
+ def test_in_pointer_subresource(self):
899
+ root = ID_AND_CHILDREN.create_resource(
900
+ {
901
+ "ID": "http://example.com/",
902
+ "children": [
903
+ {
904
+ "ID": "child/",
905
+ "children": [{"ID": "grandchild"}],
906
+ },
907
+ ],
908
+ },
909
+ )
910
+ registry = root @ Registry()
911
+
912
+ resolver = registry.resolver()
913
+ first = resolver.lookup("http://example.com/")
914
+ assert first.contents == root.contents
915
+
916
+ with pytest.raises(exceptions.Unresolvable):
917
+ first.resolver.lookup("grandchild")
918
+
919
+ second = first.resolver.lookup("#/children/0")
920
+ third = second.resolver.lookup("grandchild")
921
+ assert third.contents == {"ID": "grandchild"}
922
+
923
+ def test_dynamic_scope(self):
924
+ one = ID_AND_CHILDREN.create_resource(
925
+ {
926
+ "ID": "http://example.com/",
927
+ "children": [
928
+ {
929
+ "ID": "child/",
930
+ "children": [{"ID": "grandchild"}],
931
+ },
932
+ ],
933
+ },
934
+ )
935
+ two = ID_AND_CHILDREN.create_resource(
936
+ {
937
+ "ID": "http://example.com/two",
938
+ "children": [{"ID": "two-child/"}],
939
+ },
940
+ )
941
+ registry = [one, two] @ Registry()
942
+
943
+ resolver = registry.resolver()
944
+ first = resolver.lookup("http://example.com/")
945
+ second = first.resolver.lookup("#/children/0")
946
+ third = second.resolver.lookup("grandchild")
947
+ fourth = third.resolver.lookup("http://example.com/two")
948
+ assert list(fourth.resolver.dynamic_scope()) == [
949
+ ("http://example.com/child/grandchild", fourth.resolver._registry),
950
+ ("http://example.com/child/", fourth.resolver._registry),
951
+ ("http://example.com/", fourth.resolver._registry),
952
+ ]
953
+ assert list(third.resolver.dynamic_scope()) == [
954
+ ("http://example.com/child/", third.resolver._registry),
955
+ ("http://example.com/", third.resolver._registry),
956
+ ]
957
+ assert list(second.resolver.dynamic_scope()) == [
958
+ ("http://example.com/", second.resolver._registry),
959
+ ]
960
+ assert list(first.resolver.dynamic_scope()) == []
961
+
962
+
963
+ class TestSpecification:
964
+ def test_create_resource(self):
965
+ specification = Specification(
966
+ name="",
967
+ id_of=lambda contents: "urn:fixedID",
968
+ subresources_of=lambda contents: [],
969
+ anchors_in=lambda specification, contents: [],
970
+ maybe_in_subresource=(
971
+ lambda segments, resolver, subresource: resolver
972
+ ),
973
+ )
974
+ resource = specification.create_resource(contents={"foo": "baz"})
975
+ assert resource == Resource(
976
+ contents={"foo": "baz"},
977
+ specification=specification,
978
+ )
979
+ assert resource.id() == "urn:fixedID"
980
+
981
+ def test_detect_from_json_schema(self):
982
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
983
+ specification = Specification.detect(schema)
984
+ assert specification == DRAFT202012
985
+
986
+ def test_detect_with_no_discernible_information(self):
987
+ with pytest.raises(exceptions.CannotDetermineSpecification):
988
+ Specification.detect({"foo": "bar"})
989
+
990
+ def test_detect_with_non_URI_schema(self):
991
+ with pytest.raises(exceptions.CannotDetermineSpecification):
992
+ Specification.detect({"$schema": 37})
993
+
994
+ def test_detect_with_no_discernible_information_and_default(self):
995
+ specification = Specification.OPAQUE.detect({"foo": "bar"})
996
+ assert specification is Specification.OPAQUE
997
+
998
+ def test_detect_unneeded_default(self):
999
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
1000
+ specification = Specification.OPAQUE.detect(schema)
1001
+ assert specification == DRAFT202012
1002
+
1003
+ def test_non_mapping_detect(self):
1004
+ with pytest.raises(exceptions.CannotDetermineSpecification):
1005
+ Specification.detect(True)
1006
+
1007
+ def test_non_mapping_detect_with_default(self):
1008
+ specification = ID_AND_CHILDREN.detect(True)
1009
+ assert specification is ID_AND_CHILDREN
1010
+
1011
+ def test_detect_with_fallback(self):
1012
+ specification = Specification.OPAQUE.detect({"foo": "bar"})
1013
+ assert specification is Specification.OPAQUE
1014
+
1015
+ def test_repr(self):
1016
+ assert (
1017
+ repr(ID_AND_CHILDREN) == "<Specification name='id-and-children'>"
1018
+ )
1019
+
1020
+
1021
+ class TestOpaqueSpecification:
1022
+ THINGS = [{"foo": "bar"}, True, 37, "foo", object()]
1023
+
1024
+ @pytest.mark.parametrize("thing", THINGS)
1025
+ def test_no_id(self, thing):
1026
+ """
1027
+ An arbitrary thing has no ID.
1028
+ """
1029
+
1030
+ assert Specification.OPAQUE.id_of(thing) is None
1031
+
1032
+ @pytest.mark.parametrize("thing", THINGS)
1033
+ def test_no_subresources(self, thing):
1034
+ """
1035
+ An arbitrary thing has no subresources.
1036
+ """
1037
+
1038
+ assert list(Specification.OPAQUE.subresources_of(thing)) == []
1039
+
1040
+ @pytest.mark.parametrize("thing", THINGS)
1041
+ def test_no_anchors(self, thing):
1042
+ """
1043
+ An arbitrary thing has no anchors.
1044
+ """
1045
+
1046
+ assert list(Specification.OPAQUE.anchors_in(thing)) == []
1047
+
1048
+
1049
+ @pytest.mark.parametrize(
1050
+ "cls",
1051
+ [Anchor, Registry, Resource, Specification, exceptions.PointerToNowhere],
1052
+ )
1053
+ def test_nonsubclassable(cls):
1054
+ with pytest.raises(Exception, match="(?i)subclassing"):
1055
+
1056
+ class Boom(cls): # pragma: no cover
1057
+ pass
falcon/lib/python3.10/site-packages/referencing/tests/test_jsonschema.py ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from referencing import Registry, Resource, Specification
4
+ import referencing.jsonschema
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ "uri, expected",
9
+ [
10
+ (
11
+ "https://json-schema.org/draft/2020-12/schema",
12
+ referencing.jsonschema.DRAFT202012,
13
+ ),
14
+ (
15
+ "https://json-schema.org/draft/2019-09/schema",
16
+ referencing.jsonschema.DRAFT201909,
17
+ ),
18
+ (
19
+ "http://json-schema.org/draft-07/schema#",
20
+ referencing.jsonschema.DRAFT7,
21
+ ),
22
+ (
23
+ "http://json-schema.org/draft-06/schema#",
24
+ referencing.jsonschema.DRAFT6,
25
+ ),
26
+ (
27
+ "http://json-schema.org/draft-04/schema#",
28
+ referencing.jsonschema.DRAFT4,
29
+ ),
30
+ (
31
+ "http://json-schema.org/draft-03/schema#",
32
+ referencing.jsonschema.DRAFT3,
33
+ ),
34
+ ],
35
+ )
36
+ def test_schemas_with_explicit_schema_keywords_are_detected(uri, expected):
37
+ """
38
+ The $schema keyword in JSON Schema is a dialect identifier.
39
+ """
40
+ contents = {"$schema": uri}
41
+ resource = Resource.from_contents(contents)
42
+ assert resource == Resource(contents=contents, specification=expected)
43
+
44
+
45
+ def test_unknown_dialect():
46
+ dialect_id = "http://example.com/unknown-json-schema-dialect-id"
47
+ with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo:
48
+ Resource.from_contents({"$schema": dialect_id})
49
+ assert excinfo.value.uri == dialect_id
50
+
51
+
52
+ @pytest.mark.parametrize(
53
+ "id, specification",
54
+ [
55
+ ("$id", referencing.jsonschema.DRAFT202012),
56
+ ("$id", referencing.jsonschema.DRAFT201909),
57
+ ("$id", referencing.jsonschema.DRAFT7),
58
+ ("$id", referencing.jsonschema.DRAFT6),
59
+ ("id", referencing.jsonschema.DRAFT4),
60
+ ("id", referencing.jsonschema.DRAFT3),
61
+ ],
62
+ )
63
+ def test_id_of_mapping(id, specification):
64
+ uri = "http://example.com/some-schema"
65
+ assert specification.id_of({id: uri}) == uri
66
+
67
+
68
+ @pytest.mark.parametrize(
69
+ "specification",
70
+ [
71
+ referencing.jsonschema.DRAFT202012,
72
+ referencing.jsonschema.DRAFT201909,
73
+ referencing.jsonschema.DRAFT7,
74
+ referencing.jsonschema.DRAFT6,
75
+ ],
76
+ )
77
+ @pytest.mark.parametrize("value", [True, False])
78
+ def test_id_of_bool(specification, value):
79
+ assert specification.id_of(value) is None
80
+
81
+
82
+ @pytest.mark.parametrize(
83
+ "specification",
84
+ [
85
+ referencing.jsonschema.DRAFT202012,
86
+ referencing.jsonschema.DRAFT201909,
87
+ referencing.jsonschema.DRAFT7,
88
+ referencing.jsonschema.DRAFT6,
89
+ ],
90
+ )
91
+ @pytest.mark.parametrize("value", [True, False])
92
+ def test_anchors_in_bool(specification, value):
93
+ assert list(specification.anchors_in(value)) == []
94
+
95
+
96
+ @pytest.mark.parametrize(
97
+ "specification",
98
+ [
99
+ referencing.jsonschema.DRAFT202012,
100
+ referencing.jsonschema.DRAFT201909,
101
+ referencing.jsonschema.DRAFT7,
102
+ referencing.jsonschema.DRAFT6,
103
+ ],
104
+ )
105
+ @pytest.mark.parametrize("value", [True, False])
106
+ def test_subresources_of_bool(specification, value):
107
+ assert list(specification.subresources_of(value)) == []
108
+
109
+
110
+ @pytest.mark.parametrize(
111
+ "uri, expected",
112
+ [
113
+ (
114
+ "https://json-schema.org/draft/2020-12/schema",
115
+ referencing.jsonschema.DRAFT202012,
116
+ ),
117
+ (
118
+ "https://json-schema.org/draft/2019-09/schema",
119
+ referencing.jsonschema.DRAFT201909,
120
+ ),
121
+ (
122
+ "http://json-schema.org/draft-07/schema#",
123
+ referencing.jsonschema.DRAFT7,
124
+ ),
125
+ (
126
+ "http://json-schema.org/draft-06/schema#",
127
+ referencing.jsonschema.DRAFT6,
128
+ ),
129
+ (
130
+ "http://json-schema.org/draft-04/schema#",
131
+ referencing.jsonschema.DRAFT4,
132
+ ),
133
+ (
134
+ "http://json-schema.org/draft-03/schema#",
135
+ referencing.jsonschema.DRAFT3,
136
+ ),
137
+ ],
138
+ )
139
+ def test_specification_with(uri, expected):
140
+ assert referencing.jsonschema.specification_with(uri) == expected
141
+
142
+
143
+ @pytest.mark.parametrize(
144
+ "uri, expected",
145
+ [
146
+ (
147
+ "http://json-schema.org/draft-07/schema",
148
+ referencing.jsonschema.DRAFT7,
149
+ ),
150
+ (
151
+ "http://json-schema.org/draft-06/schema",
152
+ referencing.jsonschema.DRAFT6,
153
+ ),
154
+ (
155
+ "http://json-schema.org/draft-04/schema",
156
+ referencing.jsonschema.DRAFT4,
157
+ ),
158
+ (
159
+ "http://json-schema.org/draft-03/schema",
160
+ referencing.jsonschema.DRAFT3,
161
+ ),
162
+ ],
163
+ )
164
+ def test_specification_with_no_empty_fragment(uri, expected):
165
+ assert referencing.jsonschema.specification_with(uri) == expected
166
+
167
+
168
+ def test_specification_with_unknown_dialect():
169
+ dialect_id = "http://example.com/unknown-json-schema-dialect-id"
170
+ with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo:
171
+ referencing.jsonschema.specification_with(dialect_id)
172
+ assert excinfo.value.uri == dialect_id
173
+
174
+
175
+ def test_specification_with_default():
176
+ dialect_id = "http://example.com/unknown-json-schema-dialect-id"
177
+ specification = referencing.jsonschema.specification_with(
178
+ dialect_id,
179
+ default=Specification.OPAQUE,
180
+ )
181
+ assert specification is Specification.OPAQUE
182
+
183
+
184
+ # FIXME: The tests below should move to the referencing suite but I haven't yet
185
+ # figured out how to represent dynamic (& recursive) ref lookups in it.
186
+ def test_lookup_trivial_dynamic_ref():
187
+ one = referencing.jsonschema.DRAFT202012.create_resource(
188
+ {"$dynamicAnchor": "foo"},
189
+ )
190
+ resolver = Registry().with_resource("http://example.com", one).resolver()
191
+ resolved = resolver.lookup("http://example.com#foo")
192
+ assert resolved.contents == one.contents
193
+
194
+
195
+ def test_multiple_lookup_trivial_dynamic_ref():
196
+ TRUE = referencing.jsonschema.DRAFT202012.create_resource(True)
197
+ root = referencing.jsonschema.DRAFT202012.create_resource(
198
+ {
199
+ "$id": "http://example.com",
200
+ "$dynamicAnchor": "fooAnchor",
201
+ "$defs": {
202
+ "foo": {
203
+ "$id": "foo",
204
+ "$dynamicAnchor": "fooAnchor",
205
+ "$defs": {
206
+ "bar": True,
207
+ "baz": {
208
+ "$dynamicAnchor": "fooAnchor",
209
+ },
210
+ },
211
+ },
212
+ },
213
+ },
214
+ )
215
+ resolver = (
216
+ Registry()
217
+ .with_resources(
218
+ [
219
+ ("http://example.com", root),
220
+ ("http://example.com/foo/", TRUE),
221
+ ("http://example.com/foo/bar", root),
222
+ ],
223
+ )
224
+ .resolver()
225
+ )
226
+
227
+ first = resolver.lookup("http://example.com")
228
+ second = first.resolver.lookup("foo/")
229
+ resolver = second.resolver.lookup("bar").resolver
230
+ fourth = resolver.lookup("#fooAnchor")
231
+ assert fourth.contents == root.contents
232
+
233
+
234
+ def test_multiple_lookup_dynamic_ref_to_nondynamic_ref():
235
+ one = referencing.jsonschema.DRAFT202012.create_resource(
236
+ {"$anchor": "fooAnchor"},
237
+ )
238
+ two = referencing.jsonschema.DRAFT202012.create_resource(
239
+ {
240
+ "$id": "http://example.com",
241
+ "$dynamicAnchor": "fooAnchor",
242
+ "$defs": {
243
+ "foo": {
244
+ "$id": "foo",
245
+ "$dynamicAnchor": "fooAnchor",
246
+ "$defs": {
247
+ "bar": True,
248
+ "baz": {
249
+ "$dynamicAnchor": "fooAnchor",
250
+ },
251
+ },
252
+ },
253
+ },
254
+ },
255
+ )
256
+ resolver = (
257
+ Registry()
258
+ .with_resources(
259
+ [
260
+ ("http://example.com", two),
261
+ ("http://example.com/foo/", one),
262
+ ("http://example.com/foo/bar", two),
263
+ ],
264
+ )
265
+ .resolver()
266
+ )
267
+
268
+ first = resolver.lookup("http://example.com")
269
+ second = first.resolver.lookup("foo/")
270
+ resolver = second.resolver.lookup("bar").resolver
271
+ fourth = resolver.lookup("#fooAnchor")
272
+ assert fourth.contents == two.contents
273
+
274
+
275
+ def test_lookup_trivial_recursive_ref():
276
+ one = referencing.jsonschema.DRAFT201909.create_resource(
277
+ {"$recursiveAnchor": True},
278
+ )
279
+ resolver = Registry().with_resource("http://example.com", one).resolver()
280
+ first = resolver.lookup("http://example.com")
281
+ resolved = referencing.jsonschema.lookup_recursive_ref(
282
+ resolver=first.resolver,
283
+ )
284
+ assert resolved.contents == one.contents
285
+
286
+
287
+ def test_lookup_recursive_ref_to_bool():
288
+ TRUE = referencing.jsonschema.DRAFT201909.create_resource(True)
289
+ registry = Registry({"http://example.com": TRUE})
290
+ resolved = referencing.jsonschema.lookup_recursive_ref(
291
+ resolver=registry.resolver(base_uri="http://example.com"),
292
+ )
293
+ assert resolved.contents == TRUE.contents
294
+
295
+
296
+ def test_multiple_lookup_recursive_ref_to_bool():
297
+ TRUE = referencing.jsonschema.DRAFT201909.create_resource(True)
298
+ root = referencing.jsonschema.DRAFT201909.create_resource(
299
+ {
300
+ "$id": "http://example.com",
301
+ "$recursiveAnchor": True,
302
+ "$defs": {
303
+ "foo": {
304
+ "$id": "foo",
305
+ "$recursiveAnchor": True,
306
+ "$defs": {
307
+ "bar": True,
308
+ "baz": {
309
+ "$recursiveAnchor": True,
310
+ "$anchor": "fooAnchor",
311
+ },
312
+ },
313
+ },
314
+ },
315
+ },
316
+ )
317
+ resolver = (
318
+ Registry()
319
+ .with_resources(
320
+ [
321
+ ("http://example.com", root),
322
+ ("http://example.com/foo/", TRUE),
323
+ ("http://example.com/foo/bar", root),
324
+ ],
325
+ )
326
+ .resolver()
327
+ )
328
+
329
+ first = resolver.lookup("http://example.com")
330
+ second = first.resolver.lookup("foo/")
331
+ resolver = second.resolver.lookup("bar").resolver
332
+ fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver)
333
+ assert fourth.contents == root.contents
334
+
335
+
336
+ def test_multiple_lookup_recursive_ref_with_nonrecursive_ref():
337
+ one = referencing.jsonschema.DRAFT201909.create_resource(
338
+ {"$recursiveAnchor": True},
339
+ )
340
+ two = referencing.jsonschema.DRAFT201909.create_resource(
341
+ {
342
+ "$id": "http://example.com",
343
+ "$recursiveAnchor": True,
344
+ "$defs": {
345
+ "foo": {
346
+ "$id": "foo",
347
+ "$recursiveAnchor": True,
348
+ "$defs": {
349
+ "bar": True,
350
+ "baz": {
351
+ "$recursiveAnchor": True,
352
+ "$anchor": "fooAnchor",
353
+ },
354
+ },
355
+ },
356
+ },
357
+ },
358
+ )
359
+ three = referencing.jsonschema.DRAFT201909.create_resource(
360
+ {"$recursiveAnchor": False},
361
+ )
362
+ resolver = (
363
+ Registry()
364
+ .with_resources(
365
+ [
366
+ ("http://example.com", three),
367
+ ("http://example.com/foo/", two),
368
+ ("http://example.com/foo/bar", one),
369
+ ],
370
+ )
371
+ .resolver()
372
+ )
373
+
374
+ first = resolver.lookup("http://example.com")
375
+ second = first.resolver.lookup("foo/")
376
+ resolver = second.resolver.lookup("bar").resolver
377
+ fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver)
378
+ assert fourth.contents == two.contents
379
+
380
+
381
+ def test_empty_registry():
382
+ assert referencing.jsonschema.EMPTY_REGISTRY == Registry()
falcon/lib/python3.10/site-packages/referencing/tests/test_referencing_suite.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import json
3
+ import os
4
+
5
+ import pytest
6
+
7
+ from referencing import Registry
8
+ from referencing.exceptions import Unresolvable
9
+ import referencing.jsonschema
10
+
11
+
12
+ class SuiteNotFound(Exception):
13
+ def __str__(self): # pragma: no cover
14
+ return (
15
+ "Cannot find the referencing suite. "
16
+ "Set the REFERENCING_SUITE environment variable to the path to "
17
+ "the suite, or run the test suite from alongside a full checkout "
18
+ "of the git repository."
19
+ )
20
+
21
+
22
+ if "REFERENCING_SUITE" in os.environ: # pragma: no cover
23
+ SUITE = Path(os.environ["REFERENCING_SUITE"]) / "tests"
24
+ else:
25
+ SUITE = Path(__file__).parent.parent.parent / "suite/tests"
26
+ if not SUITE.is_dir(): # pragma: no cover
27
+ raise SuiteNotFound()
28
+ DIALECT_IDS = json.loads(SUITE.joinpath("specifications.json").read_text())
29
+
30
+
31
+ @pytest.mark.parametrize(
32
+ "test_path",
33
+ [
34
+ pytest.param(each, id=f"{each.parent.name}-{each.stem}")
35
+ for each in SUITE.glob("*/**/*.json")
36
+ ],
37
+ )
38
+ def test_referencing_suite(test_path, subtests):
39
+ dialect_id = DIALECT_IDS[test_path.relative_to(SUITE).parts[0]]
40
+ specification = referencing.jsonschema.specification_with(dialect_id)
41
+ loaded = json.loads(test_path.read_text())
42
+ registry = loaded["registry"]
43
+ registry = Registry().with_resources(
44
+ (uri, specification.create_resource(contents))
45
+ for uri, contents in loaded["registry"].items()
46
+ )
47
+ for test in loaded["tests"]:
48
+ with subtests.test(test=test):
49
+ if "normalization" in test_path.stem:
50
+ pytest.xfail("APIs need to change for proper URL support.")
51
+
52
+ resolver = registry.resolver(base_uri=test.get("base_uri", ""))
53
+
54
+ if test.get("error"):
55
+ with pytest.raises(Unresolvable):
56
+ resolver.lookup(test["ref"])
57
+ else:
58
+ resolved = resolver.lookup(test["ref"])
59
+ assert resolved.contents == test["target"]
60
+
61
+ then = test.get("then")
62
+ while then: # pragma: no cover
63
+ with subtests.test(test=test, then=then):
64
+ resolved = resolved.resolver.lookup(then["ref"])
65
+ assert resolved.contents == then["target"]
66
+ then = then.get("then")
falcon/lib/python3.10/site-packages/referencing/tests/test_retrieval.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from functools import lru_cache
2
+ import json
3
+
4
+ import pytest
5
+
6
+ from referencing import Registry, Resource, exceptions
7
+ from referencing.jsonschema import DRAFT202012
8
+ from referencing.retrieval import to_cached_resource
9
+
10
+
11
+ class TestToCachedResource:
12
+ def test_it_caches_retrieved_resources(self):
13
+ contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
14
+ stack = [json.dumps(contents)]
15
+
16
+ @to_cached_resource()
17
+ def retrieve(uri):
18
+ return stack.pop()
19
+
20
+ registry = Registry(retrieve=retrieve)
21
+
22
+ expected = Resource.from_contents(contents)
23
+
24
+ got = registry.get_or_retrieve("urn:example:schema")
25
+ assert got.value == expected
26
+
27
+ # And a second time we get the same value.
28
+ again = registry.get_or_retrieve("urn:example:schema")
29
+ assert again.value is got.value
30
+
31
+ def test_custom_loader(self):
32
+ contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
33
+ stack = [json.dumps(contents)[::-1]]
34
+
35
+ @to_cached_resource(loads=lambda s: json.loads(s[::-1]))
36
+ def retrieve(uri):
37
+ return stack.pop()
38
+
39
+ registry = Registry(retrieve=retrieve)
40
+
41
+ expected = Resource.from_contents(contents)
42
+
43
+ got = registry.get_or_retrieve("urn:example:schema")
44
+ assert got.value == expected
45
+
46
+ # And a second time we get the same value.
47
+ again = registry.get_or_retrieve("urn:example:schema")
48
+ assert again.value is got.value
49
+
50
+ def test_custom_from_contents(self):
51
+ contents = {}
52
+ stack = [json.dumps(contents)]
53
+
54
+ @to_cached_resource(from_contents=DRAFT202012.create_resource)
55
+ def retrieve(uri):
56
+ return stack.pop()
57
+
58
+ registry = Registry(retrieve=retrieve)
59
+
60
+ expected = DRAFT202012.create_resource(contents)
61
+
62
+ got = registry.get_or_retrieve("urn:example:schema")
63
+ assert got.value == expected
64
+
65
+ # And a second time we get the same value.
66
+ again = registry.get_or_retrieve("urn:example:schema")
67
+ assert again.value is got.value
68
+
69
+ def test_custom_cache(self):
70
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
71
+ mapping = {
72
+ "urn:example:1": dict(schema, foo=1),
73
+ "urn:example:2": dict(schema, foo=2),
74
+ "urn:example:3": dict(schema, foo=3),
75
+ }
76
+
77
+ resources = {
78
+ uri: Resource.from_contents(contents)
79
+ for uri, contents in mapping.items()
80
+ }
81
+
82
+ @to_cached_resource(cache=lru_cache(maxsize=2))
83
+ def retrieve(uri):
84
+ return json.dumps(mapping.pop(uri))
85
+
86
+ registry = Registry(retrieve=retrieve)
87
+
88
+ got = registry.get_or_retrieve("urn:example:1")
89
+ assert got.value == resources["urn:example:1"]
90
+ assert registry.get_or_retrieve("urn:example:1").value is got.value
91
+ assert registry.get_or_retrieve("urn:example:1").value is got.value
92
+
93
+ got = registry.get_or_retrieve("urn:example:2")
94
+ assert got.value == resources["urn:example:2"]
95
+ assert registry.get_or_retrieve("urn:example:2").value is got.value
96
+ assert registry.get_or_retrieve("urn:example:2").value is got.value
97
+
98
+ # This still succeeds, but evicts the first URI
99
+ got = registry.get_or_retrieve("urn:example:3")
100
+ assert got.value == resources["urn:example:3"]
101
+ assert registry.get_or_retrieve("urn:example:3").value is got.value
102
+ assert registry.get_or_retrieve("urn:example:3").value is got.value
103
+
104
+ # And now this fails (as we popped the value out of `mapping`)
105
+ with pytest.raises(exceptions.Unretrievable):
106
+ registry.get_or_retrieve("urn:example:1")
falcon/lib/python3.10/site-packages/referencing/typing.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Type-annotation related support for the referencing library.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import TYPE_CHECKING, Protocol, TypeVar
8
+
9
+ try:
10
+ from collections.abc import Mapping as Mapping
11
+
12
+ Mapping[str, str]
13
+ except TypeError: # pragma: no cover
14
+ from typing import Mapping as Mapping
15
+
16
+
17
+ if TYPE_CHECKING:
18
+ from referencing._core import Resolved, Resolver, Resource
19
+
20
+ #: A URI which identifies a `Resource`.
21
+ URI = str
22
+
23
+ #: The type of documents within a registry.
24
+ D = TypeVar("D")
25
+
26
+
27
+ class Retrieve(Protocol[D]):
28
+ """
29
+ A retrieval callable, usable within a `Registry` for resource retrieval.
30
+
31
+ Does not make assumptions about where the resource might be coming from.
32
+ """
33
+
34
+ def __call__(self, uri: URI) -> Resource[D]:
35
+ """
36
+ Retrieve the resource with the given URI.
37
+
38
+ Raise `referencing.exceptions.NoSuchResource` if you wish to indicate
39
+ the retriever cannot lookup the given URI.
40
+ """
41
+ ...
42
+
43
+
44
+ class Anchor(Protocol[D]):
45
+ """
46
+ An anchor within a `Resource`.
47
+
48
+ Beyond "simple" anchors, some specifications like JSON Schema's 2020
49
+ version have dynamic anchors.
50
+ """
51
+
52
+ @property
53
+ def name(self) -> str:
54
+ """
55
+ Return the name of this anchor.
56
+ """
57
+ ...
58
+
59
+ def resolve(self, resolver: Resolver[D]) -> Resolved[D]:
60
+ """
61
+ Return the resource for this anchor.
62
+ """
63
+ ...