Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/RECORD +33 -0
- evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/REQUESTED +0 -0
- evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/top_level.txt +1 -0
- evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/LICENSE +202 -0
- evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/METADATA +36 -0
- evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/REQUESTED +0 -0
- evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/WHEEL +6 -0
- evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/top_level.txt +1 -0
- evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axisartist/tests/__pycache__/test_axis_artist.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/LICENSE +13 -0
- evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/METADATA +106 -0
- evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/WHEEL +6 -0
- evalkit_tf437/lib/python3.10/site-packages/sympy/sets/__init__.py +36 -0
- evalkit_tf437/lib/python3.10/site-packages/sympy/sets/handlers/__pycache__/mul.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/__pycache__/test_contains.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/__pycache__/test_fancysets.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/test_sets.py +1753 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/__pycache__/typing_extensions.cpython-310.pyc +3 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER +1 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE +166 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD +18 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL +5 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt +1 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/autocommand.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/autoparse.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/errors.py +23 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_compat.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/py39.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/__init__.py +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__pycache__/py38.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/py38.py +7 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/py.typed +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA +85 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL +5 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE +3 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.APACHE +177 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.BSD +23 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/METADATA +102 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/WHEEL +4 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__init__.py +11 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_re.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_types.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/_parser.py +691 -0
- falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/_re.py +107 -0
.gitattributes
CHANGED
|
@@ -1279,3 +1279,4 @@ evalkit_tf437/lib/python3.10/site-packages/transformers/__pycache__/modeling_out
|
|
| 1279 |
infer_4_33_0/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.11.2 filter=lfs diff=lfs merge=lfs -text
|
| 1280 |
falcon/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1281 |
falcon/lib/python3.10/site-packages/sklearn/preprocessing/__pycache__/_data.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1279 |
infer_4_33_0/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.11.2 filter=lfs diff=lfs merge=lfs -text
|
| 1280 |
falcon/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1281 |
falcon/lib/python3.10/site-packages/sklearn/preprocessing/__pycache__/_data.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1282 |
+
falcon/lib/python3.10/site-packages/setuptools/_vendor/__pycache__/typing_extensions.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
google/cloud/__pycache__/version.cpython-310.pyc,,
|
| 2 |
+
google/cloud/_helpers/__init__.py,sha256=7aFMb13R-zqSPwjYJvI7JL5kzDXJAA-KyWYGFuBLWeQ,18644
|
| 3 |
+
google/cloud/_helpers/__pycache__/__init__.cpython-310.pyc,,
|
| 4 |
+
google/cloud/_helpers/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 5 |
+
google/cloud/_http/__init__.py,sha256=p3Fx59gfYYVnS1-8RxTIG6f8Z6NIDNjySQzR55JdvUg,16649
|
| 6 |
+
google/cloud/_http/__pycache__/__init__.cpython-310.pyc,,
|
| 7 |
+
google/cloud/_http/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 8 |
+
google/cloud/_testing/__init__.py,sha256=ezhO0xNaEnpMaH0eB3Qi10TLgQFvk7GKoztxD0AVLW0,3397
|
| 9 |
+
google/cloud/_testing/__pycache__/__init__.cpython-310.pyc,,
|
| 10 |
+
google/cloud/_testing/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 11 |
+
google/cloud/client/__init__.py,sha256=zTsn3FwWE7Ukh43G85VunfcHUlNKf-dcWjj-i1D4gxo,12266
|
| 12 |
+
google/cloud/client/__pycache__/__init__.cpython-310.pyc,,
|
| 13 |
+
google/cloud/client/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 14 |
+
google/cloud/environment_vars/__init__.py,sha256=lCe2EyQjeJO2ImbrSR23Cj2XpwGKFFy1xCZuQo2DHEo,1318
|
| 15 |
+
google/cloud/environment_vars/__pycache__/__init__.cpython-310.pyc,,
|
| 16 |
+
google/cloud/environment_vars/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 17 |
+
google/cloud/exceptions/__init__.py,sha256=pyCO5lyFO_99DTwUsJqolO0iPOoFDhKG_ebTIfsoI6M,2199
|
| 18 |
+
google/cloud/exceptions/__pycache__/__init__.cpython-310.pyc,,
|
| 19 |
+
google/cloud/exceptions/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 20 |
+
google/cloud/obsolete/__init__.py,sha256=MeXpOiQ6BOYjkIeIEGfL59ytVy_NX1kcnbCFQcUUqsw,1479
|
| 21 |
+
google/cloud/obsolete/__pycache__/__init__.cpython-310.pyc,,
|
| 22 |
+
google/cloud/obsolete/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 23 |
+
google/cloud/operation/__init__.py,sha256=SD9exHvTtJm6cvzn8FOuz3y59fp9drpk_hBb2Ok1l-A,9083
|
| 24 |
+
google/cloud/operation/__pycache__/__init__.cpython-310.pyc,,
|
| 25 |
+
google/cloud/operation/py.typed,sha256=0XXSft34lxBaTiAPy-Gu8ejOOFXoAskbySm9m2Uq7UY,63
|
| 26 |
+
google/cloud/version.py,sha256=Y_K22yBdaAEamPLwca5c8mBwgo-dAnUXHyMVGtpBa8E,597
|
| 27 |
+
google_cloud_core-2.4.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 28 |
+
google_cloud_core-2.4.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
| 29 |
+
google_cloud_core-2.4.1.dist-info/METADATA,sha256=X7E3MwB0E0e4Os-klv14ubTpaUmKsbiutDdoumDX-hk,2706
|
| 30 |
+
google_cloud_core-2.4.1.dist-info/RECORD,,
|
| 31 |
+
google_cloud_core-2.4.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 32 |
+
google_cloud_core-2.4.1.dist-info/WHEEL,sha256=P2T-6epvtXQ2cBOE_U1K4_noqlJFN3tj15djMgEu4NM,110
|
| 33 |
+
google_cloud_core-2.4.1.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/REQUESTED
ADDED
|
File without changes
|
evalkit_tf437/lib/python3.10/site-packages/google_cloud_core-2.4.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
google
|
evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: googleapis-common-protos
|
| 3 |
+
Version: 1.65.0
|
| 4 |
+
Summary: Common protobufs used in Google APIs
|
| 5 |
+
Home-page: https://github.com/googleapis/python-api-common-protos
|
| 6 |
+
Author: Google LLC
|
| 7 |
+
Author-email: googleapis-packages@google.com
|
| 8 |
+
License: Apache-2.0
|
| 9 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 10 |
+
Classifier: Intended Audience :: Developers
|
| 11 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 12 |
+
Classifier: Programming Language :: Python
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 20 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 21 |
+
Requires-Python: >=3.7
|
| 22 |
+
Description-Content-Type: text/markdown
|
| 23 |
+
License-File: LICENSE
|
| 24 |
+
Requires-Dist: protobuf !=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0.dev0,>=3.20.2
|
| 25 |
+
Provides-Extra: grpc
|
| 26 |
+
Requires-Dist: grpcio <2.0.0.dev0,>=1.44.0 ; extra == 'grpc'
|
| 27 |
+
|
| 28 |
+
Google APIs common protos
|
| 29 |
+
-------------------------
|
| 30 |
+
|
| 31 |
+
.. image:: https://img.shields.io/pypi/v/googleapis-common-protos.svg
|
| 32 |
+
:target: https://pypi.org/project/googleapis-common-protos/
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
googleapis-common-protos contains the python classes generated from the common
|
| 36 |
+
protos in the `googleapis/googleapis <https://github.com/googleapis/googleapis>`_ repository.
|
evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/REQUESTED
ADDED
|
File without changes
|
evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (70.2.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py2-none-any
|
| 5 |
+
Tag: py3-none-any
|
| 6 |
+
|
evalkit_tf437/lib/python3.10/site-packages/googleapis_common_protos-1.65.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
google
|
evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axisartist/tests/__pycache__/test_axis_artist.cpython-310.pyc
ADDED
|
Binary file (3.11 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2018, Tzu-ping Chung <uranusjr@gmail.com>
|
| 2 |
+
|
| 3 |
+
Permission to use, copy, modify, and distribute this software for any
|
| 4 |
+
purpose with or without fee is hereby granted, provided that the above
|
| 5 |
+
copyright notice and this permission notice appear in all copies.
|
| 6 |
+
|
| 7 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| 8 |
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 9 |
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| 10 |
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 11 |
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 12 |
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
| 13 |
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/METADATA
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: shellingham
|
| 3 |
+
Version: 1.5.4
|
| 4 |
+
Summary: Tool to Detect Surrounding Shell
|
| 5 |
+
Home-page: https://github.com/sarugaku/shellingham
|
| 6 |
+
Author: Tzu-ping Chung
|
| 7 |
+
Author-email: uranusjr@gmail.com
|
| 8 |
+
License: ISC License
|
| 9 |
+
Keywords: shell
|
| 10 |
+
Classifier: Development Status :: 3 - Alpha
|
| 11 |
+
Classifier: Environment :: Console
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: License :: OSI Approved :: ISC License (ISCL)
|
| 14 |
+
Classifier: Operating System :: OS Independent
|
| 15 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 22 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 23 |
+
Requires-Python: >=3.7
|
| 24 |
+
Description-Content-Type: text/x-rst
|
| 25 |
+
License-File: LICENSE
|
| 26 |
+
|
| 27 |
+
=============================================
|
| 28 |
+
Shellingham: Tool to Detect Surrounding Shell
|
| 29 |
+
=============================================
|
| 30 |
+
|
| 31 |
+
.. image:: https://img.shields.io/pypi/v/shellingham.svg
|
| 32 |
+
:target: https://pypi.org/project/shellingham/
|
| 33 |
+
|
| 34 |
+
Shellingham detects what shell the current Python executable is running in.
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
Usage
|
| 38 |
+
=====
|
| 39 |
+
|
| 40 |
+
.. code-block:: python
|
| 41 |
+
|
| 42 |
+
>>> import shellingham
|
| 43 |
+
>>> shellingham.detect_shell()
|
| 44 |
+
('bash', '/bin/bash')
|
| 45 |
+
|
| 46 |
+
``detect_shell`` pokes around the process's running environment to determine
|
| 47 |
+
what shell it is run in. It returns a 2-tuple:
|
| 48 |
+
|
| 49 |
+
* The shell name, always lowercased.
|
| 50 |
+
* The command used to run the shell.
|
| 51 |
+
|
| 52 |
+
``ShellDetectionFailure`` is raised if ``detect_shell`` fails to detect the
|
| 53 |
+
surrounding shell.
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
Notes
|
| 57 |
+
=====
|
| 58 |
+
|
| 59 |
+
* The shell name is always lowercased.
|
| 60 |
+
* On Windows, the shell name is the name of the executable, minus the file
|
| 61 |
+
extension.
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
Notes for Application Developers
|
| 65 |
+
================================
|
| 66 |
+
|
| 67 |
+
Remember, your application's user is not necessarily using a shell.
|
| 68 |
+
Shellingham raises ``ShellDetectionFailure`` if there is no shell to detect,
|
| 69 |
+
but *your application should almost never do this to your user*.
|
| 70 |
+
|
| 71 |
+
A practical approach to this is to wrap ``detect_shell`` in a try block, and
|
| 72 |
+
provide a sane default on failure
|
| 73 |
+
|
| 74 |
+
.. code-block:: python
|
| 75 |
+
|
| 76 |
+
try:
|
| 77 |
+
shell = shellingham.detect_shell()
|
| 78 |
+
except shellingham.ShellDetectionFailure:
|
| 79 |
+
shell = provide_default()
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
There are a few choices for you to choose from.
|
| 83 |
+
|
| 84 |
+
* The POSIX standard mandates the environment variable ``SHELL`` to refer to
|
| 85 |
+
"the user's preferred command language interpreter". This is always available
|
| 86 |
+
(even if the user is not in an interactive session), and likely the correct
|
| 87 |
+
choice to launch an interactive sub-shell with.
|
| 88 |
+
* A command ``sh`` is almost guaranteed to exist, likely at ``/bin/sh``, since
|
| 89 |
+
several POSIX tools rely on it. This should be suitable if you want to run a
|
| 90 |
+
(possibly non-interactive) script.
|
| 91 |
+
* All versions of DOS and Windows have an environment variable ``COMSPEC``.
|
| 92 |
+
This can always be used to launch a usable command prompt (e.g. `cmd.exe` on
|
| 93 |
+
Windows).
|
| 94 |
+
|
| 95 |
+
Here's a simple implementation to provide a default shell
|
| 96 |
+
|
| 97 |
+
.. code-block:: python
|
| 98 |
+
|
| 99 |
+
import os
|
| 100 |
+
|
| 101 |
+
def provide_default():
|
| 102 |
+
if os.name == 'posix':
|
| 103 |
+
return os.environ['SHELL']
|
| 104 |
+
elif os.name == 'nt':
|
| 105 |
+
return os.environ['COMSPEC']
|
| 106 |
+
raise NotImplementedError(f'OS {os.name!r} support not available')
|
evalkit_tf437/lib/python3.10/site-packages/shellingham-1.5.4.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.41.2)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py2-none-any
|
| 5 |
+
Tag: py3-none-any
|
| 6 |
+
|
evalkit_tf437/lib/python3.10/site-packages/sympy/sets/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .sets import (Set, Interval, Union, FiniteSet, ProductSet,
|
| 2 |
+
Intersection, imageset, Complement, SymmetricDifference,
|
| 3 |
+
DisjointUnion)
|
| 4 |
+
|
| 5 |
+
from .fancysets import ImageSet, Range, ComplexRegion
|
| 6 |
+
from .contains import Contains
|
| 7 |
+
from .conditionset import ConditionSet
|
| 8 |
+
from .ordinals import Ordinal, OmegaPower, ord0
|
| 9 |
+
from .powerset import PowerSet
|
| 10 |
+
from ..core.singleton import S
|
| 11 |
+
from .handlers.comparison import _eval_is_eq # noqa:F401
|
| 12 |
+
Complexes = S.Complexes
|
| 13 |
+
EmptySet = S.EmptySet
|
| 14 |
+
Integers = S.Integers
|
| 15 |
+
Naturals = S.Naturals
|
| 16 |
+
Naturals0 = S.Naturals0
|
| 17 |
+
Rationals = S.Rationals
|
| 18 |
+
Reals = S.Reals
|
| 19 |
+
UniversalSet = S.UniversalSet
|
| 20 |
+
|
| 21 |
+
__all__ = [
|
| 22 |
+
'Set', 'Interval', 'Union', 'EmptySet', 'FiniteSet', 'ProductSet',
|
| 23 |
+
'Intersection', 'imageset', 'Complement', 'SymmetricDifference', 'DisjointUnion',
|
| 24 |
+
|
| 25 |
+
'ImageSet', 'Range', 'ComplexRegion', 'Reals',
|
| 26 |
+
|
| 27 |
+
'Contains',
|
| 28 |
+
|
| 29 |
+
'ConditionSet',
|
| 30 |
+
|
| 31 |
+
'Ordinal', 'OmegaPower', 'ord0',
|
| 32 |
+
|
| 33 |
+
'PowerSet',
|
| 34 |
+
|
| 35 |
+
'Reals', 'Naturals', 'Naturals0', 'UniversalSet', 'Integers', 'Rationals',
|
| 36 |
+
]
|
evalkit_tf437/lib/python3.10/site-packages/sympy/sets/handlers/__pycache__/mul.cpython-310.pyc
ADDED
|
Binary file (2.06 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/__pycache__/test_contains.cpython-310.pyc
ADDED
|
Binary file (2.33 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/__pycache__/test_fancysets.cpython-310.pyc
ADDED
|
Binary file (50.3 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/sympy/sets/tests/test_sets.py
ADDED
|
@@ -0,0 +1,1753 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sympy.concrete.summations import Sum
|
| 2 |
+
from sympy.core.add import Add
|
| 3 |
+
from sympy.core.containers import TupleKind
|
| 4 |
+
from sympy.core.function import Lambda
|
| 5 |
+
from sympy.core.kind import NumberKind, UndefinedKind
|
| 6 |
+
from sympy.core.numbers import (Float, I, Rational, nan, oo, pi, zoo)
|
| 7 |
+
from sympy.core.power import Pow
|
| 8 |
+
from sympy.core.singleton import S
|
| 9 |
+
from sympy.core.symbol import (Symbol, symbols)
|
| 10 |
+
from sympy.core.sympify import sympify
|
| 11 |
+
from sympy.functions.elementary.miscellaneous import (Max, Min, sqrt)
|
| 12 |
+
from sympy.functions.elementary.piecewise import Piecewise
|
| 13 |
+
from sympy.functions.elementary.trigonometric import (cos, sin)
|
| 14 |
+
from sympy.logic.boolalg import (false, true)
|
| 15 |
+
from sympy.matrices.kind import MatrixKind
|
| 16 |
+
from sympy.matrices.dense import Matrix
|
| 17 |
+
from sympy.polys.rootoftools import rootof
|
| 18 |
+
from sympy.sets.contains import Contains
|
| 19 |
+
from sympy.sets.fancysets import (ImageSet, Range)
|
| 20 |
+
from sympy.sets.sets import (Complement, DisjointUnion, FiniteSet, Intersection, Interval, ProductSet, Set, SymmetricDifference, Union, imageset, SetKind)
|
| 21 |
+
from mpmath import mpi
|
| 22 |
+
|
| 23 |
+
from sympy.core.expr import unchanged
|
| 24 |
+
from sympy.core.relational import Eq, Ne, Le, Lt, LessThan
|
| 25 |
+
from sympy.logic import And, Or, Xor
|
| 26 |
+
from sympy.testing.pytest import raises, XFAIL, warns_deprecated_sympy
|
| 27 |
+
from sympy.utilities.iterables import cartes
|
| 28 |
+
|
| 29 |
+
from sympy.abc import x, y, z, m, n
|
| 30 |
+
|
| 31 |
+
EmptySet = S.EmptySet
|
| 32 |
+
|
| 33 |
+
def test_imageset():
|
| 34 |
+
ints = S.Integers
|
| 35 |
+
assert imageset(x, x - 1, S.Naturals) is S.Naturals0
|
| 36 |
+
assert imageset(x, x + 1, S.Naturals0) is S.Naturals
|
| 37 |
+
assert imageset(x, abs(x), S.Naturals0) is S.Naturals0
|
| 38 |
+
assert imageset(x, abs(x), S.Naturals) is S.Naturals
|
| 39 |
+
assert imageset(x, abs(x), S.Integers) is S.Naturals0
|
| 40 |
+
# issue 16878a
|
| 41 |
+
r = symbols('r', real=True)
|
| 42 |
+
assert imageset(x, (x, x), S.Reals)._contains((1, r)) == None
|
| 43 |
+
assert imageset(x, (x, x), S.Reals)._contains((1, 2)) == False
|
| 44 |
+
assert (r, r) in imageset(x, (x, x), S.Reals)
|
| 45 |
+
assert 1 + I in imageset(x, x + I, S.Reals)
|
| 46 |
+
assert {1} not in imageset(x, (x,), S.Reals)
|
| 47 |
+
assert (1, 1) not in imageset(x, (x,), S.Reals)
|
| 48 |
+
raises(TypeError, lambda: imageset(x, ints))
|
| 49 |
+
raises(ValueError, lambda: imageset(x, y, z, ints))
|
| 50 |
+
raises(ValueError, lambda: imageset(Lambda(x, cos(x)), y))
|
| 51 |
+
assert (1, 2) in imageset(Lambda((x, y), (x, y)), ints, ints)
|
| 52 |
+
raises(ValueError, lambda: imageset(Lambda(x, x), ints, ints))
|
| 53 |
+
assert imageset(cos, ints) == ImageSet(Lambda(x, cos(x)), ints)
|
| 54 |
+
def f(x):
|
| 55 |
+
return cos(x)
|
| 56 |
+
assert imageset(f, ints) == imageset(x, cos(x), ints)
|
| 57 |
+
f = lambda x: cos(x)
|
| 58 |
+
assert imageset(f, ints) == ImageSet(Lambda(x, cos(x)), ints)
|
| 59 |
+
assert imageset(x, 1, ints) == FiniteSet(1)
|
| 60 |
+
assert imageset(x, y, ints) == {y}
|
| 61 |
+
assert imageset((x, y), (1, z), ints, S.Reals) == {(1, z)}
|
| 62 |
+
clash = Symbol('x', integer=true)
|
| 63 |
+
assert (str(imageset(lambda x: x + clash, Interval(-2, 1)).lamda.expr)
|
| 64 |
+
in ('x0 + x', 'x + x0'))
|
| 65 |
+
x1, x2 = symbols("x1, x2")
|
| 66 |
+
assert imageset(lambda x, y:
|
| 67 |
+
Add(x, y), Interval(1, 2), Interval(2, 3)).dummy_eq(
|
| 68 |
+
ImageSet(Lambda((x1, x2), x1 + x2),
|
| 69 |
+
Interval(1, 2), Interval(2, 3)))
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def test_is_empty():
|
| 73 |
+
for s in [S.Naturals, S.Naturals0, S.Integers, S.Rationals, S.Reals,
|
| 74 |
+
S.UniversalSet]:
|
| 75 |
+
assert s.is_empty is False
|
| 76 |
+
|
| 77 |
+
assert S.EmptySet.is_empty is True
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def test_is_finiteset():
|
| 81 |
+
for s in [S.Naturals, S.Naturals0, S.Integers, S.Rationals, S.Reals,
|
| 82 |
+
S.UniversalSet]:
|
| 83 |
+
assert s.is_finite_set is False
|
| 84 |
+
|
| 85 |
+
assert S.EmptySet.is_finite_set is True
|
| 86 |
+
|
| 87 |
+
assert FiniteSet(1, 2).is_finite_set is True
|
| 88 |
+
assert Interval(1, 2).is_finite_set is False
|
| 89 |
+
assert Interval(x, y).is_finite_set is None
|
| 90 |
+
assert ProductSet(FiniteSet(1), FiniteSet(2)).is_finite_set is True
|
| 91 |
+
assert ProductSet(FiniteSet(1), Interval(1, 2)).is_finite_set is False
|
| 92 |
+
assert ProductSet(FiniteSet(1), Interval(x, y)).is_finite_set is None
|
| 93 |
+
assert Union(Interval(0, 1), Interval(2, 3)).is_finite_set is False
|
| 94 |
+
assert Union(FiniteSet(1), Interval(2, 3)).is_finite_set is False
|
| 95 |
+
assert Union(FiniteSet(1), FiniteSet(2)).is_finite_set is True
|
| 96 |
+
assert Union(FiniteSet(1), Interval(x, y)).is_finite_set is None
|
| 97 |
+
assert Intersection(Interval(x, y), FiniteSet(1)).is_finite_set is True
|
| 98 |
+
assert Intersection(Interval(x, y), Interval(1, 2)).is_finite_set is None
|
| 99 |
+
assert Intersection(FiniteSet(x), FiniteSet(y)).is_finite_set is True
|
| 100 |
+
assert Complement(FiniteSet(1), Interval(x, y)).is_finite_set is True
|
| 101 |
+
assert Complement(Interval(x, y), FiniteSet(1)).is_finite_set is None
|
| 102 |
+
assert Complement(Interval(1, 2), FiniteSet(x)).is_finite_set is False
|
| 103 |
+
assert DisjointUnion(Interval(-5, 3), FiniteSet(x, y)).is_finite_set is False
|
| 104 |
+
assert DisjointUnion(S.EmptySet, FiniteSet(x, y), S.EmptySet).is_finite_set is True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def test_deprecated_is_EmptySet():
|
| 108 |
+
with warns_deprecated_sympy():
|
| 109 |
+
S.EmptySet.is_EmptySet
|
| 110 |
+
|
| 111 |
+
with warns_deprecated_sympy():
|
| 112 |
+
FiniteSet(1).is_EmptySet
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def test_interval_arguments():
|
| 116 |
+
assert Interval(0, oo) == Interval(0, oo, False, True)
|
| 117 |
+
assert Interval(0, oo).right_open is true
|
| 118 |
+
assert Interval(-oo, 0) == Interval(-oo, 0, True, False)
|
| 119 |
+
assert Interval(-oo, 0).left_open is true
|
| 120 |
+
assert Interval(oo, -oo) == S.EmptySet
|
| 121 |
+
assert Interval(oo, oo) == S.EmptySet
|
| 122 |
+
assert Interval(-oo, -oo) == S.EmptySet
|
| 123 |
+
assert Interval(oo, x) == S.EmptySet
|
| 124 |
+
assert Interval(oo, oo) == S.EmptySet
|
| 125 |
+
assert Interval(x, -oo) == S.EmptySet
|
| 126 |
+
assert Interval(x, x) == {x}
|
| 127 |
+
|
| 128 |
+
assert isinstance(Interval(1, 1), FiniteSet)
|
| 129 |
+
e = Sum(x, (x, 1, 3))
|
| 130 |
+
assert isinstance(Interval(e, e), FiniteSet)
|
| 131 |
+
|
| 132 |
+
assert Interval(1, 0) == S.EmptySet
|
| 133 |
+
assert Interval(1, 1).measure == 0
|
| 134 |
+
|
| 135 |
+
assert Interval(1, 1, False, True) == S.EmptySet
|
| 136 |
+
assert Interval(1, 1, True, False) == S.EmptySet
|
| 137 |
+
assert Interval(1, 1, True, True) == S.EmptySet
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
assert isinstance(Interval(0, Symbol('a')), Interval)
|
| 141 |
+
assert Interval(Symbol('a', positive=True), 0) == S.EmptySet
|
| 142 |
+
raises(ValueError, lambda: Interval(0, S.ImaginaryUnit))
|
| 143 |
+
raises(ValueError, lambda: Interval(0, Symbol('z', extended_real=False)))
|
| 144 |
+
raises(ValueError, lambda: Interval(x, x + S.ImaginaryUnit))
|
| 145 |
+
|
| 146 |
+
raises(NotImplementedError, lambda: Interval(0, 1, And(x, y)))
|
| 147 |
+
raises(NotImplementedError, lambda: Interval(0, 1, False, And(x, y)))
|
| 148 |
+
raises(NotImplementedError, lambda: Interval(0, 1, z, And(x, y)))
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def test_interval_symbolic_end_points():
|
| 152 |
+
a = Symbol('a', real=True)
|
| 153 |
+
|
| 154 |
+
assert Union(Interval(0, a), Interval(0, 3)).sup == Max(a, 3)
|
| 155 |
+
assert Union(Interval(a, 0), Interval(-3, 0)).inf == Min(-3, a)
|
| 156 |
+
|
| 157 |
+
assert Interval(0, a).contains(1) == LessThan(1, a)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def test_interval_is_empty():
|
| 161 |
+
x, y = symbols('x, y')
|
| 162 |
+
r = Symbol('r', real=True)
|
| 163 |
+
p = Symbol('p', positive=True)
|
| 164 |
+
n = Symbol('n', negative=True)
|
| 165 |
+
nn = Symbol('nn', nonnegative=True)
|
| 166 |
+
assert Interval(1, 2).is_empty == False
|
| 167 |
+
assert Interval(3, 3).is_empty == False # FiniteSet
|
| 168 |
+
assert Interval(r, r).is_empty == False # FiniteSet
|
| 169 |
+
assert Interval(r, r + nn).is_empty == False
|
| 170 |
+
assert Interval(x, x).is_empty == False
|
| 171 |
+
assert Interval(1, oo).is_empty == False
|
| 172 |
+
assert Interval(-oo, oo).is_empty == False
|
| 173 |
+
assert Interval(-oo, 1).is_empty == False
|
| 174 |
+
assert Interval(x, y).is_empty == None
|
| 175 |
+
assert Interval(r, oo).is_empty == False # real implies finite
|
| 176 |
+
assert Interval(n, 0).is_empty == False
|
| 177 |
+
assert Interval(n, 0, left_open=True).is_empty == False
|
| 178 |
+
assert Interval(p, 0).is_empty == True # EmptySet
|
| 179 |
+
assert Interval(nn, 0).is_empty == None
|
| 180 |
+
assert Interval(n, p).is_empty == False
|
| 181 |
+
assert Interval(0, p, left_open=True).is_empty == False
|
| 182 |
+
assert Interval(0, p, right_open=True).is_empty == False
|
| 183 |
+
assert Interval(0, nn, left_open=True).is_empty == None
|
| 184 |
+
assert Interval(0, nn, right_open=True).is_empty == None
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def test_union():
|
| 188 |
+
assert Union(Interval(1, 2), Interval(2, 3)) == Interval(1, 3)
|
| 189 |
+
assert Union(Interval(1, 2), Interval(2, 3, True)) == Interval(1, 3)
|
| 190 |
+
assert Union(Interval(1, 3), Interval(2, 4)) == Interval(1, 4)
|
| 191 |
+
assert Union(Interval(1, 2), Interval(1, 3)) == Interval(1, 3)
|
| 192 |
+
assert Union(Interval(1, 3), Interval(1, 2)) == Interval(1, 3)
|
| 193 |
+
assert Union(Interval(1, 3, False, True), Interval(1, 2)) == \
|
| 194 |
+
Interval(1, 3, False, True)
|
| 195 |
+
assert Union(Interval(1, 3), Interval(1, 2, False, True)) == Interval(1, 3)
|
| 196 |
+
assert Union(Interval(1, 2, True), Interval(1, 3)) == Interval(1, 3)
|
| 197 |
+
assert Union(Interval(1, 2, True), Interval(1, 3, True)) == \
|
| 198 |
+
Interval(1, 3, True)
|
| 199 |
+
assert Union(Interval(1, 2, True), Interval(1, 3, True, True)) == \
|
| 200 |
+
Interval(1, 3, True, True)
|
| 201 |
+
assert Union(Interval(1, 2, True, True), Interval(1, 3, True)) == \
|
| 202 |
+
Interval(1, 3, True)
|
| 203 |
+
assert Union(Interval(1, 3), Interval(2, 3)) == Interval(1, 3)
|
| 204 |
+
assert Union(Interval(1, 3, False, True), Interval(2, 3)) == \
|
| 205 |
+
Interval(1, 3)
|
| 206 |
+
assert Union(Interval(1, 2, False, True), Interval(2, 3, True)) != \
|
| 207 |
+
Interval(1, 3)
|
| 208 |
+
assert Union(Interval(1, 2), S.EmptySet) == Interval(1, 2)
|
| 209 |
+
assert Union(S.EmptySet) == S.EmptySet
|
| 210 |
+
|
| 211 |
+
assert Union(Interval(0, 1), *[FiniteSet(1.0/n) for n in range(1, 10)]) == \
|
| 212 |
+
Interval(0, 1)
|
| 213 |
+
# issue #18241:
|
| 214 |
+
x = Symbol('x')
|
| 215 |
+
assert Union(Interval(0, 1), FiniteSet(1, x)) == Union(
|
| 216 |
+
Interval(0, 1), FiniteSet(x))
|
| 217 |
+
assert unchanged(Union, Interval(0, 1), FiniteSet(2, x))
|
| 218 |
+
|
| 219 |
+
assert Interval(1, 2).union(Interval(2, 3)) == \
|
| 220 |
+
Interval(1, 2) + Interval(2, 3)
|
| 221 |
+
|
| 222 |
+
assert Interval(1, 2).union(Interval(2, 3)) == Interval(1, 3)
|
| 223 |
+
|
| 224 |
+
assert Union(Set()) == Set()
|
| 225 |
+
|
| 226 |
+
assert FiniteSet(1) + FiniteSet(2) + FiniteSet(3) == FiniteSet(1, 2, 3)
|
| 227 |
+
assert FiniteSet('ham') + FiniteSet('eggs') == FiniteSet('ham', 'eggs')
|
| 228 |
+
assert FiniteSet(1, 2, 3) + S.EmptySet == FiniteSet(1, 2, 3)
|
| 229 |
+
|
| 230 |
+
assert FiniteSet(1, 2, 3) & FiniteSet(2, 3, 4) == FiniteSet(2, 3)
|
| 231 |
+
assert FiniteSet(1, 2, 3) | FiniteSet(2, 3, 4) == FiniteSet(1, 2, 3, 4)
|
| 232 |
+
|
| 233 |
+
assert FiniteSet(1, 2, 3) & S.EmptySet == S.EmptySet
|
| 234 |
+
assert FiniteSet(1, 2, 3) | S.EmptySet == FiniteSet(1, 2, 3)
|
| 235 |
+
|
| 236 |
+
x = Symbol("x")
|
| 237 |
+
y = Symbol("y")
|
| 238 |
+
z = Symbol("z")
|
| 239 |
+
assert S.EmptySet | FiniteSet(x, FiniteSet(y, z)) == \
|
| 240 |
+
FiniteSet(x, FiniteSet(y, z))
|
| 241 |
+
|
| 242 |
+
# Test that Intervals and FiniteSets play nicely
|
| 243 |
+
assert Interval(1, 3) + FiniteSet(2) == Interval(1, 3)
|
| 244 |
+
assert Interval(1, 3, True, True) + FiniteSet(3) == \
|
| 245 |
+
Interval(1, 3, True, False)
|
| 246 |
+
X = Interval(1, 3) + FiniteSet(5)
|
| 247 |
+
Y = Interval(1, 2) + FiniteSet(3)
|
| 248 |
+
XandY = X.intersect(Y)
|
| 249 |
+
assert 2 in X and 3 in X and 3 in XandY
|
| 250 |
+
assert XandY.is_subset(X) and XandY.is_subset(Y)
|
| 251 |
+
|
| 252 |
+
raises(TypeError, lambda: Union(1, 2, 3))
|
| 253 |
+
|
| 254 |
+
assert X.is_iterable is False
|
| 255 |
+
|
| 256 |
+
# issue 7843
|
| 257 |
+
assert Union(S.EmptySet, FiniteSet(-sqrt(-I), sqrt(-I))) == \
|
| 258 |
+
FiniteSet(-sqrt(-I), sqrt(-I))
|
| 259 |
+
|
| 260 |
+
assert Union(S.Reals, S.Integers) == S.Reals
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
def test_union_iter():
|
| 264 |
+
# Use Range because it is ordered
|
| 265 |
+
u = Union(Range(3), Range(5), Range(4), evaluate=False)
|
| 266 |
+
|
| 267 |
+
# Round robin
|
| 268 |
+
assert list(u) == [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4]
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
def test_union_is_empty():
|
| 272 |
+
assert (Interval(x, y) + FiniteSet(1)).is_empty == False
|
| 273 |
+
assert (Interval(x, y) + Interval(-x, y)).is_empty == None
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def test_difference():
|
| 277 |
+
assert Interval(1, 3) - Interval(1, 2) == Interval(2, 3, True)
|
| 278 |
+
assert Interval(1, 3) - Interval(2, 3) == Interval(1, 2, False, True)
|
| 279 |
+
assert Interval(1, 3, True) - Interval(2, 3) == Interval(1, 2, True, True)
|
| 280 |
+
assert Interval(1, 3, True) - Interval(2, 3, True) == \
|
| 281 |
+
Interval(1, 2, True, False)
|
| 282 |
+
assert Interval(0, 2) - FiniteSet(1) == \
|
| 283 |
+
Union(Interval(0, 1, False, True), Interval(1, 2, True, False))
|
| 284 |
+
|
| 285 |
+
# issue #18119
|
| 286 |
+
assert S.Reals - FiniteSet(I) == S.Reals
|
| 287 |
+
assert S.Reals - FiniteSet(-I, I) == S.Reals
|
| 288 |
+
assert Interval(0, 10) - FiniteSet(-I, I) == Interval(0, 10)
|
| 289 |
+
assert Interval(0, 10) - FiniteSet(1, I) == Union(
|
| 290 |
+
Interval.Ropen(0, 1), Interval.Lopen(1, 10))
|
| 291 |
+
assert S.Reals - FiniteSet(1, 2 + I, x, y**2) == Complement(
|
| 292 |
+
Union(Interval.open(-oo, 1), Interval.open(1, oo)), FiniteSet(x, y**2),
|
| 293 |
+
evaluate=False)
|
| 294 |
+
|
| 295 |
+
assert FiniteSet(1, 2, 3) - FiniteSet(2) == FiniteSet(1, 3)
|
| 296 |
+
assert FiniteSet('ham', 'eggs') - FiniteSet('eggs') == FiniteSet('ham')
|
| 297 |
+
assert FiniteSet(1, 2, 3, 4) - Interval(2, 10, True, False) == \
|
| 298 |
+
FiniteSet(1, 2)
|
| 299 |
+
assert FiniteSet(1, 2, 3, 4) - S.EmptySet == FiniteSet(1, 2, 3, 4)
|
| 300 |
+
assert Union(Interval(0, 2), FiniteSet(2, 3, 4)) - Interval(1, 3) == \
|
| 301 |
+
Union(Interval(0, 1, False, True), FiniteSet(4))
|
| 302 |
+
|
| 303 |
+
assert -1 in S.Reals - S.Naturals
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
def test_Complement():
|
| 307 |
+
A = FiniteSet(1, 3, 4)
|
| 308 |
+
B = FiniteSet(3, 4)
|
| 309 |
+
C = Interval(1, 3)
|
| 310 |
+
D = Interval(1, 2)
|
| 311 |
+
|
| 312 |
+
assert Complement(A, B, evaluate=False).is_iterable is True
|
| 313 |
+
assert Complement(A, C, evaluate=False).is_iterable is True
|
| 314 |
+
assert Complement(C, D, evaluate=False).is_iterable is None
|
| 315 |
+
|
| 316 |
+
assert FiniteSet(*Complement(A, B, evaluate=False)) == FiniteSet(1)
|
| 317 |
+
assert FiniteSet(*Complement(A, C, evaluate=False)) == FiniteSet(4)
|
| 318 |
+
raises(TypeError, lambda: FiniteSet(*Complement(C, A, evaluate=False)))
|
| 319 |
+
|
| 320 |
+
assert Complement(Interval(1, 3), Interval(1, 2)) == Interval(2, 3, True)
|
| 321 |
+
assert Complement(FiniteSet(1, 3, 4), FiniteSet(3, 4)) == FiniteSet(1)
|
| 322 |
+
assert Complement(Union(Interval(0, 2), FiniteSet(2, 3, 4)),
|
| 323 |
+
Interval(1, 3)) == \
|
| 324 |
+
Union(Interval(0, 1, False, True), FiniteSet(4))
|
| 325 |
+
|
| 326 |
+
assert 3 not in Complement(Interval(0, 5), Interval(1, 4), evaluate=False)
|
| 327 |
+
assert -1 in Complement(S.Reals, S.Naturals, evaluate=False)
|
| 328 |
+
assert 1 not in Complement(S.Reals, S.Naturals, evaluate=False)
|
| 329 |
+
|
| 330 |
+
assert Complement(S.Integers, S.UniversalSet) == EmptySet
|
| 331 |
+
assert S.UniversalSet.complement(S.Integers) == EmptySet
|
| 332 |
+
|
| 333 |
+
assert (0 not in S.Reals.intersect(S.Integers - FiniteSet(0)))
|
| 334 |
+
|
| 335 |
+
assert S.EmptySet - S.Integers == S.EmptySet
|
| 336 |
+
|
| 337 |
+
assert (S.Integers - FiniteSet(0)) - FiniteSet(1) == S.Integers - FiniteSet(0, 1)
|
| 338 |
+
|
| 339 |
+
assert S.Reals - Union(S.Naturals, FiniteSet(pi)) == \
|
| 340 |
+
Intersection(S.Reals - S.Naturals, S.Reals - FiniteSet(pi))
|
| 341 |
+
# issue 12712
|
| 342 |
+
assert Complement(FiniteSet(x, y, 2), Interval(-10, 10)) == \
|
| 343 |
+
Complement(FiniteSet(x, y), Interval(-10, 10))
|
| 344 |
+
|
| 345 |
+
A = FiniteSet(*symbols('a:c'))
|
| 346 |
+
B = FiniteSet(*symbols('d:f'))
|
| 347 |
+
assert unchanged(Complement, ProductSet(A, A), B)
|
| 348 |
+
|
| 349 |
+
A2 = ProductSet(A, A)
|
| 350 |
+
B3 = ProductSet(B, B, B)
|
| 351 |
+
assert A2 - B3 == A2
|
| 352 |
+
assert B3 - A2 == B3
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def test_set_operations_nonsets():
|
| 356 |
+
'''Tests that e.g. FiniteSet(1) * 2 raises TypeError'''
|
| 357 |
+
ops = [
|
| 358 |
+
lambda a, b: a + b,
|
| 359 |
+
lambda a, b: a - b,
|
| 360 |
+
lambda a, b: a * b,
|
| 361 |
+
lambda a, b: a / b,
|
| 362 |
+
lambda a, b: a // b,
|
| 363 |
+
lambda a, b: a | b,
|
| 364 |
+
lambda a, b: a & b,
|
| 365 |
+
lambda a, b: a ^ b,
|
| 366 |
+
# FiniteSet(1) ** 2 gives a ProductSet
|
| 367 |
+
#lambda a, b: a ** b,
|
| 368 |
+
]
|
| 369 |
+
Sx = FiniteSet(x)
|
| 370 |
+
Sy = FiniteSet(y)
|
| 371 |
+
sets = [
|
| 372 |
+
{1},
|
| 373 |
+
FiniteSet(1),
|
| 374 |
+
Interval(1, 2),
|
| 375 |
+
Union(Sx, Interval(1, 2)),
|
| 376 |
+
Intersection(Sx, Sy),
|
| 377 |
+
Complement(Sx, Sy),
|
| 378 |
+
ProductSet(Sx, Sy),
|
| 379 |
+
S.EmptySet,
|
| 380 |
+
]
|
| 381 |
+
nums = [0, 1, 2, S(0), S(1), S(2)]
|
| 382 |
+
|
| 383 |
+
for si in sets:
|
| 384 |
+
for ni in nums:
|
| 385 |
+
for op in ops:
|
| 386 |
+
raises(TypeError, lambda : op(si, ni))
|
| 387 |
+
raises(TypeError, lambda : op(ni, si))
|
| 388 |
+
raises(TypeError, lambda: si ** object())
|
| 389 |
+
raises(TypeError, lambda: si ** {1})
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
def test_complement():
|
| 393 |
+
assert Complement({1, 2}, {1}) == {2}
|
| 394 |
+
assert Interval(0, 1).complement(S.Reals) == \
|
| 395 |
+
Union(Interval(-oo, 0, True, True), Interval(1, oo, True, True))
|
| 396 |
+
assert Interval(0, 1, True, False).complement(S.Reals) == \
|
| 397 |
+
Union(Interval(-oo, 0, True, False), Interval(1, oo, True, True))
|
| 398 |
+
assert Interval(0, 1, False, True).complement(S.Reals) == \
|
| 399 |
+
Union(Interval(-oo, 0, True, True), Interval(1, oo, False, True))
|
| 400 |
+
assert Interval(0, 1, True, True).complement(S.Reals) == \
|
| 401 |
+
Union(Interval(-oo, 0, True, False), Interval(1, oo, False, True))
|
| 402 |
+
|
| 403 |
+
assert S.UniversalSet.complement(S.EmptySet) == S.EmptySet
|
| 404 |
+
assert S.UniversalSet.complement(S.Reals) == S.EmptySet
|
| 405 |
+
assert S.UniversalSet.complement(S.UniversalSet) == S.EmptySet
|
| 406 |
+
|
| 407 |
+
assert S.EmptySet.complement(S.Reals) == S.Reals
|
| 408 |
+
|
| 409 |
+
assert Union(Interval(0, 1), Interval(2, 3)).complement(S.Reals) == \
|
| 410 |
+
Union(Interval(-oo, 0, True, True), Interval(1, 2, True, True),
|
| 411 |
+
Interval(3, oo, True, True))
|
| 412 |
+
|
| 413 |
+
assert FiniteSet(0).complement(S.Reals) == \
|
| 414 |
+
Union(Interval(-oo, 0, True, True), Interval(0, oo, True, True))
|
| 415 |
+
|
| 416 |
+
assert (FiniteSet(5) + Interval(S.NegativeInfinity,
|
| 417 |
+
0)).complement(S.Reals) == \
|
| 418 |
+
Interval(0, 5, True, True) + Interval(5, S.Infinity, True, True)
|
| 419 |
+
|
| 420 |
+
assert FiniteSet(1, 2, 3).complement(S.Reals) == \
|
| 421 |
+
Interval(S.NegativeInfinity, 1, True, True) + \
|
| 422 |
+
Interval(1, 2, True, True) + Interval(2, 3, True, True) +\
|
| 423 |
+
Interval(3, S.Infinity, True, True)
|
| 424 |
+
|
| 425 |
+
assert FiniteSet(x).complement(S.Reals) == Complement(S.Reals, FiniteSet(x))
|
| 426 |
+
|
| 427 |
+
assert FiniteSet(0, x).complement(S.Reals) == Complement(Interval(-oo, 0, True, True) +
|
| 428 |
+
Interval(0, oo, True, True)
|
| 429 |
+
, FiniteSet(x), evaluate=False)
|
| 430 |
+
|
| 431 |
+
square = Interval(0, 1) * Interval(0, 1)
|
| 432 |
+
notsquare = square.complement(S.Reals*S.Reals)
|
| 433 |
+
|
| 434 |
+
assert all(pt in square for pt in [(0, 0), (.5, .5), (1, 0), (1, 1)])
|
| 435 |
+
assert not any(
|
| 436 |
+
pt in notsquare for pt in [(0, 0), (.5, .5), (1, 0), (1, 1)])
|
| 437 |
+
assert not any(pt in square for pt in [(-1, 0), (1.5, .5), (10, 10)])
|
| 438 |
+
assert all(pt in notsquare for pt in [(-1, 0), (1.5, .5), (10, 10)])
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
def test_intersect1():
|
| 442 |
+
assert all(S.Integers.intersection(i) is i for i in
|
| 443 |
+
(S.Naturals, S.Naturals0))
|
| 444 |
+
assert all(i.intersection(S.Integers) is i for i in
|
| 445 |
+
(S.Naturals, S.Naturals0))
|
| 446 |
+
s = S.Naturals0
|
| 447 |
+
assert S.Naturals.intersection(s) is S.Naturals
|
| 448 |
+
assert s.intersection(S.Naturals) is S.Naturals
|
| 449 |
+
x = Symbol('x')
|
| 450 |
+
assert Interval(0, 2).intersect(Interval(1, 2)) == Interval(1, 2)
|
| 451 |
+
assert Interval(0, 2).intersect(Interval(1, 2, True)) == \
|
| 452 |
+
Interval(1, 2, True)
|
| 453 |
+
assert Interval(0, 2, True).intersect(Interval(1, 2)) == \
|
| 454 |
+
Interval(1, 2, False, False)
|
| 455 |
+
assert Interval(0, 2, True, True).intersect(Interval(1, 2)) == \
|
| 456 |
+
Interval(1, 2, False, True)
|
| 457 |
+
assert Interval(0, 2).intersect(Union(Interval(0, 1), Interval(2, 3))) == \
|
| 458 |
+
Union(Interval(0, 1), Interval(2, 2))
|
| 459 |
+
|
| 460 |
+
assert FiniteSet(1, 2).intersect(FiniteSet(1, 2, 3)) == FiniteSet(1, 2)
|
| 461 |
+
assert FiniteSet(1, 2, x).intersect(FiniteSet(x)) == FiniteSet(x)
|
| 462 |
+
assert FiniteSet('ham', 'eggs').intersect(FiniteSet('ham')) == \
|
| 463 |
+
FiniteSet('ham')
|
| 464 |
+
assert FiniteSet(1, 2, 3, 4, 5).intersect(S.EmptySet) == S.EmptySet
|
| 465 |
+
|
| 466 |
+
assert Interval(0, 5).intersect(FiniteSet(1, 3)) == FiniteSet(1, 3)
|
| 467 |
+
assert Interval(0, 1, True, True).intersect(FiniteSet(1)) == S.EmptySet
|
| 468 |
+
|
| 469 |
+
assert Union(Interval(0, 1), Interval(2, 3)).intersect(Interval(1, 2)) == \
|
| 470 |
+
Union(Interval(1, 1), Interval(2, 2))
|
| 471 |
+
assert Union(Interval(0, 1), Interval(2, 3)).intersect(Interval(0, 2)) == \
|
| 472 |
+
Union(Interval(0, 1), Interval(2, 2))
|
| 473 |
+
assert Union(Interval(0, 1), Interval(2, 3)).intersect(Interval(1, 2, True, True)) == \
|
| 474 |
+
S.EmptySet
|
| 475 |
+
assert Union(Interval(0, 1), Interval(2, 3)).intersect(S.EmptySet) == \
|
| 476 |
+
S.EmptySet
|
| 477 |
+
assert Union(Interval(0, 5), FiniteSet('ham')).intersect(FiniteSet(2, 3, 4, 5, 6)) == \
|
| 478 |
+
Intersection(FiniteSet(2, 3, 4, 5, 6), Union(FiniteSet('ham'), Interval(0, 5)))
|
| 479 |
+
assert Intersection(FiniteSet(1, 2, 3), Interval(2, x), Interval(3, y)) == \
|
| 480 |
+
Intersection(FiniteSet(3), Interval(2, x), Interval(3, y), evaluate=False)
|
| 481 |
+
assert Intersection(FiniteSet(1, 2), Interval(0, 3), Interval(x, y)) == \
|
| 482 |
+
Intersection({1, 2}, Interval(x, y), evaluate=False)
|
| 483 |
+
assert Intersection(FiniteSet(1, 2, 4), Interval(0, 3), Interval(x, y)) == \
|
| 484 |
+
Intersection({1, 2}, Interval(x, y), evaluate=False)
|
| 485 |
+
# XXX: Is the real=True necessary here?
|
| 486 |
+
# https://github.com/sympy/sympy/issues/17532
|
| 487 |
+
m, n = symbols('m, n', real=True)
|
| 488 |
+
assert Intersection(FiniteSet(m), FiniteSet(m, n), Interval(m, m+1)) == \
|
| 489 |
+
FiniteSet(m)
|
| 490 |
+
|
| 491 |
+
# issue 8217
|
| 492 |
+
assert Intersection(FiniteSet(x), FiniteSet(y)) == \
|
| 493 |
+
Intersection(FiniteSet(x), FiniteSet(y), evaluate=False)
|
| 494 |
+
assert FiniteSet(x).intersect(S.Reals) == \
|
| 495 |
+
Intersection(S.Reals, FiniteSet(x), evaluate=False)
|
| 496 |
+
|
| 497 |
+
# tests for the intersection alias
|
| 498 |
+
assert Interval(0, 5).intersection(FiniteSet(1, 3)) == FiniteSet(1, 3)
|
| 499 |
+
assert Interval(0, 1, True, True).intersection(FiniteSet(1)) == S.EmptySet
|
| 500 |
+
|
| 501 |
+
assert Union(Interval(0, 1), Interval(2, 3)).intersection(Interval(1, 2)) == \
|
| 502 |
+
Union(Interval(1, 1), Interval(2, 2))
|
| 503 |
+
|
| 504 |
+
# canonical boundary selected
|
| 505 |
+
a = sqrt(2*sqrt(6) + 5)
|
| 506 |
+
b = sqrt(2) + sqrt(3)
|
| 507 |
+
assert Interval(a, 4).intersection(Interval(b, 5)) == Interval(b, 4)
|
| 508 |
+
assert Interval(1, a).intersection(Interval(0, b)) == Interval(1, b)
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
def test_intersection_interval_float():
|
| 512 |
+
# intersection of Intervals with mixed Rational/Float boundaries should
|
| 513 |
+
# lead to Float boundaries in all cases regardless of which Interval is
|
| 514 |
+
# open or closed.
|
| 515 |
+
typs = [
|
| 516 |
+
(Interval, Interval, Interval),
|
| 517 |
+
(Interval, Interval.open, Interval.open),
|
| 518 |
+
(Interval, Interval.Lopen, Interval.Lopen),
|
| 519 |
+
(Interval, Interval.Ropen, Interval.Ropen),
|
| 520 |
+
(Interval.open, Interval.open, Interval.open),
|
| 521 |
+
(Interval.open, Interval.Lopen, Interval.open),
|
| 522 |
+
(Interval.open, Interval.Ropen, Interval.open),
|
| 523 |
+
(Interval.Lopen, Interval.Lopen, Interval.Lopen),
|
| 524 |
+
(Interval.Lopen, Interval.Ropen, Interval.open),
|
| 525 |
+
(Interval.Ropen, Interval.Ropen, Interval.Ropen),
|
| 526 |
+
]
|
| 527 |
+
|
| 528 |
+
as_float = lambda a1, a2: a2 if isinstance(a2, float) else a1
|
| 529 |
+
|
| 530 |
+
for t1, t2, t3 in typs:
|
| 531 |
+
for t1i, t2i in [(t1, t2), (t2, t1)]:
|
| 532 |
+
for a1, a2, b1, b2 in cartes([2, 2.0], [2, 2.0], [3, 3.0], [3, 3.0]):
|
| 533 |
+
I1 = t1(a1, b1)
|
| 534 |
+
I2 = t2(a2, b2)
|
| 535 |
+
I3 = t3(as_float(a1, a2), as_float(b1, b2))
|
| 536 |
+
assert I1.intersect(I2) == I3
|
| 537 |
+
|
| 538 |
+
|
| 539 |
+
def test_intersection():
|
| 540 |
+
# iterable
|
| 541 |
+
i = Intersection(FiniteSet(1, 2, 3), Interval(2, 5), evaluate=False)
|
| 542 |
+
assert i.is_iterable
|
| 543 |
+
assert set(i) == {S(2), S(3)}
|
| 544 |
+
|
| 545 |
+
# challenging intervals
|
| 546 |
+
x = Symbol('x', real=True)
|
| 547 |
+
i = Intersection(Interval(0, 3), Interval(x, 6))
|
| 548 |
+
assert (5 in i) is False
|
| 549 |
+
raises(TypeError, lambda: 2 in i)
|
| 550 |
+
|
| 551 |
+
# Singleton special cases
|
| 552 |
+
assert Intersection(Interval(0, 1), S.EmptySet) == S.EmptySet
|
| 553 |
+
assert Intersection(Interval(-oo, oo), Interval(-oo, x)) == Interval(-oo, x)
|
| 554 |
+
|
| 555 |
+
# Products
|
| 556 |
+
line = Interval(0, 5)
|
| 557 |
+
i = Intersection(line**2, line**3, evaluate=False)
|
| 558 |
+
assert (2, 2) not in i
|
| 559 |
+
assert (2, 2, 2) not in i
|
| 560 |
+
raises(TypeError, lambda: list(i))
|
| 561 |
+
|
| 562 |
+
a = Intersection(Intersection(S.Integers, S.Naturals, evaluate=False), S.Reals, evaluate=False)
|
| 563 |
+
assert a._argset == frozenset([Intersection(S.Naturals, S.Integers, evaluate=False), S.Reals])
|
| 564 |
+
|
| 565 |
+
assert Intersection(S.Complexes, FiniteSet(S.ComplexInfinity)) == S.EmptySet
|
| 566 |
+
|
| 567 |
+
# issue 12178
|
| 568 |
+
assert Intersection() == S.UniversalSet
|
| 569 |
+
|
| 570 |
+
# issue 16987
|
| 571 |
+
assert Intersection({1}, {1}, {x}) == Intersection({1}, {x})
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
def test_issue_9623():
|
| 575 |
+
n = Symbol('n')
|
| 576 |
+
|
| 577 |
+
a = S.Reals
|
| 578 |
+
b = Interval(0, oo)
|
| 579 |
+
c = FiniteSet(n)
|
| 580 |
+
|
| 581 |
+
assert Intersection(a, b, c) == Intersection(b, c)
|
| 582 |
+
assert Intersection(Interval(1, 2), Interval(3, 4), FiniteSet(n)) == EmptySet
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
def test_is_disjoint():
|
| 586 |
+
assert Interval(0, 2).is_disjoint(Interval(1, 2)) == False
|
| 587 |
+
assert Interval(0, 2).is_disjoint(Interval(3, 4)) == True
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
def test_ProductSet__len__():
|
| 591 |
+
A = FiniteSet(1, 2)
|
| 592 |
+
B = FiniteSet(1, 2, 3)
|
| 593 |
+
assert ProductSet(A).__len__() == 2
|
| 594 |
+
assert ProductSet(A).__len__() is not S(2)
|
| 595 |
+
assert ProductSet(A, B).__len__() == 6
|
| 596 |
+
assert ProductSet(A, B).__len__() is not S(6)
|
| 597 |
+
|
| 598 |
+
|
| 599 |
+
def test_ProductSet():
|
| 600 |
+
# ProductSet is always a set of Tuples
|
| 601 |
+
assert ProductSet(S.Reals) == S.Reals ** 1
|
| 602 |
+
assert ProductSet(S.Reals, S.Reals) == S.Reals ** 2
|
| 603 |
+
assert ProductSet(S.Reals, S.Reals, S.Reals) == S.Reals ** 3
|
| 604 |
+
|
| 605 |
+
assert ProductSet(S.Reals) != S.Reals
|
| 606 |
+
assert ProductSet(S.Reals, S.Reals) == S.Reals * S.Reals
|
| 607 |
+
assert ProductSet(S.Reals, S.Reals, S.Reals) != S.Reals * S.Reals * S.Reals
|
| 608 |
+
assert ProductSet(S.Reals, S.Reals, S.Reals) == (S.Reals * S.Reals * S.Reals).flatten()
|
| 609 |
+
|
| 610 |
+
assert 1 not in ProductSet(S.Reals)
|
| 611 |
+
assert (1,) in ProductSet(S.Reals)
|
| 612 |
+
|
| 613 |
+
assert 1 not in ProductSet(S.Reals, S.Reals)
|
| 614 |
+
assert (1, 2) in ProductSet(S.Reals, S.Reals)
|
| 615 |
+
assert (1, I) not in ProductSet(S.Reals, S.Reals)
|
| 616 |
+
|
| 617 |
+
assert (1, 2, 3) in ProductSet(S.Reals, S.Reals, S.Reals)
|
| 618 |
+
assert (1, 2, 3) in S.Reals ** 3
|
| 619 |
+
assert (1, 2, 3) not in S.Reals * S.Reals * S.Reals
|
| 620 |
+
assert ((1, 2), 3) in S.Reals * S.Reals * S.Reals
|
| 621 |
+
assert (1, (2, 3)) not in S.Reals * S.Reals * S.Reals
|
| 622 |
+
assert (1, (2, 3)) in S.Reals * (S.Reals * S.Reals)
|
| 623 |
+
|
| 624 |
+
assert ProductSet() == FiniteSet(())
|
| 625 |
+
assert ProductSet(S.Reals, S.EmptySet) == S.EmptySet
|
| 626 |
+
|
| 627 |
+
# See GH-17458
|
| 628 |
+
|
| 629 |
+
for ni in range(5):
|
| 630 |
+
Rn = ProductSet(*(S.Reals,) * ni)
|
| 631 |
+
assert (1,) * ni in Rn
|
| 632 |
+
assert 1 not in Rn
|
| 633 |
+
|
| 634 |
+
assert (S.Reals * S.Reals) * S.Reals != S.Reals * (S.Reals * S.Reals)
|
| 635 |
+
|
| 636 |
+
S1 = S.Reals
|
| 637 |
+
S2 = S.Integers
|
| 638 |
+
x1 = pi
|
| 639 |
+
x2 = 3
|
| 640 |
+
assert x1 in S1
|
| 641 |
+
assert x2 in S2
|
| 642 |
+
assert (x1, x2) in S1 * S2
|
| 643 |
+
S3 = S1 * S2
|
| 644 |
+
x3 = (x1, x2)
|
| 645 |
+
assert x3 in S3
|
| 646 |
+
assert (x3, x3) in S3 * S3
|
| 647 |
+
assert x3 + x3 not in S3 * S3
|
| 648 |
+
|
| 649 |
+
raises(ValueError, lambda: S.Reals**-1)
|
| 650 |
+
with warns_deprecated_sympy():
|
| 651 |
+
ProductSet(FiniteSet(s) for s in range(2))
|
| 652 |
+
raises(TypeError, lambda: ProductSet(None))
|
| 653 |
+
|
| 654 |
+
S1 = FiniteSet(1, 2)
|
| 655 |
+
S2 = FiniteSet(3, 4)
|
| 656 |
+
S3 = ProductSet(S1, S2)
|
| 657 |
+
assert (S3.as_relational(x, y)
|
| 658 |
+
== And(S1.as_relational(x), S2.as_relational(y))
|
| 659 |
+
== And(Or(Eq(x, 1), Eq(x, 2)), Or(Eq(y, 3), Eq(y, 4))))
|
| 660 |
+
raises(ValueError, lambda: S3.as_relational(x))
|
| 661 |
+
raises(ValueError, lambda: S3.as_relational(x, 1))
|
| 662 |
+
raises(ValueError, lambda: ProductSet(Interval(0, 1)).as_relational(x, y))
|
| 663 |
+
|
| 664 |
+
Z2 = ProductSet(S.Integers, S.Integers)
|
| 665 |
+
assert Z2.contains((1, 2)) is S.true
|
| 666 |
+
assert Z2.contains((1,)) is S.false
|
| 667 |
+
assert Z2.contains(x) == Contains(x, Z2, evaluate=False)
|
| 668 |
+
assert Z2.contains(x).subs(x, 1) is S.false
|
| 669 |
+
assert Z2.contains((x, 1)).subs(x, 2) is S.true
|
| 670 |
+
assert Z2.contains((x, y)) == Contains(x, S.Integers) & Contains(y, S.Integers)
|
| 671 |
+
assert unchanged(Contains, (x, y), Z2)
|
| 672 |
+
assert Contains((1, 2), Z2) is S.true
|
| 673 |
+
|
| 674 |
+
|
| 675 |
+
def test_ProductSet_of_single_arg_is_not_arg():
|
| 676 |
+
assert unchanged(ProductSet, Interval(0, 1))
|
| 677 |
+
assert unchanged(ProductSet, ProductSet(Interval(0, 1)))
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
def test_ProductSet_is_empty():
|
| 681 |
+
assert ProductSet(S.Integers, S.Reals).is_empty == False
|
| 682 |
+
assert ProductSet(Interval(x, 1), S.Reals).is_empty == None
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
def test_interval_subs():
|
| 686 |
+
a = Symbol('a', real=True)
|
| 687 |
+
|
| 688 |
+
assert Interval(0, a).subs(a, 2) == Interval(0, 2)
|
| 689 |
+
assert Interval(a, 0).subs(a, 2) == S.EmptySet
|
| 690 |
+
|
| 691 |
+
|
| 692 |
+
def test_interval_to_mpi():
|
| 693 |
+
assert Interval(0, 1).to_mpi() == mpi(0, 1)
|
| 694 |
+
assert Interval(0, 1, True, False).to_mpi() == mpi(0, 1)
|
| 695 |
+
assert type(Interval(0, 1).to_mpi()) == type(mpi(0, 1))
|
| 696 |
+
|
| 697 |
+
|
| 698 |
+
def test_set_evalf():
|
| 699 |
+
assert Interval(S(11)/64, S.Half).evalf() == Interval(
|
| 700 |
+
Float('0.171875'), Float('0.5'))
|
| 701 |
+
assert Interval(x, S.Half, right_open=True).evalf() == Interval(
|
| 702 |
+
x, Float('0.5'), right_open=True)
|
| 703 |
+
assert Interval(-oo, S.Half).evalf() == Interval(-oo, Float('0.5'))
|
| 704 |
+
assert FiniteSet(2, x).evalf() == FiniteSet(Float('2.0'), x)
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
def test_measure():
|
| 708 |
+
a = Symbol('a', real=True)
|
| 709 |
+
|
| 710 |
+
assert Interval(1, 3).measure == 2
|
| 711 |
+
assert Interval(0, a).measure == a
|
| 712 |
+
assert Interval(1, a).measure == a - 1
|
| 713 |
+
|
| 714 |
+
assert Union(Interval(1, 2), Interval(3, 4)).measure == 2
|
| 715 |
+
assert Union(Interval(1, 2), Interval(3, 4), FiniteSet(5, 6, 7)).measure \
|
| 716 |
+
== 2
|
| 717 |
+
|
| 718 |
+
assert FiniteSet(1, 2, oo, a, -oo, -5).measure == 0
|
| 719 |
+
|
| 720 |
+
assert S.EmptySet.measure == 0
|
| 721 |
+
|
| 722 |
+
square = Interval(0, 10) * Interval(0, 10)
|
| 723 |
+
offsetsquare = Interval(5, 15) * Interval(5, 15)
|
| 724 |
+
band = Interval(-oo, oo) * Interval(2, 4)
|
| 725 |
+
|
| 726 |
+
assert square.measure == offsetsquare.measure == 100
|
| 727 |
+
assert (square + offsetsquare).measure == 175 # there is some overlap
|
| 728 |
+
assert (square - offsetsquare).measure == 75
|
| 729 |
+
assert (square * FiniteSet(1, 2, 3)).measure == 0
|
| 730 |
+
assert (square.intersect(band)).measure == 20
|
| 731 |
+
assert (square + band).measure is oo
|
| 732 |
+
assert (band * FiniteSet(1, 2, 3)).measure is nan
|
| 733 |
+
|
| 734 |
+
|
| 735 |
+
def test_is_subset():
|
| 736 |
+
assert Interval(0, 1).is_subset(Interval(0, 2)) is True
|
| 737 |
+
assert Interval(0, 3).is_subset(Interval(0, 2)) is False
|
| 738 |
+
assert Interval(0, 1).is_subset(FiniteSet(0, 1)) is False
|
| 739 |
+
|
| 740 |
+
assert FiniteSet(1, 2).is_subset(FiniteSet(1, 2, 3, 4))
|
| 741 |
+
assert FiniteSet(4, 5).is_subset(FiniteSet(1, 2, 3, 4)) is False
|
| 742 |
+
assert FiniteSet(1).is_subset(Interval(0, 2))
|
| 743 |
+
assert FiniteSet(1, 2).is_subset(Interval(0, 2, True, True)) is False
|
| 744 |
+
assert (Interval(1, 2) + FiniteSet(3)).is_subset(
|
| 745 |
+
Interval(0, 2, False, True) + FiniteSet(2, 3))
|
| 746 |
+
|
| 747 |
+
assert Interval(3, 4).is_subset(Union(Interval(0, 1), Interval(2, 5))) is True
|
| 748 |
+
assert Interval(3, 6).is_subset(Union(Interval(0, 1), Interval(2, 5))) is False
|
| 749 |
+
|
| 750 |
+
assert FiniteSet(1, 2, 3, 4).is_subset(Interval(0, 5)) is True
|
| 751 |
+
assert S.EmptySet.is_subset(FiniteSet(1, 2, 3)) is True
|
| 752 |
+
|
| 753 |
+
assert Interval(0, 1).is_subset(S.EmptySet) is False
|
| 754 |
+
assert S.EmptySet.is_subset(S.EmptySet) is True
|
| 755 |
+
|
| 756 |
+
raises(ValueError, lambda: S.EmptySet.is_subset(1))
|
| 757 |
+
|
| 758 |
+
# tests for the issubset alias
|
| 759 |
+
assert FiniteSet(1, 2, 3, 4).issubset(Interval(0, 5)) is True
|
| 760 |
+
assert S.EmptySet.issubset(FiniteSet(1, 2, 3)) is True
|
| 761 |
+
|
| 762 |
+
assert S.Naturals.is_subset(S.Integers)
|
| 763 |
+
assert S.Naturals0.is_subset(S.Integers)
|
| 764 |
+
|
| 765 |
+
assert FiniteSet(x).is_subset(FiniteSet(y)) is None
|
| 766 |
+
assert FiniteSet(x).is_subset(FiniteSet(y).subs(y, x)) is True
|
| 767 |
+
assert FiniteSet(x).is_subset(FiniteSet(y).subs(y, x+1)) is False
|
| 768 |
+
|
| 769 |
+
assert Interval(0, 1).is_subset(Interval(0, 1, left_open=True)) is False
|
| 770 |
+
assert Interval(-2, 3).is_subset(Union(Interval(-oo, -2), Interval(3, oo))) is False
|
| 771 |
+
|
| 772 |
+
n = Symbol('n', integer=True)
|
| 773 |
+
assert Range(-3, 4, 1).is_subset(FiniteSet(-10, 10)) is False
|
| 774 |
+
assert Range(S(10)**100).is_subset(FiniteSet(0, 1, 2)) is False
|
| 775 |
+
assert Range(6, 0, -2).is_subset(FiniteSet(2, 4, 6)) is True
|
| 776 |
+
assert Range(1, oo).is_subset(FiniteSet(1, 2)) is False
|
| 777 |
+
assert Range(-oo, 1).is_subset(FiniteSet(1)) is False
|
| 778 |
+
assert Range(3).is_subset(FiniteSet(0, 1, n)) is None
|
| 779 |
+
assert Range(n, n + 2).is_subset(FiniteSet(n, n + 1)) is True
|
| 780 |
+
assert Range(5).is_subset(Interval(0, 4, right_open=True)) is False
|
| 781 |
+
#issue 19513
|
| 782 |
+
assert imageset(Lambda(n, 1/n), S.Integers).is_subset(S.Reals) is None
|
| 783 |
+
|
| 784 |
+
def test_is_proper_subset():
|
| 785 |
+
assert Interval(0, 1).is_proper_subset(Interval(0, 2)) is True
|
| 786 |
+
assert Interval(0, 3).is_proper_subset(Interval(0, 2)) is False
|
| 787 |
+
assert S.EmptySet.is_proper_subset(FiniteSet(1, 2, 3)) is True
|
| 788 |
+
|
| 789 |
+
raises(ValueError, lambda: Interval(0, 1).is_proper_subset(0))
|
| 790 |
+
|
| 791 |
+
|
| 792 |
+
def test_is_superset():
|
| 793 |
+
assert Interval(0, 1).is_superset(Interval(0, 2)) == False
|
| 794 |
+
assert Interval(0, 3).is_superset(Interval(0, 2))
|
| 795 |
+
|
| 796 |
+
assert FiniteSet(1, 2).is_superset(FiniteSet(1, 2, 3, 4)) == False
|
| 797 |
+
assert FiniteSet(4, 5).is_superset(FiniteSet(1, 2, 3, 4)) == False
|
| 798 |
+
assert FiniteSet(1).is_superset(Interval(0, 2)) == False
|
| 799 |
+
assert FiniteSet(1, 2).is_superset(Interval(0, 2, True, True)) == False
|
| 800 |
+
assert (Interval(1, 2) + FiniteSet(3)).is_superset(
|
| 801 |
+
Interval(0, 2, False, True) + FiniteSet(2, 3)) == False
|
| 802 |
+
|
| 803 |
+
assert Interval(3, 4).is_superset(Union(Interval(0, 1), Interval(2, 5))) == False
|
| 804 |
+
|
| 805 |
+
assert FiniteSet(1, 2, 3, 4).is_superset(Interval(0, 5)) == False
|
| 806 |
+
assert S.EmptySet.is_superset(FiniteSet(1, 2, 3)) == False
|
| 807 |
+
|
| 808 |
+
assert Interval(0, 1).is_superset(S.EmptySet) == True
|
| 809 |
+
assert S.EmptySet.is_superset(S.EmptySet) == True
|
| 810 |
+
|
| 811 |
+
raises(ValueError, lambda: S.EmptySet.is_superset(1))
|
| 812 |
+
|
| 813 |
+
# tests for the issuperset alias
|
| 814 |
+
assert Interval(0, 1).issuperset(S.EmptySet) == True
|
| 815 |
+
assert S.EmptySet.issuperset(S.EmptySet) == True
|
| 816 |
+
|
| 817 |
+
|
| 818 |
+
def test_is_proper_superset():
|
| 819 |
+
assert Interval(0, 1).is_proper_superset(Interval(0, 2)) is False
|
| 820 |
+
assert Interval(0, 3).is_proper_superset(Interval(0, 2)) is True
|
| 821 |
+
assert FiniteSet(1, 2, 3).is_proper_superset(S.EmptySet) is True
|
| 822 |
+
|
| 823 |
+
raises(ValueError, lambda: Interval(0, 1).is_proper_superset(0))
|
| 824 |
+
|
| 825 |
+
|
| 826 |
+
def test_contains():
|
| 827 |
+
assert Interval(0, 2).contains(1) is S.true
|
| 828 |
+
assert Interval(0, 2).contains(3) is S.false
|
| 829 |
+
assert Interval(0, 2, True, False).contains(0) is S.false
|
| 830 |
+
assert Interval(0, 2, True, False).contains(2) is S.true
|
| 831 |
+
assert Interval(0, 2, False, True).contains(0) is S.true
|
| 832 |
+
assert Interval(0, 2, False, True).contains(2) is S.false
|
| 833 |
+
assert Interval(0, 2, True, True).contains(0) is S.false
|
| 834 |
+
assert Interval(0, 2, True, True).contains(2) is S.false
|
| 835 |
+
|
| 836 |
+
assert (Interval(0, 2) in Interval(0, 2)) is False
|
| 837 |
+
|
| 838 |
+
assert FiniteSet(1, 2, 3).contains(2) is S.true
|
| 839 |
+
assert FiniteSet(1, 2, Symbol('x')).contains(Symbol('x')) is S.true
|
| 840 |
+
|
| 841 |
+
assert FiniteSet(y)._contains(x) == Eq(y, x, evaluate=False)
|
| 842 |
+
raises(TypeError, lambda: x in FiniteSet(y))
|
| 843 |
+
assert FiniteSet({x, y})._contains({x}) == Eq({x, y}, {x}, evaluate=False)
|
| 844 |
+
assert FiniteSet({x, y}).subs(y, x)._contains({x}) is S.true
|
| 845 |
+
assert FiniteSet({x, y}).subs(y, x+1)._contains({x}) is S.false
|
| 846 |
+
|
| 847 |
+
# issue 8197
|
| 848 |
+
from sympy.abc import a, b
|
| 849 |
+
assert FiniteSet(b).contains(-a) == Eq(b, -a)
|
| 850 |
+
assert FiniteSet(b).contains(a) == Eq(b, a)
|
| 851 |
+
assert FiniteSet(a).contains(1) == Eq(a, 1)
|
| 852 |
+
raises(TypeError, lambda: 1 in FiniteSet(a))
|
| 853 |
+
|
| 854 |
+
# issue 8209
|
| 855 |
+
rad1 = Pow(Pow(2, Rational(1, 3)) - 1, Rational(1, 3))
|
| 856 |
+
rad2 = Pow(Rational(1, 9), Rational(1, 3)) - Pow(Rational(2, 9), Rational(1, 3)) + Pow(Rational(4, 9), Rational(1, 3))
|
| 857 |
+
s1 = FiniteSet(rad1)
|
| 858 |
+
s2 = FiniteSet(rad2)
|
| 859 |
+
assert s1 - s2 == S.EmptySet
|
| 860 |
+
|
| 861 |
+
items = [1, 2, S.Infinity, S('ham'), -1.1]
|
| 862 |
+
fset = FiniteSet(*items)
|
| 863 |
+
assert all(item in fset for item in items)
|
| 864 |
+
assert all(fset.contains(item) is S.true for item in items)
|
| 865 |
+
|
| 866 |
+
assert Union(Interval(0, 1), Interval(2, 5)).contains(3) is S.true
|
| 867 |
+
assert Union(Interval(0, 1), Interval(2, 5)).contains(6) is S.false
|
| 868 |
+
assert Union(Interval(0, 1), FiniteSet(2, 5)).contains(3) is S.false
|
| 869 |
+
|
| 870 |
+
assert S.EmptySet.contains(1) is S.false
|
| 871 |
+
assert FiniteSet(rootof(x**3 + x - 1, 0)).contains(S.Infinity) is S.false
|
| 872 |
+
|
| 873 |
+
assert rootof(x**5 + x**3 + 1, 0) in S.Reals
|
| 874 |
+
assert not rootof(x**5 + x**3 + 1, 1) in S.Reals
|
| 875 |
+
|
| 876 |
+
# non-bool results
|
| 877 |
+
assert Union(Interval(1, 2), Interval(3, 4)).contains(x) == \
|
| 878 |
+
Or(And(S.One <= x, x <= 2), And(S(3) <= x, x <= 4))
|
| 879 |
+
assert Intersection(Interval(1, x), Interval(2, 3)).contains(y) == \
|
| 880 |
+
And(y <= 3, y <= x, S.One <= y, S(2) <= y)
|
| 881 |
+
|
| 882 |
+
assert (S.Complexes).contains(S.ComplexInfinity) == S.false
|
| 883 |
+
|
| 884 |
+
|
| 885 |
+
def test_interval_symbolic():
|
| 886 |
+
x = Symbol('x')
|
| 887 |
+
e = Interval(0, 1)
|
| 888 |
+
assert e.contains(x) == And(S.Zero <= x, x <= 1)
|
| 889 |
+
raises(TypeError, lambda: x in e)
|
| 890 |
+
e = Interval(0, 1, True, True)
|
| 891 |
+
assert e.contains(x) == And(S.Zero < x, x < 1)
|
| 892 |
+
c = Symbol('c', real=False)
|
| 893 |
+
assert Interval(x, x + 1).contains(c) == False
|
| 894 |
+
e = Symbol('e', extended_real=True)
|
| 895 |
+
assert Interval(-oo, oo).contains(e) == And(
|
| 896 |
+
S.NegativeInfinity < e, e < S.Infinity)
|
| 897 |
+
|
| 898 |
+
|
| 899 |
+
def test_union_contains():
|
| 900 |
+
x = Symbol('x')
|
| 901 |
+
i1 = Interval(0, 1)
|
| 902 |
+
i2 = Interval(2, 3)
|
| 903 |
+
i3 = Union(i1, i2)
|
| 904 |
+
assert i3.as_relational(x) == Or(And(S.Zero <= x, x <= 1), And(S(2) <= x, x <= 3))
|
| 905 |
+
raises(TypeError, lambda: x in i3)
|
| 906 |
+
e = i3.contains(x)
|
| 907 |
+
assert e == i3.as_relational(x)
|
| 908 |
+
assert e.subs(x, -0.5) is false
|
| 909 |
+
assert e.subs(x, 0.5) is true
|
| 910 |
+
assert e.subs(x, 1.5) is false
|
| 911 |
+
assert e.subs(x, 2.5) is true
|
| 912 |
+
assert e.subs(x, 3.5) is false
|
| 913 |
+
|
| 914 |
+
U = Interval(0, 2, True, True) + Interval(10, oo) + FiniteSet(-1, 2, 5, 6)
|
| 915 |
+
assert all(el not in U for el in [0, 4, -oo])
|
| 916 |
+
assert all(el in U for el in [2, 5, 10])
|
| 917 |
+
|
| 918 |
+
|
| 919 |
+
def test_is_number():
|
| 920 |
+
assert Interval(0, 1).is_number is False
|
| 921 |
+
assert Set().is_number is False
|
| 922 |
+
|
| 923 |
+
|
| 924 |
+
def test_Interval_is_left_unbounded():
|
| 925 |
+
assert Interval(3, 4).is_left_unbounded is False
|
| 926 |
+
assert Interval(-oo, 3).is_left_unbounded is True
|
| 927 |
+
assert Interval(Float("-inf"), 3).is_left_unbounded is True
|
| 928 |
+
|
| 929 |
+
|
| 930 |
+
def test_Interval_is_right_unbounded():
|
| 931 |
+
assert Interval(3, 4).is_right_unbounded is False
|
| 932 |
+
assert Interval(3, oo).is_right_unbounded is True
|
| 933 |
+
assert Interval(3, Float("+inf")).is_right_unbounded is True
|
| 934 |
+
|
| 935 |
+
|
| 936 |
+
def test_Interval_as_relational():
|
| 937 |
+
x = Symbol('x')
|
| 938 |
+
|
| 939 |
+
assert Interval(-1, 2, False, False).as_relational(x) == \
|
| 940 |
+
And(Le(-1, x), Le(x, 2))
|
| 941 |
+
assert Interval(-1, 2, True, False).as_relational(x) == \
|
| 942 |
+
And(Lt(-1, x), Le(x, 2))
|
| 943 |
+
assert Interval(-1, 2, False, True).as_relational(x) == \
|
| 944 |
+
And(Le(-1, x), Lt(x, 2))
|
| 945 |
+
assert Interval(-1, 2, True, True).as_relational(x) == \
|
| 946 |
+
And(Lt(-1, x), Lt(x, 2))
|
| 947 |
+
|
| 948 |
+
assert Interval(-oo, 2, right_open=False).as_relational(x) == And(Lt(-oo, x), Le(x, 2))
|
| 949 |
+
assert Interval(-oo, 2, right_open=True).as_relational(x) == And(Lt(-oo, x), Lt(x, 2))
|
| 950 |
+
|
| 951 |
+
assert Interval(-2, oo, left_open=False).as_relational(x) == And(Le(-2, x), Lt(x, oo))
|
| 952 |
+
assert Interval(-2, oo, left_open=True).as_relational(x) == And(Lt(-2, x), Lt(x, oo))
|
| 953 |
+
|
| 954 |
+
assert Interval(-oo, oo).as_relational(x) == And(Lt(-oo, x), Lt(x, oo))
|
| 955 |
+
x = Symbol('x', real=True)
|
| 956 |
+
y = Symbol('y', real=True)
|
| 957 |
+
assert Interval(x, y).as_relational(x) == (x <= y)
|
| 958 |
+
assert Interval(y, x).as_relational(x) == (y <= x)
|
| 959 |
+
|
| 960 |
+
|
| 961 |
+
def test_Finite_as_relational():
|
| 962 |
+
x = Symbol('x')
|
| 963 |
+
y = Symbol('y')
|
| 964 |
+
|
| 965 |
+
assert FiniteSet(1, 2).as_relational(x) == Or(Eq(x, 1), Eq(x, 2))
|
| 966 |
+
assert FiniteSet(y, -5).as_relational(x) == Or(Eq(x, y), Eq(x, -5))
|
| 967 |
+
|
| 968 |
+
|
| 969 |
+
def test_Union_as_relational():
|
| 970 |
+
x = Symbol('x')
|
| 971 |
+
assert (Interval(0, 1) + FiniteSet(2)).as_relational(x) == \
|
| 972 |
+
Or(And(Le(0, x), Le(x, 1)), Eq(x, 2))
|
| 973 |
+
assert (Interval(0, 1, True, True) + FiniteSet(1)).as_relational(x) == \
|
| 974 |
+
And(Lt(0, x), Le(x, 1))
|
| 975 |
+
assert Or(x < 0, x > 0).as_set().as_relational(x) == \
|
| 976 |
+
And((x > -oo), (x < oo), Ne(x, 0))
|
| 977 |
+
assert (Interval.Ropen(1, 3) + Interval.Lopen(3, 5)
|
| 978 |
+
).as_relational(x) == And(Ne(x,3),(x>=1),(x<=5))
|
| 979 |
+
|
| 980 |
+
|
| 981 |
+
def test_Intersection_as_relational():
|
| 982 |
+
x = Symbol('x')
|
| 983 |
+
assert (Intersection(Interval(0, 1), FiniteSet(2),
|
| 984 |
+
evaluate=False).as_relational(x)
|
| 985 |
+
== And(And(Le(0, x), Le(x, 1)), Eq(x, 2)))
|
| 986 |
+
|
| 987 |
+
|
| 988 |
+
def test_Complement_as_relational():
|
| 989 |
+
x = Symbol('x')
|
| 990 |
+
expr = Complement(Interval(0, 1), FiniteSet(2), evaluate=False)
|
| 991 |
+
assert expr.as_relational(x) == \
|
| 992 |
+
And(Le(0, x), Le(x, 1), Ne(x, 2))
|
| 993 |
+
|
| 994 |
+
|
| 995 |
+
@XFAIL
|
| 996 |
+
def test_Complement_as_relational_fail():
|
| 997 |
+
x = Symbol('x')
|
| 998 |
+
expr = Complement(Interval(0, 1), FiniteSet(2), evaluate=False)
|
| 999 |
+
# XXX This example fails because 0 <= x changes to x >= 0
|
| 1000 |
+
# during the evaluation.
|
| 1001 |
+
assert expr.as_relational(x) == \
|
| 1002 |
+
(0 <= x) & (x <= 1) & Ne(x, 2)
|
| 1003 |
+
|
| 1004 |
+
|
| 1005 |
+
def test_SymmetricDifference_as_relational():
|
| 1006 |
+
x = Symbol('x')
|
| 1007 |
+
expr = SymmetricDifference(Interval(0, 1), FiniteSet(2), evaluate=False)
|
| 1008 |
+
assert expr.as_relational(x) == Xor(Eq(x, 2), Le(0, x) & Le(x, 1))
|
| 1009 |
+
|
| 1010 |
+
|
| 1011 |
+
def test_EmptySet():
|
| 1012 |
+
assert S.EmptySet.as_relational(Symbol('x')) is S.false
|
| 1013 |
+
assert S.EmptySet.intersect(S.UniversalSet) == S.EmptySet
|
| 1014 |
+
assert S.EmptySet.boundary == S.EmptySet
|
| 1015 |
+
|
| 1016 |
+
|
| 1017 |
+
def test_finite_basic():
|
| 1018 |
+
x = Symbol('x')
|
| 1019 |
+
A = FiniteSet(1, 2, 3)
|
| 1020 |
+
B = FiniteSet(3, 4, 5)
|
| 1021 |
+
AorB = Union(A, B)
|
| 1022 |
+
AandB = A.intersect(B)
|
| 1023 |
+
assert A.is_subset(AorB) and B.is_subset(AorB)
|
| 1024 |
+
assert AandB.is_subset(A)
|
| 1025 |
+
assert AandB == FiniteSet(3)
|
| 1026 |
+
|
| 1027 |
+
assert A.inf == 1 and A.sup == 3
|
| 1028 |
+
assert AorB.inf == 1 and AorB.sup == 5
|
| 1029 |
+
assert FiniteSet(x, 1, 5).sup == Max(x, 5)
|
| 1030 |
+
assert FiniteSet(x, 1, 5).inf == Min(x, 1)
|
| 1031 |
+
|
| 1032 |
+
# issue 7335
|
| 1033 |
+
assert FiniteSet(S.EmptySet) != S.EmptySet
|
| 1034 |
+
assert FiniteSet(FiniteSet(1, 2, 3)) != FiniteSet(1, 2, 3)
|
| 1035 |
+
assert FiniteSet((1, 2, 3)) != FiniteSet(1, 2, 3)
|
| 1036 |
+
|
| 1037 |
+
# Ensure a variety of types can exist in a FiniteSet
|
| 1038 |
+
assert FiniteSet((1, 2), A, -5, x, 'eggs', x**2)
|
| 1039 |
+
|
| 1040 |
+
assert (A > B) is False
|
| 1041 |
+
assert (A >= B) is False
|
| 1042 |
+
assert (A < B) is False
|
| 1043 |
+
assert (A <= B) is False
|
| 1044 |
+
assert AorB > A and AorB > B
|
| 1045 |
+
assert AorB >= A and AorB >= B
|
| 1046 |
+
assert A >= A and A <= A
|
| 1047 |
+
assert A >= AandB and B >= AandB
|
| 1048 |
+
assert A > AandB and B > AandB
|
| 1049 |
+
|
| 1050 |
+
|
| 1051 |
+
def test_product_basic():
|
| 1052 |
+
H, T = 'H', 'T'
|
| 1053 |
+
unit_line = Interval(0, 1)
|
| 1054 |
+
d6 = FiniteSet(1, 2, 3, 4, 5, 6)
|
| 1055 |
+
d4 = FiniteSet(1, 2, 3, 4)
|
| 1056 |
+
coin = FiniteSet(H, T)
|
| 1057 |
+
|
| 1058 |
+
square = unit_line * unit_line
|
| 1059 |
+
|
| 1060 |
+
assert (0, 0) in square
|
| 1061 |
+
assert 0 not in square
|
| 1062 |
+
assert (H, T) in coin ** 2
|
| 1063 |
+
assert (.5, .5, .5) in (square * unit_line).flatten()
|
| 1064 |
+
assert ((.5, .5), .5) in square * unit_line
|
| 1065 |
+
assert (H, 3, 3) in (coin * d6 * d6).flatten()
|
| 1066 |
+
assert ((H, 3), 3) in coin * d6 * d6
|
| 1067 |
+
HH, TT = sympify(H), sympify(T)
|
| 1068 |
+
assert set(coin**2) == {(HH, HH), (HH, TT), (TT, HH), (TT, TT)}
|
| 1069 |
+
|
| 1070 |
+
assert (d4*d4).is_subset(d6*d6)
|
| 1071 |
+
|
| 1072 |
+
assert square.complement(Interval(-oo, oo)*Interval(-oo, oo)) == Union(
|
| 1073 |
+
(Interval(-oo, 0, True, True) +
|
| 1074 |
+
Interval(1, oo, True, True))*Interval(-oo, oo),
|
| 1075 |
+
Interval(-oo, oo)*(Interval(-oo, 0, True, True) +
|
| 1076 |
+
Interval(1, oo, True, True)))
|
| 1077 |
+
|
| 1078 |
+
assert (Interval(-5, 5)**3).is_subset(Interval(-10, 10)**3)
|
| 1079 |
+
assert not (Interval(-10, 10)**3).is_subset(Interval(-5, 5)**3)
|
| 1080 |
+
assert not (Interval(-5, 5)**2).is_subset(Interval(-10, 10)**3)
|
| 1081 |
+
|
| 1082 |
+
assert (Interval(.2, .5)*FiniteSet(.5)).is_subset(square) # segment in square
|
| 1083 |
+
|
| 1084 |
+
assert len(coin*coin*coin) == 8
|
| 1085 |
+
assert len(S.EmptySet*S.EmptySet) == 0
|
| 1086 |
+
assert len(S.EmptySet*coin) == 0
|
| 1087 |
+
raises(TypeError, lambda: len(coin*Interval(0, 2)))
|
| 1088 |
+
|
| 1089 |
+
|
| 1090 |
+
def test_real():
|
| 1091 |
+
x = Symbol('x', real=True)
|
| 1092 |
+
|
| 1093 |
+
I = Interval(0, 5)
|
| 1094 |
+
J = Interval(10, 20)
|
| 1095 |
+
A = FiniteSet(1, 2, 30, x, S.Pi)
|
| 1096 |
+
B = FiniteSet(-4, 0)
|
| 1097 |
+
C = FiniteSet(100)
|
| 1098 |
+
D = FiniteSet('Ham', 'Eggs')
|
| 1099 |
+
|
| 1100 |
+
assert all(s.is_subset(S.Reals) for s in [I, J, A, B, C])
|
| 1101 |
+
assert not D.is_subset(S.Reals)
|
| 1102 |
+
assert all((a + b).is_subset(S.Reals) for a in [I, J, A, B, C] for b in [I, J, A, B, C])
|
| 1103 |
+
assert not any((a + D).is_subset(S.Reals) for a in [I, J, A, B, C, D])
|
| 1104 |
+
|
| 1105 |
+
assert not (I + A + D).is_subset(S.Reals)
|
| 1106 |
+
|
| 1107 |
+
|
| 1108 |
+
def test_supinf():
|
| 1109 |
+
x = Symbol('x', real=True)
|
| 1110 |
+
y = Symbol('y', real=True)
|
| 1111 |
+
|
| 1112 |
+
assert (Interval(0, 1) + FiniteSet(2)).sup == 2
|
| 1113 |
+
assert (Interval(0, 1) + FiniteSet(2)).inf == 0
|
| 1114 |
+
assert (Interval(0, 1) + FiniteSet(x)).sup == Max(1, x)
|
| 1115 |
+
assert (Interval(0, 1) + FiniteSet(x)).inf == Min(0, x)
|
| 1116 |
+
assert FiniteSet(5, 1, x).sup == Max(5, x)
|
| 1117 |
+
assert FiniteSet(5, 1, x).inf == Min(1, x)
|
| 1118 |
+
assert FiniteSet(5, 1, x, y).sup == Max(5, x, y)
|
| 1119 |
+
assert FiniteSet(5, 1, x, y).inf == Min(1, x, y)
|
| 1120 |
+
assert FiniteSet(5, 1, x, y, S.Infinity, S.NegativeInfinity).sup == \
|
| 1121 |
+
S.Infinity
|
| 1122 |
+
assert FiniteSet(5, 1, x, y, S.Infinity, S.NegativeInfinity).inf == \
|
| 1123 |
+
S.NegativeInfinity
|
| 1124 |
+
assert FiniteSet('Ham', 'Eggs').sup == Max('Ham', 'Eggs')
|
| 1125 |
+
|
| 1126 |
+
|
| 1127 |
+
def test_universalset():
|
| 1128 |
+
U = S.UniversalSet
|
| 1129 |
+
x = Symbol('x')
|
| 1130 |
+
assert U.as_relational(x) is S.true
|
| 1131 |
+
assert U.union(Interval(2, 4)) == U
|
| 1132 |
+
|
| 1133 |
+
assert U.intersect(Interval(2, 4)) == Interval(2, 4)
|
| 1134 |
+
assert U.measure is S.Infinity
|
| 1135 |
+
assert U.boundary == S.EmptySet
|
| 1136 |
+
assert U.contains(0) is S.true
|
| 1137 |
+
|
| 1138 |
+
|
| 1139 |
+
def test_Union_of_ProductSets_shares():
|
| 1140 |
+
line = Interval(0, 2)
|
| 1141 |
+
points = FiniteSet(0, 1, 2)
|
| 1142 |
+
assert Union(line * line, line * points) == line * line
|
| 1143 |
+
|
| 1144 |
+
|
| 1145 |
+
def test_Interval_free_symbols():
|
| 1146 |
+
# issue 6211
|
| 1147 |
+
assert Interval(0, 1).free_symbols == set()
|
| 1148 |
+
x = Symbol('x', real=True)
|
| 1149 |
+
assert Interval(0, x).free_symbols == {x}
|
| 1150 |
+
|
| 1151 |
+
|
| 1152 |
+
def test_image_interval():
|
| 1153 |
+
x = Symbol('x', real=True)
|
| 1154 |
+
a = Symbol('a', real=True)
|
| 1155 |
+
assert imageset(x, 2*x, Interval(-2, 1)) == Interval(-4, 2)
|
| 1156 |
+
assert imageset(x, 2*x, Interval(-2, 1, True, False)) == \
|
| 1157 |
+
Interval(-4, 2, True, False)
|
| 1158 |
+
assert imageset(x, x**2, Interval(-2, 1, True, False)) == \
|
| 1159 |
+
Interval(0, 4, False, True)
|
| 1160 |
+
assert imageset(x, x**2, Interval(-2, 1)) == Interval(0, 4)
|
| 1161 |
+
assert imageset(x, x**2, Interval(-2, 1, True, False)) == \
|
| 1162 |
+
Interval(0, 4, False, True)
|
| 1163 |
+
assert imageset(x, x**2, Interval(-2, 1, True, True)) == \
|
| 1164 |
+
Interval(0, 4, False, True)
|
| 1165 |
+
assert imageset(x, (x - 2)**2, Interval(1, 3)) == Interval(0, 1)
|
| 1166 |
+
assert imageset(x, 3*x**4 - 26*x**3 + 78*x**2 - 90*x, Interval(0, 4)) == \
|
| 1167 |
+
Interval(-35, 0) # Multiple Maxima
|
| 1168 |
+
assert imageset(x, x + 1/x, Interval(-oo, oo)) == Interval(-oo, -2) \
|
| 1169 |
+
+ Interval(2, oo) # Single Infinite discontinuity
|
| 1170 |
+
assert imageset(x, 1/x + 1/(x-1)**2, Interval(0, 2, True, False)) == \
|
| 1171 |
+
Interval(Rational(3, 2), oo, False) # Multiple Infinite discontinuities
|
| 1172 |
+
|
| 1173 |
+
# Test for Python lambda
|
| 1174 |
+
assert imageset(lambda x: 2*x, Interval(-2, 1)) == Interval(-4, 2)
|
| 1175 |
+
|
| 1176 |
+
assert imageset(Lambda(x, a*x), Interval(0, 1)) == \
|
| 1177 |
+
ImageSet(Lambda(x, a*x), Interval(0, 1))
|
| 1178 |
+
|
| 1179 |
+
assert imageset(Lambda(x, sin(cos(x))), Interval(0, 1)) == \
|
| 1180 |
+
ImageSet(Lambda(x, sin(cos(x))), Interval(0, 1))
|
| 1181 |
+
|
| 1182 |
+
|
| 1183 |
+
def test_image_piecewise():
|
| 1184 |
+
f = Piecewise((x, x <= -1), (1/x**2, x <= 5), (x**3, True))
|
| 1185 |
+
f1 = Piecewise((0, x <= 1), (1, x <= 2), (2, True))
|
| 1186 |
+
assert imageset(x, f, Interval(-5, 5)) == Union(Interval(-5, -1), Interval(Rational(1, 25), oo))
|
| 1187 |
+
assert imageset(x, f1, Interval(1, 2)) == FiniteSet(0, 1)
|
| 1188 |
+
|
| 1189 |
+
|
| 1190 |
+
@XFAIL # See: https://github.com/sympy/sympy/pull/2723#discussion_r8659826
|
| 1191 |
+
def test_image_Intersection():
|
| 1192 |
+
x = Symbol('x', real=True)
|
| 1193 |
+
y = Symbol('y', real=True)
|
| 1194 |
+
assert imageset(x, x**2, Interval(-2, 0).intersect(Interval(x, y))) == \
|
| 1195 |
+
Interval(0, 4).intersect(Interval(Min(x**2, y**2), Max(x**2, y**2)))
|
| 1196 |
+
|
| 1197 |
+
|
| 1198 |
+
def test_image_FiniteSet():
|
| 1199 |
+
x = Symbol('x', real=True)
|
| 1200 |
+
assert imageset(x, 2*x, FiniteSet(1, 2, 3)) == FiniteSet(2, 4, 6)
|
| 1201 |
+
|
| 1202 |
+
|
| 1203 |
+
def test_image_Union():
|
| 1204 |
+
x = Symbol('x', real=True)
|
| 1205 |
+
assert imageset(x, x**2, Interval(-2, 0) + FiniteSet(1, 2, 3)) == \
|
| 1206 |
+
(Interval(0, 4) + FiniteSet(9))
|
| 1207 |
+
|
| 1208 |
+
|
| 1209 |
+
def test_image_EmptySet():
|
| 1210 |
+
x = Symbol('x', real=True)
|
| 1211 |
+
assert imageset(x, 2*x, S.EmptySet) == S.EmptySet
|
| 1212 |
+
|
| 1213 |
+
|
| 1214 |
+
def test_issue_5724_7680():
|
| 1215 |
+
assert I not in S.Reals # issue 7680
|
| 1216 |
+
assert Interval(-oo, oo).contains(I) is S.false
|
| 1217 |
+
|
| 1218 |
+
|
| 1219 |
+
def test_boundary():
|
| 1220 |
+
assert FiniteSet(1).boundary == FiniteSet(1)
|
| 1221 |
+
assert all(Interval(0, 1, left_open, right_open).boundary == FiniteSet(0, 1)
|
| 1222 |
+
for left_open in (true, false) for right_open in (true, false))
|
| 1223 |
+
|
| 1224 |
+
|
| 1225 |
+
def test_boundary_Union():
|
| 1226 |
+
assert (Interval(0, 1) + Interval(2, 3)).boundary == FiniteSet(0, 1, 2, 3)
|
| 1227 |
+
assert ((Interval(0, 1, False, True)
|
| 1228 |
+
+ Interval(1, 2, True, False)).boundary == FiniteSet(0, 1, 2))
|
| 1229 |
+
|
| 1230 |
+
assert (Interval(0, 1) + FiniteSet(2)).boundary == FiniteSet(0, 1, 2)
|
| 1231 |
+
assert Union(Interval(0, 10), Interval(5, 15), evaluate=False).boundary \
|
| 1232 |
+
== FiniteSet(0, 15)
|
| 1233 |
+
|
| 1234 |
+
assert Union(Interval(0, 10), Interval(0, 1), evaluate=False).boundary \
|
| 1235 |
+
== FiniteSet(0, 10)
|
| 1236 |
+
assert Union(Interval(0, 10, True, True),
|
| 1237 |
+
Interval(10, 15, True, True), evaluate=False).boundary \
|
| 1238 |
+
== FiniteSet(0, 10, 15)
|
| 1239 |
+
|
| 1240 |
+
|
| 1241 |
+
@XFAIL
|
| 1242 |
+
def test_union_boundary_of_joining_sets():
|
| 1243 |
+
""" Testing the boundary of unions is a hard problem """
|
| 1244 |
+
assert Union(Interval(0, 10), Interval(10, 15), evaluate=False).boundary \
|
| 1245 |
+
== FiniteSet(0, 15)
|
| 1246 |
+
|
| 1247 |
+
|
| 1248 |
+
def test_boundary_ProductSet():
|
| 1249 |
+
open_square = Interval(0, 1, True, True) ** 2
|
| 1250 |
+
assert open_square.boundary == (FiniteSet(0, 1) * Interval(0, 1)
|
| 1251 |
+
+ Interval(0, 1) * FiniteSet(0, 1))
|
| 1252 |
+
|
| 1253 |
+
second_square = Interval(1, 2, True, True) * Interval(0, 1, True, True)
|
| 1254 |
+
assert (open_square + second_square).boundary == (
|
| 1255 |
+
FiniteSet(0, 1) * Interval(0, 1)
|
| 1256 |
+
+ FiniteSet(1, 2) * Interval(0, 1)
|
| 1257 |
+
+ Interval(0, 1) * FiniteSet(0, 1)
|
| 1258 |
+
+ Interval(1, 2) * FiniteSet(0, 1))
|
| 1259 |
+
|
| 1260 |
+
|
| 1261 |
+
def test_boundary_ProductSet_line():
|
| 1262 |
+
line_in_r2 = Interval(0, 1) * FiniteSet(0)
|
| 1263 |
+
assert line_in_r2.boundary == line_in_r2
|
| 1264 |
+
|
| 1265 |
+
|
| 1266 |
+
def test_is_open():
|
| 1267 |
+
assert Interval(0, 1, False, False).is_open is False
|
| 1268 |
+
assert Interval(0, 1, True, False).is_open is False
|
| 1269 |
+
assert Interval(0, 1, True, True).is_open is True
|
| 1270 |
+
assert FiniteSet(1, 2, 3).is_open is False
|
| 1271 |
+
|
| 1272 |
+
|
| 1273 |
+
def test_is_closed():
|
| 1274 |
+
assert Interval(0, 1, False, False).is_closed is True
|
| 1275 |
+
assert Interval(0, 1, True, False).is_closed is False
|
| 1276 |
+
assert FiniteSet(1, 2, 3).is_closed is True
|
| 1277 |
+
|
| 1278 |
+
|
| 1279 |
+
def test_closure():
|
| 1280 |
+
assert Interval(0, 1, False, True).closure == Interval(0, 1, False, False)
|
| 1281 |
+
|
| 1282 |
+
|
| 1283 |
+
def test_interior():
|
| 1284 |
+
assert Interval(0, 1, False, True).interior == Interval(0, 1, True, True)
|
| 1285 |
+
|
| 1286 |
+
|
| 1287 |
+
def test_issue_7841():
|
| 1288 |
+
raises(TypeError, lambda: x in S.Reals)
|
| 1289 |
+
|
| 1290 |
+
|
| 1291 |
+
def test_Eq():
|
| 1292 |
+
assert Eq(Interval(0, 1), Interval(0, 1))
|
| 1293 |
+
assert Eq(Interval(0, 1), Interval(0, 2)) == False
|
| 1294 |
+
|
| 1295 |
+
s1 = FiniteSet(0, 1)
|
| 1296 |
+
s2 = FiniteSet(1, 2)
|
| 1297 |
+
|
| 1298 |
+
assert Eq(s1, s1)
|
| 1299 |
+
assert Eq(s1, s2) == False
|
| 1300 |
+
|
| 1301 |
+
assert Eq(s1*s2, s1*s2)
|
| 1302 |
+
assert Eq(s1*s2, s2*s1) == False
|
| 1303 |
+
|
| 1304 |
+
assert unchanged(Eq, FiniteSet({x, y}), FiniteSet({x}))
|
| 1305 |
+
assert Eq(FiniteSet({x, y}).subs(y, x), FiniteSet({x})) is S.true
|
| 1306 |
+
assert Eq(FiniteSet({x, y}), FiniteSet({x})).subs(y, x) is S.true
|
| 1307 |
+
assert Eq(FiniteSet({x, y}).subs(y, x+1), FiniteSet({x})) is S.false
|
| 1308 |
+
assert Eq(FiniteSet({x, y}), FiniteSet({x})).subs(y, x+1) is S.false
|
| 1309 |
+
|
| 1310 |
+
assert Eq(ProductSet({1}, {2}), Interval(1, 2)) is S.false
|
| 1311 |
+
assert Eq(ProductSet({1}), ProductSet({1}, {2})) is S.false
|
| 1312 |
+
|
| 1313 |
+
assert Eq(FiniteSet(()), FiniteSet(1)) is S.false
|
| 1314 |
+
assert Eq(ProductSet(), FiniteSet(1)) is S.false
|
| 1315 |
+
|
| 1316 |
+
i1 = Interval(0, 1)
|
| 1317 |
+
i2 = Interval(x, y)
|
| 1318 |
+
assert unchanged(Eq, ProductSet(i1, i1), ProductSet(i2, i2))
|
| 1319 |
+
|
| 1320 |
+
|
| 1321 |
+
def test_SymmetricDifference():
|
| 1322 |
+
A = FiniteSet(0, 1, 2, 3, 4, 5)
|
| 1323 |
+
B = FiniteSet(2, 4, 6, 8, 10)
|
| 1324 |
+
C = Interval(8, 10)
|
| 1325 |
+
|
| 1326 |
+
assert SymmetricDifference(A, B, evaluate=False).is_iterable is True
|
| 1327 |
+
assert SymmetricDifference(A, C, evaluate=False).is_iterable is None
|
| 1328 |
+
assert FiniteSet(*SymmetricDifference(A, B, evaluate=False)) == \
|
| 1329 |
+
FiniteSet(0, 1, 3, 5, 6, 8, 10)
|
| 1330 |
+
raises(TypeError,
|
| 1331 |
+
lambda: FiniteSet(*SymmetricDifference(A, C, evaluate=False)))
|
| 1332 |
+
|
| 1333 |
+
assert SymmetricDifference(FiniteSet(0, 1, 2, 3, 4, 5), \
|
| 1334 |
+
FiniteSet(2, 4, 6, 8, 10)) == FiniteSet(0, 1, 3, 5, 6, 8, 10)
|
| 1335 |
+
assert SymmetricDifference(FiniteSet(2, 3, 4), FiniteSet(2, 3, 4 ,5)) \
|
| 1336 |
+
== FiniteSet(5)
|
| 1337 |
+
assert FiniteSet(1, 2, 3, 4, 5) ^ FiniteSet(1, 2, 5, 6) == \
|
| 1338 |
+
FiniteSet(3, 4, 6)
|
| 1339 |
+
assert Set(S(1), S(2), S(3)) ^ Set(S(2), S(3), S(4)) == Union(Set(S(1), S(2), S(3)) - Set(S(2), S(3), S(4)), \
|
| 1340 |
+
Set(S(2), S(3), S(4)) - Set(S(1), S(2), S(3)))
|
| 1341 |
+
assert Interval(0, 4) ^ Interval(2, 5) == Union(Interval(0, 4) - \
|
| 1342 |
+
Interval(2, 5), Interval(2, 5) - Interval(0, 4))
|
| 1343 |
+
|
| 1344 |
+
|
| 1345 |
+
def test_issue_9536():
|
| 1346 |
+
from sympy.functions.elementary.exponential import log
|
| 1347 |
+
a = Symbol('a', real=True)
|
| 1348 |
+
assert FiniteSet(log(a)).intersect(S.Reals) == Intersection(S.Reals, FiniteSet(log(a)))
|
| 1349 |
+
|
| 1350 |
+
|
| 1351 |
+
def test_issue_9637():
|
| 1352 |
+
n = Symbol('n')
|
| 1353 |
+
a = FiniteSet(n)
|
| 1354 |
+
b = FiniteSet(2, n)
|
| 1355 |
+
assert Complement(S.Reals, a) == Complement(S.Reals, a, evaluate=False)
|
| 1356 |
+
assert Complement(Interval(1, 3), a) == Complement(Interval(1, 3), a, evaluate=False)
|
| 1357 |
+
assert Complement(Interval(1, 3), b) == \
|
| 1358 |
+
Complement(Union(Interval(1, 2, False, True), Interval(2, 3, True, False)), a)
|
| 1359 |
+
assert Complement(a, S.Reals) == Complement(a, S.Reals, evaluate=False)
|
| 1360 |
+
assert Complement(a, Interval(1, 3)) == Complement(a, Interval(1, 3), evaluate=False)
|
| 1361 |
+
|
| 1362 |
+
|
| 1363 |
+
def test_issue_9808():
|
| 1364 |
+
# See https://github.com/sympy/sympy/issues/16342
|
| 1365 |
+
assert Complement(FiniteSet(y), FiniteSet(1)) == Complement(FiniteSet(y), FiniteSet(1), evaluate=False)
|
| 1366 |
+
assert Complement(FiniteSet(1, 2, x), FiniteSet(x, y, 2, 3)) == \
|
| 1367 |
+
Complement(FiniteSet(1), FiniteSet(y), evaluate=False)
|
| 1368 |
+
|
| 1369 |
+
|
| 1370 |
+
def test_issue_9956():
|
| 1371 |
+
assert Union(Interval(-oo, oo), FiniteSet(1)) == Interval(-oo, oo)
|
| 1372 |
+
assert Interval(-oo, oo).contains(1) is S.true
|
| 1373 |
+
|
| 1374 |
+
|
| 1375 |
+
def test_issue_Symbol_inter():
|
| 1376 |
+
i = Interval(0, oo)
|
| 1377 |
+
r = S.Reals
|
| 1378 |
+
mat = Matrix([0, 0, 0])
|
| 1379 |
+
assert Intersection(r, i, FiniteSet(m), FiniteSet(m, n)) == \
|
| 1380 |
+
Intersection(i, FiniteSet(m))
|
| 1381 |
+
assert Intersection(FiniteSet(1, m, n), FiniteSet(m, n, 2), i) == \
|
| 1382 |
+
Intersection(i, FiniteSet(m, n))
|
| 1383 |
+
assert Intersection(FiniteSet(m, n, x), FiniteSet(m, z), r) == \
|
| 1384 |
+
Intersection(Intersection({m, z}, {m, n, x}), r)
|
| 1385 |
+
assert Intersection(FiniteSet(m, n, 3), FiniteSet(m, n, x), r) == \
|
| 1386 |
+
Intersection(FiniteSet(3, m, n), FiniteSet(m, n, x), r, evaluate=False)
|
| 1387 |
+
assert Intersection(FiniteSet(m, n, 3), FiniteSet(m, n, 2, 3), r) == \
|
| 1388 |
+
Intersection(FiniteSet(3, m, n), r)
|
| 1389 |
+
assert Intersection(r, FiniteSet(mat, 2, n), FiniteSet(0, mat, n)) == \
|
| 1390 |
+
Intersection(r, FiniteSet(n))
|
| 1391 |
+
assert Intersection(FiniteSet(sin(x), cos(x)), FiniteSet(sin(x), cos(x), 1), r) == \
|
| 1392 |
+
Intersection(r, FiniteSet(sin(x), cos(x)))
|
| 1393 |
+
assert Intersection(FiniteSet(x**2, 1, sin(x)), FiniteSet(x**2, 2, sin(x)), r) == \
|
| 1394 |
+
Intersection(r, FiniteSet(x**2, sin(x)))
|
| 1395 |
+
|
| 1396 |
+
|
| 1397 |
+
def test_issue_11827():
|
| 1398 |
+
assert S.Naturals0**4
|
| 1399 |
+
|
| 1400 |
+
|
| 1401 |
+
def test_issue_10113():
|
| 1402 |
+
f = x**2/(x**2 - 4)
|
| 1403 |
+
assert imageset(x, f, S.Reals) == Union(Interval(-oo, 0), Interval(1, oo, True, True))
|
| 1404 |
+
assert imageset(x, f, Interval(-2, 2)) == Interval(-oo, 0)
|
| 1405 |
+
assert imageset(x, f, Interval(-2, 3)) == Union(Interval(-oo, 0), Interval(Rational(9, 5), oo))
|
| 1406 |
+
|
| 1407 |
+
|
| 1408 |
+
def test_issue_10248():
|
| 1409 |
+
raises(
|
| 1410 |
+
TypeError, lambda: list(Intersection(S.Reals, FiniteSet(x)))
|
| 1411 |
+
)
|
| 1412 |
+
A = Symbol('A', real=True)
|
| 1413 |
+
assert list(Intersection(S.Reals, FiniteSet(A))) == [A]
|
| 1414 |
+
|
| 1415 |
+
|
| 1416 |
+
def test_issue_9447():
|
| 1417 |
+
a = Interval(0, 1) + Interval(2, 3)
|
| 1418 |
+
assert Complement(S.UniversalSet, a) == Complement(
|
| 1419 |
+
S.UniversalSet, Union(Interval(0, 1), Interval(2, 3)), evaluate=False)
|
| 1420 |
+
assert Complement(S.Naturals, a) == Complement(
|
| 1421 |
+
S.Naturals, Union(Interval(0, 1), Interval(2, 3)), evaluate=False)
|
| 1422 |
+
|
| 1423 |
+
|
| 1424 |
+
def test_issue_10337():
|
| 1425 |
+
assert (FiniteSet(2) == 3) is False
|
| 1426 |
+
assert (FiniteSet(2) != 3) is True
|
| 1427 |
+
raises(TypeError, lambda: FiniteSet(2) < 3)
|
| 1428 |
+
raises(TypeError, lambda: FiniteSet(2) <= 3)
|
| 1429 |
+
raises(TypeError, lambda: FiniteSet(2) > 3)
|
| 1430 |
+
raises(TypeError, lambda: FiniteSet(2) >= 3)
|
| 1431 |
+
|
| 1432 |
+
|
| 1433 |
+
def test_issue_10326():
|
| 1434 |
+
bad = [
|
| 1435 |
+
EmptySet,
|
| 1436 |
+
FiniteSet(1),
|
| 1437 |
+
Interval(1, 2),
|
| 1438 |
+
S.ComplexInfinity,
|
| 1439 |
+
S.ImaginaryUnit,
|
| 1440 |
+
S.Infinity,
|
| 1441 |
+
S.NaN,
|
| 1442 |
+
S.NegativeInfinity,
|
| 1443 |
+
]
|
| 1444 |
+
interval = Interval(0, 5)
|
| 1445 |
+
for i in bad:
|
| 1446 |
+
assert i not in interval
|
| 1447 |
+
|
| 1448 |
+
x = Symbol('x', real=True)
|
| 1449 |
+
nr = Symbol('nr', extended_real=False)
|
| 1450 |
+
assert x + 1 in Interval(x, x + 4)
|
| 1451 |
+
assert nr not in Interval(x, x + 4)
|
| 1452 |
+
assert Interval(1, 2) in FiniteSet(Interval(0, 5), Interval(1, 2))
|
| 1453 |
+
assert Interval(-oo, oo).contains(oo) is S.false
|
| 1454 |
+
assert Interval(-oo, oo).contains(-oo) is S.false
|
| 1455 |
+
|
| 1456 |
+
|
| 1457 |
+
def test_issue_2799():
|
| 1458 |
+
U = S.UniversalSet
|
| 1459 |
+
a = Symbol('a', real=True)
|
| 1460 |
+
inf_interval = Interval(a, oo)
|
| 1461 |
+
R = S.Reals
|
| 1462 |
+
|
| 1463 |
+
assert U + inf_interval == inf_interval + U
|
| 1464 |
+
assert U + R == R + U
|
| 1465 |
+
assert R + inf_interval == inf_interval + R
|
| 1466 |
+
|
| 1467 |
+
|
| 1468 |
+
def test_issue_9706():
|
| 1469 |
+
assert Interval(-oo, 0).closure == Interval(-oo, 0, True, False)
|
| 1470 |
+
assert Interval(0, oo).closure == Interval(0, oo, False, True)
|
| 1471 |
+
assert Interval(-oo, oo).closure == Interval(-oo, oo)
|
| 1472 |
+
|
| 1473 |
+
|
| 1474 |
+
def test_issue_8257():
|
| 1475 |
+
reals_plus_infinity = Union(Interval(-oo, oo), FiniteSet(oo))
|
| 1476 |
+
reals_plus_negativeinfinity = Union(Interval(-oo, oo), FiniteSet(-oo))
|
| 1477 |
+
assert Interval(-oo, oo) + FiniteSet(oo) == reals_plus_infinity
|
| 1478 |
+
assert FiniteSet(oo) + Interval(-oo, oo) == reals_plus_infinity
|
| 1479 |
+
assert Interval(-oo, oo) + FiniteSet(-oo) == reals_plus_negativeinfinity
|
| 1480 |
+
assert FiniteSet(-oo) + Interval(-oo, oo) == reals_plus_negativeinfinity
|
| 1481 |
+
|
| 1482 |
+
|
| 1483 |
+
def test_issue_10931():
|
| 1484 |
+
assert S.Integers - S.Integers == EmptySet
|
| 1485 |
+
assert S.Integers - S.Reals == EmptySet
|
| 1486 |
+
|
| 1487 |
+
|
| 1488 |
+
def test_issue_11174():
|
| 1489 |
+
soln = Intersection(Interval(-oo, oo), FiniteSet(-x), evaluate=False)
|
| 1490 |
+
assert Intersection(FiniteSet(-x), S.Reals) == soln
|
| 1491 |
+
|
| 1492 |
+
soln = Intersection(S.Reals, FiniteSet(x), evaluate=False)
|
| 1493 |
+
assert Intersection(FiniteSet(x), S.Reals) == soln
|
| 1494 |
+
|
| 1495 |
+
|
| 1496 |
+
def test_issue_18505():
|
| 1497 |
+
assert ImageSet(Lambda(n, sqrt(pi*n/2 - 1 + pi/2)), S.Integers).contains(0) == \
|
| 1498 |
+
Contains(0, ImageSet(Lambda(n, sqrt(pi*n/2 - 1 + pi/2)), S.Integers))
|
| 1499 |
+
|
| 1500 |
+
|
| 1501 |
+
def test_finite_set_intersection():
|
| 1502 |
+
# The following should not produce recursion errors
|
| 1503 |
+
# Note: some of these are not completely correct. See
|
| 1504 |
+
# https://github.com/sympy/sympy/issues/16342.
|
| 1505 |
+
assert Intersection(FiniteSet(-oo, x), FiniteSet(x)) == FiniteSet(x)
|
| 1506 |
+
assert Intersection._handle_finite_sets([FiniteSet(-oo, x), FiniteSet(0, x)]) == FiniteSet(x)
|
| 1507 |
+
|
| 1508 |
+
assert Intersection._handle_finite_sets([FiniteSet(-oo, x), FiniteSet(x)]) == FiniteSet(x)
|
| 1509 |
+
assert Intersection._handle_finite_sets([FiniteSet(2, 3, x, y), FiniteSet(1, 2, x)]) == \
|
| 1510 |
+
Intersection._handle_finite_sets([FiniteSet(1, 2, x), FiniteSet(2, 3, x, y)]) == \
|
| 1511 |
+
Intersection(FiniteSet(1, 2, x), FiniteSet(2, 3, x, y)) == \
|
| 1512 |
+
Intersection(FiniteSet(1, 2, x), FiniteSet(2, x, y))
|
| 1513 |
+
|
| 1514 |
+
assert FiniteSet(1+x-y) & FiniteSet(1) == \
|
| 1515 |
+
FiniteSet(1) & FiniteSet(1+x-y) == \
|
| 1516 |
+
Intersection(FiniteSet(1+x-y), FiniteSet(1), evaluate=False)
|
| 1517 |
+
|
| 1518 |
+
assert FiniteSet(1) & FiniteSet(x) == FiniteSet(x) & FiniteSet(1) == \
|
| 1519 |
+
Intersection(FiniteSet(1), FiniteSet(x), evaluate=False)
|
| 1520 |
+
|
| 1521 |
+
assert FiniteSet({x}) & FiniteSet({x, y}) == \
|
| 1522 |
+
Intersection(FiniteSet({x}), FiniteSet({x, y}), evaluate=False)
|
| 1523 |
+
|
| 1524 |
+
|
| 1525 |
+
def test_union_intersection_constructor():
|
| 1526 |
+
# The actual exception does not matter here, so long as these fail
|
| 1527 |
+
sets = [FiniteSet(1), FiniteSet(2)]
|
| 1528 |
+
raises(Exception, lambda: Union(sets))
|
| 1529 |
+
raises(Exception, lambda: Intersection(sets))
|
| 1530 |
+
raises(Exception, lambda: Union(tuple(sets)))
|
| 1531 |
+
raises(Exception, lambda: Intersection(tuple(sets)))
|
| 1532 |
+
raises(Exception, lambda: Union(i for i in sets))
|
| 1533 |
+
raises(Exception, lambda: Intersection(i for i in sets))
|
| 1534 |
+
|
| 1535 |
+
# Python sets are treated the same as FiniteSet
|
| 1536 |
+
# The union of a single set (of sets) is the set (of sets) itself
|
| 1537 |
+
assert Union(set(sets)) == FiniteSet(*sets)
|
| 1538 |
+
assert Intersection(set(sets)) == FiniteSet(*sets)
|
| 1539 |
+
|
| 1540 |
+
assert Union({1}, {2}) == FiniteSet(1, 2)
|
| 1541 |
+
assert Intersection({1, 2}, {2, 3}) == FiniteSet(2)
|
| 1542 |
+
|
| 1543 |
+
|
| 1544 |
+
def test_Union_contains():
|
| 1545 |
+
assert zoo not in Union(
|
| 1546 |
+
Interval.open(-oo, 0), Interval.open(0, oo))
|
| 1547 |
+
|
| 1548 |
+
|
| 1549 |
+
@XFAIL
|
| 1550 |
+
def test_issue_16878b():
|
| 1551 |
+
# in intersection_sets for (ImageSet, Set) there is no code
|
| 1552 |
+
# that handles the base_set of S.Reals like there is
|
| 1553 |
+
# for Integers
|
| 1554 |
+
assert imageset(x, (x, x), S.Reals).is_subset(S.Reals**2) is True
|
| 1555 |
+
|
| 1556 |
+
def test_DisjointUnion():
|
| 1557 |
+
assert DisjointUnion(FiniteSet(1, 2, 3), FiniteSet(1, 2, 3), FiniteSet(1, 2, 3)).rewrite(Union) == (FiniteSet(1, 2, 3) * FiniteSet(0, 1, 2))
|
| 1558 |
+
assert DisjointUnion(Interval(1, 3), Interval(2, 4)).rewrite(Union) == Union(Interval(1, 3) * FiniteSet(0), Interval(2, 4) * FiniteSet(1))
|
| 1559 |
+
assert DisjointUnion(Interval(0, 5), Interval(0, 5)).rewrite(Union) == Union(Interval(0, 5) * FiniteSet(0), Interval(0, 5) * FiniteSet(1))
|
| 1560 |
+
assert DisjointUnion(Interval(-1, 2), S.EmptySet, S.EmptySet).rewrite(Union) == Interval(-1, 2) * FiniteSet(0)
|
| 1561 |
+
assert DisjointUnion(Interval(-1, 2)).rewrite(Union) == Interval(-1, 2) * FiniteSet(0)
|
| 1562 |
+
assert DisjointUnion(S.EmptySet, Interval(-1, 2), S.EmptySet).rewrite(Union) == Interval(-1, 2) * FiniteSet(1)
|
| 1563 |
+
assert DisjointUnion(Interval(-oo, oo)).rewrite(Union) == Interval(-oo, oo) * FiniteSet(0)
|
| 1564 |
+
assert DisjointUnion(S.EmptySet).rewrite(Union) == S.EmptySet
|
| 1565 |
+
assert DisjointUnion().rewrite(Union) == S.EmptySet
|
| 1566 |
+
raises(TypeError, lambda: DisjointUnion(Symbol('n')))
|
| 1567 |
+
|
| 1568 |
+
x = Symbol("x")
|
| 1569 |
+
y = Symbol("y")
|
| 1570 |
+
z = Symbol("z")
|
| 1571 |
+
assert DisjointUnion(FiniteSet(x), FiniteSet(y, z)).rewrite(Union) == (FiniteSet(x) * FiniteSet(0)) + (FiniteSet(y, z) * FiniteSet(1))
|
| 1572 |
+
|
| 1573 |
+
def test_DisjointUnion_is_empty():
|
| 1574 |
+
assert DisjointUnion(S.EmptySet).is_empty is True
|
| 1575 |
+
assert DisjointUnion(S.EmptySet, S.EmptySet).is_empty is True
|
| 1576 |
+
assert DisjointUnion(S.EmptySet, FiniteSet(1, 2, 3)).is_empty is False
|
| 1577 |
+
|
| 1578 |
+
def test_DisjointUnion_is_iterable():
|
| 1579 |
+
assert DisjointUnion(S.Integers, S.Naturals, S.Rationals).is_iterable is True
|
| 1580 |
+
assert DisjointUnion(S.EmptySet, S.Reals).is_iterable is False
|
| 1581 |
+
assert DisjointUnion(FiniteSet(1, 2, 3), S.EmptySet, FiniteSet(x, y)).is_iterable is True
|
| 1582 |
+
assert DisjointUnion(S.EmptySet, S.EmptySet).is_iterable is False
|
| 1583 |
+
|
| 1584 |
+
def test_DisjointUnion_contains():
|
| 1585 |
+
assert (0, 0) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1586 |
+
assert (0, 1) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1587 |
+
assert (0, 2) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1588 |
+
assert (1, 0) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1589 |
+
assert (1, 1) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1590 |
+
assert (1, 2) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1591 |
+
assert (2, 0) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1592 |
+
assert (2, 1) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1593 |
+
assert (2, 2) in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1594 |
+
assert (0, 1, 2) not in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1595 |
+
assert (0, 0.5) not in DisjointUnion(FiniteSet(0.5))
|
| 1596 |
+
assert (0, 5) not in DisjointUnion(FiniteSet(0, 1, 2), FiniteSet(0, 1, 2), FiniteSet(0, 1, 2))
|
| 1597 |
+
assert (x, 0) in DisjointUnion(FiniteSet(x, y, z), S.EmptySet, FiniteSet(y))
|
| 1598 |
+
assert (y, 0) in DisjointUnion(FiniteSet(x, y, z), S.EmptySet, FiniteSet(y))
|
| 1599 |
+
assert (z, 0) in DisjointUnion(FiniteSet(x, y, z), S.EmptySet, FiniteSet(y))
|
| 1600 |
+
assert (y, 2) in DisjointUnion(FiniteSet(x, y, z), S.EmptySet, FiniteSet(y))
|
| 1601 |
+
assert (0.5, 0) in DisjointUnion(Interval(0, 1), Interval(0, 2))
|
| 1602 |
+
assert (0.5, 1) in DisjointUnion(Interval(0, 1), Interval(0, 2))
|
| 1603 |
+
assert (1.5, 0) not in DisjointUnion(Interval(0, 1), Interval(0, 2))
|
| 1604 |
+
assert (1.5, 1) in DisjointUnion(Interval(0, 1), Interval(0, 2))
|
| 1605 |
+
|
| 1606 |
+
def test_DisjointUnion_iter():
|
| 1607 |
+
D = DisjointUnion(FiniteSet(3, 5, 7, 9), FiniteSet(x, y, z))
|
| 1608 |
+
it = iter(D)
|
| 1609 |
+
L1 = [(x, 1), (y, 1), (z, 1)]
|
| 1610 |
+
L2 = [(3, 0), (5, 0), (7, 0), (9, 0)]
|
| 1611 |
+
nxt = next(it)
|
| 1612 |
+
assert nxt in L2
|
| 1613 |
+
L2.remove(nxt)
|
| 1614 |
+
nxt = next(it)
|
| 1615 |
+
assert nxt in L1
|
| 1616 |
+
L1.remove(nxt)
|
| 1617 |
+
nxt = next(it)
|
| 1618 |
+
assert nxt in L2
|
| 1619 |
+
L2.remove(nxt)
|
| 1620 |
+
nxt = next(it)
|
| 1621 |
+
assert nxt in L1
|
| 1622 |
+
L1.remove(nxt)
|
| 1623 |
+
nxt = next(it)
|
| 1624 |
+
assert nxt in L2
|
| 1625 |
+
L2.remove(nxt)
|
| 1626 |
+
nxt = next(it)
|
| 1627 |
+
assert nxt in L1
|
| 1628 |
+
L1.remove(nxt)
|
| 1629 |
+
nxt = next(it)
|
| 1630 |
+
assert nxt in L2
|
| 1631 |
+
L2.remove(nxt)
|
| 1632 |
+
raises(StopIteration, lambda: next(it))
|
| 1633 |
+
|
| 1634 |
+
raises(ValueError, lambda: iter(DisjointUnion(Interval(0, 1), S.EmptySet)))
|
| 1635 |
+
|
| 1636 |
+
def test_DisjointUnion_len():
|
| 1637 |
+
assert len(DisjointUnion(FiniteSet(3, 5, 7, 9), FiniteSet(x, y, z))) == 7
|
| 1638 |
+
assert len(DisjointUnion(S.EmptySet, S.EmptySet, FiniteSet(x, y, z), S.EmptySet)) == 3
|
| 1639 |
+
raises(ValueError, lambda: len(DisjointUnion(Interval(0, 1), S.EmptySet)))
|
| 1640 |
+
|
| 1641 |
+
def test_SetKind_ProductSet():
|
| 1642 |
+
p = ProductSet(FiniteSet(Matrix([1, 2])), FiniteSet(Matrix([1, 2])))
|
| 1643 |
+
mk = MatrixKind(NumberKind)
|
| 1644 |
+
k = SetKind(TupleKind(mk, mk))
|
| 1645 |
+
assert p.kind is k
|
| 1646 |
+
assert ProductSet(Interval(1, 2), FiniteSet(Matrix([1, 2]))).kind is SetKind(TupleKind(NumberKind, mk))
|
| 1647 |
+
|
| 1648 |
+
def test_SetKind_Interval():
|
| 1649 |
+
assert Interval(1, 2).kind is SetKind(NumberKind)
|
| 1650 |
+
|
| 1651 |
+
def test_SetKind_EmptySet_UniversalSet():
|
| 1652 |
+
assert S.UniversalSet.kind is SetKind(UndefinedKind)
|
| 1653 |
+
assert EmptySet.kind is SetKind()
|
| 1654 |
+
|
| 1655 |
+
def test_SetKind_FiniteSet():
|
| 1656 |
+
assert FiniteSet(1, Matrix([1, 2])).kind is SetKind(UndefinedKind)
|
| 1657 |
+
assert FiniteSet(1, 2).kind is SetKind(NumberKind)
|
| 1658 |
+
|
| 1659 |
+
def test_SetKind_Unions():
|
| 1660 |
+
assert Union(FiniteSet(Matrix([1, 2])), Interval(1, 2)).kind is SetKind(UndefinedKind)
|
| 1661 |
+
assert Union(Interval(1, 2), Interval(1, 7)).kind is SetKind(NumberKind)
|
| 1662 |
+
|
| 1663 |
+
def test_SetKind_DisjointUnion():
|
| 1664 |
+
A = FiniteSet(1, 2, 3)
|
| 1665 |
+
B = Interval(0, 5)
|
| 1666 |
+
assert DisjointUnion(A, B).kind is SetKind(NumberKind)
|
| 1667 |
+
|
| 1668 |
+
def test_SetKind_evaluate_False():
|
| 1669 |
+
U = lambda *args: Union(*args, evaluate=False)
|
| 1670 |
+
assert U({1}, EmptySet).kind is SetKind(NumberKind)
|
| 1671 |
+
assert U(Interval(1, 2), EmptySet).kind is SetKind(NumberKind)
|
| 1672 |
+
assert U({1}, S.UniversalSet).kind is SetKind(UndefinedKind)
|
| 1673 |
+
assert U(Interval(1, 2), Interval(4, 5),
|
| 1674 |
+
FiniteSet(1)).kind is SetKind(NumberKind)
|
| 1675 |
+
I = lambda *args: Intersection(*args, evaluate=False)
|
| 1676 |
+
assert I({1}, S.UniversalSet).kind is SetKind(NumberKind)
|
| 1677 |
+
assert I({1}, EmptySet).kind is SetKind()
|
| 1678 |
+
C = lambda *args: Complement(*args, evaluate=False)
|
| 1679 |
+
assert C(S.UniversalSet, {1, 2, 4, 5}).kind is SetKind(UndefinedKind)
|
| 1680 |
+
assert C({1, 2, 3, 4, 5}, EmptySet).kind is SetKind(NumberKind)
|
| 1681 |
+
assert C(EmptySet, {1, 2, 3, 4, 5}).kind is SetKind()
|
| 1682 |
+
|
| 1683 |
+
def test_SetKind_ImageSet_Special():
|
| 1684 |
+
f = ImageSet(Lambda(n, n ** 2), Interval(1, 4))
|
| 1685 |
+
assert (f - FiniteSet(3)).kind is SetKind(NumberKind)
|
| 1686 |
+
assert (f + Interval(16, 17)).kind is SetKind(NumberKind)
|
| 1687 |
+
assert (f + FiniteSet(17)).kind is SetKind(NumberKind)
|
| 1688 |
+
|
| 1689 |
+
def test_issue_20089():
|
| 1690 |
+
B = FiniteSet(FiniteSet(1, 2), FiniteSet(1))
|
| 1691 |
+
assert 1 not in B
|
| 1692 |
+
assert 1.0 not in B
|
| 1693 |
+
assert not Eq(1, FiniteSet(1, 2))
|
| 1694 |
+
assert FiniteSet(1) in B
|
| 1695 |
+
A = FiniteSet(1, 2)
|
| 1696 |
+
assert A in B
|
| 1697 |
+
assert B.issubset(B)
|
| 1698 |
+
assert not A.issubset(B)
|
| 1699 |
+
assert 1 in A
|
| 1700 |
+
C = FiniteSet(FiniteSet(1, 2), FiniteSet(1), 1, 2)
|
| 1701 |
+
assert A.issubset(C)
|
| 1702 |
+
assert B.issubset(C)
|
| 1703 |
+
|
| 1704 |
+
def test_issue_19378():
|
| 1705 |
+
a = FiniteSet(1, 2)
|
| 1706 |
+
b = ProductSet(a, a)
|
| 1707 |
+
c = FiniteSet((1, 1), (1, 2), (2, 1), (2, 2))
|
| 1708 |
+
assert b.is_subset(c) is True
|
| 1709 |
+
d = FiniteSet(1)
|
| 1710 |
+
assert b.is_subset(d) is False
|
| 1711 |
+
assert Eq(c, b).simplify() is S.true
|
| 1712 |
+
assert Eq(a, c).simplify() is S.false
|
| 1713 |
+
assert Eq({1}, {x}).simplify() == Eq({1}, {x})
|
| 1714 |
+
|
| 1715 |
+
def test_intersection_symbolic():
|
| 1716 |
+
n = Symbol('n')
|
| 1717 |
+
# These should not throw an error
|
| 1718 |
+
assert isinstance(Intersection(Range(n), Range(100)), Intersection)
|
| 1719 |
+
assert isinstance(Intersection(Range(n), Interval(1, 100)), Intersection)
|
| 1720 |
+
assert isinstance(Intersection(Range(100), Interval(1, n)), Intersection)
|
| 1721 |
+
|
| 1722 |
+
|
| 1723 |
+
@XFAIL
|
| 1724 |
+
def test_intersection_symbolic_failing():
|
| 1725 |
+
n = Symbol('n', integer=True, positive=True)
|
| 1726 |
+
assert Intersection(Range(10, n), Range(4, 500, 5)) == Intersection(
|
| 1727 |
+
Range(14, n), Range(14, 500, 5))
|
| 1728 |
+
assert Intersection(Interval(10, n), Range(4, 500, 5)) == Intersection(
|
| 1729 |
+
Interval(14, n), Range(14, 500, 5))
|
| 1730 |
+
|
| 1731 |
+
|
| 1732 |
+
def test_issue_20379():
|
| 1733 |
+
#https://github.com/sympy/sympy/issues/20379
|
| 1734 |
+
x = pi - 3.14159265358979
|
| 1735 |
+
assert FiniteSet(x).evalf(2) == FiniteSet(Float('3.23108914886517e-15', 2))
|
| 1736 |
+
|
| 1737 |
+
def test_finiteset_simplify():
|
| 1738 |
+
S = FiniteSet(1, cos(1)**2 + sin(1)**2)
|
| 1739 |
+
assert S.simplify() == {1}
|
| 1740 |
+
|
| 1741 |
+
def test_issue_14336():
|
| 1742 |
+
#https://github.com/sympy/sympy/issues/14336
|
| 1743 |
+
U = S.Complexes
|
| 1744 |
+
x = Symbol("x")
|
| 1745 |
+
U -= U.intersect(Ne(x, 1).as_set())
|
| 1746 |
+
U -= U.intersect(S.true.as_set())
|
| 1747 |
+
|
| 1748 |
+
def test_issue_9855():
|
| 1749 |
+
#https://github.com/sympy/sympy/issues/9855
|
| 1750 |
+
x, y, z = symbols('x, y, z', real=True)
|
| 1751 |
+
s1 = Interval(1, x) & Interval(y, 2)
|
| 1752 |
+
s2 = Interval(1, 2)
|
| 1753 |
+
assert s1.is_subset(s2) == None
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/__pycache__/typing_extensions.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aae0f0b825e60b4e208c23a96717f1de76acea5b4be62a5c78d0dd99c5ae7ab3
|
| 3 |
+
size 100312
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
conda
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU LESSER GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 29 June 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
This version of the GNU Lesser General Public License incorporates
|
| 10 |
+
the terms and conditions of version 3 of the GNU General Public
|
| 11 |
+
License, supplemented by the additional permissions listed below.
|
| 12 |
+
|
| 13 |
+
0. Additional Definitions.
|
| 14 |
+
|
| 15 |
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
| 16 |
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
| 17 |
+
General Public License.
|
| 18 |
+
|
| 19 |
+
"The Library" refers to a covered work governed by this License,
|
| 20 |
+
other than an Application or a Combined Work as defined below.
|
| 21 |
+
|
| 22 |
+
An "Application" is any work that makes use of an interface provided
|
| 23 |
+
by the Library, but which is not otherwise based on the Library.
|
| 24 |
+
Defining a subclass of a class defined by the Library is deemed a mode
|
| 25 |
+
of using an interface provided by the Library.
|
| 26 |
+
|
| 27 |
+
A "Combined Work" is a work produced by combining or linking an
|
| 28 |
+
Application with the Library. The particular version of the Library
|
| 29 |
+
with which the Combined Work was made is also called the "Linked
|
| 30 |
+
Version".
|
| 31 |
+
|
| 32 |
+
The "Minimal Corresponding Source" for a Combined Work means the
|
| 33 |
+
Corresponding Source for the Combined Work, excluding any source code
|
| 34 |
+
for portions of the Combined Work that, considered in isolation, are
|
| 35 |
+
based on the Application, and not on the Linked Version.
|
| 36 |
+
|
| 37 |
+
The "Corresponding Application Code" for a Combined Work means the
|
| 38 |
+
object code and/or source code for the Application, including any data
|
| 39 |
+
and utility programs needed for reproducing the Combined Work from the
|
| 40 |
+
Application, but excluding the System Libraries of the Combined Work.
|
| 41 |
+
|
| 42 |
+
1. Exception to Section 3 of the GNU GPL.
|
| 43 |
+
|
| 44 |
+
You may convey a covered work under sections 3 and 4 of this License
|
| 45 |
+
without being bound by section 3 of the GNU GPL.
|
| 46 |
+
|
| 47 |
+
2. Conveying Modified Versions.
|
| 48 |
+
|
| 49 |
+
If you modify a copy of the Library, and, in your modifications, a
|
| 50 |
+
facility refers to a function or data to be supplied by an Application
|
| 51 |
+
that uses the facility (other than as an argument passed when the
|
| 52 |
+
facility is invoked), then you may convey a copy of the modified
|
| 53 |
+
version:
|
| 54 |
+
|
| 55 |
+
a) under this License, provided that you make a good faith effort to
|
| 56 |
+
ensure that, in the event an Application does not supply the
|
| 57 |
+
function or data, the facility still operates, and performs
|
| 58 |
+
whatever part of its purpose remains meaningful, or
|
| 59 |
+
|
| 60 |
+
b) under the GNU GPL, with none of the additional permissions of
|
| 61 |
+
this License applicable to that copy.
|
| 62 |
+
|
| 63 |
+
3. Object Code Incorporating Material from Library Header Files.
|
| 64 |
+
|
| 65 |
+
The object code form of an Application may incorporate material from
|
| 66 |
+
a header file that is part of the Library. You may convey such object
|
| 67 |
+
code under terms of your choice, provided that, if the incorporated
|
| 68 |
+
material is not limited to numerical parameters, data structure
|
| 69 |
+
layouts and accessors, or small macros, inline functions and templates
|
| 70 |
+
(ten or fewer lines in length), you do both of the following:
|
| 71 |
+
|
| 72 |
+
a) Give prominent notice with each copy of the object code that the
|
| 73 |
+
Library is used in it and that the Library and its use are
|
| 74 |
+
covered by this License.
|
| 75 |
+
|
| 76 |
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
| 77 |
+
document.
|
| 78 |
+
|
| 79 |
+
4. Combined Works.
|
| 80 |
+
|
| 81 |
+
You may convey a Combined Work under terms of your choice that,
|
| 82 |
+
taken together, effectively do not restrict modification of the
|
| 83 |
+
portions of the Library contained in the Combined Work and reverse
|
| 84 |
+
engineering for debugging such modifications, if you also do each of
|
| 85 |
+
the following:
|
| 86 |
+
|
| 87 |
+
a) Give prominent notice with each copy of the Combined Work that
|
| 88 |
+
the Library is used in it and that the Library and its use are
|
| 89 |
+
covered by this License.
|
| 90 |
+
|
| 91 |
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
| 92 |
+
document.
|
| 93 |
+
|
| 94 |
+
c) For a Combined Work that displays copyright notices during
|
| 95 |
+
execution, include the copyright notice for the Library among
|
| 96 |
+
these notices, as well as a reference directing the user to the
|
| 97 |
+
copies of the GNU GPL and this license document.
|
| 98 |
+
|
| 99 |
+
d) Do one of the following:
|
| 100 |
+
|
| 101 |
+
0) Convey the Minimal Corresponding Source under the terms of this
|
| 102 |
+
License, and the Corresponding Application Code in a form
|
| 103 |
+
suitable for, and under terms that permit, the user to
|
| 104 |
+
recombine or relink the Application with a modified version of
|
| 105 |
+
the Linked Version to produce a modified Combined Work, in the
|
| 106 |
+
manner specified by section 6 of the GNU GPL for conveying
|
| 107 |
+
Corresponding Source.
|
| 108 |
+
|
| 109 |
+
1) Use a suitable shared library mechanism for linking with the
|
| 110 |
+
Library. A suitable mechanism is one that (a) uses at run time
|
| 111 |
+
a copy of the Library already present on the user's computer
|
| 112 |
+
system, and (b) will operate properly with a modified version
|
| 113 |
+
of the Library that is interface-compatible with the Linked
|
| 114 |
+
Version.
|
| 115 |
+
|
| 116 |
+
e) Provide Installation Information, but only if you would otherwise
|
| 117 |
+
be required to provide such information under section 6 of the
|
| 118 |
+
GNU GPL, and only to the extent that such information is
|
| 119 |
+
necessary to install and execute a modified version of the
|
| 120 |
+
Combined Work produced by recombining or relinking the
|
| 121 |
+
Application with a modified version of the Linked Version. (If
|
| 122 |
+
you use option 4d0, the Installation Information must accompany
|
| 123 |
+
the Minimal Corresponding Source and Corresponding Application
|
| 124 |
+
Code. If you use option 4d1, you must provide the Installation
|
| 125 |
+
Information in the manner specified by section 6 of the GNU GPL
|
| 126 |
+
for conveying Corresponding Source.)
|
| 127 |
+
|
| 128 |
+
5. Combined Libraries.
|
| 129 |
+
|
| 130 |
+
You may place library facilities that are a work based on the
|
| 131 |
+
Library side by side in a single library together with other library
|
| 132 |
+
facilities that are not Applications and are not covered by this
|
| 133 |
+
License, and convey such a combined library under terms of your
|
| 134 |
+
choice, if you do both of the following:
|
| 135 |
+
|
| 136 |
+
a) Accompany the combined library with a copy of the same work based
|
| 137 |
+
on the Library, uncombined with any other library facilities,
|
| 138 |
+
conveyed under the terms of this License.
|
| 139 |
+
|
| 140 |
+
b) Give prominent notice with the combined library that part of it
|
| 141 |
+
is a work based on the Library, and explaining where to find the
|
| 142 |
+
accompanying uncombined form of the same work.
|
| 143 |
+
|
| 144 |
+
6. Revised Versions of the GNU Lesser General Public License.
|
| 145 |
+
|
| 146 |
+
The Free Software Foundation may publish revised and/or new versions
|
| 147 |
+
of the GNU Lesser General Public License from time to time. Such new
|
| 148 |
+
versions will be similar in spirit to the present version, but may
|
| 149 |
+
differ in detail to address new problems or concerns.
|
| 150 |
+
|
| 151 |
+
Each version is given a distinguishing version number. If the
|
| 152 |
+
Library as you received it specifies that a certain numbered version
|
| 153 |
+
of the GNU Lesser General Public License "or any later version"
|
| 154 |
+
applies to it, you have the option of following the terms and
|
| 155 |
+
conditions either of that published version or of any later version
|
| 156 |
+
published by the Free Software Foundation. If the Library as you
|
| 157 |
+
received it does not specify a version number of the GNU Lesser
|
| 158 |
+
General Public License, you may choose any version of the GNU Lesser
|
| 159 |
+
General Public License ever published by the Free Software Foundation.
|
| 160 |
+
|
| 161 |
+
If the Library as you received it specifies that a proxy can decide
|
| 162 |
+
whether future versions of the GNU Lesser General Public License shall
|
| 163 |
+
apply, that proxy's public statement of acceptance of any version is
|
| 164 |
+
permanent authorization for you to choose that version for the
|
| 165 |
+
Library.
|
| 166 |
+
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
|
| 3 |
+
autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
|
| 4 |
+
autocommand-2.2.2.dist-info/RECORD,,
|
| 5 |
+
autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
| 6 |
+
autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
|
| 7 |
+
autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
|
| 8 |
+
autocommand/__pycache__/__init__.cpython-312.pyc,,
|
| 9 |
+
autocommand/__pycache__/autoasync.cpython-312.pyc,,
|
| 10 |
+
autocommand/__pycache__/autocommand.cpython-312.pyc,,
|
| 11 |
+
autocommand/__pycache__/automain.cpython-312.pyc,,
|
| 12 |
+
autocommand/__pycache__/autoparse.cpython-312.pyc,,
|
| 13 |
+
autocommand/__pycache__/errors.cpython-312.pyc,,
|
| 14 |
+
autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
|
| 15 |
+
autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
|
| 16 |
+
autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
|
| 17 |
+
autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
|
| 18 |
+
autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.38.4)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
autocommand
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (359 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/autocommand.cpython-310.pyc
ADDED
|
Binary file (1 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__pycache__/autoparse.cpython-310.pyc
ADDED
|
Binary file (8.36 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand/errors.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2014-2016 Nathan West
|
| 2 |
+
#
|
| 3 |
+
# This file is part of autocommand.
|
| 4 |
+
#
|
| 5 |
+
# autocommand is free software: you can redistribute it and/or modify
|
| 6 |
+
# it under the terms of the GNU Lesser General Public License as published by
|
| 7 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 8 |
+
# (at your option) any later version.
|
| 9 |
+
#
|
| 10 |
+
# autocommand is distributed in the hope that it will be useful,
|
| 11 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
# GNU Lesser General Public License for more details.
|
| 14 |
+
#
|
| 15 |
+
# You should have received a copy of the GNU Lesser General Public License
|
| 16 |
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class AutocommandError(Exception):
|
| 20 |
+
'''Base class for autocommand exceptions'''
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
+
# Individual modules will define errors specific to that module.
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_compat.cpython-310.pyc
ADDED
|
Binary file (1.88 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (178 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/py39.cpython-310.pyc
ADDED
|
Binary file (1.17 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/__init__.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (74 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (167 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__pycache__/py38.cpython-310.pyc
ADDED
|
Binary file (293 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/py38.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
if sys.version_info > (3, 9):
|
| 5 |
+
from typing import Annotated
|
| 6 |
+
else: # pragma: no cover
|
| 7 |
+
from typing_extensions import Annotated # noqa: F401
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/py.typed
ADDED
|
File without changes
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: jaraco.collections
|
| 3 |
+
Version: 5.1.0
|
| 4 |
+
Summary: Collection objects similar to those in stdlib by jaraco
|
| 5 |
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
| 6 |
+
Project-URL: Source, https://github.com/jaraco/jaraco.collections
|
| 7 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 8 |
+
Classifier: Intended Audience :: Developers
|
| 9 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 12 |
+
Requires-Python: >=3.8
|
| 13 |
+
Description-Content-Type: text/x-rst
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
Requires-Dist: jaraco.text
|
| 16 |
+
Provides-Extra: check
|
| 17 |
+
Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'check'
|
| 18 |
+
Requires-Dist: pytest-ruff >=0.2.1 ; (sys_platform != "cygwin") and extra == 'check'
|
| 19 |
+
Provides-Extra: cover
|
| 20 |
+
Requires-Dist: pytest-cov ; extra == 'cover'
|
| 21 |
+
Provides-Extra: doc
|
| 22 |
+
Requires-Dist: sphinx >=3.5 ; extra == 'doc'
|
| 23 |
+
Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
|
| 24 |
+
Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
|
| 25 |
+
Requires-Dist: furo ; extra == 'doc'
|
| 26 |
+
Requires-Dist: sphinx-lint ; extra == 'doc'
|
| 27 |
+
Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
|
| 28 |
+
Provides-Extra: enabler
|
| 29 |
+
Requires-Dist: pytest-enabler >=2.2 ; extra == 'enabler'
|
| 30 |
+
Provides-Extra: test
|
| 31 |
+
Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
|
| 32 |
+
Provides-Extra: type
|
| 33 |
+
Requires-Dist: pytest-mypy ; extra == 'type'
|
| 34 |
+
|
| 35 |
+
.. image:: https://img.shields.io/pypi/v/jaraco.collections.svg
|
| 36 |
+
:target: https://pypi.org/project/jaraco.collections
|
| 37 |
+
|
| 38 |
+
.. image:: https://img.shields.io/pypi/pyversions/jaraco.collections.svg
|
| 39 |
+
|
| 40 |
+
.. image:: https://github.com/jaraco/jaraco.collections/actions/workflows/main.yml/badge.svg
|
| 41 |
+
:target: https://github.com/jaraco/jaraco.collections/actions?query=workflow%3A%22tests%22
|
| 42 |
+
:alt: tests
|
| 43 |
+
|
| 44 |
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
| 45 |
+
:target: https://github.com/astral-sh/ruff
|
| 46 |
+
:alt: Ruff
|
| 47 |
+
|
| 48 |
+
.. image:: https://readthedocs.org/projects/jaracocollections/badge/?version=latest
|
| 49 |
+
:target: https://jaracocollections.readthedocs.io/en/latest/?badge=latest
|
| 50 |
+
|
| 51 |
+
.. image:: https://img.shields.io/badge/skeleton-2024-informational
|
| 52 |
+
:target: https://blog.jaraco.com/skeleton
|
| 53 |
+
|
| 54 |
+
.. image:: https://tidelift.com/badges/package/pypi/jaraco.collections
|
| 55 |
+
:target: https://tidelift.com/subscription/pkg/pypi-jaraco.collections?utm_source=pypi-jaraco.collections&utm_medium=readme
|
| 56 |
+
|
| 57 |
+
Models and classes to supplement the stdlib 'collections' module.
|
| 58 |
+
|
| 59 |
+
See the docs, linked above, for descriptions and usage examples.
|
| 60 |
+
|
| 61 |
+
Highlights include:
|
| 62 |
+
|
| 63 |
+
- RangeMap: A mapping that accepts a range of values for keys.
|
| 64 |
+
- Projection: A subset over an existing mapping.
|
| 65 |
+
- KeyTransformingDict: Generalized mapping with keys transformed by a function.
|
| 66 |
+
- FoldedCaseKeyedDict: A dict whose string keys are case-insensitive.
|
| 67 |
+
- BijectiveMap: A map where keys map to values and values back to their keys.
|
| 68 |
+
- ItemsAsAttributes: A mapping mix-in exposing items as attributes.
|
| 69 |
+
- IdentityOverrideMap: A map whose keys map by default to themselves unless overridden.
|
| 70 |
+
- FrozenDict: A hashable, immutable map.
|
| 71 |
+
- Enumeration: An object whose keys are enumerated.
|
| 72 |
+
- Everything: A container that contains all things.
|
| 73 |
+
- Least, Greatest: Objects that are always less than or greater than any other.
|
| 74 |
+
- pop_all: Return all items from the mutable sequence and remove them from that sequence.
|
| 75 |
+
- DictStack: A stack of dicts, great for sharing scopes.
|
| 76 |
+
- WeightedLookup: A specialized RangeMap for selecting an item by weights.
|
| 77 |
+
|
| 78 |
+
For Enterprise
|
| 79 |
+
==============
|
| 80 |
+
|
| 81 |
+
Available as part of the Tidelift Subscription.
|
| 82 |
+
|
| 83 |
+
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
|
| 84 |
+
|
| 85 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-jaraco.collections?utm_source=pypi-jaraco.collections&utm_medium=referral&utm_campaign=github>`_.
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (73.0.1)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This software is made available under the terms of *either* of the licenses
|
| 2 |
+
found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made
|
| 3 |
+
under the terms of *both* these licenses.
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.APACHE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.BSD
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) Donald Stufft and individual contributors.
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions are met:
|
| 6 |
+
|
| 7 |
+
1. Redistributions of source code must retain the above copyright notice,
|
| 8 |
+
this list of conditions and the following disclaimer.
|
| 9 |
+
|
| 10 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 15 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 16 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 17 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 18 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 19 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 20 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 21 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 22 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 23 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/METADATA
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.3
|
| 2 |
+
Name: packaging
|
| 3 |
+
Version: 24.2
|
| 4 |
+
Summary: Core utilities for Python packages
|
| 5 |
+
Author-email: Donald Stufft <donald@stufft.io>
|
| 6 |
+
Requires-Python: >=3.8
|
| 7 |
+
Description-Content-Type: text/x-rst
|
| 8 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 9 |
+
Classifier: Intended Audience :: Developers
|
| 10 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 11 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 12 |
+
Classifier: Programming Language :: Python
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 21 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 22 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 23 |
+
Classifier: Typing :: Typed
|
| 24 |
+
Project-URL: Documentation, https://packaging.pypa.io/
|
| 25 |
+
Project-URL: Source, https://github.com/pypa/packaging
|
| 26 |
+
|
| 27 |
+
packaging
|
| 28 |
+
=========
|
| 29 |
+
|
| 30 |
+
.. start-intro
|
| 31 |
+
|
| 32 |
+
Reusable core utilities for various Python Packaging
|
| 33 |
+
`interoperability specifications <https://packaging.python.org/specifications/>`_.
|
| 34 |
+
|
| 35 |
+
This library provides utilities that implement the interoperability
|
| 36 |
+
specifications which have clearly one correct behaviour (eg: :pep:`440`)
|
| 37 |
+
or benefit greatly from having a single shared implementation (eg: :pep:`425`).
|
| 38 |
+
|
| 39 |
+
.. end-intro
|
| 40 |
+
|
| 41 |
+
The ``packaging`` project includes the following: version handling, specifiers,
|
| 42 |
+
markers, requirements, tags, utilities.
|
| 43 |
+
|
| 44 |
+
Documentation
|
| 45 |
+
-------------
|
| 46 |
+
|
| 47 |
+
The `documentation`_ provides information and the API for the following:
|
| 48 |
+
|
| 49 |
+
- Version Handling
|
| 50 |
+
- Specifiers
|
| 51 |
+
- Markers
|
| 52 |
+
- Requirements
|
| 53 |
+
- Tags
|
| 54 |
+
- Utilities
|
| 55 |
+
|
| 56 |
+
Installation
|
| 57 |
+
------------
|
| 58 |
+
|
| 59 |
+
Use ``pip`` to install these utilities::
|
| 60 |
+
|
| 61 |
+
pip install packaging
|
| 62 |
+
|
| 63 |
+
The ``packaging`` library uses calendar-based versioning (``YY.N``).
|
| 64 |
+
|
| 65 |
+
Discussion
|
| 66 |
+
----------
|
| 67 |
+
|
| 68 |
+
If you run into bugs, you can file them in our `issue tracker`_.
|
| 69 |
+
|
| 70 |
+
You can also join ``#pypa`` on Freenode to ask questions or get involved.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
.. _`documentation`: https://packaging.pypa.io/
|
| 74 |
+
.. _`issue tracker`: https://github.com/pypa/packaging/issues
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
Code of Conduct
|
| 78 |
+
---------------
|
| 79 |
+
|
| 80 |
+
Everyone interacting in the packaging project's codebases, issue trackers, chat
|
| 81 |
+
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
| 82 |
+
|
| 83 |
+
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
| 84 |
+
|
| 85 |
+
Contributing
|
| 86 |
+
------------
|
| 87 |
+
|
| 88 |
+
The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as
|
| 89 |
+
well as how to report a potential security issue. The documentation for this
|
| 90 |
+
project also covers information about `project development`_ and `security`_.
|
| 91 |
+
|
| 92 |
+
.. _`project development`: https://packaging.pypa.io/en/latest/development/
|
| 93 |
+
.. _`security`: https://packaging.pypa.io/en/latest/security/
|
| 94 |
+
|
| 95 |
+
Project History
|
| 96 |
+
---------------
|
| 97 |
+
|
| 98 |
+
Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for
|
| 99 |
+
recent changes and project history.
|
| 100 |
+
|
| 101 |
+
.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/
|
| 102 |
+
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/packaging-24.2.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: flit 3.10.1
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
|
| 3 |
+
# Licensed to PSF under a Contributor Agreement.
|
| 4 |
+
|
| 5 |
+
__all__ = ("loads", "load", "TOMLDecodeError")
|
| 6 |
+
__version__ = "2.0.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
|
| 7 |
+
|
| 8 |
+
from ._parser import TOMLDecodeError, load, loads
|
| 9 |
+
|
| 10 |
+
# Pretend this exception was created here.
|
| 11 |
+
TOMLDecodeError.__module__ = __name__
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (324 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_re.cpython-310.pyc
ADDED
|
Binary file (2.87 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_types.cpython-310.pyc
ADDED
|
Binary file (294 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/_parser.py
ADDED
|
@@ -0,0 +1,691 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ed to PSF under a Contributor Agreement.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from collections.abc import Iterable
|
| 8 |
+
import string
|
| 9 |
+
from types import MappingProxyType
|
| 10 |
+
from typing import Any, BinaryIO, NamedTuple
|
| 11 |
+
|
| 12 |
+
from ._re import (
|
| 13 |
+
RE_DATETIME,
|
| 14 |
+
RE_LOCALTIME,
|
| 15 |
+
RE_NUMBER,
|
| 16 |
+
match_to_datetime,
|
| 17 |
+
match_to_localtime,
|
| 18 |
+
match_to_number,
|
| 19 |
+
)
|
| 20 |
+
from ._types import Key, ParseFloat, Pos
|
| 21 |
+
|
| 22 |
+
ASCII_CTRL = frozenset(chr(i) for i in range(32)) | frozenset(chr(127))
|
| 23 |
+
|
| 24 |
+
# Neither of these sets include quotation mark or backslash. They are
|
| 25 |
+
# currently handled as separate cases in the parser functions.
|
| 26 |
+
ILLEGAL_BASIC_STR_CHARS = ASCII_CTRL - frozenset("\t")
|
| 27 |
+
ILLEGAL_MULTILINE_BASIC_STR_CHARS = ASCII_CTRL - frozenset("\t\n")
|
| 28 |
+
|
| 29 |
+
ILLEGAL_LITERAL_STR_CHARS = ILLEGAL_BASIC_STR_CHARS
|
| 30 |
+
ILLEGAL_MULTILINE_LITERAL_STR_CHARS = ILLEGAL_MULTILINE_BASIC_STR_CHARS
|
| 31 |
+
|
| 32 |
+
ILLEGAL_COMMENT_CHARS = ILLEGAL_BASIC_STR_CHARS
|
| 33 |
+
|
| 34 |
+
TOML_WS = frozenset(" \t")
|
| 35 |
+
TOML_WS_AND_NEWLINE = TOML_WS | frozenset("\n")
|
| 36 |
+
BARE_KEY_CHARS = frozenset(string.ascii_letters + string.digits + "-_")
|
| 37 |
+
KEY_INITIAL_CHARS = BARE_KEY_CHARS | frozenset("\"'")
|
| 38 |
+
HEXDIGIT_CHARS = frozenset(string.hexdigits)
|
| 39 |
+
|
| 40 |
+
BASIC_STR_ESCAPE_REPLACEMENTS = MappingProxyType(
|
| 41 |
+
{
|
| 42 |
+
"\\b": "\u0008", # backspace
|
| 43 |
+
"\\t": "\u0009", # tab
|
| 44 |
+
"\\n": "\u000A", # linefeed
|
| 45 |
+
"\\f": "\u000C", # form feed
|
| 46 |
+
"\\r": "\u000D", # carriage return
|
| 47 |
+
'\\"': "\u0022", # quote
|
| 48 |
+
"\\\\": "\u005C", # backslash
|
| 49 |
+
}
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class TOMLDecodeError(ValueError):
|
| 54 |
+
"""An error raised if a document is not valid TOML."""
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def load(__fp: BinaryIO, *, parse_float: ParseFloat = float) -> dict[str, Any]:
|
| 58 |
+
"""Parse TOML from a binary file object."""
|
| 59 |
+
b = __fp.read()
|
| 60 |
+
try:
|
| 61 |
+
s = b.decode()
|
| 62 |
+
except AttributeError:
|
| 63 |
+
raise TypeError(
|
| 64 |
+
"File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`"
|
| 65 |
+
) from None
|
| 66 |
+
return loads(s, parse_float=parse_float)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def loads(__s: str, *, parse_float: ParseFloat = float) -> dict[str, Any]: # noqa: C901
|
| 70 |
+
"""Parse TOML from a string."""
|
| 71 |
+
|
| 72 |
+
# The spec allows converting "\r\n" to "\n", even in string
|
| 73 |
+
# literals. Let's do so to simplify parsing.
|
| 74 |
+
src = __s.replace("\r\n", "\n")
|
| 75 |
+
pos = 0
|
| 76 |
+
out = Output(NestedDict(), Flags())
|
| 77 |
+
header: Key = ()
|
| 78 |
+
parse_float = make_safe_parse_float(parse_float)
|
| 79 |
+
|
| 80 |
+
# Parse one statement at a time
|
| 81 |
+
# (typically means one line in TOML source)
|
| 82 |
+
while True:
|
| 83 |
+
# 1. Skip line leading whitespace
|
| 84 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 85 |
+
|
| 86 |
+
# 2. Parse rules. Expect one of the following:
|
| 87 |
+
# - end of file
|
| 88 |
+
# - end of line
|
| 89 |
+
# - comment
|
| 90 |
+
# - key/value pair
|
| 91 |
+
# - append dict to list (and move to its namespace)
|
| 92 |
+
# - create dict (and move to its namespace)
|
| 93 |
+
# Skip trailing whitespace when applicable.
|
| 94 |
+
try:
|
| 95 |
+
char = src[pos]
|
| 96 |
+
except IndexError:
|
| 97 |
+
break
|
| 98 |
+
if char == "\n":
|
| 99 |
+
pos += 1
|
| 100 |
+
continue
|
| 101 |
+
if char in KEY_INITIAL_CHARS:
|
| 102 |
+
pos = key_value_rule(src, pos, out, header, parse_float)
|
| 103 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 104 |
+
elif char == "[":
|
| 105 |
+
try:
|
| 106 |
+
second_char: str | None = src[pos + 1]
|
| 107 |
+
except IndexError:
|
| 108 |
+
second_char = None
|
| 109 |
+
out.flags.finalize_pending()
|
| 110 |
+
if second_char == "[":
|
| 111 |
+
pos, header = create_list_rule(src, pos, out)
|
| 112 |
+
else:
|
| 113 |
+
pos, header = create_dict_rule(src, pos, out)
|
| 114 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 115 |
+
elif char != "#":
|
| 116 |
+
raise suffixed_err(src, pos, "Invalid statement")
|
| 117 |
+
|
| 118 |
+
# 3. Skip comment
|
| 119 |
+
pos = skip_comment(src, pos)
|
| 120 |
+
|
| 121 |
+
# 4. Expect end of line or end of file
|
| 122 |
+
try:
|
| 123 |
+
char = src[pos]
|
| 124 |
+
except IndexError:
|
| 125 |
+
break
|
| 126 |
+
if char != "\n":
|
| 127 |
+
raise suffixed_err(
|
| 128 |
+
src, pos, "Expected newline or end of document after a statement"
|
| 129 |
+
)
|
| 130 |
+
pos += 1
|
| 131 |
+
|
| 132 |
+
return out.data.dict
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class Flags:
|
| 136 |
+
"""Flags that map to parsed keys/namespaces."""
|
| 137 |
+
|
| 138 |
+
# Marks an immutable namespace (inline array or inline table).
|
| 139 |
+
FROZEN = 0
|
| 140 |
+
# Marks a nest that has been explicitly created and can no longer
|
| 141 |
+
# be opened using the "[table]" syntax.
|
| 142 |
+
EXPLICIT_NEST = 1
|
| 143 |
+
|
| 144 |
+
def __init__(self) -> None:
|
| 145 |
+
self._flags: dict[str, dict] = {}
|
| 146 |
+
self._pending_flags: set[tuple[Key, int]] = set()
|
| 147 |
+
|
| 148 |
+
def add_pending(self, key: Key, flag: int) -> None:
|
| 149 |
+
self._pending_flags.add((key, flag))
|
| 150 |
+
|
| 151 |
+
def finalize_pending(self) -> None:
|
| 152 |
+
for key, flag in self._pending_flags:
|
| 153 |
+
self.set(key, flag, recursive=False)
|
| 154 |
+
self._pending_flags.clear()
|
| 155 |
+
|
| 156 |
+
def unset_all(self, key: Key) -> None:
|
| 157 |
+
cont = self._flags
|
| 158 |
+
for k in key[:-1]:
|
| 159 |
+
if k not in cont:
|
| 160 |
+
return
|
| 161 |
+
cont = cont[k]["nested"]
|
| 162 |
+
cont.pop(key[-1], None)
|
| 163 |
+
|
| 164 |
+
def set(self, key: Key, flag: int, *, recursive: bool) -> None: # noqa: A003
|
| 165 |
+
cont = self._flags
|
| 166 |
+
key_parent, key_stem = key[:-1], key[-1]
|
| 167 |
+
for k in key_parent:
|
| 168 |
+
if k not in cont:
|
| 169 |
+
cont[k] = {"flags": set(), "recursive_flags": set(), "nested": {}}
|
| 170 |
+
cont = cont[k]["nested"]
|
| 171 |
+
if key_stem not in cont:
|
| 172 |
+
cont[key_stem] = {"flags": set(), "recursive_flags": set(), "nested": {}}
|
| 173 |
+
cont[key_stem]["recursive_flags" if recursive else "flags"].add(flag)
|
| 174 |
+
|
| 175 |
+
def is_(self, key: Key, flag: int) -> bool:
|
| 176 |
+
if not key:
|
| 177 |
+
return False # document root has no flags
|
| 178 |
+
cont = self._flags
|
| 179 |
+
for k in key[:-1]:
|
| 180 |
+
if k not in cont:
|
| 181 |
+
return False
|
| 182 |
+
inner_cont = cont[k]
|
| 183 |
+
if flag in inner_cont["recursive_flags"]:
|
| 184 |
+
return True
|
| 185 |
+
cont = inner_cont["nested"]
|
| 186 |
+
key_stem = key[-1]
|
| 187 |
+
if key_stem in cont:
|
| 188 |
+
cont = cont[key_stem]
|
| 189 |
+
return flag in cont["flags"] or flag in cont["recursive_flags"]
|
| 190 |
+
return False
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
class NestedDict:
|
| 194 |
+
def __init__(self) -> None:
|
| 195 |
+
# The parsed content of the TOML document
|
| 196 |
+
self.dict: dict[str, Any] = {}
|
| 197 |
+
|
| 198 |
+
def get_or_create_nest(
|
| 199 |
+
self,
|
| 200 |
+
key: Key,
|
| 201 |
+
*,
|
| 202 |
+
access_lists: bool = True,
|
| 203 |
+
) -> dict:
|
| 204 |
+
cont: Any = self.dict
|
| 205 |
+
for k in key:
|
| 206 |
+
if k not in cont:
|
| 207 |
+
cont[k] = {}
|
| 208 |
+
cont = cont[k]
|
| 209 |
+
if access_lists and isinstance(cont, list):
|
| 210 |
+
cont = cont[-1]
|
| 211 |
+
if not isinstance(cont, dict):
|
| 212 |
+
raise KeyError("There is no nest behind this key")
|
| 213 |
+
return cont
|
| 214 |
+
|
| 215 |
+
def append_nest_to_list(self, key: Key) -> None:
|
| 216 |
+
cont = self.get_or_create_nest(key[:-1])
|
| 217 |
+
last_key = key[-1]
|
| 218 |
+
if last_key in cont:
|
| 219 |
+
list_ = cont[last_key]
|
| 220 |
+
if not isinstance(list_, list):
|
| 221 |
+
raise KeyError("An object other than list found behind this key")
|
| 222 |
+
list_.append({})
|
| 223 |
+
else:
|
| 224 |
+
cont[last_key] = [{}]
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
class Output(NamedTuple):
|
| 228 |
+
data: NestedDict
|
| 229 |
+
flags: Flags
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def skip_chars(src: str, pos: Pos, chars: Iterable[str]) -> Pos:
|
| 233 |
+
try:
|
| 234 |
+
while src[pos] in chars:
|
| 235 |
+
pos += 1
|
| 236 |
+
except IndexError:
|
| 237 |
+
pass
|
| 238 |
+
return pos
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def skip_until(
|
| 242 |
+
src: str,
|
| 243 |
+
pos: Pos,
|
| 244 |
+
expect: str,
|
| 245 |
+
*,
|
| 246 |
+
error_on: frozenset[str],
|
| 247 |
+
error_on_eof: bool,
|
| 248 |
+
) -> Pos:
|
| 249 |
+
try:
|
| 250 |
+
new_pos = src.index(expect, pos)
|
| 251 |
+
except ValueError:
|
| 252 |
+
new_pos = len(src)
|
| 253 |
+
if error_on_eof:
|
| 254 |
+
raise suffixed_err(src, new_pos, f"Expected {expect!r}") from None
|
| 255 |
+
|
| 256 |
+
if not error_on.isdisjoint(src[pos:new_pos]):
|
| 257 |
+
while src[pos] not in error_on:
|
| 258 |
+
pos += 1
|
| 259 |
+
raise suffixed_err(src, pos, f"Found invalid character {src[pos]!r}")
|
| 260 |
+
return new_pos
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
def skip_comment(src: str, pos: Pos) -> Pos:
|
| 264 |
+
try:
|
| 265 |
+
char: str | None = src[pos]
|
| 266 |
+
except IndexError:
|
| 267 |
+
char = None
|
| 268 |
+
if char == "#":
|
| 269 |
+
return skip_until(
|
| 270 |
+
src, pos + 1, "\n", error_on=ILLEGAL_COMMENT_CHARS, error_on_eof=False
|
| 271 |
+
)
|
| 272 |
+
return pos
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def skip_comments_and_array_ws(src: str, pos: Pos) -> Pos:
|
| 276 |
+
while True:
|
| 277 |
+
pos_before_skip = pos
|
| 278 |
+
pos = skip_chars(src, pos, TOML_WS_AND_NEWLINE)
|
| 279 |
+
pos = skip_comment(src, pos)
|
| 280 |
+
if pos == pos_before_skip:
|
| 281 |
+
return pos
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def create_dict_rule(src: str, pos: Pos, out: Output) -> tuple[Pos, Key]:
|
| 285 |
+
pos += 1 # Skip "["
|
| 286 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 287 |
+
pos, key = parse_key(src, pos)
|
| 288 |
+
|
| 289 |
+
if out.flags.is_(key, Flags.EXPLICIT_NEST) or out.flags.is_(key, Flags.FROZEN):
|
| 290 |
+
raise suffixed_err(src, pos, f"Cannot declare {key} twice")
|
| 291 |
+
out.flags.set(key, Flags.EXPLICIT_NEST, recursive=False)
|
| 292 |
+
try:
|
| 293 |
+
out.data.get_or_create_nest(key)
|
| 294 |
+
except KeyError:
|
| 295 |
+
raise suffixed_err(src, pos, "Cannot overwrite a value") from None
|
| 296 |
+
|
| 297 |
+
if not src.startswith("]", pos):
|
| 298 |
+
raise suffixed_err(src, pos, "Expected ']' at the end of a table declaration")
|
| 299 |
+
return pos + 1, key
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
def create_list_rule(src: str, pos: Pos, out: Output) -> tuple[Pos, Key]:
|
| 303 |
+
pos += 2 # Skip "[["
|
| 304 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 305 |
+
pos, key = parse_key(src, pos)
|
| 306 |
+
|
| 307 |
+
if out.flags.is_(key, Flags.FROZEN):
|
| 308 |
+
raise suffixed_err(src, pos, f"Cannot mutate immutable namespace {key}")
|
| 309 |
+
# Free the namespace now that it points to another empty list item...
|
| 310 |
+
out.flags.unset_all(key)
|
| 311 |
+
# ...but this key precisely is still prohibited from table declaration
|
| 312 |
+
out.flags.set(key, Flags.EXPLICIT_NEST, recursive=False)
|
| 313 |
+
try:
|
| 314 |
+
out.data.append_nest_to_list(key)
|
| 315 |
+
except KeyError:
|
| 316 |
+
raise suffixed_err(src, pos, "Cannot overwrite a value") from None
|
| 317 |
+
|
| 318 |
+
if not src.startswith("]]", pos):
|
| 319 |
+
raise suffixed_err(src, pos, "Expected ']]' at the end of an array declaration")
|
| 320 |
+
return pos + 2, key
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
def key_value_rule(
|
| 324 |
+
src: str, pos: Pos, out: Output, header: Key, parse_float: ParseFloat
|
| 325 |
+
) -> Pos:
|
| 326 |
+
pos, key, value = parse_key_value_pair(src, pos, parse_float)
|
| 327 |
+
key_parent, key_stem = key[:-1], key[-1]
|
| 328 |
+
abs_key_parent = header + key_parent
|
| 329 |
+
|
| 330 |
+
relative_path_cont_keys = (header + key[:i] for i in range(1, len(key)))
|
| 331 |
+
for cont_key in relative_path_cont_keys:
|
| 332 |
+
# Check that dotted key syntax does not redefine an existing table
|
| 333 |
+
if out.flags.is_(cont_key, Flags.EXPLICIT_NEST):
|
| 334 |
+
raise suffixed_err(src, pos, f"Cannot redefine namespace {cont_key}")
|
| 335 |
+
# Containers in the relative path can't be opened with the table syntax or
|
| 336 |
+
# dotted key/value syntax in following table sections.
|
| 337 |
+
out.flags.add_pending(cont_key, Flags.EXPLICIT_NEST)
|
| 338 |
+
|
| 339 |
+
if out.flags.is_(abs_key_parent, Flags.FROZEN):
|
| 340 |
+
raise suffixed_err(
|
| 341 |
+
src, pos, f"Cannot mutate immutable namespace {abs_key_parent}"
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
+
try:
|
| 345 |
+
nest = out.data.get_or_create_nest(abs_key_parent)
|
| 346 |
+
except KeyError:
|
| 347 |
+
raise suffixed_err(src, pos, "Cannot overwrite a value") from None
|
| 348 |
+
if key_stem in nest:
|
| 349 |
+
raise suffixed_err(src, pos, "Cannot overwrite a value")
|
| 350 |
+
# Mark inline table and array namespaces recursively immutable
|
| 351 |
+
if isinstance(value, (dict, list)):
|
| 352 |
+
out.flags.set(header + key, Flags.FROZEN, recursive=True)
|
| 353 |
+
nest[key_stem] = value
|
| 354 |
+
return pos
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def parse_key_value_pair(
|
| 358 |
+
src: str, pos: Pos, parse_float: ParseFloat
|
| 359 |
+
) -> tuple[Pos, Key, Any]:
|
| 360 |
+
pos, key = parse_key(src, pos)
|
| 361 |
+
try:
|
| 362 |
+
char: str | None = src[pos]
|
| 363 |
+
except IndexError:
|
| 364 |
+
char = None
|
| 365 |
+
if char != "=":
|
| 366 |
+
raise suffixed_err(src, pos, "Expected '=' after a key in a key/value pair")
|
| 367 |
+
pos += 1
|
| 368 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 369 |
+
pos, value = parse_value(src, pos, parse_float)
|
| 370 |
+
return pos, key, value
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
def parse_key(src: str, pos: Pos) -> tuple[Pos, Key]:
|
| 374 |
+
pos, key_part = parse_key_part(src, pos)
|
| 375 |
+
key: Key = (key_part,)
|
| 376 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 377 |
+
while True:
|
| 378 |
+
try:
|
| 379 |
+
char: str | None = src[pos]
|
| 380 |
+
except IndexError:
|
| 381 |
+
char = None
|
| 382 |
+
if char != ".":
|
| 383 |
+
return pos, key
|
| 384 |
+
pos += 1
|
| 385 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 386 |
+
pos, key_part = parse_key_part(src, pos)
|
| 387 |
+
key += (key_part,)
|
| 388 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
def parse_key_part(src: str, pos: Pos) -> tuple[Pos, str]:
|
| 392 |
+
try:
|
| 393 |
+
char: str | None = src[pos]
|
| 394 |
+
except IndexError:
|
| 395 |
+
char = None
|
| 396 |
+
if char in BARE_KEY_CHARS:
|
| 397 |
+
start_pos = pos
|
| 398 |
+
pos = skip_chars(src, pos, BARE_KEY_CHARS)
|
| 399 |
+
return pos, src[start_pos:pos]
|
| 400 |
+
if char == "'":
|
| 401 |
+
return parse_literal_str(src, pos)
|
| 402 |
+
if char == '"':
|
| 403 |
+
return parse_one_line_basic_str(src, pos)
|
| 404 |
+
raise suffixed_err(src, pos, "Invalid initial character for a key part")
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
def parse_one_line_basic_str(src: str, pos: Pos) -> tuple[Pos, str]:
|
| 408 |
+
pos += 1
|
| 409 |
+
return parse_basic_str(src, pos, multiline=False)
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
def parse_array(src: str, pos: Pos, parse_float: ParseFloat) -> tuple[Pos, list]:
|
| 413 |
+
pos += 1
|
| 414 |
+
array: list = []
|
| 415 |
+
|
| 416 |
+
pos = skip_comments_and_array_ws(src, pos)
|
| 417 |
+
if src.startswith("]", pos):
|
| 418 |
+
return pos + 1, array
|
| 419 |
+
while True:
|
| 420 |
+
pos, val = parse_value(src, pos, parse_float)
|
| 421 |
+
array.append(val)
|
| 422 |
+
pos = skip_comments_and_array_ws(src, pos)
|
| 423 |
+
|
| 424 |
+
c = src[pos : pos + 1]
|
| 425 |
+
if c == "]":
|
| 426 |
+
return pos + 1, array
|
| 427 |
+
if c != ",":
|
| 428 |
+
raise suffixed_err(src, pos, "Unclosed array")
|
| 429 |
+
pos += 1
|
| 430 |
+
|
| 431 |
+
pos = skip_comments_and_array_ws(src, pos)
|
| 432 |
+
if src.startswith("]", pos):
|
| 433 |
+
return pos + 1, array
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
def parse_inline_table(src: str, pos: Pos, parse_float: ParseFloat) -> tuple[Pos, dict]:
|
| 437 |
+
pos += 1
|
| 438 |
+
nested_dict = NestedDict()
|
| 439 |
+
flags = Flags()
|
| 440 |
+
|
| 441 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 442 |
+
if src.startswith("}", pos):
|
| 443 |
+
return pos + 1, nested_dict.dict
|
| 444 |
+
while True:
|
| 445 |
+
pos, key, value = parse_key_value_pair(src, pos, parse_float)
|
| 446 |
+
key_parent, key_stem = key[:-1], key[-1]
|
| 447 |
+
if flags.is_(key, Flags.FROZEN):
|
| 448 |
+
raise suffixed_err(src, pos, f"Cannot mutate immutable namespace {key}")
|
| 449 |
+
try:
|
| 450 |
+
nest = nested_dict.get_or_create_nest(key_parent, access_lists=False)
|
| 451 |
+
except KeyError:
|
| 452 |
+
raise suffixed_err(src, pos, "Cannot overwrite a value") from None
|
| 453 |
+
if key_stem in nest:
|
| 454 |
+
raise suffixed_err(src, pos, f"Duplicate inline table key {key_stem!r}")
|
| 455 |
+
nest[key_stem] = value
|
| 456 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 457 |
+
c = src[pos : pos + 1]
|
| 458 |
+
if c == "}":
|
| 459 |
+
return pos + 1, nested_dict.dict
|
| 460 |
+
if c != ",":
|
| 461 |
+
raise suffixed_err(src, pos, "Unclosed inline table")
|
| 462 |
+
if isinstance(value, (dict, list)):
|
| 463 |
+
flags.set(key, Flags.FROZEN, recursive=True)
|
| 464 |
+
pos += 1
|
| 465 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
def parse_basic_str_escape(
|
| 469 |
+
src: str, pos: Pos, *, multiline: bool = False
|
| 470 |
+
) -> tuple[Pos, str]:
|
| 471 |
+
escape_id = src[pos : pos + 2]
|
| 472 |
+
pos += 2
|
| 473 |
+
if multiline and escape_id in {"\\ ", "\\\t", "\\\n"}:
|
| 474 |
+
# Skip whitespace until next non-whitespace character or end of
|
| 475 |
+
# the doc. Error if non-whitespace is found before newline.
|
| 476 |
+
if escape_id != "\\\n":
|
| 477 |
+
pos = skip_chars(src, pos, TOML_WS)
|
| 478 |
+
try:
|
| 479 |
+
char = src[pos]
|
| 480 |
+
except IndexError:
|
| 481 |
+
return pos, ""
|
| 482 |
+
if char != "\n":
|
| 483 |
+
raise suffixed_err(src, pos, "Unescaped '\\' in a string")
|
| 484 |
+
pos += 1
|
| 485 |
+
pos = skip_chars(src, pos, TOML_WS_AND_NEWLINE)
|
| 486 |
+
return pos, ""
|
| 487 |
+
if escape_id == "\\u":
|
| 488 |
+
return parse_hex_char(src, pos, 4)
|
| 489 |
+
if escape_id == "\\U":
|
| 490 |
+
return parse_hex_char(src, pos, 8)
|
| 491 |
+
try:
|
| 492 |
+
return pos, BASIC_STR_ESCAPE_REPLACEMENTS[escape_id]
|
| 493 |
+
except KeyError:
|
| 494 |
+
raise suffixed_err(src, pos, "Unescaped '\\' in a string") from None
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
def parse_basic_str_escape_multiline(src: str, pos: Pos) -> tuple[Pos, str]:
|
| 498 |
+
return parse_basic_str_escape(src, pos, multiline=True)
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
def parse_hex_char(src: str, pos: Pos, hex_len: int) -> tuple[Pos, str]:
|
| 502 |
+
hex_str = src[pos : pos + hex_len]
|
| 503 |
+
if len(hex_str) != hex_len or not HEXDIGIT_CHARS.issuperset(hex_str):
|
| 504 |
+
raise suffixed_err(src, pos, "Invalid hex value")
|
| 505 |
+
pos += hex_len
|
| 506 |
+
hex_int = int(hex_str, 16)
|
| 507 |
+
if not is_unicode_scalar_value(hex_int):
|
| 508 |
+
raise suffixed_err(src, pos, "Escaped character is not a Unicode scalar value")
|
| 509 |
+
return pos, chr(hex_int)
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
def parse_literal_str(src: str, pos: Pos) -> tuple[Pos, str]:
|
| 513 |
+
pos += 1 # Skip starting apostrophe
|
| 514 |
+
start_pos = pos
|
| 515 |
+
pos = skip_until(
|
| 516 |
+
src, pos, "'", error_on=ILLEGAL_LITERAL_STR_CHARS, error_on_eof=True
|
| 517 |
+
)
|
| 518 |
+
return pos + 1, src[start_pos:pos] # Skip ending apostrophe
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
def parse_multiline_str(src: str, pos: Pos, *, literal: bool) -> tuple[Pos, str]:
|
| 522 |
+
pos += 3
|
| 523 |
+
if src.startswith("\n", pos):
|
| 524 |
+
pos += 1
|
| 525 |
+
|
| 526 |
+
if literal:
|
| 527 |
+
delim = "'"
|
| 528 |
+
end_pos = skip_until(
|
| 529 |
+
src,
|
| 530 |
+
pos,
|
| 531 |
+
"'''",
|
| 532 |
+
error_on=ILLEGAL_MULTILINE_LITERAL_STR_CHARS,
|
| 533 |
+
error_on_eof=True,
|
| 534 |
+
)
|
| 535 |
+
result = src[pos:end_pos]
|
| 536 |
+
pos = end_pos + 3
|
| 537 |
+
else:
|
| 538 |
+
delim = '"'
|
| 539 |
+
pos, result = parse_basic_str(src, pos, multiline=True)
|
| 540 |
+
|
| 541 |
+
# Add at maximum two extra apostrophes/quotes if the end sequence
|
| 542 |
+
# is 4 or 5 chars long instead of just 3.
|
| 543 |
+
if not src.startswith(delim, pos):
|
| 544 |
+
return pos, result
|
| 545 |
+
pos += 1
|
| 546 |
+
if not src.startswith(delim, pos):
|
| 547 |
+
return pos, result + delim
|
| 548 |
+
pos += 1
|
| 549 |
+
return pos, result + (delim * 2)
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
def parse_basic_str(src: str, pos: Pos, *, multiline: bool) -> tuple[Pos, str]:
|
| 553 |
+
if multiline:
|
| 554 |
+
error_on = ILLEGAL_MULTILINE_BASIC_STR_CHARS
|
| 555 |
+
parse_escapes = parse_basic_str_escape_multiline
|
| 556 |
+
else:
|
| 557 |
+
error_on = ILLEGAL_BASIC_STR_CHARS
|
| 558 |
+
parse_escapes = parse_basic_str_escape
|
| 559 |
+
result = ""
|
| 560 |
+
start_pos = pos
|
| 561 |
+
while True:
|
| 562 |
+
try:
|
| 563 |
+
char = src[pos]
|
| 564 |
+
except IndexError:
|
| 565 |
+
raise suffixed_err(src, pos, "Unterminated string") from None
|
| 566 |
+
if char == '"':
|
| 567 |
+
if not multiline:
|
| 568 |
+
return pos + 1, result + src[start_pos:pos]
|
| 569 |
+
if src.startswith('"""', pos):
|
| 570 |
+
return pos + 3, result + src[start_pos:pos]
|
| 571 |
+
pos += 1
|
| 572 |
+
continue
|
| 573 |
+
if char == "\\":
|
| 574 |
+
result += src[start_pos:pos]
|
| 575 |
+
pos, parsed_escape = parse_escapes(src, pos)
|
| 576 |
+
result += parsed_escape
|
| 577 |
+
start_pos = pos
|
| 578 |
+
continue
|
| 579 |
+
if char in error_on:
|
| 580 |
+
raise suffixed_err(src, pos, f"Illegal character {char!r}")
|
| 581 |
+
pos += 1
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
def parse_value( # noqa: C901
|
| 585 |
+
src: str, pos: Pos, parse_float: ParseFloat
|
| 586 |
+
) -> tuple[Pos, Any]:
|
| 587 |
+
try:
|
| 588 |
+
char: str | None = src[pos]
|
| 589 |
+
except IndexError:
|
| 590 |
+
char = None
|
| 591 |
+
|
| 592 |
+
# IMPORTANT: order conditions based on speed of checking and likelihood
|
| 593 |
+
|
| 594 |
+
# Basic strings
|
| 595 |
+
if char == '"':
|
| 596 |
+
if src.startswith('"""', pos):
|
| 597 |
+
return parse_multiline_str(src, pos, literal=False)
|
| 598 |
+
return parse_one_line_basic_str(src, pos)
|
| 599 |
+
|
| 600 |
+
# Literal strings
|
| 601 |
+
if char == "'":
|
| 602 |
+
if src.startswith("'''", pos):
|
| 603 |
+
return parse_multiline_str(src, pos, literal=True)
|
| 604 |
+
return parse_literal_str(src, pos)
|
| 605 |
+
|
| 606 |
+
# Booleans
|
| 607 |
+
if char == "t":
|
| 608 |
+
if src.startswith("true", pos):
|
| 609 |
+
return pos + 4, True
|
| 610 |
+
if char == "f":
|
| 611 |
+
if src.startswith("false", pos):
|
| 612 |
+
return pos + 5, False
|
| 613 |
+
|
| 614 |
+
# Arrays
|
| 615 |
+
if char == "[":
|
| 616 |
+
return parse_array(src, pos, parse_float)
|
| 617 |
+
|
| 618 |
+
# Inline tables
|
| 619 |
+
if char == "{":
|
| 620 |
+
return parse_inline_table(src, pos, parse_float)
|
| 621 |
+
|
| 622 |
+
# Dates and times
|
| 623 |
+
datetime_match = RE_DATETIME.match(src, pos)
|
| 624 |
+
if datetime_match:
|
| 625 |
+
try:
|
| 626 |
+
datetime_obj = match_to_datetime(datetime_match)
|
| 627 |
+
except ValueError as e:
|
| 628 |
+
raise suffixed_err(src, pos, "Invalid date or datetime") from e
|
| 629 |
+
return datetime_match.end(), datetime_obj
|
| 630 |
+
localtime_match = RE_LOCALTIME.match(src, pos)
|
| 631 |
+
if localtime_match:
|
| 632 |
+
return localtime_match.end(), match_to_localtime(localtime_match)
|
| 633 |
+
|
| 634 |
+
# Integers and "normal" floats.
|
| 635 |
+
# The regex will greedily match any type starting with a decimal
|
| 636 |
+
# char, so needs to be located after handling of dates and times.
|
| 637 |
+
number_match = RE_NUMBER.match(src, pos)
|
| 638 |
+
if number_match:
|
| 639 |
+
return number_match.end(), match_to_number(number_match, parse_float)
|
| 640 |
+
|
| 641 |
+
# Special floats
|
| 642 |
+
first_three = src[pos : pos + 3]
|
| 643 |
+
if first_three in {"inf", "nan"}:
|
| 644 |
+
return pos + 3, parse_float(first_three)
|
| 645 |
+
first_four = src[pos : pos + 4]
|
| 646 |
+
if first_four in {"-inf", "+inf", "-nan", "+nan"}:
|
| 647 |
+
return pos + 4, parse_float(first_four)
|
| 648 |
+
|
| 649 |
+
raise suffixed_err(src, pos, "Invalid value")
|
| 650 |
+
|
| 651 |
+
|
| 652 |
+
def suffixed_err(src: str, pos: Pos, msg: str) -> TOMLDecodeError:
|
| 653 |
+
"""Return a `TOMLDecodeError` where error message is suffixed with
|
| 654 |
+
coordinates in source."""
|
| 655 |
+
|
| 656 |
+
def coord_repr(src: str, pos: Pos) -> str:
|
| 657 |
+
if pos >= len(src):
|
| 658 |
+
return "end of document"
|
| 659 |
+
line = src.count("\n", 0, pos) + 1
|
| 660 |
+
if line == 1:
|
| 661 |
+
column = pos + 1
|
| 662 |
+
else:
|
| 663 |
+
column = pos - src.rindex("\n", 0, pos)
|
| 664 |
+
return f"line {line}, column {column}"
|
| 665 |
+
|
| 666 |
+
return TOMLDecodeError(f"{msg} (at {coord_repr(src, pos)})")
|
| 667 |
+
|
| 668 |
+
|
| 669 |
+
def is_unicode_scalar_value(codepoint: int) -> bool:
|
| 670 |
+
return (0 <= codepoint <= 55295) or (57344 <= codepoint <= 1114111)
|
| 671 |
+
|
| 672 |
+
|
| 673 |
+
def make_safe_parse_float(parse_float: ParseFloat) -> ParseFloat:
|
| 674 |
+
"""A decorator to make `parse_float` safe.
|
| 675 |
+
|
| 676 |
+
`parse_float` must not return dicts or lists, because these types
|
| 677 |
+
would be mixed with parsed TOML tables and arrays, thus confusing
|
| 678 |
+
the parser. The returned decorated callable raises `ValueError`
|
| 679 |
+
instead of returning illegal types.
|
| 680 |
+
"""
|
| 681 |
+
# The default `float` callable never returns illegal types. Optimize it.
|
| 682 |
+
if parse_float is float: # type: ignore[comparison-overlap]
|
| 683 |
+
return float
|
| 684 |
+
|
| 685 |
+
def safe_parse_float(float_str: str) -> Any:
|
| 686 |
+
float_value = parse_float(float_str)
|
| 687 |
+
if isinstance(float_value, (dict, list)):
|
| 688 |
+
raise ValueError("parse_float must not return dicts or lists")
|
| 689 |
+
return float_value
|
| 690 |
+
|
| 691 |
+
return safe_parse_float
|
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/_re.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
|
| 3 |
+
# Licensed to PSF under a Contributor Agreement.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from datetime import date, datetime, time, timedelta, timezone, tzinfo
|
| 8 |
+
from functools import lru_cache
|
| 9 |
+
import re
|
| 10 |
+
from typing import Any
|
| 11 |
+
|
| 12 |
+
from ._types import ParseFloat
|
| 13 |
+
|
| 14 |
+
# E.g.
|
| 15 |
+
# - 00:32:00.999999
|
| 16 |
+
# - 00:32:00
|
| 17 |
+
_TIME_RE_STR = r"([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.([0-9]{1,6})[0-9]*)?"
|
| 18 |
+
|
| 19 |
+
RE_NUMBER = re.compile(
|
| 20 |
+
r"""
|
| 21 |
+
0
|
| 22 |
+
(?:
|
| 23 |
+
x[0-9A-Fa-f](?:_?[0-9A-Fa-f])* # hex
|
| 24 |
+
|
|
| 25 |
+
b[01](?:_?[01])* # bin
|
| 26 |
+
|
|
| 27 |
+
o[0-7](?:_?[0-7])* # oct
|
| 28 |
+
)
|
| 29 |
+
|
|
| 30 |
+
[+-]?(?:0|[1-9](?:_?[0-9])*) # dec, integer part
|
| 31 |
+
(?P<floatpart>
|
| 32 |
+
(?:\.[0-9](?:_?[0-9])*)? # optional fractional part
|
| 33 |
+
(?:[eE][+-]?[0-9](?:_?[0-9])*)? # optional exponent part
|
| 34 |
+
)
|
| 35 |
+
""",
|
| 36 |
+
flags=re.VERBOSE,
|
| 37 |
+
)
|
| 38 |
+
RE_LOCALTIME = re.compile(_TIME_RE_STR)
|
| 39 |
+
RE_DATETIME = re.compile(
|
| 40 |
+
rf"""
|
| 41 |
+
([0-9]{{4}})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) # date, e.g. 1988-10-27
|
| 42 |
+
(?:
|
| 43 |
+
[Tt ]
|
| 44 |
+
{_TIME_RE_STR}
|
| 45 |
+
(?:([Zz])|([+-])([01][0-9]|2[0-3]):([0-5][0-9]))? # optional time offset
|
| 46 |
+
)?
|
| 47 |
+
""",
|
| 48 |
+
flags=re.VERBOSE,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def match_to_datetime(match: re.Match) -> datetime | date:
|
| 53 |
+
"""Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.
|
| 54 |
+
|
| 55 |
+
Raises ValueError if the match does not correspond to a valid date
|
| 56 |
+
or datetime.
|
| 57 |
+
"""
|
| 58 |
+
(
|
| 59 |
+
year_str,
|
| 60 |
+
month_str,
|
| 61 |
+
day_str,
|
| 62 |
+
hour_str,
|
| 63 |
+
minute_str,
|
| 64 |
+
sec_str,
|
| 65 |
+
micros_str,
|
| 66 |
+
zulu_time,
|
| 67 |
+
offset_sign_str,
|
| 68 |
+
offset_hour_str,
|
| 69 |
+
offset_minute_str,
|
| 70 |
+
) = match.groups()
|
| 71 |
+
year, month, day = int(year_str), int(month_str), int(day_str)
|
| 72 |
+
if hour_str is None:
|
| 73 |
+
return date(year, month, day)
|
| 74 |
+
hour, minute, sec = int(hour_str), int(minute_str), int(sec_str)
|
| 75 |
+
micros = int(micros_str.ljust(6, "0")) if micros_str else 0
|
| 76 |
+
if offset_sign_str:
|
| 77 |
+
tz: tzinfo | None = cached_tz(
|
| 78 |
+
offset_hour_str, offset_minute_str, offset_sign_str
|
| 79 |
+
)
|
| 80 |
+
elif zulu_time:
|
| 81 |
+
tz = timezone.utc
|
| 82 |
+
else: # local date-time
|
| 83 |
+
tz = None
|
| 84 |
+
return datetime(year, month, day, hour, minute, sec, micros, tzinfo=tz)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
@lru_cache(maxsize=None)
|
| 88 |
+
def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
|
| 89 |
+
sign = 1 if sign_str == "+" else -1
|
| 90 |
+
return timezone(
|
| 91 |
+
timedelta(
|
| 92 |
+
hours=sign * int(hour_str),
|
| 93 |
+
minutes=sign * int(minute_str),
|
| 94 |
+
)
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def match_to_localtime(match: re.Match) -> time:
|
| 99 |
+
hour_str, minute_str, sec_str, micros_str = match.groups()
|
| 100 |
+
micros = int(micros_str.ljust(6, "0")) if micros_str else 0
|
| 101 |
+
return time(int(hour_str), int(minute_str), int(sec_str), micros)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def match_to_number(match: re.Match, parse_float: ParseFloat) -> Any:
|
| 105 |
+
if match.group("floatpart"):
|
| 106 |
+
return parse_float(match.group())
|
| 107 |
+
return int(match.group(), 0)
|