Upload folder using huggingface_hub (part 13)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+13
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/INSTALLERAdded+1
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/METADATAAdded+141
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/RECORDAdded+516
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/REQUESTEDAdded
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/WHEELAdded+5
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/entry_points.txtAdded+51
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/licenses/LICENSEAdded+17
- .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/top_level.txtAdded+3
- .venv/lib/python3.12/site-packages/setuptools/tests/test_find_packages.pyAdded+218
- .venv/lib/python3.12/site-packages/setuptools/tests/test_find_py_modules.pyAdded+73
- .venv/lib/python3.12/site-packages/setuptools/tests/test_glob.pyAdded+45
- .venv/lib/python3.12/site-packages/setuptools/tests/test_install_scripts.pyAdded+89
- .venv/lib/python3.12/site-packages/setuptools/tests/test_logging.pyAdded+76
- .venv/lib/python3.12/site-packages/setuptools/tests/test_manifest.pyAdded+622
- .venv/lib/python3.12/site-packages/setuptools/tests/test_namespaces.pyAdded+138
- .venv/lib/python3.12/site-packages/setuptools/tests/test_packageindex.pyAdded+267
- .venv/lib/python3.12/site-packages/setuptools/tests/test_sandbox.pyAdded+134
- .venv/lib/python3.12/site-packages/setuptools/tests/test_sdist.pyAdded+984
- .venv/lib/python3.12/site-packages/setuptools/tests/test_setopt.pyAdded+40
- .venv/lib/python3.12/site-packages/setuptools/tests/test_setuptools.pyAdded+290
- .venv/lib/python3.12/site-packages/setuptools/tests/test_shutil_wrapper.pyAdded+23
- .venv/lib/python3.12/site-packages/setuptools/tests/test_unicode_utils.pyAdded+10
- .venv/lib/python3.12/site-packages/setuptools/tests/test_virtualenv.pyAdded+113
- .venv/lib/python3.12/site-packages/setuptools/tests/test_warnings.pyAdded+106
- .venv/lib/python3.12/site-packages/setuptools/tests/test_wheel.pyAdded+714
- .venv/lib/python3.12/site-packages/setuptools/tests/test_windows_wrappers.pyAdded+259
- .venv/lib/python3.12/site-packages/setuptools/tests/text.pyAdded+4
- .venv/lib/python3.12/site-packages/setuptools/tests/textwrap.pyAdded+6
- .venv/lib/python3.12/site-packages/setuptools/unicode_utils.pyAdded+102
- .venv/lib/python3.12/site-packages/setuptools/version.pyAdded+6
- .venv/lib/python3.12/site-packages/setuptools/warnings.pyAdded+110
- .venv/lib/python3.12/site-packages/setuptools/wheel.pyAdded+236
- .venv/lib/python3.12/site-packages/setuptools/windows_support.pyAdded+30
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/INSTALLERAdded+1
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/LICENSEAdded+18
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/METADATAAdded+43
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/RECORDAdded+8
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/REQUESTEDAdded
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/WHEELAdded+6
- .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/top_level.txtAdded+1
- .venv/lib/python3.12/site-packages/six.pyAdded+1003
- .venv/lib/python3.12/site-packages/sympy/__init__.pyAdded+545
- .venv/lib/python3.12/site-packages/sympy/__pycache__/__init__.cpython-312.pycAdded
- .venv/lib/python3.12/site-packages/sympy/__pycache__/release.cpython-312.pycAdded
- .venv/lib/python3.12/site-packages/sympy/abc.pyAdded+111
- .venv/lib/python3.12/site-packages/sympy/algebras/__init__.pyAdded+3
- .venv/lib/python3.12/site-packages/sympy/algebras/__pycache__/__init__.cpython-312.pycAdded
- .venv/lib/python3.12/site-packages/sympy/algebras/__pycache__/quaternion.cpython-312.pycAdded
- .venv/lib/python3.12/site-packages/sympy/algebras/quaternion.pyAdded+1666
162 unmodified lines163164165162 unmodified lines.venv/lib/python3.12/site-packages/pyarrow/libarrow_python_flight.so.2500.1.0 filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/pyarrow/libarrow_substrait.so.2500 filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/pyarrow/libparquet.so.2500 filter=lfs diff=lfs merge=lfs -text162 unmodified lines163164165166167168169170171172173174175176177178162 unmodified lines.venv/lib/python3.12/site-packages/pyarrow/libarrow_python_flight.so.2500.1.0 filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/pyarrow/libarrow_substrait.so.2500 filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/pyarrow/libparquet.so.2500 filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/core/__pycache__/expr.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/core/__pycache__/function.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/core/__pycache__/numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/functions/combinatorial/__pycache__/numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/functions/elementary/__pycache__/hyperbolic.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/functions/elementary/__pycache__/trigonometric.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/functions/special/__pycache__/bessel.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/functions/special/__pycache__/error_functions.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/geometry/__pycache__/polygon.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/integrals/__pycache__/laplace.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/integrals/__pycache__/meijerint.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/logic/__pycache__/boolalg.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text.venv/lib/python3.12/site-packages/sympy/matrices/__pycache__/matrixbase.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
1uv123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141Metadata-Version: 2.4Name: setuptoolsVersion: 78.1.0Summary: Easily download, build, install, upgrade, and uninstall Python packagesAuthor-email: Python Packaging Authority <distutils-sig@python.org>Project-URL: Source, https://github.com/pypa/setuptoolsProject-URL: Documentation, https://setuptools.pypa.io/Project-URL: Changelog, https://setuptools.pypa.io/en/stable/history.htmlKeywords: CPAN PyPI distutils eggs package managementClassifier: Development Status :: 5 - Production/StableClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3 :: OnlyClassifier: Topic :: Software Development :: Libraries :: Python ModulesClassifier: Topic :: System :: Archiving :: PackagingClassifier: Topic :: System :: Systems AdministrationClassifier: Topic :: UtilitiesRequires-Python: >=3.9Description-Content-Type: text/x-rstLicense-File: LICENSEProvides-Extra: testRequires-Dist: pytest!=8.1.*,>=6; extra == "test"Requires-Dist: virtualenv>=13.0.0; extra == "test"Requires-Dist: wheel>=0.44.0; extra == "test"Requires-Dist: pip>=19.1; extra == "test"Requires-Dist: packaging>=24.2; extra == "test"Requires-Dist: jaraco.envs>=2.2; extra == "test"Requires-Dist: pytest-xdist>=3; extra == "test"Requires-Dist: jaraco.path>=3.7.2; extra == "test"Requires-Dist: build[virtualenv]>=1.0.3; extra == "test"Requires-Dist: filelock>=3.4.0; extra == "test"Requires-Dist: ini2toml[lite]>=0.14; extra == "test"Requires-Dist: tomli-w>=1.0.0; extra == "test"Requires-Dist: pytest-timeout; extra == "test"Requires-Dist: pytest-perf; sys_platform != "cygwin" and extra == "test"Requires-Dist: jaraco.develop>=7.21; (python_version >= "3.9" and sys_platform != "cygwin") and extra == "test"Requires-Dist: pytest-home>=0.5; extra == "test"Requires-Dist: pytest-subprocess; extra == "test"Requires-Dist: pyproject-hooks!=1.1; extra == "test"Requires-Dist: jaraco.test>=5.5; extra == "test"Provides-Extra: docRequires-Dist: sphinx>=3.5; extra == "doc"Requires-Dist: jaraco.packaging>=9.3; extra == "doc"Requires-Dist: rst.linker>=1.9; extra == "doc"Requires-Dist: furo; extra == "doc"Requires-Dist: sphinx-lint; extra == "doc"Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"Requires-Dist: pygments-github-lexers==0.0.5; extra == "doc"Requires-Dist: sphinx-favicon; extra == "doc"Requires-Dist: sphinx-inline-tabs; extra == "doc"Requires-Dist: sphinx-reredirects; extra == "doc"Requires-Dist: sphinxcontrib-towncrier; extra == "doc"Requires-Dist: sphinx-notfound-page<2,>=1; extra == "doc"Requires-Dist: pyproject-hooks!=1.1; extra == "doc"Requires-Dist: towncrier<24.7; extra == "doc"Provides-Extra: sslProvides-Extra: certsProvides-Extra: coreRequires-Dist: packaging>=24.2; extra == "core"Requires-Dist: more_itertools>=8.8; extra == "core"Requires-Dist: jaraco.text>=3.7; extra == "core"Requires-Dist: importlib_metadata>=6; python_version < "3.10" and extra == "core"Requires-Dist: tomli>=2.0.1; python_version < "3.11" and extra == "core"Requires-Dist: wheel>=0.43.0; extra == "core"Requires-Dist: platformdirs>=4.2.2; extra == "core"Requires-Dist: jaraco.functools>=4; extra == "core"Requires-Dist: more_itertools; extra == "core"Provides-Extra: checkRequires-Dist: pytest-checkdocs>=2.4; extra == "check"Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"Requires-Dist: ruff>=0.8.0; sys_platform != "cygwin" and extra == "check"Provides-Extra: coverRequires-Dist: pytest-cov; extra == "cover"Provides-Extra: enablerRequires-Dist: pytest-enabler>=2.2; extra == "enabler"Provides-Extra: typeRequires-Dist: pytest-mypy; extra == "type"Requires-Dist: mypy==1.14.*; extra == "type"Requires-Dist: importlib_metadata>=7.0.2; python_version < "3.10" and extra == "type"Requires-Dist: jaraco.develop>=7.21; sys_platform != "cygwin" and extra == "type"Dynamic: license-file
.. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg :target: https://pypi.org/project/setuptools
.. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg
.. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22 :alt: tests
.. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json :target: https://github.com/astral-sh/ruff :alt: Ruff
.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg :target: https://setuptools.pypa.io
.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational :target: https://blog.jaraco.com/skeleton
.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white :target: https://codecov.io/gh/pypa/setuptools
.. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme
.. |discord-badge| image:: https://img.shields.io/discord/803025117553754132 :target: https://discord.com/channels/803025117553754132/815945031150993468 :alt: Discord
|pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge|
See the `Quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>`_and the `User's Guide <https://setuptools.pypa.io/en/latest/userguide/>`_ forinstructions on how to use Setuptools.
Questions and comments should be directed to `GitHub Discussions<https://github.com/pypa/setuptools/discussions>`_.Bug reports and especially tested patches may besubmitted directly to the `bug tracker<https://github.com/pypa/setuptools/issues>`_.
Code of Conduct===============
Everyone interacting in the setuptools project's codebases, issue trackers,chat rooms, and fora is expected to follow the`PSF Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>`_.
For Enterprise==============
Available as part of the Tidelift Subscription.
Setuptools 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.
`Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516_distutils_hack/__init__.py,sha256=34HmvLo07j45Uvd2VR-2aRQ7lJD91sTK6zJgn5fphbQ,6755_distutils_hack/override.py,sha256=Eu_s-NF6VIZ4Cqd0tbbA5wtWky2IZPNd8et6GLt1mzo,44distutils-precedence.pth,sha256=JjjOniUA5XKl4N5_rtZmHrVp0baW_LoHsN0iPaX10iQ,151pkg_resources/__init__.py,sha256=-rh7XOnTxdGuC-_9FAyu5D6s8BL1UsBehxUtj7a-IVo,126203pkg_resources/api_tests.txt,sha256=XEdvy4igHHrq2qNHNMHnlfO6XSQKNqOyLHbl6QcpfAI,12595pkg_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0pkg_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0pkg_resources/tests/data/my-test-package-source/setup.cfg,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0pkg_resources/tests/data/my-test-package-source/setup.py,sha256=1VobhAZbMb7M9mfhb_NE8PwDsvukoWLs9aUAS0pYhe8,105pkg_resources/tests/data/my-test-package-zip/my-test-package.zip,sha256=AYRcQ39GVePPnMT8TknP1gdDHyJnXhthESmpAjnzSCI,1809pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/PKG-INFO,sha256=JvWv9Io2PAuYwEEw2fBW4Qc5YvdbkscpKX1kmLzsoHk,187pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/SOURCES.txt,sha256=4ClkH8eTovZrdVrJFsVuxdbMEF--lBVSuKonDAPE5Jc,208pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/dependency_links.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1pkg_resources/tests/data/my-test-package_zipped-egg/my_test_package-1.0-py3.7.egg,sha256=ZTlMGxjRGiKDNkiA2c75jbQH2TWIteP00irF9gvczbo,843pkg_resources/tests/test_find_distributions.py,sha256=U91cov5L1COAIWLNq3Xy4plU7_MnOE1WtXMu6iV2waM,1972pkg_resources/tests/test_integration_zope_interface.py,sha256=nzVoK557KZQN0V3DIQ1sVeaCOgt4Kpl-CODAWsO7pmc,1652pkg_resources/tests/test_markers.py,sha256=0orKg7UMDf7fnuNQvRMOc-EF9EAP_JTQnk4mtGgbW50,241pkg_resources/tests/test_pkg_resources.py,sha256=5Mt4bJQhLCL8j8cC46Uv32Np2Xc1TTxLGawIfET55Fk,17111pkg_resources/tests/test_resources.py,sha256=K0LqMAUGpRQ9pUb9K0vyI7GesvtlQvTH074m-E2VQlo,31252pkg_resources/tests/test_working_set.py,sha256=lRtGJWIixSwSMSbjHgRxeJEQiLMRXcz3xzJL2qL7eXY,8602setuptools-78.1.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2setuptools-78.1.0.dist-info/METADATA,sha256=RESmtUmo67AuFzn0N1r3dWyEH5bwwxB3oYMnPHRivRA,6599setuptools-78.1.0.dist-info/RECORD,,setuptools-78.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools-78.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91setuptools-78.1.0.dist-info/entry_points.txt,sha256=zkgthpf_Fa9NVE9p6FKT3Xk9DR1faAcRU4coggsV7jA,2449setuptools-78.1.0.dist-info/licenses/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools-78.1.0.dist-info/top_level.txt,sha256=d9yL39v_W7qmKDDSH6sT4bE0j_Ls1M3P161OGgdsm4g,41setuptools/__init__.py,sha256=AQsMeRFWz9CQ9aBtcSkbB4Dn8t2w86-GPriklpoAjew,10406setuptools/_core_metadata.py,sha256=T7Tjp-WSoN881adev3R1wzXCPnkDHqbC2MgylN1yjS8,11978setuptools/_distutils/__init__.py,sha256=xGYuhWwLG07J0Q49BVnEjPy6wyDcd6veJMDJX7ljlyM,359setuptools/_distutils/_log.py,sha256=i-lNTTcXS8TmWITJ6DODGvtW5z5tMattJQ76h8rZxQU,42setuptools/_distutils/_macos_compat.py,sha256=JzUGhF4E5yIITHbUaPobZEWjGHdrrcNV63z86S4RjBc,239setuptools/_distutils/_modified.py,sha256=RF1n1CexyDYV3lvGbeXS0s-XCJVboDOIUbA8wEQqYTY,3211setuptools/_distutils/_msvccompiler.py,sha256=9PSfSHxvJnHnQL6Sqz4Xcz7iaBIT62p6BheQzGsSlwo,335setuptools/_distutils/archive_util.py,sha256=Qw2z-Pt-NV8lNUQrzjs3XDGWCWHMPnqHLyt8TiD2XEA,8884setuptools/_distutils/ccompiler.py,sha256=FKVjqzGJ7c-FtouNjhLiaMPm5LKMZHHAruXf8LU216c,524setuptools/_distutils/cmd.py,sha256=hXtaRaH7QBnfNOIqEvCt47iwZzD9MVvBdhhdQctHsxM,22186setuptools/_distutils/command/__init__.py,sha256=GfFAzbBqk1qxSH4BdaKioKS4hRRnD44BAmwEN85C4u8,386setuptools/_distutils/command/_framework_compat.py,sha256=0iZdSJYzGRWCCvzRDKE-R0-_yaAYvFMd1ylXb2eYXug,1609setuptools/_distutils/command/bdist.py,sha256=jWtk61R7fWNUUNxJV0thTZzU5n80L3Ay1waSiP9kiLA,5854setuptools/_distutils/command/bdist_dumb.py,sha256=Hx1jAqoZNxYIy4N5TLzUp6J5fi8Ls18py7UlLNFhO2E,4631setuptools/_distutils/command/bdist_rpm.py,sha256=nxcXXv5a7B-1ntWu4DbGmCtES4EBINrJaBQcRNAYCJI,21785setuptools/_distutils/command/build.py,sha256=SpHlagf0iNaKVyIhxDfhPFZ8X1-LAWOCQACy-yt2K0w,5923setuptools/_distutils/command/build_clib.py,sha256=aMqZcUfCbOAu_xr-A9iW-Q9YZHzpDGLRTezOgMQJmSQ,7777setuptools/_distutils/command/build_ext.py,sha256=zrrsu9HXnzV6bXYbJuZCK4SwVZMjKnl4pG1o3bNcxtc,32710setuptools/_distutils/command/build_py.py,sha256=Vfq-INemoMbg6f003BTy_Ufp8bjOZhmFIhpKMcfXLgs,16696setuptools/_distutils/command/build_scripts.py,sha256=tUpEzwTsnrP8qrNory3ldPB240QDCFkMp-pdYPs2wTk,5118setuptools/_distutils/command/check.py,sha256=yoNe2MPY4JcTM7rwoIQdfZ75q5Ri058I2coi-Gq9CjM,4946setuptools/_distutils/command/clean.py,sha256=dQAacOabwBXU9JoZ-1GFusq3eFltDaeXJFSYncqGbvE,2644setuptools/_distutils/command/config.py,sha256=BuUdPu91Vo9w44xzD1RQfiyXfSfVcNpeX3aeoKcGAOw,12818setuptools/_distutils/command/install.py,sha256=-JenB-mua4hc2RI_-W8F9PnP_J-OaFO7E0PJGKxLo1o,30072setuptools/_distutils/command/install_data.py,sha256=GzBlUWWKubTYJlP-L0auUriq9cL-5RKOcoyHTttKj0Q,2875setuptools/_distutils/command/install_egg_info.py,sha256=ffiLoU1ivQJ8q2_WL7ZygZbUcOsgdFLKL7otEIJWWkI,2868setuptools/_distutils/command/install_headers.py,sha256=5ciKCj8c3XKsYNKdkdMvnypaUCKcoWCDeeZij3fD-Z4,1272setuptools/_distutils/command/install_lib.py,sha256=2s9-m5-b1qKm51F28lB5L39Z6vv_GHMlv9dNBSupok0,8588setuptools/_distutils/command/install_scripts.py,sha256=M0pPdiaqB7TGmqTMujpGGeiL0Iq_CTeGjMFtrmDmwzM,2002setuptools/_distutils/command/sdist.py,sha256=cRIF6Ht1hJ6ayOOFVycMFBUNxjo94e_rFYPx4Hi8Ahc,19151setuptools/_distutils/compat/__init__.py,sha256=J20aXGjJ86Rg41xFLIWlcWCgZ9edMdJ9vvdNEQ87vPQ,522setuptools/_distutils/compat/numpy.py,sha256=UFgneZw9w97g4c-yGoAIOyLxUOWQ-fPRIhhfMs7_Ouc,167setuptools/_distutils/compat/py39.py,sha256=hOsD6lwZLqZoMnacNJ3P6nUA-LJQhEpVtYTzVH0o96M,1964setuptools/_distutils/compilers/C/base.py,sha256=XR1rBCStCquqm7QOYXD41-LfvsFcPpGxrwxeXzJyn_w,54876setuptools/_distutils/compilers/C/cygwin.py,sha256=DUlwQSb55aj7OdcmcddrmCmVEjEaxIiJ5hHUO3GBPNs,11844setuptools/_distutils/compilers/C/errors.py,sha256=sKOVzJajMUmNdfywo9UM_QQGsKFcclDhtI5TlCiXMLc,573setuptools/_distutils/compilers/C/msvc.py,sha256=elzG8v9jN5QytLMwLCdUdSuZ3eZ3R98VUvnm9Y2PBCA,21404setuptools/_distutils/compilers/C/tests/test_base.py,sha256=rdhHc56bhXtm5NnN9BSHwr6c69UqzMItZQzlw2AsdMc,2706setuptools/_distutils/compilers/C/tests/test_cygwin.py,sha256=UgV2VgUXj3VulcbDc0UBWfEyJDx42tgSwS4LzHix3mY,2701setuptools/_distutils/compilers/C/tests/test_mingw.py,sha256=hCmwyywISpRoyOySbFHBL4TprWRV0mUWDKmOLO8XBXE,1900setuptools/_distutils/compilers/C/tests/test_msvc.py,sha256=DlGjmZ1mBSMXIgmlu80BKc7V-EJOZuYucwJwFh5dn28,4151setuptools/_distutils/compilers/C/tests/test_unix.py,sha256=ErbYWio7ejY2ZqQmPk4AwOu1HFW4-_-aZdUvGa1W2Fw,11834setuptools/_distutils/compilers/C/unix.py,sha256=l7CxY4rDJAECJo-vcv6io0SBmmPJ9JmN5mSmZcin2VU,16502setuptools/_distutils/compilers/C/zos.py,sha256=vnNeWLRZkdIkdZ-YyBnL8idTUfcCOn0tLMW5OBJ0ScU,6586setuptools/_distutils/core.py,sha256=GEHKaFC48T3o-_SmH4864GvKyx1IgbVC6ISIPVlx7a4,9364setuptools/_distutils/cygwinccompiler.py,sha256=mG_cU8SVZ4amD_VtF5vH6BXP0-kghGsDPbDSXrQ963c,594setuptools/_distutils/debug.py,sha256=N6MrTAqK6l9SVk6tWweR108PM8Ol7qNlfyV-nHcLhsY,139setuptools/_distutils/dep_util.py,sha256=xN75p6ZpHhMiHEc-rpL2XilJQynHnDNiafHteaZ4tjU,349setuptools/_distutils/dir_util.py,sha256=DXPUlfVVGsg9B-Jgg4At_j9T7vM60OgwNXkQHqTo7-I,7236setuptools/_distutils/dist.py,sha256=gW598UE0WMkzXQQ31Nr-8L7MPw0oIOz5OSSRzYZlwrM,55794setuptools/_distutils/errors.py,sha256=PPE2oDRh5y9Q1beKK9rhdvDaCzQhi4HCXs4KcqfqgZY,3092setuptools/_distutils/extension.py,sha256=Foyu4gULcPqm1_U9zrYYHxNk4NqglXv1rbsOk_QrSds,11155setuptools/_distutils/fancy_getopt.py,sha256=PjdO-bWCW0imV_UN-MGEw9R2GP2OiE8pHjITgmTAY3Q,17895setuptools/_distutils/file_util.py,sha256=YFQL_pD3hLuER9II_H6-hDC_YIGEookdd4wedLuiTW0,7978setuptools/_distutils/filelist.py,sha256=MBeSRJmPcKmDv8ooZgSU4BiQPZ0Khwv8l_jhD50XycI,15337setuptools/_distutils/log.py,sha256=VyBs5j7z4-K6XTEEBThUc9HyMpoPLGtQpERqbz5ylww,1200setuptools/_distutils/spawn.py,sha256=zseCh9sEifyp0I5Vg719JNIASlROJ2ehXqQnHlpt89Q,4086setuptools/_distutils/sysconfig.py,sha256=KeI8OHbMuEzHJ8Q0cBez9KZny8iRy6Z6Y0AkMz1jlsU,19728setuptools/_distutils/tests/__init__.py,sha256=j-IoPZEtQv3EOPuqNTwalr6GLyRjzCC-OOaNvZzmHsI,1485setuptools/_distutils/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_distutils/tests/compat/py39.py,sha256=t0GBTM-30jX-9zCfkwlNBFtzzabemx6065mJ0d9_VRw,1026setuptools/_distutils/tests/support.py,sha256=tjsYsyxvpTK4NrkCseh2ujvDIGV0Mf_b5SI5fP2T0yM,4099setuptools/_distutils/tests/test_archive_util.py,sha256=jozimSwPBF-JoJfN_vDaiVGZp66BNcWZGh34FlW57DQ,11787setuptools/_distutils/tests/test_bdist.py,sha256=xNHxUsLlHsZQRwkzLb_iSD24s-9Mk-NX2ffBWwOyPyc,1396setuptools/_distutils/tests/test_bdist_dumb.py,sha256=QF05MHNhPOdZyh88Xpw8KsO64s7pRFkl8KL-RoV4XK0,2247setuptools/_distutils/tests/test_bdist_rpm.py,sha256=Hdm-pwWgyaoGdGbEcGZa8cRhGU45y8gHK8umOanTjik,3932setuptools/_distutils/tests/test_build.py,sha256=JJY5XpOZco25ZY0pstxl-iI8mHsWP0ujf5o8aOtuZYY,1742setuptools/_distutils/tests/test_build_clib.py,sha256=Mo1ZFb4C1VXBYOGvnallwN7YCnTtr24akLDO8Zi4CsY,4331setuptools/_distutils/tests/test_build_ext.py,sha256=QFO9qYVhWWdJu17HXc4x9RMnLZlhk0lAHi9HVppbuX4,22545setuptools/_distutils/tests/test_build_py.py,sha256=NsfmRrojOHBXNMqWR_mp5g4PLTgjhD7iZFUffGZFIdw,6882setuptools/_distutils/tests/test_build_scripts.py,sha256=cD-FRy-oX55sXRX5Ez5xQCaeHrWajyKc4Xuwv2fe48w,2880setuptools/_distutils/tests/test_check.py,sha256=hHSV07qf7YoSxGsTbbsUQ9tssZz5RRNdbrY1s2SwaFI,6226setuptools/_distutils/tests/test_clean.py,sha256=hPH6jfIpGFUrvWbF1txkiNVSNaAxt2wq5XjV499zO4E,1240setuptools/_distutils/tests/test_cmd.py,sha256=bgRB79mitoOKR1OiyZHnCogvGxt3pWkxeTqIC04lQWQ,3254setuptools/_distutils/tests/test_config_cmd.py,sha256=Zs6WX0IfxDvmuC19XzuVNnYCnTr9Y-hl73TAmDSBN4Y,2664setuptools/_distutils/tests/test_core.py,sha256=L7XKVAxa-MGoAZeANopnuK9fRKneYhkSQpgw8XQvcF8,3829setuptools/_distutils/tests/test_dir_util.py,sha256=E84lC-k4riVUwURyWaQ0Jqx2ui2-io-0RuJa3M7qkJs,4500setuptools/_distutils/tests/test_dist.py,sha256=a6wlc5fQJd5qQ6HOndzcupNhjTxvj6-_JLtpuYvaP1M,18793setuptools/_distutils/tests/test_extension.py,sha256=-YejLgZCuycFrOBd64pVH0JvwMc9NwhzHvQxvvjXHqk,3670setuptools/_distutils/tests/test_file_util.py,sha256=livjnl3FkilQlrB2rFdFQq9nvjEVZHynNya0bfzv_b4,3522setuptools/_distutils/tests/test_filelist.py,sha256=rJwkqCUfkGDgWlD22TozsT8ycbupMHB8DXqThzwT1T4,10766setuptools/_distutils/tests/test_install.py,sha256=TfCB0ykhIxydIC2Q4SuTAZzSHvteMHgrBL9whoSgK9Q,8618setuptools/_distutils/tests/test_install_data.py,sha256=vKq3K97k0hBAnOg38nmwEdf7cEDVr9rTVyCeJolgb4A,2464setuptools/_distutils/tests/test_install_headers.py,sha256=PVAYpo_tYl980Qf64DPOmmSvyefIHdU06f7VsJeZykE,936setuptools/_distutils/tests/test_install_lib.py,sha256=qri6Rl-maNTQrNDV8DbeXNl0hjsfRIKiI4rfZLrmWBI,3612setuptools/_distutils/tests/test_install_scripts.py,sha256=KE3v0cDkFW-90IOID-OmZZGM2mhy-ZkEuuW7UXS2SHw,1600setuptools/_distutils/tests/test_log.py,sha256=isFtOufloCyEdZaQOV7cVUr46GwtdVMj43mGBB5XH7k,323setuptools/_distutils/tests/test_modified.py,sha256=h1--bOWmtJo1bpVV6uRhdnS9br71CBiNDM1MDwSGpug,4221setuptools/_distutils/tests/test_sdist.py,sha256=cfzUhlCA418-1vH9ta3IBs26c_jUBbkJoFOK5GnAyNk,15062setuptools/_distutils/tests/test_spawn.py,sha256=eS8w9D7bTxyFLSyRahJWeuh8Kc1F8RWWiY_dSG5B5Bc,4803setuptools/_distutils/tests/test_sysconfig.py,sha256=lxM8LsUi1TomjDV4HoYK8u5nUoBkeNL60Uq8PY1DcwU,11986setuptools/_distutils/tests/test_text_file.py,sha256=WQWSB5AfdBDZaMA8BFgipJPnsJb_2SKMfL90fSkRVtw,3460setuptools/_distutils/tests/test_util.py,sha256=H9zlZ4z4Vh4TfjNYDBsxP7wguQLpxCfJYyOcm1yZU3c,7988setuptools/_distutils/tests/test_version.py,sha256=ahfg_mP8wRy1sgwY-_Px5hrjgf6_upTIpnCgpR4yWRk,2750setuptools/_distutils/tests/test_versionpredicate.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_distutils/tests/unix_compat.py,sha256=z-op6C2iVdX1aq5BIBR7cqOxijKE97alNwJqHNdLpoI,386setuptools/_distutils/text_file.py,sha256=z4dkOJBr9Bo2LG0TNqm8sD63LEEaKSSP0J0bWBrFG3c,12101setuptools/_distutils/unixccompiler.py,sha256=1bXJWH4fiu_A2WfriHzf88xjllQTXnnjUkZdRKs9cWU,212setuptools/_distutils/util.py,sha256=Njfnqk60zMdkiAjRnGcTWX3t49-obHapOlbNvyIl02I,18094setuptools/_distutils/version.py,sha256=vImT5-ECXkQ21oKL0XYFiTqK6NyM09cpzBNoA_34CQU,12619setuptools/_distutils/versionpredicate.py,sha256=qBWQ6wTj12ODytoTmIydefIY2jb4uY1sdbgbuLn-IJM,5205setuptools/_distutils/zosccompiler.py,sha256=svdiXZ2kdcwKrJKfhUhib03y8gz7aGZKukXH3I7YkBc,58setuptools/_entry_points.py,sha256=Y3QUE9JKFW_YyquDnpffNWSs6f3jKEt1e-dnx--9-Kw,2310setuptools/_imp.py,sha256=YY1EjZEN-0zYci1cxO10B_adAEOr7i8eK8JoCc9Ierc,2435setuptools/_importlib.py,sha256=aKIjcK0HKXNz2D-XTrxaixGn_juTkONwmu3dcheMOF0,223setuptools/_itertools.py,sha256=jWRfsIrpC7myooz3hDURj9GtvpswZeKXg2HakmEhNjo,657setuptools/_normalization.py,sha256=kAmGfrwjF5djydEfLLyKgjkXCbL_0_ZxUPO-DlLlmIY,5824setuptools/_path.py,sha256=cPv41v03HD7uEYqCIo-E_cGRfpPVr4lywBCiK-HSrCg,2685setuptools/_reqs.py,sha256=QI3C9uOBSNRccu208qPnixHx51nxCry7_nPTIJaSYxM,1438setuptools/_shutil.py,sha256=cAOllcoyMTXs5JLoybQi29yI5gABk82hepJyOBv2bMw,1496setuptools/_static.py,sha256=GTR79gESF1_JaK4trLkpDrEuCeEtPlwQW0MRv7VNQX4,4855setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD,sha256=giu6ZrQVJvpUcYa4AiH4XaUNZSvuVJPb_l0UCFES8MM,1308setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12setuptools/_vendor/autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037setuptools/_vendor/autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680setuptools/_vendor/autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505setuptools/_vendor/autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076setuptools/_vendor/autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642setuptools/_vendor/autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD,sha256=JYofHISeEXUGmlWl1s41ev3QTjTNXeJwk-Ss7HqdLOE,1360setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10setuptools/_vendor/backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81setuptools/_vendor/backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491setuptools/_vendor/backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59setuptools/_vendor/backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA,sha256=anuQ7_7h4J1bSEzfcjIBakPi2cyVQ7y7jklLHsBeH1k,4648setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD,sha256=DY08buueu-hsrH1ghhVSQzwynanqUSSLYdAr4uXmQDA,2518setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19setuptools/_vendor/importlib_metadata/__init__.py,sha256=tZNB-23h8Bixi9uCrQqj9Yf0aeC--Josdy3IZRIQeB0,33798setuptools/_vendor/importlib_metadata/_adapters.py,sha256=rIhWTwBvYA1bV7i-5FfVX38qEXDTXFeS5cb5xJtP3ks,2317setuptools/_vendor/importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743setuptools/_vendor/importlib_metadata/_compat.py,sha256=73QKrN9KNoaZzhbX5yPCCZa-FaALwXe8TPlDR72JgBU,1314setuptools/_vendor/importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895setuptools/_vendor/importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068setuptools/_vendor/importlib_metadata/_meta.py,sha256=nxZ7C8GVlcBFAKWyVOn_dn7ot_twBcbm1NmvjIetBHI,1801setuptools/_vendor/importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166setuptools/_vendor/importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608setuptools/_vendor/importlib_metadata/compat/py39.py,sha256=cPkMv6-0ilK-0Jw_Tkn0xYbOKJZc4WJKQHow0c2T44w,1102setuptools/_vendor/importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379setuptools/_vendor/importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079setuptools/_vendor/inflect-7.3.1.dist-info/RECORD,sha256=XXg0rBuiYSxoAQUP3lenuYsPNqz4jDwtTzdv2JEbMJE,943setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8setuptools/_vendor/inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796setuptools/_vendor/inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160setuptools/_vendor/inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/jaraco.collections-5.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA,sha256=IMUaliNsA5X1Ox9MXUWOagch5R4Wwb_3M7erp29dBtg,3933setuptools/_vendor/jaraco.collections-5.1.0.dist-info/RECORD,sha256=HptivXDkpfom6VlMu4CGD_7KPev-6Hc9rvp3TNJZygY,873setuptools/_vendor/jaraco.collections-5.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91setuptools/_vendor/jaraco.collections-5.1.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7setuptools/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/jaraco.context-5.3.0.dist-info/METADATA,sha256=xDtguJej0tN9iEXCUvxEJh2a7xceIRVBEakBLSr__tY,4020setuptools/_vendor/jaraco.context-5.3.0.dist-info/RECORD,sha256=VRl7iKeEQyl7stgnp1uq50CzOJYlHYcoNdS0x17C9X4,641setuptools/_vendor/jaraco.context-5.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD,sha256=YyqnwE98S8wBwCevW5vHb-iVj0oYEDW5V6O9MBS6JIs,843setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD,sha256=gW2UV0HcokYJk4jKPu10_AZnrLqjb3C1WbJJTDl5sfY,1500setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7setuptools/_vendor/jaraco/collections/__init__.py,sha256=Pc1-SqjWm81ad1P0-GttpkwO_LWlnaY6gUq8gcKh2v0,26640setuptools/_vendor/jaraco/collections/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/jaraco/context.py,sha256=REoLIxDkO5MfEYowt_WoupNCRoxBS5v7YX2PbW8lIcs,9552setuptools/_vendor/jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642setuptools/_vendor/jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878setuptools/_vendor/jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335setuptools/_vendor/jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250setuptools/_vendor/jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643setuptools/_vendor/jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904setuptools/_vendor/jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412setuptools/_vendor/jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119setuptools/_vendor/jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA,sha256=BFO90O-fLNiVQMpj7oIS5ztzgJUUQZ3TA32P5HH3N-A,36293setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD,sha256=d8jnPgGNwP1-ntbICwWkQEVF9kH7CFIgzkKzaLWao9M,1259setuptools/_vendor/more_itertools-10.3.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81setuptools/_vendor/more_itertools/__init__.py,sha256=dtAbGjTDmn_ghiU5YXfhyDy0phAlXVdt5klZA5fUa-Q,149setuptools/_vendor/more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43setuptools/_vendor/more_itertools/more.py,sha256=1E5kzFncRKTDw0cYv1yRXMgDdunstLQd1QStcnL6U90,148370setuptools/_vendor/more_itertools/more.pyi,sha256=iXXeqt48Nxe8VGmIWpkVXuKpR2FYNuu2DU8nQLWCCu0,21484setuptools/_vendor/more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/more_itertools/recipes.py,sha256=WedhhfhGVgr6zii8fIbGJVmRTw0ZKRiLKnYBDGJv4nY,28591setuptools/_vendor/more_itertools/recipes.pyi,sha256=T_mdGpcFdfrP3JSWbwzYP9JyNV-Go-7RPfpxfftAWlA,4617setuptools/_vendor/packaging-24.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2setuptools/_vendor/packaging-24.2.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197setuptools/_vendor/packaging-24.2.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174setuptools/_vendor/packaging-24.2.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344setuptools/_vendor/packaging-24.2.dist-info/METADATA,sha256=ohH86s6k5mIfQxY2TS0LcSfADeOFa4BiCC-bxZV-pNs,3204setuptools/_vendor/packaging-24.2.dist-info/RECORD,sha256=Y4DrXM0KY0ArfzhbAEa1LYFPwW3WEgEeL4iCqXe-A-M,2009setuptools/_vendor/packaging-24.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/packaging-24.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82setuptools/_vendor/packaging/__init__.py,sha256=dk4Ta_vmdVJxYHDcfyhvQNw8V3PgSBomKNXqg-D2JDY,494setuptools/_vendor/packaging/_elffile.py,sha256=cflAQAkE25tzhYmq_aCi72QfbT_tn891tPzfpbeHOwE,3306setuptools/_vendor/packaging/_manylinux.py,sha256=vl5OCoz4kx80H5rwXKeXWjl9WNISGmr4ZgTpTP9lU9c,9612setuptools/_vendor/packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694setuptools/_vendor/packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236setuptools/_vendor/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431setuptools/_vendor/packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273setuptools/_vendor/packaging/licenses/__init__.py,sha256=1x5M1nEYjcgwEbLt0dXwz2ukjr18DiCzC0sraQqJ-Ww,5715setuptools/_vendor/packaging/licenses/_spdx.py,sha256=oAm1ztPFwlsmCKe7lAAsv_OIOfS1cWDu9bNBkeu-2ns,48398setuptools/_vendor/packaging/markers.py,sha256=c89TNzB7ZdGYhkovm6PYmqGyHxXlYVaLW591PHUNKD8,10561setuptools/_vendor/packaging/metadata.py,sha256=YJibM7GYe4re8-0a3OlXmGS-XDgTEoO4tlBt2q25Bng,34762setuptools/_vendor/packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947setuptools/_vendor/packaging/specifiers.py,sha256=GG1wPNMcL0fMJO68vF53wKMdwnfehDcaI-r9NpTfilA,40074setuptools/_vendor/packaging/tags.py,sha256=CFqrJzAzc2XNGexerH__T-Y5Iwq7WbsYXsiLERLWxY0,21014setuptools/_vendor/packaging/utils.py,sha256=0F3Hh9OFuRgrhTgGZUl5K22Fv1YP2tZl1z_2gO6kJiA,5050setuptools/_vendor/packaging/version.py,sha256=olfyuk_DPbflNkJ4wBWetXQ17c74x3DB501degUv7DY,16676setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA,sha256=zmsie01G1MtXR0wgIv5XpVeTO7idr0WWvfmxKsKWuGk,11429setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD,sha256=TCEddtQu1A78Os_Mhm2JEqcYr7yit-UYSUQjZtbpn-g,1642setuptools/_vendor/platformdirs-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089setuptools/_vendor/platformdirs/__init__.py,sha256=EMGE8qeHRR9CzDFr8kL3tA8hdZZniYjXBVZd0UGTWK0,22225setuptools/_vendor/platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493setuptools/_vendor/platformdirs/android.py,sha256=xZXY9Jd46WOsxT2U6-5HsNtDZ-IQqxcEUrBLl3hYk4o,9016setuptools/_vendor/platformdirs/api.py,sha256=QBYdUac2eC521ek_y53uD1Dcq-lJX8IgSRVd4InC6uc,8996setuptools/_vendor/platformdirs/macos.py,sha256=wftsbsvq6nZ0WORXSiCrZNkRHz_WKuktl0a6mC7MFkI,5580setuptools/_vendor/platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/platformdirs/unix.py,sha256=Cci9Wqt35dAMsg6HT9nRGHSBW5obb0pR3AE1JJnsCXg,10643setuptools/_vendor/platformdirs/version.py,sha256=r7F76tZRjgQKzrpx_I0_ZMQOMU-PS7eGnHD7zEK3KB0,411setuptools/_vendor/platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125setuptools/_vendor/tomli-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/tomli-2.0.1.dist-info/LICENSE,sha256=uAgWsNUwuKzLTCIReDeQmEpuO2GSLCte6S8zcqsnQv4,1072setuptools/_vendor/tomli-2.0.1.dist-info/METADATA,sha256=zPDceKmPwJGLWtZykrHixL7WVXWmJGzZ1jyRT5lCoPI,8875setuptools/_vendor/tomli-2.0.1.dist-info/RECORD,sha256=DLn5pFGh42WsVLTIhmLh2gy1SnLRalJY-wq_-dPhwCI,999setuptools/_vendor/tomli-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/tomli-2.0.1.dist-info/WHEEL,sha256=jPMR_Dzkc4X4icQtmz81lnNY_kAsfog7ry7qoRvYLXw,81setuptools/_vendor/tomli/__init__.py,sha256=JhUwV66DB1g4Hvt1UQCVMdfCu-IgAV8FXmvDU9onxd4,396setuptools/_vendor/tomli/_parser.py,sha256=g9-ENaALS-B8dokYpCuzUFalWlog7T-SIYMjLZSWrtM,22633setuptools/_vendor/tomli/_re.py,sha256=dbjg5ChZT23Ka9z9DHOXfdtSpPwUfdgMXnj8NOoly-w,2943setuptools/_vendor/tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254setuptools/_vendor/tomli/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE,sha256=YWP3mH37ONa8MgzitwsvArhivEESZRbVUu8c1DJH51g,1130setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA,sha256=z2dcHAp0TwhYCFU5Deh8x31nazElgujUz9tbuP0pjSE,3717setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD,sha256=SKUZWVgkeDUidUKM7s1473fXmsna55bjmi6vJUAoJVI,2402setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt,sha256=qp7NQ1aLtiSgMQqo6gWlfGpy0IIXzoMJmeQTLpzqFZQ,48setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt,sha256=4z28AhuDodwRS_c1J_l8H51t5QuwfTseskYzlxp6grs,10setuptools/_vendor/typeguard/__init__.py,sha256=Onh4w38elPCjtlcU3JY9k3h70NjsxXIkAflmQn-Z0FY,2071setuptools/_vendor/typeguard/_checkers.py,sha256=JRrgKicdOEfIBoNEtegYCEIlhpad-a1u1Em7GCj0WCI,31360setuptools/_vendor/typeguard/_config.py,sha256=nIz8QwDa-oFO3L9O8_6srzlmd99pSby2wOM4Wb7F_B0,2846setuptools/_vendor/typeguard/_decorators.py,sha256=v6dsIeWvPhExGLP_wXF-RmDUyjZf_Ak28g7gBJ_v0-0,9033setuptools/_vendor/typeguard/_exceptions.py,sha256=ZIPeiV-FBd5Emw2EaWd2Fvlsrwi4ocwT2fVGBIAtHcQ,1121setuptools/_vendor/typeguard/_functions.py,sha256=ibgSAKa5ptIm1eR9ARG0BSozAFJPFNASZqhPVyQeqig,10393setuptools/_vendor/typeguard/_importhook.py,sha256=ugjCDvFcdWMU7UugqlJG91IpVNpEIxtRr-99s0h1k7M,6389setuptools/_vendor/typeguard/_memo.py,sha256=1juQV_vxnD2JYKbSrebiQuj4oKHz6n67v9pYA-CCISg,1303setuptools/_vendor/typeguard/_pytest_plugin.py,sha256=-fcSqkv54rIfIF8pDavY5YQPkj4OX8GMt_lL7CQSD4I,4416setuptools/_vendor/typeguard/_suppression.py,sha256=VQfzxcwIbu3if0f7VBkKM7hkYOA7tNFw9a7jMBsmMg4,2266setuptools/_vendor/typeguard/_transformer.py,sha256=9Ha7_QhdwoUni_6hvdY-hZbuEergowHrNL2vzHIakFY,44937setuptools/_vendor/typeguard/_union_transformer.py,sha256=v_42r7-6HuRX2SoFwnyJ-E5PlxXpVeUJPJR1-HU9qSo,1354setuptools/_vendor/typeguard/_utils.py,sha256=5HhO1rPn5f1M6ymkVAEv7Xmlz1cX-j0OnTMlyHqqrR8,5270setuptools/_vendor/typeguard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjWx-N8TOznM9UGW5Gm2DicVpDtRA8W0,3018setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=dxAALYGXHmMqpqL8M9xddKr118quIgQKZdPjFQOwXuk,571setuptools/_vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81setuptools/_vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451setuptools/_vendor/wheel-0.45.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/wheel-0.45.1.dist-info/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107setuptools/_vendor/wheel-0.45.1.dist-info/METADATA,sha256=mKz84H7m7jsxJyzeIcTVORiTb0NPMV39KvOIYhGgmjA,2313setuptools/_vendor/wheel-0.45.1.dist-info/RECORD,sha256=1jnxrHyZPDcVvULyfGFhiba4Z5L9_RsXr9dxcNbhaYQ,4900setuptools/_vendor/wheel-0.45.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/wheel-0.45.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82setuptools/_vendor/wheel-0.45.1.dist-info/entry_points.txt,sha256=rTY1BbkPHhkGMm4Q3F0pIzJBzW2kMxoG1oriffvGdA0,104setuptools/_vendor/wheel/__init__.py,sha256=mrxMnvdXACur_LWegbUfh5g5ysWZrd63UJn890wvGNk,59setuptools/_vendor/wheel/__main__.py,sha256=NkMUnuTCGcOkgY0IBLgBCVC_BGGcWORx2K8jYGS12UE,455setuptools/_vendor/wheel/_bdist_wheel.py,sha256=UghCQjSH_pVfcZh6oRjzSw_TQhcf3anSx1OkiLSL82M,21694setuptools/_vendor/wheel/_setuptools_logging.py,sha256=-5KC-lne0ilOUWIDfOkqapUWGMFZhuKYDIavIZiB5kM,781setuptools/_vendor/wheel/bdist_wheel.py,sha256=tpf9WufiSO1RuEMg5oPhIfSG8DMziCZ_4muCKF69Cqo,1107setuptools/_vendor/wheel/cli/__init__.py,sha256=Npq6_jKi03dhIcRnmbuFhwviVJxwO0tYEnEhWMv9cJo,4402setuptools/_vendor/wheel/cli/convert.py,sha256=Bi0ntEXb9nTllCxWeTRQ4j-nPs3szWSEKipG_GgnMkQ,12634setuptools/_vendor/wheel/cli/pack.py,sha256=CAFcHdBVulvsHYJlndKVO7KMI9JqBTZz5ii0PKxxCOs,3103setuptools/_vendor/wheel/cli/tags.py,sha256=lHw-LaWrkS5Jy_qWcw-6pSjeNM6yAjDnqKI3E5JTTCU,4760setuptools/_vendor/wheel/cli/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021setuptools/_vendor/wheel/macosx_libfile.py,sha256=k1x7CE3LPtOVGqj6NXQ1nTGYVPaeRrhVzUG_KPq3zDs,16572setuptools/_vendor/wheel/metadata.py,sha256=JC4p7jlQZu2bUTAQ2fevkqLjg_X6gnNyRhLn6OUO1tc,6171setuptools/_vendor/wheel/util.py,sha256=aL7aibHwYUgfc8WlolL5tXdkV4DatbJxZHb1kwHFJAU,423setuptools/_vendor/wheel/vendored/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/wheel/vendored/packaging/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197setuptools/_vendor/wheel/vendored/packaging/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174setuptools/_vendor/wheel/vendored/packaging/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344setuptools/_vendor/wheel/vendored/packaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/wheel/vendored/packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266setuptools/_vendor/wheel/vendored/packaging/_manylinux.py,sha256=P7sdR5_7XBY09LVYYPhHmydMJIIwPXWsh4olk74Uuj4,9588setuptools/_vendor/wheel/vendored/packaging/_musllinux.py,sha256=z1s8To2hQ0vpn_d-O2i5qxGwEK8WmGlLt3d_26V7NeY,2674setuptools/_vendor/wheel/vendored/packaging/_parser.py,sha256=4tT4emSl2qTaU7VTQE1Xa9o1jMPCsBezsYBxyNMUN-s,10347setuptools/_vendor/wheel/vendored/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292setuptools/_vendor/wheel/vendored/packaging/markers.py,sha256=_TSPI1BhJYO7Bp9AzTmHQxIqHEVXaTjmDh9G-w8qzPA,8232setuptools/_vendor/wheel/vendored/packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933setuptools/_vendor/wheel/vendored/packaging/specifiers.py,sha256=IWSt0SrLSP72heWhAC8UL0eGvas7XIQHjqiViVfmPKE,39778setuptools/_vendor/wheel/vendored/packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950setuptools/_vendor/wheel/vendored/packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268setuptools/_vendor/wheel/vendored/packaging/version.py,sha256=PFJaYZDxBgyxkfYhH3SQw4qfE9ICCWrTmitvq14y3bs,16234setuptools/_vendor/wheel/vendored/vendor.txt,sha256=Z2ENjB1i5prfez8CdM1Sdr3c6Zxv2rRRolMpLmBncAE,16setuptools/_vendor/wheel/wheelfile.py,sha256=USCttNlJwafxt51YYFFKG7jnxz8dfhbyqAZL6jMTA9s,8411setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023setuptools/_vendor/zipp-3.19.2.dist-info/METADATA,sha256=UIrk_kMIHGSwsKKChYizqMw0MMZpPRZ2ZiVpQAsN_bE,3575setuptools/_vendor/zipp-3.19.2.dist-info/RECORD,sha256=8xby4D_ZrefrvAsVRwaEjiu4_VaLkJNRCfDY484rm_4,1039setuptools/_vendor/zipp-3.19.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92setuptools/_vendor/zipp-3.19.2.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5setuptools/_vendor/zipp/__init__.py,sha256=QuI1g00G4fRAcGt-HqbV0oWIkmSgedCGGYsHHYzNa8A,13412setuptools/_vendor/zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/_vendor/zipp/compat/py310.py,sha256=eZpkW0zRtunkhEh8jjX3gCGe22emoKCBJw72Zt4RkhA,219setuptools/_vendor/zipp/glob.py,sha256=etWpnfEoRyfUvrUsi6sTiGmErvPwe6HzY6pT8jg_lUI,3082setuptools/archive_util.py,sha256=Tl_64hSTtc4y8x7xa98rFVUbG24oArpjzLAYGYP2_sI,7356setuptools/build_meta.py,sha256=rry-LowqvWFsxG6Qm5QWetHJGeETzRdiQ5-bs4bOkjo,20446setuptools/cli-32.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776setuptools/cli-64.exe,sha256=u7PeVwdinmpgoMI4zUd7KPB_AGaYL9qVP6b87DkHOko,14336setuptools/cli-arm64.exe,sha256=uafQjaiA36yLz1SOuksG-1m28JsX0zFIoPZhgyiSbGE,13824setuptools/cli.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776setuptools/command/__init__.py,sha256=wdSrlNR0P6nCz9_oFtCAiAkeFJMsZa1jPcpXT53f0SM,803setuptools/command/_requirestxt.py,sha256=ItYMTJGh_i5TlQstX_nFopqEhkC4PJFadBL2Zd3V670,4228setuptools/command/alias.py,sha256=rDdrMt32DS6qf3K7tjZZyHD_dMKrm77AXcAtx-nBQ0I,2380setuptools/command/bdist_egg.py,sha256=3eDucQ4fdeYMsLO9PhBfY1JkcMLhZXgnAI_9FdFNsEE,16972setuptools/command/bdist_rpm.py,sha256=LyqI49w48SKk0FmuHsE9MLzX1SuXjL7YMNbZMFZqFII,1435setuptools/command/bdist_wheel.py,sha256=_LfGHB7CV_uyncqlOTSETEi2gjVCoPKuAXcyRFoq7Cs,22246setuptools/command/build.py,sha256=eI7STMERGGZEpzk1tvJN8p9IOjAAXMcGLzljv2mwI3M,6052setuptools/command/build_clib.py,sha256=AbgpPIF_3qL8fZr3JIebI-WHTMTBiMfrFkVQz8K40G4,4528setuptools/command/build_ext.py,sha256=bUH4M0NizaJJrv10wK-ZD3uY0TxCSZlYQDhiwwzHslM,18377setuptools/command/build_py.py,sha256=DCbjvB18kkL-xUK5rvlzm0C6twTeOxNhyvJDxxa7fII,15539setuptools/command/develop.py,sha256=zX22119sI1G1gfJ1gNCE4hkg2zbLKx0uUwvNmC5bIu8,6886setuptools/command/dist_info.py,sha256=HU752iLLmmYMHbsDBgz2ubRjkgJobugOp8H71LzzDys,3450setuptools/command/easy_install.py,sha256=0Z4kFlE78Ae2AfHXYTxZFUa2t3qlNqXCtQu4J1Nx8iA,87870setuptools/command/editable_wheel.py,sha256=3bBipRZA3E4poQ8LEWhMYEjHjCzqU_pIdO86C3t7oNY,35624setuptools/command/egg_info.py,sha256=WWUozR3DZCrWsTQhHXOygMiEUcrjLWphET0-Zsocsm4,25982setuptools/command/install.py,sha256=MmTGb8m1R8fJ0cc5FTWCF6uq-s1ZJmvpYm-N_CtqEaI,7046setuptools/command/install_egg_info.py,sha256=3I9IPCH7D59Sh-6aVYz-h6wwyxq-wkxrKwKg3nDdJqs,2075setuptools/command/install_lib.py,sha256=9n1_U83eHcERL_a_rv_LhHCkhXlLdqyZ4SdBow-9qcE,4319setuptools/command/install_scripts.py,sha256=tVOCj3e8OTIrkoL_bGbT5pOksdxZfQblH_bdI4DtVV4,2637setuptools/command/launcher manifest.xml,sha256=xlLbjWrB01tKC0-hlVkOKkiSPbzMml2eOPtJ_ucCnbE,628setuptools/command/rotate.py,sha256=XNd_BEEOWAJHW1FcLTMUWWl4QB6zAuk7b8VWQg3FHos,2187setuptools/command/saveopts.py,sha256=Np0PVb7SD7oTbu9Z9sosS7D-CkkIkU7x4glu5Es1tjA,692setuptools/command/sdist.py,sha256=JaQm2-ebXI2kvyrBjJKP8yNLPa5eMbMeis88CXBMYlk,7374setuptools/command/setopt.py,sha256=xZF2RCc4ABvE9eHHAzF50-fkQg3au8fcRUVVGd58k3U,5100setuptools/command/test.py,sha256=k7xcq7D7bEehgxarbw-dW3AtmGZORqz8HjKR6FGJ3jk,1343setuptools/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/compat/py310.py,sha256=8sqwWczIcrkzeAbhaim4pKVd4tXZdcqmebgdvzji0rc,141setuptools/compat/py311.py,sha256=e6tJAFwZEP82hmMBl10HYeSypelo_Ti2wTjKZVKLwOE,790setuptools/compat/py312.py,sha256=vYKVtdrdOTsO_R90dJkEXsFwfMJFuIFJflhIgHrjJ-Y,366setuptools/compat/py39.py,sha256=BJMtnkfcqyTfccqjYQxfoRtU2nTnWaEESBVkshTiXqY,493setuptools/config/NOTICE,sha256=Ld3wiBgpejuJ1D2V_2WdjahXQRCMkTbfo6TYVsBiO9g,493setuptools/config/__init__.py,sha256=aiPnL9BJn1O6MfmuNXyn8W2Lp8u9qizRVqwPiOdPIjY,1499setuptools/config/_apply_pyprojecttoml.py,sha256=SUyTw7A2btZ1lBuWKN5o42-Diyv95eGTiYJ3rZOnGSc,19120setuptools/config/_validate_pyproject/NOTICE,sha256=XTANv6ZDE4sBO3WsnK7uWR-VG4sO4kKIw0zNkmxHgMg,18737setuptools/config/_validate_pyproject/__init__.py,sha256=dnp6T7ePP1R5z4OuC7Fd2dkFlIrtIfizUfvpGJP6nz0,1042setuptools/config/_validate_pyproject/error_reporting.py,sha256=meldD7nBQdolQhvG-43r1Ue-gU1n7ORAJR86vh3Rrvk,11813setuptools/config/_validate_pyproject/extra_validations.py,sha256=-GUG5S--ijY8WfXbdXPoHl6ywGsyEF9dtDpenSoJPHg,2858setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py,sha256=w749JgqKi8clBFcObdcbZVqsmF4oJ_QByhZ1SGbUFNw,1612setuptools/config/_validate_pyproject/fastjsonschema_validations.py,sha256=FihD5ZcM6p77BPZ04CGqh3BEwVNoPMKJZJAyuJpkAU0,354682setuptools/config/_validate_pyproject/formats.py,sha256=TETokJBK9hjl-cVg1olsojkJwLxfP7_chgJQNmzAB98,13564setuptools/config/distutils.schema.json,sha256=Tcp32kRnhwORGw_9p6GEi08lj2h15tQRzOYBbzGmcBU,972setuptools/config/expand.py,sha256=JNAktRCsyyRB-rQodbPnCucmLWqcYvzCDC8Ebn2Z7xM,16041setuptools/config/pyprojecttoml.py,sha256=YMu5PdbJJI5azp6kR_boM1mflf5nqOA-InF4s6LnLgw,18320setuptools/config/setupcfg.py,sha256=VZDkwE7DYv45SbadJD8CwKrDtiXvjgllL8PYSvoRCyg,26575setuptools/config/setuptools.schema.json,sha256=dZBRuSEnZkatoVlt1kVwG8ocTeRdO7BD0xvOWKH54PY,16071setuptools/depends.py,sha256=jKYfjmt_2ZQYVghb8L9bU7LJ6erHJ5ze-K_fKV1BMXk,5965setuptools/discovery.py,sha256=-42c3XhwzkfodDKKP50C2YBzr11fncAgmUzBdBRb0-Q,21258setuptools/dist.py,sha256=RZz7aj9RxqSYriqgFoZOu-7KIV82cmlaMFx9owZrApQ,44897setuptools/errors.py,sha256=gY2x2PIaIgy01yRANRC-zcCwxDCqCScgJoCOZFe0yio,3024setuptools/extension.py,sha256=KCnv9p3tgm0ZVqtgE451fyILsm4hCyvOiUtOu787D-4,6683setuptools/glob.py,sha256=AC_B33DY8g-CHELxDsJrtwFrpiucSAZsakPFdSOQzhc,6062setuptools/gui-32.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776setuptools/gui-64.exe,sha256=NHG2FA6txkEid9u-_j_vjDRaDxpZd2CGuAo2GMOoPjs,14336setuptools/gui-arm64.exe,sha256=5pT0dDQFyLWSb_RX22_n8aEt7HwWqcOGR4TT9OB64Jc,13824setuptools/gui.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776setuptools/installer.py,sha256=_4Wegx4r3L05sMo3-IlqFp-OuxnWyBqjyMZ7LWQXmh8,5110setuptools/launch.py,sha256=IBb5lEv69CyuZ9ewIrmKlXh154kdLmP29LKfTMkximE,820setuptools/logging.py,sha256=W16iHJ1HcCXYQ0RxyrEfJ83FT4175tCtoYg-E6uSpVI,1261setuptools/modified.py,sha256=ZwbfBfCFP88ltvbv_dJDz-t1LsQjnM-JUpgZnnQZjjM,568setuptools/monkey.py,sha256=FwMWl2n1v2bHbeqBy-o9g8yUNaAkYFbszCbXe9d5Za8,3717setuptools/msvc.py,sha256=vmM0qL4rIzrtD9pia9ZEwtqZ4LbbrgL0dU0EANVYRm8,41631setuptools/namespaces.py,sha256=2GGqYY1BNDEhMtBc1rHTv7klgmNVRdksJeW-L1f--ys,3171setuptools/package_index.py,sha256=yHXj4Z_QaUeh8W6rwq08I5LxnyHrSkNf01uXHwdE8K0,39095setuptools/sandbox.py,sha256=fMqtcOuipHO6RKPh1YB5o7d985dLKo76Whp3vrIei2E,14906setuptools/script (dev).tmpl,sha256=RUzQzCQUaXtwdLtYHWYbIQmOaES5Brqq1FvUA_tu-5I,218setuptools/script.tmpl,sha256=WGTt5piezO27c-Dbx6l5Q4T3Ff20A5z7872hv3aAhYY,138setuptools/tests/__init__.py,sha256=AnBfls2iJbTDQzmMKeLRt-9lxhaOHUVOZEgXv89Uwvs,335setuptools/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/tests/compat/py39.py,sha256=eUy7_F-6KRTOIKl-veshUu6I0EdTSdBZMh0EV0lZ1-g,135setuptools/tests/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/tests/config/downloads/__init__.py,sha256=9ixnDEdyL_arKbUzfuiJftAj9bGxKz8M9alOFZMjx9Y,1827setuptools/tests/config/downloads/preload.py,sha256=sIGGZpY3cmMpMwiJYYYYHG2ifZJkvJgEotRFtiulV1I,450setuptools/tests/config/setupcfg_examples.txt,sha256=cAbVvCbkFZuTUL6xRRzRgqyB0rLvJTfvw3D30glo2OE,1912setuptools/tests/config/test_apply_pyprojecttoml.py,sha256=l6nE4d8WLU_eSWRic7VSoqeKv9Bi7CZGHcEuB2ehk2w,28807setuptools/tests/config/test_expand.py,sha256=S0oT6JvgA_oujR4YS4RUuf5gmOt1CTQV66RQDzV8xd4,8933setuptools/tests/config/test_pyprojecttoml.py,sha256=0LefSljUhA6MqtJ5AVzLhomqZcYiFKdu_1ckDeMT1LY,12406setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py,sha256=9W73-yLhZJmvCiO4rTiQoBpZT5wNA90Xbd5n2HCshd4,3271setuptools/tests/config/test_setupcfg.py,sha256=ZvN-O-2Dgon1adp6oM6il8JWdgT9y196fRvqESU5ELI,33427setuptools/tests/contexts.py,sha256=TAdZKxmmodx1ExMVo01o4QpRjpIpo4X3IWKq_BnjxpU,3480setuptools/tests/environment.py,sha256=95_UtTaRiuvwYC9eXKEHbn02kDtZysvZq3UZJmPUj1I,3102setuptools/tests/fixtures.py,sha256=-V7iD6BeE2E0Rw6dVvTOCm36JG8ZTTnrXhN0GISlgrg,5197setuptools/tests/indexes/test_links_priority/external.html,sha256=eL9euOuE93JKZdqlXxBOlHbKwIuNuIdq7GBRpsaPMcU,92setuptools/tests/indexes/test_links_priority/simple/foobar/index.html,sha256=DD-TKr7UU4zAjHHz4VexYDNSAzR27levSh1c-k3ZdLE,174setuptools/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0setuptools/tests/integration/helpers.py,sha256=3PHcS9SCA-fwVJmUP2ad5NQOttJAETI5Nnoc_xroO5k,2522setuptools/tests/integration/test_pip_install_sdist.py,sha256=SFbvuYF_hDzt6OtsQ5GjFNnxmoJ_eElfvpYsiyyGJ-g,8256setuptools/tests/mod_with_constant.py,sha256=X_Kj80M55w1tmQ4f7uZY91ZTALo4hKVT6EHxgYocUMQ,22setuptools/tests/namespaces.py,sha256=HPcI3nR5MCFWXpaADIJ1fwKxymcQgBkuw87Ic5PUSAQ,2774setuptools/tests/script-with-bom.py,sha256=hRRgIizEULGiG_ZTNoMY46HhKhxpWfy5FGcD6Qbh5fc,18setuptools/tests/server.py,sha256=0FDZf0cSInCP5n1haK7AxHo3jD261RK7D3-RjP-F53k,2397setuptools/tests/test_archive_util.py,sha256=buuKdY8XkW26Pe3IKAoBRGHG0MDumnuNoPg2WsAQzIg,845setuptools/tests/test_bdist_deprecations.py,sha256=75Xq3gYn79LIIyusEltbHan0bEgAt2e_CaL7KLS8-KQ,775setuptools/tests/test_bdist_egg.py,sha256=6PaYN1F3JDbIh1uK0urv7yJFcx98z5dn9SOJ8Mv91l8,1957setuptools/tests/test_bdist_wheel.py,sha256=dZ9a7OT_UyRvLnoCi2KGEIbtzhEQjM3YutYMA6ZCezs,23083setuptools/tests/test_build.py,sha256=wJgMz2hwHADcLFg-nXrwRVhus7hjmAeEGgrpIQwCGnA,798setuptools/tests/test_build_clib.py,sha256=bX51XRAf4uO7IuHFpjePnoK8mE74N2gsoeEqF-ofgws,3123setuptools/tests/test_build_ext.py,sha256=e4ZSxsYPB5zq1KSqGEuATZ0t0PJQzMhjjkKJ-hIjcgc,10099setuptools/tests/test_build_meta.py,sha256=Iakpp9Micvhxi9_F2RPyY2NnCB1G90a38s4O5A3CuiE,34118setuptools/tests/test_build_py.py,sha256=gobME_Cvzf6Ugxq70iWfXekb_xyyT61khwjFq8zkwfw,14186setuptools/tests/test_config_discovery.py,sha256=FqV-lOtkqaI-ayzU2zocSdD5TaRAgCZnixNDilKA6FQ,22580setuptools/tests/test_core_metadata.py,sha256=vbVJ5_Lsx_hsO_GdB6nQEXJRjA2ydx6_qSbr5LpheAA,20881setuptools/tests/test_depends.py,sha256=yQBXoQbNQlJit6mbRVoz6Bb553f3sNrq02lZimNz5XY,424setuptools/tests/test_develop.py,sha256=CLzXZ8-b5-VFTuau4P4yXEdLx1UdyTFcOfrV0qyUIdE,5142setuptools/tests/test_dist.py,sha256=GFjyL2etAxvVM3q7NhFEGcXS5gyKj8VzbqcbKzpqbOk,8901setuptools/tests/test_dist_info.py,sha256=5kBRj9tuBsVreBsY22H2feMO_JQZsSoOZMU_MJfUevY,7077setuptools/tests/test_distutils_adoption.py,sha256=_eynrOfyEqXFEmjUJhzpe8GXPyTUPvNSObs4qAAmBy8,5987setuptools/tests/test_easy_install.py,sha256=jx4lpFyee0G432cdnwBow3AkL4ibw-0QILwldwv5SCI,53534setuptools/tests/test_editable_install.py,sha256=7eTEtpT0k7QeVyZg64eh3kZn-SjckuB9LcokOuV37DI,43383setuptools/tests/test_egg_info.py,sha256=QCzoUOkFocmbkwS6XU7F8WNzKE8CGEMRxYBqKLgfUrc,44866setuptools/tests/test_extern.py,sha256=rpKU6oCcksumLwf5TeKlDluFQ0TUfbPwTLQbpxcFrCU,296setuptools/tests/test_find_packages.py,sha256=CTLAcTzWGWBLCcd2aAsUVkvO3ibrlqexFBdDKOWPoq8,7819setuptools/tests/test_find_py_modules.py,sha256=zQjuhIG5TQN2SJPix9ARo4DL_w84Ln8QsHDUjjbrtAQ,2404setuptools/tests/test_glob.py,sha256=P3JvpH-kXQ4BZ3zvRF-zKxOgwyWzwIaQIz0WHdxS0kk,887setuptools/tests/test_install_scripts.py,sha256=scIrJ6a_ssKqg4vIBNaUjmAKHEYLUUZ9WKnPeKnE6gc,3433setuptools/tests/test_logging.py,sha256=zlE5DlldukC7Jc54FNvDV_7ux3ErAkrfrN5CSsnNOUQ,2099setuptools/tests/test_manifest.py,sha256=eMg65pIA52DizB6mpktSU-b8CjwaNCS5MSgL_V1LrFI,18562setuptools/tests/test_namespaces.py,sha256=Y6utoe5PHHqL_DlgawqB9F8XpsUDPvvw1sQMenK04e0,4515setuptools/tests/test_packageindex.py,sha256=qEjLHpSu2gAkegwEstzHQT-Om1uQIYjA8zeNzEX79uo,8775setuptools/tests/test_sandbox.py,sha256=shUWE7fLTWe7Jzdfi6NheBWauG3oUukbUV46cArD0u0,4330setuptools/tests/test_sdist.py,sha256=RYLvPa_nfyC1ZmoinzqMzJynTDG4RtPYC19_0LU6pvs,32872setuptools/tests/test_setopt.py,sha256=3VxxM4ATfP-P4AGnDjoWCnHr5-i9CSEQTFYU1-FTnvI,1365setuptools/tests/test_setuptools.py,sha256=_eIhqKf45-OtHqxRf20KndOZJlJdS0PuFLXBO3M-LN8,9008setuptools/tests/test_shutil_wrapper.py,sha256=g15E11PtZxG-InB2BWNFyH-svObXx2XcMhgMLJPuFnc,641setuptools/tests/test_unicode_utils.py,sha256=xWfEEl8jkQCt9othUTXJfFmdyATAFggJs2tTxjbumbw,316setuptools/tests/test_virtualenv.py,sha256=g-njC_9JTAs1YVx_1dGJ_Q6RlInO4qKVu9-XAgNb6TY,3730setuptools/tests/test_warnings.py,sha256=zwR2zcnCeCeDqILZlJOPAcuyPHoDvGu1OtOVYiLMk74,3347setuptools/tests/test_wheel.py,sha256=J-83W1KdXTgAjFZE3H-ytohhvDE1iqdbE5YF5jLQlGQ,19370setuptools/tests/test_windows_wrappers.py,sha256=aF6UTowN3yzCgdBh9nDQVvYIfSYogrTK776TEyXEBqg,7881setuptools/tests/text.py,sha256=a12197pMVTvB6FAWQ0ujT8fIQiLIWJlFAl1UCaDUDfg,123setuptools/tests/textwrap.py,sha256=FNNNq_MiaEJx88PnsbJQIRxmj1qmgcAOCXXRsODPJN4,98setuptools/unicode_utils.py,sha256=ukMGh8pEAw6F_Ezb-K5D3c-078RgA_GcF0oW6lg4lSs,3189setuptools/version.py,sha256=WJCeUuyq74Aok2TeK9-OexZOu8XrlQy7-y0BEuWNovQ,161setuptools/warnings.py,sha256=oY0Se5eOqje_FEyjTgonUc0XGwgsrI5cgm1kkwulz_w,3796setuptools/wheel.py,sha256=xkAtvgm7uPTyYV2zqVmQ0wA8kLwOyRT2Jes1zAy07Ks,8624setuptools/windows_support.py,sha256=wW4IYLM1Bv7Z1MaauP2xmPjyy-wkmQnXdyvXscAf9fw,72612345Wheel-Version: 1.0Generator: setuptools (78.1.0)Root-Is-Purelib: trueTag: py3-none-any
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051[distutils.commands]alias = setuptools.command.alias:aliasbdist_egg = setuptools.command.bdist_egg:bdist_eggbdist_rpm = setuptools.command.bdist_rpm:bdist_rpmbdist_wheel = setuptools.command.bdist_wheel:bdist_wheelbuild = setuptools.command.build:buildbuild_clib = setuptools.command.build_clib:build_clibbuild_ext = setuptools.command.build_ext:build_extbuild_py = setuptools.command.build_py:build_pydevelop = setuptools.command.develop:developdist_info = setuptools.command.dist_info:dist_infoeasy_install = setuptools.command.easy_install:easy_installeditable_wheel = setuptools.command.editable_wheel:editable_wheelegg_info = setuptools.command.egg_info:egg_infoinstall = setuptools.command.install:installinstall_egg_info = setuptools.command.install_egg_info:install_egg_infoinstall_lib = setuptools.command.install_lib:install_libinstall_scripts = setuptools.command.install_scripts:install_scriptsrotate = setuptools.command.rotate:rotatesaveopts = setuptools.command.saveopts:saveoptssdist = setuptools.command.sdist:sdistsetopt = setuptools.command.setopt:setopt
[distutils.setup_keywords]dependency_links = setuptools.dist:assert_string_listeager_resources = setuptools.dist:assert_string_listentry_points = setuptools.dist:check_entry_pointsexclude_package_data = setuptools.dist:check_package_dataextras_require = setuptools.dist:check_extrasinclude_package_data = setuptools.dist:assert_boolinstall_requires = setuptools.dist:check_requirementsnamespace_packages = setuptools.dist:check_nsppackage_data = setuptools.dist:check_package_datapackages = setuptools.dist:check_packagespython_requires = setuptools.dist:check_specifiersetup_requires = setuptools.dist:check_requirementsuse_2to3 = setuptools.dist:invalid_unless_falsezip_safe = setuptools.dist:assert_bool
[egg_info.writers]PKG-INFO = setuptools.command.egg_info:write_pkg_infodependency_links.txt = setuptools.command.egg_info:overwrite_argeager_resources.txt = setuptools.command.egg_info:overwrite_argentry_points.txt = setuptools.command.egg_info:write_entriesnamespace_packages.txt = setuptools.command.egg_info:overwrite_argrequires.txt = setuptools.command.egg_info:write_requirementstop_level.txt = setuptools.command.egg_info:write_toplevel_names
[setuptools.finalize_distribution_options]keywords = setuptools.dist:Distribution._finalize_setup_keywordsparent_finalize = setuptools.dist:_Distribution.finalize_options1234567891011121314151617Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), todeal in the Software without restriction, including without limitation therights to use, copy, modify, merge, publish, distribute, sublicense, and/orsell copies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGSIN THE SOFTWARE.123_distutils_hackpkg_resourcessetuptools123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218"""Tests for automatic package discovery"""
import osimport shutilimport tempfile
import pytest
from setuptools import find_namespace_packages, find_packagesfrom setuptools.discovery import FlatLayoutPackageFinder
from .compat.py39 import os_helper
class TestFindPackages: def setup_method(self, method): self.dist_dir = tempfile.mkdtemp() self._make_pkg_structure()
def teardown_method(self, method): shutil.rmtree(self.dist_dir)
def _make_pkg_structure(self): """Make basic package structure.
dist/ docs/ conf.py pkg/ __pycache__/ nspkg/ mod.py subpkg/ assets/ asset __init__.py setup.py
""" self.docs_dir = self._mkdir('docs', self.dist_dir) self._touch('conf.py', self.docs_dir) self.pkg_dir = self._mkdir('pkg', self.dist_dir) self._mkdir('__pycache__', self.pkg_dir) self.ns_pkg_dir = self._mkdir('nspkg', self.pkg_dir) self._touch('mod.py', self.ns_pkg_dir) self.sub_pkg_dir = self._mkdir('subpkg', self.pkg_dir) self.asset_dir = self._mkdir('assets', self.sub_pkg_dir) self._touch('asset', self.asset_dir) self._touch('__init__.py', self.sub_pkg_dir) self._touch('setup.py', self.dist_dir)
def _mkdir(self, path, parent_dir=None): if parent_dir: path = os.path.join(parent_dir, path) os.mkdir(path) return path
def _touch(self, path, dir_=None): if dir_: path = os.path.join(dir_, path) open(path, 'wb').close() return path
def test_regular_package(self): self._touch('__init__.py', self.pkg_dir) packages = find_packages(self.dist_dir) assert packages == ['pkg', 'pkg.subpkg']
def test_exclude(self): self._touch('__init__.py', self.pkg_dir) packages = find_packages(self.dist_dir, exclude=('pkg.*',)) assert packages == ['pkg']
def test_exclude_recursive(self): """ Excluding a parent package should not exclude child packages as well. """ self._touch('__init__.py', self.pkg_dir) self._touch('__init__.py', self.sub_pkg_dir) packages = find_packages(self.dist_dir, exclude=('pkg',)) assert packages == ['pkg.subpkg']
def test_include_excludes_other(self): """ If include is specified, other packages should be excluded. """ self._touch('__init__.py', self.pkg_dir) alt_dir = self._mkdir('other_pkg', self.dist_dir) self._touch('__init__.py', alt_dir) packages = find_packages(self.dist_dir, include=['other_pkg']) assert packages == ['other_pkg']
def test_dir_with_dot_is_skipped(self): shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets')) data_dir = self._mkdir('some.data', self.pkg_dir) self._touch('__init__.py', data_dir) self._touch('file.dat', data_dir) packages = find_packages(self.dist_dir) assert 'pkg.some.data' not in packages
def test_dir_with_packages_in_subdir_is_excluded(self): """ Ensure that a package in a non-package such as build/pkg/__init__.py is excluded. """ build_dir = self._mkdir('build', self.dist_dir) build_pkg_dir = self._mkdir('pkg', build_dir) self._touch('__init__.py', build_pkg_dir) packages = find_packages(self.dist_dir) assert 'build.pkg' not in packages
@pytest.mark.skipif(not os_helper.can_symlink(), reason='Symlink support required') def test_symlinked_packages_are_included(self): """ A symbolically-linked directory should be treated like any other directory when matched as a package.
Create a link from lpkg -> pkg. """ self._touch('__init__.py', self.pkg_dir) linked_pkg = os.path.join(self.dist_dir, 'lpkg') os.symlink('pkg', linked_pkg) assert os.path.isdir(linked_pkg) packages = find_packages(self.dist_dir) assert 'lpkg' in packages
def _assert_packages(self, actual, expected): assert set(actual) == set(expected)
def test_pep420_ns_package(self): packages = find_namespace_packages( self.dist_dir, include=['pkg*'], exclude=['pkg.subpkg.assets'] ) self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
def test_pep420_ns_package_no_includes(self): packages = find_namespace_packages(self.dist_dir, exclude=['pkg.subpkg.assets']) self._assert_packages(packages, ['docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg'])
def test_pep420_ns_package_no_includes_or_excludes(self): packages = find_namespace_packages(self.dist_dir) expected = ['docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg', 'pkg.subpkg.assets'] self._assert_packages(packages, expected)
def test_regular_package_with_nested_pep420_ns_packages(self): self._touch('__init__.py', self.pkg_dir) packages = find_namespace_packages( self.dist_dir, exclude=['docs', 'pkg.subpkg.assets'] ) self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
def test_pep420_ns_package_no_non_package_dirs(self): shutil.rmtree(self.docs_dir) shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets')) packages = find_namespace_packages(self.dist_dir) self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
class TestFlatLayoutPackageFinder: EXAMPLES = { "hidden-folders": ( [".pkg/__init__.py", "pkg/__init__.py", "pkg/nested/file.txt"], ["pkg", "pkg.nested"], ), "private-packages": ( ["_pkg/__init__.py", "pkg/_private/__init__.py"], ["pkg", "pkg._private"], ), "invalid-name": ( ["invalid-pkg/__init__.py", "other.pkg/__init__.py", "yet,another/file.py"], [], ), "docs": (["pkg/__init__.py", "docs/conf.py", "docs/readme.rst"], ["pkg"]), "tests": ( ["pkg/__init__.py", "tests/test_pkg.py", "tests/__init__.py"], ["pkg"], ), "examples": ( [ "pkg/__init__.py", "examples/__init__.py", "examples/file.py", "example/other_file.py", # Sub-packages should always be fine "pkg/example/__init__.py", "pkg/examples/__init__.py", ], ["pkg", "pkg.examples", "pkg.example"], ), "tool-specific": ( [ "htmlcov/index.html", "pkg/__init__.py", "tasks/__init__.py", "tasks/subpackage/__init__.py", "fabfile/__init__.py", "fabfile/subpackage/__init__.py", # Sub-packages should always be fine "pkg/tasks/__init__.py", "pkg/fabfile/__init__.py", ], ["pkg", "pkg.tasks", "pkg.fabfile"], ), }
@pytest.mark.parametrize("example", EXAMPLES.keys()) def test_unwanted_directories_not_included(self, tmp_path, example): files, expected_packages = self.EXAMPLES[example] ensure_files(tmp_path, files) found_packages = FlatLayoutPackageFinder.find(str(tmp_path)) assert set(found_packages) == set(expected_packages)
def ensure_files(root_path, files): for file in files: path = root_path / file path.parent.mkdir(parents=True, exist_ok=True) path.touch()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273"""Tests for automatic discovery of modules"""
import os
import pytest
from setuptools.discovery import FlatLayoutModuleFinder, ModuleFinder
from .compat.py39 import os_helperfrom .test_find_packages import ensure_files
class TestModuleFinder: def find(self, path, *args, **kwargs): return set(ModuleFinder.find(str(path), *args, **kwargs))
EXAMPLES = { # circumstance: (files, kwargs, expected_modules) "simple_folder": ( ["file.py", "other.py"], {}, # kwargs ["file", "other"], ), "exclude": ( ["file.py", "other.py"], {"exclude": ["f*"]}, ["other"], ), "include": ( ["file.py", "fole.py", "other.py"], {"include": ["f*"], "exclude": ["fo*"]}, ["file"], ), "invalid-name": (["my-file.py", "other.file.py"], {}, []), }
@pytest.mark.parametrize("example", EXAMPLES.keys()) def test_finder(self, tmp_path, example): files, kwargs, expected_modules = self.EXAMPLES[example] ensure_files(tmp_path, files) assert self.find(tmp_path, **kwargs) == set(expected_modules)
@pytest.mark.skipif(not os_helper.can_symlink(), reason='Symlink support required') def test_symlinked_packages_are_included(self, tmp_path): src = "_myfiles/file.py" ensure_files(tmp_path, [src]) os.symlink(tmp_path / src, tmp_path / "link.py") assert self.find(tmp_path) == {"link"}
class TestFlatLayoutModuleFinder: def find(self, path, *args, **kwargs): return set(FlatLayoutModuleFinder.find(str(path)))
EXAMPLES = { # circumstance: (files, expected_modules) "hidden-files": ([".module.py"], []), "private-modules": (["_module.py"], []), "common-names": ( ["setup.py", "conftest.py", "test.py", "tests.py", "example.py", "mod.py"], ["mod"], ), "tool-specific": ( ["tasks.py", "fabfile.py", "noxfile.py", "dodo.py", "manage.py", "mod.py"], ["mod"], ), }
@pytest.mark.parametrize("example", EXAMPLES.keys()) def test_unwanted_files_not_included(self, tmp_path, example): files, expected_modules = self.EXAMPLES[example] ensure_files(tmp_path, files) assert self.find(tmp_path) == set(expected_modules)123456789101112131415161718192021222324252627282930313233343536373839404142434445import pytestfrom jaraco import path
from setuptools.glob import glob
@pytest.mark.parametrize( ('tree', 'pattern', 'matches'), ( ('', b'', []), ('', '', []), ( """ appveyor.yml CHANGES.rst LICENSE MANIFEST.in pyproject.toml README.rst setup.cfg setup.py """, '*.rst', ('CHANGES.rst', 'README.rst'), ), ( """ appveyor.yml CHANGES.rst LICENSE MANIFEST.in pyproject.toml README.rst setup.cfg setup.py """, b'*.rst', (b'CHANGES.rst', b'README.rst'), ), ),)def test_glob(monkeypatch, tmpdir, tree, pattern, matches): monkeypatch.chdir(tmpdir) path.build({name: '' for name in tree.split()}) assert list(sorted(glob(pattern))) == list(sorted(matches))1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889"""install_scripts tests"""
import sys
import pytest
from setuptools.command.install_scripts import install_scriptsfrom setuptools.dist import Distribution
from . import contexts
class TestInstallScripts: settings = dict( name='foo', entry_points={'console_scripts': ['foo=foo:foo']}, version='0.0', ) unix_exe = '/usr/dummy-test-path/local/bin/python' unix_spaces_exe = '/usr/bin/env dummy-test-python' win32_exe = 'C:\\Dummy Test Path\\Program Files\\Python 3.6\\python.exe'
def _run_install_scripts(self, install_dir, executable=None): dist = Distribution(self.settings) dist.script_name = 'setup.py' cmd = install_scripts(dist) cmd.install_dir = install_dir if executable is not None: bs = cmd.get_finalized_command('build_scripts') bs.executable = executable cmd.ensure_finalized() with contexts.quiet(): cmd.run()
@pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only') def test_sys_executable_escaping_unix(self, tmpdir, monkeypatch): """ Ensure that shebang is not quoted on Unix when getting the Python exe from sys.executable. """ expected = f'#!{self.unix_exe}\n' monkeypatch.setattr('sys.executable', self.unix_exe) with tmpdir.as_cwd(): self._run_install_scripts(str(tmpdir)) with open(str(tmpdir.join('foo')), 'r', encoding="utf-8") as f: actual = f.readline() assert actual == expected
@pytest.mark.skipif(sys.platform != 'win32', reason='Windows only') def test_sys_executable_escaping_win32(self, tmpdir, monkeypatch): """ Ensure that shebang is quoted on Windows when getting the Python exe from sys.executable and it contains a space. """ expected = f'#!"{self.win32_exe}"\n' monkeypatch.setattr('sys.executable', self.win32_exe) with tmpdir.as_cwd(): self._run_install_scripts(str(tmpdir)) with open(str(tmpdir.join('foo-script.py')), 'r', encoding="utf-8") as f: actual = f.readline() assert actual == expected
@pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only') def test_executable_with_spaces_escaping_unix(self, tmpdir): """ Ensure that shebang on Unix is not quoted, even when a value with spaces is specified using --executable. """ expected = f'#!{self.unix_spaces_exe}\n' with tmpdir.as_cwd(): self._run_install_scripts(str(tmpdir), self.unix_spaces_exe) with open(str(tmpdir.join('foo')), 'r', encoding="utf-8") as f: actual = f.readline() assert actual == expected
@pytest.mark.skipif(sys.platform != 'win32', reason='Windows only') def test_executable_arg_escaping_win32(self, tmpdir): """ Ensure that shebang on Windows is quoted when getting a path with spaces from --executable, that is itself properly quoted. """ expected = f'#!"{self.win32_exe}"\n' with tmpdir.as_cwd(): self._run_install_scripts(str(tmpdir), '"' + self.win32_exe + '"') with open(str(tmpdir.join('foo-script.py')), 'r', encoding="utf-8") as f: actual = f.readline() assert actual == expected12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576import functoolsimport inspectimport loggingimport sys
import pytest
IS_PYPY = '__pypy__' in sys.builtin_module_names
setup_py = """\from setuptools import setup
setup( name="test_logging", version="0.0")"""
@pytest.mark.parametrize( ('flag', 'expected_level'), [("--dry-run", "INFO"), ("--verbose", "DEBUG")])def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level): """Make sure the correct verbosity level is set (issue #3038)""" import setuptools # noqa: F401 # import setuptools to monkeypatch distutils
import distutils # <- load distutils after all the patches take place
logger = logging.Logger(__name__) monkeypatch.setattr(logging, "root", logger) unset_log_level = logger.getEffectiveLevel() assert logging.getLevelName(unset_log_level) == "NOTSET"
setup_script = tmp_path / "setup.py" setup_script.write_text(setup_py, encoding="utf-8") dist = distutils.core.run_setup(setup_script, stop_after="init") dist.script_args = [flag, "sdist"] dist.parse_command_line() # <- where the log level is set log_level = logger.getEffectiveLevel() log_level_name = logging.getLevelName(log_level) assert log_level_name == expected_level
def flaky_on_pypy(func): @functools.wraps(func) def _func(): try: func() except AssertionError: # pragma: no cover if IS_PYPY: msg = "Flaky monkeypatch on PyPy (#4124)" pytest.xfail(f"{msg}. Original discussion in #3707, #3709.") raise
return _func
@flaky_on_pypydef test_patching_does_not_cause_problems(): # Ensure `dist.log` is only patched if necessary
import _distutils_hack
import setuptools.logging
from distutils import dist
setuptools.logging.configure()
if _distutils_hack.enabled(): # Modern logging infra, no problematic patching. assert dist.__file__ is None or "setuptools" in dist.__file__ assert isinstance(dist.log, logging.Logger) else: assert inspect.ismodule(dist.log)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622"""sdist tests"""
from __future__ import annotations
import contextlibimport ioimport itertoolsimport loggingimport osimport shutilimport sysimport tempfile
import pytest
from setuptools.command.egg_info import FileList, egg_info, translate_patternfrom setuptools.dist import Distributionfrom setuptools.tests.textwrap import DALS
from distutils import logfrom distutils.errors import DistutilsTemplateError
IS_PYPY = '__pypy__' in sys.builtin_module_names
def make_local_path(s): """Converts '/' in a string to os.sep""" return s.replace('/', os.sep)
SETUP_ATTRS = { 'name': 'app', 'version': '0.0', 'packages': ['app'],}
SETUP_PY = f"""\from setuptools import setup
setup(**{SETUP_ATTRS!r})"""
@contextlib.contextmanagerdef quiet(): old_stdout, old_stderr = sys.stdout, sys.stderr sys.stdout, sys.stderr = io.StringIO(), io.StringIO() try: yield finally: sys.stdout, sys.stderr = old_stdout, old_stderr
def touch(filename): open(filename, 'wb').close()
# The set of files always in the manifest, including all files in the# .egg-info directorydefault_files = frozenset( map( make_local_path, [ 'README.rst', 'MANIFEST.in', 'setup.py', 'app.egg-info/PKG-INFO', 'app.egg-info/SOURCES.txt', 'app.egg-info/dependency_links.txt', 'app.egg-info/top_level.txt', 'app/__init__.py', ], ))
translate_specs: list[tuple[str, list[str], list[str]]] = [ ('foo', ['foo'], ['bar', 'foobar']), ('foo/bar', ['foo/bar'], ['foo/bar/baz', './foo/bar', 'foo']), # Glob matching ('*.txt', ['foo.txt', 'bar.txt'], ['foo/foo.txt']), ('dir/*.txt', ['dir/foo.txt', 'dir/bar.txt', 'dir/.txt'], ['notdir/foo.txt']), ('*/*.py', ['bin/start.py'], []), ('docs/page-?.txt', ['docs/page-9.txt'], ['docs/page-10.txt']), # Globstars change what they mean depending upon where they are ( 'foo/**/bar', ['foo/bing/bar', 'foo/bing/bang/bar', 'foo/bar'], ['foo/abar'], ), ( 'foo/**', ['foo/bar/bing.py', 'foo/x'], ['/foo/x'], ), ( '**', ['x', 'abc/xyz', '@nything'], [], ), # Character classes ( 'pre[one]post', ['preopost', 'prenpost', 'preepost'], ['prepost', 'preonepost'], ), ( 'hello[!one]world', ['helloxworld', 'helloyworld'], ['hellooworld', 'helloworld', 'hellooneworld'], ), ( '[]one].txt', ['o.txt', '].txt', 'e.txt'], ['one].txt'], ), ( 'foo[!]one]bar', ['fooybar'], ['foo]bar', 'fooobar', 'fooebar'], ),]"""A spec of inputs for 'translate_pattern' and matches and mismatchesfor that input."""
match_params = itertools.chain.from_iterable( zip(itertools.repeat(pattern), matches) for pattern, matches, mismatches in translate_specs)
@pytest.fixture(params=match_params)def pattern_match(request): return map(make_local_path, request.param)
mismatch_params = itertools.chain.from_iterable( zip(itertools.repeat(pattern), mismatches) for pattern, matches, mismatches in translate_specs)
@pytest.fixture(params=mismatch_params)def pattern_mismatch(request): return map(make_local_path, request.param)
def test_translated_pattern_match(pattern_match): pattern, target = pattern_match assert translate_pattern(pattern).match(target)
def test_translated_pattern_mismatch(pattern_mismatch): pattern, target = pattern_mismatch assert not translate_pattern(pattern).match(target)
class TempDirTestCase: def setup_method(self, method): self.temp_dir = tempfile.mkdtemp() self.old_cwd = os.getcwd() os.chdir(self.temp_dir)
def teardown_method(self, method): os.chdir(self.old_cwd) shutil.rmtree(self.temp_dir)
class TestManifestTest(TempDirTestCase): def setup_method(self, method): super().setup_method(method)
f = open(os.path.join(self.temp_dir, 'setup.py'), 'w', encoding="utf-8") f.write(SETUP_PY) f.close() """ Create a file tree like: - LICENSE - README.rst - testing.rst - .hidden.rst - app/ - __init__.py - a.txt - b.txt - c.rst - static/ - app.js - app.js.map - app.css - app.css.map """
for fname in ['README.rst', '.hidden.rst', 'testing.rst', 'LICENSE']: touch(os.path.join(self.temp_dir, fname))
# Set up the rest of the test package test_pkg = os.path.join(self.temp_dir, 'app') os.mkdir(test_pkg) for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst']: touch(os.path.join(test_pkg, fname))
# Some compiled front-end assets to include static = os.path.join(test_pkg, 'static') os.mkdir(static) for fname in ['app.js', 'app.js.map', 'app.css', 'app.css.map']: touch(os.path.join(static, fname))
def make_manifest(self, contents): """Write a MANIFEST.in.""" manifest = os.path.join(self.temp_dir, 'MANIFEST.in') with open(manifest, 'w', encoding="utf-8") as f: f.write(DALS(contents))
def get_files(self): """Run egg_info and get all the files to include, as a set""" dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = egg_info(dist) cmd.ensure_finalized()
cmd.run()
return set(cmd.filelist.files)
def test_no_manifest(self): """Check a missing MANIFEST.in includes only the standard files.""" assert (default_files - set(['MANIFEST.in'])) == self.get_files()
def test_empty_files(self): """Check an empty MANIFEST.in includes only the standard files.""" self.make_manifest("") assert default_files == self.get_files()
def test_include(self): """Include extra rst files in the project root.""" self.make_manifest("include *.rst") files = default_files | set(['testing.rst', '.hidden.rst']) assert files == self.get_files()
def test_exclude(self): """Include everything in app/ except the text files""" ml = make_local_path self.make_manifest( """ include app/* exclude app/*.txt """ ) files = default_files | set([ml('app/c.rst')]) assert files == self.get_files()
def test_include_multiple(self): """Include with multiple patterns.""" ml = make_local_path self.make_manifest("include app/*.txt app/static/*") files = default_files | set([ ml('app/a.txt'), ml('app/b.txt'), ml('app/static/app.js'), ml('app/static/app.js.map'), ml('app/static/app.css'), ml('app/static/app.css.map'), ]) assert files == self.get_files()
def test_graft(self): """Include the whole app/static/ directory.""" ml = make_local_path self.make_manifest("graft app/static") files = default_files | set([ ml('app/static/app.js'), ml('app/static/app.js.map'), ml('app/static/app.css'), ml('app/static/app.css.map'), ]) assert files == self.get_files()
def test_graft_glob_syntax(self): """Include the whole app/static/ directory.""" ml = make_local_path self.make_manifest("graft */static") files = default_files | set([ ml('app/static/app.js'), ml('app/static/app.js.map'), ml('app/static/app.css'), ml('app/static/app.css.map'), ]) assert files == self.get_files()
def test_graft_global_exclude(self): """Exclude all *.map files in the project.""" ml = make_local_path self.make_manifest( """ graft app/static global-exclude *.map """ ) files = default_files | set([ml('app/static/app.js'), ml('app/static/app.css')]) assert files == self.get_files()
def test_global_include(self): """Include all *.rst, *.js, and *.css files in the whole tree.""" ml = make_local_path self.make_manifest( """ global-include *.rst *.js *.css """ ) files = default_files | set([ '.hidden.rst', 'testing.rst', ml('app/c.rst'), ml('app/static/app.js'), ml('app/static/app.css'), ]) assert files == self.get_files()
def test_graft_prune(self): """Include all files in app/, except for the whole app/static/ dir.""" ml = make_local_path self.make_manifest( """ graft app prune app/static """ ) files = default_files | set([ml('app/a.txt'), ml('app/b.txt'), ml('app/c.rst')]) assert files == self.get_files()
class TestFileListTest(TempDirTestCase): """ A copy of the relevant bits of distutils/tests/test_filelist.py, to ensure setuptools' version of FileList keeps parity with distutils. """
@pytest.fixture(autouse=os.getenv("SETUPTOOLS_USE_DISTUTILS") == "stdlib") def _compat_record_logs(self, monkeypatch, caplog): """Account for stdlib compatibility"""
def _log(_logger, level, msg, args): exc = sys.exc_info() rec = logging.LogRecord("distutils", level, "", 0, msg, args, exc) caplog.records.append(rec)
monkeypatch.setattr(log.Log, "_log", _log)
def get_records(self, caplog, *levels): return [r for r in caplog.records if r.levelno in levels]
def assertNoWarnings(self, caplog): assert self.get_records(caplog, log.WARN) == [] caplog.clear()
def assertWarnings(self, caplog): if IS_PYPY and not caplog.records: pytest.xfail("caplog checks may not work well in PyPy") else: assert len(self.get_records(caplog, log.WARN)) > 0 caplog.clear()
def make_files(self, files): for file in files: file = os.path.join(self.temp_dir, file) dirname, _basename = os.path.split(file) os.makedirs(dirname, exist_ok=True) touch(file)
def test_process_template_line(self): # testing all MANIFEST.in template patterns file_list = FileList() ml = make_local_path
# simulated file list self.make_files([ 'foo.tmp', 'ok', 'xo', 'four.txt', 'buildout.cfg', # filelist does not filter out VCS directories, # it's sdist that does ml('.hg/last-message.txt'), ml('global/one.txt'), ml('global/two.txt'), ml('global/files.x'), ml('global/here.tmp'), ml('f/o/f.oo'), ml('dir/graft-one'), ml('dir/dir2/graft2'), ml('dir3/ok'), ml('dir3/sub/ok.txt'), ])
MANIFEST_IN = DALS( """\ include ok include xo exclude xo include foo.tmp include buildout.cfg global-include *.x global-include *.txt global-exclude *.tmp recursive-include f *.oo recursive-exclude global *.x graft dir prune dir3 """ )
for line in MANIFEST_IN.split('\n'): if not line: continue file_list.process_template_line(line)
wanted = [ 'buildout.cfg', 'four.txt', 'ok', ml('.hg/last-message.txt'), ml('dir/graft-one'), ml('dir/dir2/graft2'), ml('f/o/f.oo'), ml('global/one.txt'), ml('global/two.txt'), ]
file_list.sort() assert file_list.files == wanted
def test_exclude_pattern(self): # return False if no match file_list = FileList() assert not file_list.exclude_pattern('*.py')
# return True if files match file_list = FileList() file_list.files = ['a.py', 'b.py'] assert file_list.exclude_pattern('*.py')
# test excludes file_list = FileList() file_list.files = ['a.py', 'a.txt'] file_list.exclude_pattern('*.py') file_list.sort() assert file_list.files == ['a.txt']
def test_include_pattern(self): # return False if no match file_list = FileList() self.make_files([]) assert not file_list.include_pattern('*.py')
# return True if files match file_list = FileList() self.make_files(['a.py', 'b.txt']) assert file_list.include_pattern('*.py')
# test * matches all files file_list = FileList() self.make_files(['a.py', 'b.txt']) file_list.include_pattern('*') file_list.sort() assert file_list.files == ['a.py', 'b.txt']
def test_process_template_line_invalid(self): # invalid lines file_list = FileList() for action in ( 'include', 'exclude', 'global-include', 'global-exclude', 'recursive-include', 'recursive-exclude', 'graft', 'prune', 'blarg', ): with pytest.raises(DistutilsTemplateError): file_list.process_template_line(action)
def test_include(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # include file_list = FileList() self.make_files(['a.py', 'b.txt', ml('d/c.py')])
file_list.process_template_line('include *.py') file_list.sort() assert file_list.files == ['a.py'] self.assertNoWarnings(caplog)
file_list.process_template_line('include *.rb') file_list.sort() assert file_list.files == ['a.py'] self.assertWarnings(caplog)
def test_exclude(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # exclude file_list = FileList() file_list.files = ['a.py', 'b.txt', ml('d/c.py')]
file_list.process_template_line('exclude *.py') file_list.sort() assert file_list.files == ['b.txt', ml('d/c.py')] self.assertNoWarnings(caplog)
file_list.process_template_line('exclude *.rb') file_list.sort() assert file_list.files == ['b.txt', ml('d/c.py')] self.assertWarnings(caplog)
def test_global_include(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # global-include file_list = FileList() self.make_files(['a.py', 'b.txt', ml('d/c.py')])
file_list.process_template_line('global-include *.py') file_list.sort() assert file_list.files == ['a.py', ml('d/c.py')] self.assertNoWarnings(caplog)
file_list.process_template_line('global-include *.rb') file_list.sort() assert file_list.files == ['a.py', ml('d/c.py')] self.assertWarnings(caplog)
def test_global_exclude(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # global-exclude file_list = FileList() file_list.files = ['a.py', 'b.txt', ml('d/c.py')]
file_list.process_template_line('global-exclude *.py') file_list.sort() assert file_list.files == ['b.txt'] self.assertNoWarnings(caplog)
file_list.process_template_line('global-exclude *.rb') file_list.sort() assert file_list.files == ['b.txt'] self.assertWarnings(caplog)
def test_recursive_include(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # recursive-include file_list = FileList() self.make_files(['a.py', ml('d/b.py'), ml('d/c.txt'), ml('d/d/e.py')])
file_list.process_template_line('recursive-include d *.py') file_list.sort() assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')] self.assertNoWarnings(caplog)
file_list.process_template_line('recursive-include e *.py') file_list.sort() assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')] self.assertWarnings(caplog)
def test_recursive_exclude(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # recursive-exclude file_list = FileList() file_list.files = ['a.py', ml('d/b.py'), ml('d/c.txt'), ml('d/d/e.py')]
file_list.process_template_line('recursive-exclude d *.py') file_list.sort() assert file_list.files == ['a.py', ml('d/c.txt')] self.assertNoWarnings(caplog)
file_list.process_template_line('recursive-exclude e *.py') file_list.sort() assert file_list.files == ['a.py', ml('d/c.txt')] self.assertWarnings(caplog)
def test_graft(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # graft file_list = FileList() self.make_files(['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')])
file_list.process_template_line('graft d') file_list.sort() assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')] self.assertNoWarnings(caplog)
file_list.process_template_line('graft e') file_list.sort() assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')] self.assertWarnings(caplog)
def test_prune(self, caplog): caplog.set_level(logging.DEBUG) ml = make_local_path # prune file_list = FileList() file_list.files = ['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')]
file_list.process_template_line('prune d') file_list.sort() assert file_list.files == ['a.py', ml('f/f.py')] self.assertNoWarnings(caplog)
file_list.process_template_line('prune e') file_list.sort() assert file_list.files == ['a.py', ml('f/f.py')] self.assertWarnings(caplog)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138import subprocessimport sys
from setuptools._path import paths_on_pythonpath
from . import namespaces
class TestNamespaces: def test_mixed_site_and_non_site(self, tmpdir): """ Installing two packages sharing the same namespace, one installed to a site dir and the other installed just to a path on PYTHONPATH should leave the namespace in tact and both packages reachable by import. """ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB') site_packages = tmpdir / 'site-packages' path_packages = tmpdir / 'path-packages' targets = site_packages, path_packages # use pip to install to the target directory install_cmd = [ sys.executable, '-m', 'pip.__main__', 'install', str(pkg_A), '-t', str(site_packages), ] subprocess.check_call(install_cmd) namespaces.make_site_dir(site_packages) install_cmd = [ sys.executable, '-m', 'pip.__main__', 'install', str(pkg_B), '-t', str(path_packages), ] subprocess.check_call(install_cmd) try_import = [ sys.executable, '-c', 'import myns.pkgA; import myns.pkgB', ] with paths_on_pythonpath(map(str, targets)): subprocess.check_call(try_import)
def test_pkg_resources_import(self, tmpdir): """ Ensure that a namespace package doesn't break on import of pkg_resources. """ pkg = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') target = tmpdir / 'packages' target.mkdir() install_cmd = [ sys.executable, '-m', 'pip', 'install', '-t', str(target), str(pkg), ] with paths_on_pythonpath([str(target)]): subprocess.check_call(install_cmd) namespaces.make_site_dir(target) try_import = [ sys.executable, '-c', 'import pkg_resources', ] with paths_on_pythonpath([str(target)]): subprocess.check_call(try_import)
def test_namespace_package_installed_and_cwd(self, tmpdir): """ Installing a namespace packages but also having it in the current working directory, only one version should take precedence. """ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') target = tmpdir / 'packages' # use pip to install to the target directory install_cmd = [ sys.executable, '-m', 'pip.__main__', 'install', str(pkg_A), '-t', str(target), ] subprocess.check_call(install_cmd) namespaces.make_site_dir(target)
# ensure that package imports and pkg_resources imports pkg_resources_imp = [ sys.executable, '-c', 'import pkg_resources; import myns.pkgA', ] with paths_on_pythonpath([str(target)]): subprocess.check_call(pkg_resources_imp, cwd=str(pkg_A))
def test_packages_in_the_same_namespace_installed_and_cwd(self, tmpdir): """ Installing one namespace package and also have another in the same namespace in the current working directory, both of them must be importable. """ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB') target = tmpdir / 'packages' # use pip to install to the target directory install_cmd = [ sys.executable, '-m', 'pip.__main__', 'install', str(pkg_A), '-t', str(target), ] subprocess.check_call(install_cmd) namespaces.make_site_dir(target)
# ensure that all packages import and pkg_resources imports pkg_resources_imp = [ sys.executable, '-c', 'import pkg_resources; import myns.pkgA; import myns.pkgB', ] with paths_on_pythonpath([str(target)]): subprocess.check_call(pkg_resources_imp, cwd=str(pkg_B))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267import http.clientimport reimport urllib.errorimport urllib.requestfrom inspect import cleandoc
import pytest
import setuptools.package_index
import distutils.errors
class TestPackageIndex: def test_regex(self): hash_url = 'http://other_url?:action=show_md5&' hash_url += 'digest=0123456789abcdef0123456789abcdef' doc = """ <a href="http://some_url">Name</a> (<a title="MD5 hash" href="{hash_url}">md5</a>) """.lstrip().format(**locals()) assert setuptools.package_index.PYPI_MD5.match(doc)
def test_bad_url_bad_port(self): index = setuptools.package_index.PackageIndex() url = 'http://127.0.0.1:0/nonesuch/test_package_index' with pytest.raises(Exception, match=re.escape(url)): v = index.open_url(url) assert isinstance(v, urllib.error.HTTPError)
def test_bad_url_typo(self): # issue 16 # easy_install inquant.contentmirror.plone breaks because of a typo # in its home URL index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
url = 'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
with pytest.raises(Exception, match=re.escape(url)): v = index.open_url(url) assert isinstance(v, urllib.error.HTTPError)
def test_bad_url_bad_status_line(self): index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
def _urlopen(*args): raise http.client.BadStatusLine('line')
index.opener = _urlopen url = 'http://example.com' with pytest.raises(Exception, match=r'line'): index.open_url(url)
def test_bad_url_double_scheme(self): """ A bad URL with a double scheme should raise a DistutilsError. """ index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
# issue 20 url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk' try: index.open_url(url) except distutils.errors.DistutilsError as error: msg = str(error) assert ( 'nonnumeric port' in msg or 'getaddrinfo failed' in msg or 'Name or service not known' in msg ) return raise RuntimeError("Did not raise")
def test_url_ok(self): index = setuptools.package_index.PackageIndex(hosts=('www.example.com',)) url = 'file:///tmp/test_package_index' assert index.url_ok(url, True)
def test_parse_bdist_wininst(self): parse = setuptools.package_index.parse_bdist_wininst
actual = parse('reportlab-2.5.win32-py2.4.exe') expected = 'reportlab-2.5', '2.4', 'win32' assert actual == expected
actual = parse('reportlab-2.5.win32.exe') expected = 'reportlab-2.5', None, 'win32' assert actual == expected
actual = parse('reportlab-2.5.win-amd64-py2.7.exe') expected = 'reportlab-2.5', '2.7', 'win-amd64' assert actual == expected
actual = parse('reportlab-2.5.win-amd64.exe') expected = 'reportlab-2.5', None, 'win-amd64' assert actual == expected
def test__vcs_split_rev_from_url(self): """ Test the basic usage of _vcs_split_rev_from_url """ vsrfu = setuptools.package_index.PackageIndex._vcs_split_rev_from_url url, rev = vsrfu('https://example.com/bar@2995') assert url == 'https://example.com/bar' assert rev == '2995'
def test_local_index(self, tmpdir): """ local_open should be able to read an index from the file system. """ index_file = tmpdir / 'index.html' with index_file.open('w') as f: f.write('<div>content</div>') url = 'file:' + urllib.request.pathname2url(str(tmpdir)) + '/' res = setuptools.package_index.local_open(url) assert 'content' in res.read()
def test_egg_fragment(self): """ EGG fragments must comply to PEP 440 """ epoch = [ '', '1!', ] releases = [ '0', '0.0', '0.0.0', ] pre = [ 'a0', 'b0', 'rc0', ] post = ['.post0'] dev = [ '.dev0', ] local = [ ('', ''), ('+ubuntu.0', '+ubuntu.0'), ('+ubuntu-0', '+ubuntu.0'), ('+ubuntu_0', '+ubuntu.0'), ] versions = [ [''.join([e, r, p, loc]) for loc in locs] for e in epoch for r in releases for p in sum([pre, post, dev], ['']) for locs in local ] for v, vc in versions: dists = list( setuptools.package_index.distros_for_url( 'http://example.com/example-foo.zip#egg=example-foo-' + v ) ) assert dists[0].version == '' assert dists[1].version == vc
def test_download_git_with_rev(self, tmp_path, fp): url = 'git+https://github.example/group/project@master#egg=foo' index = setuptools.package_index.PackageIndex()
expected_dir = tmp_path / 'project@master' fp.register([ 'git', 'clone', '--quiet', 'https://github.example/group/project', expected_dir, ]) fp.register(['git', '-C', expected_dir, 'checkout', '--quiet', 'master'])
result = index.download(url, tmp_path)
assert result == str(expected_dir) assert len(fp.calls) == 2
def test_download_git_no_rev(self, tmp_path, fp): url = 'git+https://github.example/group/project#egg=foo' index = setuptools.package_index.PackageIndex()
expected_dir = tmp_path / 'project' fp.register([ 'git', 'clone', '--quiet', 'https://github.example/group/project', expected_dir, ]) index.download(url, tmp_path)
def test_download_svn(self, tmp_path): url = 'svn+https://svn.example/project#egg=foo' index = setuptools.package_index.PackageIndex()
msg = r".*SVN download is not supported.*" with pytest.raises(distutils.errors.DistutilsError, match=msg): index.download(url, tmp_path)
class TestContentCheckers: def test_md5(self): checker = setuptools.package_index.HashChecker.from_url( 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' ) checker.feed('You should probably not be using MD5'.encode('ascii')) assert checker.hash.hexdigest() == 'f12895fdffbd45007040d2e44df98478' assert checker.is_valid()
def test_other_fragment(self): "Content checks should succeed silently if no hash is present" checker = setuptools.package_index.HashChecker.from_url( 'http://foo/bar#something%20completely%20different' ) checker.feed('anything'.encode('ascii')) assert checker.is_valid()
def test_blank_md5(self): "Content checks should succeed if a hash is empty" checker = setuptools.package_index.HashChecker.from_url('http://foo/bar#md5=') checker.feed('anything'.encode('ascii')) assert checker.is_valid()
def test_get_hash_name_md5(self): checker = setuptools.package_index.HashChecker.from_url( 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' ) assert checker.hash_name == 'md5'
def test_report(self): checker = setuptools.package_index.HashChecker.from_url( 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' ) rep = checker.report(lambda x: x, 'My message about %s') assert rep == 'My message about md5'
class TestPyPIConfig: def test_percent_in_password(self, tmp_home_dir): pypirc = tmp_home_dir / '.pypirc' pypirc.write_text( cleandoc( """ [pypi] repository=https://pypi.org username=jaraco password=pity% """ ), encoding="utf-8", ) cfg = setuptools.package_index.PyPIConfig() cred = cfg.creds_by_repository['https://pypi.org'] assert cred.username == 'jaraco' assert cred.password == 'pity%'
@pytest.mark.timeout(1)def test_REL_DoS(): """ REL should not hang on a contrived attack string. """ setuptools.package_index.REL.search('< rel=' + ' ' * 2**12)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134"""develop tests"""
import osimport types
import pytest
import pkg_resourcesimport setuptools.sandbox
class TestSandbox: def test_devnull(self, tmpdir): with setuptools.sandbox.DirectorySandbox(str(tmpdir)): self._file_writer(os.devnull)
@staticmethod def _file_writer(path): def do_write(): with open(path, 'w', encoding="utf-8") as f: f.write('xxx')
return do_write
def test_setup_py_with_BOM(self): """ It should be possible to execute a setup.py with a Byte Order Mark """ target = pkg_resources.resource_filename(__name__, 'script-with-bom.py') namespace = types.ModuleType('namespace') setuptools.sandbox._execfile(target, vars(namespace)) assert namespace.result == 'passed'
def test_setup_py_with_CRLF(self, tmpdir): setup_py = tmpdir / 'setup.py' with setup_py.open('wb') as stream: stream.write(b'"degenerate script"\r\n') setuptools.sandbox._execfile(str(setup_py), globals())
class TestExceptionSaver: def test_exception_trapped(self): with setuptools.sandbox.ExceptionSaver(): raise ValueError("details")
def test_exception_resumed(self): with setuptools.sandbox.ExceptionSaver() as saved_exc: raise ValueError("details")
with pytest.raises(ValueError) as caught: saved_exc.resume()
assert isinstance(caught.value, ValueError) assert str(caught.value) == 'details'
def test_exception_reconstructed(self): orig_exc = ValueError("details")
with setuptools.sandbox.ExceptionSaver() as saved_exc: raise orig_exc
with pytest.raises(ValueError) as caught: saved_exc.resume()
assert isinstance(caught.value, ValueError) assert caught.value is not orig_exc
def test_no_exception_passes_quietly(self): with setuptools.sandbox.ExceptionSaver() as saved_exc: pass
saved_exc.resume()
def test_unpickleable_exception(self): class CantPickleThis(Exception): "This Exception is unpickleable because it's not in globals"
def __repr__(self) -> str: return f'CantPickleThis{self.args!r}'
with setuptools.sandbox.ExceptionSaver() as saved_exc: raise CantPickleThis('detail')
with pytest.raises(setuptools.sandbox.UnpickleableException) as caught: saved_exc.resume()
assert str(caught.value) == "CantPickleThis('detail',)"
def test_unpickleable_exception_when_hiding_setuptools(self): """ As revealed in #440, an infinite recursion can occur if an unpickleable exception while setuptools is hidden. Ensure this doesn't happen. """
class ExceptionUnderTest(Exception): """ An unpickleable exception (not in globals). """
with pytest.raises(setuptools.sandbox.UnpickleableException) as caught: with setuptools.sandbox.save_modules(): setuptools.sandbox.hide_setuptools() raise ExceptionUnderTest
(msg,) = caught.value.args assert msg == 'ExceptionUnderTest()'
def test_sandbox_violation_raised_hiding_setuptools(self, tmpdir): """ When in a sandbox with setuptools hidden, a SandboxViolation should reflect a proper exception and not be wrapped in an UnpickleableException. """
def write_file(): "Trigger a SandboxViolation by writing outside the sandbox" with open('/etc/foo', 'w', encoding="utf-8"): pass
with pytest.raises(setuptools.sandbox.SandboxViolation) as caught: with setuptools.sandbox.save_modules(): setuptools.sandbox.hide_setuptools() with setuptools.sandbox.DirectorySandbox(str(tmpdir)): write_file()
cmd, args, kwargs = caught.value.args assert cmd == 'open' assert args == ('/etc/foo', 'w') assert kwargs == {"encoding": "utf-8"}
msg = str(caught.value) assert 'open' in msg assert "('/etc/foo', 'w')" in msg assert "{'encoding': 'utf-8'}" in msg123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984"""sdist tests"""
import contextlibimport ioimport loggingimport osimport pathlibimport sysimport tarfileimport tempfileimport unicodedatafrom inspect import cleandocfrom pathlib import Pathfrom unittest import mock
import jaraco.pathimport pytest
from setuptools import Command, SetuptoolsDeprecationWarningfrom setuptools._importlib import metadatafrom setuptools.command.egg_info import manifest_makerfrom setuptools.command.sdist import sdistfrom setuptools.dist import Distributionfrom setuptools.extension import Extensionfrom setuptools.tests import fail_on_ascii
from .text import Filenames
import distutilsfrom distutils.core import run_setup
SETUP_ATTRS = { 'name': 'sdist_test', 'version': '0.0', 'packages': ['sdist_test'], 'package_data': {'sdist_test': ['*.txt']}, 'data_files': [("data", [os.path.join("d", "e.dat")])],}
SETUP_PY = f"""\from setuptools import setup
setup(**{SETUP_ATTRS!r})"""
EXTENSION = Extension( name="sdist_test.f", sources=[os.path.join("sdist_test", "f.c")], depends=[os.path.join("sdist_test", "f.h")],)EXTENSION_SOURCES = EXTENSION.sources + EXTENSION.depends
@contextlib.contextmanagerdef quiet(): old_stdout, old_stderr = sys.stdout, sys.stderr sys.stdout, sys.stderr = io.StringIO(), io.StringIO() try: yield finally: sys.stdout, sys.stderr = old_stdout, old_stderr
# Convert to POSIX pathdef posix(path): if not isinstance(path, str): return path.replace(os.sep.encode('ascii'), b'/') else: return path.replace(os.sep, '/')
# HFS Plus uses decomposed UTF-8def decompose(path): if isinstance(path, str): return unicodedata.normalize('NFD', path) try: path = path.decode('utf-8') path = unicodedata.normalize('NFD', path) path = path.encode('utf-8') except UnicodeError: pass # Not UTF-8 return path
def read_all_bytes(filename): with open(filename, 'rb') as fp: return fp.read()
def latin1_fail(): try: desc, filename = tempfile.mkstemp(suffix=Filenames.latin_1) os.close(desc) os.remove(filename) except Exception: return True
fail_on_latin1_encoded_filenames = pytest.mark.xfail( latin1_fail(), reason="System does not support latin-1 filenames",)
skip_under_xdist = pytest.mark.skipif( "os.environ.get('PYTEST_XDIST_WORKER')", reason="pytest-dev/pytest-xdist#843",)skip_under_stdlib_distutils = pytest.mark.skipif( not distutils.__package__.startswith('setuptools'), reason="the test is not supported with stdlib distutils",)
def touch(path): open(path, 'wb').close() return path
def symlink_or_skip_test(src, dst): try: os.symlink(src, dst) except (OSError, NotImplementedError): pytest.skip("symlink not supported in OS") return None return dst
class TestSdistTest: @pytest.fixture(autouse=True) def source_dir(self, tmpdir): tmpdir = tmpdir / "project_root" tmpdir.mkdir()
(tmpdir / 'setup.py').write_text(SETUP_PY, encoding='utf-8')
# Set up the rest of the test package test_pkg = tmpdir / 'sdist_test' test_pkg.mkdir() data_folder = tmpdir / 'd' data_folder.mkdir() # *.rst was not included in package_data, so c.rst should not be # automatically added to the manifest when not under version control for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst']: touch(test_pkg / fname) touch(data_folder / 'e.dat') # C sources are not included by default, but they will be, # if an extension module uses them as sources or depends for fname in EXTENSION_SOURCES: touch(tmpdir / fname)
with tmpdir.as_cwd(): yield tmpdir
def assert_package_data_in_manifest(self, cmd): manifest = cmd.filelist.files assert os.path.join('sdist_test', 'a.txt') in manifest assert os.path.join('sdist_test', 'b.txt') in manifest assert os.path.join('sdist_test', 'c.rst') not in manifest assert os.path.join('d', 'e.dat') in manifest
def setup_with_extension(self): setup_attrs = {**SETUP_ATTRS, 'ext_modules': [EXTENSION]}
dist = Distribution(setup_attrs) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
return cmd
def test_package_data_in_sdist(self): """Regression test for pull request #4: ensures that files listed in package_data are included in the manifest even if they're not added to version control. """
dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
self.assert_package_data_in_manifest(cmd)
def test_package_data_and_include_package_data_in_sdist(self): """ Ensure package_data and include_package_data work together. """ setup_attrs = {**SETUP_ATTRS, 'include_package_data': True} assert setup_attrs['package_data']
dist = Distribution(setup_attrs) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
self.assert_package_data_in_manifest(cmd)
def test_extension_sources_in_sdist(self): """ Ensure that the files listed in Extension.sources and Extension.depends are automatically included in the manifest. """ cmd = self.setup_with_extension() self.assert_package_data_in_manifest(cmd) manifest = cmd.filelist.files for path in EXTENSION_SOURCES: assert path in manifest
def test_missing_extension_sources(self): """ Similar to test_extension_sources_in_sdist but the referenced files don't exist. Missing files should not be included in distribution (with no error raised). """ for path in EXTENSION_SOURCES: os.remove(path)
cmd = self.setup_with_extension() self.assert_package_data_in_manifest(cmd) manifest = cmd.filelist.files for path in EXTENSION_SOURCES: assert path not in manifest
def test_symlinked_extension_sources(self): """ Similar to test_extension_sources_in_sdist but the referenced files are instead symbolic links to project-local files. Referenced file paths should be included. Symlink targets themselves should NOT be included. """ symlinked = [] for path in EXTENSION_SOURCES: base, ext = os.path.splitext(path) target = base + "_target." + ext
os.rename(path, target) symlink_or_skip_test(os.path.basename(target), path) symlinked.append(target)
cmd = self.setup_with_extension() self.assert_package_data_in_manifest(cmd) manifest = cmd.filelist.files for path in EXTENSION_SOURCES: assert path in manifest for path in symlinked: assert path not in manifest
_INVALID_PATHS = { "must be relative": lambda: ( os.path.abspath(os.path.join("sdist_test", "f.h")) ), "can't have `..` segments": lambda: ( os.path.join("sdist_test", "..", "sdist_test", "f.h") ), "doesn't exist": lambda: ( os.path.join("sdist_test", "this_file_does_not_exist.h") ), "must be inside the project root": lambda: ( symlink_or_skip_test( touch(os.path.join("..", "outside_of_project_root.h")), "symlink.h", ) ), }
@skip_under_stdlib_distutils @pytest.mark.parametrize("reason", _INVALID_PATHS.keys()) def test_invalid_extension_depends(self, reason, caplog): """ Due to backwards compatibility reasons, `Extension.depends` should accept invalid/weird paths, but then ignore them when building a sdist.
This test verifies that the source distribution is still built successfully with such paths, but that instead of adding these paths to the manifest, we emit an informational message, notifying the user that the invalid path won't be automatically included. """ invalid_path = self._INVALID_PATHS[reason]() extension = Extension( name="sdist_test.f", sources=[], depends=[invalid_path], ) setup_attrs = {**SETUP_ATTRS, 'ext_modules': [extension]}
dist = Distribution(setup_attrs) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(), caplog.at_level(logging.INFO): cmd.run()
self.assert_package_data_in_manifest(cmd) manifest = cmd.filelist.files assert invalid_path not in manifest
expected_message = [ message for (logger, level, message) in caplog.record_tuples if ( logger == "root" # and level == logging.INFO # and invalid_path in message # ) ] assert len(expected_message) == 1 (expected_message,) = expected_message assert reason in expected_message
def test_custom_build_py(self): """ Ensure projects defining custom build_py don't break when creating sdists (issue #2849) """ from distutils.command.build_py import build_py as OrigBuildPy
using_custom_command_guard = mock.Mock()
class CustomBuildPy(OrigBuildPy): """ Some projects have custom commands inheriting from `distutils` """
def get_data_files(self): using_custom_command_guard() return super().get_data_files()
setup_attrs = {**SETUP_ATTRS, 'include_package_data': True} assert setup_attrs['package_data']
dist = Distribution(setup_attrs) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
# Make sure we use the custom command cmd.cmdclass = {'build_py': CustomBuildPy} cmd.distribution.cmdclass = {'build_py': CustomBuildPy} assert cmd.distribution.get_command_class('build_py') == CustomBuildPy
msg = "setuptools instead of distutils" with quiet(), pytest.warns(SetuptoolsDeprecationWarning, match=msg): cmd.run()
using_custom_command_guard.assert_called() self.assert_package_data_in_manifest(cmd)
def test_setup_py_exists(self): dist = Distribution(SETUP_ATTRS) dist.script_name = 'foo.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
manifest = cmd.filelist.files assert 'setup.py' in manifest
def test_setup_py_missing(self): dist = Distribution(SETUP_ATTRS) dist.script_name = 'foo.py' cmd = sdist(dist) cmd.ensure_finalized()
if os.path.exists("setup.py"): os.remove("setup.py") with quiet(): cmd.run()
manifest = cmd.filelist.files assert 'setup.py' not in manifest
def test_setup_py_excluded(self): with open("MANIFEST.in", "w", encoding="utf-8") as manifest_file: manifest_file.write("exclude setup.py")
dist = Distribution(SETUP_ATTRS) dist.script_name = 'foo.py' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
manifest = cmd.filelist.files assert 'setup.py' not in manifest
def test_defaults_case_sensitivity(self, source_dir): """ Make sure default files (README.*, etc.) are added in a case-sensitive way to avoid problems with packages built on Windows. """
touch(source_dir / 'readme.rst') touch(source_dir / 'SETUP.cfg')
dist = Distribution(SETUP_ATTRS) # the extension deliberately capitalized for this test # to make sure the actual filename (not capitalized) gets added # to the manifest dist.script_name = 'setup.PY' cmd = sdist(dist) cmd.ensure_finalized()
with quiet(): cmd.run()
# lowercase all names so we can test in a # case-insensitive way to make sure the files # are not included. manifest = map(lambda x: x.lower(), cmd.filelist.files) assert 'readme.rst' not in manifest, manifest assert 'setup.py' not in manifest, manifest assert 'setup.cfg' not in manifest, manifest
def test_exclude_dev_only_cache_folders(self, source_dir): included = { # Emulate problem in https://github.com/pypa/setuptools/issues/4601 "MANIFEST.in": ( "global-include LICEN[CS]E* COPYING* NOTICE* AUTHORS*\n" "global-include *.txt\n" ), # For the sake of being conservative and limiting unforeseen side-effects # we just exclude dev-only cache folders at the root of the repository: "test/.venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rst": "", "src/.nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txt": "", "doc/.tox/default/lib/python3.11/site-packages/foo-4.dist-info/LICENSE": "", # Let's test against false positives with similarly named files: ".venv-requirements.txt": "", ".tox-coveragerc.txt": "", ".noxy/coveragerc.txt": "", }
excluded = { # .tox/.nox/.venv are well-know folders present at the root of Python repos # and therefore should be excluded ".tox/release/lib/python3.11/site-packages/foo-4.dist-info/LICENSE": "", ".nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txt": "", ".venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rst": "", }
for file, content in {**excluded, **included}.items(): Path(source_dir, file).parent.mkdir(parents=True, exist_ok=True) Path(source_dir, file).write_text(content, encoding="utf-8")
cmd = self.setup_with_extension() self.assert_package_data_in_manifest(cmd) manifest = {f.replace(os.sep, '/') for f in cmd.filelist.files} for path in excluded: assert os.path.exists(path) assert path not in manifest, (path, manifest) for path in included: assert os.path.exists(path) assert path in manifest, (path, manifest)
@fail_on_ascii def test_manifest_is_written_with_utf8_encoding(self): # Test for #303. dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' mm = manifest_maker(dist) mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') os.mkdir('sdist_test.egg-info')
# UTF-8 filename filename = os.path.join('sdist_test', 'smörbröd.py')
# Must create the file or it will get stripped. touch(filename)
# Add UTF-8 filename and write manifest with quiet(): mm.run() mm.filelist.append(filename) mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded u_contents = contents.decode('UTF-8')
# The manifest should contain the UTF-8 filename assert posix(filename) in u_contents
@fail_on_ascii def test_write_manifest_allows_utf8_filenames(self): # Test for #303. dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' mm = manifest_maker(dist) mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') os.mkdir('sdist_test.egg-info')
filename = os.path.join(b'sdist_test', Filenames.utf_8)
# Must touch the file or risk removal touch(filename)
# Add filename and write manifest with quiet(): mm.run() u_filename = filename.decode('utf-8') mm.filelist.files.append(u_filename) # Re-write manifest mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded contents.decode('UTF-8')
# The manifest should contain the UTF-8 filename assert posix(filename) in contents
# The filelist should have been updated as well assert u_filename in mm.filelist.files
@skip_under_xdist def test_write_manifest_skips_non_utf8_filenames(self): """ Files that cannot be encoded to UTF-8 (specifically, those that weren't originally successfully decoded and have surrogate escapes) should be omitted from the manifest. See https://bitbucket.org/tarek/distribute/issue/303 for history. """ dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' mm = manifest_maker(dist) mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') os.mkdir('sdist_test.egg-info')
# Latin-1 filename filename = os.path.join(b'sdist_test', Filenames.latin_1)
# Add filename with surrogates and write manifest with quiet(): mm.run() u_filename = filename.decode('utf-8', 'surrogateescape') mm.filelist.append(u_filename) # Re-write manifest mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded contents.decode('UTF-8')
# The Latin-1 filename should have been skipped assert posix(filename) not in contents
# The filelist should have been updated as well assert u_filename not in mm.filelist.files
@fail_on_ascii def test_manifest_is_read_with_utf8_encoding(self): # Test for #303. dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
# Create manifest with quiet(): cmd.run()
# Add UTF-8 filename to manifest filename = os.path.join(b'sdist_test', Filenames.utf_8) cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') manifest = open(cmd.manifest, 'ab') manifest.write(b'\n' + filename) manifest.close()
# The file must exist to be included in the filelist touch(filename)
# Re-read manifest cmd.filelist.files = [] with quiet(): cmd.read_manifest()
# The filelist should contain the UTF-8 filename filename = filename.decode('utf-8') assert filename in cmd.filelist.files
@fail_on_latin1_encoded_filenames def test_read_manifest_skips_non_utf8_filenames(self): # Test for #303. dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
# Create manifest with quiet(): cmd.run()
# Add Latin-1 filename to manifest filename = os.path.join(b'sdist_test', Filenames.latin_1) cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') manifest = open(cmd.manifest, 'ab') manifest.write(b'\n' + filename) manifest.close()
# The file must exist to be included in the filelist touch(filename)
# Re-read manifest cmd.filelist.files = [] with quiet(): cmd.read_manifest()
# The Latin-1 filename should have been skipped filename = filename.decode('latin-1') assert filename not in cmd.filelist.files
@fail_on_ascii @fail_on_latin1_encoded_filenames def test_sdist_with_utf8_encoded_filename(self): # Test for #303. dist = Distribution(self.make_strings(SETUP_ATTRS)) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
filename = os.path.join(b'sdist_test', Filenames.utf_8) touch(filename)
with quiet(): cmd.run()
if sys.platform == 'darwin': filename = decompose(filename)
fs_enc = sys.getfilesystemencoding()
if sys.platform == 'win32': if fs_enc == 'cp1252': # Python mangles the UTF-8 filename filename = filename.decode('cp1252') assert filename in cmd.filelist.files else: filename = filename.decode('mbcs') assert filename in cmd.filelist.files else: filename = filename.decode('utf-8') assert filename in cmd.filelist.files
@classmethod def make_strings(cls, item): if isinstance(item, dict): return {key: cls.make_strings(value) for key, value in item.items()} if isinstance(item, list): return list(map(cls.make_strings, item)) return str(item)
@fail_on_latin1_encoded_filenames @skip_under_xdist def test_sdist_with_latin1_encoded_filename(self): # Test for #303. dist = Distribution(self.make_strings(SETUP_ATTRS)) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized()
# Latin-1 filename filename = os.path.join(b'sdist_test', Filenames.latin_1) touch(filename) assert os.path.isfile(filename)
with quiet(): cmd.run()
# not all windows systems have a default FS encoding of cp1252 if sys.platform == 'win32': # Latin-1 is similar to Windows-1252 however # on mbcs filesys it is not in latin-1 encoding fs_enc = sys.getfilesystemencoding() if fs_enc != 'mbcs': fs_enc = 'latin-1' filename = filename.decode(fs_enc)
assert filename in cmd.filelist.files else: # The Latin-1 filename should have been skipped filename = filename.decode('latin-1') assert filename not in cmd.filelist.files
_EXAMPLE_DIRECTIVES = { "setup.cfg - long_description and version": """ [metadata] name = testing version = file: src/VERSION.txt license_files = DOWHATYOUWANT long_description = file: README.rst, USAGE.rst """, "pyproject.toml - static readme/license files and dynamic version": """ [project] name = "testing" readme = "USAGE.rst" license-files = ["DOWHATYOUWANT"] dynamic = ["version"] [tool.setuptools.dynamic] version = {file = ["src/VERSION.txt"]} """, "pyproject.toml - directive with str instead of list": """ [project] name = "testing" readme = "USAGE.rst" license-files = ["DOWHATYOUWANT"] dynamic = ["version"] [tool.setuptools.dynamic] version = {file = "src/VERSION.txt"} """, "pyproject.toml - deprecated license table with file entry": """ [project] name = "testing" readme = "USAGE.rst" license = {file = "DOWHATYOUWANT"} dynamic = ["version"] [tool.setuptools.dynamic] version = {file = "src/VERSION.txt"} """, }
@pytest.mark.parametrize("config", _EXAMPLE_DIRECTIVES.keys()) @pytest.mark.filterwarnings( "ignore:.project.license. as a TOML table is deprecated" ) def test_add_files_referenced_by_config_directives(self, source_dir, config): config_file, _, _ = config.partition(" - ") config_text = self._EXAMPLE_DIRECTIVES[config] (source_dir / 'src').mkdir() (source_dir / 'src/VERSION.txt').write_text("0.42", encoding="utf-8") (source_dir / 'README.rst').write_text("hello world!", encoding="utf-8") (source_dir / 'USAGE.rst').write_text("hello world!", encoding="utf-8") (source_dir / 'DOWHATYOUWANT').write_text("hello world!", encoding="utf-8") (source_dir / config_file).write_text(config_text, encoding="utf-8")
dist = Distribution({"packages": []}) dist.script_name = 'setup.py' dist.parse_config_files()
cmd = sdist(dist) cmd.ensure_finalized() with quiet(): cmd.run()
assert ( 'src/VERSION.txt' in cmd.filelist.files or 'src\\VERSION.txt' in cmd.filelist.files ) assert 'USAGE.rst' in cmd.filelist.files assert 'DOWHATYOUWANT' in cmd.filelist.files assert '/' not in cmd.filelist.files assert '\\' not in cmd.filelist.files
def test_pyproject_toml_in_sdist(self, source_dir): """ Check if pyproject.toml is included in source distribution if present """ touch(source_dir / 'pyproject.toml') dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized() with quiet(): cmd.run() manifest = cmd.filelist.files assert 'pyproject.toml' in manifest
def test_pyproject_toml_excluded(self, source_dir): """ Check that pyproject.toml can excluded even if present """ touch(source_dir / 'pyproject.toml') with open('MANIFEST.in', 'w', encoding="utf-8") as mts: print('exclude pyproject.toml', file=mts) dist = Distribution(SETUP_ATTRS) dist.script_name = 'setup.py' cmd = sdist(dist) cmd.ensure_finalized() with quiet(): cmd.run() manifest = cmd.filelist.files assert 'pyproject.toml' not in manifest
def test_build_subcommand_source_files(self, source_dir): touch(source_dir / '.myfile~')
# Sanity check: without custom commands file list should not be affected dist = Distribution({**SETUP_ATTRS, "script_name": "setup.py"}) cmd = sdist(dist) cmd.ensure_finalized() with quiet(): cmd.run() manifest = cmd.filelist.files assert '.myfile~' not in manifest
# Test: custom command should be able to augment file list dist = Distribution({**SETUP_ATTRS, "script_name": "setup.py"}) build = dist.get_command_obj("build") build.sub_commands = [*build.sub_commands, ("build_custom", None)]
class build_custom(Command): def initialize_options(self): ...
def finalize_options(self): ...
def run(self): ...
def get_source_files(self): return ['.myfile~']
dist.cmdclass.update(build_custom=build_custom)
cmd = sdist(dist) cmd.use_defaults = True cmd.ensure_finalized() with quiet(): cmd.run() manifest = cmd.filelist.files assert '.myfile~' in manifest
@pytest.mark.skipif("os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'stdlib'") def test_build_base_pathlib(self, source_dir): """ Ensure if build_base is a pathlib.Path, the build still succeeds. """ dist = Distribution({ **SETUP_ATTRS, "script_name": "setup.py", "options": {"build": {"build_base": pathlib.Path('build')}}, }) cmd = sdist(dist) cmd.ensure_finalized() with quiet(): cmd.run()
def test_default_revctrl(): """ When _default_revctrl was removed from the `setuptools.command.sdist` module in 10.0, it broke some systems which keep an old install of setuptools (Distribute) around. Those old versions require that the setuptools package continue to implement that interface, so this function provides that interface, stubbed. See #320 for details.
This interface must be maintained until Ubuntu 12.04 is no longer supported (by Setuptools). """ (ep,) = metadata.EntryPoints._from_text( """ [setuptools.file_finders] svn_cvs = setuptools.command.sdist:_default_revctrl """ ) res = ep.load() assert hasattr(res, '__iter__')
class TestRegressions: """ Can be removed/changed if the project decides to change how it handles symlinks or external files. """
@staticmethod def files_for_symlink_in_extension_depends(tmp_path, dep_path): return { "external": { "dir": {"file.h": ""}, }, "project": { "setup.py": cleandoc( f""" from setuptools import Extension, setup setup( name="myproj", version="42", ext_modules=[ Extension( "hello", sources=["hello.pyx"], depends=[{dep_path!r}] ) ], ) """ ), "hello.pyx": "", "MANIFEST.in": "global-include *.h", }, }
@pytest.mark.parametrize( "dep_path", ("myheaders/dir/file.h", "myheaders/dir/../dir/file.h") ) def test_symlink_in_extension_depends(self, monkeypatch, tmp_path, dep_path): # Given a project with a symlinked dir and a "depends" targeting that dir files = self.files_for_symlink_in_extension_depends(tmp_path, dep_path) jaraco.path.build(files, prefix=str(tmp_path)) symlink_or_skip_test(tmp_path / "external", tmp_path / "project/myheaders")
# When `sdist` runs, there should be no error members = run_sdist(monkeypatch, tmp_path / "project") # and the sdist should contain the symlinked files for expected in ( "myproj-42/hello.pyx", "myproj-42/myheaders/dir/file.h", ): assert expected in members
@staticmethod def files_for_external_path_in_extension_depends(tmp_path, dep_path): head, _, tail = dep_path.partition("$tmp_path$/") dep_path = tmp_path / tail if tail else head
return { "external": { "dir": {"file.h": ""}, }, "project": { "setup.py": cleandoc( f""" from setuptools import Extension, setup setup( name="myproj", version="42", ext_modules=[ Extension( "hello", sources=["hello.pyx"], depends=[{str(dep_path)!r}] ) ], ) """ ), "hello.pyx": "", "MANIFEST.in": "global-include *.h", }, }
@pytest.mark.parametrize( "dep_path", ("$tmp_path$/external/dir/file.h", "../external/dir/file.h") ) def test_external_path_in_extension_depends(self, monkeypatch, tmp_path, dep_path): # Given a project with a "depends" targeting an external dir files = self.files_for_external_path_in_extension_depends(tmp_path, dep_path) jaraco.path.build(files, prefix=str(tmp_path)) # When `sdist` runs, there should be no error members = run_sdist(monkeypatch, tmp_path / "project") # and the sdist should not contain the external file for name in members: assert "file.h" not in name
def run_sdist(monkeypatch, project): """Given a project directory, run the sdist and return its contents""" monkeypatch.chdir(project) with quiet(): run_setup("setup.py", ["sdist"])
archive = next((project / "dist").glob("*.tar.gz")) with tarfile.open(str(archive)) as tar: return set(tar.getnames())
def test_sanity_check_setuptools_own_sdist(setuptools_sdist): with tarfile.open(setuptools_sdist) as tar: files = tar.getnames()
# setuptools sdist should not include the .tox folder tox_files = [name for name in files if ".tox" in name] assert len(tox_files) == 0, f"not empty {tox_files}"12345678910111213141516171819202122232425262728293031323334353637383940import configparser
from setuptools.command import setopt
class TestEdit: @staticmethod def parse_config(filename): parser = configparser.ConfigParser() with open(filename, encoding='utf-8') as reader: parser.read_file(reader) return parser
@staticmethod def write_text(file, content): with open(file, 'wb') as strm: strm.write(content.encode('utf-8'))
def test_utf8_encoding_retained(self, tmpdir): """ When editing a file, non-ASCII characters encoded in UTF-8 should be retained. """ config = tmpdir.join('setup.cfg') self.write_text(str(config), '[names]\njaraco=джарако') setopt.edit_config(str(config), dict(names=dict(other='yes'))) parser = self.parse_config(str(config)) assert parser.get('names', 'jaraco') == 'джарако' assert parser.get('names', 'other') == 'yes'
def test_case_retained(self, tmpdir): """ When editing a file, case of keys should be retained. """ config = tmpdir.join('setup.cfg') self.write_text(str(config), '[names]\nFoO=bAr') setopt.edit_config(str(config), dict(names=dict(oTher='yes'))) actual = config.read_text(encoding='ascii') assert 'FoO' in actual assert 'oTher' in actual123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290"""Tests for the 'setuptools' package"""
import osimport reimport sysfrom zipfile import ZipFile
import pytestfrom packaging.version import Version
import setuptoolsimport setuptools.depends as depimport setuptools.distfrom setuptools.depends import Require
import distutils.cmdimport distutils.corefrom distutils.core import Extensionfrom distutils.errors import DistutilsSetupError
@pytest.fixture(autouse=True)def isolated_dir(tmpdir_cwd): return
def makeSetup(**args): """Return distribution from 'setup(**args)', without executing commands"""
distutils.core._setup_stop_after = "commandline"
# Don't let system command line leak into tests! args.setdefault('script_args', ['install'])
try: return setuptools.setup(**args) finally: distutils.core._setup_stop_after = None
needs_bytecode = pytest.mark.skipif( not hasattr(dep, 'get_module_constant'), reason="bytecode support not available",)
class TestDepends: def testExtractConst(self): if not hasattr(dep, 'extract_constant'): # skip on non-bytecode platforms return
def f1(): global x, y, z x = "test" y = z # pyright: ignore[reportUnboundVariable] # Explicitly testing for this runtime issue
fc = f1.__code__
# unrecognized name assert dep.extract_constant(fc, 'q', -1) is None
# constant assigned assert dep.extract_constant(fc, 'x', -1) == "test"
# expression assigned assert dep.extract_constant(fc, 'y', -1) == -1
# recognized name, not assigned assert dep.extract_constant(fc, 'z', -1) is None
def testFindModule(self): with pytest.raises(ImportError): dep.find_module('no-such.-thing') with pytest.raises(ImportError): dep.find_module('setuptools.non-existent') f, _p, _i = dep.find_module('setuptools.tests') f.close()
@needs_bytecode def testModuleExtract(self): from json import __version__
assert dep.get_module_constant('json', '__version__') == __version__ assert dep.get_module_constant('sys', 'version') == sys.version assert ( dep.get_module_constant('setuptools.tests.test_setuptools', '__doc__') == __doc__ )
@needs_bytecode def testRequire(self): req = Require('Json', '1.0.3', 'json')
assert req.name == 'Json' assert req.module == 'json' assert req.requested_version == Version('1.0.3') assert req.attribute == '__version__' assert req.full_name() == 'Json-1.0.3'
from json import __version__
assert str(req.get_version()) == __version__ assert req.version_ok('1.0.9') assert not req.version_ok('0.9.1') assert not req.version_ok('unknown')
assert req.is_present() assert req.is_current()
req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') assert not req.is_present() assert not req.is_current()
@needs_bytecode def test_require_present(self): # In #1896, this test was failing for months with the only # complaint coming from test runners (not end users). # TODO: Evaluate if this code is needed at all. req = Require('Tests', None, 'tests', homepage="http://example.com") assert req.format is None assert req.attribute is None assert req.requested_version is None assert req.full_name() == 'Tests' assert req.homepage == 'http://example.com'
from setuptools.tests import __path__
paths = [os.path.dirname(p) for p in __path__] assert req.is_present(paths) assert req.is_current(paths)
class TestDistro: def setup_method(self, method): self.e1 = Extension('bar.ext', ['bar.c']) self.e2 = Extension('c.y', ['y.c'])
self.dist = makeSetup( packages=['a', 'a.b', 'a.b.c', 'b', 'c'], py_modules=['b.d', 'x'], ext_modules=(self.e1, self.e2), package_dir={}, )
def testDistroType(self): assert isinstance(self.dist, setuptools.dist.Distribution)
def testExcludePackage(self): self.dist.exclude_package('a') assert self.dist.packages == ['b', 'c']
self.dist.exclude_package('b') assert self.dist.packages == ['c'] assert self.dist.py_modules == ['x'] assert self.dist.ext_modules == [self.e1, self.e2]
self.dist.exclude_package('c') assert self.dist.packages == [] assert self.dist.py_modules == ['x'] assert self.dist.ext_modules == [self.e1]
# test removals from unspecified options makeSetup().exclude_package('x')
def testIncludeExclude(self): # remove an extension self.dist.exclude(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2]
# add it back in self.dist.include(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2, self.e1]
# should not add duplicate self.dist.include(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2, self.e1]
def testExcludePackages(self): self.dist.exclude(packages=['c', 'b', 'a']) assert self.dist.packages == [] assert self.dist.py_modules == ['x'] assert self.dist.ext_modules == [self.e1]
def testEmpty(self): dist = makeSetup() dist.include(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) dist = makeSetup() dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
def testContents(self): assert self.dist.has_contents_for('a') self.dist.exclude_package('a') assert not self.dist.has_contents_for('a')
assert self.dist.has_contents_for('b') self.dist.exclude_package('b') assert not self.dist.has_contents_for('b')
assert self.dist.has_contents_for('c') self.dist.exclude_package('c') assert not self.dist.has_contents_for('c')
def testInvalidIncludeExclude(self): with pytest.raises(DistutilsSetupError): self.dist.include(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.exclude(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.include(packages={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(packages={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.include(ext_modules={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(ext_modules={'x': 'y'})
with pytest.raises(DistutilsSetupError): self.dist.include(package_dir=['q']) with pytest.raises(DistutilsSetupError): self.dist.exclude(package_dir=['q'])
@pytest.fixturedef example_source(tmpdir): tmpdir.mkdir('foo') (tmpdir / 'foo/bar.py').write('') (tmpdir / 'readme.txt').write('') return tmpdir
def test_findall(example_source): found = list(setuptools.findall(str(example_source))) expected = ['readme.txt', 'foo/bar.py'] expected = [example_source.join(fn) for fn in expected] assert found == expected
def test_findall_curdir(example_source): with example_source.as_cwd(): found = list(setuptools.findall()) expected = ['readme.txt', os.path.join('foo', 'bar.py')] assert found == expected
@pytest.fixturedef can_symlink(tmpdir): """ Skip if cannot create a symbolic link """ link_fn = 'link' target_fn = 'target' try: os.symlink(target_fn, link_fn) except (OSError, NotImplementedError, AttributeError): pytest.skip("Cannot create symbolic links") os.remove(link_fn)
@pytest.mark.usefixtures("can_symlink")def test_findall_missing_symlink(tmpdir): with tmpdir.as_cwd(): os.symlink('foo', 'bar') found = list(setuptools.findall()) assert found == []
@pytest.mark.xfail(reason="unable to exclude tests; #4475 #3260")def test_its_own_wheel_does_not_contain_tests(setuptools_wheel): with ZipFile(setuptools_wheel) as zipfile: contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
for member in contents: assert '/tests/' not in member
def test_wheel_includes_cli_scripts(setuptools_wheel): with ZipFile(setuptools_wheel) as zipfile: contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
assert any('cli-64.exe' in member for member in contents)
def test_wheel_includes_vendored_metadata(setuptools_wheel): with ZipFile(setuptools_wheel) as zipfile: contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
assert any( re.search(r'_vendor/.*\.dist-info/METADATA', member) for member in contents )1234567891011121314151617181920212223import statimport sysfrom unittest.mock import Mock
from setuptools import _shutil
def test_rmtree_readonly(monkeypatch, tmp_path): """Verify onerr works as expected"""
tmp_dir = tmp_path / "with_readonly" tmp_dir.mkdir() some_file = tmp_dir.joinpath("file.txt") some_file.touch() some_file.chmod(stat.S_IREAD)
expected_count = 1 if sys.platform.startswith("win") else 0 chmod_fn = Mock(wraps=_shutil.attempt_chmod_verbose) monkeypatch.setattr(_shutil, "attempt_chmod_verbose", chmod_fn)
_shutil.rmtree(tmp_dir) assert chmod_fn.call_count == expected_count assert not tmp_dir.is_dir()12345678910from setuptools import unicode_utils
def test_filesys_decode_fs_encoding_is_None(monkeypatch): """ Test filesys_decode does not raise TypeError when getfilesystemencoding returns None. """ monkeypatch.setattr('sys.getfilesystemencoding', lambda: None) unicode_utils.filesys_decode(b'test')123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113import osimport subprocessimport sysfrom urllib.error import URLErrorfrom urllib.request import urlopen
import pytest
@pytest.fixture(autouse=True)def pytest_virtualenv_works(venv): """ pytest_virtualenv may not work. if it doesn't, skip these tests. See #1284. """ venv_prefix = venv.run(["python", "-c", "import sys; print(sys.prefix)"]).strip() if venv_prefix == sys.prefix: pytest.skip("virtualenv is broken (see pypa/setuptools#1284)")
def test_clean_env_install(venv_without_setuptools, setuptools_wheel): """ Check setuptools can be installed in a clean environment. """ cmd = ["python", "-m", "pip", "install", str(setuptools_wheel)] venv_without_setuptools.run(cmd)
def access_pypi(): # Detect if tests are being run without connectivity if not os.environ.get('NETWORK_REQUIRED', False): # pragma: nocover try: urlopen('https://pypi.org', timeout=1) except URLError: # No network, disable most of these tests return False
return True
@pytest.mark.skipif( 'platform.python_implementation() == "PyPy"', reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",)@pytest.mark.skipif(not access_pypi(), reason="no network")# ^-- Even when it is not necessary to install a different version of `pip`# the build process will still try to download `wheel`, see #3147 and #2986.@pytest.mark.parametrize( 'pip_version', [ None, pytest.param( 'pip<20.1', marks=pytest.mark.xfail( 'sys.version_info >= (3, 12)', reason="pip 23.1.2 required for Python 3.12 and later", ), ), pytest.param( 'pip<21', marks=pytest.mark.xfail( 'sys.version_info >= (3, 12)', reason="pip 23.1.2 required for Python 3.12 and later", ), ), pytest.param( 'pip<22', marks=pytest.mark.xfail( 'sys.version_info >= (3, 12)', reason="pip 23.1.2 required for Python 3.12 and later", ), ), pytest.param( 'pip<23', marks=pytest.mark.xfail( 'sys.version_info >= (3, 12)', reason="pip 23.1.2 required for Python 3.12 and later", ), ), pytest.param( 'https://github.com/pypa/pip/archive/main.zip', marks=pytest.mark.xfail(reason='#2975'), ), ],)def test_pip_upgrade_from_source( pip_version, venv_without_setuptools, setuptools_wheel, setuptools_sdist): """ Check pip can upgrade setuptools from source. """ # Install pip/wheel, in a venv without setuptools (as it # should not be needed for bootstrapping from source) venv = venv_without_setuptools venv.run(["pip", "install", "-U", "wheel"]) if pip_version is not None: venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"]) with pytest.raises(subprocess.CalledProcessError): # Meta-test to make sure setuptools is not installed venv.run(["python", "-c", "import setuptools"])
# Then install from wheel. venv.run(["pip", "install", str(setuptools_wheel)]) # And finally try to upgrade from source. venv.run(["pip", "install", "--no-cache-dir", "--upgrade", str(setuptools_sdist)])
def test_no_missing_dependencies(bare_venv, request): """ Quick and dirty test to ensure all external dependencies are vendored. """ setuptools_dir = request.config.rootdir bare_venv.run(['python', 'setup.py', '--help'], cwd=setuptools_dir)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106from inspect import cleandoc
import pytest
from setuptools.warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning
_EXAMPLES = { "default": dict( args=("Hello {x}", "\n\t{target} {v:.1f}"), kwargs={"x": 5, "v": 3, "target": "World"}, expected=""" Hello 5 !!
******************************************************************************** World 3.0 ********************************************************************************
!! """, ), "futue_due_date": dict( args=("Summary", "Lorem ipsum"), kwargs={"due_date": (9999, 11, 22)}, expected=""" Summary !!
******************************************************************************** Lorem ipsum
By 9999-Nov-22, you need to update your project and remove deprecated calls or your builds will no longer be supported. ********************************************************************************
!! """, ), "past_due_date_with_docs": dict( args=("Summary", "Lorem ipsum"), kwargs={"due_date": (2000, 11, 22), "see_docs": "some_page.html"}, expected=""" Summary !!
******************************************************************************** Lorem ipsum
This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future.
See https://setuptools.pypa.io/en/latest/some_page.html for details. ********************************************************************************
!! """, ),}
@pytest.mark.parametrize("example_name", _EXAMPLES.keys())def test_formatting(monkeypatch, example_name): """ It should automatically handle indentation, interpolation and things like due date. """ args = _EXAMPLES[example_name]["args"] kwargs = _EXAMPLES[example_name]["kwargs"] expected = _EXAMPLES[example_name]["expected"]
monkeypatch.setenv("SETUPTOOLS_ENFORCE_DEPRECATION", "false") with pytest.warns(SetuptoolsWarning) as warn_info: SetuptoolsWarning.emit(*args, **kwargs) assert _get_message(warn_info) == cleandoc(expected)
def test_due_date_enforcement(monkeypatch): class _MyDeprecation(SetuptoolsDeprecationWarning): _SUMMARY = "Summary" _DETAILS = "Lorem ipsum" _DUE_DATE = (2000, 11, 22) _SEE_DOCS = "some_page.html"
monkeypatch.setenv("SETUPTOOLS_ENFORCE_DEPRECATION", "true") with pytest.raises(SetuptoolsDeprecationWarning) as exc_info: _MyDeprecation.emit()
expected = """ Summary !!
******************************************************************************** Lorem ipsum
This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future.
See https://setuptools.pypa.io/en/latest/some_page.html for details. ********************************************************************************
!! """ assert str(exc_info.value) == cleandoc(expected)
def _get_message(warn_info): return next(warn.message.args[0] for warn in warn_info)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714"""wheel tests"""
from __future__ import annotations
import contextlibimport globimport inspectimport osimport pathlibimport shutilimport statimport subprocessimport sysimport zipfilefrom typing import Any
import pytestfrom jaraco import pathfrom packaging.tags import parse_tagfrom packaging.utils import canonicalize_name
from pkg_resources import PY_MAJOR, Distribution, PathMetadatafrom setuptools.wheel import Wheel
from .contexts import tempdirfrom .textwrap import DALS
from distutils.sysconfig import get_config_varfrom distutils.util import get_platform
WHEEL_INFO_TESTS = ( ('invalid.whl', ValueError), ( 'simplewheel-2.0-1-py2.py3-none-any.whl', { 'project_name': 'simplewheel', 'version': '2.0', 'build': '1', 'py_version': 'py2.py3', 'abi': 'none', 'platform': 'any', }, ), ( 'simple.dist-0.1-py2.py3-none-any.whl', { 'project_name': 'simple.dist', 'version': '0.1', 'build': None, 'py_version': 'py2.py3', 'abi': 'none', 'platform': 'any', }, ), ( 'example_pkg_a-1-py3-none-any.whl', { 'project_name': 'example_pkg_a', 'version': '1', 'build': None, 'py_version': 'py3', 'abi': 'none', 'platform': 'any', }, ), ( 'PyQt5-5.9-5.9.1-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl', { 'project_name': 'PyQt5', 'version': '5.9', 'build': '5.9.1', 'py_version': 'cp35.cp36.cp37', 'abi': 'abi3', 'platform': 'manylinux1_x86_64', }, ),)
@pytest.mark.parametrize( ('filename', 'info'), WHEEL_INFO_TESTS, ids=[t[0] for t in WHEEL_INFO_TESTS])def test_wheel_info(filename, info): if inspect.isclass(info): with pytest.raises(info): Wheel(filename) return w = Wheel(filename) assert {k: getattr(w, k) for k in info.keys()} == info
@contextlib.contextmanagerdef build_wheel(extra_file_defs=None, **kwargs): file_defs = { 'setup.py': ( DALS( """ # -*- coding: utf-8 -*- from setuptools import setup import setuptools setup(**%r) """ ) % kwargs ).encode('utf-8'), } if extra_file_defs: file_defs.update(extra_file_defs) with tempdir() as source_dir: path.build(file_defs, source_dir) subprocess.check_call( (sys.executable, 'setup.py', '-q', 'bdist_wheel'), cwd=source_dir ) yield glob.glob(os.path.join(source_dir, 'dist', '*.whl'))[0]
def tree_set(root): contents = set() for dirpath, dirnames, filenames in os.walk(root): for filename in filenames: contents.add(os.path.join(os.path.relpath(dirpath, root), filename)) return contents
def flatten_tree(tree): """Flatten nested dicts and lists into a full list of paths""" output = set() for node, contents in tree.items(): if isinstance(contents, dict): contents = flatten_tree(contents)
for elem in contents: if isinstance(elem, dict): output |= {os.path.join(node, val) for val in flatten_tree(elem)} else: output.add(os.path.join(node, elem)) return output
def format_install_tree(tree): return { x.format( py_version=PY_MAJOR, platform=get_platform(), shlib_ext=get_config_var('EXT_SUFFIX') or get_config_var('SO'), ) for x in tree }
def _check_wheel_install( filename, install_dir, install_tree_includes, project_name, version, requires_txt): w = Wheel(filename) egg_path = os.path.join(install_dir, w.egg_name()) w.install_as_egg(egg_path) if install_tree_includes is not None: install_tree = format_install_tree(install_tree_includes) exp = tree_set(install_dir) assert install_tree.issubset(exp), install_tree - exp
metadata = PathMetadata(egg_path, os.path.join(egg_path, 'EGG-INFO')) dist = Distribution.from_filename(egg_path, metadata=metadata) assert dist.project_name == project_name assert dist.version == version if requires_txt is None: assert not dist.has_metadata('requires.txt') else: # Order must match to ensure reproducibility. assert requires_txt == dist.get_metadata('requires.txt').lstrip()
class Record: def __init__(self, id, **kwargs): self._id = id self._fields = kwargs
def __repr__(self) -> str: return f'{self._id}(**{self._fields!r})'
# Using Any to avoid possible type union issues later in test# making a TypedDict is not worth in a test and anonymous/inline TypedDict are experimental# https://github.com/python/mypy/issues/9884WHEEL_INSTALL_TESTS: tuple[dict[str, Any], ...] = ( dict( id='basic', file_defs={'foo': {'__init__.py': ''}}, setup_kwargs=dict( packages=['foo'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'], 'foo': ['__init__.py'], } }), ), dict( id='utf-8', setup_kwargs=dict( description='Description accentuée', ), ), dict( id='data', file_defs={ 'data.txt': DALS( """ Some data... """ ), }, setup_kwargs=dict( data_files=[('data_dir', ['data.txt'])], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'], 'data_dir': ['data.txt'], } }), ), dict( id='extension', file_defs={ 'extension.c': DALS( """ #include "Python.h"
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "extension", NULL, 0, NULL, NULL, NULL, NULL, NULL };
#define INITERROR return NULL
PyMODINIT_FUNC PyInit_extension(void)
#else
#define INITERROR return
void initextension(void)
#endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&moduledef); #else PyObject *module = Py_InitModule("extension", NULL); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } """ ), }, setup_kwargs=dict( ext_modules=[ Record( 'setuptools.Extension', name='extension', sources=['extension.c'] ) ], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}-{platform}.egg': [ 'extension{shlib_ext}', { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt', ] }, ] }), ), dict( id='header', file_defs={ 'header.h': DALS( """ """ ), }, setup_kwargs=dict( headers=['header.h'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': [ 'header.h', { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt', ] }, ] }), ), dict( id='script', file_defs={ 'script.py': DALS( """ #/usr/bin/python print('hello world!') """ ), 'script.sh': DALS( """ #/bin/sh echo 'hello world!' """ ), }, setup_kwargs=dict( scripts=['script.py', 'script.sh'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt', {'scripts': ['script.py', 'script.sh']}, ] } }), ), dict( id='requires1', install_requires='foobar==2.0', install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'requires.txt', 'top_level.txt', ] } }), requires_txt=DALS( """ foobar==2.0 """ ), ), dict( id='requires2', install_requires=f""" bar foo<=2.0; {sys.platform!r} in sys_platform """, requires_txt=DALS( """ bar foo<=2.0 """ ), ), dict( id='requires3', install_requires=f""" bar; {sys.platform!r} != sys_platform """, ), dict( id='requires4', install_requires=""" foo """, extras_require={ 'extra': 'foobar>3', }, requires_txt=DALS( """ foo
[extra] foobar>3 """ ), ), dict( id='requires5', extras_require={ 'extra': f'foobar; {sys.platform!r} != sys_platform', }, requires_txt=DALS( """ [extra] """ ), ), dict( id='requires_ensure_order', install_requires=""" foo bar baz qux """, extras_require={ 'extra': """ foobar>3 barbaz>4 bazqux>5 quxzap>6 """, }, requires_txt=DALS( """ foo bar baz qux
[extra] foobar>3 barbaz>4 bazqux>5 quxzap>6 """ ), ), dict( id='namespace_package', file_defs={ 'foo': { 'bar': {'__init__.py': ''}, }, }, setup_kwargs=dict( namespace_packages=['foo'], packages=['foo.bar'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': [ 'foo-1.0-py{py_version}-nspkg.pth', { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'namespace_packages.txt', 'top_level.txt', ] }, { 'foo': [ '__init__.py', {'bar': ['__init__.py']}, ] }, ] }), ), dict( id='empty_namespace_package', file_defs={ 'foobar': { '__init__.py': ( "__import__('pkg_resources').declare_namespace(__name__)" ) }, }, setup_kwargs=dict( namespace_packages=['foobar'], packages=['foobar'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': [ 'foo-1.0-py{py_version}-nspkg.pth', { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'namespace_packages.txt', 'top_level.txt', ] }, { 'foobar': [ '__init__.py', ] }, ] }), ), dict( id='data_in_package', file_defs={ 'foo': { '__init__.py': '', 'data_dir': { 'data.txt': DALS( """ Some data... """ ), }, } }, setup_kwargs=dict( packages=['foo'], data_files=[('foo/data_dir', ['foo/data_dir/data.txt'])], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt', ], 'foo': [ '__init__.py', { 'data_dir': [ 'data.txt', ] }, ], } }), ),)
@pytest.mark.parametrize( 'params', WHEEL_INSTALL_TESTS, ids=[params['id'] for params in WHEEL_INSTALL_TESTS],)def test_wheel_install(params): project_name = params.get('name', 'foo') version = params.get('version', '1.0') install_requires = params.get('install_requires', []) extras_require = params.get('extras_require', {}) requires_txt = params.get('requires_txt', None) install_tree = params.get('install_tree') file_defs = params.get('file_defs', {}) setup_kwargs = params.get('setup_kwargs', {}) with ( build_wheel( name=project_name, version=version, install_requires=install_requires, extras_require=extras_require, extra_file_defs=file_defs, **setup_kwargs, ) as filename, tempdir() as install_dir, ): _check_wheel_install( filename, install_dir, install_tree, project_name, version, requires_txt )
def test_wheel_install_pep_503(): project_name = 'Foo_Bar' # PEP 503 canonicalized name is "foo-bar" version = '1.0' with ( build_wheel( name=project_name, version=version, ) as filename, tempdir() as install_dir, ): new_filename = filename.replace(project_name, canonicalize_name(project_name)) shutil.move(filename, new_filename) _check_wheel_install( new_filename, install_dir, None, canonicalize_name(project_name), version, None, )
def test_wheel_no_dist_dir(): project_name = 'nodistinfo' version = '1.0' wheel_name = f'{project_name}-{version}-py2.py3-none-any.whl' with tempdir() as source_dir: wheel_path = os.path.join(source_dir, wheel_name) # create an empty zip file zipfile.ZipFile(wheel_path, 'w').close() with tempdir() as install_dir: with pytest.raises(ValueError): _check_wheel_install( wheel_path, install_dir, None, project_name, version, None )
def test_wheel_is_compatible(monkeypatch): def sys_tags(): return { (t.interpreter, t.abi, t.platform) for t in parse_tag('cp36-cp36m-manylinux1_x86_64') }
monkeypatch.setattr('setuptools.wheel._get_supported_tags', sys_tags) assert Wheel('onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible()
def test_wheel_mode(): @contextlib.contextmanager def build_wheel(extra_file_defs=None, **kwargs): file_defs = { 'setup.py': ( DALS( """ # -*- coding: utf-8 -*- from setuptools import setup import setuptools setup(**%r) """ ) % kwargs ).encode('utf-8'), } if extra_file_defs: file_defs.update(extra_file_defs) with tempdir() as source_dir: path.build(file_defs, source_dir) runsh = pathlib.Path(source_dir) / "script.sh" os.chmod(runsh, 0o777) subprocess.check_call( (sys.executable, 'setup.py', '-q', 'bdist_wheel'), cwd=source_dir ) yield glob.glob(os.path.join(source_dir, 'dist', '*.whl'))[0]
params = dict( id='script', file_defs={ 'script.py': DALS( """ #/usr/bin/python print('hello world!') """ ), 'script.sh': DALS( """ #/bin/sh echo 'hello world!' """ ), }, setup_kwargs=dict( scripts=['script.py', 'script.sh'], ), install_tree=flatten_tree({ 'foo-1.0-py{py_version}.egg': { 'EGG-INFO': [ 'PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt', {'scripts': ['script.py', 'script.sh']}, ] } }), )
project_name = params.get('name', 'foo') version = params.get('version', '1.0') install_tree = params.get('install_tree') file_defs = params.get('file_defs', {}) setup_kwargs = params.get('setup_kwargs', {})
with ( build_wheel( name=project_name, version=version, install_requires=[], extras_require={}, extra_file_defs=file_defs, **setup_kwargs, ) as filename, tempdir() as install_dir, ): _check_wheel_install( filename, install_dir, install_tree, project_name, version, None ) w = Wheel(filename) base = pathlib.Path(install_dir) / w.egg_name() script_sh = base / "EGG-INFO" / "scripts" / "script.sh" assert script_sh.exists() if sys.platform != 'win32': # Editable file mode has no effect on Windows assert oct(stat.S_IMODE(script_sh.stat().st_mode)) == "0o777"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259"""Python Script Wrapper for Windows=================================
setuptools includes wrappers for Python scripts that allows them to beexecuted like regular windows programs. There are 2 wrappers, onefor command-line programs, cli.exe, and one for graphical programs,gui.exe. These programs are almost identical, function pretty muchthe same way, and are generated from the same source file. Thewrapper programs are used by copying them to the directory containingthe script they are to wrap and with the same name as the script theyare to wrap."""
import pathlibimport platformimport subprocessimport sysimport textwrap
import pytest
import pkg_resourcesfrom setuptools.command.easy_install import nt_quote_arg
pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only")
class WrapperTester: @classmethod def prep_script(cls, template): python_exe = nt_quote_arg(sys.executable) return template % locals()
@classmethod def create_script(cls, tmpdir): """ Create a simple script, foo-script.py
Note that the script starts with a Unix-style '#!' line saying which Python executable to run. The wrapper will use this line to find the correct Python executable. """
script = cls.prep_script(cls.script_tmpl)
with (tmpdir / cls.script_name).open('w') as f: f.write(script)
# also copy cli.exe to the sample directory with (tmpdir / cls.wrapper_name).open('wb') as f: w = pkg_resources.resource_string('setuptools', cls.wrapper_source) f.write(w)
def win_launcher_exe(prefix): """A simple routine to select launcher script based on platform.""" assert prefix in ('cli', 'gui') if platform.machine() == "ARM64": return f"{prefix}-arm64.exe" else: return f"{prefix}-32.exe"
class TestCLI(WrapperTester): script_name = 'foo-script.py' wrapper_name = 'foo.exe' wrapper_source = win_launcher_exe('cli')
script_tmpl = textwrap.dedent( """ #!%(python_exe)s import sys input = repr(sys.stdin.read()) print(sys.argv[0][-14:]) print(sys.argv[1:]) print(input) if __debug__: print('non-optimized') """ ).lstrip()
def test_basic(self, tmpdir): """ When the copy of cli.exe, foo.exe in this example, runs, it examines the path name it was run with and computes a Python script path name by removing the '.exe' suffix and adding the '-script.py' suffix. (For GUI programs, the suffix '-script.pyw' is added.) This is why we named out script the way we did. Now we can run out script by running the wrapper:
This example was a little pathological in that it exercised windows (MS C runtime) quoting rules:
- Strings containing spaces are surrounded by double quotes.
- Double quotes in strings need to be escaped by preceding them with back slashes.
- One or more backslashes preceding double quotes need to be escaped by preceding each of them with back slashes. """ self.create_script(tmpdir) cmd = [ str(tmpdir / 'foo.exe'), 'arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b', ] proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, text=True, encoding="utf-8", ) stdout, _stderr = proc.communicate('hello\nworld\n') actual = stdout.replace('\r\n', '\n') expected = textwrap.dedent( r""" \foo-script.py ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b'] 'hello\nworld\n' non-optimized """ ).lstrip() assert actual == expected
def test_symlink(self, tmpdir): """ Ensure that symlink for the foo.exe is working correctly. """ script_dir = tmpdir / "script_dir" script_dir.mkdir() self.create_script(script_dir) symlink = pathlib.Path(tmpdir / "foo.exe") symlink.symlink_to(script_dir / "foo.exe")
cmd = [ str(tmpdir / 'foo.exe'), 'arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b', ] proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, text=True, encoding="utf-8", ) stdout, _stderr = proc.communicate('hello\nworld\n') actual = stdout.replace('\r\n', '\n') expected = textwrap.dedent( r""" \foo-script.py ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b'] 'hello\nworld\n' non-optimized """ ).lstrip() assert actual == expected
def test_with_options(self, tmpdir): """ Specifying Python Command-line Options --------------------------------------
You can specify a single argument on the '#!' line. This can be used to specify Python options like -O, to run in optimized mode or -i to start the interactive interpreter. You can combine multiple options as usual. For example, to run in optimized mode and enter the interpreter after running the script, you could use -Oi: """ self.create_script(tmpdir) tmpl = textwrap.dedent( """ #!%(python_exe)s -Oi import sys input = repr(sys.stdin.read()) print(sys.argv[0][-14:]) print(sys.argv[1:]) print(input) if __debug__: print('non-optimized') sys.ps1 = '---' """ ).lstrip() with (tmpdir / 'foo-script.py').open('w') as f: f.write(self.prep_script(tmpl)) cmd = [str(tmpdir / 'foo.exe')] proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, encoding="utf-8", ) stdout, _stderr = proc.communicate() actual = stdout.replace('\r\n', '\n') expected = textwrap.dedent( r""" \foo-script.py [] '' --- """ ).lstrip() assert actual == expected
class TestGUI(WrapperTester): """ Testing the GUI Version ----------------------- """
script_name = 'bar-script.pyw' wrapper_source = win_launcher_exe('gui') wrapper_name = 'bar.exe'
script_tmpl = textwrap.dedent( """ #!%(python_exe)s import sys f = open(sys.argv[1], 'wb') bytes_written = f.write(repr(sys.argv[2]).encode('utf-8')) f.close() """ ).strip()
def test_basic(self, tmpdir): """Test the GUI version with the simple script, bar-script.py""" self.create_script(tmpdir)
cmd = [ str(tmpdir / 'bar.exe'), str(tmpdir / 'test_output.txt'), 'Test Argument', ] proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, encoding="utf-8", ) stdout, stderr = proc.communicate() assert not stdout assert not stderr with (tmpdir / 'test_output.txt').open('rb') as f_out: actual = f_out.read().decode('ascii') assert actual == repr('Test Argument')1234class Filenames: unicode = 'smörbröd.py' latin_1 = unicode.encode('latin-1') utf_8 = unicode.encode('utf-8')123456import textwrap
def DALS(s): "dedent and left-strip" return textwrap.dedent(s).lstrip()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102import sysimport unicodedatafrom configparser import RawConfigParser
from .compat import py39from .warnings import SetuptoolsDeprecationWarning
# HFS Plus uses decomposed UTF-8def decompose(path): if isinstance(path, str): return unicodedata.normalize('NFD', path) try: path = path.decode('utf-8') path = unicodedata.normalize('NFD', path) path = path.encode('utf-8') except UnicodeError: pass # Not UTF-8 return path
def filesys_decode(path): """ Ensure that the given path is decoded, ``None`` when no expected encoding works """
if isinstance(path, str): return path
fs_enc = sys.getfilesystemencoding() or 'utf-8' candidates = fs_enc, 'utf-8'
for enc in candidates: try: return path.decode(enc) except UnicodeDecodeError: continue
return None
def try_encode(string, enc): "turn unicode encoding into a functional routine" try: return string.encode(enc) except UnicodeEncodeError: return None
def _read_utf8_with_fallback(file: str, fallback_encoding=py39.LOCALE_ENCODING) -> str: """ First try to read the file with UTF-8, if there is an error fallback to a different encoding ("locale" by default). Returns the content of the file. Also useful when reading files that might have been produced by an older version of setuptools. """ try: with open(file, "r", encoding="utf-8") as f: return f.read() except UnicodeDecodeError: # pragma: no cover _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding) with open(file, "r", encoding=fallback_encoding) as f: return f.read()
def _cfg_read_utf8_with_fallback( cfg: RawConfigParser, file: str, fallback_encoding=py39.LOCALE_ENCODING) -> None: """Same idea as :func:`_read_utf8_with_fallback`, but for the :meth:`RawConfigParser.read` method.
This method may call ``cfg.clear()``. """ try: cfg.read(file, encoding="utf-8") except UnicodeDecodeError: # pragma: no cover _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding) cfg.clear() cfg.read(file, encoding=fallback_encoding)
class _Utf8EncodingNeeded(SetuptoolsDeprecationWarning): _SUMMARY = """ `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`. """
_DETAILS = """ Fallback behavior for UTF-8 is considered **deprecated** and future versions of `setuptools` may not implement it.
Please encode {file!r} with "utf-8" to ensure future builds will succeed.
If this file was produced by `setuptools` itself, cleaning up the cached files and re-building/re-installing the package with a newer version of `setuptools` (e.g. by updating `build-system.requires` in its `pyproject.toml`) might solve the problem. """ # TODO: Add a deadline? # Will we be able to remove this? # The question comes to mind mainly because of sdists that have been produced # by old versions of setuptools and published to PyPI...123456from ._importlib import metadata
try: __version__ = metadata.version('setuptools') or '0.dev0+unknown'except Exception: __version__ = '0.dev0+unknown'123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110"""Provide basic warnings used by setuptools modules.
Using custom classes (other than ``UserWarning``) allow users to set``PYTHONWARNINGS`` filters to run tests and prepare for upcoming changes insetuptools."""
from __future__ import annotations
import osimport warningsfrom datetime import datefrom inspect import cleandocfrom textwrap import indentfrom typing import TYPE_CHECKING
if TYPE_CHECKING: from typing_extensions import TypeAlias
_DueDate: TypeAlias = tuple[int, int, int] # time tuple_INDENT = 8 * " "_TEMPLATE = f"""{80 * '*'}\n{{details}}\n{80 * '*'}"""
class SetuptoolsWarning(UserWarning): """Base class in ``setuptools`` warning hierarchy."""
@classmethod def emit( cls, summary: str | None = None, details: str | None = None, due_date: _DueDate | None = None, see_docs: str | None = None, see_url: str | None = None, stacklevel: int = 2, **kwargs, ) -> None: """Private: reserved for ``setuptools`` internal use only""" # Default values: summary_ = summary or getattr(cls, "_SUMMARY", None) or "" details_ = details or getattr(cls, "_DETAILS", None) or "" due_date = due_date or getattr(cls, "_DUE_DATE", None) docs_ref = see_docs or getattr(cls, "_SEE_DOCS", None) docs_url = docs_ref and f"https://setuptools.pypa.io/en/latest/{docs_ref}" see_url = see_url or getattr(cls, "_SEE_URL", None) due = date(*due_date) if due_date else None
text = cls._format(summary_, details_, due, see_url or docs_url, kwargs) if due and due < date.today() and _should_enforce(): raise cls(text) warnings.warn(text, cls, stacklevel=stacklevel + 1)
@classmethod def _format( cls, summary: str, details: str, due_date: date | None = None, see_url: str | None = None, format_args: dict | None = None, ) -> str: """Private: reserved for ``setuptools`` internal use only""" today = date.today() summary = cleandoc(summary).format_map(format_args or {}) possible_parts = [ cleandoc(details).format_map(format_args or {}), ( f"\nBy {due_date:%Y-%b-%d}, you need to update your project and remove " "deprecated calls\nor your builds will no longer be supported." if due_date and due_date > today else None ), ( "\nThis deprecation is overdue, please update your project and remove " "deprecated\ncalls to avoid build errors in the future." if due_date and due_date < today else None ), (f"\nSee {see_url} for details." if see_url else None), ] parts = [x for x in possible_parts if x] if parts: body = indent(_TEMPLATE.format(details="\n".join(parts)), _INDENT) return "\n".join([summary, "!!\n", body, "\n!!"]) return summary
class InformationOnly(SetuptoolsWarning): """Currently there is no clear way of displaying messages to the users that use the setuptools backend directly via ``pip``. The only thing that might work is a warning, although it is not the most appropriate tool for the job...
See pypa/packaging-problems#558. """
class SetuptoolsDeprecationWarning(SetuptoolsWarning): """ Base class for warning deprecations in ``setuptools``
This class is not derived from ``DeprecationWarning``, and as such is visible by default. """
def _should_enforce(): enforce = os.getenv("SETUPTOOLS_ENFORCE_DEPRECATION", "false").lower() return enforce in ("true", "on", "ok", "1")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236"""Wheels support."""
import contextlibimport emailimport functoolsimport itertoolsimport osimport posixpathimport reimport zipfile
from packaging.tags import sys_tagsfrom packaging.utils import canonicalize_namefrom packaging.version import Version as parse_version
import setuptoolsfrom setuptools.archive_util import _unpack_zipfile_objfrom setuptools.command.egg_info import _egg_basename, write_requirements
from .unicode_utils import _read_utf8_with_fallback
from distutils.util import get_platform
WHEEL_NAME = re.compile( r"""^(?P<project_name>.+?)-(?P<version>\d.*?) ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?) )\.whl$""", re.VERBOSE,).match
NAMESPACE_PACKAGE_INIT = "__import__('pkg_resources').declare_namespace(__name__)\n"
@functools.cachedef _get_supported_tags(): # We calculate the supported tags only once, otherwise calling # this method on thousands of wheels takes seconds instead of # milliseconds. return {(t.interpreter, t.abi, t.platform) for t in sys_tags()}
def unpack(src_dir, dst_dir) -> None: """Move everything under `src_dir` to `dst_dir`, and delete the former.""" for dirpath, dirnames, filenames in os.walk(src_dir): subdir = os.path.relpath(dirpath, src_dir) for f in filenames: src = os.path.join(dirpath, f) dst = os.path.join(dst_dir, subdir, f) os.renames(src, dst) for n, d in reversed(list(enumerate(dirnames))): src = os.path.join(dirpath, d) dst = os.path.join(dst_dir, subdir, d) if not os.path.exists(dst): # Directory does not exist in destination, # rename it and prune it from os.walk list. os.renames(src, dst) del dirnames[n] # Cleanup. for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True): assert not filenames os.rmdir(dirpath)
@contextlib.contextmanagerdef disable_info_traces(): """ Temporarily disable info traces. """ from distutils import log
saved = log.set_threshold(log.WARN) try: yield finally: log.set_threshold(saved)
class Wheel: def __init__(self, filename) -> None: match = WHEEL_NAME(os.path.basename(filename)) if match is None: raise ValueError(f'invalid wheel name: {filename!r}') self.filename = filename for k, v in match.groupdict().items(): setattr(self, k, v)
def tags(self): """List tags (py_version, abi, platform) supported by this wheel.""" return itertools.product( self.py_version.split('.'), self.abi.split('.'), self.platform.split('.'), )
def is_compatible(self): """Is the wheel compatible with the current platform?""" return next((True for t in self.tags() if t in _get_supported_tags()), False)
def egg_name(self): return ( _egg_basename( self.project_name, self.version, platform=(None if self.platform == 'any' else get_platform()), ) + ".egg" )
def get_dist_info(self, zf): # find the correct name of the .dist-info dir in the wheel file for member in zf.namelist(): dirname = posixpath.dirname(member) if dirname.endswith('.dist-info') and canonicalize_name(dirname).startswith( canonicalize_name(self.project_name) ): return dirname raise ValueError("unsupported wheel format. .dist-info not found")
def install_as_egg(self, destination_eggdir) -> None: """Install wheel as an egg directory.""" with zipfile.ZipFile(self.filename) as zf: self._install_as_egg(destination_eggdir, zf)
def _install_as_egg(self, destination_eggdir, zf): dist_basename = f'{self.project_name}-{self.version}' dist_info = self.get_dist_info(zf) dist_data = f'{dist_basename}.data' egg_info = os.path.join(destination_eggdir, 'EGG-INFO')
self._convert_metadata(zf, destination_eggdir, dist_info, egg_info) self._move_data_entries(destination_eggdir, dist_data) self._fix_namespace_packages(egg_info, destination_eggdir)
@staticmethod def _convert_metadata(zf, destination_eggdir, dist_info, egg_info): import pkg_resources
def get_metadata(name): with zf.open(posixpath.join(dist_info, name)) as fp: value = fp.read().decode('utf-8') return email.parser.Parser().parsestr(value)
wheel_metadata = get_metadata('WHEEL') # Check wheel format version is supported. wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) wheel_v1 = parse_version('1.0') <= wheel_version < parse_version('2.0dev0') if not wheel_v1: raise ValueError(f'unsupported wheel format version: {wheel_version}') # Extract to target directory. _unpack_zipfile_obj(zf, destination_eggdir) # Convert metadata. dist_info = os.path.join(destination_eggdir, dist_info) dist = pkg_resources.Distribution.from_location( destination_eggdir, dist_info, metadata=pkg_resources.PathMetadata(destination_eggdir, dist_info), )
# Note: Evaluate and strip markers now, # as it's difficult to convert back from the syntax: # foobar; "linux" in sys_platform and extra == 'test' def raw_req(req): req.marker = None return str(req)
install_requires = list(map(raw_req, dist.requires())) extras_require = { extra: [ req for req in map(raw_req, dist.requires((extra,))) if req not in install_requires ] for extra in dist.extras } os.rename(dist_info, egg_info) os.rename( os.path.join(egg_info, 'METADATA'), os.path.join(egg_info, 'PKG-INFO'), ) setup_dist = setuptools.Distribution( attrs=dict( install_requires=install_requires, extras_require=extras_require, ), ) with disable_info_traces(): write_requirements( setup_dist.get_command_obj('egg_info'), None, os.path.join(egg_info, 'requires.txt'), )
@staticmethod def _move_data_entries(destination_eggdir, dist_data): """Move data entries to their correct location.""" dist_data = os.path.join(destination_eggdir, dist_data) dist_data_scripts = os.path.join(dist_data, 'scripts') if os.path.exists(dist_data_scripts): egg_info_scripts = os.path.join(destination_eggdir, 'EGG-INFO', 'scripts') os.mkdir(egg_info_scripts) for entry in os.listdir(dist_data_scripts): # Remove bytecode, as it's not properly handled # during easy_install scripts install phase. if entry.endswith('.pyc'): os.unlink(os.path.join(dist_data_scripts, entry)) else: os.rename( os.path.join(dist_data_scripts, entry), os.path.join(egg_info_scripts, entry), ) os.rmdir(dist_data_scripts) for subdir in filter( os.path.exists, ( os.path.join(dist_data, d) for d in ('data', 'headers', 'purelib', 'platlib') ), ): unpack(subdir, destination_eggdir) if os.path.exists(dist_data): os.rmdir(dist_data)
@staticmethod def _fix_namespace_packages(egg_info, destination_eggdir): namespace_packages = os.path.join(egg_info, 'namespace_packages.txt') if os.path.exists(namespace_packages): namespace_packages = _read_utf8_with_fallback(namespace_packages).split()
for mod in namespace_packages: mod_dir = os.path.join(destination_eggdir, *mod.split('.')) mod_init = os.path.join(mod_dir, '__init__.py') if not os.path.exists(mod_dir): os.mkdir(mod_dir) if not os.path.exists(mod_init): with open(mod_init, 'w', encoding="utf-8") as fp: fp.write(NAMESPACE_PACKAGE_INIT)123456789101112131415161718192021222324252627282930import platform
def windows_only(func): if platform.system() != 'Windows': return lambda *args, **kwargs: None return func
@windows_onlydef hide_file(path: str) -> None: """ Set the hidden attribute on a file or directory.
From https://stackoverflow.com/questions/19622133/
`path` must be text. """ import ctypes import ctypes.wintypes
SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD SetFileAttributes.restype = ctypes.wintypes.BOOL
FILE_ATTRIBUTE_HIDDEN = 0x02
ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN) if not ret: raise ctypes.WinError()1uv123456789101112131415161718Copyright (c) 2010-2024 Benjamin Peterson
Permission is hereby granted, free of charge, to any person obtaining a copy ofthis software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ORCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHERIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.12345678910111213141516171819202122232425262728293031323334353637383940414243Metadata-Version: 2.1Name: sixVersion: 1.17.0Summary: Python 2 and 3 compatibility utilitiesHome-page: https://github.com/benjaminp/sixAuthor: Benjamin PetersonAuthor-email: benjamin@python.orgLicense: MITClassifier: Development Status :: 5 - Production/StableClassifier: Programming Language :: Python :: 2Classifier: Programming Language :: Python :: 3Classifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Topic :: Software Development :: LibrariesClassifier: Topic :: UtilitiesRequires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*License-File: LICENSE
.. image:: https://img.shields.io/pypi/v/six.svg :target: https://pypi.org/project/six/ :alt: six on PyPI
.. image:: https://readthedocs.org/projects/six/badge/?version=latest :target: https://six.readthedocs.io/ :alt: six's documentation on Read the Docs
.. image:: https://img.shields.io/badge/license-MIT-green.svg :target: https://github.com/benjaminp/six/blob/master/LICENSE :alt: MIT License badge
Six is a Python 2 and 3 compatibility library. It provides utility functionsfor smoothing over the differences between the Python versions with the goal ofwriting Python code that is compatible on both Python versions. See thedocumentation for more information on what is provided.
Six supports Python 2.7 and 3.3+. It is contained in only one Pythonfile, so it can be easily copied into your project. (The copyright and licensenotice must be retained.)
Online documentation is at https://six.readthedocs.io/.
Bugs can be reported to https://github.com/benjaminp/six. The code can alsobe found there.12345678six-1.17.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2six-1.17.0.dist-info/LICENSE,sha256=Q3W6IOK5xsTnytKUCmKP2Q6VzD1Q7pKq51VxXYuh-9A,1066six-1.17.0.dist-info/METADATA,sha256=ViBCB4wnUlSfbYp8htvF3XCAiKe-bYBnLsewcQC3JGg,1658six-1.17.0.dist-info/RECORD,,six-1.17.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0six-1.17.0.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109six-1.17.0.dist-info/top_level.txt,sha256=_iVH_iYEtEXnD8nYGQYpYFUvkUW9sEO1GYbkeKSAais,4six.py,sha256=xRyR9wPT1LNpbJI8tf7CE-BeddkhU5O--sfy-mo5BN8,34703123456Wheel-Version: 1.0Generator: setuptools (75.6.0)Root-Is-Purelib: trueTag: py2-none-anyTag: py3-none-any
1six1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003# Copyright (c) 2010-2024 Benjamin Peterson## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the "Software"), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:## The above copyright notice and this permission notice shall be included in all# copies or substantial portions of the Software.## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE# SOFTWARE.
"""Utilities for writing code that runs on Python 2 and 3"""
from __future__ import absolute_import
import functoolsimport itertoolsimport operatorimport sysimport types
__author__ = "Benjamin Peterson <benjamin@python.org>"__version__ = "1.17.0"
# Useful for very coarse version differentiation.PY2 = sys.version_info[0] == 2PY3 = sys.version_info[0] == 3PY34 = sys.version_info[0:2] >= (3, 4)
if PY3: string_types = str, integer_types = int, class_types = type, text_type = str binary_type = bytes
MAXSIZE = sys.maxsizeelse: string_types = basestring, integer_types = (int, long) class_types = (type, types.ClassType) text_type = unicode binary_type = str
if sys.platform.startswith("java"): # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: # It's possible to have sizeof(long) != sizeof(Py_ssize_t). class X(object):
def __len__(self): return 1 << 31 try: len(X()) except OverflowError: # 32-bit MAXSIZE = int((1 << 31) - 1) else: # 64-bit MAXSIZE = int((1 << 63) - 1) del X
if PY34: from importlib.util import spec_from_loaderelse: spec_from_loader = None
def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc
def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name]
class _LazyDescr(object):
def __init__(self, name): self.name = name
def __get__(self, obj, tp): result = self._resolve() setattr(obj, self.name, result) # Invokes __set__. try: # This is a bit ugly, but it avoids running this again by # removing this descriptor. delattr(obj.__class__, self.name) except AttributeError: pass return result
class MovedModule(_LazyDescr):
def __init__(self, name, old, new=None): super(MovedModule, self).__init__(name) if PY3: if new is None: new = name self.mod = new else: self.mod = old
def _resolve(self): return _import_module(self.mod)
def __getattr__(self, attr): _module = self._resolve() value = getattr(_module, attr) setattr(self, attr, value) return value
class _LazyModule(types.ModuleType):
def __init__(self, name): super(_LazyModule, self).__init__(name) self.__doc__ = self.__class__.__doc__
def __dir__(self): attrs = ["__doc__", "__name__"] attrs += [attr.name for attr in self._moved_attributes] return attrs
# Subclasses should override this _moved_attributes = []
class MovedAttribute(_LazyDescr):
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): super(MovedAttribute, self).__init__(name) if PY3: if new_mod is None: new_mod = name self.mod = new_mod if new_attr is None: if old_attr is None: new_attr = name else: new_attr = old_attr self.attr = new_attr else: self.mod = old_mod if old_attr is None: old_attr = name self.attr = old_attr
def _resolve(self): module = _import_module(self.mod) return getattr(module, self.attr)
class _SixMetaPathImporter(object):
""" A meta path importer to import six.moves and its submodules.
This class implements a PEP302 finder and loader. It should be compatible with Python 2.5 and all existing versions of Python3 """
def __init__(self, six_module_name): self.name = six_module_name self.known_modules = {}
def _add_module(self, mod, *fullnames): for fullname in fullnames: self.known_modules[self.name + "." + fullname] = mod
def _get_module(self, fullname): return self.known_modules[self.name + "." + fullname]
def find_module(self, fullname, path=None): if fullname in self.known_modules: return self return None
def find_spec(self, fullname, path, target=None): if fullname in self.known_modules: return spec_from_loader(fullname, self) return None
def __get_module(self, fullname): try: return self.known_modules[fullname] except KeyError: raise ImportError("This loader does not know module " + fullname)
def load_module(self, fullname): try: # in case of a reload return sys.modules[fullname] except KeyError: pass mod = self.__get_module(fullname) if isinstance(mod, MovedModule): mod = mod._resolve() else: mod.__loader__ = self sys.modules[fullname] = mod return mod
def is_package(self, fullname): """ Return true, if the named module is a package.
We need this method to get correct spec objects with Python 3.4 (see PEP451) """ return hasattr(self.__get_module(fullname), "__path__")
def get_code(self, fullname): """Return None
Required, if is_package is implemented""" self.__get_module(fullname) # eventually raises ImportError return None get_source = get_code # same as get_code
def create_module(self, spec): return self.load_module(spec.name)
def exec_module(self, module): pass
_importer = _SixMetaPathImporter(__name__)
class _MovedItems(_LazyModule):
"""Lazy loading of moved objects""" __path__ = [] # mark as package
_moved_attributes = [ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("intern", "__builtin__", "sys"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), MovedAttribute("getoutput", "commands", "subprocess"), MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), MovedAttribute("StringIO", "StringIO", "io"), MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"), MovedAttribute("UserList", "UserList", "collections"), MovedAttribute("UserString", "UserString", "collections"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), MovedModule("builtins", "__builtin__"), MovedModule("configparser", "ConfigParser"), MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"), MovedModule("copyreg", "copy_reg"), MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"), MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"), MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), MovedModule("http_cookies", "Cookie", "http.cookies"), MovedModule("html_entities", "htmlentitydefs", "html.entities"), MovedModule("html_parser", "HTMLParser", "html.parser"), MovedModule("http_client", "httplib", "http.client"), MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"), MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), MovedModule("cPickle", "cPickle", "pickle"), MovedModule("queue", "Queue"), MovedModule("reprlib", "repr"), MovedModule("socketserver", "SocketServer"), MovedModule("_thread", "thread", "_thread"), MovedModule("tkinter", "Tkinter"), MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), MovedModule("tkinter_tix", "Tix", "tkinter.tix"), MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"), MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), MovedModule("tkinter_colorchooser", "tkColorChooser", "tkinter.colorchooser"), MovedModule("tkinter_commondialog", "tkCommonDialog", "tkinter.commondialog"), MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), MovedModule("tkinter_font", "tkFont", "tkinter.font"), MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", "tkinter.simpledialog"), MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),]# Add windows specific modules.if sys.platform == "win32": _moved_attributes += [ MovedModule("winreg", "_winreg"), ]
for attr in _moved_attributes: setattr(_MovedItems, attr.name, attr) if isinstance(attr, MovedModule): _importer._add_module(attr, "moves." + attr.name)del attr
_MovedItems._moved_attributes = _moved_attributes
moves = _MovedItems(__name__ + ".moves")_importer._add_module(moves, "moves")
class Module_six_moves_urllib_parse(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_parse"""
_urllib_parse_moved_attributes = [ MovedAttribute("ParseResult", "urlparse", "urllib.parse"), MovedAttribute("SplitResult", "urlparse", "urllib.parse"), MovedAttribute("parse_qs", "urlparse", "urllib.parse"), MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), MovedAttribute("urldefrag", "urlparse", "urllib.parse"), MovedAttribute("urljoin", "urlparse", "urllib.parse"), MovedAttribute("urlparse", "urlparse", "urllib.parse"), MovedAttribute("urlsplit", "urlparse", "urllib.parse"), MovedAttribute("urlunparse", "urlparse", "urllib.parse"), MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), MovedAttribute("quote", "urllib", "urllib.parse"), MovedAttribute("quote_plus", "urllib", "urllib.parse"), MovedAttribute("unquote", "urllib", "urllib.parse"), MovedAttribute("unquote_plus", "urllib", "urllib.parse"), MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"), MovedAttribute("urlencode", "urllib", "urllib.parse"), MovedAttribute("splitquery", "urllib", "urllib.parse"), MovedAttribute("splittag", "urllib", "urllib.parse"), MovedAttribute("splituser", "urllib", "urllib.parse"), MovedAttribute("splitvalue", "urllib", "urllib.parse"), MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), MovedAttribute("uses_params", "urlparse", "urllib.parse"), MovedAttribute("uses_query", "urlparse", "urllib.parse"), MovedAttribute("uses_relative", "urlparse", "urllib.parse"),]for attr in _urllib_parse_moved_attributes: setattr(Module_six_moves_urllib_parse, attr.name, attr)del attr
Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), "moves.urllib_parse", "moves.urllib.parse")
class Module_six_moves_urllib_error(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_error"""
_urllib_error_moved_attributes = [ MovedAttribute("URLError", "urllib2", "urllib.error"), MovedAttribute("HTTPError", "urllib2", "urllib.error"), MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),]for attr in _urllib_error_moved_attributes: setattr(Module_six_moves_urllib_error, attr.name, attr)del attr
Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), "moves.urllib_error", "moves.urllib.error")
class Module_six_moves_urllib_request(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_request"""
_urllib_request_moved_attributes = [ MovedAttribute("urlopen", "urllib2", "urllib.request"), MovedAttribute("install_opener", "urllib2", "urllib.request"), MovedAttribute("build_opener", "urllib2", "urllib.request"), MovedAttribute("pathname2url", "urllib", "urllib.request"), MovedAttribute("url2pathname", "urllib", "urllib.request"), MovedAttribute("getproxies", "urllib", "urllib.request"), MovedAttribute("Request", "urllib2", "urllib.request"), MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), MovedAttribute("BaseHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), MovedAttribute("FileHandler", "urllib2", "urllib.request"), MovedAttribute("FTPHandler", "urllib2", "urllib.request"), MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), MovedAttribute("urlretrieve", "urllib", "urllib.request"), MovedAttribute("urlcleanup", "urllib", "urllib.request"), MovedAttribute("proxy_bypass", "urllib", "urllib.request"), MovedAttribute("parse_http_list", "urllib2", "urllib.request"), MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),]if sys.version_info[:2] < (3, 14): _urllib_request_moved_attributes.extend( [ MovedAttribute("URLopener", "urllib", "urllib.request"), MovedAttribute("FancyURLopener", "urllib", "urllib.request"), ] )for attr in _urllib_request_moved_attributes: setattr(Module_six_moves_urllib_request, attr.name, attr)del attr
Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), "moves.urllib_request", "moves.urllib.request")
class Module_six_moves_urllib_response(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_response"""
_urllib_response_moved_attributes = [ MovedAttribute("addbase", "urllib", "urllib.response"), MovedAttribute("addclosehook", "urllib", "urllib.response"), MovedAttribute("addinfo", "urllib", "urllib.response"), MovedAttribute("addinfourl", "urllib", "urllib.response"),]for attr in _urllib_response_moved_attributes: setattr(Module_six_moves_urllib_response, attr.name, attr)del attr
Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), "moves.urllib_response", "moves.urllib.response")
class Module_six_moves_urllib_robotparser(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_robotparser"""
_urllib_robotparser_moved_attributes = [ MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),]for attr in _urllib_robotparser_moved_attributes: setattr(Module_six_moves_urllib_robotparser, attr.name, attr)del attr
Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), "moves.urllib_robotparser", "moves.urllib.robotparser")
class Module_six_moves_urllib(types.ModuleType):
"""Create a six.moves.urllib namespace that resembles the Python 3 namespace""" __path__ = [] # mark as package parse = _importer._get_module("moves.urllib_parse") error = _importer._get_module("moves.urllib_error") request = _importer._get_module("moves.urllib_request") response = _importer._get_module("moves.urllib_response") robotparser = _importer._get_module("moves.urllib_robotparser")
def __dir__(self): return ['parse', 'error', 'request', 'response', 'robotparser']
_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), "moves.urllib")
def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move)
def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,))
if PY3: _meth_func = "__func__" _meth_self = "__self__"
_func_closure = "__closure__" _func_code = "__code__" _func_defaults = "__defaults__" _func_globals = "__globals__"else: _meth_func = "im_func" _meth_self = "im_self"
_func_closure = "func_closure" _func_code = "func_code" _func_defaults = "func_defaults" _func_globals = "func_globals"
try: advance_iterator = nextexcept NameError: def advance_iterator(it): return it.next()next = advance_iterator
try: callable = callableexcept NameError: def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
if PY3: def get_unbound_function(unbound): return unbound
create_bound_method = types.MethodType
def create_unbound_method(func, cls): return func
Iterator = objectelse: def get_unbound_function(unbound): return unbound.im_func
def create_bound_method(func, obj): return types.MethodType(func, obj, obj.__class__)
def create_unbound_method(func, cls): return types.MethodType(func, None, cls)
class Iterator(object):
def next(self): return type(self).__next__(self)
callable = callable_add_doc(get_unbound_function, """Get the function out of a possibly unbound function""")
get_method_function = operator.attrgetter(_meth_func)get_method_self = operator.attrgetter(_meth_self)get_function_closure = operator.attrgetter(_func_closure)get_function_code = operator.attrgetter(_func_code)get_function_defaults = operator.attrgetter(_func_defaults)get_function_globals = operator.attrgetter(_func_globals)
if PY3: def iterkeys(d, **kw): return iter(d.keys(**kw))
def itervalues(d, **kw): return iter(d.values(**kw))
def iteritems(d, **kw): return iter(d.items(**kw))
def iterlists(d, **kw): return iter(d.lists(**kw))
viewkeys = operator.methodcaller("keys")
viewvalues = operator.methodcaller("values")
viewitems = operator.methodcaller("items")else: def iterkeys(d, **kw): return d.iterkeys(**kw)
def itervalues(d, **kw): return d.itervalues(**kw)
def iteritems(d, **kw): return d.iteritems(**kw)
def iterlists(d, **kw): return d.iterlists(**kw)
viewkeys = operator.methodcaller("viewkeys")
viewvalues = operator.methodcaller("viewvalues")
viewitems = operator.methodcaller("viewitems")
_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")_add_doc(itervalues, "Return an iterator over the values of a dictionary.")_add_doc(iteritems, "Return an iterator over the (key, value) pairs of a dictionary.")_add_doc(iterlists, "Return an iterator over the (key, [values]) pairs of a dictionary.")
if PY3: def b(s): return s.encode("latin-1")
def u(s): return s unichr = chr import struct int2byte = struct.Struct(">B").pack del struct byte2int = operator.itemgetter(0) indexbytes = operator.getitem iterbytes = iter import io StringIO = io.StringIO BytesIO = io.BytesIO del io _assertCountEqual = "assertCountEqual" if sys.version_info[1] <= 1: _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" _assertNotRegex = "assertNotRegexpMatches" else: _assertRaisesRegex = "assertRaisesRegex" _assertRegex = "assertRegex" _assertNotRegex = "assertNotRegex"else: def b(s): return s # Workaround for standalone backslash
def u(s): return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") unichr = unichr int2byte = chr
def byte2int(bs): return ord(bs[0])
def indexbytes(buf, i): return ord(buf[i]) iterbytes = functools.partial(itertools.imap, ord) import StringIO StringIO = BytesIO = StringIO.StringIO _assertCountEqual = "assertItemsEqual" _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" _assertNotRegex = "assertNotRegexpMatches"_add_doc(b, """Byte literal""")_add_doc(u, """Text literal""")
def assertCountEqual(self, *args, **kwargs): return getattr(self, _assertCountEqual)(*args, **kwargs)
def assertRaisesRegex(self, *args, **kwargs): return getattr(self, _assertRaisesRegex)(*args, **kwargs)
def assertRegex(self, *args, **kwargs): return getattr(self, _assertRegex)(*args, **kwargs)
def assertNotRegex(self, *args, **kwargs): return getattr(self, _assertNotRegex)(*args, **kwargs)
if PY3: exec_ = getattr(moves.builtins, "exec")
def reraise(tp, value, tb=None): try: if value is None: value = tp() if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value finally: value = None tb = None
else: def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" if _globs_ is None: frame = sys._getframe(1) _globs_ = frame.f_globals if _locs_ is None: _locs_ = frame.f_locals del frame elif _locs_ is None: _locs_ = _globs_ exec("""exec _code_ in _globs_, _locs_""")
exec_("""def reraise(tp, value, tb=None): try: raise tp, value, tb finally: tb = None""")
if sys.version_info[:2] > (3,): exec_("""def raise_from(value, from_value): try: raise value from from_value finally: value = None""")else: def raise_from(value, from_value): raise value
print_ = getattr(moves.builtins, "print", None)if print_ is None: def print_(*args, **kwargs): """The new-style print function for Python 2.4 and 2.5.""" fp = kwargs.pop("file", sys.stdout) if fp is None: return
def write(data): if not isinstance(data, basestring): data = str(data) # If the file has an encoding, encode unicode with it. if (isinstance(fp, file) and isinstance(data, unicode) and fp.encoding is not None): errors = getattr(fp, "errors", None) if errors is None: errors = "strict" data = data.encode(fp.encoding, errors) fp.write(data) want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: if isinstance(sep, unicode): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: if isinstance(end, unicode): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") if kwargs: raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: if isinstance(arg, unicode): want_unicode = True break if want_unicode: newline = unicode("\n") space = unicode(" ") else: newline = "\n" space = " " if sep is None: sep = space if end is None: end = newline for i, arg in enumerate(args): if i: write(sep) write(arg) write(end)if sys.version_info[:2] < (3, 3): _print = print_
def print_(*args, **kwargs): fp = kwargs.get("file", sys.stdout) flush = kwargs.pop("flush", False) _print(*args, **kwargs) if flush and fp is not None: fp.flush()
_add_doc(reraise, """Reraise an exception.""")
if sys.version_info[0:2] < (3, 4): # This does exactly the same what the :func:`py3:functools.update_wrapper` # function does on Python versions after 3.2. It sets the ``__wrapped__`` # attribute on ``wrapper`` object and it doesn't raise an error if any of # the attributes mentioned in ``assigned`` and ``updated`` are missing on # ``wrapped`` object. def _update_wrapper(wrapper, wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): for attr in assigned: try: value = getattr(wrapped, attr) except AttributeError: continue else: setattr(wrapper, attr, value) for attr in updated: getattr(wrapper, attr).update(getattr(wrapped, attr, {})) wrapper.__wrapped__ = wrapped return wrapper _update_wrapper.__doc__ = functools.update_wrapper.__doc__
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): return functools.partial(_update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated) wraps.__doc__ = functools.wraps.__doc__
else: wraps = functools.wraps
def with_metaclass(meta, *bases): """Create a base class with a metaclass.""" # This requires a bit of explanation: the basic idea is to make a dummy # metaclass for one level of class instantiation that replaces itself with # the actual metaclass. class metaclass(type):
def __new__(cls, name, this_bases, d): if sys.version_info[:2] >= (3, 7): # This version introduced PEP 560 that requires a bit # of extra care (we mimic what is done by __build_class__). resolved_bases = types.resolve_bases(bases) if resolved_bases is not bases: d['__orig_bases__'] = bases else: resolved_bases = bases return meta(name, resolved_bases, d)
@classmethod def __prepare__(cls, name, this_bases): return meta.__prepare__(name, bases) return type.__new__(metaclass, 'temporary_class', (), {})
def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() slots = orig_vars.get('__slots__') if slots is not None: if isinstance(slots, str): slots = [slots] for slots_var in slots: orig_vars.pop(slots_var) orig_vars.pop('__dict__', None) orig_vars.pop('__weakref__', None) if hasattr(cls, '__qualname__'): orig_vars['__qualname__'] = cls.__qualname__ return metaclass(cls.__name__, cls.__bases__, orig_vars) return wrapper
def ensure_binary(s, encoding='utf-8', errors='strict'): """Coerce **s** to six.binary_type.
For Python 2: - `unicode` -> encoded to `str` - `str` -> `str`
For Python 3: - `str` -> encoded to `bytes` - `bytes` -> `bytes` """ if isinstance(s, binary_type): return s if isinstance(s, text_type): return s.encode(encoding, errors) raise TypeError("not expecting type '%s'" % type(s))
def ensure_str(s, encoding='utf-8', errors='strict'): """Coerce *s* to `str`.
For Python 2: - `unicode` -> encoded to `str` - `str` -> `str`
For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ # Optimization: Fast return for the common case. if type(s) is str: return s if PY2 and isinstance(s, text_type): return s.encode(encoding, errors) elif PY3 and isinstance(s, binary_type): return s.decode(encoding, errors) elif not isinstance(s, (text_type, binary_type)): raise TypeError("not expecting type '%s'" % type(s)) return s
def ensure_text(s, encoding='utf-8', errors='strict'): """Coerce *s* to six.text_type.
For Python 2: - `unicode` -> `unicode` - `str` -> `unicode`
For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if isinstance(s, binary_type): return s.decode(encoding, errors) elif isinstance(s, text_type): return s else: raise TypeError("not expecting type '%s'" % type(s))
def python_2_unicode_compatible(klass): """ A class decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. """ if PY2: if '__str__' not in klass.__dict__: raise ValueError("@python_2_unicode_compatible cannot be applied " "to %s because it doesn't define __str__()." % klass.__name__) klass.__unicode__ = klass.__str__ klass.__str__ = lambda self: self.__unicode__().encode('utf-8') return klass
# Complete the moves implementation.# This code is at the end of this module to speed up module loading.# Turn this module into a package.__path__ = [] # required for PEP 302 and PEP 451__package__ = __name__ # see PEP 366 @ReservedAssignmentif globals().get("__spec__") is not None: __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable# Remove other six meta path importers, since they cause problems. This can# happen if six is removed from sys.modules and then reloaded. (Setuptools does# this for some reason.)if sys.meta_path: for i, importer in enumerate(sys.meta_path): # Here's some real nastiness: Another "instance" of the six module might # be floating around. Therefore, we can't use isinstance() to check for # the six meta path importer, since the other six instance will have # inserted an importer with different class. if (type(importer).__name__ == "_SixMetaPathImporter" and importer.name == __name__): del sys.meta_path[i] break del i, importer# Finally, add the importer to the meta path import hook.sys.meta_path.append(_importer)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545"""SymPy is a Python library for symbolic mathematics. It aims to become afull-featured computer algebra system (CAS) while keeping the code as simpleas possible in order to be comprehensible and easily extensible. SymPy iswritten entirely in Python. It depends on mpmath, and other external librariesmay be optionally for things like plotting support.
See the webpage for more information and documentation:
https://sympy.org
"""
# Keep this in sync with setup.py/pyproject.tomlimport sysif sys.version_info < (3, 9): raise ImportError("Python version 3.9 or above is required for SymPy.")del sys
try: import mpmathexcept ImportError: raise ImportError("SymPy now depends on mpmath as an external library. " "See https://docs.sympy.org/latest/install.html#mpmath for more information.")
del mpmath
from sympy.release import __version__from sympy.core.cache import lazy_function
if 'dev' in __version__: def enable_warnings(): import warnings warnings.filterwarnings('default', '.*', DeprecationWarning, module='sympy.*') del warnings enable_warnings() del enable_warnings
def __sympy_debug(): # helper function so we don't import os globally import os debug_str = os.getenv('SYMPY_DEBUG', 'False') if debug_str in ('True', 'False'): return eval(debug_str) else: raise RuntimeError("unrecognized value for SYMPY_DEBUG: %s" % debug_str)# Fails py2 test if using type hintingSYMPY_DEBUG = __sympy_debug() # type: bool
from .core import (sympify, SympifyError, cacheit, Basic, Atom, preorder_traversal, S, Expr, AtomicExpr, UnevaluatedExpr, Symbol, Wild, Dummy, symbols, var, Number, Float, Rational, Integer, NumberSymbol, RealNumber, igcd, ilcm, seterr, E, I, nan, oo, pi, zoo, AlgebraicNumber, comp, mod_inverse, Pow, integer_nthroot, integer_log, trailing, Mul, prod, Add, Mod, Rel, Eq, Ne, Lt, Le, Gt, Ge, Equality, GreaterThan, LessThan, Unequality, StrictGreaterThan, StrictLessThan, vectorize, Lambda, WildFunction, Derivative, diff, FunctionClass, Function, Subs, expand, PoleError, count_ops, expand_mul, expand_log, expand_func, expand_trig, expand_complex, expand_multinomial, nfloat, expand_power_base, expand_power_exp, arity, PrecisionExhausted, N, evalf, Tuple, Dict, gcd_terms, factor_terms, factor_nc, evaluate, Catalan, EulerGamma, GoldenRatio, TribonacciConstant, bottom_up, use, postorder_traversal, default_sort_key, ordered, num_digits)
from .logic import (to_cnf, to_dnf, to_nnf, And, Or, Not, Xor, Nand, Nor, Implies, Equivalent, ITE, POSform, SOPform, simplify_logic, bool_map, true, false, satisfiable)
from .assumptions import (AppliedPredicate, Predicate, AssumptionsContext, assuming, Q, ask, register_handler, remove_handler, refine)
from .polys import (Poly, PurePoly, poly_from_expr, parallel_poly_from_expr, degree, total_degree, degree_list, LC, LM, LT, pdiv, prem, pquo, pexquo, div, rem, quo, exquo, half_gcdex, gcdex, invert, subresultants, resultant, discriminant, cofactors, gcd_list, gcd, lcm_list, lcm, terms_gcd, trunc, monic, content, primitive, compose, decompose, sturm, gff_list, gff, sqf_norm, sqf_part, sqf_list, sqf, factor_list, factor, intervals, refine_root, count_roots, all_roots, real_roots, nroots, ground_roots, nth_power_roots_poly, cancel, reduced, groebner, is_zero_dimensional, GroebnerBasis, poly, symmetrize, horner, interpolate, rational_interpolate, viete, together, BasePolynomialError, ExactQuotientFailed, PolynomialDivisionFailed, OperationNotSupported, HeuristicGCDFailed, HomomorphismFailed, IsomorphismFailed, ExtraneousFactors, EvaluationFailed, RefinementFailed, CoercionFailed, NotInvertible, NotReversible, NotAlgebraic, DomainError, PolynomialError, UnificationFailed, GeneratorsError, GeneratorsNeeded, ComputationFailed, UnivariatePolynomialError, MultivariatePolynomialError, PolificationFailed, OptionError, FlagError, minpoly, minimal_polynomial, primitive_element, field_isomorphism, to_number_field, isolate, round_two, prime_decomp, prime_valuation, galois_group, itermonomials, Monomial, lex, grlex, grevlex, ilex, igrlex, igrevlex, CRootOf, rootof, RootOf, ComplexRootOf, RootSum, roots, Domain, FiniteField, IntegerRing, RationalField, RealField, ComplexField, PythonFiniteField, GMPYFiniteField, PythonIntegerRing, GMPYIntegerRing, PythonRational, GMPYRationalField, AlgebraicField, PolynomialRing, FractionField, ExpressionDomain, FF_python, FF_gmpy, ZZ_python, ZZ_gmpy, QQ_python, QQ_gmpy, GF, FF, ZZ, QQ, ZZ_I, QQ_I, RR, CC, EX, EXRAW, construct_domain, swinnerton_dyer_poly, cyclotomic_poly, symmetric_poly, random_poly, interpolating_poly, jacobi_poly, chebyshevt_poly, chebyshevu_poly, hermite_poly, hermite_prob_poly, legendre_poly, laguerre_poly, apart, apart_list, assemble_partfrac_list, Options, ring, xring, vring, sring, field, xfield, vfield, sfield)
from .series import (Order, O, limit, Limit, gruntz, series, approximants, residue, EmptySequence, SeqPer, SeqFormula, sequence, SeqAdd, SeqMul, fourier_series, fps, difference_delta, limit_seq)
from .functions import (factorial, factorial2, rf, ff, binomial, RisingFactorial, FallingFactorial, subfactorial, carmichael, fibonacci, lucas, motzkin, tribonacci, harmonic, bernoulli, bell, euler, catalan, genocchi, andre, partition, divisor_sigma, legendre_symbol, jacobi_symbol, kronecker_symbol, mobius, primenu, primeomega, totient, reduced_totient, primepi, sqrt, root, Min, Max, Id, real_root, Rem, cbrt, re, im, sign, Abs, conjugate, arg, polar_lift, periodic_argument, unbranched_argument, principal_branch, transpose, adjoint, polarify, unpolarify, sin, cos, tan, sec, csc, cot, sinc, asin, acos, atan, asec, acsc, acot, atan2, exp_polar, exp, ln, log, LambertW, sinh, cosh, tanh, coth, sech, csch, asinh, acosh, atanh, acoth, asech, acsch, floor, ceiling, frac, Piecewise, piecewise_fold, piecewise_exclusive, erf, erfc, erfi, erf2, erfinv, erfcinv, erf2inv, Ei, expint, E1, li, Li, Si, Ci, Shi, Chi, fresnels, fresnelc, gamma, lowergamma, uppergamma, polygamma, loggamma, digamma, trigamma, multigamma, dirichlet_eta, zeta, lerchphi, polylog, stieltjes, Eijk, LeviCivita, KroneckerDelta, SingularityFunction, DiracDelta, Heaviside, bspline_basis, bspline_basis_set, interpolating_spline, besselj, bessely, besseli, besselk, hankel1, hankel2, jn, yn, jn_zeros, hn1, hn2, airyai, airybi, airyaiprime, airybiprime, marcumq, hyper, meijerg, appellf1, legendre, assoc_legendre, hermite, hermite_prob, chebyshevt, chebyshevu, chebyshevu_root, chebyshevt_root, laguerre, assoc_laguerre, gegenbauer, jacobi, jacobi_normalized, Ynm, Ynm_c, Znm, elliptic_k, elliptic_f, elliptic_e, elliptic_pi, beta, mathieus, mathieuc, mathieusprime, mathieucprime, riemann_xi, betainc, betainc_regularized)
from .ntheory import (nextprime, prevprime, prime, primerange, randprime, Sieve, sieve, primorial, cycle_length, composite, compositepi, isprime, divisors, proper_divisors, factorint, multiplicity, perfect_power, factor_cache, pollard_pm1, pollard_rho, primefactors, divisor_count, proper_divisor_count, factorrat, mersenne_prime_exponent, is_perfect, is_mersenne_prime, is_abundant, is_deficient, is_amicable, is_carmichael, abundance, npartitions, is_primitive_root, is_quad_residue, n_order, sqrt_mod, quadratic_residues, primitive_root, nthroot_mod, is_nthpow_residue, sqrt_mod_iter, discrete_log, quadratic_congruence, binomial_coefficients, binomial_coefficients_list, multinomial_coefficients, continued_fraction_periodic, continued_fraction_iterator, continued_fraction_reduce, continued_fraction_convergents, continued_fraction, egyptian_fraction)
from .concrete import product, Product, summation, Sum
from .discrete import (fft, ifft, ntt, intt, fwht, ifwht, mobius_transform, inverse_mobius_transform, convolution, covering_product, intersecting_product)
from .simplify import (simplify, hypersimp, hypersimilar, logcombine, separatevars, posify, besselsimp, kroneckersimp, signsimp, nsimplify, FU, fu, sqrtdenest, cse, epath, EPath, hyperexpand, collect, rcollect, radsimp, collect_const, fraction, numer, denom, trigsimp, exptrigsimp, powsimp, powdenest, combsimp, gammasimp, ratsimp, ratsimpmodprime)
from .sets import (Set, Interval, Union, EmptySet, FiniteSet, ProductSet, Intersection, DisjointUnion, imageset, Complement, SymmetricDifference, ImageSet, Range, ComplexRegion, Complexes, Reals, Contains, ConditionSet, Ordinal, OmegaPower, ord0, PowerSet, Naturals, Naturals0, UniversalSet, Integers, Rationals)
from .solvers import (solve, solve_linear_system, solve_linear_system_LU, solve_undetermined_coeffs, nsolve, solve_linear, checksol, det_quick, inv_quick, check_assumptions, failing_assumptions, diophantine, rsolve, rsolve_poly, rsolve_ratio, rsolve_hyper, checkodesol, classify_ode, dsolve, homogeneous_order, solve_poly_system, factor_system, solve_triangulated, pde_separate, pde_separate_add, pde_separate_mul, pdsolve, classify_pde, checkpdesol, ode_order, reduce_inequalities, reduce_abs_inequality, reduce_abs_inequalities, solve_poly_inequality, solve_rational_inequalities, solve_univariate_inequality, decompogen, solveset, linsolve, linear_eq_to_matrix, nonlinsolve, substitution)
from .matrices import (ShapeError, NonSquareMatrixError, GramSchmidt, casoratian, diag, eye, hessian, jordan_cell, list2numpy, matrix2numpy, matrix_multiply_elementwise, ones, randMatrix, rot_axis1, rot_axis2, rot_axis3, symarray, wronskian, zeros, MutableDenseMatrix, DeferredVector, MatrixBase, Matrix, MutableMatrix, MutableSparseMatrix, banded, ImmutableDenseMatrix, ImmutableSparseMatrix, ImmutableMatrix, SparseMatrix, MatrixSlice, BlockDiagMatrix, BlockMatrix, FunctionMatrix, Identity, Inverse, MatAdd, MatMul, MatPow, MatrixExpr, MatrixSymbol, Trace, Transpose, ZeroMatrix, OneMatrix, blockcut, block_collapse, matrix_symbols, Adjoint, hadamard_product, HadamardProduct, HadamardPower, Determinant, det, diagonalize_vector, DiagMatrix, DiagonalMatrix, DiagonalOf, trace, DotProduct, kronecker_product, KroneckerProduct, PermutationMatrix, MatrixPermute, Permanent, per, rot_ccw_axis1, rot_ccw_axis2, rot_ccw_axis3, rot_givens)
from .geometry import (Point, Point2D, Point3D, Line, Ray, Segment, Line2D, Segment2D, Ray2D, Line3D, Segment3D, Ray3D, Plane, Ellipse, Circle, Polygon, RegularPolygon, Triangle, rad, deg, are_similar, centroid, convex_hull, idiff, intersection, closest_points, farthest_points, GeometryError, Curve, Parabola)
from .utilities import (flatten, group, take, subsets, variations, numbered_symbols, cartes, capture, dict_merge, prefixes, postfixes, sift, topological_sort, unflatten, has_dups, has_variety, reshape, rotations, filldedent, lambdify, threaded, xthreaded, public, memoize_property, timed)
from .integrals import (integrate, Integral, line_integrate, mellin_transform, inverse_mellin_transform, MellinTransform, InverseMellinTransform, laplace_transform, laplace_correspondence, laplace_initial_conds, inverse_laplace_transform, LaplaceTransform, InverseLaplaceTransform, fourier_transform, inverse_fourier_transform, FourierTransform, InverseFourierTransform, sine_transform, inverse_sine_transform, SineTransform, InverseSineTransform, cosine_transform, inverse_cosine_transform, CosineTransform, InverseCosineTransform, hankel_transform, inverse_hankel_transform, HankelTransform, InverseHankelTransform, singularityintegrate)
from .tensor import (IndexedBase, Idx, Indexed, get_contraction_structure, get_indices, shape, MutableDenseNDimArray, ImmutableDenseNDimArray, MutableSparseNDimArray, ImmutableSparseNDimArray, NDimArray, tensorproduct, tensorcontraction, tensordiagonal, derive_by_array, permutedims, Array, DenseNDimArray, SparseNDimArray)
from .parsing import parse_expr
from .calculus import (euler_equations, singularities, is_increasing, is_strictly_increasing, is_decreasing, is_strictly_decreasing, is_monotonic, finite_diff_weights, apply_finite_diff, differentiate_finite, periodicity, not_empty_in, AccumBounds, is_convex, stationary_points, minimum, maximum)
from .algebras import Quaternion
from .printing import (pager_print, pretty, pretty_print, pprint, pprint_use_unicode, pprint_try_use_unicode, latex, print_latex, multiline_latex, mathml, print_mathml, python, print_python, pycode, ccode, print_ccode, smtlib_code, glsl_code, print_glsl, cxxcode, fcode, print_fcode, rcode, print_rcode, jscode, print_jscode, julia_code, mathematica_code, octave_code, rust_code, print_gtk, preview, srepr, print_tree, StrPrinter, sstr, sstrrepr, TableForm, dotprint, maple_code, print_maple_code)
test = lazy_function('sympy.testing.runtests_pytest', 'test')doctest = lazy_function('sympy.testing.runtests', 'doctest')
# This module causes conflicts with other modules:# from .stats import *# Adds about .04-.05 seconds of import time# from combinatorics import *# This module is slow to import:#from physics import unitsfrom .plotting import plot, textplot, plot_backends, plot_implicit, plot_parametricfrom .interactive import init_session, init_printing, interactive_traversal
evalf._create_evalf_table()
__all__ = [ '__version__',
# sympy.core 'sympify', 'SympifyError', 'cacheit', 'Basic', 'Atom', 'preorder_traversal', 'S', 'Expr', 'AtomicExpr', 'UnevaluatedExpr', 'Symbol', 'Wild', 'Dummy', 'symbols', 'var', 'Number', 'Float', 'Rational', 'Integer', 'NumberSymbol', 'RealNumber', 'igcd', 'ilcm', 'seterr', 'E', 'I', 'nan', 'oo', 'pi', 'zoo', 'AlgebraicNumber', 'comp', 'mod_inverse', 'Pow', 'integer_nthroot', 'integer_log', 'trailing', 'Mul', 'prod', 'Add', 'Mod', 'Rel', 'Eq', 'Ne', 'Lt', 'Le', 'Gt', 'Ge', 'Equality', 'GreaterThan', 'LessThan', 'Unequality', 'StrictGreaterThan', 'StrictLessThan', 'vectorize', 'Lambda', 'WildFunction', 'Derivative', 'diff', 'FunctionClass', 'Function', 'Subs', 'expand', 'PoleError', 'count_ops', 'expand_mul', 'expand_log', 'expand_func', 'expand_trig', 'expand_complex', 'expand_multinomial', 'nfloat', 'expand_power_base', 'expand_power_exp', 'arity', 'PrecisionExhausted', 'N', 'evalf', 'Tuple', 'Dict', 'gcd_terms', 'factor_terms', 'factor_nc', 'evaluate', 'Catalan', 'EulerGamma', 'GoldenRatio', 'TribonacciConstant', 'bottom_up', 'use', 'postorder_traversal', 'default_sort_key', 'ordered', 'num_digits',
# sympy.logic 'to_cnf', 'to_dnf', 'to_nnf', 'And', 'Or', 'Not', 'Xor', 'Nand', 'Nor', 'Implies', 'Equivalent', 'ITE', 'POSform', 'SOPform', 'simplify_logic', 'bool_map', 'true', 'false', 'satisfiable',
# sympy.assumptions 'AppliedPredicate', 'Predicate', 'AssumptionsContext', 'assuming', 'Q', 'ask', 'register_handler', 'remove_handler', 'refine',
# sympy.polys 'Poly', 'PurePoly', 'poly_from_expr', 'parallel_poly_from_expr', 'degree', 'total_degree', 'degree_list', 'LC', 'LM', 'LT', 'pdiv', 'prem', 'pquo', 'pexquo', 'div', 'rem', 'quo', 'exquo', 'half_gcdex', 'gcdex', 'invert', 'subresultants', 'resultant', 'discriminant', 'cofactors', 'gcd_list', 'gcd', 'lcm_list', 'lcm', 'terms_gcd', 'trunc', 'monic', 'content', 'primitive', 'compose', 'decompose', 'sturm', 'gff_list', 'gff', 'sqf_norm', 'sqf_part', 'sqf_list', 'sqf', 'factor_list', 'factor', 'intervals', 'refine_root', 'count_roots', 'all_roots', 'real_roots', 'nroots', 'ground_roots', 'nth_power_roots_poly', 'cancel', 'reduced', 'groebner', 'is_zero_dimensional', 'GroebnerBasis', 'poly', 'symmetrize', 'horner', 'interpolate', 'rational_interpolate', 'viete', 'together', 'BasePolynomialError', 'ExactQuotientFailed', 'PolynomialDivisionFailed', 'OperationNotSupported', 'HeuristicGCDFailed', 'HomomorphismFailed', 'IsomorphismFailed', 'ExtraneousFactors', 'EvaluationFailed', 'RefinementFailed', 'CoercionFailed', 'NotInvertible', 'NotReversible', 'NotAlgebraic', 'DomainError', 'PolynomialError', 'UnificationFailed', 'GeneratorsError', 'GeneratorsNeeded', 'ComputationFailed', 'UnivariatePolynomialError', 'MultivariatePolynomialError', 'PolificationFailed', 'OptionError', 'FlagError', 'minpoly', 'minimal_polynomial', 'primitive_element', 'field_isomorphism', 'to_number_field', 'isolate', 'round_two', 'prime_decomp', 'prime_valuation', 'galois_group', 'itermonomials', 'Monomial', 'lex', 'grlex', 'grevlex', 'ilex', 'igrlex', 'igrevlex', 'CRootOf', 'rootof', 'RootOf', 'ComplexRootOf', 'RootSum', 'roots', 'Domain', 'FiniteField', 'IntegerRing', 'RationalField', 'RealField', 'ComplexField', 'PythonFiniteField', 'GMPYFiniteField', 'PythonIntegerRing', 'GMPYIntegerRing', 'PythonRational', 'GMPYRationalField', 'AlgebraicField', 'PolynomialRing', 'FractionField', 'ExpressionDomain', 'FF_python', 'FF_gmpy', 'ZZ_python', 'ZZ_gmpy', 'QQ_python', 'QQ_gmpy', 'GF', 'FF', 'ZZ', 'QQ', 'ZZ_I', 'QQ_I', 'RR', 'CC', 'EX', 'EXRAW', 'construct_domain', 'swinnerton_dyer_poly', 'cyclotomic_poly', 'symmetric_poly', 'random_poly', 'interpolating_poly', 'jacobi_poly', 'chebyshevt_poly', 'chebyshevu_poly', 'hermite_poly', 'hermite_prob_poly', 'legendre_poly', 'laguerre_poly', 'apart', 'apart_list', 'assemble_partfrac_list', 'Options', 'ring', 'xring', 'vring', 'sring', 'field', 'xfield', 'vfield', 'sfield',
# sympy.series 'Order', 'O', 'limit', 'Limit', 'gruntz', 'series', 'approximants', 'residue', 'EmptySequence', 'SeqPer', 'SeqFormula', 'sequence', 'SeqAdd', 'SeqMul', 'fourier_series', 'fps', 'difference_delta', 'limit_seq',
# sympy.functions 'factorial', 'factorial2', 'rf', 'ff', 'binomial', 'RisingFactorial', 'FallingFactorial', 'subfactorial', 'carmichael', 'fibonacci', 'lucas', 'motzkin', 'tribonacci', 'harmonic', 'bernoulli', 'bell', 'euler', 'catalan', 'genocchi', 'andre', 'partition', 'divisor_sigma', 'legendre_symbol', 'jacobi_symbol', 'kronecker_symbol', 'mobius', 'primenu', 'primeomega', 'totient', 'primepi', 'reduced_totient', 'sqrt', 'root', 'Min', 'Max', 'Id', 'real_root', 'Rem', 'cbrt', 're', 'im', 'sign', 'Abs', 'conjugate', 'arg', 'polar_lift', 'periodic_argument', 'unbranched_argument', 'principal_branch', 'transpose', 'adjoint', 'polarify', 'unpolarify', 'sin', 'cos', 'tan', 'sec', 'csc', 'cot', 'sinc', 'asin', 'acos', 'atan', 'asec', 'acsc', 'acot', 'atan2', 'exp_polar', 'exp', 'ln', 'log', 'LambertW', 'sinh', 'cosh', 'tanh', 'coth', 'sech', 'csch', 'asinh', 'acosh', 'atanh', 'acoth', 'asech', 'acsch', 'floor', 'ceiling', 'frac', 'Piecewise', 'piecewise_fold', 'piecewise_exclusive', 'erf', 'erfc', 'erfi', 'erf2', 'erfinv', 'erfcinv', 'erf2inv', 'Ei', 'expint', 'E1', 'li', 'Li', 'Si', 'Ci', 'Shi', 'Chi', 'fresnels', 'fresnelc', 'gamma', 'lowergamma', 'uppergamma', 'polygamma', 'loggamma', 'digamma', 'trigamma', 'multigamma', 'dirichlet_eta', 'zeta', 'lerchphi', 'polylog', 'stieltjes', 'Eijk', 'LeviCivita', 'KroneckerDelta', 'SingularityFunction', 'DiracDelta', 'Heaviside', 'bspline_basis', 'bspline_basis_set', 'interpolating_spline', 'besselj', 'bessely', 'besseli', 'besselk', 'hankel1', 'hankel2', 'jn', 'yn', 'jn_zeros', 'hn1', 'hn2', 'airyai', 'airybi', 'airyaiprime', 'airybiprime', 'marcumq', 'hyper', 'meijerg', 'appellf1', 'legendre', 'assoc_legendre', 'hermite', 'hermite_prob', 'chebyshevt', 'chebyshevu', 'chebyshevu_root', 'chebyshevt_root', 'laguerre', 'assoc_laguerre', 'gegenbauer', 'jacobi', 'jacobi_normalized', 'Ynm', 'Ynm_c', 'Znm', 'elliptic_k', 'elliptic_f', 'elliptic_e', 'elliptic_pi', 'beta', 'mathieus', 'mathieuc', 'mathieusprime', 'mathieucprime', 'riemann_xi','betainc', 'betainc_regularized',
# sympy.ntheory 'nextprime', 'prevprime', 'prime', 'primerange', 'randprime', 'Sieve', 'sieve', 'primorial', 'cycle_length', 'composite', 'compositepi', 'isprime', 'divisors', 'proper_divisors', 'factorint', 'multiplicity', 'perfect_power', 'pollard_pm1', 'factor_cache', 'pollard_rho', 'primefactors', 'divisor_count', 'proper_divisor_count', 'factorrat', 'mersenne_prime_exponent', 'is_perfect', 'is_mersenne_prime', 'is_abundant', 'is_deficient', 'is_amicable', 'is_carmichael', 'abundance', 'npartitions', 'is_primitive_root', 'is_quad_residue', 'n_order', 'sqrt_mod', 'quadratic_residues', 'primitive_root', 'nthroot_mod', 'is_nthpow_residue', 'sqrt_mod_iter', 'discrete_log', 'quadratic_congruence', 'binomial_coefficients', 'binomial_coefficients_list', 'multinomial_coefficients', 'continued_fraction_periodic', 'continued_fraction_iterator', 'continued_fraction_reduce', 'continued_fraction_convergents', 'continued_fraction', 'egyptian_fraction',
# sympy.concrete 'product', 'Product', 'summation', 'Sum',
# sympy.discrete 'fft', 'ifft', 'ntt', 'intt', 'fwht', 'ifwht', 'mobius_transform', 'inverse_mobius_transform', 'convolution', 'covering_product', 'intersecting_product',
# sympy.simplify 'simplify', 'hypersimp', 'hypersimilar', 'logcombine', 'separatevars', 'posify', 'besselsimp', 'kroneckersimp', 'signsimp', 'nsimplify', 'FU', 'fu', 'sqrtdenest', 'cse', 'epath', 'EPath', 'hyperexpand', 'collect', 'rcollect', 'radsimp', 'collect_const', 'fraction', 'numer', 'denom', 'trigsimp', 'exptrigsimp', 'powsimp', 'powdenest', 'combsimp', 'gammasimp', 'ratsimp', 'ratsimpmodprime',
# sympy.sets 'Set', 'Interval', 'Union', 'EmptySet', 'FiniteSet', 'ProductSet', 'Intersection', 'imageset', 'DisjointUnion', 'Complement', 'SymmetricDifference', 'ImageSet', 'Range', 'ComplexRegion', 'Reals', 'Contains', 'ConditionSet', 'Ordinal', 'OmegaPower', 'ord0', 'PowerSet', 'Naturals', 'Naturals0', 'UniversalSet', 'Integers', 'Rationals', 'Complexes',
# sympy.solvers 'solve', 'solve_linear_system', 'solve_linear_system_LU', 'solve_undetermined_coeffs', 'nsolve', 'solve_linear', 'checksol', 'det_quick', 'inv_quick', 'check_assumptions', 'failing_assumptions', 'diophantine', 'rsolve', 'rsolve_poly', 'rsolve_ratio', 'rsolve_hyper', 'checkodesol', 'classify_ode', 'dsolve', 'homogeneous_order', 'solve_poly_system', 'factor_system', 'solve_triangulated', 'pde_separate', 'pde_separate_add', 'pde_separate_mul', 'pdsolve', 'classify_pde', 'checkpdesol', 'ode_order', 'reduce_inequalities', 'reduce_abs_inequality', 'reduce_abs_inequalities', 'solve_poly_inequality', 'solve_rational_inequalities', 'solve_univariate_inequality', 'decompogen', 'solveset', 'linsolve', 'linear_eq_to_matrix', 'nonlinsolve', 'substitution',
# sympy.matrices 'ShapeError', 'NonSquareMatrixError', 'GramSchmidt', 'casoratian', 'diag', 'eye', 'hessian', 'jordan_cell', 'list2numpy', 'matrix2numpy', 'matrix_multiply_elementwise', 'ones', 'randMatrix', 'rot_axis1', 'rot_axis2', 'rot_axis3', 'symarray', 'wronskian', 'zeros', 'MutableDenseMatrix', 'DeferredVector', 'MatrixBase', 'Matrix', 'MutableMatrix', 'MutableSparseMatrix', 'banded', 'ImmutableDenseMatrix', 'ImmutableSparseMatrix', 'ImmutableMatrix', 'SparseMatrix', 'MatrixSlice', 'BlockDiagMatrix', 'BlockMatrix', 'FunctionMatrix', 'Identity', 'Inverse', 'MatAdd', 'MatMul', 'MatPow', 'MatrixExpr', 'MatrixSymbol', 'Trace', 'Transpose', 'ZeroMatrix', 'OneMatrix', 'blockcut', 'block_collapse', 'matrix_symbols', 'Adjoint', 'hadamard_product', 'HadamardProduct', 'HadamardPower', 'Determinant', 'det', 'diagonalize_vector', 'DiagMatrix', 'DiagonalMatrix', 'DiagonalOf', 'trace', 'DotProduct', 'kronecker_product', 'KroneckerProduct', 'PermutationMatrix', 'MatrixPermute', 'Permanent', 'per', 'rot_ccw_axis1', 'rot_ccw_axis2', 'rot_ccw_axis3', 'rot_givens',
# sympy.geometry 'Point', 'Point2D', 'Point3D', 'Line', 'Ray', 'Segment', 'Line2D', 'Segment2D', 'Ray2D', 'Line3D', 'Segment3D', 'Ray3D', 'Plane', 'Ellipse', 'Circle', 'Polygon', 'RegularPolygon', 'Triangle', 'rad', 'deg', 'are_similar', 'centroid', 'convex_hull', 'idiff', 'intersection', 'closest_points', 'farthest_points', 'GeometryError', 'Curve', 'Parabola',
# sympy.utilities 'flatten', 'group', 'take', 'subsets', 'variations', 'numbered_symbols', 'cartes', 'capture', 'dict_merge', 'prefixes', 'postfixes', 'sift', 'topological_sort', 'unflatten', 'has_dups', 'has_variety', 'reshape', 'rotations', 'filldedent', 'lambdify', 'threaded', 'xthreaded', 'public', 'memoize_property', 'timed',
# sympy.integrals 'integrate', 'Integral', 'line_integrate', 'mellin_transform', 'inverse_mellin_transform', 'MellinTransform', 'InverseMellinTransform', 'laplace_transform', 'inverse_laplace_transform', 'LaplaceTransform', 'laplace_correspondence', 'laplace_initial_conds', 'InverseLaplaceTransform', 'fourier_transform', 'inverse_fourier_transform', 'FourierTransform', 'InverseFourierTransform', 'sine_transform', 'inverse_sine_transform', 'SineTransform', 'InverseSineTransform', 'cosine_transform', 'inverse_cosine_transform', 'CosineTransform', 'InverseCosineTransform', 'hankel_transform', 'inverse_hankel_transform', 'HankelTransform', 'InverseHankelTransform', 'singularityintegrate',
# sympy.tensor 'IndexedBase', 'Idx', 'Indexed', 'get_contraction_structure', 'get_indices', 'shape', 'MutableDenseNDimArray', 'ImmutableDenseNDimArray', 'MutableSparseNDimArray', 'ImmutableSparseNDimArray', 'NDimArray', 'tensorproduct', 'tensorcontraction', 'tensordiagonal', 'derive_by_array', 'permutedims', 'Array', 'DenseNDimArray', 'SparseNDimArray',
# sympy.parsing 'parse_expr',
# sympy.calculus 'euler_equations', 'singularities', 'is_increasing', 'is_strictly_increasing', 'is_decreasing', 'is_strictly_decreasing', 'is_monotonic', 'finite_diff_weights', 'apply_finite_diff', 'differentiate_finite', 'periodicity', 'not_empty_in', 'AccumBounds', 'is_convex', 'stationary_points', 'minimum', 'maximum',
# sympy.algebras 'Quaternion',
# sympy.printing 'pager_print', 'pretty', 'pretty_print', 'pprint', 'pprint_use_unicode', 'pprint_try_use_unicode', 'latex', 'print_latex', 'multiline_latex', 'mathml', 'print_mathml', 'python', 'print_python', 'pycode', 'ccode', 'print_ccode', 'smtlib_code', 'glsl_code', 'print_glsl', 'cxxcode', 'fcode', 'print_fcode', 'rcode', 'print_rcode', 'jscode', 'print_jscode', 'julia_code', 'mathematica_code', 'octave_code', 'rust_code', 'print_gtk', 'preview', 'srepr', 'print_tree', 'StrPrinter', 'sstr', 'sstrrepr', 'TableForm', 'dotprint', 'maple_code', 'print_maple_code',
# sympy.plotting 'plot', 'textplot', 'plot_backends', 'plot_implicit', 'plot_parametric',
# sympy.interactive 'init_session', 'init_printing', 'interactive_traversal',
# sympy.testing 'test', 'doctest',]
#===========================================================================## ## XXX: The names below were importable before SymPy 1.6 using ## ## from sympy import * ## ## This happened implicitly because there was no __all__ defined in this ## __init__.py file. Not every package is imported. The list matches what ## would have been imported before. It is possible that these packages will ## not be imported by a star-import from sympy in future. ## ##===========================================================================#
__all__.extend(( 'algebras', 'assumptions', 'calculus', 'concrete', 'discrete', 'external', 'functions', 'geometry', 'interactive', 'multipledispatch', 'ntheory', 'parsing', 'plotting', 'polys', 'printing', 'release', 'strategies', 'tensor', 'utilities',))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111"""This module exports all latin and greek letters as Symbols, so you canconveniently do
>>> from sympy.abc import x, y
instead of the slightly more clunky-looking
>>> from sympy import symbols >>> x, y = symbols('x y')
Caveats=======
1. As of the time of writing this, the names ``O``, ``S``, ``I``, ``N``,``E``, and ``Q`` are colliding with names defined in SymPy. If you import themfrom both ``sympy.abc`` and ``sympy``, the second import will "win".This is an issue only for * imports, which should only be used for short-livedcode such as interactive sessions and throwaway scripts that do not surviveuntil the next SymPy upgrade, where ``sympy`` may contain a different set ofnames.
2. This module does not define symbol names on demand, i.e.``from sympy.abc import foo`` will be reported as an error because``sympy.abc`` does not contain the name ``foo``. To get a symbol named ``foo``,you still need to use ``Symbol('foo')`` or ``symbols('foo')``.You can freely mix usage of ``sympy.abc`` and ``Symbol``/``symbols``, thoughsticking with one and only one way to get the symbols does tend to make the codemore readable.
The module also defines some special names to help detect which names clashwith the default SymPy namespace.
``_clash1`` defines all the single letter variables that clash withSymPy objects; ``_clash2`` defines the multi-letter clashing symbols;and ``_clash`` is the union of both. These can be passed for ``locals``during sympification if one desires Symbols rather than the non-Symbolobjects for those names.
Examples========
>>> from sympy import S>>> from sympy.abc import _clash1, _clash2, _clash>>> S("Q & C", locals=_clash1)C & Q>>> S('pi(x)', locals=_clash2)pi(x)>>> S('pi(C, Q)', locals=_clash)pi(C, Q)
"""from __future__ import annotationsfrom typing import Any
import string
from .core import Symbol, symbolsfrom .core.alphabets import greeksfrom sympy.parsing.sympy_parser import null
##### Symbol definitions #####
# Implementation note: The easiest way to avoid typos in the symbols()# parameter is to copy it from the left-hand side of the assignment.
a, b, c, d, e, f, g, h, i, j = symbols('a, b, c, d, e, f, g, h, i, j')k, l, m, n, o, p, q, r, s, t = symbols('k, l, m, n, o, p, q, r, s, t')u, v, w, x, y, z = symbols('u, v, w, x, y, z')
A, B, C, D, E, F, G, H, I, J = symbols('A, B, C, D, E, F, G, H, I, J')K, L, M, N, O, P, Q, R, S, T = symbols('K, L, M, N, O, P, Q, R, S, T')U, V, W, X, Y, Z = symbols('U, V, W, X, Y, Z')
alpha, beta, gamma, delta = symbols('alpha, beta, gamma, delta')epsilon, zeta, eta, theta = symbols('epsilon, zeta, eta, theta')iota, kappa, lamda, mu = symbols('iota, kappa, lamda, mu')nu, xi, omicron, pi = symbols('nu, xi, omicron, pi')rho, sigma, tau, upsilon = symbols('rho, sigma, tau, upsilon')phi, chi, psi, omega = symbols('phi, chi, psi, omega')
##### Clashing-symbols diagnostics #####
# We want to know which names in SymPy collide with those in here.# This is mostly for diagnosing SymPy's namespace during SymPy development.
_latin = list(string.ascii_letters)# QOSINE should not be imported as they clash; gamma, pi and zeta clash, too_greek = list(greeks) # make a copy, so we can mutate it# Note: We import lamda since lambda is a reserved keyword in Python_greek.remove("lambda")_greek.append("lamda")
ns: dict[str, Any] = {}exec('from sympy import *', ns)_clash1: dict[str, Any] = {}_clash2: dict[str, Any] = {}while ns: _k, _ = ns.popitem() if _k in _greek: _clash2[_k] = null _greek.remove(_k) elif _k in _latin: _clash1[_k] = null _latin.remove(_k)_clash = {}_clash.update(_clash1)_clash.update(_clash2)
del _latin, _greek, Symbol, _k, null123from .quaternion import Quaternion
__all__ = ["Quaternion",]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666from sympy.core.numbers import Rationalfrom sympy.core.singleton import Sfrom sympy.core.relational import is_eqfrom sympy.functions.elementary.complexes import (conjugate, im, re, sign)from sympy.functions.elementary.exponential import (exp, log as ln)from sympy.functions.elementary.miscellaneous import sqrtfrom sympy.functions.elementary.trigonometric import (acos, asin, atan2)from sympy.functions.elementary.trigonometric import (cos, sin)from sympy.simplify.trigsimp import trigsimpfrom sympy.integrals.integrals import integratefrom sympy.matrices.dense import MutableDenseMatrix as Matrixfrom sympy.core.sympify import sympify, _sympifyfrom sympy.core.expr import Exprfrom sympy.core.logic import fuzzy_not, fuzzy_orfrom sympy.utilities.misc import as_int
from mpmath.libmp.libmpf import prec_to_dps
def _check_norm(elements, norm): """validate if input norm is consistent""" if norm is not None and norm.is_number: if norm.is_positive is False: raise ValueError("Input norm must be positive.")
numerical = all(i.is_number and i.is_real is True for i in elements) if numerical and is_eq(norm**2, sum(i**2 for i in elements)) is False: raise ValueError("Incompatible value for norm.")
def _is_extrinsic(seq): """validate seq and return True if seq is lowercase and False if uppercase""" if type(seq) != str: raise ValueError('Expected seq to be a string.') if len(seq) != 3: raise ValueError("Expected 3 axes, got `{}`.".format(seq))
intrinsic = seq.isupper() extrinsic = seq.islower() if not (intrinsic or extrinsic): raise ValueError("seq must either be fully uppercase (for extrinsic " "rotations), or fully lowercase, for intrinsic " "rotations).")
i, j, k = seq.lower() if (i == j) or (j == k): raise ValueError("Consecutive axes must be different")
bad = set(seq) - set('xyzXYZ') if bad: raise ValueError("Expected axes from `seq` to be from " "['x', 'y', 'z'] or ['X', 'Y', 'Z'], " "got {}".format(''.join(bad)))
return extrinsic
class Quaternion(Expr): """Provides basic quaternion operations. Quaternion objects can be instantiated as ``Quaternion(a, b, c, d)`` as in $q = a + bi + cj + dk$.
Parameters ==========
norm : None or number Pre-defined quaternion norm. If a value is given, Quaternion.norm returns this pre-defined value instead of calculating the norm
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 2, 3, 4) >>> q 1 + 2*i + 3*j + 4*k
Quaternions over complex fields can be defined as:
>>> from sympy import Quaternion >>> from sympy import symbols, I >>> x = symbols('x') >>> q1 = Quaternion(x, x**3, x, x**2, real_field = False) >>> q2 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False) >>> q1 x + x**3*i + x*j + x**2*k >>> q2 (3 + 4*I) + (2 + 5*I)*i + 0*j + (7 + 8*I)*k
Defining symbolic unit quaternions:
>>> from sympy import Quaternion >>> from sympy.abc import w, x, y, z >>> q = Quaternion(w, x, y, z, norm=1) >>> q w + x*i + y*j + z*k >>> q.norm() 1
References ==========
.. [1] https://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/ .. [2] https://en.wikipedia.org/wiki/Quaternion
""" _op_priority = 11.0
is_commutative = False
def __new__(cls, a=0, b=0, c=0, d=0, real_field=True, norm=None): a, b, c, d = map(sympify, (a, b, c, d))
if any(i.is_commutative is False for i in [a, b, c, d]): raise ValueError("arguments have to be commutative") obj = super().__new__(cls, a, b, c, d) obj._real_field = real_field obj.set_norm(norm) return obj
def set_norm(self, norm): """Sets norm of an already instantiated quaternion.
Parameters ==========
norm : None or number Pre-defined quaternion norm. If a value is given, Quaternion.norm returns this pre-defined value instead of calculating the norm
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> q = Quaternion(a, b, c, d) >>> q.norm() sqrt(a**2 + b**2 + c**2 + d**2)
Setting the norm:
>>> q.set_norm(1) >>> q.norm() 1
Removing set norm:
>>> q.set_norm(None) >>> q.norm() sqrt(a**2 + b**2 + c**2 + d**2)
""" norm = sympify(norm) _check_norm(self.args, norm) self._norm = norm
@property def a(self): return self.args[0]
@property def b(self): return self.args[1]
@property def c(self): return self.args[2]
@property def d(self): return self.args[3]
@property def real_field(self): return self._real_field
@property def product_matrix_left(self): r"""Returns 4 x 4 Matrix equivalent to a Hamilton product from the left. This can be useful when treating quaternion elements as column vectors. Given a quaternion $q = a + bi + cj + dk$ where a, b, c and d are real numbers, the product matrix from the left is:
.. math::
M = \begin{bmatrix} a &-b &-c &-d \\ b & a &-d & c \\ c & d & a &-b \\ d &-c & b & a \end{bmatrix}
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> q1 = Quaternion(1, 0, 0, 1) >>> q2 = Quaternion(a, b, c, d) >>> q1.product_matrix_left Matrix([ [1, 0, 0, -1], [0, 1, -1, 0], [0, 1, 1, 0], [1, 0, 0, 1]])
>>> q1.product_matrix_left * q2.to_Matrix() Matrix([ [a - d], [b - c], [b + c], [a + d]])
This is equivalent to:
>>> (q1 * q2).to_Matrix() Matrix([ [a - d], [b - c], [b + c], [a + d]]) """ return Matrix([ [self.a, -self.b, -self.c, -self.d], [self.b, self.a, -self.d, self.c], [self.c, self.d, self.a, -self.b], [self.d, -self.c, self.b, self.a]])
@property def product_matrix_right(self): r"""Returns 4 x 4 Matrix equivalent to a Hamilton product from the right. This can be useful when treating quaternion elements as column vectors. Given a quaternion $q = a + bi + cj + dk$ where a, b, c and d are real numbers, the product matrix from the left is:
.. math::
M = \begin{bmatrix} a &-b &-c &-d \\ b & a & d &-c \\ c &-d & a & b \\ d & c &-b & a \end{bmatrix}
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> q1 = Quaternion(a, b, c, d) >>> q2 = Quaternion(1, 0, 0, 1) >>> q2.product_matrix_right Matrix([ [1, 0, 0, -1], [0, 1, 1, 0], [0, -1, 1, 0], [1, 0, 0, 1]])
Note the switched arguments: the matrix represents the quaternion on the right, but is still considered as a matrix multiplication from the left.
>>> q2.product_matrix_right * q1.to_Matrix() Matrix([ [ a - d], [ b + c], [-b + c], [ a + d]])
This is equivalent to:
>>> (q1 * q2).to_Matrix() Matrix([ [ a - d], [ b + c], [-b + c], [ a + d]]) """ return Matrix([ [self.a, -self.b, -self.c, -self.d], [self.b, self.a, self.d, -self.c], [self.c, -self.d, self.a, self.b], [self.d, self.c, -self.b, self.a]])
def to_Matrix(self, vector_only=False): """Returns elements of quaternion as a column vector. By default, a ``Matrix`` of length 4 is returned, with the real part as the first element. If ``vector_only`` is ``True``, returns only imaginary part as a Matrix of length 3.
Parameters ==========
vector_only : bool If True, only imaginary part is returned. Default value: False
Returns =======
Matrix A column vector constructed by the elements of the quaternion.
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> q = Quaternion(a, b, c, d) >>> q a + b*i + c*j + d*k
>>> q.to_Matrix() Matrix([ [a], [b], [c], [d]])
>>> q.to_Matrix(vector_only=True) Matrix([ [b], [c], [d]])
""" if vector_only: return Matrix(self.args[1:]) else: return Matrix(self.args)
@classmethod def from_Matrix(cls, elements): """Returns quaternion from elements of a column vector`. If vector_only is True, returns only imaginary part as a Matrix of length 3.
Parameters ==========
elements : Matrix, list or tuple of length 3 or 4. If length is 3, assume real part is zero. Default value: False
Returns =======
Quaternion A quaternion created from the input elements.
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> q = Quaternion.from_Matrix([a, b, c, d]) >>> q a + b*i + c*j + d*k
>>> q = Quaternion.from_Matrix([b, c, d]) >>> q 0 + b*i + c*j + d*k
""" length = len(elements) if length != 3 and length != 4: raise ValueError("Input elements must have length 3 or 4, got {} " "elements".format(length))
if length == 3: return Quaternion(0, *elements) else: return Quaternion(*elements)
@classmethod def from_euler(cls, angles, seq): """Returns quaternion equivalent to rotation represented by the Euler angles, in the sequence defined by ``seq``.
Parameters ==========
angles : list, tuple or Matrix of 3 numbers The Euler angles (in radians). seq : string of length 3 Represents the sequence of rotations. For extrinsic rotations, seq must be all lowercase and its elements must be from the set ``{'x', 'y', 'z'}`` For intrinsic rotations, seq must be all uppercase and its elements must be from the set ``{'X', 'Y', 'Z'}``
Returns =======
Quaternion The normalized rotation quaternion calculated from the Euler angles in the given sequence.
Examples ========
>>> from sympy import Quaternion >>> from sympy import pi >>> q = Quaternion.from_euler([pi/2, 0, 0], 'xyz') >>> q sqrt(2)/2 + sqrt(2)/2*i + 0*j + 0*k
>>> q = Quaternion.from_euler([0, pi/2, pi] , 'zyz') >>> q 0 + (-sqrt(2)/2)*i + 0*j + sqrt(2)/2*k
>>> q = Quaternion.from_euler([0, pi/2, pi] , 'ZYZ') >>> q 0 + sqrt(2)/2*i + 0*j + sqrt(2)/2*k
"""
if len(angles) != 3: raise ValueError("3 angles must be given.")
extrinsic = _is_extrinsic(seq) i, j, k = seq.lower()
# get elementary basis vectors ei = [1 if n == i else 0 for n in 'xyz'] ej = [1 if n == j else 0 for n in 'xyz'] ek = [1 if n == k else 0 for n in 'xyz']
# calculate distinct quaternions qi = cls.from_axis_angle(ei, angles[0]) qj = cls.from_axis_angle(ej, angles[1]) qk = cls.from_axis_angle(ek, angles[2])
if extrinsic: return trigsimp(qk * qj * qi) else: return trigsimp(qi * qj * qk)
def to_euler(self, seq, angle_addition=True, avoid_square_root=False): r"""Returns Euler angles representing same rotation as the quaternion, in the sequence given by ``seq``. This implements the method described in [1]_.
For degenerate cases (gymbal lock cases), the third angle is set to zero.
Parameters ==========
seq : string of length 3 Represents the sequence of rotations. For extrinsic rotations, seq must be all lowercase and its elements must be from the set ``{'x', 'y', 'z'}`` For intrinsic rotations, seq must be all uppercase and its elements must be from the set ``{'X', 'Y', 'Z'}``
angle_addition : bool When True, first and third angles are given as an addition and subtraction of two simpler ``atan2`` expressions. When False, the first and third angles are each given by a single more complicated ``atan2`` expression. This equivalent expression is given by:
.. math::
\operatorname{atan_2} (b,a) \pm \operatorname{atan_2} (d,c) = \operatorname{atan_2} (bc\pm ad, ac\mp bd)
Default value: True
avoid_square_root : bool When True, the second angle is calculated with an expression based on ``acos``, which is slightly more complicated but avoids a square root. When False, second angle is calculated with ``atan2``, which is simpler and can be better for numerical reasons (some numerical implementations of ``acos`` have problems near zero). Default value: False
Returns =======
Tuple The Euler angles calculated from the quaternion
Examples ========
>>> from sympy import Quaternion >>> from sympy.abc import a, b, c, d >>> euler = Quaternion(a, b, c, d).to_euler('zyz') >>> euler (-atan2(-b, c) + atan2(d, a), 2*atan2(sqrt(b**2 + c**2), sqrt(a**2 + d**2)), atan2(-b, c) + atan2(d, a))
References ==========
.. [1] https://doi.org/10.1371/journal.pone.0276302
""" if self.is_zero_quaternion(): raise ValueError('Cannot convert a quaternion with norm 0.')
angles = [0, 0, 0]
extrinsic = _is_extrinsic(seq) i, j, k = seq.lower()
# get index corresponding to elementary basis vectors i = 'xyz'.index(i) + 1 j = 'xyz'.index(j) + 1 k = 'xyz'.index(k) + 1
if not extrinsic: i, k = k, i
# check if sequence is symmetric symmetric = i == k if symmetric: k = 6 - i - j
# parity of the permutation sign = (i - j) * (j - k) * (k - i) // 2
# permutate elements elements = [self.a, self.b, self.c, self.d] a = elements[0] b = elements[i] c = elements[j] d = elements[k] * sign
if not symmetric: a, b, c, d = a - c, b + d, c + a, d - b
if avoid_square_root: if symmetric: n2 = self.norm()**2 angles[1] = acos((a * a + b * b - c * c - d * d) / n2) else: n2 = 2 * self.norm()**2 angles[1] = asin((c * c + d * d - a * a - b * b) / n2) else: angles[1] = 2 * atan2(sqrt(c * c + d * d), sqrt(a * a + b * b)) if not symmetric: angles[1] -= S.Pi / 2
# Check for singularities in numerical cases case = 0 if is_eq(c, S.Zero) and is_eq(d, S.Zero): case = 1 if is_eq(a, S.Zero) and is_eq(b, S.Zero): case = 2
if case == 0: if angle_addition: angles[0] = atan2(b, a) + atan2(d, c) angles[2] = atan2(b, a) - atan2(d, c) else: angles[0] = atan2(b*c + a*d, a*c - b*d) angles[2] = atan2(b*c - a*d, a*c + b*d)
else: # any degenerate case angles[2 * (not extrinsic)] = S.Zero if case == 1: angles[2 * extrinsic] = 2 * atan2(b, a) else: angles[2 * extrinsic] = 2 * atan2(d, c) angles[2 * extrinsic] *= (-1 if extrinsic else 1)
# for Tait-Bryan angles if not symmetric: angles[0] *= sign
if extrinsic: return tuple(angles[::-1]) else: return tuple(angles)
@classmethod def from_axis_angle(cls, vector, angle): """Returns a rotation quaternion given the axis and the angle of rotation.
Parameters ==========
vector : tuple of three numbers The vector representation of the given axis. angle : number The angle by which axis is rotated (in radians).
Returns =======
Quaternion The normalized rotation quaternion calculated from the given axis and the angle of rotation.
Examples ========
>>> from sympy import Quaternion >>> from sympy import pi, sqrt >>> q = Quaternion.from_axis_angle((sqrt(3)/3, sqrt(3)/3, sqrt(3)/3), 2*pi/3) >>> q 1/2 + 1/2*i + 1/2*j + 1/2*k
""" (x, y, z) = vector norm = sqrt(x**2 + y**2 + z**2) (x, y, z) = (x / norm, y / norm, z / norm) s = sin(angle * S.Half) a = cos(angle * S.Half) b = x * s c = y * s d = z * s
# note that this quaternion is already normalized by construction: # c^2 + (s*x)^2 + (s*y)^2 + (s*z)^2 = c^2 + s^2*(x^2 + y^2 + z^2) = c^2 + s^2 * 1 = c^2 + s^2 = 1 # so, what we return is a normalized quaternion
return cls(a, b, c, d)
@classmethod def from_rotation_matrix(cls, M): """Returns the equivalent quaternion of a matrix. The quaternion will be normalized only if the matrix is special orthogonal (orthogonal and det(M) = 1).
Parameters ==========
M : Matrix Input matrix to be converted to equivalent quaternion. M must be special orthogonal (orthogonal and det(M) = 1) for the quaternion to be normalized.
Returns =======
Quaternion The quaternion equivalent to given matrix.
Examples ========
>>> from sympy import Quaternion >>> from sympy import Matrix, symbols, cos, sin, trigsimp >>> x = symbols('x') >>> M = Matrix([[cos(x), -sin(x), 0], [sin(x), cos(x), 0], [0, 0, 1]]) >>> q = trigsimp(Quaternion.from_rotation_matrix(M)) >>> q sqrt(2)*sqrt(cos(x) + 1)/2 + 0*i + 0*j + sqrt(2 - 2*cos(x))*sign(sin(x))/2*k
"""
absQ = M.det()**Rational(1, 3)
a = sqrt(absQ + M[0, 0] + M[1, 1] + M[2, 2]) / 2 b = sqrt(absQ + M[0, 0] - M[1, 1] - M[2, 2]) / 2 c = sqrt(absQ - M[0, 0] + M[1, 1] - M[2, 2]) / 2 d = sqrt(absQ - M[0, 0] - M[1, 1] + M[2, 2]) / 2
b = b * sign(M[2, 1] - M[1, 2]) c = c * sign(M[0, 2] - M[2, 0]) d = d * sign(M[1, 0] - M[0, 1])
return Quaternion(a, b, c, d)
def __add__(self, other): return self.add(other)
def __radd__(self, other): return self.add(other)
def __sub__(self, other): return self.add(other*-1)
def __mul__(self, other): return self._generic_mul(self, _sympify(other))
def __rmul__(self, other): return self._generic_mul(_sympify(other), self)
def __pow__(self, p): return self.pow(p)
def __neg__(self): return Quaternion(-self.a, -self.b, -self.c, -self.d)
def __truediv__(self, other): return self * sympify(other)**-1
def __rtruediv__(self, other): return sympify(other) * self**-1
def _eval_Integral(self, *args): return self.integrate(*args)
def diff(self, *symbols, **kwargs): kwargs.setdefault('evaluate', True) return self.func(*[a.diff(*symbols, **kwargs) for a in self.args])
def add(self, other): """Adds quaternions.
Parameters ==========
other : Quaternion The quaternion to add to current (self) quaternion.
Returns =======
Quaternion The resultant quaternion after adding self to other
Examples ========
>>> from sympy import Quaternion >>> from sympy import symbols >>> q1 = Quaternion(1, 2, 3, 4) >>> q2 = Quaternion(5, 6, 7, 8) >>> q1.add(q2) 6 + 8*i + 10*j + 12*k >>> q1 + 5 6 + 2*i + 3*j + 4*k >>> x = symbols('x', real = True) >>> q1.add(x) (x + 1) + 2*i + 3*j + 4*k
Quaternions over complex fields :
>>> from sympy import Quaternion >>> from sympy import I >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False) >>> q3.add(2 + 3*I) (5 + 7*I) + (2 + 5*I)*i + 0*j + (7 + 8*I)*k
""" q1 = self q2 = sympify(other)
# If q2 is a number or a SymPy expression instead of a quaternion if not isinstance(q2, Quaternion): if q1.real_field and q2.is_complex: return Quaternion(re(q2) + q1.a, im(q2) + q1.b, q1.c, q1.d) elif q2.is_commutative: return Quaternion(q1.a + q2, q1.b, q1.c, q1.d) else: raise ValueError("Only commutative expressions can be added with a Quaternion.")
return Quaternion(q1.a + q2.a, q1.b + q2.b, q1.c + q2.c, q1.d + q2.d)
def mul(self, other): """Multiplies quaternions.
Parameters ==========
other : Quaternion or symbol The quaternion to multiply to current (self) quaternion.
Returns =======
Quaternion The resultant quaternion after multiplying self with other
Examples ========
>>> from sympy import Quaternion >>> from sympy import symbols >>> q1 = Quaternion(1, 2, 3, 4) >>> q2 = Quaternion(5, 6, 7, 8) >>> q1.mul(q2) (-60) + 12*i + 30*j + 24*k >>> q1.mul(2) 2 + 4*i + 6*j + 8*k >>> x = symbols('x', real = True) >>> q1.mul(x) x + 2*x*i + 3*x*j + 4*x*k
Quaternions over complex fields :
>>> from sympy import Quaternion >>> from sympy import I >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False) >>> q3.mul(2 + 3*I) (2 + 3*I)*(3 + 4*I) + (2 + 3*I)*(2 + 5*I)*i + 0*j + (2 + 3*I)*(7 + 8*I)*k
""" return self._generic_mul(self, _sympify(other))
@staticmethod def _generic_mul(q1, q2): """Generic multiplication.
Parameters ==========
q1 : Quaternion or symbol q2 : Quaternion or symbol
It is important to note that if neither q1 nor q2 is a Quaternion, this function simply returns q1 * q2.
Returns =======
Quaternion The resultant quaternion after multiplying q1 and q2
Examples ========
>>> from sympy import Quaternion >>> from sympy import Symbol, S >>> q1 = Quaternion(1, 2, 3, 4) >>> q2 = Quaternion(5, 6, 7, 8) >>> Quaternion._generic_mul(q1, q2) (-60) + 12*i + 30*j + 24*k >>> Quaternion._generic_mul(q1, S(2)) 2 + 4*i + 6*j + 8*k >>> x = Symbol('x', real = True) >>> Quaternion._generic_mul(q1, x) x + 2*x*i + 3*x*j + 4*x*k
Quaternions over complex fields :
>>> from sympy import I >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False) >>> Quaternion._generic_mul(q3, 2 + 3*I) (2 + 3*I)*(3 + 4*I) + (2 + 3*I)*(2 + 5*I)*i + 0*j + (2 + 3*I)*(7 + 8*I)*k
""" # None is a Quaternion: if not isinstance(q1, Quaternion) and not isinstance(q2, Quaternion): return q1 * q2
# If q1 is a number or a SymPy expression instead of a quaternion if not isinstance(q1, Quaternion): if q2.real_field and q1.is_complex: return Quaternion(re(q1), im(q1), 0, 0) * q2 elif q1.is_commutative: return Quaternion(q1 * q2.a, q1 * q2.b, q1 * q2.c, q1 * q2.d) else: raise ValueError("Only commutative expressions can be multiplied with a Quaternion.")
# If q2 is a number or a SymPy expression instead of a quaternion if not isinstance(q2, Quaternion): if q1.real_field and q2.is_complex: return q1 * Quaternion(re(q2), im(q2), 0, 0) elif q2.is_commutative: return Quaternion(q2 * q1.a, q2 * q1.b, q2 * q1.c, q2 * q1.d) else: raise ValueError("Only commutative expressions can be multiplied with a Quaternion.")
# If any of the quaternions has a fixed norm, pre-compute norm if q1._norm is None and q2._norm is None: norm = None else: norm = q1.norm() * q2.norm()
return Quaternion(-q1.b*q2.b - q1.c*q2.c - q1.d*q2.d + q1.a*q2.a, q1.b*q2.a + q1.c*q2.d - q1.d*q2.c + q1.a*q2.b, -q1.b*q2.d + q1.c*q2.a + q1.d*q2.b + q1.a*q2.c, q1.b*q2.c - q1.c*q2.b + q1.d*q2.a + q1.a * q2.d, norm=norm)
def _eval_conjugate(self): """Returns the conjugate of the quaternion.""" q = self return Quaternion(q.a, -q.b, -q.c, -q.d, norm=q._norm)
def norm(self): """Returns the norm of the quaternion.""" if self._norm is None: # check if norm is pre-defined q = self # trigsimp is used to simplify sin(x)^2 + cos(x)^2 (these terms # arise when from_axis_angle is used). return sqrt(trigsimp(q.a**2 + q.b**2 + q.c**2 + q.d**2))
return self._norm
def normalize(self): """Returns the normalized form of the quaternion.""" q = self return q * (1/q.norm())
def inverse(self): """Returns the inverse of the quaternion.""" q = self if not q.norm(): raise ValueError("Cannot compute inverse for a quaternion with zero norm") return conjugate(q) * (1/q.norm()**2)
def pow(self, p): """Finds the pth power of the quaternion.
Parameters ==========
p : int Power to be applied on quaternion.
Returns =======
Quaternion Returns the p-th power of the current quaternion. Returns the inverse if p = -1.
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 2, 3, 4) >>> q.pow(4) 668 + (-224)*i + (-336)*j + (-448)*k
""" try: q, p = self, as_int(p) except ValueError: return NotImplemented
if p < 0: q, p = q.inverse(), -p
if p == 1: return q
res = Quaternion(1, 0, 0, 0) while p > 0: if p & 1: res *= q q *= q p >>= 1
return res
def exp(self): """Returns the exponential of $q$, given by $e^q$.
Returns =======
Quaternion The exponential of the quaternion.
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 2, 3, 4) >>> q.exp() E*cos(sqrt(29)) + 2*sqrt(29)*E*sin(sqrt(29))/29*i + 3*sqrt(29)*E*sin(sqrt(29))/29*j + 4*sqrt(29)*E*sin(sqrt(29))/29*k
""" # exp(q) = e^a(cos||v|| + v/||v||*sin||v||) q = self vector_norm = sqrt(q.b**2 + q.c**2 + q.d**2) a = exp(q.a) * cos(vector_norm) b = exp(q.a) * sin(vector_norm) * q.b / vector_norm c = exp(q.a) * sin(vector_norm) * q.c / vector_norm d = exp(q.a) * sin(vector_norm) * q.d / vector_norm
return Quaternion(a, b, c, d)
def log(self): r"""Returns the logarithm of the quaternion, given by $\log q$.
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 2, 3, 4) >>> q.log() log(sqrt(30)) + 2*sqrt(29)*acos(sqrt(30)/30)/29*i + 3*sqrt(29)*acos(sqrt(30)/30)/29*j + 4*sqrt(29)*acos(sqrt(30)/30)/29*k
""" # log(q) = log||q|| + v/||v||*arccos(a/||q||) q = self vector_norm = sqrt(q.b**2 + q.c**2 + q.d**2) q_norm = q.norm() a = ln(q_norm) b = q.b * acos(q.a / q_norm) / vector_norm c = q.c * acos(q.a / q_norm) / vector_norm d = q.d * acos(q.a / q_norm) / vector_norm
return Quaternion(a, b, c, d)
def _eval_subs(self, *args): elements = [i.subs(*args) for i in self.args] norm = self._norm if norm is not None: norm = norm.subs(*args) _check_norm(elements, norm) return Quaternion(*elements, norm=norm)
def _eval_evalf(self, prec): """Returns the floating point approximations (decimal numbers) of the quaternion.
Returns =======
Quaternion Floating point approximations of quaternion(self)
Examples ========
>>> from sympy import Quaternion >>> from sympy import sqrt >>> q = Quaternion(1/sqrt(1), 1/sqrt(2), 1/sqrt(3), 1/sqrt(4)) >>> q.evalf() 1.00000000000000 + 0.707106781186547*i + 0.577350269189626*j + 0.500000000000000*k
""" nprec = prec_to_dps(prec) return Quaternion(*[arg.evalf(n=nprec) for arg in self.args])
def pow_cos_sin(self, p): """Computes the pth power in the cos-sin form.
Parameters ==========
p : int Power to be applied on quaternion.
Returns =======
Quaternion The p-th power in the cos-sin form.
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 2, 3, 4) >>> q.pow_cos_sin(4) 900*cos(4*acos(sqrt(30)/30)) + 1800*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*i + 2700*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*j + 3600*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*k
""" # q = ||q||*(cos(a) + u*sin(a)) # q^p = ||q||^p * (cos(p*a) + u*sin(p*a))
q = self (v, angle) = q.to_axis_angle() q2 = Quaternion.from_axis_angle(v, p * angle) return q2 * (q.norm()**p)
def integrate(self, *args): """Computes integration of quaternion.
Returns =======
Quaternion Integration of the quaternion(self) with the given variable.
Examples ========
Indefinite Integral of quaternion :
>>> from sympy import Quaternion >>> from sympy.abc import x >>> q = Quaternion(1, 2, 3, 4) >>> q.integrate(x) x + 2*x*i + 3*x*j + 4*x*k
Definite integral of quaternion :
>>> from sympy import Quaternion >>> from sympy.abc import x >>> q = Quaternion(1, 2, 3, 4) >>> q.integrate((x, 1, 5)) 4 + 8*i + 12*j + 16*k
""" return Quaternion(integrate(self.a, *args), integrate(self.b, *args), integrate(self.c, *args), integrate(self.d, *args))
@staticmethod def rotate_point(pin, r): """Returns the coordinates of the point pin (a 3 tuple) after rotation.
Parameters ==========
pin : tuple A 3-element tuple of coordinates of a point which needs to be rotated. r : Quaternion or tuple Axis and angle of rotation.
It's important to note that when r is a tuple, it must be of the form (axis, angle)
Returns =======
tuple The coordinates of the point after rotation.
Examples ========
>>> from sympy import Quaternion >>> from sympy import symbols, trigsimp, cos, sin >>> x = symbols('x') >>> q = Quaternion(cos(x/2), 0, 0, sin(x/2)) >>> trigsimp(Quaternion.rotate_point((1, 1, 1), q)) (sqrt(2)*cos(x + pi/4), sqrt(2)*sin(x + pi/4), 1) >>> (axis, angle) = q.to_axis_angle() >>> trigsimp(Quaternion.rotate_point((1, 1, 1), (axis, angle))) (sqrt(2)*cos(x + pi/4), sqrt(2)*sin(x + pi/4), 1)
""" if isinstance(r, tuple): # if r is of the form (vector, angle) q = Quaternion.from_axis_angle(r[0], r[1]) else: # if r is a quaternion q = r.normalize() pout = q * Quaternion(0, pin[0], pin[1], pin[2]) * conjugate(q) return (pout.b, pout.c, pout.d)
def to_axis_angle(self): """Returns the axis and angle of rotation of a quaternion.
Returns =======
tuple Tuple of (axis, angle)
Examples ========
>>> from sympy import Quaternion >>> q = Quaternion(1, 1, 1, 1) >>> (axis, angle) = q.to_axis_angle() >>> axis (sqrt(3)/3, sqrt(3)/3, sqrt(3)/3) >>> angle 2*pi/3
""" q = self if q.a.is_negative: q = q * -1
q = q.normalize() angle = trigsimp(2 * acos(q.a))
# Since quaternion is normalised, q.a is less than 1. s = sqrt(1 - q.a*q.a)
x = trigsimp(q.b / s) y = trigsimp(q.c / s) z = trigsimp(q.d / s)
v = (x, y, z) t = (v, angle)
return t
def to_rotation_matrix(self, v=None, homogeneous=True): """Returns the equivalent rotation transformation matrix of the quaternion which represents rotation about the origin if ``v`` is not passed.
Parameters ==========
v : tuple or None Default value: None homogeneous : bool When True, gives an expression that may be more efficient for symbolic calculations but less so for direct evaluation. Both formulas are mathematically equivalent. Default value: True
Returns =======
tuple Returns the equivalent rotation transformation matrix of the quaternion which represents rotation about the origin if v is not passed.
Examples ========
>>> from sympy import Quaternion >>> from sympy import symbols, trigsimp, cos, sin >>> x = symbols('x') >>> q = Quaternion(cos(x/2), 0, 0, sin(x/2)) >>> trigsimp(q.to_rotation_matrix()) Matrix([ [cos(x), -sin(x), 0], [sin(x), cos(x), 0], [ 0, 0, 1]])
Generates a 4x4 transformation matrix (used for rotation about a point other than the origin) if the point(v) is passed as an argument. """
q = self s = q.norm()**-2
# diagonal elements are different according to parameter normal if homogeneous: m00 = s*(q.a**2 + q.b**2 - q.c**2 - q.d**2) m11 = s*(q.a**2 - q.b**2 + q.c**2 - q.d**2) m22 = s*(q.a**2 - q.b**2 - q.c**2 + q.d**2) else: m00 = 1 - 2*s*(q.c**2 + q.d**2) m11 = 1 - 2*s*(q.b**2 + q.d**2) m22 = 1 - 2*s*(q.b**2 + q.c**2)
m01 = 2*s*(q.b*q.c - q.d*q.a) m02 = 2*s*(q.b*q.d + q.c*q.a)
m10 = 2*s*(q.b*q.c + q.d*q.a) m12 = 2*s*(q.c*q.d - q.b*q.a)
m20 = 2*s*(q.b*q.d - q.c*q.a) m21 = 2*s*(q.c*q.d + q.b*q.a)
if not v: return Matrix([[m00, m01, m02], [m10, m11, m12], [m20, m21, m22]])
else: (x, y, z) = v
m03 = x - x*m00 - y*m01 - z*m02 m13 = y - x*m10 - y*m11 - z*m12 m23 = z - x*m20 - y*m21 - z*m22 m30 = m31 = m32 = 0 m33 = 1
return Matrix([[m00, m01, m02, m03], [m10, m11, m12, m13], [m20, m21, m22, m23], [m30, m31, m32, m33]])
def scalar_part(self): r"""Returns scalar part($\mathbf{S}(q)$) of the quaternion q.
Explanation ===========
Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{S}(q) = a$.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(4, 8, 13, 12) >>> q.scalar_part() 4
"""
return self.a
def vector_part(self): r""" Returns $\mathbf{V}(q)$, the vector part of the quaternion $q$.
Explanation ===========
Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{V}(q) = bi + cj + dk$.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(1, 1, 1, 1) >>> q.vector_part() 0 + 1*i + 1*j + 1*k
>>> q = Quaternion(4, 8, 13, 12) >>> q.vector_part() 0 + 8*i + 13*j + 12*k
"""
return Quaternion(0, self.b, self.c, self.d)
def axis(self): r""" Returns $\mathbf{Ax}(q)$, the axis of the quaternion $q$.
Explanation ===========
Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{Ax}(q)$ i.e., the versor of the vector part of that quaternion equal to $\mathbf{U}[\mathbf{V}(q)]$. The axis is always an imaginary unit with square equal to $-1 + 0i + 0j + 0k$.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(1, 1, 1, 1) >>> q.axis() 0 + sqrt(3)/3*i + sqrt(3)/3*j + sqrt(3)/3*k
See Also ========
vector_part
""" axis = self.vector_part().normalize()
return Quaternion(0, axis.b, axis.c, axis.d)
def is_pure(self): """ Returns true if the quaternion is pure, false if the quaternion is not pure or returns none if it is unknown.
Explanation ===========
A pure quaternion (also a vector quaternion) is a quaternion with scalar part equal to 0.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(0, 8, 13, 12) >>> q.is_pure() True
See Also ======== scalar_part
"""
return self.a.is_zero
def is_zero_quaternion(self): """ Returns true if the quaternion is a zero quaternion or false if it is not a zero quaternion and None if the value is unknown.
Explanation ===========
A zero quaternion is a quaternion with both scalar part and vector part equal to 0.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(1, 0, 0, 0) >>> q.is_zero_quaternion() False
>>> q = Quaternion(0, 0, 0, 0) >>> q.is_zero_quaternion() True
See Also ======== scalar_part vector_part
"""
return self.norm().is_zero
def angle(self): r""" Returns the angle of the quaternion measured in the real-axis plane.
Explanation ===========
Given a quaternion $q = a + bi + cj + dk$ where $a$, $b$, $c$ and $d$ are real numbers, returns the angle of the quaternion given by
.. math:: \theta := 2 \operatorname{atan_2}\left(\sqrt{b^2 + c^2 + d^2}, {a}\right)
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(1, 4, 4, 4) >>> q.angle() 2*atan(4*sqrt(3))
"""
return 2 * atan2(self.vector_part().norm(), self.scalar_part())
def arc_coplanar(self, other): """ Returns True if the transformation arcs represented by the input quaternions happen in the same plane.
Explanation ===========
Two quaternions are said to be coplanar (in this arc sense) when their axes are parallel. The plane of a quaternion is the one normal to its axis.
Parameters ==========
other : a Quaternion
Returns =======
True : if the planes of the two quaternions are the same, apart from its orientation/sign. False : if the planes of the two quaternions are not the same, apart from its orientation/sign. None : if plane of either of the quaternion is unknown.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q1 = Quaternion(1, 4, 4, 4) >>> q2 = Quaternion(3, 8, 8, 8) >>> Quaternion.arc_coplanar(q1, q2) True
>>> q1 = Quaternion(2, 8, 13, 12) >>> Quaternion.arc_coplanar(q1, q2) False
See Also ========
vector_coplanar is_pure
""" if (self.is_zero_quaternion()) or (other.is_zero_quaternion()): raise ValueError('Neither of the given quaternions can be 0')
return fuzzy_or([(self.axis() - other.axis()).is_zero_quaternion(), (self.axis() + other.axis()).is_zero_quaternion()])
@classmethod def vector_coplanar(cls, q1, q2, q3): r""" Returns True if the axis of the pure quaternions seen as 3D vectors ``q1``, ``q2``, and ``q3`` are coplanar.
Explanation ===========
Three pure quaternions are vector coplanar if the quaternions seen as 3D vectors are coplanar.
Parameters ==========
q1 A pure Quaternion. q2 A pure Quaternion. q3 A pure Quaternion.
Returns =======
True : if the axis of the pure quaternions seen as 3D vectors q1, q2, and q3 are coplanar. False : if the axis of the pure quaternions seen as 3D vectors q1, q2, and q3 are not coplanar. None : if the axis of the pure quaternions seen as 3D vectors q1, q2, and q3 are coplanar is unknown.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q1 = Quaternion(0, 4, 4, 4) >>> q2 = Quaternion(0, 8, 8, 8) >>> q3 = Quaternion(0, 24, 24, 24) >>> Quaternion.vector_coplanar(q1, q2, q3) True
>>> q1 = Quaternion(0, 8, 16, 8) >>> q2 = Quaternion(0, 8, 3, 12) >>> Quaternion.vector_coplanar(q1, q2, q3) False
See Also ========
axis is_pure
"""
if fuzzy_not(q1.is_pure()) or fuzzy_not(q2.is_pure()) or fuzzy_not(q3.is_pure()): raise ValueError('The given quaternions must be pure')
M = Matrix([[q1.b, q1.c, q1.d], [q2.b, q2.c, q2.d], [q3.b, q3.c, q3.d]]).det() return M.is_zero
def parallel(self, other): """ Returns True if the two pure quaternions seen as 3D vectors are parallel.
Explanation ===========
Two pure quaternions are called parallel when their vector product is commutative which implies that the quaternions seen as 3D vectors have same direction.
Parameters ==========
other : a Quaternion
Returns =======
True : if the two pure quaternions seen as 3D vectors are parallel. False : if the two pure quaternions seen as 3D vectors are not parallel. None : if the two pure quaternions seen as 3D vectors are parallel is unknown.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(0, 4, 4, 4) >>> q1 = Quaternion(0, 8, 8, 8) >>> q.parallel(q1) True
>>> q1 = Quaternion(0, 8, 13, 12) >>> q.parallel(q1) False
"""
if fuzzy_not(self.is_pure()) or fuzzy_not(other.is_pure()): raise ValueError('The provided quaternions must be pure')
return (self*other - other*self).is_zero_quaternion()
def orthogonal(self, other): """ Returns the orthogonality of two quaternions.
Explanation ===========
Two pure quaternions are called orthogonal when their product is anti-commutative.
Parameters ==========
other : a Quaternion
Returns =======
True : if the two pure quaternions seen as 3D vectors are orthogonal. False : if the two pure quaternions seen as 3D vectors are not orthogonal. None : if the two pure quaternions seen as 3D vectors are orthogonal is unknown.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(0, 4, 4, 4) >>> q1 = Quaternion(0, 8, 8, 8) >>> q.orthogonal(q1) False
>>> q1 = Quaternion(0, 2, 2, 0) >>> q = Quaternion(0, 2, -2, 0) >>> q.orthogonal(q1) True
"""
if fuzzy_not(self.is_pure()) or fuzzy_not(other.is_pure()): raise ValueError('The given quaternions must be pure')
return (self*other + other*self).is_zero_quaternion()
def index_vector(self): r""" Returns the index vector of the quaternion.
Explanation ===========
The index vector is given by $\mathbf{T}(q)$, the norm (or magnitude) of the quaternion $q$, multiplied by $\mathbf{Ax}(q)$, the axis of $q$.
Returns =======
Quaternion: representing index vector of the provided quaternion.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(2, 4, 2, 4) >>> q.index_vector() 0 + 4*sqrt(10)/3*i + 2*sqrt(10)/3*j + 4*sqrt(10)/3*k
See Also ========
axis norm
"""
return self.norm() * self.axis()
def mensor(self): """ Returns the natural logarithm of the norm(magnitude) of the quaternion.
Examples ========
>>> from sympy.algebras.quaternion import Quaternion >>> q = Quaternion(2, 4, 2, 4) >>> q.mensor() log(2*sqrt(10)) >>> q.norm() 2*sqrt(10)
See Also ========
norm
"""
return ln(self.norm()).gitattributes+13
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/INSTALLERAdded+1
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/METADATAAdded+141
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/RECORDAdded+516
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/REQUESTEDAdded
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/WHEELAdded+5
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/entry_points.txtAdded+51
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/licenses/LICENSEAdded+17
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/top_level.txtAdded+3
.venv/lib/python3.12/site-packages/setuptools/tests/test_find_packages.pyAdded+218
.venv/lib/python3.12/site-packages/setuptools/tests/test_find_py_modules.pyAdded+73
.venv/lib/python3.12/site-packages/setuptools/tests/test_glob.pyAdded+45
.venv/lib/python3.12/site-packages/setuptools/tests/test_install_scripts.pyAdded+89
.venv/lib/python3.12/site-packages/setuptools/tests/test_logging.pyAdded+76
.venv/lib/python3.12/site-packages/setuptools/tests/test_manifest.pyAdded+622
.venv/lib/python3.12/site-packages/setuptools/tests/test_namespaces.pyAdded+138
.venv/lib/python3.12/site-packages/setuptools/tests/test_packageindex.pyAdded+267
.venv/lib/python3.12/site-packages/setuptools/tests/test_sandbox.pyAdded+134
.venv/lib/python3.12/site-packages/setuptools/tests/test_sdist.pyAdded+984
.venv/lib/python3.12/site-packages/setuptools/tests/test_setopt.pyAdded+40
.venv/lib/python3.12/site-packages/setuptools/tests/test_setuptools.pyAdded+290
.venv/lib/python3.12/site-packages/setuptools/tests/test_shutil_wrapper.pyAdded+23
.venv/lib/python3.12/site-packages/setuptools/tests/test_unicode_utils.pyAdded+10
.venv/lib/python3.12/site-packages/setuptools/tests/test_virtualenv.pyAdded+113
.venv/lib/python3.12/site-packages/setuptools/tests/test_warnings.pyAdded+106
.venv/lib/python3.12/site-packages/setuptools/tests/test_wheel.pyAdded+714
.venv/lib/python3.12/site-packages/setuptools/tests/test_windows_wrappers.pyAdded+259
.venv/lib/python3.12/site-packages/setuptools/tests/text.pyAdded+4
.venv/lib/python3.12/site-packages/setuptools/tests/textwrap.pyAdded+6
.venv/lib/python3.12/site-packages/setuptools/unicode_utils.pyAdded+102
.venv/lib/python3.12/site-packages/setuptools/version.pyAdded+6
.venv/lib/python3.12/site-packages/setuptools/warnings.pyAdded+110
.venv/lib/python3.12/site-packages/setuptools/wheel.pyAdded+236
.venv/lib/python3.12/site-packages/setuptools/windows_support.pyAdded+30
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/INSTALLERAdded+1
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/LICENSEAdded+18
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/METADATAAdded+43
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/RECORDAdded+8
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/REQUESTEDAdded
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/WHEELAdded+6
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/top_level.txtAdded+1
.venv/lib/python3.12/site-packages/six.pyAdded+1003
.venv/lib/python3.12/site-packages/sympy/__init__.pyAdded+545
.venv/lib/python3.12/site-packages/sympy/__pycache__/__init__.cpython-312.pycAdded
.venv/lib/python3.12/site-packages/sympy/__pycache__/release.cpython-312.pycAdded
.venv/lib/python3.12/site-packages/sympy/abc.pyAdded+111
.venv/lib/python3.12/site-packages/sympy/algebras/__init__.pyAdded+3
.venv/lib/python3.12/site-packages/sympy/algebras/__pycache__/__init__.cpython-312.pycAdded
.venv/lib/python3.12/site-packages/sympy/algebras/__pycache__/quaternion.cpython-312.pycAdded
.venv/lib/python3.12/site-packages/sympy/algebras/quaternion.pyAdded+1666