Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/PKG-INFO +141 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/SOURCES.txt +527 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/dependency_links.txt +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/entry_points.txt +51 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/requires.txt +83 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/top_level.txt +3 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE +17 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA +46 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD +12 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL +5 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py +24 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA +133 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD +21 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL +5 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +73 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py +1191 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py +136 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py +34 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py +56 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py +135 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py +171 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py +71 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py +99 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_typing.py +15 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py +22 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py +42 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py +21 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/INSTALLER +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/LICENSE +17 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/METADATA +96 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/RECORD +14 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/REQUESTED +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/WHEEL +5 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/top_level.txt +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context/__init__.py +367 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context/py.typed +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.py +722 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi +123 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/py.typed +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +2 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/__init__.py +647 -0
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/PKG-INFO
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: setuptools
|
| 3 |
+
Version: 80.10.2
|
| 4 |
+
Summary: Easily download, build, install, upgrade, and uninstall Python packages
|
| 5 |
+
Author-email: Python Packaging Authority <distutils-sig@python.org>
|
| 6 |
+
License-Expression: MIT
|
| 7 |
+
Project-URL: Source, https://github.com/pypa/setuptools
|
| 8 |
+
Project-URL: Documentation, https://setuptools.pypa.io/
|
| 9 |
+
Project-URL: Changelog, https://setuptools.pypa.io/en/stable/history.html
|
| 10 |
+
Keywords: CPAN PyPI distutils eggs package management
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 15 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 16 |
+
Classifier: Topic :: System :: Archiving :: Packaging
|
| 17 |
+
Classifier: Topic :: System :: Systems Administration
|
| 18 |
+
Classifier: Topic :: Utilities
|
| 19 |
+
Requires-Python: >=3.9
|
| 20 |
+
Description-Content-Type: text/x-rst
|
| 21 |
+
License-File: LICENSE
|
| 22 |
+
Provides-Extra: test
|
| 23 |
+
Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
|
| 24 |
+
Requires-Dist: virtualenv>=13.0.0; extra == "test"
|
| 25 |
+
Requires-Dist: wheel>=0.44.0; extra == "test"
|
| 26 |
+
Requires-Dist: pip>=19.1; extra == "test"
|
| 27 |
+
Requires-Dist: packaging>=24.2; extra == "test"
|
| 28 |
+
Requires-Dist: jaraco.envs>=2.2; extra == "test"
|
| 29 |
+
Requires-Dist: pytest-xdist>=3; extra == "test"
|
| 30 |
+
Requires-Dist: jaraco.path>=3.7.2; extra == "test"
|
| 31 |
+
Requires-Dist: build[virtualenv]>=1.0.3; extra == "test"
|
| 32 |
+
Requires-Dist: filelock>=3.4.0; extra == "test"
|
| 33 |
+
Requires-Dist: ini2toml[lite]>=0.14; extra == "test"
|
| 34 |
+
Requires-Dist: tomli-w>=1.0.0; extra == "test"
|
| 35 |
+
Requires-Dist: pytest-timeout; extra == "test"
|
| 36 |
+
Requires-Dist: pytest-perf; sys_platform != "cygwin" and extra == "test"
|
| 37 |
+
Requires-Dist: jaraco.develop>=7.21; (python_version >= "3.9" and sys_platform != "cygwin") and extra == "test"
|
| 38 |
+
Requires-Dist: pytest-home>=0.5; extra == "test"
|
| 39 |
+
Requires-Dist: pytest-subprocess; extra == "test"
|
| 40 |
+
Requires-Dist: pyproject-hooks!=1.1; extra == "test"
|
| 41 |
+
Requires-Dist: jaraco.test>=5.5; extra == "test"
|
| 42 |
+
Provides-Extra: doc
|
| 43 |
+
Requires-Dist: sphinx>=3.5; extra == "doc"
|
| 44 |
+
Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
|
| 45 |
+
Requires-Dist: rst.linker>=1.9; extra == "doc"
|
| 46 |
+
Requires-Dist: furo; extra == "doc"
|
| 47 |
+
Requires-Dist: sphinx-lint; extra == "doc"
|
| 48 |
+
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
|
| 49 |
+
Requires-Dist: pygments-github-lexers==0.0.5; extra == "doc"
|
| 50 |
+
Requires-Dist: sphinx-favicon; extra == "doc"
|
| 51 |
+
Requires-Dist: sphinx-inline-tabs; extra == "doc"
|
| 52 |
+
Requires-Dist: sphinx-reredirects; extra == "doc"
|
| 53 |
+
Requires-Dist: sphinxcontrib-towncrier; extra == "doc"
|
| 54 |
+
Requires-Dist: sphinx-notfound-page<2,>=1; extra == "doc"
|
| 55 |
+
Requires-Dist: pyproject-hooks!=1.1; extra == "doc"
|
| 56 |
+
Requires-Dist: towncrier<24.7; extra == "doc"
|
| 57 |
+
Provides-Extra: ssl
|
| 58 |
+
Provides-Extra: certs
|
| 59 |
+
Provides-Extra: core
|
| 60 |
+
Requires-Dist: packaging>=24.2; extra == "core"
|
| 61 |
+
Requires-Dist: more_itertools>=8.8; extra == "core"
|
| 62 |
+
Requires-Dist: jaraco.text>=3.7; extra == "core"
|
| 63 |
+
Requires-Dist: importlib_metadata>=6; python_version < "3.10" and extra == "core"
|
| 64 |
+
Requires-Dist: tomli>=2.0.1; python_version < "3.11" and extra == "core"
|
| 65 |
+
Requires-Dist: wheel>=0.43.0; extra == "core"
|
| 66 |
+
Requires-Dist: platformdirs>=4.2.2; extra == "core"
|
| 67 |
+
Requires-Dist: jaraco.functools>=4; extra == "core"
|
| 68 |
+
Requires-Dist: more_itertools; extra == "core"
|
| 69 |
+
Provides-Extra: check
|
| 70 |
+
Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
|
| 71 |
+
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
|
| 72 |
+
Requires-Dist: ruff>=0.8.0; sys_platform != "cygwin" and extra == "check"
|
| 73 |
+
Provides-Extra: cover
|
| 74 |
+
Requires-Dist: pytest-cov; extra == "cover"
|
| 75 |
+
Provides-Extra: enabler
|
| 76 |
+
Requires-Dist: pytest-enabler>=2.2; extra == "enabler"
|
| 77 |
+
Provides-Extra: type
|
| 78 |
+
Requires-Dist: pytest-mypy; extra == "type"
|
| 79 |
+
Requires-Dist: mypy==1.14.*; extra == "type"
|
| 80 |
+
Requires-Dist: importlib_metadata>=7.0.2; python_version < "3.10" and extra == "type"
|
| 81 |
+
Requires-Dist: jaraco.develop>=7.21; sys_platform != "cygwin" and extra == "type"
|
| 82 |
+
Dynamic: license-file
|
| 83 |
+
|
| 84 |
+
.. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg
|
| 85 |
+
:target: https://pypi.org/project/setuptools
|
| 86 |
+
|
| 87 |
+
.. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg
|
| 88 |
+
|
| 89 |
+
.. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg
|
| 90 |
+
:target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22
|
| 91 |
+
:alt: tests
|
| 92 |
+
|
| 93 |
+
.. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
| 94 |
+
:target: https://github.com/astral-sh/ruff
|
| 95 |
+
:alt: Ruff
|
| 96 |
+
|
| 97 |
+
.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg
|
| 98 |
+
:target: https://setuptools.pypa.io
|
| 99 |
+
|
| 100 |
+
.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational
|
| 101 |
+
:target: https://blog.jaraco.com/skeleton
|
| 102 |
+
|
| 103 |
+
.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white
|
| 104 |
+
:target: https://codecov.io/gh/pypa/setuptools
|
| 105 |
+
|
| 106 |
+
.. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat
|
| 107 |
+
:target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme
|
| 108 |
+
|
| 109 |
+
.. |discord-badge| image:: https://img.shields.io/discord/803025117553754132
|
| 110 |
+
:target: https://discord.com/channels/803025117553754132/815945031150993468
|
| 111 |
+
:alt: Discord
|
| 112 |
+
|
| 113 |
+
|pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge|
|
| 114 |
+
|
| 115 |
+
See the `Quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>`_
|
| 116 |
+
and the `User's Guide <https://setuptools.pypa.io/en/latest/userguide/>`_ for
|
| 117 |
+
instructions on how to use Setuptools.
|
| 118 |
+
|
| 119 |
+
Questions and comments should be directed to `GitHub Discussions
|
| 120 |
+
<https://github.com/pypa/setuptools/discussions>`_.
|
| 121 |
+
Bug reports and especially tested patches may be
|
| 122 |
+
submitted directly to the `bug tracker
|
| 123 |
+
<https://github.com/pypa/setuptools/issues>`_.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
Code of Conduct
|
| 127 |
+
===============
|
| 128 |
+
|
| 129 |
+
Everyone interacting in the setuptools project's codebases, issue trackers,
|
| 130 |
+
chat rooms, and fora is expected to follow the
|
| 131 |
+
`PSF Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>`_.
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
For Enterprise
|
| 135 |
+
==============
|
| 136 |
+
|
| 137 |
+
Available as part of the Tidelift Subscription.
|
| 138 |
+
|
| 139 |
+
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.
|
| 140 |
+
|
| 141 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/SOURCES.txt
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LICENSE
|
| 2 |
+
MANIFEST.in
|
| 3 |
+
NEWS.rst
|
| 4 |
+
README.rst
|
| 5 |
+
conftest.py
|
| 6 |
+
exercises.py
|
| 7 |
+
launcher.c
|
| 8 |
+
mypy.ini
|
| 9 |
+
pyproject.toml
|
| 10 |
+
pytest.ini
|
| 11 |
+
setup.cfg
|
| 12 |
+
setup.py
|
| 13 |
+
tox.ini
|
| 14 |
+
_distutils_hack/__init__.py
|
| 15 |
+
_distutils_hack/override.py
|
| 16 |
+
docs/artwork.rst
|
| 17 |
+
docs/build_meta.rst
|
| 18 |
+
docs/conf.py
|
| 19 |
+
docs/history.rst
|
| 20 |
+
docs/index.rst
|
| 21 |
+
docs/pkg_resources.rst
|
| 22 |
+
docs/python 2 sunset.rst
|
| 23 |
+
docs/roadmap.rst
|
| 24 |
+
docs/setuptools.rst
|
| 25 |
+
docs/deprecated/changed_keywords.rst
|
| 26 |
+
docs/deprecated/commands.rst
|
| 27 |
+
docs/deprecated/dependency_links.rst
|
| 28 |
+
docs/deprecated/distutils-legacy.rst
|
| 29 |
+
docs/deprecated/easy_install.rst
|
| 30 |
+
docs/deprecated/functionalities.rst
|
| 31 |
+
docs/deprecated/index.rst
|
| 32 |
+
docs/deprecated/python_eggs.rst
|
| 33 |
+
docs/deprecated/resource_extraction.rst
|
| 34 |
+
docs/deprecated/zip_safe.rst
|
| 35 |
+
docs/deprecated/distutils/_setuptools_disclaimer.rst
|
| 36 |
+
docs/deprecated/distutils/apiref.rst
|
| 37 |
+
docs/deprecated/distutils/builtdist.rst
|
| 38 |
+
docs/deprecated/distutils/commandref.rst
|
| 39 |
+
docs/deprecated/distutils/configfile.rst
|
| 40 |
+
docs/deprecated/distutils/examples.rst
|
| 41 |
+
docs/deprecated/distutils/extending.rst
|
| 42 |
+
docs/deprecated/distutils/index.rst
|
| 43 |
+
docs/deprecated/distutils/introduction.rst
|
| 44 |
+
docs/deprecated/distutils/packageindex.rst
|
| 45 |
+
docs/deprecated/distutils/setupscript.rst
|
| 46 |
+
docs/deprecated/distutils/sourcedist.rst
|
| 47 |
+
docs/deprecated/distutils/uploading.rst
|
| 48 |
+
docs/development/developer-guide.rst
|
| 49 |
+
docs/development/index.rst
|
| 50 |
+
docs/development/releases.rst
|
| 51 |
+
docs/references/keywords.rst
|
| 52 |
+
docs/userguide/datafiles.rst
|
| 53 |
+
docs/userguide/declarative_config.rst
|
| 54 |
+
docs/userguide/dependency_management.rst
|
| 55 |
+
docs/userguide/development_mode.rst
|
| 56 |
+
docs/userguide/distribution.rst
|
| 57 |
+
docs/userguide/entry_point.rst
|
| 58 |
+
docs/userguide/ext_modules.rst
|
| 59 |
+
docs/userguide/extension.rst
|
| 60 |
+
docs/userguide/index.rst
|
| 61 |
+
docs/userguide/interfaces.rst
|
| 62 |
+
docs/userguide/miscellaneous.rst
|
| 63 |
+
docs/userguide/package_discovery.rst
|
| 64 |
+
docs/userguide/pyproject_config.rst
|
| 65 |
+
docs/userguide/quickstart.rst
|
| 66 |
+
newsfragments/.gitignore
|
| 67 |
+
newsfragments/README.rst
|
| 68 |
+
pkg_resources/__init__.py
|
| 69 |
+
pkg_resources/api_tests.txt
|
| 70 |
+
pkg_resources/py.typed
|
| 71 |
+
pkg_resources/tests/__init__.py
|
| 72 |
+
pkg_resources/tests/test_find_distributions.py
|
| 73 |
+
pkg_resources/tests/test_integration_zope_interface.py
|
| 74 |
+
pkg_resources/tests/test_markers.py
|
| 75 |
+
pkg_resources/tests/test_pkg_resources.py
|
| 76 |
+
pkg_resources/tests/test_resources.py
|
| 77 |
+
pkg_resources/tests/test_working_set.py
|
| 78 |
+
pkg_resources/tests/data/my-test-package-source/setup.cfg
|
| 79 |
+
pkg_resources/tests/data/my-test-package-source/setup.py
|
| 80 |
+
pkg_resources/tests/data/my-test-package-zip/my-test-package.zip
|
| 81 |
+
pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/PKG-INFO
|
| 82 |
+
pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/SOURCES.txt
|
| 83 |
+
pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/dependency_links.txt
|
| 84 |
+
pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/top_level.txt
|
| 85 |
+
pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/zip-safe
|
| 86 |
+
pkg_resources/tests/data/my-test-package_zipped-egg/my_test_package-1.0-py3.7.egg
|
| 87 |
+
setuptools/__init__.py
|
| 88 |
+
setuptools/_core_metadata.py
|
| 89 |
+
setuptools/_discovery.py
|
| 90 |
+
setuptools/_entry_points.py
|
| 91 |
+
setuptools/_imp.py
|
| 92 |
+
setuptools/_importlib.py
|
| 93 |
+
setuptools/_itertools.py
|
| 94 |
+
setuptools/_normalization.py
|
| 95 |
+
setuptools/_path.py
|
| 96 |
+
setuptools/_reqs.py
|
| 97 |
+
setuptools/_scripts.py
|
| 98 |
+
setuptools/_shutil.py
|
| 99 |
+
setuptools/_static.py
|
| 100 |
+
setuptools/archive_util.py
|
| 101 |
+
setuptools/build_meta.py
|
| 102 |
+
setuptools/cli-32.exe
|
| 103 |
+
setuptools/cli-64.exe
|
| 104 |
+
setuptools/cli-arm64.exe
|
| 105 |
+
setuptools/cli.exe
|
| 106 |
+
setuptools/depends.py
|
| 107 |
+
setuptools/discovery.py
|
| 108 |
+
setuptools/dist.py
|
| 109 |
+
setuptools/errors.py
|
| 110 |
+
setuptools/extension.py
|
| 111 |
+
setuptools/glob.py
|
| 112 |
+
setuptools/gui-32.exe
|
| 113 |
+
setuptools/gui-64.exe
|
| 114 |
+
setuptools/gui-arm64.exe
|
| 115 |
+
setuptools/gui.exe
|
| 116 |
+
setuptools/installer.py
|
| 117 |
+
setuptools/launch.py
|
| 118 |
+
setuptools/logging.py
|
| 119 |
+
setuptools/modified.py
|
| 120 |
+
setuptools/monkey.py
|
| 121 |
+
setuptools/msvc.py
|
| 122 |
+
setuptools/namespaces.py
|
| 123 |
+
setuptools/script (dev).tmpl
|
| 124 |
+
setuptools/script.tmpl
|
| 125 |
+
setuptools/unicode_utils.py
|
| 126 |
+
setuptools/version.py
|
| 127 |
+
setuptools/warnings.py
|
| 128 |
+
setuptools/wheel.py
|
| 129 |
+
setuptools/windows_support.py
|
| 130 |
+
setuptools.egg-info/PKG-INFO
|
| 131 |
+
setuptools.egg-info/SOURCES.txt
|
| 132 |
+
setuptools.egg-info/dependency_links.txt
|
| 133 |
+
setuptools.egg-info/entry_points.txt
|
| 134 |
+
setuptools.egg-info/requires.txt
|
| 135 |
+
setuptools.egg-info/top_level.txt
|
| 136 |
+
setuptools/_distutils/__init__.py
|
| 137 |
+
setuptools/_distutils/_log.py
|
| 138 |
+
setuptools/_distutils/_macos_compat.py
|
| 139 |
+
setuptools/_distutils/_modified.py
|
| 140 |
+
setuptools/_distutils/_msvccompiler.py
|
| 141 |
+
setuptools/_distutils/archive_util.py
|
| 142 |
+
setuptools/_distutils/ccompiler.py
|
| 143 |
+
setuptools/_distutils/cmd.py
|
| 144 |
+
setuptools/_distutils/core.py
|
| 145 |
+
setuptools/_distutils/cygwinccompiler.py
|
| 146 |
+
setuptools/_distutils/debug.py
|
| 147 |
+
setuptools/_distutils/dep_util.py
|
| 148 |
+
setuptools/_distutils/dir_util.py
|
| 149 |
+
setuptools/_distutils/dist.py
|
| 150 |
+
setuptools/_distutils/errors.py
|
| 151 |
+
setuptools/_distutils/extension.py
|
| 152 |
+
setuptools/_distutils/fancy_getopt.py
|
| 153 |
+
setuptools/_distutils/file_util.py
|
| 154 |
+
setuptools/_distutils/filelist.py
|
| 155 |
+
setuptools/_distutils/log.py
|
| 156 |
+
setuptools/_distutils/spawn.py
|
| 157 |
+
setuptools/_distutils/sysconfig.py
|
| 158 |
+
setuptools/_distutils/text_file.py
|
| 159 |
+
setuptools/_distutils/unixccompiler.py
|
| 160 |
+
setuptools/_distutils/util.py
|
| 161 |
+
setuptools/_distutils/version.py
|
| 162 |
+
setuptools/_distutils/versionpredicate.py
|
| 163 |
+
setuptools/_distutils/zosccompiler.py
|
| 164 |
+
setuptools/_distutils/command/__init__.py
|
| 165 |
+
setuptools/_distutils/command/_framework_compat.py
|
| 166 |
+
setuptools/_distutils/command/bdist.py
|
| 167 |
+
setuptools/_distutils/command/bdist_dumb.py
|
| 168 |
+
setuptools/_distutils/command/bdist_rpm.py
|
| 169 |
+
setuptools/_distutils/command/build.py
|
| 170 |
+
setuptools/_distutils/command/build_clib.py
|
| 171 |
+
setuptools/_distutils/command/build_ext.py
|
| 172 |
+
setuptools/_distutils/command/build_py.py
|
| 173 |
+
setuptools/_distutils/command/build_scripts.py
|
| 174 |
+
setuptools/_distutils/command/check.py
|
| 175 |
+
setuptools/_distutils/command/clean.py
|
| 176 |
+
setuptools/_distutils/command/config.py
|
| 177 |
+
setuptools/_distutils/command/install.py
|
| 178 |
+
setuptools/_distutils/command/install_data.py
|
| 179 |
+
setuptools/_distutils/command/install_egg_info.py
|
| 180 |
+
setuptools/_distutils/command/install_headers.py
|
| 181 |
+
setuptools/_distutils/command/install_lib.py
|
| 182 |
+
setuptools/_distutils/command/install_scripts.py
|
| 183 |
+
setuptools/_distutils/command/sdist.py
|
| 184 |
+
setuptools/_distutils/compat/__init__.py
|
| 185 |
+
setuptools/_distutils/compat/numpy.py
|
| 186 |
+
setuptools/_distutils/compat/py39.py
|
| 187 |
+
setuptools/_distutils/compilers/C/base.py
|
| 188 |
+
setuptools/_distutils/compilers/C/cygwin.py
|
| 189 |
+
setuptools/_distutils/compilers/C/errors.py
|
| 190 |
+
setuptools/_distutils/compilers/C/msvc.py
|
| 191 |
+
setuptools/_distutils/compilers/C/unix.py
|
| 192 |
+
setuptools/_distutils/compilers/C/zos.py
|
| 193 |
+
setuptools/_distutils/compilers/C/tests/test_base.py
|
| 194 |
+
setuptools/_distutils/compilers/C/tests/test_cygwin.py
|
| 195 |
+
setuptools/_distutils/compilers/C/tests/test_mingw.py
|
| 196 |
+
setuptools/_distutils/compilers/C/tests/test_msvc.py
|
| 197 |
+
setuptools/_distutils/compilers/C/tests/test_unix.py
|
| 198 |
+
setuptools/_distutils/tests/__init__.py
|
| 199 |
+
setuptools/_distutils/tests/support.py
|
| 200 |
+
setuptools/_distutils/tests/test_archive_util.py
|
| 201 |
+
setuptools/_distutils/tests/test_bdist.py
|
| 202 |
+
setuptools/_distutils/tests/test_bdist_dumb.py
|
| 203 |
+
setuptools/_distutils/tests/test_bdist_rpm.py
|
| 204 |
+
setuptools/_distutils/tests/test_build.py
|
| 205 |
+
setuptools/_distutils/tests/test_build_clib.py
|
| 206 |
+
setuptools/_distutils/tests/test_build_ext.py
|
| 207 |
+
setuptools/_distutils/tests/test_build_py.py
|
| 208 |
+
setuptools/_distutils/tests/test_build_scripts.py
|
| 209 |
+
setuptools/_distutils/tests/test_check.py
|
| 210 |
+
setuptools/_distutils/tests/test_clean.py
|
| 211 |
+
setuptools/_distutils/tests/test_cmd.py
|
| 212 |
+
setuptools/_distutils/tests/test_config_cmd.py
|
| 213 |
+
setuptools/_distutils/tests/test_core.py
|
| 214 |
+
setuptools/_distutils/tests/test_dir_util.py
|
| 215 |
+
setuptools/_distutils/tests/test_dist.py
|
| 216 |
+
setuptools/_distutils/tests/test_extension.py
|
| 217 |
+
setuptools/_distutils/tests/test_file_util.py
|
| 218 |
+
setuptools/_distutils/tests/test_filelist.py
|
| 219 |
+
setuptools/_distutils/tests/test_install.py
|
| 220 |
+
setuptools/_distutils/tests/test_install_data.py
|
| 221 |
+
setuptools/_distutils/tests/test_install_headers.py
|
| 222 |
+
setuptools/_distutils/tests/test_install_lib.py
|
| 223 |
+
setuptools/_distutils/tests/test_install_scripts.py
|
| 224 |
+
setuptools/_distutils/tests/test_log.py
|
| 225 |
+
setuptools/_distutils/tests/test_modified.py
|
| 226 |
+
setuptools/_distutils/tests/test_sdist.py
|
| 227 |
+
setuptools/_distutils/tests/test_spawn.py
|
| 228 |
+
setuptools/_distutils/tests/test_sysconfig.py
|
| 229 |
+
setuptools/_distutils/tests/test_text_file.py
|
| 230 |
+
setuptools/_distutils/tests/test_util.py
|
| 231 |
+
setuptools/_distutils/tests/test_version.py
|
| 232 |
+
setuptools/_distutils/tests/test_versionpredicate.py
|
| 233 |
+
setuptools/_distutils/tests/unix_compat.py
|
| 234 |
+
setuptools/_distutils/tests/compat/__init__.py
|
| 235 |
+
setuptools/_distutils/tests/compat/py39.py
|
| 236 |
+
setuptools/_vendor/.lock
|
| 237 |
+
setuptools/_vendor/ruff.toml
|
| 238 |
+
setuptools/_vendor/autocommand/__init__.py
|
| 239 |
+
setuptools/_vendor/autocommand/autoasync.py
|
| 240 |
+
setuptools/_vendor/autocommand/autocommand.py
|
| 241 |
+
setuptools/_vendor/autocommand/automain.py
|
| 242 |
+
setuptools/_vendor/autocommand/autoparse.py
|
| 243 |
+
setuptools/_vendor/autocommand/errors.py
|
| 244 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
|
| 245 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
|
| 246 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
|
| 247 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
|
| 248 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/REQUESTED
|
| 249 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
|
| 250 |
+
setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
|
| 251 |
+
setuptools/_vendor/backports/__init__.py
|
| 252 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
|
| 253 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
|
| 254 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
|
| 255 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
|
| 256 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
|
| 257 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
|
| 258 |
+
setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
|
| 259 |
+
setuptools/_vendor/backports/tarfile/__init__.py
|
| 260 |
+
setuptools/_vendor/backports/tarfile/__main__.py
|
| 261 |
+
setuptools/_vendor/backports/tarfile/compat/__init__.py
|
| 262 |
+
setuptools/_vendor/backports/tarfile/compat/py38.py
|
| 263 |
+
setuptools/_vendor/importlib_metadata/__init__.py
|
| 264 |
+
setuptools/_vendor/importlib_metadata/_adapters.py
|
| 265 |
+
setuptools/_vendor/importlib_metadata/_collections.py
|
| 266 |
+
setuptools/_vendor/importlib_metadata/_compat.py
|
| 267 |
+
setuptools/_vendor/importlib_metadata/_functools.py
|
| 268 |
+
setuptools/_vendor/importlib_metadata/_itertools.py
|
| 269 |
+
setuptools/_vendor/importlib_metadata/_meta.py
|
| 270 |
+
setuptools/_vendor/importlib_metadata/_text.py
|
| 271 |
+
setuptools/_vendor/importlib_metadata/_typing.py
|
| 272 |
+
setuptools/_vendor/importlib_metadata/diagnose.py
|
| 273 |
+
setuptools/_vendor/importlib_metadata/py.typed
|
| 274 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER
|
| 275 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA
|
| 276 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD
|
| 277 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED
|
| 278 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL
|
| 279 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt
|
| 280 |
+
setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE
|
| 281 |
+
setuptools/_vendor/importlib_metadata/compat/__init__.py
|
| 282 |
+
setuptools/_vendor/importlib_metadata/compat/py311.py
|
| 283 |
+
setuptools/_vendor/importlib_metadata/compat/py39.py
|
| 284 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/INSTALLER
|
| 285 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/LICENSE
|
| 286 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/METADATA
|
| 287 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/RECORD
|
| 288 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/REQUESTED
|
| 289 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/WHEEL
|
| 290 |
+
setuptools/_vendor/jaraco.text-4.0.0.dist-info/top_level.txt
|
| 291 |
+
setuptools/_vendor/jaraco/context/__init__.py
|
| 292 |
+
setuptools/_vendor/jaraco/context/py.typed
|
| 293 |
+
setuptools/_vendor/jaraco/functools/__init__.py
|
| 294 |
+
setuptools/_vendor/jaraco/functools/__init__.pyi
|
| 295 |
+
setuptools/_vendor/jaraco/functools/py.typed
|
| 296 |
+
setuptools/_vendor/jaraco/text/Lorem ipsum.txt
|
| 297 |
+
setuptools/_vendor/jaraco/text/__init__.py
|
| 298 |
+
setuptools/_vendor/jaraco/text/layouts.py
|
| 299 |
+
setuptools/_vendor/jaraco/text/show-newlines.py
|
| 300 |
+
setuptools/_vendor/jaraco/text/strip-prefix.py
|
| 301 |
+
setuptools/_vendor/jaraco/text/to-dvorak.py
|
| 302 |
+
setuptools/_vendor/jaraco/text/to-qwerty.py
|
| 303 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/INSTALLER
|
| 304 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/METADATA
|
| 305 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/RECORD
|
| 306 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/REQUESTED
|
| 307 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/WHEEL
|
| 308 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/top_level.txt
|
| 309 |
+
setuptools/_vendor/jaraco_context-6.1.0.dist-info/licenses/LICENSE
|
| 310 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/INSTALLER
|
| 311 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/METADATA
|
| 312 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/RECORD
|
| 313 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/REQUESTED
|
| 314 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/WHEEL
|
| 315 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/top_level.txt
|
| 316 |
+
setuptools/_vendor/jaraco_functools-4.4.0.dist-info/licenses/LICENSE
|
| 317 |
+
setuptools/_vendor/more_itertools/__init__.py
|
| 318 |
+
setuptools/_vendor/more_itertools/__init__.pyi
|
| 319 |
+
setuptools/_vendor/more_itertools/more.py
|
| 320 |
+
setuptools/_vendor/more_itertools/more.pyi
|
| 321 |
+
setuptools/_vendor/more_itertools/py.typed
|
| 322 |
+
setuptools/_vendor/more_itertools/recipes.py
|
| 323 |
+
setuptools/_vendor/more_itertools/recipes.pyi
|
| 324 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/INSTALLER
|
| 325 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/METADATA
|
| 326 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/RECORD
|
| 327 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/REQUESTED
|
| 328 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/WHEEL
|
| 329 |
+
setuptools/_vendor/more_itertools-10.8.0.dist-info/licenses/LICENSE
|
| 330 |
+
setuptools/_vendor/packaging/__init__.py
|
| 331 |
+
setuptools/_vendor/packaging/_elffile.py
|
| 332 |
+
setuptools/_vendor/packaging/_manylinux.py
|
| 333 |
+
setuptools/_vendor/packaging/_musllinux.py
|
| 334 |
+
setuptools/_vendor/packaging/_parser.py
|
| 335 |
+
setuptools/_vendor/packaging/_structures.py
|
| 336 |
+
setuptools/_vendor/packaging/_tokenizer.py
|
| 337 |
+
setuptools/_vendor/packaging/markers.py
|
| 338 |
+
setuptools/_vendor/packaging/metadata.py
|
| 339 |
+
setuptools/_vendor/packaging/py.typed
|
| 340 |
+
setuptools/_vendor/packaging/pylock.py
|
| 341 |
+
setuptools/_vendor/packaging/requirements.py
|
| 342 |
+
setuptools/_vendor/packaging/specifiers.py
|
| 343 |
+
setuptools/_vendor/packaging/tags.py
|
| 344 |
+
setuptools/_vendor/packaging/utils.py
|
| 345 |
+
setuptools/_vendor/packaging/version.py
|
| 346 |
+
setuptools/_vendor/packaging-26.0.dist-info/INSTALLER
|
| 347 |
+
setuptools/_vendor/packaging-26.0.dist-info/METADATA
|
| 348 |
+
setuptools/_vendor/packaging-26.0.dist-info/RECORD
|
| 349 |
+
setuptools/_vendor/packaging-26.0.dist-info/REQUESTED
|
| 350 |
+
setuptools/_vendor/packaging-26.0.dist-info/WHEEL
|
| 351 |
+
setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE
|
| 352 |
+
setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE.APACHE
|
| 353 |
+
setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE.BSD
|
| 354 |
+
setuptools/_vendor/packaging/licenses/__init__.py
|
| 355 |
+
setuptools/_vendor/packaging/licenses/_spdx.py
|
| 356 |
+
setuptools/_vendor/platformdirs/__init__.py
|
| 357 |
+
setuptools/_vendor/platformdirs/__main__.py
|
| 358 |
+
setuptools/_vendor/platformdirs/android.py
|
| 359 |
+
setuptools/_vendor/platformdirs/api.py
|
| 360 |
+
setuptools/_vendor/platformdirs/macos.py
|
| 361 |
+
setuptools/_vendor/platformdirs/py.typed
|
| 362 |
+
setuptools/_vendor/platformdirs/unix.py
|
| 363 |
+
setuptools/_vendor/platformdirs/version.py
|
| 364 |
+
setuptools/_vendor/platformdirs/windows.py
|
| 365 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/INSTALLER
|
| 366 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/METADATA
|
| 367 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/RECORD
|
| 368 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/REQUESTED
|
| 369 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/WHEEL
|
| 370 |
+
setuptools/_vendor/platformdirs-4.4.0.dist-info/licenses/LICENSE
|
| 371 |
+
setuptools/_vendor/tomli/__init__.py
|
| 372 |
+
setuptools/_vendor/tomli/_parser.py
|
| 373 |
+
setuptools/_vendor/tomli/_re.py
|
| 374 |
+
setuptools/_vendor/tomli/_types.py
|
| 375 |
+
setuptools/_vendor/tomli/py.typed
|
| 376 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/INSTALLER
|
| 377 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/METADATA
|
| 378 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/RECORD
|
| 379 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/REQUESTED
|
| 380 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/WHEEL
|
| 381 |
+
setuptools/_vendor/tomli-2.4.0.dist-info/licenses/LICENSE
|
| 382 |
+
setuptools/_vendor/wheel/__init__.py
|
| 383 |
+
setuptools/_vendor/wheel/__main__.py
|
| 384 |
+
setuptools/_vendor/wheel/_bdist_wheel.py
|
| 385 |
+
setuptools/_vendor/wheel/_metadata.py
|
| 386 |
+
setuptools/_vendor/wheel/_setuptools_logging.py
|
| 387 |
+
setuptools/_vendor/wheel/bdist_wheel.py
|
| 388 |
+
setuptools/_vendor/wheel/macosx_libfile.py
|
| 389 |
+
setuptools/_vendor/wheel/metadata.py
|
| 390 |
+
setuptools/_vendor/wheel/wheelfile.py
|
| 391 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/INSTALLER
|
| 392 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/METADATA
|
| 393 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/RECORD
|
| 394 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/REQUESTED
|
| 395 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/WHEEL
|
| 396 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/entry_points.txt
|
| 397 |
+
setuptools/_vendor/wheel-0.46.3.dist-info/licenses/LICENSE.txt
|
| 398 |
+
setuptools/_vendor/wheel/_commands/__init__.py
|
| 399 |
+
setuptools/_vendor/wheel/_commands/convert.py
|
| 400 |
+
setuptools/_vendor/wheel/_commands/pack.py
|
| 401 |
+
setuptools/_vendor/wheel/_commands/tags.py
|
| 402 |
+
setuptools/_vendor/wheel/_commands/unpack.py
|
| 403 |
+
setuptools/_vendor/zipp/__init__.py
|
| 404 |
+
setuptools/_vendor/zipp/_functools.py
|
| 405 |
+
setuptools/_vendor/zipp/glob.py
|
| 406 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/INSTALLER
|
| 407 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/METADATA
|
| 408 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/RECORD
|
| 409 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/REQUESTED
|
| 410 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/WHEEL
|
| 411 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/top_level.txt
|
| 412 |
+
setuptools/_vendor/zipp-3.23.0.dist-info/licenses/LICENSE
|
| 413 |
+
setuptools/_vendor/zipp/compat/__init__.py
|
| 414 |
+
setuptools/_vendor/zipp/compat/overlay.py
|
| 415 |
+
setuptools/_vendor/zipp/compat/py310.py
|
| 416 |
+
setuptools/_vendor/zipp/compat/py313.py
|
| 417 |
+
setuptools/command/__init__.py
|
| 418 |
+
setuptools/command/_requirestxt.py
|
| 419 |
+
setuptools/command/alias.py
|
| 420 |
+
setuptools/command/bdist_egg.py
|
| 421 |
+
setuptools/command/bdist_rpm.py
|
| 422 |
+
setuptools/command/bdist_wheel.py
|
| 423 |
+
setuptools/command/build.py
|
| 424 |
+
setuptools/command/build_clib.py
|
| 425 |
+
setuptools/command/build_ext.py
|
| 426 |
+
setuptools/command/build_py.py
|
| 427 |
+
setuptools/command/develop.py
|
| 428 |
+
setuptools/command/dist_info.py
|
| 429 |
+
setuptools/command/easy_install.py
|
| 430 |
+
setuptools/command/editable_wheel.py
|
| 431 |
+
setuptools/command/egg_info.py
|
| 432 |
+
setuptools/command/install.py
|
| 433 |
+
setuptools/command/install_egg_info.py
|
| 434 |
+
setuptools/command/install_lib.py
|
| 435 |
+
setuptools/command/install_scripts.py
|
| 436 |
+
setuptools/command/launcher manifest.xml
|
| 437 |
+
setuptools/command/rotate.py
|
| 438 |
+
setuptools/command/saveopts.py
|
| 439 |
+
setuptools/command/sdist.py
|
| 440 |
+
setuptools/command/setopt.py
|
| 441 |
+
setuptools/command/test.py
|
| 442 |
+
setuptools/compat/__init__.py
|
| 443 |
+
setuptools/compat/py310.py
|
| 444 |
+
setuptools/compat/py311.py
|
| 445 |
+
setuptools/compat/py312.py
|
| 446 |
+
setuptools/compat/py39.py
|
| 447 |
+
setuptools/config/NOTICE
|
| 448 |
+
setuptools/config/__init__.py
|
| 449 |
+
setuptools/config/_apply_pyprojecttoml.py
|
| 450 |
+
setuptools/config/distutils.schema.json
|
| 451 |
+
setuptools/config/expand.py
|
| 452 |
+
setuptools/config/pyprojecttoml.py
|
| 453 |
+
setuptools/config/setupcfg.py
|
| 454 |
+
setuptools/config/setuptools.schema.json
|
| 455 |
+
setuptools/config/_validate_pyproject/NOTICE
|
| 456 |
+
setuptools/config/_validate_pyproject/__init__.py
|
| 457 |
+
setuptools/config/_validate_pyproject/error_reporting.py
|
| 458 |
+
setuptools/config/_validate_pyproject/extra_validations.py
|
| 459 |
+
setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py
|
| 460 |
+
setuptools/config/_validate_pyproject/fastjsonschema_validations.py
|
| 461 |
+
setuptools/config/_validate_pyproject/formats.py
|
| 462 |
+
setuptools/tests/__init__.py
|
| 463 |
+
setuptools/tests/contexts.py
|
| 464 |
+
setuptools/tests/environment.py
|
| 465 |
+
setuptools/tests/fixtures.py
|
| 466 |
+
setuptools/tests/mod_with_constant.py
|
| 467 |
+
setuptools/tests/namespaces.py
|
| 468 |
+
setuptools/tests/script-with-bom.py
|
| 469 |
+
setuptools/tests/test_archive_util.py
|
| 470 |
+
setuptools/tests/test_bdist_deprecations.py
|
| 471 |
+
setuptools/tests/test_bdist_egg.py
|
| 472 |
+
setuptools/tests/test_bdist_wheel.py
|
| 473 |
+
setuptools/tests/test_build.py
|
| 474 |
+
setuptools/tests/test_build_clib.py
|
| 475 |
+
setuptools/tests/test_build_ext.py
|
| 476 |
+
setuptools/tests/test_build_meta.py
|
| 477 |
+
setuptools/tests/test_build_py.py
|
| 478 |
+
setuptools/tests/test_config_discovery.py
|
| 479 |
+
setuptools/tests/test_core_metadata.py
|
| 480 |
+
setuptools/tests/test_depends.py
|
| 481 |
+
setuptools/tests/test_develop.py
|
| 482 |
+
setuptools/tests/test_dist.py
|
| 483 |
+
setuptools/tests/test_dist_info.py
|
| 484 |
+
setuptools/tests/test_distutils_adoption.py
|
| 485 |
+
setuptools/tests/test_editable_install.py
|
| 486 |
+
setuptools/tests/test_egg_info.py
|
| 487 |
+
setuptools/tests/test_extern.py
|
| 488 |
+
setuptools/tests/test_find_packages.py
|
| 489 |
+
setuptools/tests/test_find_py_modules.py
|
| 490 |
+
setuptools/tests/test_glob.py
|
| 491 |
+
setuptools/tests/test_install_scripts.py
|
| 492 |
+
setuptools/tests/test_logging.py
|
| 493 |
+
setuptools/tests/test_manifest.py
|
| 494 |
+
setuptools/tests/test_namespaces.py
|
| 495 |
+
setuptools/tests/test_scripts.py
|
| 496 |
+
setuptools/tests/test_sdist.py
|
| 497 |
+
setuptools/tests/test_setopt.py
|
| 498 |
+
setuptools/tests/test_setuptools.py
|
| 499 |
+
setuptools/tests/test_shutil_wrapper.py
|
| 500 |
+
setuptools/tests/test_unicode_utils.py
|
| 501 |
+
setuptools/tests/test_virtualenv.py
|
| 502 |
+
setuptools/tests/test_warnings.py
|
| 503 |
+
setuptools/tests/test_wheel.py
|
| 504 |
+
setuptools/tests/test_windows_wrappers.py
|
| 505 |
+
setuptools/tests/text.py
|
| 506 |
+
setuptools/tests/textwrap.py
|
| 507 |
+
setuptools/tests/compat/__init__.py
|
| 508 |
+
setuptools/tests/compat/py39.py
|
| 509 |
+
setuptools/tests/config/__init__.py
|
| 510 |
+
setuptools/tests/config/setupcfg_examples.txt
|
| 511 |
+
setuptools/tests/config/test_apply_pyprojecttoml.py
|
| 512 |
+
setuptools/tests/config/test_expand.py
|
| 513 |
+
setuptools/tests/config/test_pyprojecttoml.py
|
| 514 |
+
setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py
|
| 515 |
+
setuptools/tests/config/test_setupcfg.py
|
| 516 |
+
setuptools/tests/config/downloads/__init__.py
|
| 517 |
+
setuptools/tests/config/downloads/preload.py
|
| 518 |
+
setuptools/tests/indexes/test_links_priority/external.html
|
| 519 |
+
setuptools/tests/indexes/test_links_priority/simple/foobar/index.html
|
| 520 |
+
setuptools/tests/integration/__init__.py
|
| 521 |
+
setuptools/tests/integration/helpers.py
|
| 522 |
+
setuptools/tests/integration/test_pbr.py
|
| 523 |
+
setuptools/tests/integration/test_pip_install_sdist.py
|
| 524 |
+
tools/build_launchers.py
|
| 525 |
+
tools/finalize.py
|
| 526 |
+
tools/generate_validation_code.py
|
| 527 |
+
tools/vendored.py
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/dependency_links.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/entry_points.txt
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[distutils.commands]
|
| 2 |
+
alias = setuptools.command.alias:alias
|
| 3 |
+
bdist_egg = setuptools.command.bdist_egg:bdist_egg
|
| 4 |
+
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
|
| 5 |
+
bdist_wheel = setuptools.command.bdist_wheel:bdist_wheel
|
| 6 |
+
build = setuptools.command.build:build
|
| 7 |
+
build_clib = setuptools.command.build_clib:build_clib
|
| 8 |
+
build_ext = setuptools.command.build_ext:build_ext
|
| 9 |
+
build_py = setuptools.command.build_py:build_py
|
| 10 |
+
develop = setuptools.command.develop:develop
|
| 11 |
+
dist_info = setuptools.command.dist_info:dist_info
|
| 12 |
+
easy_install = setuptools.command.easy_install:easy_install
|
| 13 |
+
editable_wheel = setuptools.command.editable_wheel:editable_wheel
|
| 14 |
+
egg_info = setuptools.command.egg_info:egg_info
|
| 15 |
+
install = setuptools.command.install:install
|
| 16 |
+
install_egg_info = setuptools.command.install_egg_info:install_egg_info
|
| 17 |
+
install_lib = setuptools.command.install_lib:install_lib
|
| 18 |
+
install_scripts = setuptools.command.install_scripts:install_scripts
|
| 19 |
+
rotate = setuptools.command.rotate:rotate
|
| 20 |
+
saveopts = setuptools.command.saveopts:saveopts
|
| 21 |
+
sdist = setuptools.command.sdist:sdist
|
| 22 |
+
setopt = setuptools.command.setopt:setopt
|
| 23 |
+
|
| 24 |
+
[distutils.setup_keywords]
|
| 25 |
+
dependency_links = setuptools.dist:assert_string_list
|
| 26 |
+
eager_resources = setuptools.dist:assert_string_list
|
| 27 |
+
entry_points = setuptools.dist:check_entry_points
|
| 28 |
+
exclude_package_data = setuptools.dist:check_package_data
|
| 29 |
+
extras_require = setuptools.dist:check_extras
|
| 30 |
+
include_package_data = setuptools.dist:assert_bool
|
| 31 |
+
install_requires = setuptools.dist:check_requirements
|
| 32 |
+
namespace_packages = setuptools.dist:check_nsp
|
| 33 |
+
package_data = setuptools.dist:check_package_data
|
| 34 |
+
packages = setuptools.dist:check_packages
|
| 35 |
+
python_requires = setuptools.dist:check_specifier
|
| 36 |
+
setup_requires = setuptools.dist:check_requirements
|
| 37 |
+
use_2to3 = setuptools.dist:invalid_unless_false
|
| 38 |
+
zip_safe = setuptools.dist:assert_bool
|
| 39 |
+
|
| 40 |
+
[egg_info.writers]
|
| 41 |
+
PKG-INFO = setuptools.command.egg_info:write_pkg_info
|
| 42 |
+
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
|
| 43 |
+
eager_resources.txt = setuptools.command.egg_info:overwrite_arg
|
| 44 |
+
entry_points.txt = setuptools.command.egg_info:write_entries
|
| 45 |
+
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
|
| 46 |
+
requires.txt = setuptools.command.egg_info:write_requirements
|
| 47 |
+
top_level.txt = setuptools.command.egg_info:write_toplevel_names
|
| 48 |
+
|
| 49 |
+
[setuptools.finalize_distribution_options]
|
| 50 |
+
keywords = setuptools.dist:Distribution._finalize_setup_keywords
|
| 51 |
+
parent_finalize = setuptools.dist:_Distribution.finalize_options
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/requires.txt
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
[certs]
|
| 3 |
+
|
| 4 |
+
[check]
|
| 5 |
+
pytest-checkdocs>=2.4
|
| 6 |
+
|
| 7 |
+
[check:sys_platform != "cygwin"]
|
| 8 |
+
pytest-ruff>=0.2.1
|
| 9 |
+
ruff>=0.8.0
|
| 10 |
+
|
| 11 |
+
[core]
|
| 12 |
+
packaging>=24.2
|
| 13 |
+
more_itertools>=8.8
|
| 14 |
+
jaraco.text>=3.7
|
| 15 |
+
wheel>=0.43.0
|
| 16 |
+
platformdirs>=4.2.2
|
| 17 |
+
jaraco.functools>=4
|
| 18 |
+
more_itertools
|
| 19 |
+
|
| 20 |
+
[core:python_version < "3.10"]
|
| 21 |
+
importlib_metadata>=6
|
| 22 |
+
|
| 23 |
+
[core:python_version < "3.11"]
|
| 24 |
+
tomli>=2.0.1
|
| 25 |
+
|
| 26 |
+
[cover]
|
| 27 |
+
pytest-cov
|
| 28 |
+
|
| 29 |
+
[doc]
|
| 30 |
+
sphinx>=3.5
|
| 31 |
+
jaraco.packaging>=9.3
|
| 32 |
+
rst.linker>=1.9
|
| 33 |
+
furo
|
| 34 |
+
sphinx-lint
|
| 35 |
+
jaraco.tidelift>=1.4
|
| 36 |
+
pygments-github-lexers==0.0.5
|
| 37 |
+
sphinx-favicon
|
| 38 |
+
sphinx-inline-tabs
|
| 39 |
+
sphinx-reredirects
|
| 40 |
+
sphinxcontrib-towncrier
|
| 41 |
+
sphinx-notfound-page<2,>=1
|
| 42 |
+
pyproject-hooks!=1.1
|
| 43 |
+
towncrier<24.7
|
| 44 |
+
|
| 45 |
+
[enabler]
|
| 46 |
+
pytest-enabler>=2.2
|
| 47 |
+
|
| 48 |
+
[ssl]
|
| 49 |
+
|
| 50 |
+
[test]
|
| 51 |
+
pytest!=8.1.*,>=6
|
| 52 |
+
virtualenv>=13.0.0
|
| 53 |
+
wheel>=0.44.0
|
| 54 |
+
pip>=19.1
|
| 55 |
+
packaging>=24.2
|
| 56 |
+
jaraco.envs>=2.2
|
| 57 |
+
pytest-xdist>=3
|
| 58 |
+
jaraco.path>=3.7.2
|
| 59 |
+
build[virtualenv]>=1.0.3
|
| 60 |
+
filelock>=3.4.0
|
| 61 |
+
ini2toml[lite]>=0.14
|
| 62 |
+
tomli-w>=1.0.0
|
| 63 |
+
pytest-timeout
|
| 64 |
+
pytest-home>=0.5
|
| 65 |
+
pytest-subprocess
|
| 66 |
+
pyproject-hooks!=1.1
|
| 67 |
+
jaraco.test>=5.5
|
| 68 |
+
|
| 69 |
+
[test:python_version >= "3.9" and sys_platform != "cygwin"]
|
| 70 |
+
jaraco.develop>=7.21
|
| 71 |
+
|
| 72 |
+
[test:sys_platform != "cygwin"]
|
| 73 |
+
pytest-perf
|
| 74 |
+
|
| 75 |
+
[type]
|
| 76 |
+
pytest-mypy
|
| 77 |
+
mypy==1.14.*
|
| 78 |
+
|
| 79 |
+
[type:python_version < "3.10"]
|
| 80 |
+
importlib_metadata>=7.0.2
|
| 81 |
+
|
| 82 |
+
[type:sys_platform != "cygwin"]
|
| 83 |
+
jaraco.develop>=7.21
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools-80.10.2-py3.10.egg-info/top_level.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_distutils_hack
|
| 2 |
+
pkg_resources
|
| 3 |
+
setuptools
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
conda
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 2 |
+
of this software and associated documentation files (the "Software"), to
|
| 3 |
+
deal in the Software without restriction, including without limitation the
|
| 4 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 5 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 6 |
+
furnished to do so, subject to the following conditions:
|
| 7 |
+
|
| 8 |
+
The above copyright notice and this permission notice shall be included in
|
| 9 |
+
all copies or substantial portions of the Software.
|
| 10 |
+
|
| 11 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 12 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 13 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 14 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 15 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 16 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| 17 |
+
IN THE SOFTWARE.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: backports.tarfile
|
| 3 |
+
Version: 1.2.0
|
| 4 |
+
Summary: Backport of CPython tarfile module
|
| 5 |
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
| 6 |
+
Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
|
| 7 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 8 |
+
Classifier: Intended Audience :: Developers
|
| 9 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 12 |
+
Requires-Python: >=3.8
|
| 13 |
+
Description-Content-Type: text/x-rst
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
Provides-Extra: docs
|
| 16 |
+
Requires-Dist: sphinx >=3.5 ; extra == 'docs'
|
| 17 |
+
Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
|
| 18 |
+
Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
|
| 19 |
+
Requires-Dist: furo ; extra == 'docs'
|
| 20 |
+
Requires-Dist: sphinx-lint ; extra == 'docs'
|
| 21 |
+
Provides-Extra: testing
|
| 22 |
+
Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
|
| 23 |
+
Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
|
| 24 |
+
Requires-Dist: pytest-cov ; extra == 'testing'
|
| 25 |
+
Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
|
| 26 |
+
Requires-Dist: jaraco.test ; extra == 'testing'
|
| 27 |
+
Requires-Dist: pytest !=8.0.* ; extra == 'testing'
|
| 28 |
+
|
| 29 |
+
.. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
|
| 30 |
+
:target: https://pypi.org/project/backports.tarfile
|
| 31 |
+
|
| 32 |
+
.. image:: https://img.shields.io/pypi/pyversions/backports.tarfile.svg
|
| 33 |
+
|
| 34 |
+
.. image:: https://github.com/jaraco/backports.tarfile/actions/workflows/main.yml/badge.svg
|
| 35 |
+
:target: https://github.com/jaraco/backports.tarfile/actions?query=workflow%3A%22tests%22
|
| 36 |
+
:alt: tests
|
| 37 |
+
|
| 38 |
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
| 39 |
+
:target: https://github.com/astral-sh/ruff
|
| 40 |
+
:alt: Ruff
|
| 41 |
+
|
| 42 |
+
.. .. image:: https://readthedocs.org/projects/backportstarfile/badge/?version=latest
|
| 43 |
+
.. :target: https://backportstarfile.readthedocs.io/en/latest/?badge=latest
|
| 44 |
+
|
| 45 |
+
.. image:: https://img.shields.io/badge/skeleton-2024-informational
|
| 46 |
+
:target: https://blog.jaraco.com/skeleton
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
|
| 3 |
+
backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
|
| 4 |
+
backports.tarfile-1.2.0.dist-info/RECORD,,
|
| 5 |
+
backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
| 7 |
+
backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
|
| 8 |
+
backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
|
| 9 |
+
backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
|
| 10 |
+
backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
|
| 11 |
+
backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 12 |
+
backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.43.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
backports
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
if sys.version_info < (3, 9):
|
| 5 |
+
|
| 6 |
+
def removesuffix(self, suffix):
|
| 7 |
+
# suffix='' should not call self[:-0].
|
| 8 |
+
if suffix and self.endswith(suffix):
|
| 9 |
+
return self[: -len(suffix)]
|
| 10 |
+
else:
|
| 11 |
+
return self[:]
|
| 12 |
+
|
| 13 |
+
def removeprefix(self, prefix):
|
| 14 |
+
if self.startswith(prefix):
|
| 15 |
+
return self[len(prefix) :]
|
| 16 |
+
else:
|
| 17 |
+
return self[:]
|
| 18 |
+
else:
|
| 19 |
+
|
| 20 |
+
def removesuffix(self, suffix):
|
| 21 |
+
return self.removesuffix(suffix)
|
| 22 |
+
|
| 23 |
+
def removeprefix(self, prefix):
|
| 24 |
+
return self.removeprefix(prefix)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
conda
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: importlib_metadata
|
| 3 |
+
Version: 8.7.1
|
| 4 |
+
Summary: Read metadata from Python packages
|
| 5 |
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
| 6 |
+
License-Expression: Apache-2.0
|
| 7 |
+
Project-URL: Source, https://github.com/python/importlib_metadata
|
| 8 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 9 |
+
Classifier: Intended Audience :: Developers
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 12 |
+
Requires-Python: >=3.9
|
| 13 |
+
Description-Content-Type: text/x-rst
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
Requires-Dist: zipp>=3.20
|
| 16 |
+
Provides-Extra: test
|
| 17 |
+
Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
|
| 18 |
+
Requires-Dist: packaging; extra == "test"
|
| 19 |
+
Requires-Dist: pyfakefs; extra == "test"
|
| 20 |
+
Requires-Dist: flufl.flake8; extra == "test"
|
| 21 |
+
Requires-Dist: pytest-perf>=0.9.2; extra == "test"
|
| 22 |
+
Requires-Dist: jaraco.test>=5.4; extra == "test"
|
| 23 |
+
Provides-Extra: doc
|
| 24 |
+
Requires-Dist: sphinx>=3.5; extra == "doc"
|
| 25 |
+
Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
|
| 26 |
+
Requires-Dist: rst.linker>=1.9; extra == "doc"
|
| 27 |
+
Requires-Dist: furo; extra == "doc"
|
| 28 |
+
Requires-Dist: sphinx-lint; extra == "doc"
|
| 29 |
+
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
|
| 30 |
+
Provides-Extra: perf
|
| 31 |
+
Requires-Dist: ipython; extra == "perf"
|
| 32 |
+
Provides-Extra: check
|
| 33 |
+
Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
|
| 34 |
+
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
|
| 35 |
+
Provides-Extra: cover
|
| 36 |
+
Requires-Dist: pytest-cov; extra == "cover"
|
| 37 |
+
Provides-Extra: enabler
|
| 38 |
+
Requires-Dist: pytest-enabler>=3.4; extra == "enabler"
|
| 39 |
+
Provides-Extra: type
|
| 40 |
+
Requires-Dist: pytest-mypy>=1.0.1; extra == "type"
|
| 41 |
+
Requires-Dist: mypy<1.19; platform_python_implementation == "PyPy" and extra == "type"
|
| 42 |
+
Dynamic: license-file
|
| 43 |
+
|
| 44 |
+
.. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
|
| 45 |
+
:target: https://pypi.org/project/importlib_metadata
|
| 46 |
+
|
| 47 |
+
.. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
|
| 48 |
+
|
| 49 |
+
.. image:: https://github.com/python/importlib_metadata/actions/workflows/main.yml/badge.svg
|
| 50 |
+
:target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
|
| 51 |
+
:alt: tests
|
| 52 |
+
|
| 53 |
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
| 54 |
+
:target: https://github.com/astral-sh/ruff
|
| 55 |
+
:alt: Ruff
|
| 56 |
+
|
| 57 |
+
.. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
|
| 58 |
+
:target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
|
| 59 |
+
|
| 60 |
+
.. image:: https://img.shields.io/badge/skeleton-2025-informational
|
| 61 |
+
:target: https://blog.jaraco.com/skeleton
|
| 62 |
+
|
| 63 |
+
.. image:: https://tidelift.com/badges/package/pypi/importlib-metadata
|
| 64 |
+
:target: https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=readme
|
| 65 |
+
|
| 66 |
+
Library to access the metadata for a Python package.
|
| 67 |
+
|
| 68 |
+
This package supplies third-party access to the functionality of
|
| 69 |
+
`importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
|
| 70 |
+
including improvements added to subsequent Python versions.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
Compatibility
|
| 74 |
+
=============
|
| 75 |
+
|
| 76 |
+
New features are introduced in this third-party library and later merged
|
| 77 |
+
into CPython. The following table indicates which versions of this library
|
| 78 |
+
were contributed to different versions in the standard library:
|
| 79 |
+
|
| 80 |
+
.. list-table::
|
| 81 |
+
:header-rows: 1
|
| 82 |
+
|
| 83 |
+
* - importlib_metadata
|
| 84 |
+
- stdlib
|
| 85 |
+
* - 7.0
|
| 86 |
+
- 3.13
|
| 87 |
+
* - 6.5
|
| 88 |
+
- 3.12
|
| 89 |
+
* - 4.13
|
| 90 |
+
- 3.11
|
| 91 |
+
* - 4.6
|
| 92 |
+
- 3.10
|
| 93 |
+
* - 1.4
|
| 94 |
+
- 3.8
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Usage
|
| 98 |
+
=====
|
| 99 |
+
|
| 100 |
+
See the `online documentation <https://importlib-metadata.readthedocs.io/>`_
|
| 101 |
+
for usage details.
|
| 102 |
+
|
| 103 |
+
`Finder authors
|
| 104 |
+
<https://docs.python.org/3/reference/import.html#finders-and-loaders>`_ can
|
| 105 |
+
also add support for custom package installers. See the above documentation
|
| 106 |
+
for details.
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
Caveats
|
| 110 |
+
=======
|
| 111 |
+
|
| 112 |
+
This project primarily supports third-party packages installed by PyPA
|
| 113 |
+
tools (or other conforming packages). It does not support:
|
| 114 |
+
|
| 115 |
+
- Packages in the stdlib.
|
| 116 |
+
- Packages installed without metadata.
|
| 117 |
+
|
| 118 |
+
Project details
|
| 119 |
+
===============
|
| 120 |
+
|
| 121 |
+
* Project home: https://github.com/python/importlib_metadata
|
| 122 |
+
* Report bugs at: https://github.com/python/importlib_metadata/issues
|
| 123 |
+
* Code hosting: https://github.com/python/importlib_metadata
|
| 124 |
+
* Documentation: https://importlib-metadata.readthedocs.io/
|
| 125 |
+
|
| 126 |
+
For Enterprise
|
| 127 |
+
==============
|
| 128 |
+
|
| 129 |
+
Available as part of the Tidelift Subscription.
|
| 130 |
+
|
| 131 |
+
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
|
| 132 |
+
|
| 133 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=referral&utm_campaign=github>`_.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
importlib_metadata-8.7.1.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
importlib_metadata-8.7.1.dist-info/METADATA,sha256=o-OLnuQyYonUhkcE8w4pnudp4jCc6fSnXw3hpQrQo1Y,4670
|
| 3 |
+
importlib_metadata-8.7.1.dist-info/RECORD,,
|
| 4 |
+
importlib_metadata-8.7.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
importlib_metadata-8.7.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
| 6 |
+
importlib_metadata-8.7.1.dist-info/licenses/LICENSE,sha256=RYUC4S2Xu_ZEOGBqIARKqF6wX7CoqAe7NdvsJT_R_AQ,10278
|
| 7 |
+
importlib_metadata-8.7.1.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
|
| 8 |
+
importlib_metadata/__init__.py,sha256=u7Ew4-UkpzNY-ka6k-WRkDhQZS1akkLMfWs2eEnUmGo,37734
|
| 9 |
+
importlib_metadata/_adapters.py,sha256=r5i8XLrKT6xmrpoREZhZrfczOYDmrVZeJBW5u0HzIGU,3797
|
| 10 |
+
importlib_metadata/_collections.py,sha256=CxAhzlF3g1rwu_fMiB53JtRQiUFh0RgiMpoOvmK_ocg,760
|
| 11 |
+
importlib_metadata/_compat.py,sha256=VC5ZDLlT-BcshauCShdFJvMNLntJJfZzNK1meGa-enw,1313
|
| 12 |
+
importlib_metadata/_functools.py,sha256=0pA2OoiVK6wnsGq8HvVIzgdkvLiZ0nfnfw7IsndjoHk,3510
|
| 13 |
+
importlib_metadata/_itertools.py,sha256=nMvp9SfHAQ_JYwK4L2i64lr3GRXGlYlikGTVzWbys_E,5351
|
| 14 |
+
importlib_metadata/_meta.py,sha256=EtHyiJ5kGzWFDfKyQ2XQp6Vu113CeadKW1Vf6aGc1B4,1765
|
| 15 |
+
importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
|
| 16 |
+
importlib_metadata/_typing.py,sha256=EQKhhsEgz_Sa-FnePI-faC72rNOOQwopjA1i5pG8FDU,367
|
| 17 |
+
importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 18 |
+
importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
|
| 19 |
+
importlib_metadata/compat/py39.py,sha256=J3W7PUVRPNYMmcvT12RF8ndBU9e8_T0Ac4U87Bsrq70,1187
|
| 20 |
+
importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
|
| 21 |
+
importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.9.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
| 10 |
+
|
| 11 |
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
| 12 |
+
|
| 13 |
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
| 14 |
+
|
| 15 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
| 16 |
+
|
| 17 |
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
| 18 |
+
|
| 19 |
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 20 |
+
|
| 21 |
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
| 22 |
+
|
| 23 |
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
| 24 |
+
|
| 25 |
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
| 26 |
+
|
| 27 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
| 28 |
+
|
| 29 |
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
| 30 |
+
|
| 31 |
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
| 32 |
+
|
| 33 |
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
| 34 |
+
|
| 35 |
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
| 36 |
+
|
| 37 |
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
| 38 |
+
|
| 39 |
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
| 40 |
+
|
| 41 |
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
| 42 |
+
|
| 43 |
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
| 44 |
+
|
| 45 |
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
| 46 |
+
|
| 47 |
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
| 48 |
+
|
| 49 |
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
| 50 |
+
|
| 51 |
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
| 52 |
+
|
| 53 |
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
| 54 |
+
|
| 55 |
+
END OF TERMS AND CONDITIONS
|
| 56 |
+
|
| 57 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 58 |
+
|
| 59 |
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
| 60 |
+
|
| 61 |
+
Copyright 2025 [name of copyright owner]
|
| 62 |
+
|
| 63 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 64 |
+
you may not use this file except in compliance with the License.
|
| 65 |
+
You may obtain a copy of the License at
|
| 66 |
+
|
| 67 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 68 |
+
|
| 69 |
+
Unless required by applicable law or agreed to in writing, software
|
| 70 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 71 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 72 |
+
See the License for the specific language governing permissions and
|
| 73 |
+
limitations under the License.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
importlib_metadata
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py
ADDED
|
@@ -0,0 +1,1191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
APIs exposing metadata from third-party Python packages.
|
| 3 |
+
|
| 4 |
+
This codebase is shared between importlib.metadata in the stdlib
|
| 5 |
+
and importlib_metadata in PyPI. See
|
| 6 |
+
https://github.com/python/importlib_metadata/wiki/Development-Methodology
|
| 7 |
+
for more detail.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import abc
|
| 13 |
+
import collections
|
| 14 |
+
import email
|
| 15 |
+
import functools
|
| 16 |
+
import itertools
|
| 17 |
+
import operator
|
| 18 |
+
import os
|
| 19 |
+
import pathlib
|
| 20 |
+
import posixpath
|
| 21 |
+
import re
|
| 22 |
+
import sys
|
| 23 |
+
import textwrap
|
| 24 |
+
import types
|
| 25 |
+
from collections.abc import Iterable, Mapping
|
| 26 |
+
from contextlib import suppress
|
| 27 |
+
from importlib import import_module
|
| 28 |
+
from importlib.abc import MetaPathFinder
|
| 29 |
+
from itertools import starmap
|
| 30 |
+
from typing import Any
|
| 31 |
+
|
| 32 |
+
from . import _meta
|
| 33 |
+
from ._collections import FreezableDefaultDict, Pair
|
| 34 |
+
from ._compat import (
|
| 35 |
+
NullFinder,
|
| 36 |
+
install,
|
| 37 |
+
)
|
| 38 |
+
from ._functools import method_cache, noop, pass_none, passthrough
|
| 39 |
+
from ._itertools import always_iterable, bucket, unique_everseen
|
| 40 |
+
from ._meta import PackageMetadata, SimplePath
|
| 41 |
+
from ._typing import md_none
|
| 42 |
+
from .compat import py39, py311
|
| 43 |
+
|
| 44 |
+
__all__ = [
|
| 45 |
+
'Distribution',
|
| 46 |
+
'DistributionFinder',
|
| 47 |
+
'PackageMetadata',
|
| 48 |
+
'PackageNotFoundError',
|
| 49 |
+
'SimplePath',
|
| 50 |
+
'distribution',
|
| 51 |
+
'distributions',
|
| 52 |
+
'entry_points',
|
| 53 |
+
'files',
|
| 54 |
+
'metadata',
|
| 55 |
+
'packages_distributions',
|
| 56 |
+
'requires',
|
| 57 |
+
'version',
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class PackageNotFoundError(ModuleNotFoundError):
|
| 62 |
+
"""The package was not found."""
|
| 63 |
+
|
| 64 |
+
def __str__(self) -> str:
|
| 65 |
+
return f"No package metadata was found for {self.name}"
|
| 66 |
+
|
| 67 |
+
@property
|
| 68 |
+
def name(self) -> str: # type: ignore[override] # make readonly
|
| 69 |
+
(name,) = self.args
|
| 70 |
+
return name
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class Sectioned:
|
| 74 |
+
"""
|
| 75 |
+
A simple entry point config parser for performance
|
| 76 |
+
|
| 77 |
+
>>> for item in Sectioned.read(Sectioned._sample):
|
| 78 |
+
... print(item)
|
| 79 |
+
Pair(name='sec1', value='# comments ignored')
|
| 80 |
+
Pair(name='sec1', value='a = 1')
|
| 81 |
+
Pair(name='sec1', value='b = 2')
|
| 82 |
+
Pair(name='sec2', value='a = 2')
|
| 83 |
+
|
| 84 |
+
>>> res = Sectioned.section_pairs(Sectioned._sample)
|
| 85 |
+
>>> item = next(res)
|
| 86 |
+
>>> item.name
|
| 87 |
+
'sec1'
|
| 88 |
+
>>> item.value
|
| 89 |
+
Pair(name='a', value='1')
|
| 90 |
+
>>> item = next(res)
|
| 91 |
+
>>> item.value
|
| 92 |
+
Pair(name='b', value='2')
|
| 93 |
+
>>> item = next(res)
|
| 94 |
+
>>> item.name
|
| 95 |
+
'sec2'
|
| 96 |
+
>>> item.value
|
| 97 |
+
Pair(name='a', value='2')
|
| 98 |
+
>>> list(res)
|
| 99 |
+
[]
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
_sample = textwrap.dedent(
|
| 103 |
+
"""
|
| 104 |
+
[sec1]
|
| 105 |
+
# comments ignored
|
| 106 |
+
a = 1
|
| 107 |
+
b = 2
|
| 108 |
+
|
| 109 |
+
[sec2]
|
| 110 |
+
a = 2
|
| 111 |
+
"""
|
| 112 |
+
).lstrip()
|
| 113 |
+
|
| 114 |
+
@classmethod
|
| 115 |
+
def section_pairs(cls, text):
|
| 116 |
+
return (
|
| 117 |
+
section._replace(value=Pair.parse(section.value))
|
| 118 |
+
for section in cls.read(text, filter_=cls.valid)
|
| 119 |
+
if section.name is not None
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
@staticmethod
|
| 123 |
+
def read(text, filter_=None):
|
| 124 |
+
lines = filter(filter_, map(str.strip, text.splitlines()))
|
| 125 |
+
name = None
|
| 126 |
+
for value in lines:
|
| 127 |
+
section_match = value.startswith('[') and value.endswith(']')
|
| 128 |
+
if section_match:
|
| 129 |
+
name = value.strip('[]')
|
| 130 |
+
continue
|
| 131 |
+
yield Pair(name, value)
|
| 132 |
+
|
| 133 |
+
@staticmethod
|
| 134 |
+
def valid(line: str):
|
| 135 |
+
return line and not line.startswith('#')
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class _EntryPointMatch(types.SimpleNamespace):
|
| 139 |
+
module: str
|
| 140 |
+
attr: str
|
| 141 |
+
extras: str
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class EntryPoint:
|
| 145 |
+
"""An entry point as defined by Python packaging conventions.
|
| 146 |
+
|
| 147 |
+
See `the packaging docs on entry points
|
| 148 |
+
<https://packaging.python.org/specifications/entry-points/>`_
|
| 149 |
+
for more information.
|
| 150 |
+
|
| 151 |
+
>>> ep = EntryPoint(
|
| 152 |
+
... name=None, group=None, value='package.module:attr [extra1, extra2]')
|
| 153 |
+
>>> ep.module
|
| 154 |
+
'package.module'
|
| 155 |
+
>>> ep.attr
|
| 156 |
+
'attr'
|
| 157 |
+
>>> ep.extras
|
| 158 |
+
['extra1', 'extra2']
|
| 159 |
+
|
| 160 |
+
If the value package or module are not valid identifiers, a
|
| 161 |
+
ValueError is raised on access.
|
| 162 |
+
|
| 163 |
+
>>> EntryPoint(name=None, group=None, value='invalid-name').module
|
| 164 |
+
Traceback (most recent call last):
|
| 165 |
+
...
|
| 166 |
+
ValueError: ('Invalid object reference...invalid-name...
|
| 167 |
+
>>> EntryPoint(name=None, group=None, value='invalid-name').attr
|
| 168 |
+
Traceback (most recent call last):
|
| 169 |
+
...
|
| 170 |
+
ValueError: ('Invalid object reference...invalid-name...
|
| 171 |
+
>>> EntryPoint(name=None, group=None, value='invalid-name').extras
|
| 172 |
+
Traceback (most recent call last):
|
| 173 |
+
...
|
| 174 |
+
ValueError: ('Invalid object reference...invalid-name...
|
| 175 |
+
|
| 176 |
+
The same thing happens on construction.
|
| 177 |
+
|
| 178 |
+
>>> EntryPoint(name=None, group=None, value='invalid-name')
|
| 179 |
+
Traceback (most recent call last):
|
| 180 |
+
...
|
| 181 |
+
ValueError: ('Invalid object reference...invalid-name...
|
| 182 |
+
|
| 183 |
+
"""
|
| 184 |
+
|
| 185 |
+
pattern = re.compile(
|
| 186 |
+
r'(?P<module>[\w.]+)\s*'
|
| 187 |
+
r'(:\s*(?P<attr>[\w.]+)\s*)?'
|
| 188 |
+
r'((?P<extras>\[.*\])\s*)?$'
|
| 189 |
+
)
|
| 190 |
+
"""
|
| 191 |
+
A regular expression describing the syntax for an entry point,
|
| 192 |
+
which might look like:
|
| 193 |
+
|
| 194 |
+
- module
|
| 195 |
+
- package.module
|
| 196 |
+
- package.module:attribute
|
| 197 |
+
- package.module:object.attribute
|
| 198 |
+
- package.module:attr [extra1, extra2]
|
| 199 |
+
|
| 200 |
+
Other combinations are possible as well.
|
| 201 |
+
|
| 202 |
+
The expression is lenient about whitespace around the ':',
|
| 203 |
+
following the attr, and following any extras.
|
| 204 |
+
"""
|
| 205 |
+
|
| 206 |
+
name: str
|
| 207 |
+
value: str
|
| 208 |
+
group: str
|
| 209 |
+
|
| 210 |
+
dist: Distribution | None = None
|
| 211 |
+
|
| 212 |
+
def __init__(self, name: str, value: str, group: str) -> None:
|
| 213 |
+
vars(self).update(name=name, value=value, group=group)
|
| 214 |
+
self.module
|
| 215 |
+
|
| 216 |
+
def load(self) -> Any:
|
| 217 |
+
"""Load the entry point from its definition. If only a module
|
| 218 |
+
is indicated by the value, return that module. Otherwise,
|
| 219 |
+
return the named object.
|
| 220 |
+
"""
|
| 221 |
+
module = import_module(self.module)
|
| 222 |
+
attrs = filter(None, (self.attr or '').split('.'))
|
| 223 |
+
return functools.reduce(getattr, attrs, module)
|
| 224 |
+
|
| 225 |
+
@property
|
| 226 |
+
def module(self) -> str:
|
| 227 |
+
return self._match.module
|
| 228 |
+
|
| 229 |
+
@property
|
| 230 |
+
def attr(self) -> str:
|
| 231 |
+
return self._match.attr
|
| 232 |
+
|
| 233 |
+
@property
|
| 234 |
+
def extras(self) -> list[str]:
|
| 235 |
+
return re.findall(r'\w+', self._match.extras or '')
|
| 236 |
+
|
| 237 |
+
@functools.cached_property
|
| 238 |
+
def _match(self) -> _EntryPointMatch:
|
| 239 |
+
match = self.pattern.match(self.value)
|
| 240 |
+
if not match:
|
| 241 |
+
raise ValueError(
|
| 242 |
+
'Invalid object reference. '
|
| 243 |
+
'See https://packaging.python.org'
|
| 244 |
+
'/en/latest/specifications/entry-points/#data-model',
|
| 245 |
+
self.value,
|
| 246 |
+
)
|
| 247 |
+
return _EntryPointMatch(**match.groupdict())
|
| 248 |
+
|
| 249 |
+
def _for(self, dist):
|
| 250 |
+
vars(self).update(dist=dist)
|
| 251 |
+
return self
|
| 252 |
+
|
| 253 |
+
def matches(self, **params):
|
| 254 |
+
"""
|
| 255 |
+
EntryPoint matches the given parameters.
|
| 256 |
+
|
| 257 |
+
>>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
|
| 258 |
+
>>> ep.matches(group='foo')
|
| 259 |
+
True
|
| 260 |
+
>>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
|
| 261 |
+
True
|
| 262 |
+
>>> ep.matches(group='foo', name='other')
|
| 263 |
+
False
|
| 264 |
+
>>> ep.matches()
|
| 265 |
+
True
|
| 266 |
+
>>> ep.matches(extras=['extra1', 'extra2'])
|
| 267 |
+
True
|
| 268 |
+
>>> ep.matches(module='bing')
|
| 269 |
+
True
|
| 270 |
+
>>> ep.matches(attr='bong')
|
| 271 |
+
True
|
| 272 |
+
"""
|
| 273 |
+
self._disallow_dist(params)
|
| 274 |
+
attrs = (getattr(self, param) for param in params)
|
| 275 |
+
return all(map(operator.eq, params.values(), attrs))
|
| 276 |
+
|
| 277 |
+
@staticmethod
|
| 278 |
+
def _disallow_dist(params):
|
| 279 |
+
"""
|
| 280 |
+
Querying by dist is not allowed (dist objects are not comparable).
|
| 281 |
+
>>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo')
|
| 282 |
+
Traceback (most recent call last):
|
| 283 |
+
...
|
| 284 |
+
ValueError: "dist" is not suitable for matching...
|
| 285 |
+
"""
|
| 286 |
+
if "dist" in params:
|
| 287 |
+
raise ValueError(
|
| 288 |
+
'"dist" is not suitable for matching. '
|
| 289 |
+
"Instead, use Distribution.entry_points.select() on a "
|
| 290 |
+
"located distribution."
|
| 291 |
+
)
|
| 292 |
+
|
| 293 |
+
def _key(self):
|
| 294 |
+
return self.name, self.value, self.group
|
| 295 |
+
|
| 296 |
+
def __lt__(self, other):
|
| 297 |
+
return self._key() < other._key()
|
| 298 |
+
|
| 299 |
+
def __eq__(self, other):
|
| 300 |
+
return self._key() == other._key()
|
| 301 |
+
|
| 302 |
+
def __setattr__(self, name, value):
|
| 303 |
+
raise AttributeError("EntryPoint objects are immutable.")
|
| 304 |
+
|
| 305 |
+
def __repr__(self):
|
| 306 |
+
return (
|
| 307 |
+
f'EntryPoint(name={self.name!r}, value={self.value!r}, '
|
| 308 |
+
f'group={self.group!r})'
|
| 309 |
+
)
|
| 310 |
+
|
| 311 |
+
def __hash__(self) -> int:
|
| 312 |
+
return hash(self._key())
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
class EntryPoints(tuple):
|
| 316 |
+
"""
|
| 317 |
+
An immutable collection of selectable EntryPoint objects.
|
| 318 |
+
"""
|
| 319 |
+
|
| 320 |
+
__slots__ = ()
|
| 321 |
+
|
| 322 |
+
def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] # Work with str instead of int
|
| 323 |
+
"""
|
| 324 |
+
Get the EntryPoint in self matching name.
|
| 325 |
+
"""
|
| 326 |
+
try:
|
| 327 |
+
return next(iter(self.select(name=name)))
|
| 328 |
+
except StopIteration:
|
| 329 |
+
raise KeyError(name)
|
| 330 |
+
|
| 331 |
+
def __repr__(self):
|
| 332 |
+
"""
|
| 333 |
+
Repr with classname and tuple constructor to
|
| 334 |
+
signal that we deviate from regular tuple behavior.
|
| 335 |
+
"""
|
| 336 |
+
return '%s(%r)' % (self.__class__.__name__, tuple(self))
|
| 337 |
+
|
| 338 |
+
def select(self, **params) -> EntryPoints:
|
| 339 |
+
"""
|
| 340 |
+
Select entry points from self that match the
|
| 341 |
+
given parameters (typically group and/or name).
|
| 342 |
+
"""
|
| 343 |
+
return EntryPoints(ep for ep in self if py39.ep_matches(ep, **params))
|
| 344 |
+
|
| 345 |
+
@property
|
| 346 |
+
def names(self) -> set[str]:
|
| 347 |
+
"""
|
| 348 |
+
Return the set of all names of all entry points.
|
| 349 |
+
"""
|
| 350 |
+
return {ep.name for ep in self}
|
| 351 |
+
|
| 352 |
+
@property
|
| 353 |
+
def groups(self) -> set[str]:
|
| 354 |
+
"""
|
| 355 |
+
Return the set of all groups of all entry points.
|
| 356 |
+
"""
|
| 357 |
+
return {ep.group for ep in self}
|
| 358 |
+
|
| 359 |
+
@classmethod
|
| 360 |
+
def _from_text_for(cls, text, dist):
|
| 361 |
+
return cls(ep._for(dist) for ep in cls._from_text(text))
|
| 362 |
+
|
| 363 |
+
@staticmethod
|
| 364 |
+
def _from_text(text):
|
| 365 |
+
return (
|
| 366 |
+
EntryPoint(name=item.value.name, value=item.value.value, group=item.name)
|
| 367 |
+
for item in Sectioned.section_pairs(text or '')
|
| 368 |
+
)
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
class PackagePath(pathlib.PurePosixPath):
|
| 372 |
+
"""A reference to a path in a package"""
|
| 373 |
+
|
| 374 |
+
hash: FileHash | None
|
| 375 |
+
size: int
|
| 376 |
+
dist: Distribution
|
| 377 |
+
|
| 378 |
+
def read_text(self, encoding: str = 'utf-8') -> str:
|
| 379 |
+
return self.locate().read_text(encoding=encoding)
|
| 380 |
+
|
| 381 |
+
def read_binary(self) -> bytes:
|
| 382 |
+
return self.locate().read_bytes()
|
| 383 |
+
|
| 384 |
+
def locate(self) -> SimplePath:
|
| 385 |
+
"""Return a path-like object for this path"""
|
| 386 |
+
return self.dist.locate_file(self)
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
class FileHash:
|
| 390 |
+
def __init__(self, spec: str) -> None:
|
| 391 |
+
self.mode, _, self.value = spec.partition('=')
|
| 392 |
+
|
| 393 |
+
def __repr__(self) -> str:
|
| 394 |
+
return f'<FileHash mode: {self.mode} value: {self.value}>'
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
class Distribution(metaclass=abc.ABCMeta):
|
| 398 |
+
"""
|
| 399 |
+
An abstract Python distribution package.
|
| 400 |
+
|
| 401 |
+
Custom providers may derive from this class and define
|
| 402 |
+
the abstract methods to provide a concrete implementation
|
| 403 |
+
for their environment. Some providers may opt to override
|
| 404 |
+
the default implementation of some properties to bypass
|
| 405 |
+
the file-reading mechanism.
|
| 406 |
+
"""
|
| 407 |
+
|
| 408 |
+
@abc.abstractmethod
|
| 409 |
+
def read_text(self, filename) -> str | None:
|
| 410 |
+
"""Attempt to load metadata file given by the name.
|
| 411 |
+
|
| 412 |
+
Python distribution metadata is organized by blobs of text
|
| 413 |
+
typically represented as "files" in the metadata directory
|
| 414 |
+
(e.g. package-1.0.dist-info). These files include things
|
| 415 |
+
like:
|
| 416 |
+
|
| 417 |
+
- METADATA: The distribution metadata including fields
|
| 418 |
+
like Name and Version and Description.
|
| 419 |
+
- entry_points.txt: A series of entry points as defined in
|
| 420 |
+
`the entry points spec <https://packaging.python.org/en/latest/specifications/entry-points/#file-format>`_.
|
| 421 |
+
- RECORD: A record of files according to
|
| 422 |
+
`this recording spec <https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>`_.
|
| 423 |
+
|
| 424 |
+
A package may provide any set of files, including those
|
| 425 |
+
not listed here or none at all.
|
| 426 |
+
|
| 427 |
+
:param filename: The name of the file in the distribution info.
|
| 428 |
+
:return: The text if found, otherwise None.
|
| 429 |
+
"""
|
| 430 |
+
|
| 431 |
+
@abc.abstractmethod
|
| 432 |
+
def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
|
| 433 |
+
"""
|
| 434 |
+
Given a path to a file in this distribution, return a SimplePath
|
| 435 |
+
to it.
|
| 436 |
+
|
| 437 |
+
This method is used by callers of ``Distribution.files()`` to
|
| 438 |
+
locate files within the distribution. If it's possible for a
|
| 439 |
+
Distribution to represent files in the distribution as
|
| 440 |
+
``SimplePath`` objects, it should implement this method
|
| 441 |
+
to resolve such objects.
|
| 442 |
+
|
| 443 |
+
Some Distribution providers may elect not to resolve SimplePath
|
| 444 |
+
objects within the distribution by raising a
|
| 445 |
+
NotImplementedError, but consumers of such a Distribution would
|
| 446 |
+
be unable to invoke ``Distribution.files()``.
|
| 447 |
+
"""
|
| 448 |
+
|
| 449 |
+
@classmethod
|
| 450 |
+
def from_name(cls, name: str) -> Distribution:
|
| 451 |
+
"""Return the Distribution for the given package name.
|
| 452 |
+
|
| 453 |
+
:param name: The name of the distribution package to search for.
|
| 454 |
+
:return: The Distribution instance (or subclass thereof) for the named
|
| 455 |
+
package, if found.
|
| 456 |
+
:raises PackageNotFoundError: When the named package's distribution
|
| 457 |
+
metadata cannot be found.
|
| 458 |
+
:raises ValueError: When an invalid value is supplied for name.
|
| 459 |
+
"""
|
| 460 |
+
if not name:
|
| 461 |
+
raise ValueError("A distribution name is required.")
|
| 462 |
+
try:
|
| 463 |
+
return next(iter(cls._prefer_valid(cls.discover(name=name))))
|
| 464 |
+
except StopIteration:
|
| 465 |
+
raise PackageNotFoundError(name)
|
| 466 |
+
|
| 467 |
+
@classmethod
|
| 468 |
+
def discover(
|
| 469 |
+
cls, *, context: DistributionFinder.Context | None = None, **kwargs
|
| 470 |
+
) -> Iterable[Distribution]:
|
| 471 |
+
"""Return an iterable of Distribution objects for all packages.
|
| 472 |
+
|
| 473 |
+
Pass a ``context`` or pass keyword arguments for constructing
|
| 474 |
+
a context.
|
| 475 |
+
|
| 476 |
+
:context: A ``DistributionFinder.Context`` object.
|
| 477 |
+
:return: Iterable of Distribution objects for packages matching
|
| 478 |
+
the context.
|
| 479 |
+
"""
|
| 480 |
+
if context and kwargs:
|
| 481 |
+
raise ValueError("cannot accept context and kwargs")
|
| 482 |
+
context = context or DistributionFinder.Context(**kwargs)
|
| 483 |
+
return itertools.chain.from_iterable(
|
| 484 |
+
resolver(context) for resolver in cls._discover_resolvers()
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
@staticmethod
|
| 488 |
+
def _prefer_valid(dists: Iterable[Distribution]) -> Iterable[Distribution]:
|
| 489 |
+
"""
|
| 490 |
+
Prefer (move to the front) distributions that have metadata.
|
| 491 |
+
|
| 492 |
+
Ref python/importlib_resources#489.
|
| 493 |
+
"""
|
| 494 |
+
buckets = bucket(dists, lambda dist: bool(dist.metadata))
|
| 495 |
+
return itertools.chain(buckets[True], buckets[False])
|
| 496 |
+
|
| 497 |
+
@staticmethod
|
| 498 |
+
def at(path: str | os.PathLike[str]) -> Distribution:
|
| 499 |
+
"""Return a Distribution for the indicated metadata path.
|
| 500 |
+
|
| 501 |
+
:param path: a string or path-like object
|
| 502 |
+
:return: a concrete Distribution instance for the path
|
| 503 |
+
"""
|
| 504 |
+
return PathDistribution(pathlib.Path(path))
|
| 505 |
+
|
| 506 |
+
@staticmethod
|
| 507 |
+
def _discover_resolvers():
|
| 508 |
+
"""Search the meta_path for resolvers (MetadataPathFinders)."""
|
| 509 |
+
declared = (
|
| 510 |
+
getattr(finder, 'find_distributions', None) for finder in sys.meta_path
|
| 511 |
+
)
|
| 512 |
+
return filter(None, declared)
|
| 513 |
+
|
| 514 |
+
@property
|
| 515 |
+
def metadata(self) -> _meta.PackageMetadata | None:
|
| 516 |
+
"""Return the parsed metadata for this Distribution.
|
| 517 |
+
|
| 518 |
+
The returned object will have keys that name the various bits of
|
| 519 |
+
metadata per the
|
| 520 |
+
`Core metadata specifications <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_.
|
| 521 |
+
|
| 522 |
+
Custom providers may provide the METADATA file or override this
|
| 523 |
+
property.
|
| 524 |
+
"""
|
| 525 |
+
|
| 526 |
+
text = (
|
| 527 |
+
self.read_text('METADATA')
|
| 528 |
+
or self.read_text('PKG-INFO')
|
| 529 |
+
# This last clause is here to support old egg-info files. Its
|
| 530 |
+
# effect is to just end up using the PathDistribution's self._path
|
| 531 |
+
# (which points to the egg-info file) attribute unchanged.
|
| 532 |
+
or self.read_text('')
|
| 533 |
+
)
|
| 534 |
+
return self._assemble_message(text)
|
| 535 |
+
|
| 536 |
+
@staticmethod
|
| 537 |
+
@pass_none
|
| 538 |
+
def _assemble_message(text: str) -> _meta.PackageMetadata:
|
| 539 |
+
# deferred for performance (python/cpython#109829)
|
| 540 |
+
from . import _adapters
|
| 541 |
+
|
| 542 |
+
return _adapters.Message(email.message_from_string(text))
|
| 543 |
+
|
| 544 |
+
@property
|
| 545 |
+
def name(self) -> str:
|
| 546 |
+
"""Return the 'Name' metadata for the distribution package."""
|
| 547 |
+
return md_none(self.metadata)['Name']
|
| 548 |
+
|
| 549 |
+
@property
|
| 550 |
+
def _normalized_name(self):
|
| 551 |
+
"""Return a normalized version of the name."""
|
| 552 |
+
return Prepared.normalize(self.name)
|
| 553 |
+
|
| 554 |
+
@property
|
| 555 |
+
def version(self) -> str:
|
| 556 |
+
"""Return the 'Version' metadata for the distribution package."""
|
| 557 |
+
return md_none(self.metadata)['Version']
|
| 558 |
+
|
| 559 |
+
@property
|
| 560 |
+
def entry_points(self) -> EntryPoints:
|
| 561 |
+
"""
|
| 562 |
+
Return EntryPoints for this distribution.
|
| 563 |
+
|
| 564 |
+
Custom providers may provide the ``entry_points.txt`` file
|
| 565 |
+
or override this property.
|
| 566 |
+
"""
|
| 567 |
+
return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
|
| 568 |
+
|
| 569 |
+
@property
|
| 570 |
+
def files(self) -> list[PackagePath] | None:
|
| 571 |
+
"""Files in this distribution.
|
| 572 |
+
|
| 573 |
+
:return: List of PackagePath for this distribution or None
|
| 574 |
+
|
| 575 |
+
Result is `None` if the metadata file that enumerates files
|
| 576 |
+
(i.e. RECORD for dist-info, or installed-files.txt or
|
| 577 |
+
SOURCES.txt for egg-info) is missing.
|
| 578 |
+
Result may be empty if the metadata exists but is empty.
|
| 579 |
+
|
| 580 |
+
Custom providers are recommended to provide a "RECORD" file (in
|
| 581 |
+
``read_text``) or override this property to allow for callers to be
|
| 582 |
+
able to resolve filenames provided by the package.
|
| 583 |
+
"""
|
| 584 |
+
|
| 585 |
+
def make_file(name, hash=None, size_str=None):
|
| 586 |
+
result = PackagePath(name)
|
| 587 |
+
result.hash = FileHash(hash) if hash else None
|
| 588 |
+
result.size = int(size_str) if size_str else None
|
| 589 |
+
result.dist = self
|
| 590 |
+
return result
|
| 591 |
+
|
| 592 |
+
@pass_none
|
| 593 |
+
def make_files(lines):
|
| 594 |
+
# Delay csv import, since Distribution.files is not as widely used
|
| 595 |
+
# as other parts of importlib.metadata
|
| 596 |
+
import csv
|
| 597 |
+
|
| 598 |
+
return starmap(make_file, csv.reader(lines))
|
| 599 |
+
|
| 600 |
+
@pass_none
|
| 601 |
+
def skip_missing_files(package_paths):
|
| 602 |
+
return list(filter(lambda path: path.locate().exists(), package_paths))
|
| 603 |
+
|
| 604 |
+
return skip_missing_files(
|
| 605 |
+
make_files(
|
| 606 |
+
self._read_files_distinfo()
|
| 607 |
+
or self._read_files_egginfo_installed()
|
| 608 |
+
or self._read_files_egginfo_sources()
|
| 609 |
+
)
|
| 610 |
+
)
|
| 611 |
+
|
| 612 |
+
def _read_files_distinfo(self):
|
| 613 |
+
"""
|
| 614 |
+
Read the lines of RECORD.
|
| 615 |
+
"""
|
| 616 |
+
text = self.read_text('RECORD')
|
| 617 |
+
return text and text.splitlines()
|
| 618 |
+
|
| 619 |
+
def _read_files_egginfo_installed(self):
|
| 620 |
+
"""
|
| 621 |
+
Read installed-files.txt and return lines in a similar
|
| 622 |
+
CSV-parsable format as RECORD: each file must be placed
|
| 623 |
+
relative to the site-packages directory and must also be
|
| 624 |
+
quoted (since file names can contain literal commas).
|
| 625 |
+
|
| 626 |
+
This file is written when the package is installed by pip,
|
| 627 |
+
but it might not be written for other installation methods.
|
| 628 |
+
Assume the file is accurate if it exists.
|
| 629 |
+
"""
|
| 630 |
+
text = self.read_text('installed-files.txt')
|
| 631 |
+
# Prepend the .egg-info/ subdir to the lines in this file.
|
| 632 |
+
# But this subdir is only available from PathDistribution's
|
| 633 |
+
# self._path.
|
| 634 |
+
subdir = getattr(self, '_path', None)
|
| 635 |
+
if not text or not subdir:
|
| 636 |
+
return
|
| 637 |
+
|
| 638 |
+
paths = (
|
| 639 |
+
py311
|
| 640 |
+
.relative_fix((subdir / name).resolve())
|
| 641 |
+
.relative_to(self.locate_file('').resolve(), walk_up=True)
|
| 642 |
+
.as_posix()
|
| 643 |
+
for name in text.splitlines()
|
| 644 |
+
)
|
| 645 |
+
return map('"{}"'.format, paths)
|
| 646 |
+
|
| 647 |
+
def _read_files_egginfo_sources(self):
|
| 648 |
+
"""
|
| 649 |
+
Read SOURCES.txt and return lines in a similar CSV-parsable
|
| 650 |
+
format as RECORD: each file name must be quoted (since it
|
| 651 |
+
might contain literal commas).
|
| 652 |
+
|
| 653 |
+
Note that SOURCES.txt is not a reliable source for what
|
| 654 |
+
files are installed by a package. This file is generated
|
| 655 |
+
for a source archive, and the files that are present
|
| 656 |
+
there (e.g. setup.py) may not correctly reflect the files
|
| 657 |
+
that are present after the package has been installed.
|
| 658 |
+
"""
|
| 659 |
+
text = self.read_text('SOURCES.txt')
|
| 660 |
+
return text and map('"{}"'.format, text.splitlines())
|
| 661 |
+
|
| 662 |
+
@property
|
| 663 |
+
def requires(self) -> list[str] | None:
|
| 664 |
+
"""Generated requirements specified for this Distribution"""
|
| 665 |
+
reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
|
| 666 |
+
return reqs and list(reqs)
|
| 667 |
+
|
| 668 |
+
def _read_dist_info_reqs(self):
|
| 669 |
+
return self.metadata.get_all('Requires-Dist')
|
| 670 |
+
|
| 671 |
+
def _read_egg_info_reqs(self):
|
| 672 |
+
source = self.read_text('requires.txt')
|
| 673 |
+
return pass_none(self._deps_from_requires_text)(source)
|
| 674 |
+
|
| 675 |
+
@classmethod
|
| 676 |
+
def _deps_from_requires_text(cls, source):
|
| 677 |
+
return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
|
| 678 |
+
|
| 679 |
+
@staticmethod
|
| 680 |
+
def _convert_egg_info_reqs_to_simple_reqs(sections):
|
| 681 |
+
"""
|
| 682 |
+
Historically, setuptools would solicit and store 'extra'
|
| 683 |
+
requirements, including those with environment markers,
|
| 684 |
+
in separate sections. More modern tools expect each
|
| 685 |
+
dependency to be defined separately, with any relevant
|
| 686 |
+
extras and environment markers attached directly to that
|
| 687 |
+
requirement. This method converts the former to the
|
| 688 |
+
latter. See _test_deps_from_requires_text for an example.
|
| 689 |
+
"""
|
| 690 |
+
|
| 691 |
+
def make_condition(name):
|
| 692 |
+
return name and f'extra == "{name}"'
|
| 693 |
+
|
| 694 |
+
def quoted_marker(section):
|
| 695 |
+
section = section or ''
|
| 696 |
+
extra, sep, markers = section.partition(':')
|
| 697 |
+
if extra and markers:
|
| 698 |
+
markers = f'({markers})'
|
| 699 |
+
conditions = list(filter(None, [markers, make_condition(extra)]))
|
| 700 |
+
return '; ' + ' and '.join(conditions) if conditions else ''
|
| 701 |
+
|
| 702 |
+
def url_req_space(req):
|
| 703 |
+
"""
|
| 704 |
+
PEP 508 requires a space between the url_spec and the quoted_marker.
|
| 705 |
+
Ref python/importlib_metadata#357.
|
| 706 |
+
"""
|
| 707 |
+
# '@' is uniquely indicative of a url_req.
|
| 708 |
+
return ' ' * ('@' in req)
|
| 709 |
+
|
| 710 |
+
for section in sections:
|
| 711 |
+
space = url_req_space(section.value)
|
| 712 |
+
yield section.value + space + quoted_marker(section.name)
|
| 713 |
+
|
| 714 |
+
@property
|
| 715 |
+
def origin(self):
|
| 716 |
+
return self._load_json('direct_url.json')
|
| 717 |
+
|
| 718 |
+
def _load_json(self, filename):
|
| 719 |
+
# Deferred for performance (python/importlib_metadata#503)
|
| 720 |
+
import json
|
| 721 |
+
|
| 722 |
+
return pass_none(json.loads)(
|
| 723 |
+
self.read_text(filename),
|
| 724 |
+
object_hook=lambda data: types.SimpleNamespace(**data),
|
| 725 |
+
)
|
| 726 |
+
|
| 727 |
+
|
| 728 |
+
class DistributionFinder(MetaPathFinder):
|
| 729 |
+
"""
|
| 730 |
+
A MetaPathFinder capable of discovering installed distributions.
|
| 731 |
+
|
| 732 |
+
Custom providers should implement this interface in order to
|
| 733 |
+
supply metadata.
|
| 734 |
+
"""
|
| 735 |
+
|
| 736 |
+
class Context:
|
| 737 |
+
"""
|
| 738 |
+
Keyword arguments presented by the caller to
|
| 739 |
+
``distributions()`` or ``Distribution.discover()``
|
| 740 |
+
to narrow the scope of a search for distributions
|
| 741 |
+
in all DistributionFinders.
|
| 742 |
+
|
| 743 |
+
Each DistributionFinder may expect any parameters
|
| 744 |
+
and should attempt to honor the canonical
|
| 745 |
+
parameters defined below when appropriate.
|
| 746 |
+
|
| 747 |
+
This mechanism gives a custom provider a means to
|
| 748 |
+
solicit additional details from the caller beyond
|
| 749 |
+
"name" and "path" when searching distributions.
|
| 750 |
+
For example, imagine a provider that exposes suites
|
| 751 |
+
of packages in either a "public" or "private" ``realm``.
|
| 752 |
+
A caller may wish to query only for distributions in
|
| 753 |
+
a particular realm and could call
|
| 754 |
+
``distributions(realm="private")`` to signal to the
|
| 755 |
+
custom provider to only include distributions from that
|
| 756 |
+
realm.
|
| 757 |
+
"""
|
| 758 |
+
|
| 759 |
+
name = None
|
| 760 |
+
"""
|
| 761 |
+
Specific name for which a distribution finder should match.
|
| 762 |
+
A name of ``None`` matches all distributions.
|
| 763 |
+
"""
|
| 764 |
+
|
| 765 |
+
def __init__(self, **kwargs):
|
| 766 |
+
vars(self).update(kwargs)
|
| 767 |
+
|
| 768 |
+
@property
|
| 769 |
+
def path(self) -> list[str]:
|
| 770 |
+
"""
|
| 771 |
+
The sequence of directory path that a distribution finder
|
| 772 |
+
should search.
|
| 773 |
+
|
| 774 |
+
Typically refers to Python installed package paths such as
|
| 775 |
+
"site-packages" directories and defaults to ``sys.path``.
|
| 776 |
+
"""
|
| 777 |
+
return vars(self).get('path', sys.path)
|
| 778 |
+
|
| 779 |
+
@abc.abstractmethod
|
| 780 |
+
def find_distributions(self, context=Context()) -> Iterable[Distribution]:
|
| 781 |
+
"""
|
| 782 |
+
Find distributions.
|
| 783 |
+
|
| 784 |
+
Return an iterable of all Distribution instances capable of
|
| 785 |
+
loading the metadata for packages matching the ``context``,
|
| 786 |
+
a DistributionFinder.Context instance.
|
| 787 |
+
"""
|
| 788 |
+
|
| 789 |
+
|
| 790 |
+
@passthrough
|
| 791 |
+
def _clear_after_fork(cached):
|
| 792 |
+
"""Ensure ``func`` clears cached state after ``fork`` when supported.
|
| 793 |
+
|
| 794 |
+
``FastPath`` caches zip-backed ``pathlib.Path`` objects that retain a
|
| 795 |
+
reference to the parent's open ``ZipFile`` handle. Re-using a cached
|
| 796 |
+
instance in a forked child can therefore resurrect invalid file pointers
|
| 797 |
+
and trigger ``BadZipFile``/``OSError`` failures (python/importlib_metadata#520).
|
| 798 |
+
Registering ``cache_clear`` with ``os.register_at_fork`` keeps each process
|
| 799 |
+
on its own cache.
|
| 800 |
+
"""
|
| 801 |
+
getattr(os, 'register_at_fork', noop)(after_in_child=cached.cache_clear)
|
| 802 |
+
|
| 803 |
+
|
| 804 |
+
class FastPath:
|
| 805 |
+
"""
|
| 806 |
+
Micro-optimized class for searching a root for children.
|
| 807 |
+
|
| 808 |
+
Root is a path on the file system that may contain metadata
|
| 809 |
+
directories either as natural directories or within a zip file.
|
| 810 |
+
|
| 811 |
+
>>> FastPath('').children()
|
| 812 |
+
['...']
|
| 813 |
+
|
| 814 |
+
FastPath objects are cached and recycled for any given root.
|
| 815 |
+
|
| 816 |
+
>>> FastPath('foobar') is FastPath('foobar')
|
| 817 |
+
True
|
| 818 |
+
"""
|
| 819 |
+
|
| 820 |
+
@_clear_after_fork # type: ignore[misc]
|
| 821 |
+
@functools.lru_cache()
|
| 822 |
+
def __new__(cls, root):
|
| 823 |
+
return super().__new__(cls)
|
| 824 |
+
|
| 825 |
+
def __init__(self, root):
|
| 826 |
+
self.root = root
|
| 827 |
+
|
| 828 |
+
def joinpath(self, child):
|
| 829 |
+
return pathlib.Path(self.root, child)
|
| 830 |
+
|
| 831 |
+
def children(self):
|
| 832 |
+
with suppress(Exception):
|
| 833 |
+
return os.listdir(self.root or '.')
|
| 834 |
+
with suppress(Exception):
|
| 835 |
+
return self.zip_children()
|
| 836 |
+
return []
|
| 837 |
+
|
| 838 |
+
def zip_children(self):
|
| 839 |
+
# deferred for performance (python/importlib_metadata#502)
|
| 840 |
+
from zipp.compat.overlay import zipfile
|
| 841 |
+
|
| 842 |
+
zip_path = zipfile.Path(self.root)
|
| 843 |
+
names = zip_path.root.namelist()
|
| 844 |
+
self.joinpath = zip_path.joinpath
|
| 845 |
+
|
| 846 |
+
return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
|
| 847 |
+
|
| 848 |
+
def search(self, name):
|
| 849 |
+
return self.lookup(self.mtime).search(name)
|
| 850 |
+
|
| 851 |
+
@property
|
| 852 |
+
def mtime(self):
|
| 853 |
+
with suppress(OSError):
|
| 854 |
+
return os.stat(self.root).st_mtime
|
| 855 |
+
self.lookup.cache_clear()
|
| 856 |
+
|
| 857 |
+
@method_cache
|
| 858 |
+
def lookup(self, mtime):
|
| 859 |
+
return Lookup(self)
|
| 860 |
+
|
| 861 |
+
|
| 862 |
+
class Lookup:
|
| 863 |
+
"""
|
| 864 |
+
A micro-optimized class for searching a (fast) path for metadata.
|
| 865 |
+
"""
|
| 866 |
+
|
| 867 |
+
def __init__(self, path: FastPath):
|
| 868 |
+
"""
|
| 869 |
+
Calculate all of the children representing metadata.
|
| 870 |
+
|
| 871 |
+
From the children in the path, calculate early all of the
|
| 872 |
+
children that appear to represent metadata (infos) or legacy
|
| 873 |
+
metadata (eggs).
|
| 874 |
+
"""
|
| 875 |
+
|
| 876 |
+
base = os.path.basename(path.root).lower()
|
| 877 |
+
base_is_egg = base.endswith(".egg")
|
| 878 |
+
self.infos = FreezableDefaultDict(list)
|
| 879 |
+
self.eggs = FreezableDefaultDict(list)
|
| 880 |
+
|
| 881 |
+
for child in path.children():
|
| 882 |
+
low = child.lower()
|
| 883 |
+
if low.endswith((".dist-info", ".egg-info")):
|
| 884 |
+
# rpartition is faster than splitext and suitable for this purpose.
|
| 885 |
+
name = low.rpartition(".")[0].partition("-")[0]
|
| 886 |
+
normalized = Prepared.normalize(name)
|
| 887 |
+
self.infos[normalized].append(path.joinpath(child))
|
| 888 |
+
elif base_is_egg and low == "egg-info":
|
| 889 |
+
name = base.rpartition(".")[0].partition("-")[0]
|
| 890 |
+
legacy_normalized = Prepared.legacy_normalize(name)
|
| 891 |
+
self.eggs[legacy_normalized].append(path.joinpath(child))
|
| 892 |
+
|
| 893 |
+
self.infos.freeze()
|
| 894 |
+
self.eggs.freeze()
|
| 895 |
+
|
| 896 |
+
def search(self, prepared: Prepared):
|
| 897 |
+
"""
|
| 898 |
+
Yield all infos and eggs matching the Prepared query.
|
| 899 |
+
"""
|
| 900 |
+
infos = (
|
| 901 |
+
self.infos[prepared.normalized]
|
| 902 |
+
if prepared
|
| 903 |
+
else itertools.chain.from_iterable(self.infos.values())
|
| 904 |
+
)
|
| 905 |
+
eggs = (
|
| 906 |
+
self.eggs[prepared.legacy_normalized]
|
| 907 |
+
if prepared
|
| 908 |
+
else itertools.chain.from_iterable(self.eggs.values())
|
| 909 |
+
)
|
| 910 |
+
return itertools.chain(infos, eggs)
|
| 911 |
+
|
| 912 |
+
|
| 913 |
+
class Prepared:
|
| 914 |
+
"""
|
| 915 |
+
A prepared search query for metadata on a possibly-named package.
|
| 916 |
+
|
| 917 |
+
Pre-calculates the normalization to prevent repeated operations.
|
| 918 |
+
|
| 919 |
+
>>> none = Prepared(None)
|
| 920 |
+
>>> none.normalized
|
| 921 |
+
>>> none.legacy_normalized
|
| 922 |
+
>>> bool(none)
|
| 923 |
+
False
|
| 924 |
+
>>> sample = Prepared('Sample__Pkg-name.foo')
|
| 925 |
+
>>> sample.normalized
|
| 926 |
+
'sample_pkg_name_foo'
|
| 927 |
+
>>> sample.legacy_normalized
|
| 928 |
+
'sample__pkg_name.foo'
|
| 929 |
+
>>> bool(sample)
|
| 930 |
+
True
|
| 931 |
+
"""
|
| 932 |
+
|
| 933 |
+
normalized = None
|
| 934 |
+
legacy_normalized = None
|
| 935 |
+
|
| 936 |
+
def __init__(self, name: str | None):
|
| 937 |
+
self.name = name
|
| 938 |
+
if name is None:
|
| 939 |
+
return
|
| 940 |
+
self.normalized = self.normalize(name)
|
| 941 |
+
self.legacy_normalized = self.legacy_normalize(name)
|
| 942 |
+
|
| 943 |
+
@staticmethod
|
| 944 |
+
def normalize(name):
|
| 945 |
+
"""
|
| 946 |
+
PEP 503 normalization plus dashes as underscores.
|
| 947 |
+
"""
|
| 948 |
+
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
|
| 949 |
+
|
| 950 |
+
@staticmethod
|
| 951 |
+
def legacy_normalize(name):
|
| 952 |
+
"""
|
| 953 |
+
Normalize the package name as found in the convention in
|
| 954 |
+
older packaging tools versions and specs.
|
| 955 |
+
"""
|
| 956 |
+
return name.lower().replace('-', '_')
|
| 957 |
+
|
| 958 |
+
def __bool__(self):
|
| 959 |
+
return bool(self.name)
|
| 960 |
+
|
| 961 |
+
|
| 962 |
+
@install
|
| 963 |
+
class MetadataPathFinder(NullFinder, DistributionFinder):
|
| 964 |
+
"""A degenerate finder for distribution packages on the file system.
|
| 965 |
+
|
| 966 |
+
This finder supplies only a find_distributions() method for versions
|
| 967 |
+
of Python that do not have a PathFinder find_distributions().
|
| 968 |
+
"""
|
| 969 |
+
|
| 970 |
+
@classmethod
|
| 971 |
+
def find_distributions(
|
| 972 |
+
cls, context=DistributionFinder.Context()
|
| 973 |
+
) -> Iterable[PathDistribution]:
|
| 974 |
+
"""
|
| 975 |
+
Find distributions.
|
| 976 |
+
|
| 977 |
+
Return an iterable of all Distribution instances capable of
|
| 978 |
+
loading the metadata for packages matching ``context.name``
|
| 979 |
+
(or all names if ``None`` indicated) along the paths in the list
|
| 980 |
+
of directories ``context.path``.
|
| 981 |
+
"""
|
| 982 |
+
found = cls._search_paths(context.name, context.path)
|
| 983 |
+
return map(PathDistribution, found)
|
| 984 |
+
|
| 985 |
+
@classmethod
|
| 986 |
+
def _search_paths(cls, name, paths):
|
| 987 |
+
"""Find metadata directories in paths heuristically."""
|
| 988 |
+
prepared = Prepared(name)
|
| 989 |
+
return itertools.chain.from_iterable(
|
| 990 |
+
path.search(prepared) for path in map(FastPath, paths)
|
| 991 |
+
)
|
| 992 |
+
|
| 993 |
+
@classmethod
|
| 994 |
+
def invalidate_caches(cls) -> None:
|
| 995 |
+
FastPath.__new__.cache_clear()
|
| 996 |
+
|
| 997 |
+
|
| 998 |
+
class PathDistribution(Distribution):
|
| 999 |
+
def __init__(self, path: SimplePath) -> None:
|
| 1000 |
+
"""Construct a distribution.
|
| 1001 |
+
|
| 1002 |
+
:param path: SimplePath indicating the metadata directory.
|
| 1003 |
+
"""
|
| 1004 |
+
self._path = path
|
| 1005 |
+
|
| 1006 |
+
def read_text(self, filename: str | os.PathLike[str]) -> str | None:
|
| 1007 |
+
with suppress(
|
| 1008 |
+
FileNotFoundError,
|
| 1009 |
+
IsADirectoryError,
|
| 1010 |
+
KeyError,
|
| 1011 |
+
NotADirectoryError,
|
| 1012 |
+
PermissionError,
|
| 1013 |
+
):
|
| 1014 |
+
return self._path.joinpath(filename).read_text(encoding='utf-8')
|
| 1015 |
+
|
| 1016 |
+
return None
|
| 1017 |
+
|
| 1018 |
+
read_text.__doc__ = Distribution.read_text.__doc__
|
| 1019 |
+
|
| 1020 |
+
def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
|
| 1021 |
+
return self._path.parent / path
|
| 1022 |
+
|
| 1023 |
+
@property
|
| 1024 |
+
def _normalized_name(self):
|
| 1025 |
+
"""
|
| 1026 |
+
Performance optimization: where possible, resolve the
|
| 1027 |
+
normalized name from the file system path.
|
| 1028 |
+
"""
|
| 1029 |
+
stem = os.path.basename(str(self._path))
|
| 1030 |
+
return (
|
| 1031 |
+
pass_none(Prepared.normalize)(self._name_from_stem(stem))
|
| 1032 |
+
or super()._normalized_name
|
| 1033 |
+
)
|
| 1034 |
+
|
| 1035 |
+
@staticmethod
|
| 1036 |
+
def _name_from_stem(stem):
|
| 1037 |
+
"""
|
| 1038 |
+
>>> PathDistribution._name_from_stem('foo-3.0.egg-info')
|
| 1039 |
+
'foo'
|
| 1040 |
+
>>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
|
| 1041 |
+
'CherryPy'
|
| 1042 |
+
>>> PathDistribution._name_from_stem('face.egg-info')
|
| 1043 |
+
'face'
|
| 1044 |
+
>>> PathDistribution._name_from_stem('foo.bar')
|
| 1045 |
+
"""
|
| 1046 |
+
filename, ext = os.path.splitext(stem)
|
| 1047 |
+
if ext not in ('.dist-info', '.egg-info'):
|
| 1048 |
+
return
|
| 1049 |
+
name, sep, rest = filename.partition('-')
|
| 1050 |
+
return name
|
| 1051 |
+
|
| 1052 |
+
|
| 1053 |
+
def distribution(distribution_name: str) -> Distribution:
|
| 1054 |
+
"""Get the ``Distribution`` instance for the named package.
|
| 1055 |
+
|
| 1056 |
+
:param distribution_name: The name of the distribution package as a string.
|
| 1057 |
+
:return: A ``Distribution`` instance (or subclass thereof).
|
| 1058 |
+
"""
|
| 1059 |
+
return Distribution.from_name(distribution_name)
|
| 1060 |
+
|
| 1061 |
+
|
| 1062 |
+
def distributions(**kwargs) -> Iterable[Distribution]:
|
| 1063 |
+
"""Get all ``Distribution`` instances in the current environment.
|
| 1064 |
+
|
| 1065 |
+
:return: An iterable of ``Distribution`` instances.
|
| 1066 |
+
"""
|
| 1067 |
+
return Distribution.discover(**kwargs)
|
| 1068 |
+
|
| 1069 |
+
|
| 1070 |
+
def metadata(distribution_name: str) -> _meta.PackageMetadata | None:
|
| 1071 |
+
"""Get the metadata for the named package.
|
| 1072 |
+
|
| 1073 |
+
:param distribution_name: The name of the distribution package to query.
|
| 1074 |
+
:return: A PackageMetadata containing the parsed metadata.
|
| 1075 |
+
"""
|
| 1076 |
+
return Distribution.from_name(distribution_name).metadata
|
| 1077 |
+
|
| 1078 |
+
|
| 1079 |
+
def version(distribution_name: str) -> str:
|
| 1080 |
+
"""Get the version string for the named package.
|
| 1081 |
+
|
| 1082 |
+
:param distribution_name: The name of the distribution package to query.
|
| 1083 |
+
:return: The version string for the package as defined in the package's
|
| 1084 |
+
"Version" metadata key.
|
| 1085 |
+
"""
|
| 1086 |
+
return distribution(distribution_name).version
|
| 1087 |
+
|
| 1088 |
+
|
| 1089 |
+
_unique = functools.partial(
|
| 1090 |
+
unique_everseen,
|
| 1091 |
+
key=py39.normalized_name,
|
| 1092 |
+
)
|
| 1093 |
+
"""
|
| 1094 |
+
Wrapper for ``distributions`` to return unique distributions by name.
|
| 1095 |
+
"""
|
| 1096 |
+
|
| 1097 |
+
|
| 1098 |
+
def entry_points(**params) -> EntryPoints:
|
| 1099 |
+
"""Return EntryPoint objects for all installed packages.
|
| 1100 |
+
|
| 1101 |
+
Pass selection parameters (group or name) to filter the
|
| 1102 |
+
result to entry points matching those properties (see
|
| 1103 |
+
EntryPoints.select()).
|
| 1104 |
+
|
| 1105 |
+
:return: EntryPoints for all installed packages.
|
| 1106 |
+
"""
|
| 1107 |
+
eps = itertools.chain.from_iterable(
|
| 1108 |
+
dist.entry_points for dist in _unique(distributions())
|
| 1109 |
+
)
|
| 1110 |
+
return EntryPoints(eps).select(**params)
|
| 1111 |
+
|
| 1112 |
+
|
| 1113 |
+
def files(distribution_name: str) -> list[PackagePath] | None:
|
| 1114 |
+
"""Return a list of files for the named package.
|
| 1115 |
+
|
| 1116 |
+
:param distribution_name: The name of the distribution package to query.
|
| 1117 |
+
:return: List of files composing the distribution.
|
| 1118 |
+
"""
|
| 1119 |
+
return distribution(distribution_name).files
|
| 1120 |
+
|
| 1121 |
+
|
| 1122 |
+
def requires(distribution_name: str) -> list[str] | None:
|
| 1123 |
+
"""
|
| 1124 |
+
Return a list of requirements for the named package.
|
| 1125 |
+
|
| 1126 |
+
:return: An iterable of requirements, suitable for
|
| 1127 |
+
packaging.requirement.Requirement.
|
| 1128 |
+
"""
|
| 1129 |
+
return distribution(distribution_name).requires
|
| 1130 |
+
|
| 1131 |
+
|
| 1132 |
+
def packages_distributions() -> Mapping[str, list[str]]:
|
| 1133 |
+
"""
|
| 1134 |
+
Return a mapping of top-level packages to their
|
| 1135 |
+
distributions.
|
| 1136 |
+
|
| 1137 |
+
>>> import collections.abc
|
| 1138 |
+
>>> pkgs = packages_distributions()
|
| 1139 |
+
>>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
|
| 1140 |
+
True
|
| 1141 |
+
"""
|
| 1142 |
+
pkg_to_dist = collections.defaultdict(list)
|
| 1143 |
+
for dist in distributions():
|
| 1144 |
+
for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
|
| 1145 |
+
pkg_to_dist[pkg].append(md_none(dist.metadata)['Name'])
|
| 1146 |
+
return dict(pkg_to_dist)
|
| 1147 |
+
|
| 1148 |
+
|
| 1149 |
+
def _top_level_declared(dist):
|
| 1150 |
+
return (dist.read_text('top_level.txt') or '').split()
|
| 1151 |
+
|
| 1152 |
+
|
| 1153 |
+
def _topmost(name: PackagePath) -> str | None:
|
| 1154 |
+
"""
|
| 1155 |
+
Return the top-most parent as long as there is a parent.
|
| 1156 |
+
"""
|
| 1157 |
+
top, *rest = name.parts
|
| 1158 |
+
return top if rest else None
|
| 1159 |
+
|
| 1160 |
+
|
| 1161 |
+
def _get_toplevel_name(name: PackagePath) -> str:
|
| 1162 |
+
"""
|
| 1163 |
+
Infer a possibly importable module name from a name presumed on
|
| 1164 |
+
sys.path.
|
| 1165 |
+
|
| 1166 |
+
>>> _get_toplevel_name(PackagePath('foo.py'))
|
| 1167 |
+
'foo'
|
| 1168 |
+
>>> _get_toplevel_name(PackagePath('foo'))
|
| 1169 |
+
'foo'
|
| 1170 |
+
>>> _get_toplevel_name(PackagePath('foo.pyc'))
|
| 1171 |
+
'foo'
|
| 1172 |
+
>>> _get_toplevel_name(PackagePath('foo/__init__.py'))
|
| 1173 |
+
'foo'
|
| 1174 |
+
>>> _get_toplevel_name(PackagePath('foo.pth'))
|
| 1175 |
+
'foo.pth'
|
| 1176 |
+
>>> _get_toplevel_name(PackagePath('foo.dist-info'))
|
| 1177 |
+
'foo.dist-info'
|
| 1178 |
+
"""
|
| 1179 |
+
# Defer import of inspect for performance (python/cpython#118761)
|
| 1180 |
+
import inspect
|
| 1181 |
+
|
| 1182 |
+
return _topmost(name) or inspect.getmodulename(name) or str(name)
|
| 1183 |
+
|
| 1184 |
+
|
| 1185 |
+
def _top_level_inferred(dist):
|
| 1186 |
+
opt_names = set(map(_get_toplevel_name, always_iterable(dist.files)))
|
| 1187 |
+
|
| 1188 |
+
def importable_name(name):
|
| 1189 |
+
return '.' not in name
|
| 1190 |
+
|
| 1191 |
+
return filter(importable_name, opt_names)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import email.message
|
| 2 |
+
import email.policy
|
| 3 |
+
import re
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
from ._text import FoldedCase
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class RawPolicy(email.policy.EmailPolicy):
|
| 10 |
+
def fold(self, name, value):
|
| 11 |
+
folded = self.linesep.join(
|
| 12 |
+
textwrap
|
| 13 |
+
.indent(value, prefix=' ' * 8, predicate=lambda line: True)
|
| 14 |
+
.lstrip()
|
| 15 |
+
.splitlines()
|
| 16 |
+
)
|
| 17 |
+
return f'{name}: {folded}{self.linesep}'
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class Message(email.message.Message):
|
| 21 |
+
r"""
|
| 22 |
+
Specialized Message subclass to handle metadata naturally.
|
| 23 |
+
|
| 24 |
+
Reads values that may have newlines in them and converts the
|
| 25 |
+
payload to the Description.
|
| 26 |
+
|
| 27 |
+
>>> msg_text = textwrap.dedent('''
|
| 28 |
+
... Name: Foo
|
| 29 |
+
... Version: 3.0
|
| 30 |
+
... License: blah
|
| 31 |
+
... de-blah
|
| 32 |
+
... <BLANKLINE>
|
| 33 |
+
... First line of description.
|
| 34 |
+
... Second line of description.
|
| 35 |
+
... <BLANKLINE>
|
| 36 |
+
... Fourth line!
|
| 37 |
+
... ''').lstrip().replace('<BLANKLINE>', '')
|
| 38 |
+
>>> msg = Message(email.message_from_string(msg_text))
|
| 39 |
+
>>> msg['Description']
|
| 40 |
+
'First line of description.\nSecond line of description.\n\nFourth line!\n'
|
| 41 |
+
|
| 42 |
+
Message should render even if values contain newlines.
|
| 43 |
+
|
| 44 |
+
>>> print(msg)
|
| 45 |
+
Name: Foo
|
| 46 |
+
Version: 3.0
|
| 47 |
+
License: blah
|
| 48 |
+
de-blah
|
| 49 |
+
Description: First line of description.
|
| 50 |
+
Second line of description.
|
| 51 |
+
<BLANKLINE>
|
| 52 |
+
Fourth line!
|
| 53 |
+
<BLANKLINE>
|
| 54 |
+
<BLANKLINE>
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
multiple_use_keys = set(
|
| 58 |
+
map(
|
| 59 |
+
FoldedCase,
|
| 60 |
+
[
|
| 61 |
+
'Classifier',
|
| 62 |
+
'Obsoletes-Dist',
|
| 63 |
+
'Platform',
|
| 64 |
+
'Project-URL',
|
| 65 |
+
'Provides-Dist',
|
| 66 |
+
'Provides-Extra',
|
| 67 |
+
'Requires-Dist',
|
| 68 |
+
'Requires-External',
|
| 69 |
+
'Supported-Platform',
|
| 70 |
+
'Dynamic',
|
| 71 |
+
],
|
| 72 |
+
)
|
| 73 |
+
)
|
| 74 |
+
"""
|
| 75 |
+
Keys that may be indicated multiple times per PEP 566.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
def __new__(cls, orig: email.message.Message):
|
| 79 |
+
res = super().__new__(cls)
|
| 80 |
+
vars(res).update(vars(orig))
|
| 81 |
+
return res
|
| 82 |
+
|
| 83 |
+
def __init__(self, *args, **kwargs):
|
| 84 |
+
self._headers = self._repair_headers()
|
| 85 |
+
|
| 86 |
+
# suppress spurious error from mypy
|
| 87 |
+
def __iter__(self):
|
| 88 |
+
return super().__iter__()
|
| 89 |
+
|
| 90 |
+
def __getitem__(self, item):
|
| 91 |
+
"""
|
| 92 |
+
Override parent behavior to typical dict behavior.
|
| 93 |
+
|
| 94 |
+
``email.message.Message`` will emit None values for missing
|
| 95 |
+
keys. Typical mappings, including this ``Message``, will raise
|
| 96 |
+
a key error for missing keys.
|
| 97 |
+
|
| 98 |
+
Ref python/importlib_metadata#371.
|
| 99 |
+
"""
|
| 100 |
+
res = super().__getitem__(item)
|
| 101 |
+
if res is None:
|
| 102 |
+
raise KeyError(item)
|
| 103 |
+
return res
|
| 104 |
+
|
| 105 |
+
def _repair_headers(self):
|
| 106 |
+
def redent(value):
|
| 107 |
+
"Correct for RFC822 indentation"
|
| 108 |
+
indent = ' ' * 8
|
| 109 |
+
if not value or '\n' + indent not in value:
|
| 110 |
+
return value
|
| 111 |
+
return textwrap.dedent(indent + value)
|
| 112 |
+
|
| 113 |
+
headers = [(key, redent(value)) for key, value in vars(self)['_headers']]
|
| 114 |
+
if self._payload:
|
| 115 |
+
headers.append(('Description', self.get_payload()))
|
| 116 |
+
self.set_payload('')
|
| 117 |
+
return headers
|
| 118 |
+
|
| 119 |
+
def as_string(self):
|
| 120 |
+
return super().as_string(policy=RawPolicy())
|
| 121 |
+
|
| 122 |
+
@property
|
| 123 |
+
def json(self):
|
| 124 |
+
"""
|
| 125 |
+
Convert PackageMetadata to a JSON-compatible format
|
| 126 |
+
per PEP 0566.
|
| 127 |
+
"""
|
| 128 |
+
|
| 129 |
+
def transform(key):
|
| 130 |
+
value = self.get_all(key) if key in self.multiple_use_keys else self[key]
|
| 131 |
+
if key == 'Keywords':
|
| 132 |
+
value = re.split(r'\s+', value)
|
| 133 |
+
tk = key.lower().replace('-', '_')
|
| 134 |
+
return tk, value
|
| 135 |
+
|
| 136 |
+
return dict(map(transform, map(FoldedCase, self)))
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import collections
|
| 2 |
+
import typing
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# from jaraco.collections 3.3
|
| 6 |
+
class FreezableDefaultDict(collections.defaultdict):
|
| 7 |
+
"""
|
| 8 |
+
Often it is desirable to prevent the mutation of
|
| 9 |
+
a default dict after its initial construction, such
|
| 10 |
+
as to prevent mutation during iteration.
|
| 11 |
+
|
| 12 |
+
>>> dd = FreezableDefaultDict(list)
|
| 13 |
+
>>> dd[0].append('1')
|
| 14 |
+
>>> dd.freeze()
|
| 15 |
+
>>> dd[1]
|
| 16 |
+
[]
|
| 17 |
+
>>> len(dd)
|
| 18 |
+
1
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
def __missing__(self, key):
|
| 22 |
+
return getattr(self, '_frozen', super().__missing__)(key)
|
| 23 |
+
|
| 24 |
+
def freeze(self):
|
| 25 |
+
self._frozen = lambda key: self.default_factory()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class Pair(typing.NamedTuple):
|
| 29 |
+
name: str
|
| 30 |
+
value: str
|
| 31 |
+
|
| 32 |
+
@classmethod
|
| 33 |
+
def parse(cls, text):
|
| 34 |
+
return cls(*map(str.strip, text.split("=", 1)))
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import platform
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
__all__ = ['install', 'NullFinder']
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def install(cls):
|
| 8 |
+
"""
|
| 9 |
+
Class decorator for installation on sys.meta_path.
|
| 10 |
+
|
| 11 |
+
Adds the backport DistributionFinder to sys.meta_path and
|
| 12 |
+
attempts to disable the finder functionality of the stdlib
|
| 13 |
+
DistributionFinder.
|
| 14 |
+
"""
|
| 15 |
+
sys.meta_path.append(cls())
|
| 16 |
+
disable_stdlib_finder()
|
| 17 |
+
return cls
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def disable_stdlib_finder():
|
| 21 |
+
"""
|
| 22 |
+
Give the backport primacy for discovering path-based distributions
|
| 23 |
+
by monkey-patching the stdlib O_O.
|
| 24 |
+
|
| 25 |
+
See #91 for more background for rationale on this sketchy
|
| 26 |
+
behavior.
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
def matches(finder):
|
| 30 |
+
return getattr(
|
| 31 |
+
finder, '__module__', None
|
| 32 |
+
) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions')
|
| 33 |
+
|
| 34 |
+
for finder in filter(matches, sys.meta_path): # pragma: nocover
|
| 35 |
+
del finder.find_distributions
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class NullFinder:
|
| 39 |
+
"""
|
| 40 |
+
A "Finder" (aka "MetaPathFinder") that never finds any modules,
|
| 41 |
+
but may find distributions.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
@staticmethod
|
| 45 |
+
def find_spec(*args, **kwargs):
|
| 46 |
+
return None
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def pypy_partial(val):
|
| 50 |
+
"""
|
| 51 |
+
Adjust for variable stacklevel on partial under PyPy.
|
| 52 |
+
|
| 53 |
+
Workaround for #327.
|
| 54 |
+
"""
|
| 55 |
+
is_pypy = platform.python_implementation() == 'PyPy'
|
| 56 |
+
return val + is_pypy
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import types
|
| 3 |
+
from typing import Callable, TypeVar
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# from jaraco.functools 3.3
|
| 7 |
+
def method_cache(method, cache_wrapper=None):
|
| 8 |
+
"""
|
| 9 |
+
Wrap lru_cache to support storing the cache data in the object instances.
|
| 10 |
+
|
| 11 |
+
Abstracts the common paradigm where the method explicitly saves an
|
| 12 |
+
underscore-prefixed protected property on first call and returns that
|
| 13 |
+
subsequently.
|
| 14 |
+
|
| 15 |
+
>>> class MyClass:
|
| 16 |
+
... calls = 0
|
| 17 |
+
...
|
| 18 |
+
... @method_cache
|
| 19 |
+
... def method(self, value):
|
| 20 |
+
... self.calls += 1
|
| 21 |
+
... return value
|
| 22 |
+
|
| 23 |
+
>>> a = MyClass()
|
| 24 |
+
>>> a.method(3)
|
| 25 |
+
3
|
| 26 |
+
>>> for x in range(75):
|
| 27 |
+
... res = a.method(x)
|
| 28 |
+
>>> a.calls
|
| 29 |
+
75
|
| 30 |
+
|
| 31 |
+
Note that the apparent behavior will be exactly like that of lru_cache
|
| 32 |
+
except that the cache is stored on each instance, so values in one
|
| 33 |
+
instance will not flush values from another, and when an instance is
|
| 34 |
+
deleted, so are the cached values for that instance.
|
| 35 |
+
|
| 36 |
+
>>> b = MyClass()
|
| 37 |
+
>>> for x in range(35):
|
| 38 |
+
... res = b.method(x)
|
| 39 |
+
>>> b.calls
|
| 40 |
+
35
|
| 41 |
+
>>> a.method(0)
|
| 42 |
+
0
|
| 43 |
+
>>> a.calls
|
| 44 |
+
75
|
| 45 |
+
|
| 46 |
+
Note that if method had been decorated with ``functools.lru_cache()``,
|
| 47 |
+
a.calls would have been 76 (due to the cached value of 0 having been
|
| 48 |
+
flushed by the 'b' instance).
|
| 49 |
+
|
| 50 |
+
Clear the cache with ``.cache_clear()``
|
| 51 |
+
|
| 52 |
+
>>> a.method.cache_clear()
|
| 53 |
+
|
| 54 |
+
Same for a method that hasn't yet been called.
|
| 55 |
+
|
| 56 |
+
>>> c = MyClass()
|
| 57 |
+
>>> c.method.cache_clear()
|
| 58 |
+
|
| 59 |
+
Another cache wrapper may be supplied:
|
| 60 |
+
|
| 61 |
+
>>> cache = functools.lru_cache(maxsize=2)
|
| 62 |
+
>>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
|
| 63 |
+
>>> a = MyClass()
|
| 64 |
+
>>> a.method2()
|
| 65 |
+
3
|
| 66 |
+
|
| 67 |
+
Caution - do not subsequently wrap the method with another decorator, such
|
| 68 |
+
as ``@property``, which changes the semantics of the function.
|
| 69 |
+
|
| 70 |
+
See also
|
| 71 |
+
http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
|
| 72 |
+
for another implementation and additional justification.
|
| 73 |
+
"""
|
| 74 |
+
cache_wrapper = cache_wrapper or functools.lru_cache()
|
| 75 |
+
|
| 76 |
+
def wrapper(self, *args, **kwargs):
|
| 77 |
+
# it's the first call, replace the method with a cached, bound method
|
| 78 |
+
bound_method = types.MethodType(method, self)
|
| 79 |
+
cached_method = cache_wrapper(bound_method)
|
| 80 |
+
setattr(self, method.__name__, cached_method)
|
| 81 |
+
return cached_method(*args, **kwargs)
|
| 82 |
+
|
| 83 |
+
# Support cache clear even before cache has been created.
|
| 84 |
+
wrapper.cache_clear = lambda: None
|
| 85 |
+
|
| 86 |
+
return wrapper
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
# From jaraco.functools 3.3
|
| 90 |
+
def pass_none(func):
|
| 91 |
+
"""
|
| 92 |
+
Wrap func so it's not called if its first param is None
|
| 93 |
+
|
| 94 |
+
>>> print_text = pass_none(print)
|
| 95 |
+
>>> print_text('text')
|
| 96 |
+
text
|
| 97 |
+
>>> print_text(None)
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
@functools.wraps(func)
|
| 101 |
+
def wrapper(param, *args, **kwargs):
|
| 102 |
+
if param is not None:
|
| 103 |
+
return func(param, *args, **kwargs)
|
| 104 |
+
|
| 105 |
+
return wrapper
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
# From jaraco.functools 4.4
|
| 109 |
+
def noop(*args, **kwargs):
|
| 110 |
+
"""
|
| 111 |
+
A no-operation function that does nothing.
|
| 112 |
+
|
| 113 |
+
>>> noop(1, 2, three=3)
|
| 114 |
+
"""
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
_T = TypeVar('_T')
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
# From jaraco.functools 4.4
|
| 121 |
+
def passthrough(func: Callable[..., object]) -> Callable[[_T], _T]:
|
| 122 |
+
"""
|
| 123 |
+
Wrap the function to always return the first parameter.
|
| 124 |
+
|
| 125 |
+
>>> passthrough(print)('3')
|
| 126 |
+
3
|
| 127 |
+
'3'
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
@functools.wraps(func)
|
| 131 |
+
def wrapper(first: _T, *args, **kwargs) -> _T:
|
| 132 |
+
func(first, *args, **kwargs)
|
| 133 |
+
return first
|
| 134 |
+
|
| 135 |
+
return wrapper # type: ignore[return-value]
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import defaultdict, deque
|
| 2 |
+
from itertools import filterfalse
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def unique_everseen(iterable, key=None):
|
| 6 |
+
"List unique elements, preserving order. Remember all elements ever seen."
|
| 7 |
+
# unique_everseen('AAAABBBCCDAABBB') --> A B C D
|
| 8 |
+
# unique_everseen('ABBCcAD', str.lower) --> A B C D
|
| 9 |
+
seen = set()
|
| 10 |
+
seen_add = seen.add
|
| 11 |
+
if key is None:
|
| 12 |
+
for element in filterfalse(seen.__contains__, iterable):
|
| 13 |
+
seen_add(element)
|
| 14 |
+
yield element
|
| 15 |
+
else:
|
| 16 |
+
for element in iterable:
|
| 17 |
+
k = key(element)
|
| 18 |
+
if k not in seen:
|
| 19 |
+
seen_add(k)
|
| 20 |
+
yield element
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# copied from more_itertools 8.8
|
| 24 |
+
def always_iterable(obj, base_type=(str, bytes)):
|
| 25 |
+
"""If *obj* is iterable, return an iterator over its items::
|
| 26 |
+
|
| 27 |
+
>>> obj = (1, 2, 3)
|
| 28 |
+
>>> list(always_iterable(obj))
|
| 29 |
+
[1, 2, 3]
|
| 30 |
+
|
| 31 |
+
If *obj* is not iterable, return a one-item iterable containing *obj*::
|
| 32 |
+
|
| 33 |
+
>>> obj = 1
|
| 34 |
+
>>> list(always_iterable(obj))
|
| 35 |
+
[1]
|
| 36 |
+
|
| 37 |
+
If *obj* is ``None``, return an empty iterable:
|
| 38 |
+
|
| 39 |
+
>>> obj = None
|
| 40 |
+
>>> list(always_iterable(None))
|
| 41 |
+
[]
|
| 42 |
+
|
| 43 |
+
By default, binary and text strings are not considered iterable::
|
| 44 |
+
|
| 45 |
+
>>> obj = 'foo'
|
| 46 |
+
>>> list(always_iterable(obj))
|
| 47 |
+
['foo']
|
| 48 |
+
|
| 49 |
+
If *base_type* is set, objects for which ``isinstance(obj, base_type)``
|
| 50 |
+
returns ``True`` won't be considered iterable.
|
| 51 |
+
|
| 52 |
+
>>> obj = {'a': 1}
|
| 53 |
+
>>> list(always_iterable(obj)) # Iterate over the dict's keys
|
| 54 |
+
['a']
|
| 55 |
+
>>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
|
| 56 |
+
[{'a': 1}]
|
| 57 |
+
|
| 58 |
+
Set *base_type* to ``None`` to avoid any special handling and treat objects
|
| 59 |
+
Python considers iterable as iterable:
|
| 60 |
+
|
| 61 |
+
>>> obj = 'foo'
|
| 62 |
+
>>> list(always_iterable(obj, base_type=None))
|
| 63 |
+
['f', 'o', 'o']
|
| 64 |
+
"""
|
| 65 |
+
if obj is None:
|
| 66 |
+
return iter(())
|
| 67 |
+
|
| 68 |
+
if (base_type is not None) and isinstance(obj, base_type):
|
| 69 |
+
return iter((obj,))
|
| 70 |
+
|
| 71 |
+
try:
|
| 72 |
+
return iter(obj)
|
| 73 |
+
except TypeError:
|
| 74 |
+
return iter((obj,))
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
# Copied from more_itertools 10.3
|
| 78 |
+
class bucket:
|
| 79 |
+
"""Wrap *iterable* and return an object that buckets the iterable into
|
| 80 |
+
child iterables based on a *key* function.
|
| 81 |
+
|
| 82 |
+
>>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3']
|
| 83 |
+
>>> s = bucket(iterable, key=lambda x: x[0]) # Bucket by 1st character
|
| 84 |
+
>>> sorted(list(s)) # Get the keys
|
| 85 |
+
['a', 'b', 'c']
|
| 86 |
+
>>> a_iterable = s['a']
|
| 87 |
+
>>> next(a_iterable)
|
| 88 |
+
'a1'
|
| 89 |
+
>>> next(a_iterable)
|
| 90 |
+
'a2'
|
| 91 |
+
>>> list(s['b'])
|
| 92 |
+
['b1', 'b2', 'b3']
|
| 93 |
+
|
| 94 |
+
The original iterable will be advanced and its items will be cached until
|
| 95 |
+
they are used by the child iterables. This may require significant storage.
|
| 96 |
+
|
| 97 |
+
By default, attempting to select a bucket to which no items belong will
|
| 98 |
+
exhaust the iterable and cache all values.
|
| 99 |
+
If you specify a *validator* function, selected buckets will instead be
|
| 100 |
+
checked against it.
|
| 101 |
+
|
| 102 |
+
>>> from itertools import count
|
| 103 |
+
>>> it = count(1, 2) # Infinite sequence of odd numbers
|
| 104 |
+
>>> key = lambda x: x % 10 # Bucket by last digit
|
| 105 |
+
>>> validator = lambda x: x in {1, 3, 5, 7, 9} # Odd digits only
|
| 106 |
+
>>> s = bucket(it, key=key, validator=validator)
|
| 107 |
+
>>> 2 in s
|
| 108 |
+
False
|
| 109 |
+
>>> list(s[2])
|
| 110 |
+
[]
|
| 111 |
+
|
| 112 |
+
"""
|
| 113 |
+
|
| 114 |
+
def __init__(self, iterable, key, validator=None):
|
| 115 |
+
self._it = iter(iterable)
|
| 116 |
+
self._key = key
|
| 117 |
+
self._cache = defaultdict(deque)
|
| 118 |
+
self._validator = validator or (lambda x: True)
|
| 119 |
+
|
| 120 |
+
def __contains__(self, value):
|
| 121 |
+
if not self._validator(value):
|
| 122 |
+
return False
|
| 123 |
+
|
| 124 |
+
try:
|
| 125 |
+
item = next(self[value])
|
| 126 |
+
except StopIteration:
|
| 127 |
+
return False
|
| 128 |
+
else:
|
| 129 |
+
self._cache[value].appendleft(item)
|
| 130 |
+
|
| 131 |
+
return True
|
| 132 |
+
|
| 133 |
+
def _get_values(self, value):
|
| 134 |
+
"""
|
| 135 |
+
Helper to yield items from the parent iterator that match *value*.
|
| 136 |
+
Items that don't match are stored in the local cache as they
|
| 137 |
+
are encountered.
|
| 138 |
+
"""
|
| 139 |
+
while True:
|
| 140 |
+
# If we've cached some items that match the target value, emit
|
| 141 |
+
# the first one and evict it from the cache.
|
| 142 |
+
if self._cache[value]:
|
| 143 |
+
yield self._cache[value].popleft()
|
| 144 |
+
# Otherwise we need to advance the parent iterator to search for
|
| 145 |
+
# a matching item, caching the rest.
|
| 146 |
+
else:
|
| 147 |
+
while True:
|
| 148 |
+
try:
|
| 149 |
+
item = next(self._it)
|
| 150 |
+
except StopIteration:
|
| 151 |
+
return
|
| 152 |
+
item_value = self._key(item)
|
| 153 |
+
if item_value == value:
|
| 154 |
+
yield item
|
| 155 |
+
break
|
| 156 |
+
elif self._validator(item_value):
|
| 157 |
+
self._cache[item_value].append(item)
|
| 158 |
+
|
| 159 |
+
def __iter__(self):
|
| 160 |
+
for item in self._it:
|
| 161 |
+
item_value = self._key(item)
|
| 162 |
+
if self._validator(item_value):
|
| 163 |
+
self._cache[item_value].append(item)
|
| 164 |
+
|
| 165 |
+
yield from self._cache.keys()
|
| 166 |
+
|
| 167 |
+
def __getitem__(self, value):
|
| 168 |
+
if not self._validator(value):
|
| 169 |
+
return iter(())
|
| 170 |
+
|
| 171 |
+
return self._get_values(value)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from collections.abc import Iterator
|
| 5 |
+
from typing import (
|
| 6 |
+
Any,
|
| 7 |
+
Protocol,
|
| 8 |
+
TypeVar,
|
| 9 |
+
overload,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
_T = TypeVar("_T")
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class PackageMetadata(Protocol):
|
| 16 |
+
def __len__(self) -> int: ... # pragma: no cover
|
| 17 |
+
|
| 18 |
+
def __contains__(self, item: str) -> bool: ... # pragma: no cover
|
| 19 |
+
|
| 20 |
+
def __getitem__(self, key: str) -> str: ... # pragma: no cover
|
| 21 |
+
|
| 22 |
+
def __iter__(self) -> Iterator[str]: ... # pragma: no cover
|
| 23 |
+
|
| 24 |
+
@overload
|
| 25 |
+
def get(
|
| 26 |
+
self, name: str, failobj: None = None
|
| 27 |
+
) -> str | None: ... # pragma: no cover
|
| 28 |
+
|
| 29 |
+
@overload
|
| 30 |
+
def get(self, name: str, failobj: _T) -> str | _T: ... # pragma: no cover
|
| 31 |
+
|
| 32 |
+
# overload per python/importlib_metadata#435
|
| 33 |
+
@overload
|
| 34 |
+
def get_all(
|
| 35 |
+
self, name: str, failobj: None = None
|
| 36 |
+
) -> list[Any] | None: ... # pragma: no cover
|
| 37 |
+
|
| 38 |
+
@overload
|
| 39 |
+
def get_all(self, name: str, failobj: _T) -> list[Any] | _T:
|
| 40 |
+
"""
|
| 41 |
+
Return all values associated with a possibly multi-valued key.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
@property
|
| 45 |
+
def json(self) -> dict[str, str | list[str]]:
|
| 46 |
+
"""
|
| 47 |
+
A JSON-compatible form of the metadata.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class SimplePath(Protocol):
|
| 52 |
+
"""
|
| 53 |
+
A minimal subset of pathlib.Path required by Distribution.
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
def joinpath(
|
| 57 |
+
self, other: str | os.PathLike[str]
|
| 58 |
+
) -> SimplePath: ... # pragma: no cover
|
| 59 |
+
|
| 60 |
+
def __truediv__(
|
| 61 |
+
self, other: str | os.PathLike[str]
|
| 62 |
+
) -> SimplePath: ... # pragma: no cover
|
| 63 |
+
|
| 64 |
+
@property
|
| 65 |
+
def parent(self) -> SimplePath: ... # pragma: no cover
|
| 66 |
+
|
| 67 |
+
def read_text(self, encoding=None) -> str: ... # pragma: no cover
|
| 68 |
+
|
| 69 |
+
def read_bytes(self) -> bytes: ... # pragma: no cover
|
| 70 |
+
|
| 71 |
+
def exists(self) -> bool: ... # pragma: no cover
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
|
| 3 |
+
from ._functools import method_cache
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# from jaraco.text 3.5
|
| 7 |
+
class FoldedCase(str):
|
| 8 |
+
"""
|
| 9 |
+
A case insensitive string class; behaves just like str
|
| 10 |
+
except compares equal when the only variation is case.
|
| 11 |
+
|
| 12 |
+
>>> s = FoldedCase('hello world')
|
| 13 |
+
|
| 14 |
+
>>> s == 'Hello World'
|
| 15 |
+
True
|
| 16 |
+
|
| 17 |
+
>>> 'Hello World' == s
|
| 18 |
+
True
|
| 19 |
+
|
| 20 |
+
>>> s != 'Hello World'
|
| 21 |
+
False
|
| 22 |
+
|
| 23 |
+
>>> s.index('O')
|
| 24 |
+
4
|
| 25 |
+
|
| 26 |
+
>>> s.split('O')
|
| 27 |
+
['hell', ' w', 'rld']
|
| 28 |
+
|
| 29 |
+
>>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
|
| 30 |
+
['alpha', 'Beta', 'GAMMA']
|
| 31 |
+
|
| 32 |
+
Sequence membership is straightforward.
|
| 33 |
+
|
| 34 |
+
>>> "Hello World" in [s]
|
| 35 |
+
True
|
| 36 |
+
>>> s in ["Hello World"]
|
| 37 |
+
True
|
| 38 |
+
|
| 39 |
+
You may test for set inclusion, but candidate and elements
|
| 40 |
+
must both be folded.
|
| 41 |
+
|
| 42 |
+
>>> FoldedCase("Hello World") in {s}
|
| 43 |
+
True
|
| 44 |
+
>>> s in {FoldedCase("Hello World")}
|
| 45 |
+
True
|
| 46 |
+
|
| 47 |
+
String inclusion works as long as the FoldedCase object
|
| 48 |
+
is on the right.
|
| 49 |
+
|
| 50 |
+
>>> "hello" in FoldedCase("Hello World")
|
| 51 |
+
True
|
| 52 |
+
|
| 53 |
+
But not if the FoldedCase object is on the left:
|
| 54 |
+
|
| 55 |
+
>>> FoldedCase('hello') in 'Hello World'
|
| 56 |
+
False
|
| 57 |
+
|
| 58 |
+
In that case, use in_:
|
| 59 |
+
|
| 60 |
+
>>> FoldedCase('hello').in_('Hello World')
|
| 61 |
+
True
|
| 62 |
+
|
| 63 |
+
>>> FoldedCase('hello') > FoldedCase('Hello')
|
| 64 |
+
False
|
| 65 |
+
"""
|
| 66 |
+
|
| 67 |
+
def __lt__(self, other):
|
| 68 |
+
return self.lower() < other.lower()
|
| 69 |
+
|
| 70 |
+
def __gt__(self, other):
|
| 71 |
+
return self.lower() > other.lower()
|
| 72 |
+
|
| 73 |
+
def __eq__(self, other):
|
| 74 |
+
return self.lower() == other.lower()
|
| 75 |
+
|
| 76 |
+
def __ne__(self, other):
|
| 77 |
+
return self.lower() != other.lower()
|
| 78 |
+
|
| 79 |
+
def __hash__(self):
|
| 80 |
+
return hash(self.lower())
|
| 81 |
+
|
| 82 |
+
def __contains__(self, other):
|
| 83 |
+
return super().lower().__contains__(other.lower())
|
| 84 |
+
|
| 85 |
+
def in_(self, other):
|
| 86 |
+
"Does self appear in other?"
|
| 87 |
+
return self in FoldedCase(other)
|
| 88 |
+
|
| 89 |
+
# cache lower since it's likely to be called frequently.
|
| 90 |
+
@method_cache
|
| 91 |
+
def lower(self):
|
| 92 |
+
return super().lower()
|
| 93 |
+
|
| 94 |
+
def index(self, sub):
|
| 95 |
+
return self.lower().index(sub.lower())
|
| 96 |
+
|
| 97 |
+
def split(self, splitter=' ', maxsplit=0):
|
| 98 |
+
pattern = re.compile(re.escape(splitter), re.I)
|
| 99 |
+
return pattern.split(self, maxsplit)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_typing.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import typing
|
| 3 |
+
|
| 4 |
+
from ._meta import PackageMetadata
|
| 5 |
+
|
| 6 |
+
md_none = functools.partial(typing.cast, PackageMetadata)
|
| 7 |
+
"""
|
| 8 |
+
Suppress type errors for optional metadata.
|
| 9 |
+
|
| 10 |
+
Although Distribution.metadata can return None when metadata is corrupt
|
| 11 |
+
and thus None, allow callers to assume it's not None and crash if
|
| 12 |
+
that's the case.
|
| 13 |
+
|
| 14 |
+
# python/importlib_metadata#493
|
| 15 |
+
"""
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pathlib
|
| 3 |
+
import sys
|
| 4 |
+
import types
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def wrap(path): # pragma: no cover
|
| 8 |
+
"""
|
| 9 |
+
Workaround for https://github.com/python/cpython/issues/84538
|
| 10 |
+
to add backward compatibility for walk_up=True.
|
| 11 |
+
An example affected package is dask-labextension, which uses
|
| 12 |
+
jupyter-packaging to install JupyterLab javascript files outside
|
| 13 |
+
of site-packages.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
def relative_to(root, *, walk_up=False):
|
| 17 |
+
return pathlib.Path(os.path.relpath(path, root))
|
| 18 |
+
|
| 19 |
+
return types.SimpleNamespace(relative_to=relative_to)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Compatibility layer with Python 3.8/3.9
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from typing import TYPE_CHECKING, Any
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING: # pragma: no cover
|
| 10 |
+
# Prevent circular imports on runtime.
|
| 11 |
+
from .. import Distribution, EntryPoint
|
| 12 |
+
else:
|
| 13 |
+
Distribution = EntryPoint = Any
|
| 14 |
+
|
| 15 |
+
from .._typing import md_none
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def normalized_name(dist: Distribution) -> str | None:
|
| 19 |
+
"""
|
| 20 |
+
Honor name normalization for distributions that don't provide ``_normalized_name``.
|
| 21 |
+
"""
|
| 22 |
+
try:
|
| 23 |
+
return dist._normalized_name
|
| 24 |
+
except AttributeError:
|
| 25 |
+
from .. import Prepared # -> delay to prevent circular imports.
|
| 26 |
+
|
| 27 |
+
return Prepared.normalize(
|
| 28 |
+
getattr(dist, "name", None) or md_none(dist.metadata)['Name']
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def ep_matches(ep: EntryPoint, **params) -> bool:
|
| 33 |
+
"""
|
| 34 |
+
Workaround for ``EntryPoint`` objects without the ``matches`` method.
|
| 35 |
+
"""
|
| 36 |
+
try:
|
| 37 |
+
return ep.matches(**params)
|
| 38 |
+
except AttributeError:
|
| 39 |
+
from .. import EntryPoint # -> delay to prevent circular imports.
|
| 40 |
+
|
| 41 |
+
# Reconstruct the EntryPoint object to make sure it is compatible.
|
| 42 |
+
return EntryPoint(ep.name, ep.value, ep.group).matches(**params)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
from . import Distribution
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def inspect(path):
|
| 7 |
+
print("Inspecting", path)
|
| 8 |
+
dists = list(Distribution.discover(path=[path]))
|
| 9 |
+
if not dists:
|
| 10 |
+
return
|
| 11 |
+
print("Found", len(dists), "packages:", end=' ')
|
| 12 |
+
print(', '.join(dist.name for dist in dists))
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def run():
|
| 16 |
+
for path in sys.path:
|
| 17 |
+
inspect(path)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if __name__ == '__main__':
|
| 21 |
+
run()
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
conda
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 2 |
+
of this software and associated documentation files (the "Software"), to
|
| 3 |
+
deal in the Software without restriction, including without limitation the
|
| 4 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 5 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 6 |
+
furnished to do so, subject to the following conditions:
|
| 7 |
+
|
| 8 |
+
The above copyright notice and this permission notice shall be included in
|
| 9 |
+
all copies or substantial portions of the Software.
|
| 10 |
+
|
| 11 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 12 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 13 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 14 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 15 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 16 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| 17 |
+
IN THE SOFTWARE.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: jaraco.text
|
| 3 |
+
Version: 4.0.0
|
| 4 |
+
Summary: Module for text manipulation
|
| 5 |
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
| 6 |
+
Project-URL: Source, https://github.com/jaraco/jaraco.text
|
| 7 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 8 |
+
Classifier: Intended Audience :: Developers
|
| 9 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 12 |
+
Requires-Python: >=3.8
|
| 13 |
+
Description-Content-Type: text/x-rst
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
Requires-Dist: jaraco.functools
|
| 16 |
+
Requires-Dist: jaraco.context >=4.1
|
| 17 |
+
Requires-Dist: autocommand
|
| 18 |
+
Requires-Dist: more-itertools
|
| 19 |
+
Requires-Dist: importlib-resources ; python_version < "3.9"
|
| 20 |
+
Provides-Extra: doc
|
| 21 |
+
Requires-Dist: sphinx >=3.5 ; extra == 'doc'
|
| 22 |
+
Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
|
| 23 |
+
Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
|
| 24 |
+
Requires-Dist: furo ; extra == 'doc'
|
| 25 |
+
Requires-Dist: sphinx-lint ; extra == 'doc'
|
| 26 |
+
Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
|
| 27 |
+
Provides-Extra: inflect
|
| 28 |
+
Requires-Dist: inflect ; extra == 'inflect'
|
| 29 |
+
Provides-Extra: test
|
| 30 |
+
Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
|
| 31 |
+
Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
|
| 32 |
+
Requires-Dist: pytest-cov ; extra == 'test'
|
| 33 |
+
Requires-Dist: pytest-mypy ; extra == 'test'
|
| 34 |
+
Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
|
| 35 |
+
Requires-Dist: pathlib2 ; (python_version < "3.10") and extra == 'test'
|
| 36 |
+
Requires-Dist: pytest-ruff >=0.2.1 ; (sys_platform != "cygwin") and extra == 'test'
|
| 37 |
+
|
| 38 |
+
.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
|
| 39 |
+
:target: https://pypi.org/project/jaraco.text
|
| 40 |
+
|
| 41 |
+
.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
|
| 42 |
+
|
| 43 |
+
.. image:: https://github.com/jaraco/jaraco.text/actions/workflows/main.yml/badge.svg
|
| 44 |
+
:target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
|
| 45 |
+
:alt: tests
|
| 46 |
+
|
| 47 |
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
| 48 |
+
:target: https://github.com/astral-sh/ruff
|
| 49 |
+
:alt: Ruff
|
| 50 |
+
|
| 51 |
+
.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
|
| 52 |
+
:target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
|
| 53 |
+
|
| 54 |
+
.. image:: https://img.shields.io/badge/skeleton-2024-informational
|
| 55 |
+
:target: https://blog.jaraco.com/skeleton
|
| 56 |
+
|
| 57 |
+
.. image:: https://tidelift.com/badges/package/pypi/jaraco.text
|
| 58 |
+
:target: https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=readme
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
This package provides handy routines for dealing with text, such as
|
| 62 |
+
wrapping, substitution, trimming, stripping, prefix and suffix removal,
|
| 63 |
+
line continuation, indentation, comment processing, identifier processing,
|
| 64 |
+
values parsing, case insensitive comparison, and more. See the docs
|
| 65 |
+
(linked in the badge above) for the detailed documentation and examples.
|
| 66 |
+
|
| 67 |
+
Layouts
|
| 68 |
+
=======
|
| 69 |
+
|
| 70 |
+
One of the features of this package is the layouts module, which
|
| 71 |
+
provides a simple example of translating keystrokes from one keyboard
|
| 72 |
+
layout to another::
|
| 73 |
+
|
| 74 |
+
echo qwerty | python -m jaraco.text.to-dvorak
|
| 75 |
+
',.pyf
|
| 76 |
+
echo "',.pyf" | python -m jaraco.text.to-qwerty
|
| 77 |
+
qwerty
|
| 78 |
+
|
| 79 |
+
Newline Reporting
|
| 80 |
+
=================
|
| 81 |
+
|
| 82 |
+
Need to know what newlines appear in a file?
|
| 83 |
+
|
| 84 |
+
::
|
| 85 |
+
|
| 86 |
+
$ python -m jaraco.text.show-newlines README.rst
|
| 87 |
+
newline is '\n'
|
| 88 |
+
|
| 89 |
+
For Enterprise
|
| 90 |
+
==============
|
| 91 |
+
|
| 92 |
+
Available as part of the Tidelift Subscription.
|
| 93 |
+
|
| 94 |
+
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
|
| 95 |
+
|
| 96 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=referral&utm_campaign=github>`_.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
jaraco.text-4.0.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
jaraco.text-4.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
|
| 3 |
+
jaraco.text-4.0.0.dist-info/METADATA,sha256=XC_QkBLJVPE5sQYkl41TNaZUw0AUzQb29GbKaD28nFY,3731
|
| 4 |
+
jaraco.text-4.0.0.dist-info/RECORD,,
|
| 5 |
+
jaraco.text-4.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
jaraco.text-4.0.0.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
| 7 |
+
jaraco.text-4.0.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
|
| 8 |
+
jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
|
| 9 |
+
jaraco/text/__init__.py,sha256=lazNYXo8IhOR1bFigLAyGiiQao6jtO3KGWh8bZZPx3c,16762
|
| 10 |
+
jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
|
| 11 |
+
jaraco/text/show-newlines.py,sha256=jT0vp4gLhG20hX2lTB-zKo_i3NgKzj79yRAdz4eMzIM,903
|
| 12 |
+
jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
|
| 13 |
+
jaraco/text/to-dvorak.py,sha256=36nPPsiifwv6RfpAb--3zpgbIx8ohnnI1aR29IJTO9s,118
|
| 14 |
+
jaraco/text/to-qwerty.py,sha256=IQoFY9v7vLTEybcput4KBYm_5GR35pmtgZ_xyrmdTgI,118
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/REQUESTED
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (71.1.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-4.0.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
jaraco
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context/__init__.py
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import contextlib
|
| 4 |
+
import errno
|
| 5 |
+
import functools
|
| 6 |
+
import operator
|
| 7 |
+
import os
|
| 8 |
+
import platform
|
| 9 |
+
import shutil
|
| 10 |
+
import stat
|
| 11 |
+
import subprocess
|
| 12 |
+
import sys
|
| 13 |
+
import tempfile
|
| 14 |
+
import urllib.request
|
| 15 |
+
from collections.abc import Iterator
|
| 16 |
+
|
| 17 |
+
if sys.version_info < (3, 12):
|
| 18 |
+
from backports import tarfile
|
| 19 |
+
else:
|
| 20 |
+
import tarfile
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@contextlib.contextmanager
|
| 24 |
+
def pushd(dir: str | os.PathLike) -> Iterator[str | os.PathLike]:
|
| 25 |
+
"""
|
| 26 |
+
>>> tmp_path = getfixture('tmp_path')
|
| 27 |
+
>>> with pushd(tmp_path):
|
| 28 |
+
... assert os.getcwd() == os.fspath(tmp_path)
|
| 29 |
+
>>> assert os.getcwd() != os.fspath(tmp_path)
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
orig = os.getcwd()
|
| 33 |
+
os.chdir(dir)
|
| 34 |
+
try:
|
| 35 |
+
yield dir
|
| 36 |
+
finally:
|
| 37 |
+
os.chdir(orig)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
@contextlib.contextmanager
|
| 41 |
+
def tarball(
|
| 42 |
+
url, target_dir: str | os.PathLike | None = None
|
| 43 |
+
) -> Iterator[str | os.PathLike]:
|
| 44 |
+
"""
|
| 45 |
+
Get a URL to a tarball, download, extract, yield, then clean up.
|
| 46 |
+
|
| 47 |
+
Assumes everything in the tarball is prefixed with a common
|
| 48 |
+
directory. That common path is stripped and the contents
|
| 49 |
+
are extracted to ``target_dir``, similar to passing
|
| 50 |
+
``-C {target} --strip-components 1`` to the ``tar`` command.
|
| 51 |
+
|
| 52 |
+
Uses the streaming protocol to extract the contents from a
|
| 53 |
+
stream in a single pass without loading the whole file into
|
| 54 |
+
memory.
|
| 55 |
+
|
| 56 |
+
>>> import urllib.request
|
| 57 |
+
>>> url = getfixture('tarfile_served')
|
| 58 |
+
>>> target = getfixture('tmp_path') / 'out'
|
| 59 |
+
>>> tb = tarball(url, target_dir=target)
|
| 60 |
+
>>> import pathlib
|
| 61 |
+
>>> with tb as extracted:
|
| 62 |
+
... contents = pathlib.Path(extracted, 'contents.txt').read_text(encoding='utf-8')
|
| 63 |
+
>>> assert not os.path.exists(extracted)
|
| 64 |
+
|
| 65 |
+
If the target is not specified, contents are extracted to a
|
| 66 |
+
directory relative to the current working directory named after
|
| 67 |
+
the name of the file as extracted from the URL.
|
| 68 |
+
|
| 69 |
+
>>> target = getfixture('tmp_path')
|
| 70 |
+
>>> with pushd(target), tarball(url):
|
| 71 |
+
... target.joinpath('served').is_dir()
|
| 72 |
+
True
|
| 73 |
+
"""
|
| 74 |
+
if target_dir is None:
|
| 75 |
+
target_dir = os.path.basename(url).replace('.tar.gz', '').replace('.tgz', '')
|
| 76 |
+
os.mkdir(target_dir)
|
| 77 |
+
try:
|
| 78 |
+
req = urllib.request.urlopen(url)
|
| 79 |
+
with tarfile.open(fileobj=req, mode='r|*') as tf:
|
| 80 |
+
tf.extractall(path=target_dir, filter=_default_filter)
|
| 81 |
+
yield target_dir
|
| 82 |
+
finally:
|
| 83 |
+
shutil.rmtree(target_dir)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def _compose_tarfile_filters(*filters):
|
| 87 |
+
def compose_two(f1, f2):
|
| 88 |
+
return lambda member, path: f1(f2(member, path), path)
|
| 89 |
+
|
| 90 |
+
return functools.reduce(compose_two, filters, lambda member, path: member)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def strip_first_component(
|
| 94 |
+
member: tarfile.TarInfo,
|
| 95 |
+
path,
|
| 96 |
+
) -> tarfile.TarInfo:
|
| 97 |
+
_, member.name = member.name.split('/', 1)
|
| 98 |
+
return member
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
_default_filter = _compose_tarfile_filters(tarfile.data_filter, strip_first_component)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def _compose(*cmgrs):
|
| 105 |
+
"""
|
| 106 |
+
Compose any number of dependent context managers into a single one.
|
| 107 |
+
|
| 108 |
+
The last, innermost context manager may take arbitrary arguments, but
|
| 109 |
+
each successive context manager should accept the result from the
|
| 110 |
+
previous as a single parameter.
|
| 111 |
+
|
| 112 |
+
Like :func:`jaraco.functools.compose`, behavior works from right to
|
| 113 |
+
left, so the context manager should be indicated from outermost to
|
| 114 |
+
innermost.
|
| 115 |
+
|
| 116 |
+
Example, to create a context manager to change to a temporary
|
| 117 |
+
directory:
|
| 118 |
+
|
| 119 |
+
>>> temp_dir_as_cwd = _compose(pushd, temp_dir)
|
| 120 |
+
>>> with temp_dir_as_cwd() as dir:
|
| 121 |
+
... assert os.path.samefile(os.getcwd(), dir)
|
| 122 |
+
"""
|
| 123 |
+
|
| 124 |
+
def compose_two(inner, outer):
|
| 125 |
+
def composed(*args, **kwargs):
|
| 126 |
+
with inner(*args, **kwargs) as saved, outer(saved) as res:
|
| 127 |
+
yield res
|
| 128 |
+
|
| 129 |
+
return contextlib.contextmanager(composed)
|
| 130 |
+
|
| 131 |
+
return functools.reduce(compose_two, reversed(cmgrs))
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
tarball_cwd = _compose(pushd, tarball)
|
| 135 |
+
"""
|
| 136 |
+
A tarball context with the current working directory pointing to the contents.
|
| 137 |
+
"""
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def remove_readonly(func, path, exc_info):
|
| 141 |
+
"""
|
| 142 |
+
Add support for removing read-only files on Windows.
|
| 143 |
+
"""
|
| 144 |
+
_, exc, _ = exc_info
|
| 145 |
+
if func in (os.rmdir, os.remove, os.unlink) and exc.errno == errno.EACCES:
|
| 146 |
+
# change the file to be readable,writable,executable: 0777
|
| 147 |
+
os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
| 148 |
+
# retry
|
| 149 |
+
func(path)
|
| 150 |
+
else:
|
| 151 |
+
raise
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def robust_remover():
|
| 155 |
+
return (
|
| 156 |
+
functools.partial(shutil.rmtree, onerror=remove_readonly)
|
| 157 |
+
if platform.system() == 'Windows'
|
| 158 |
+
else shutil.rmtree
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
@contextlib.contextmanager
|
| 163 |
+
def temp_dir(remover=shutil.rmtree):
|
| 164 |
+
"""
|
| 165 |
+
Create a temporary directory context. Pass a custom remover
|
| 166 |
+
to override the removal behavior.
|
| 167 |
+
|
| 168 |
+
>>> import pathlib
|
| 169 |
+
>>> with temp_dir() as the_dir:
|
| 170 |
+
... assert os.path.isdir(the_dir)
|
| 171 |
+
>>> assert not os.path.exists(the_dir)
|
| 172 |
+
"""
|
| 173 |
+
temp_dir = tempfile.mkdtemp()
|
| 174 |
+
try:
|
| 175 |
+
yield temp_dir
|
| 176 |
+
finally:
|
| 177 |
+
remover(temp_dir)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
robust_temp_dir = functools.partial(temp_dir, remover=robust_remover())
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
@contextlib.contextmanager
|
| 184 |
+
def repo_context(
|
| 185 |
+
url, branch: str | None = None, quiet: bool = True, dest_ctx=robust_temp_dir
|
| 186 |
+
):
|
| 187 |
+
"""
|
| 188 |
+
Check out the repo indicated by url.
|
| 189 |
+
|
| 190 |
+
If dest_ctx is supplied, it should be a context manager
|
| 191 |
+
to yield the target directory for the check out.
|
| 192 |
+
|
| 193 |
+
>>> getfixture('ensure_git')
|
| 194 |
+
>>> getfixture('needs_internet')
|
| 195 |
+
>>> repo = repo_context('https://github.com/jaraco/jaraco.context')
|
| 196 |
+
>>> with repo as dest:
|
| 197 |
+
... listing = os.listdir(dest)
|
| 198 |
+
>>> 'README.rst' in listing
|
| 199 |
+
True
|
| 200 |
+
"""
|
| 201 |
+
exe = 'git' if 'git' in url else 'hg'
|
| 202 |
+
with dest_ctx() as repo_dir:
|
| 203 |
+
cmd = [exe, 'clone', url, repo_dir]
|
| 204 |
+
cmd.extend(['--branch', branch] * bool(branch))
|
| 205 |
+
stream = subprocess.DEVNULL if quiet else None
|
| 206 |
+
subprocess.check_call(cmd, stdout=stream, stderr=stream)
|
| 207 |
+
yield repo_dir
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class ExceptionTrap:
|
| 211 |
+
"""
|
| 212 |
+
A context manager that will catch certain exceptions and provide an
|
| 213 |
+
indication they occurred.
|
| 214 |
+
|
| 215 |
+
>>> with ExceptionTrap() as trap:
|
| 216 |
+
... raise Exception()
|
| 217 |
+
>>> bool(trap)
|
| 218 |
+
True
|
| 219 |
+
|
| 220 |
+
>>> with ExceptionTrap() as trap:
|
| 221 |
+
... pass
|
| 222 |
+
>>> bool(trap)
|
| 223 |
+
False
|
| 224 |
+
|
| 225 |
+
>>> with ExceptionTrap(ValueError) as trap:
|
| 226 |
+
... raise ValueError("1 + 1 is not 3")
|
| 227 |
+
>>> bool(trap)
|
| 228 |
+
True
|
| 229 |
+
>>> trap.value
|
| 230 |
+
ValueError('1 + 1 is not 3')
|
| 231 |
+
>>> trap.tb
|
| 232 |
+
<traceback object at ...>
|
| 233 |
+
|
| 234 |
+
>>> with ExceptionTrap(ValueError) as trap:
|
| 235 |
+
... raise Exception()
|
| 236 |
+
Traceback (most recent call last):
|
| 237 |
+
...
|
| 238 |
+
Exception
|
| 239 |
+
|
| 240 |
+
>>> bool(trap)
|
| 241 |
+
False
|
| 242 |
+
"""
|
| 243 |
+
|
| 244 |
+
exc_info = None, None, None
|
| 245 |
+
|
| 246 |
+
def __init__(self, exceptions=(Exception,)):
|
| 247 |
+
self.exceptions = exceptions
|
| 248 |
+
|
| 249 |
+
def __enter__(self):
|
| 250 |
+
return self
|
| 251 |
+
|
| 252 |
+
@property
|
| 253 |
+
def type(self):
|
| 254 |
+
return self.exc_info[0]
|
| 255 |
+
|
| 256 |
+
@property
|
| 257 |
+
def value(self):
|
| 258 |
+
return self.exc_info[1]
|
| 259 |
+
|
| 260 |
+
@property
|
| 261 |
+
def tb(self):
|
| 262 |
+
return self.exc_info[2]
|
| 263 |
+
|
| 264 |
+
def __exit__(self, *exc_info):
|
| 265 |
+
type = exc_info[0]
|
| 266 |
+
matches = type and issubclass(type, self.exceptions)
|
| 267 |
+
if matches:
|
| 268 |
+
self.exc_info = exc_info
|
| 269 |
+
return matches
|
| 270 |
+
|
| 271 |
+
def __bool__(self):
|
| 272 |
+
return bool(self.type)
|
| 273 |
+
|
| 274 |
+
def raises(self, func, *, _test=bool):
|
| 275 |
+
"""
|
| 276 |
+
Wrap func and replace the result with the truth
|
| 277 |
+
value of the trap (True if an exception occurred).
|
| 278 |
+
|
| 279 |
+
First, give the decorator an alias to support Python 3.8
|
| 280 |
+
Syntax.
|
| 281 |
+
|
| 282 |
+
>>> raises = ExceptionTrap(ValueError).raises
|
| 283 |
+
|
| 284 |
+
Now decorate a function that always fails.
|
| 285 |
+
|
| 286 |
+
>>> @raises
|
| 287 |
+
... def fail():
|
| 288 |
+
... raise ValueError('failed')
|
| 289 |
+
>>> fail()
|
| 290 |
+
True
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
@functools.wraps(func)
|
| 294 |
+
def wrapper(*args, **kwargs):
|
| 295 |
+
with ExceptionTrap(self.exceptions) as trap:
|
| 296 |
+
func(*args, **kwargs)
|
| 297 |
+
return _test(trap)
|
| 298 |
+
|
| 299 |
+
return wrapper
|
| 300 |
+
|
| 301 |
+
def passes(self, func):
|
| 302 |
+
"""
|
| 303 |
+
Wrap func and replace the result with the truth
|
| 304 |
+
value of the trap (True if no exception).
|
| 305 |
+
|
| 306 |
+
First, give the decorator an alias to support Python 3.8
|
| 307 |
+
Syntax.
|
| 308 |
+
|
| 309 |
+
>>> passes = ExceptionTrap(ValueError).passes
|
| 310 |
+
|
| 311 |
+
Now decorate a function that always fails.
|
| 312 |
+
|
| 313 |
+
>>> @passes
|
| 314 |
+
... def fail():
|
| 315 |
+
... raise ValueError('failed')
|
| 316 |
+
|
| 317 |
+
>>> fail()
|
| 318 |
+
False
|
| 319 |
+
"""
|
| 320 |
+
return self.raises(func, _test=operator.not_)
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
class suppress(contextlib.suppress, contextlib.ContextDecorator):
|
| 324 |
+
"""
|
| 325 |
+
A version of contextlib.suppress with decorator support.
|
| 326 |
+
|
| 327 |
+
>>> @suppress(KeyError)
|
| 328 |
+
... def key_error():
|
| 329 |
+
... {}['']
|
| 330 |
+
>>> key_error()
|
| 331 |
+
"""
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
class on_interrupt(contextlib.ContextDecorator):
|
| 335 |
+
"""
|
| 336 |
+
Replace a KeyboardInterrupt with SystemExit(1).
|
| 337 |
+
|
| 338 |
+
Useful in conjunction with console entry point functions.
|
| 339 |
+
|
| 340 |
+
>>> def do_interrupt():
|
| 341 |
+
... raise KeyboardInterrupt()
|
| 342 |
+
>>> on_interrupt('error')(do_interrupt)()
|
| 343 |
+
Traceback (most recent call last):
|
| 344 |
+
...
|
| 345 |
+
SystemExit: 1
|
| 346 |
+
>>> on_interrupt('error', code=255)(do_interrupt)()
|
| 347 |
+
Traceback (most recent call last):
|
| 348 |
+
...
|
| 349 |
+
SystemExit: 255
|
| 350 |
+
>>> on_interrupt('suppress')(do_interrupt)()
|
| 351 |
+
>>> with __import__('pytest').raises(KeyboardInterrupt):
|
| 352 |
+
... on_interrupt('ignore')(do_interrupt)()
|
| 353 |
+
"""
|
| 354 |
+
|
| 355 |
+
def __init__(self, action='error', /, code=1):
|
| 356 |
+
self.action = action
|
| 357 |
+
self.code = code
|
| 358 |
+
|
| 359 |
+
def __enter__(self):
|
| 360 |
+
return self
|
| 361 |
+
|
| 362 |
+
def __exit__(self, exctype, excinst, exctb):
|
| 363 |
+
if exctype is not KeyboardInterrupt or self.action == 'ignore':
|
| 364 |
+
return
|
| 365 |
+
elif self.action == 'error':
|
| 366 |
+
raise SystemExit(self.code) from excinst
|
| 367 |
+
return self.action == 'suppress'
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context/py.typed
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.py
ADDED
|
@@ -0,0 +1,722 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import collections.abc
|
| 4 |
+
import functools
|
| 5 |
+
import inspect
|
| 6 |
+
import itertools
|
| 7 |
+
import operator
|
| 8 |
+
import time
|
| 9 |
+
import types
|
| 10 |
+
import warnings
|
| 11 |
+
from typing import Callable, TypeVar
|
| 12 |
+
|
| 13 |
+
import more_itertools
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def compose(*funcs):
|
| 17 |
+
"""
|
| 18 |
+
Compose any number of unary functions into a single unary function.
|
| 19 |
+
|
| 20 |
+
Comparable to
|
| 21 |
+
`function composition <https://en.wikipedia.org/wiki/Function_composition>`_
|
| 22 |
+
in mathematics:
|
| 23 |
+
|
| 24 |
+
``h = g ∘ f`` implies ``h(x) = g(f(x))``.
|
| 25 |
+
|
| 26 |
+
In Python, ``h = compose(g, f)``.
|
| 27 |
+
|
| 28 |
+
>>> import textwrap
|
| 29 |
+
>>> expected = str.strip(textwrap.dedent(compose.__doc__))
|
| 30 |
+
>>> strip_and_dedent = compose(str.strip, textwrap.dedent)
|
| 31 |
+
>>> strip_and_dedent(compose.__doc__) == expected
|
| 32 |
+
True
|
| 33 |
+
|
| 34 |
+
Compose also allows the innermost function to take arbitrary arguments.
|
| 35 |
+
|
| 36 |
+
>>> round_three = lambda x: round(x, ndigits=3)
|
| 37 |
+
>>> f = compose(round_three, int.__truediv__)
|
| 38 |
+
>>> [f(3*x, x+1) for x in range(1,10)]
|
| 39 |
+
[1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
def compose_two(f1, f2):
|
| 43 |
+
return lambda *args, **kwargs: f1(f2(*args, **kwargs))
|
| 44 |
+
|
| 45 |
+
return functools.reduce(compose_two, funcs)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def once(func):
|
| 49 |
+
"""
|
| 50 |
+
Decorate func so it's only ever called the first time.
|
| 51 |
+
|
| 52 |
+
This decorator can ensure that an expensive or non-idempotent function
|
| 53 |
+
will not be expensive on subsequent calls and is idempotent.
|
| 54 |
+
|
| 55 |
+
>>> add_three = once(lambda a: a+3)
|
| 56 |
+
>>> add_three(3)
|
| 57 |
+
6
|
| 58 |
+
>>> add_three(9)
|
| 59 |
+
6
|
| 60 |
+
>>> add_three('12')
|
| 61 |
+
6
|
| 62 |
+
|
| 63 |
+
To reset the stored value, simply clear the property ``saved_result``.
|
| 64 |
+
|
| 65 |
+
>>> del add_three.saved_result
|
| 66 |
+
>>> add_three(9)
|
| 67 |
+
12
|
| 68 |
+
>>> add_three(8)
|
| 69 |
+
12
|
| 70 |
+
|
| 71 |
+
Or invoke 'reset()' on it.
|
| 72 |
+
|
| 73 |
+
>>> add_three.reset()
|
| 74 |
+
>>> add_three(-3)
|
| 75 |
+
0
|
| 76 |
+
>>> add_three(0)
|
| 77 |
+
0
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
@functools.wraps(func)
|
| 81 |
+
def wrapper(*args, **kwargs):
|
| 82 |
+
if not hasattr(wrapper, 'saved_result'):
|
| 83 |
+
wrapper.saved_result = func(*args, **kwargs)
|
| 84 |
+
return wrapper.saved_result
|
| 85 |
+
|
| 86 |
+
wrapper.reset = lambda: vars(wrapper).__delitem__('saved_result')
|
| 87 |
+
return wrapper
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def method_cache(method, cache_wrapper=functools.lru_cache()):
|
| 91 |
+
"""
|
| 92 |
+
Wrap lru_cache to support storing the cache data in the object instances.
|
| 93 |
+
|
| 94 |
+
Abstracts the common paradigm where the method explicitly saves an
|
| 95 |
+
underscore-prefixed protected property on first call and returns that
|
| 96 |
+
subsequently.
|
| 97 |
+
|
| 98 |
+
>>> class MyClass:
|
| 99 |
+
... calls = 0
|
| 100 |
+
...
|
| 101 |
+
... @method_cache
|
| 102 |
+
... def method(self, value):
|
| 103 |
+
... self.calls += 1
|
| 104 |
+
... return value
|
| 105 |
+
|
| 106 |
+
>>> a = MyClass()
|
| 107 |
+
>>> a.method(3)
|
| 108 |
+
3
|
| 109 |
+
>>> for x in range(75):
|
| 110 |
+
... res = a.method(x)
|
| 111 |
+
>>> a.calls
|
| 112 |
+
75
|
| 113 |
+
|
| 114 |
+
Note that the apparent behavior will be exactly like that of lru_cache
|
| 115 |
+
except that the cache is stored on each instance, so values in one
|
| 116 |
+
instance will not flush values from another, and when an instance is
|
| 117 |
+
deleted, so are the cached values for that instance.
|
| 118 |
+
|
| 119 |
+
>>> b = MyClass()
|
| 120 |
+
>>> for x in range(35):
|
| 121 |
+
... res = b.method(x)
|
| 122 |
+
>>> b.calls
|
| 123 |
+
35
|
| 124 |
+
>>> a.method(0)
|
| 125 |
+
0
|
| 126 |
+
>>> a.calls
|
| 127 |
+
75
|
| 128 |
+
|
| 129 |
+
Note that if method had been decorated with ``functools.lru_cache()``,
|
| 130 |
+
a.calls would have been 76 (due to the cached value of 0 having been
|
| 131 |
+
flushed by the 'b' instance).
|
| 132 |
+
|
| 133 |
+
Clear the cache with ``.cache_clear()``
|
| 134 |
+
|
| 135 |
+
>>> a.method.cache_clear()
|
| 136 |
+
|
| 137 |
+
Same for a method that hasn't yet been called.
|
| 138 |
+
|
| 139 |
+
>>> c = MyClass()
|
| 140 |
+
>>> c.method.cache_clear()
|
| 141 |
+
|
| 142 |
+
Another cache wrapper may be supplied:
|
| 143 |
+
|
| 144 |
+
>>> cache = functools.lru_cache(maxsize=2)
|
| 145 |
+
>>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
|
| 146 |
+
>>> a = MyClass()
|
| 147 |
+
>>> a.method2()
|
| 148 |
+
3
|
| 149 |
+
|
| 150 |
+
Caution - do not subsequently wrap the method with another decorator, such
|
| 151 |
+
as ``@property``, which changes the semantics of the function.
|
| 152 |
+
|
| 153 |
+
See also
|
| 154 |
+
http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
|
| 155 |
+
for another implementation and additional justification.
|
| 156 |
+
"""
|
| 157 |
+
|
| 158 |
+
def wrapper(self, *args, **kwargs):
|
| 159 |
+
# it's the first call, replace the method with a cached, bound method
|
| 160 |
+
bound_method = types.MethodType(method, self)
|
| 161 |
+
cached_method = cache_wrapper(bound_method)
|
| 162 |
+
setattr(self, method.__name__, cached_method)
|
| 163 |
+
return cached_method(*args, **kwargs)
|
| 164 |
+
|
| 165 |
+
# Support cache clear even before cache has been created.
|
| 166 |
+
wrapper.cache_clear = lambda: None
|
| 167 |
+
|
| 168 |
+
return _special_method_cache(method, cache_wrapper) or wrapper
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def _special_method_cache(method, cache_wrapper):
|
| 172 |
+
"""
|
| 173 |
+
Because Python treats special methods differently, it's not
|
| 174 |
+
possible to use instance attributes to implement the cached
|
| 175 |
+
methods.
|
| 176 |
+
|
| 177 |
+
Instead, install the wrapper method under a different name
|
| 178 |
+
and return a simple proxy to that wrapper.
|
| 179 |
+
|
| 180 |
+
https://github.com/jaraco/jaraco.functools/issues/5
|
| 181 |
+
"""
|
| 182 |
+
name = method.__name__
|
| 183 |
+
special_names = '__getattr__', '__getitem__'
|
| 184 |
+
|
| 185 |
+
if name not in special_names:
|
| 186 |
+
return None
|
| 187 |
+
|
| 188 |
+
wrapper_name = '__cached' + name
|
| 189 |
+
|
| 190 |
+
def proxy(self, /, *args, **kwargs):
|
| 191 |
+
if wrapper_name not in vars(self):
|
| 192 |
+
bound = types.MethodType(method, self)
|
| 193 |
+
cache = cache_wrapper(bound)
|
| 194 |
+
setattr(self, wrapper_name, cache)
|
| 195 |
+
else:
|
| 196 |
+
cache = getattr(self, wrapper_name)
|
| 197 |
+
return cache(*args, **kwargs)
|
| 198 |
+
|
| 199 |
+
return proxy
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def apply(transform):
|
| 203 |
+
"""
|
| 204 |
+
Decorate a function with a transform function that is
|
| 205 |
+
invoked on results returned from the decorated function.
|
| 206 |
+
|
| 207 |
+
>>> @apply(reversed)
|
| 208 |
+
... def get_numbers(start):
|
| 209 |
+
... "doc for get_numbers"
|
| 210 |
+
... return range(start, start+3)
|
| 211 |
+
>>> list(get_numbers(4))
|
| 212 |
+
[6, 5, 4]
|
| 213 |
+
>>> get_numbers.__doc__
|
| 214 |
+
'doc for get_numbers'
|
| 215 |
+
"""
|
| 216 |
+
|
| 217 |
+
def wrap(func):
|
| 218 |
+
return functools.wraps(func)(compose(transform, func))
|
| 219 |
+
|
| 220 |
+
return wrap
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def result_invoke(action):
|
| 224 |
+
r"""
|
| 225 |
+
Decorate a function with an action function that is
|
| 226 |
+
invoked on the results returned from the decorated
|
| 227 |
+
function (for its side effect), then return the original
|
| 228 |
+
result.
|
| 229 |
+
|
| 230 |
+
>>> @result_invoke(print)
|
| 231 |
+
... def add_two(a, b):
|
| 232 |
+
... return a + b
|
| 233 |
+
>>> x = add_two(2, 3)
|
| 234 |
+
5
|
| 235 |
+
>>> x
|
| 236 |
+
5
|
| 237 |
+
"""
|
| 238 |
+
|
| 239 |
+
def wrap(func):
|
| 240 |
+
@functools.wraps(func)
|
| 241 |
+
def wrapper(*args, **kwargs):
|
| 242 |
+
result = func(*args, **kwargs)
|
| 243 |
+
action(result)
|
| 244 |
+
return result
|
| 245 |
+
|
| 246 |
+
return wrapper
|
| 247 |
+
|
| 248 |
+
return wrap
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
def invoke(f, /, *args, **kwargs):
|
| 252 |
+
"""
|
| 253 |
+
Call a function for its side effect after initialization.
|
| 254 |
+
|
| 255 |
+
The benefit of using the decorator instead of simply invoking a function
|
| 256 |
+
after defining it is that it makes explicit the author's intent for the
|
| 257 |
+
function to be called immediately. Whereas if one simply calls the
|
| 258 |
+
function immediately, it's less obvious if that was intentional or
|
| 259 |
+
incidental. It also avoids repeating the name - the two actions, defining
|
| 260 |
+
the function and calling it immediately are modeled separately, but linked
|
| 261 |
+
by the decorator construct.
|
| 262 |
+
|
| 263 |
+
The benefit of having a function construct (opposed to just invoking some
|
| 264 |
+
behavior inline) is to serve as a scope in which the behavior occurs. It
|
| 265 |
+
avoids polluting the global namespace with local variables, provides an
|
| 266 |
+
anchor on which to attach documentation (docstring), keeps the behavior
|
| 267 |
+
logically separated (instead of conceptually separated or not separated at
|
| 268 |
+
all), and provides potential to re-use the behavior for testing or other
|
| 269 |
+
purposes.
|
| 270 |
+
|
| 271 |
+
This function is named as a pithy way to communicate, "call this function
|
| 272 |
+
primarily for its side effect", or "while defining this function, also
|
| 273 |
+
take it aside and call it". It exists because there's no Python construct
|
| 274 |
+
for "define and call" (nor should there be, as decorators serve this need
|
| 275 |
+
just fine). The behavior happens immediately and synchronously.
|
| 276 |
+
|
| 277 |
+
>>> @invoke
|
| 278 |
+
... def func(): print("called")
|
| 279 |
+
called
|
| 280 |
+
>>> func()
|
| 281 |
+
called
|
| 282 |
+
|
| 283 |
+
Use functools.partial to pass parameters to the initial call
|
| 284 |
+
|
| 285 |
+
>>> @functools.partial(invoke, name='bingo')
|
| 286 |
+
... def func(name): print('called with', name)
|
| 287 |
+
called with bingo
|
| 288 |
+
"""
|
| 289 |
+
f(*args, **kwargs)
|
| 290 |
+
return f
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
_T = TypeVar('_T')
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
def passthrough(func: Callable[..., object]) -> Callable[[_T], _T]:
|
| 297 |
+
"""
|
| 298 |
+
Wrap the function to always return the first parameter.
|
| 299 |
+
|
| 300 |
+
>>> passthrough(print)('3')
|
| 301 |
+
3
|
| 302 |
+
'3'
|
| 303 |
+
"""
|
| 304 |
+
|
| 305 |
+
@functools.wraps(func)
|
| 306 |
+
def wrapper(first: _T, *args, **kwargs) -> _T:
|
| 307 |
+
func(first, *args, **kwargs)
|
| 308 |
+
return first
|
| 309 |
+
|
| 310 |
+
return wrapper
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
class Throttler:
|
| 314 |
+
"""Rate-limit a function (or other callable)."""
|
| 315 |
+
|
| 316 |
+
def __init__(self, func, max_rate=float('Inf')):
|
| 317 |
+
if isinstance(func, Throttler):
|
| 318 |
+
func = func.func
|
| 319 |
+
self.func = func
|
| 320 |
+
self.max_rate = max_rate
|
| 321 |
+
self.reset()
|
| 322 |
+
|
| 323 |
+
def reset(self):
|
| 324 |
+
self.last_called = 0
|
| 325 |
+
|
| 326 |
+
def __call__(self, *args, **kwargs):
|
| 327 |
+
self._wait()
|
| 328 |
+
return self.func(*args, **kwargs)
|
| 329 |
+
|
| 330 |
+
def _wait(self):
|
| 331 |
+
"""Ensure at least 1/max_rate seconds from last call."""
|
| 332 |
+
elapsed = time.time() - self.last_called
|
| 333 |
+
must_wait = 1 / self.max_rate - elapsed
|
| 334 |
+
time.sleep(max(0, must_wait))
|
| 335 |
+
self.last_called = time.time()
|
| 336 |
+
|
| 337 |
+
def __get__(self, obj, owner=None):
|
| 338 |
+
return first_invoke(self._wait, functools.partial(self.func, obj))
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
def first_invoke(func1, func2):
|
| 342 |
+
"""
|
| 343 |
+
Return a function that when invoked will invoke func1 without
|
| 344 |
+
any parameters (for its side effect) and then invoke func2
|
| 345 |
+
with whatever parameters were passed, returning its result.
|
| 346 |
+
"""
|
| 347 |
+
|
| 348 |
+
def wrapper(*args, **kwargs):
|
| 349 |
+
func1()
|
| 350 |
+
return func2(*args, **kwargs)
|
| 351 |
+
|
| 352 |
+
return wrapper
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
method_caller = first_invoke(
|
| 356 |
+
lambda: warnings.warn(
|
| 357 |
+
'`jaraco.functools.method_caller` is deprecated, '
|
| 358 |
+
'use `operator.methodcaller` instead',
|
| 359 |
+
DeprecationWarning,
|
| 360 |
+
stacklevel=3,
|
| 361 |
+
),
|
| 362 |
+
operator.methodcaller,
|
| 363 |
+
)
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
|
| 367 |
+
"""
|
| 368 |
+
Given a callable func, trap the indicated exceptions
|
| 369 |
+
for up to 'retries' times, invoking cleanup on the
|
| 370 |
+
exception. On the final attempt, allow any exceptions
|
| 371 |
+
to propagate.
|
| 372 |
+
"""
|
| 373 |
+
attempts = itertools.count() if retries == float('inf') else range(retries)
|
| 374 |
+
for _ in attempts:
|
| 375 |
+
try:
|
| 376 |
+
return func()
|
| 377 |
+
except trap:
|
| 378 |
+
cleanup()
|
| 379 |
+
|
| 380 |
+
return func()
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
def retry(*r_args, **r_kwargs):
|
| 384 |
+
"""
|
| 385 |
+
Decorator wrapper for retry_call. Accepts arguments to retry_call
|
| 386 |
+
except func and then returns a decorator for the decorated function.
|
| 387 |
+
|
| 388 |
+
Ex:
|
| 389 |
+
|
| 390 |
+
>>> @retry(retries=3)
|
| 391 |
+
... def my_func(a, b):
|
| 392 |
+
... "this is my funk"
|
| 393 |
+
... print(a, b)
|
| 394 |
+
>>> my_func.__doc__
|
| 395 |
+
'this is my funk'
|
| 396 |
+
"""
|
| 397 |
+
|
| 398 |
+
def decorate(func):
|
| 399 |
+
@functools.wraps(func)
|
| 400 |
+
def wrapper(*f_args, **f_kwargs):
|
| 401 |
+
bound = functools.partial(func, *f_args, **f_kwargs)
|
| 402 |
+
return retry_call(bound, *r_args, **r_kwargs)
|
| 403 |
+
|
| 404 |
+
return wrapper
|
| 405 |
+
|
| 406 |
+
return decorate
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
def print_yielded(func):
|
| 410 |
+
"""
|
| 411 |
+
Convert a generator into a function that prints all yielded elements.
|
| 412 |
+
|
| 413 |
+
>>> @print_yielded
|
| 414 |
+
... def x():
|
| 415 |
+
... yield 3; yield None
|
| 416 |
+
>>> x()
|
| 417 |
+
3
|
| 418 |
+
None
|
| 419 |
+
"""
|
| 420 |
+
print_all = functools.partial(map, print)
|
| 421 |
+
print_results = compose(more_itertools.consume, print_all, func)
|
| 422 |
+
return functools.wraps(func)(print_results)
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def pass_none(func):
|
| 426 |
+
"""
|
| 427 |
+
Wrap func so it's not called if its first param is None.
|
| 428 |
+
|
| 429 |
+
>>> print_text = pass_none(print)
|
| 430 |
+
>>> print_text('text')
|
| 431 |
+
text
|
| 432 |
+
>>> print_text(None)
|
| 433 |
+
"""
|
| 434 |
+
|
| 435 |
+
@functools.wraps(func)
|
| 436 |
+
def wrapper(param, /, *args, **kwargs):
|
| 437 |
+
if param is not None:
|
| 438 |
+
return func(param, *args, **kwargs)
|
| 439 |
+
return None
|
| 440 |
+
|
| 441 |
+
return wrapper
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
def none_as(value, replacement=None):
|
| 445 |
+
"""
|
| 446 |
+
>>> none_as(None, 'foo')
|
| 447 |
+
'foo'
|
| 448 |
+
>>> none_as('bar', 'foo')
|
| 449 |
+
'bar'
|
| 450 |
+
"""
|
| 451 |
+
return replacement if value is None else value
|
| 452 |
+
|
| 453 |
+
|
| 454 |
+
def assign_params(func, namespace):
|
| 455 |
+
"""
|
| 456 |
+
Assign parameters from namespace where func solicits.
|
| 457 |
+
|
| 458 |
+
>>> def func(x, y=3):
|
| 459 |
+
... print(x, y)
|
| 460 |
+
>>> assigned = assign_params(func, dict(x=2, z=4))
|
| 461 |
+
>>> assigned()
|
| 462 |
+
2 3
|
| 463 |
+
|
| 464 |
+
The usual errors are raised if a function doesn't receive
|
| 465 |
+
its required parameters:
|
| 466 |
+
|
| 467 |
+
>>> assigned = assign_params(func, dict(y=3, z=4))
|
| 468 |
+
>>> assigned()
|
| 469 |
+
Traceback (most recent call last):
|
| 470 |
+
TypeError: func() ...argument...
|
| 471 |
+
|
| 472 |
+
It even works on methods:
|
| 473 |
+
|
| 474 |
+
>>> class Handler:
|
| 475 |
+
... def meth(self, arg):
|
| 476 |
+
... print(arg)
|
| 477 |
+
>>> assign_params(Handler().meth, dict(arg='crystal', foo='clear'))()
|
| 478 |
+
crystal
|
| 479 |
+
"""
|
| 480 |
+
sig = inspect.signature(func)
|
| 481 |
+
params = sig.parameters.keys()
|
| 482 |
+
call_ns = {k: namespace[k] for k in params if k in namespace}
|
| 483 |
+
return functools.partial(func, **call_ns)
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
def save_method_args(method):
|
| 487 |
+
"""
|
| 488 |
+
Wrap a method such that when it is called, the args and kwargs are
|
| 489 |
+
saved on the method.
|
| 490 |
+
|
| 491 |
+
>>> class MyClass:
|
| 492 |
+
... @save_method_args
|
| 493 |
+
... def method(self, a, b):
|
| 494 |
+
... print(a, b)
|
| 495 |
+
>>> my_ob = MyClass()
|
| 496 |
+
>>> my_ob.method(1, 2)
|
| 497 |
+
1 2
|
| 498 |
+
>>> my_ob._saved_method.args
|
| 499 |
+
(1, 2)
|
| 500 |
+
>>> my_ob._saved_method.kwargs
|
| 501 |
+
{}
|
| 502 |
+
>>> my_ob.method(a=3, b='foo')
|
| 503 |
+
3 foo
|
| 504 |
+
>>> my_ob._saved_method.args
|
| 505 |
+
()
|
| 506 |
+
>>> my_ob._saved_method.kwargs == dict(a=3, b='foo')
|
| 507 |
+
True
|
| 508 |
+
|
| 509 |
+
The arguments are stored on the instance, allowing for
|
| 510 |
+
different instance to save different args.
|
| 511 |
+
|
| 512 |
+
>>> your_ob = MyClass()
|
| 513 |
+
>>> your_ob.method({str('x'): 3}, b=[4])
|
| 514 |
+
{'x': 3} [4]
|
| 515 |
+
>>> your_ob._saved_method.args
|
| 516 |
+
({'x': 3},)
|
| 517 |
+
>>> my_ob._saved_method.args
|
| 518 |
+
()
|
| 519 |
+
"""
|
| 520 |
+
args_and_kwargs = collections.namedtuple('args_and_kwargs', 'args kwargs') # noqa: PYI024 # Internal; stubs used for typing
|
| 521 |
+
|
| 522 |
+
@functools.wraps(method)
|
| 523 |
+
def wrapper(self, /, *args, **kwargs):
|
| 524 |
+
attr_name = '_saved_' + method.__name__
|
| 525 |
+
attr = args_and_kwargs(args, kwargs)
|
| 526 |
+
setattr(self, attr_name, attr)
|
| 527 |
+
return method(self, *args, **kwargs)
|
| 528 |
+
|
| 529 |
+
return wrapper
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
def except_(*exceptions, replace=None, use=None):
|
| 533 |
+
"""
|
| 534 |
+
Replace the indicated exceptions, if raised, with the indicated
|
| 535 |
+
literal replacement or evaluated expression (if present).
|
| 536 |
+
|
| 537 |
+
>>> safe_int = except_(ValueError)(int)
|
| 538 |
+
>>> safe_int('five')
|
| 539 |
+
>>> safe_int('5')
|
| 540 |
+
5
|
| 541 |
+
|
| 542 |
+
Specify a literal replacement with ``replace``.
|
| 543 |
+
|
| 544 |
+
>>> safe_int_r = except_(ValueError, replace=0)(int)
|
| 545 |
+
>>> safe_int_r('five')
|
| 546 |
+
0
|
| 547 |
+
|
| 548 |
+
Provide an expression to ``use`` to pass through particular parameters.
|
| 549 |
+
|
| 550 |
+
>>> safe_int_pt = except_(ValueError, use='args[0]')(int)
|
| 551 |
+
>>> safe_int_pt('five')
|
| 552 |
+
'five'
|
| 553 |
+
|
| 554 |
+
"""
|
| 555 |
+
|
| 556 |
+
def decorate(func):
|
| 557 |
+
@functools.wraps(func)
|
| 558 |
+
def wrapper(*args, **kwargs):
|
| 559 |
+
try:
|
| 560 |
+
return func(*args, **kwargs)
|
| 561 |
+
except exceptions:
|
| 562 |
+
try:
|
| 563 |
+
return eval(use)
|
| 564 |
+
except TypeError:
|
| 565 |
+
return replace
|
| 566 |
+
|
| 567 |
+
return wrapper
|
| 568 |
+
|
| 569 |
+
return decorate
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
def identity(x):
|
| 573 |
+
"""
|
| 574 |
+
Return the argument.
|
| 575 |
+
|
| 576 |
+
>>> o = object()
|
| 577 |
+
>>> identity(o) is o
|
| 578 |
+
True
|
| 579 |
+
"""
|
| 580 |
+
return x
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
def bypass_when(check, *, _op=identity):
|
| 584 |
+
"""
|
| 585 |
+
Decorate a function to return its parameter when ``check``.
|
| 586 |
+
|
| 587 |
+
>>> bypassed = [] # False
|
| 588 |
+
|
| 589 |
+
>>> @bypass_when(bypassed)
|
| 590 |
+
... def double(x):
|
| 591 |
+
... return x * 2
|
| 592 |
+
>>> double(2)
|
| 593 |
+
4
|
| 594 |
+
>>> bypassed[:] = [object()] # True
|
| 595 |
+
>>> double(2)
|
| 596 |
+
2
|
| 597 |
+
"""
|
| 598 |
+
|
| 599 |
+
def decorate(func):
|
| 600 |
+
@functools.wraps(func)
|
| 601 |
+
def wrapper(param, /):
|
| 602 |
+
return param if _op(check) else func(param)
|
| 603 |
+
|
| 604 |
+
return wrapper
|
| 605 |
+
|
| 606 |
+
return decorate
|
| 607 |
+
|
| 608 |
+
|
| 609 |
+
def bypass_unless(check):
|
| 610 |
+
"""
|
| 611 |
+
Decorate a function to return its parameter unless ``check``.
|
| 612 |
+
|
| 613 |
+
>>> enabled = [object()] # True
|
| 614 |
+
|
| 615 |
+
>>> @bypass_unless(enabled)
|
| 616 |
+
... def double(x):
|
| 617 |
+
... return x * 2
|
| 618 |
+
>>> double(2)
|
| 619 |
+
4
|
| 620 |
+
>>> del enabled[:] # False
|
| 621 |
+
>>> double(2)
|
| 622 |
+
2
|
| 623 |
+
"""
|
| 624 |
+
return bypass_when(check, _op=operator.not_)
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
@functools.singledispatch
|
| 628 |
+
def _splat_inner(args, func):
|
| 629 |
+
"""Splat args to func."""
|
| 630 |
+
return func(*args)
|
| 631 |
+
|
| 632 |
+
|
| 633 |
+
@_splat_inner.register
|
| 634 |
+
def _(args: collections.abc.Mapping, func):
|
| 635 |
+
"""Splat kargs to func as kwargs."""
|
| 636 |
+
return func(**args)
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
def splat(func):
|
| 640 |
+
"""
|
| 641 |
+
Wrap func to expect its parameters to be passed positionally in a tuple.
|
| 642 |
+
|
| 643 |
+
Has a similar effect to that of ``itertools.starmap`` over
|
| 644 |
+
simple ``map``.
|
| 645 |
+
|
| 646 |
+
>>> pairs = [(-1, 1), (0, 2)]
|
| 647 |
+
>>> more_itertools.consume(itertools.starmap(print, pairs))
|
| 648 |
+
-1 1
|
| 649 |
+
0 2
|
| 650 |
+
>>> more_itertools.consume(map(splat(print), pairs))
|
| 651 |
+
-1 1
|
| 652 |
+
0 2
|
| 653 |
+
|
| 654 |
+
The approach generalizes to other iterators that don't have a "star"
|
| 655 |
+
equivalent, such as a "starfilter".
|
| 656 |
+
|
| 657 |
+
>>> list(filter(splat(operator.add), pairs))
|
| 658 |
+
[(0, 2)]
|
| 659 |
+
|
| 660 |
+
Splat also accepts a mapping argument.
|
| 661 |
+
|
| 662 |
+
>>> def is_nice(msg, code):
|
| 663 |
+
... return "smile" in msg or code == 0
|
| 664 |
+
>>> msgs = [
|
| 665 |
+
... dict(msg='smile!', code=20),
|
| 666 |
+
... dict(msg='error :(', code=1),
|
| 667 |
+
... dict(msg='unknown', code=0),
|
| 668 |
+
... ]
|
| 669 |
+
>>> for msg in filter(splat(is_nice), msgs):
|
| 670 |
+
... print(msg)
|
| 671 |
+
{'msg': 'smile!', 'code': 20}
|
| 672 |
+
{'msg': 'unknown', 'code': 0}
|
| 673 |
+
"""
|
| 674 |
+
return functools.wraps(func)(functools.partial(_splat_inner, func=func))
|
| 675 |
+
|
| 676 |
+
|
| 677 |
+
_T = TypeVar('_T')
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
def chainable(method: Callable[[_T, ...], None]) -> Callable[[_T, ...], _T]:
|
| 681 |
+
"""
|
| 682 |
+
Wrap an instance method to always return self.
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
>>> class Dingus:
|
| 686 |
+
... @chainable
|
| 687 |
+
... def set_attr(self, name, val):
|
| 688 |
+
... setattr(self, name, val)
|
| 689 |
+
>>> d = Dingus().set_attr('a', 'eh!')
|
| 690 |
+
>>> d.a
|
| 691 |
+
'eh!'
|
| 692 |
+
>>> d2 = Dingus().set_attr('a', 'eh!').set_attr('b', 'bee!')
|
| 693 |
+
>>> d2.a + d2.b
|
| 694 |
+
'eh!bee!'
|
| 695 |
+
|
| 696 |
+
Enforces that the return value is null.
|
| 697 |
+
|
| 698 |
+
>>> class BorkedDingus:
|
| 699 |
+
... @chainable
|
| 700 |
+
... def set_attr(self, name, val):
|
| 701 |
+
... setattr(self, name, val)
|
| 702 |
+
... return len(name)
|
| 703 |
+
>>> BorkedDingus().set_attr('a', 'eh!')
|
| 704 |
+
Traceback (most recent call last):
|
| 705 |
+
...
|
| 706 |
+
AssertionError
|
| 707 |
+
"""
|
| 708 |
+
|
| 709 |
+
@functools.wraps(method)
|
| 710 |
+
def wrapper(self, *args, **kwargs):
|
| 711 |
+
assert method(self, *args, **kwargs) is None
|
| 712 |
+
return self
|
| 713 |
+
|
| 714 |
+
return wrapper
|
| 715 |
+
|
| 716 |
+
|
| 717 |
+
def noop(*args, **kwargs):
|
| 718 |
+
"""
|
| 719 |
+
A no-operation function that does nothing.
|
| 720 |
+
|
| 721 |
+
>>> noop(1, 2, three=3)
|
| 722 |
+
"""
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable, Hashable, Iterator
|
| 2 |
+
from functools import partial
|
| 3 |
+
from operator import methodcaller
|
| 4 |
+
from typing import (
|
| 5 |
+
Any,
|
| 6 |
+
Generic,
|
| 7 |
+
Protocol,
|
| 8 |
+
TypeVar,
|
| 9 |
+
overload,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
from typing_extensions import Concatenate, ParamSpec, TypeVarTuple, Unpack
|
| 13 |
+
|
| 14 |
+
_P = ParamSpec('_P')
|
| 15 |
+
_R = TypeVar('_R')
|
| 16 |
+
_T = TypeVar('_T')
|
| 17 |
+
_Ts = TypeVarTuple('_Ts')
|
| 18 |
+
_R1 = TypeVar('_R1')
|
| 19 |
+
_R2 = TypeVar('_R2')
|
| 20 |
+
_V = TypeVar('_V')
|
| 21 |
+
_S = TypeVar('_S')
|
| 22 |
+
_R_co = TypeVar('_R_co', covariant=True)
|
| 23 |
+
|
| 24 |
+
class _OnceCallable(Protocol[_P, _R]):
|
| 25 |
+
saved_result: _R
|
| 26 |
+
reset: Callable[[], None]
|
| 27 |
+
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
|
| 28 |
+
|
| 29 |
+
class _ProxyMethodCacheWrapper(Protocol[_R_co]):
|
| 30 |
+
cache_clear: Callable[[], None]
|
| 31 |
+
def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
|
| 32 |
+
|
| 33 |
+
class _MethodCacheWrapper(Protocol[_R_co]):
|
| 34 |
+
def cache_clear(self) -> None: ...
|
| 35 |
+
def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
|
| 36 |
+
|
| 37 |
+
# `compose()` overloads below will cover most use cases.
|
| 38 |
+
|
| 39 |
+
@overload
|
| 40 |
+
def compose(
|
| 41 |
+
__func1: Callable[[_R], _T],
|
| 42 |
+
__func2: Callable[_P, _R],
|
| 43 |
+
/,
|
| 44 |
+
) -> Callable[_P, _T]: ...
|
| 45 |
+
@overload
|
| 46 |
+
def compose(
|
| 47 |
+
__func1: Callable[[_R], _T],
|
| 48 |
+
__func2: Callable[[_R1], _R],
|
| 49 |
+
__func3: Callable[_P, _R1],
|
| 50 |
+
/,
|
| 51 |
+
) -> Callable[_P, _T]: ...
|
| 52 |
+
@overload
|
| 53 |
+
def compose(
|
| 54 |
+
__func1: Callable[[_R], _T],
|
| 55 |
+
__func2: Callable[[_R2], _R],
|
| 56 |
+
__func3: Callable[[_R1], _R2],
|
| 57 |
+
__func4: Callable[_P, _R1],
|
| 58 |
+
/,
|
| 59 |
+
) -> Callable[_P, _T]: ...
|
| 60 |
+
def once(func: Callable[_P, _R]) -> _OnceCallable[_P, _R]: ...
|
| 61 |
+
def method_cache(
|
| 62 |
+
method: Callable[..., _R],
|
| 63 |
+
cache_wrapper: Callable[[Callable[..., _R]], _MethodCacheWrapper[_R]] = ...,
|
| 64 |
+
) -> _MethodCacheWrapper[_R] | _ProxyMethodCacheWrapper[_R]: ...
|
| 65 |
+
def apply(
|
| 66 |
+
transform: Callable[[_R], _T],
|
| 67 |
+
) -> Callable[[Callable[_P, _R]], Callable[_P, _T]]: ...
|
| 68 |
+
def result_invoke(
|
| 69 |
+
action: Callable[[_R], Any],
|
| 70 |
+
) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
|
| 71 |
+
def invoke(
|
| 72 |
+
f: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs
|
| 73 |
+
) -> Callable[_P, _R]: ...
|
| 74 |
+
|
| 75 |
+
class Throttler(Generic[_R]):
|
| 76 |
+
last_called: float
|
| 77 |
+
func: Callable[..., _R]
|
| 78 |
+
max_rate: float
|
| 79 |
+
def __init__(
|
| 80 |
+
self, func: Callable[..., _R] | Throttler[_R], max_rate: float = ...
|
| 81 |
+
) -> None: ...
|
| 82 |
+
def reset(self) -> None: ...
|
| 83 |
+
def __call__(self, *args: Any, **kwargs: Any) -> _R: ...
|
| 84 |
+
def __get__(self, obj: Any, owner: type[Any] | None = ...) -> Callable[..., _R]: ...
|
| 85 |
+
|
| 86 |
+
def first_invoke(
|
| 87 |
+
func1: Callable[..., Any], func2: Callable[_P, _R]
|
| 88 |
+
) -> Callable[_P, _R]: ...
|
| 89 |
+
|
| 90 |
+
method_caller: Callable[..., methodcaller]
|
| 91 |
+
|
| 92 |
+
def retry_call(
|
| 93 |
+
func: Callable[..., _R],
|
| 94 |
+
cleanup: Callable[..., None] = ...,
|
| 95 |
+
retries: float = ...,
|
| 96 |
+
trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
|
| 97 |
+
) -> _R: ...
|
| 98 |
+
def retry(
|
| 99 |
+
cleanup: Callable[..., None] = ...,
|
| 100 |
+
retries: float = ...,
|
| 101 |
+
trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
|
| 102 |
+
) -> Callable[[Callable[..., _R]], Callable[..., _R]]: ...
|
| 103 |
+
def print_yielded(func: Callable[_P, Iterator[Any]]) -> Callable[_P, None]: ...
|
| 104 |
+
def pass_none(
|
| 105 |
+
func: Callable[Concatenate[_T, _P], _R],
|
| 106 |
+
) -> Callable[Concatenate[_T, _P], _R]: ...
|
| 107 |
+
def assign_params(
|
| 108 |
+
func: Callable[..., _R], namespace: dict[str, Any]
|
| 109 |
+
) -> partial[_R]: ...
|
| 110 |
+
def save_method_args(
|
| 111 |
+
method: Callable[Concatenate[_S, _P], _R],
|
| 112 |
+
) -> Callable[Concatenate[_S, _P], _R]: ...
|
| 113 |
+
def except_(
|
| 114 |
+
*exceptions: type[BaseException], replace: Any = ..., use: Any = ...
|
| 115 |
+
) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: ...
|
| 116 |
+
def identity(x: _T) -> _T: ...
|
| 117 |
+
def bypass_when(
|
| 118 |
+
check: _V, *, _op: Callable[[_V], Any] = ...
|
| 119 |
+
) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
|
| 120 |
+
def bypass_unless(
|
| 121 |
+
check: Any,
|
| 122 |
+
) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
|
| 123 |
+
def splat(func: Callable[[Unpack[_Ts]], _R]) -> Callable[[tuple[Unpack[_Ts]]], _R]: ...
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/py.typed
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
| 2 |
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
|
miniconda3/envs/ladir/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/__init__.py
ADDED
|
@@ -0,0 +1,647 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import itertools
|
| 3 |
+
import re
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
from typing import Iterable
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
from importlib.resources import files # type: ignore
|
| 10 |
+
except ImportError: # pragma: nocover
|
| 11 |
+
from importlib_resources import files # type: ignore
|
| 12 |
+
|
| 13 |
+
from jaraco.context import ExceptionTrap
|
| 14 |
+
from jaraco.functools import compose, method_cache
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def substitution(old, new):
|
| 18 |
+
"""
|
| 19 |
+
Return a function that will perform a substitution on a string
|
| 20 |
+
"""
|
| 21 |
+
return lambda s: s.replace(old, new)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def multi_substitution(*substitutions):
|
| 25 |
+
"""
|
| 26 |
+
Take a sequence of pairs specifying substitutions, and create
|
| 27 |
+
a function that performs those substitutions.
|
| 28 |
+
|
| 29 |
+
>>> multi_substitution(('foo', 'bar'), ('bar', 'baz'))('foo')
|
| 30 |
+
'baz'
|
| 31 |
+
"""
|
| 32 |
+
substitutions = itertools.starmap(substitution, substitutions)
|
| 33 |
+
# compose function applies last function first, so reverse the
|
| 34 |
+
# substitutions to get the expected order.
|
| 35 |
+
substitutions = reversed(tuple(substitutions))
|
| 36 |
+
return compose(*substitutions)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class FoldedCase(str):
|
| 40 |
+
"""
|
| 41 |
+
A case insensitive string class; behaves just like str
|
| 42 |
+
except compares equal when the only variation is case.
|
| 43 |
+
|
| 44 |
+
>>> s = FoldedCase('hello world')
|
| 45 |
+
|
| 46 |
+
>>> s == 'Hello World'
|
| 47 |
+
True
|
| 48 |
+
|
| 49 |
+
>>> 'Hello World' == s
|
| 50 |
+
True
|
| 51 |
+
|
| 52 |
+
>>> s != 'Hello World'
|
| 53 |
+
False
|
| 54 |
+
|
| 55 |
+
>>> s.index('O')
|
| 56 |
+
4
|
| 57 |
+
|
| 58 |
+
>>> s.split('O')
|
| 59 |
+
['hell', ' w', 'rld']
|
| 60 |
+
|
| 61 |
+
>>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
|
| 62 |
+
['alpha', 'Beta', 'GAMMA']
|
| 63 |
+
|
| 64 |
+
Sequence membership is straightforward.
|
| 65 |
+
|
| 66 |
+
>>> "Hello World" in [s]
|
| 67 |
+
True
|
| 68 |
+
>>> s in ["Hello World"]
|
| 69 |
+
True
|
| 70 |
+
|
| 71 |
+
Allows testing for set inclusion, but candidate and elements
|
| 72 |
+
must both be folded.
|
| 73 |
+
|
| 74 |
+
>>> FoldedCase("Hello World") in {s}
|
| 75 |
+
True
|
| 76 |
+
>>> s in {FoldedCase("Hello World")}
|
| 77 |
+
True
|
| 78 |
+
|
| 79 |
+
String inclusion works as long as the FoldedCase object
|
| 80 |
+
is on the right.
|
| 81 |
+
|
| 82 |
+
>>> "hello" in FoldedCase("Hello World")
|
| 83 |
+
True
|
| 84 |
+
|
| 85 |
+
But not if the FoldedCase object is on the left:
|
| 86 |
+
|
| 87 |
+
>>> FoldedCase('hello') in 'Hello World'
|
| 88 |
+
False
|
| 89 |
+
|
| 90 |
+
In that case, use ``in_``:
|
| 91 |
+
|
| 92 |
+
>>> FoldedCase('hello').in_('Hello World')
|
| 93 |
+
True
|
| 94 |
+
|
| 95 |
+
>>> FoldedCase('hello') > FoldedCase('Hello')
|
| 96 |
+
False
|
| 97 |
+
|
| 98 |
+
>>> FoldedCase('ß') == FoldedCase('ss')
|
| 99 |
+
True
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
def __lt__(self, other):
|
| 103 |
+
return self.casefold() < other.casefold()
|
| 104 |
+
|
| 105 |
+
def __gt__(self, other):
|
| 106 |
+
return self.casefold() > other.casefold()
|
| 107 |
+
|
| 108 |
+
def __eq__(self, other):
|
| 109 |
+
return self.casefold() == other.casefold()
|
| 110 |
+
|
| 111 |
+
def __ne__(self, other):
|
| 112 |
+
return self.casefold() != other.casefold()
|
| 113 |
+
|
| 114 |
+
def __hash__(self):
|
| 115 |
+
return hash(self.casefold())
|
| 116 |
+
|
| 117 |
+
def __contains__(self, other):
|
| 118 |
+
return super().casefold().__contains__(other.casefold())
|
| 119 |
+
|
| 120 |
+
def in_(self, other):
|
| 121 |
+
"Does self appear in other?"
|
| 122 |
+
return self in FoldedCase(other)
|
| 123 |
+
|
| 124 |
+
# cache casefold since it's likely to be called frequently.
|
| 125 |
+
@method_cache
|
| 126 |
+
def casefold(self):
|
| 127 |
+
return super().casefold()
|
| 128 |
+
|
| 129 |
+
def index(self, sub):
|
| 130 |
+
return self.casefold().index(sub.casefold())
|
| 131 |
+
|
| 132 |
+
def split(self, splitter=' ', maxsplit=0):
|
| 133 |
+
pattern = re.compile(re.escape(splitter), re.I)
|
| 134 |
+
return pattern.split(self, maxsplit)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
# Python 3.8 compatibility
|
| 138 |
+
_unicode_trap = ExceptionTrap(UnicodeDecodeError)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
@_unicode_trap.passes
|
| 142 |
+
def is_decodable(value):
|
| 143 |
+
r"""
|
| 144 |
+
Return True if the supplied value is decodable (using the default
|
| 145 |
+
encoding).
|
| 146 |
+
|
| 147 |
+
>>> is_decodable(b'\xff')
|
| 148 |
+
False
|
| 149 |
+
>>> is_decodable(b'\x32')
|
| 150 |
+
True
|
| 151 |
+
"""
|
| 152 |
+
value.decode()
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
def is_binary(value):
|
| 156 |
+
r"""
|
| 157 |
+
Return True if the value appears to be binary (that is, it's a byte
|
| 158 |
+
string and isn't decodable).
|
| 159 |
+
|
| 160 |
+
>>> is_binary(b'\xff')
|
| 161 |
+
True
|
| 162 |
+
>>> is_binary('\xff')
|
| 163 |
+
False
|
| 164 |
+
"""
|
| 165 |
+
return isinstance(value, bytes) and not is_decodable(value)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def trim(s):
|
| 169 |
+
r"""
|
| 170 |
+
Trim something like a docstring to remove the whitespace that
|
| 171 |
+
is common due to indentation and formatting.
|
| 172 |
+
|
| 173 |
+
>>> trim("\n\tfoo = bar\n\t\tbar = baz\n")
|
| 174 |
+
'foo = bar\n\tbar = baz'
|
| 175 |
+
"""
|
| 176 |
+
return textwrap.dedent(s).strip()
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def wrap(s):
|
| 180 |
+
"""
|
| 181 |
+
Wrap lines of text, retaining existing newlines as
|
| 182 |
+
paragraph markers.
|
| 183 |
+
|
| 184 |
+
>>> print(wrap(lorem_ipsum))
|
| 185 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
| 186 |
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
| 187 |
+
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
| 188 |
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
| 189 |
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
| 190 |
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
| 191 |
+
culpa qui officia deserunt mollit anim id est laborum.
|
| 192 |
+
<BLANKLINE>
|
| 193 |
+
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
|
| 194 |
+
varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
|
| 195 |
+
magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
|
| 196 |
+
gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
|
| 197 |
+
risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
|
| 198 |
+
eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
|
| 199 |
+
fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla
|
| 200 |
+
a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis,
|
| 201 |
+
neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing
|
| 202 |
+
sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque
|
| 203 |
+
nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus
|
| 204 |
+
quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis,
|
| 205 |
+
molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
|
| 206 |
+
"""
|
| 207 |
+
paragraphs = s.splitlines()
|
| 208 |
+
wrapped = ('\n'.join(textwrap.wrap(para)) for para in paragraphs)
|
| 209 |
+
return '\n\n'.join(wrapped)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def unwrap(s):
|
| 213 |
+
r"""
|
| 214 |
+
Given a multi-line string, return an unwrapped version.
|
| 215 |
+
|
| 216 |
+
>>> wrapped = wrap(lorem_ipsum)
|
| 217 |
+
>>> wrapped.count('\n')
|
| 218 |
+
20
|
| 219 |
+
>>> unwrapped = unwrap(wrapped)
|
| 220 |
+
>>> unwrapped.count('\n')
|
| 221 |
+
1
|
| 222 |
+
>>> print(unwrapped)
|
| 223 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing ...
|
| 224 |
+
Curabitur pretium tincidunt lacus. Nulla gravida orci ...
|
| 225 |
+
|
| 226 |
+
"""
|
| 227 |
+
paragraphs = re.split(r'\n\n+', s)
|
| 228 |
+
cleaned = (para.replace('\n', ' ') for para in paragraphs)
|
| 229 |
+
return '\n'.join(cleaned)
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
lorem_ipsum: str = (
|
| 233 |
+
files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
class Splitter:
|
| 238 |
+
"""object that will split a string with the given arguments for each call
|
| 239 |
+
|
| 240 |
+
>>> s = Splitter(',')
|
| 241 |
+
>>> s('hello, world, this is your, master calling')
|
| 242 |
+
['hello', ' world', ' this is your', ' master calling']
|
| 243 |
+
"""
|
| 244 |
+
|
| 245 |
+
def __init__(self, *args):
|
| 246 |
+
self.args = args
|
| 247 |
+
|
| 248 |
+
def __call__(self, s):
|
| 249 |
+
return s.split(*self.args)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def indent(string, prefix=' ' * 4):
|
| 253 |
+
"""
|
| 254 |
+
>>> indent('foo')
|
| 255 |
+
' foo'
|
| 256 |
+
"""
|
| 257 |
+
return prefix + string
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class WordSet(tuple):
|
| 261 |
+
"""
|
| 262 |
+
Given an identifier, return the words that identifier represents,
|
| 263 |
+
whether in camel case, underscore-separated, etc.
|
| 264 |
+
|
| 265 |
+
>>> WordSet.parse("camelCase")
|
| 266 |
+
('camel', 'Case')
|
| 267 |
+
|
| 268 |
+
>>> WordSet.parse("under_sep")
|
| 269 |
+
('under', 'sep')
|
| 270 |
+
|
| 271 |
+
Acronyms should be retained
|
| 272 |
+
|
| 273 |
+
>>> WordSet.parse("firstSNL")
|
| 274 |
+
('first', 'SNL')
|
| 275 |
+
|
| 276 |
+
>>> WordSet.parse("you_and_I")
|
| 277 |
+
('you', 'and', 'I')
|
| 278 |
+
|
| 279 |
+
>>> WordSet.parse("A simple test")
|
| 280 |
+
('A', 'simple', 'test')
|
| 281 |
+
|
| 282 |
+
Multiple caps should not interfere with the first cap of another word.
|
| 283 |
+
|
| 284 |
+
>>> WordSet.parse("myABCClass")
|
| 285 |
+
('my', 'ABC', 'Class')
|
| 286 |
+
|
| 287 |
+
The result is a WordSet, providing access to other forms.
|
| 288 |
+
|
| 289 |
+
>>> WordSet.parse("myABCClass").underscore_separated()
|
| 290 |
+
'my_ABC_Class'
|
| 291 |
+
|
| 292 |
+
>>> WordSet.parse('a-command').camel_case()
|
| 293 |
+
'ACommand'
|
| 294 |
+
|
| 295 |
+
>>> WordSet.parse('someIdentifier').lowered().space_separated()
|
| 296 |
+
'some identifier'
|
| 297 |
+
|
| 298 |
+
Slices of the result should return another WordSet.
|
| 299 |
+
|
| 300 |
+
>>> WordSet.parse('taken-out-of-context')[1:].underscore_separated()
|
| 301 |
+
'out_of_context'
|
| 302 |
+
|
| 303 |
+
>>> WordSet.from_class_name(WordSet()).lowered().space_separated()
|
| 304 |
+
'word set'
|
| 305 |
+
|
| 306 |
+
>>> example = WordSet.parse('figured it out')
|
| 307 |
+
>>> example.headless_camel_case()
|
| 308 |
+
'figuredItOut'
|
| 309 |
+
>>> example.dash_separated()
|
| 310 |
+
'figured-it-out'
|
| 311 |
+
|
| 312 |
+
"""
|
| 313 |
+
|
| 314 |
+
_pattern = re.compile('([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))')
|
| 315 |
+
|
| 316 |
+
def capitalized(self):
|
| 317 |
+
return WordSet(word.capitalize() for word in self)
|
| 318 |
+
|
| 319 |
+
def lowered(self):
|
| 320 |
+
return WordSet(word.lower() for word in self)
|
| 321 |
+
|
| 322 |
+
def camel_case(self):
|
| 323 |
+
return ''.join(self.capitalized())
|
| 324 |
+
|
| 325 |
+
def headless_camel_case(self):
|
| 326 |
+
words = iter(self)
|
| 327 |
+
first = next(words).lower()
|
| 328 |
+
new_words = itertools.chain((first,), WordSet(words).camel_case())
|
| 329 |
+
return ''.join(new_words)
|
| 330 |
+
|
| 331 |
+
def underscore_separated(self):
|
| 332 |
+
return '_'.join(self)
|
| 333 |
+
|
| 334 |
+
def dash_separated(self):
|
| 335 |
+
return '-'.join(self)
|
| 336 |
+
|
| 337 |
+
def space_separated(self):
|
| 338 |
+
return ' '.join(self)
|
| 339 |
+
|
| 340 |
+
def trim_right(self, item):
|
| 341 |
+
"""
|
| 342 |
+
Remove the item from the end of the set.
|
| 343 |
+
|
| 344 |
+
>>> WordSet.parse('foo bar').trim_right('foo')
|
| 345 |
+
('foo', 'bar')
|
| 346 |
+
>>> WordSet.parse('foo bar').trim_right('bar')
|
| 347 |
+
('foo',)
|
| 348 |
+
>>> WordSet.parse('').trim_right('bar')
|
| 349 |
+
()
|
| 350 |
+
"""
|
| 351 |
+
return self[:-1] if self and self[-1] == item else self
|
| 352 |
+
|
| 353 |
+
def trim_left(self, item):
|
| 354 |
+
"""
|
| 355 |
+
Remove the item from the beginning of the set.
|
| 356 |
+
|
| 357 |
+
>>> WordSet.parse('foo bar').trim_left('foo')
|
| 358 |
+
('bar',)
|
| 359 |
+
>>> WordSet.parse('foo bar').trim_left('bar')
|
| 360 |
+
('foo', 'bar')
|
| 361 |
+
>>> WordSet.parse('').trim_left('bar')
|
| 362 |
+
()
|
| 363 |
+
"""
|
| 364 |
+
return self[1:] if self and self[0] == item else self
|
| 365 |
+
|
| 366 |
+
def trim(self, item):
|
| 367 |
+
"""
|
| 368 |
+
>>> WordSet.parse('foo bar').trim('foo')
|
| 369 |
+
('bar',)
|
| 370 |
+
"""
|
| 371 |
+
return self.trim_left(item).trim_right(item)
|
| 372 |
+
|
| 373 |
+
def __getitem__(self, item):
|
| 374 |
+
result = super().__getitem__(item)
|
| 375 |
+
if isinstance(item, slice):
|
| 376 |
+
result = WordSet(result)
|
| 377 |
+
return result
|
| 378 |
+
|
| 379 |
+
@classmethod
|
| 380 |
+
def parse(cls, identifier):
|
| 381 |
+
matches = cls._pattern.finditer(identifier)
|
| 382 |
+
return WordSet(match.group(0) for match in matches)
|
| 383 |
+
|
| 384 |
+
@classmethod
|
| 385 |
+
def from_class_name(cls, subject):
|
| 386 |
+
return cls.parse(subject.__class__.__name__)
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
# for backward compatibility
|
| 390 |
+
words = WordSet.parse
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
def simple_html_strip(s):
|
| 394 |
+
r"""
|
| 395 |
+
Remove HTML from the string `s`.
|
| 396 |
+
|
| 397 |
+
>>> str(simple_html_strip(''))
|
| 398 |
+
''
|
| 399 |
+
|
| 400 |
+
>>> print(simple_html_strip('A <bold>stormy</bold> day in paradise'))
|
| 401 |
+
A stormy day in paradise
|
| 402 |
+
|
| 403 |
+
>>> print(simple_html_strip('Somebody <!-- do not --> tell the truth.'))
|
| 404 |
+
Somebody tell the truth.
|
| 405 |
+
|
| 406 |
+
>>> print(simple_html_strip('What about<br/>\nmultiple lines?'))
|
| 407 |
+
What about
|
| 408 |
+
multiple lines?
|
| 409 |
+
"""
|
| 410 |
+
html_stripper = re.compile('(<!--.*?-->)|(<[^>]*>)|([^<]+)', re.DOTALL)
|
| 411 |
+
texts = (match.group(3) or '' for match in html_stripper.finditer(s))
|
| 412 |
+
return ''.join(texts)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
class SeparatedValues(str):
|
| 416 |
+
"""
|
| 417 |
+
A string separated by a separator. Overrides __iter__ for getting
|
| 418 |
+
the values.
|
| 419 |
+
|
| 420 |
+
>>> list(SeparatedValues('a,b,c'))
|
| 421 |
+
['a', 'b', 'c']
|
| 422 |
+
|
| 423 |
+
Whitespace is stripped and empty values are discarded.
|
| 424 |
+
|
| 425 |
+
>>> list(SeparatedValues(' a, b , c, '))
|
| 426 |
+
['a', 'b', 'c']
|
| 427 |
+
"""
|
| 428 |
+
|
| 429 |
+
separator = ','
|
| 430 |
+
|
| 431 |
+
def __iter__(self):
|
| 432 |
+
parts = self.split(self.separator)
|
| 433 |
+
return filter(None, (part.strip() for part in parts))
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
class Stripper:
|
| 437 |
+
r"""
|
| 438 |
+
Given a series of lines, find the common prefix and strip it from them.
|
| 439 |
+
|
| 440 |
+
>>> lines = [
|
| 441 |
+
... 'abcdefg\n',
|
| 442 |
+
... 'abc\n',
|
| 443 |
+
... 'abcde\n',
|
| 444 |
+
... ]
|
| 445 |
+
>>> res = Stripper.strip_prefix(lines)
|
| 446 |
+
>>> res.prefix
|
| 447 |
+
'abc'
|
| 448 |
+
>>> list(res.lines)
|
| 449 |
+
['defg\n', '\n', 'de\n']
|
| 450 |
+
|
| 451 |
+
If no prefix is common, nothing should be stripped.
|
| 452 |
+
|
| 453 |
+
>>> lines = [
|
| 454 |
+
... 'abcd\n',
|
| 455 |
+
... '1234\n',
|
| 456 |
+
... ]
|
| 457 |
+
>>> res = Stripper.strip_prefix(lines)
|
| 458 |
+
>>> res.prefix = ''
|
| 459 |
+
>>> list(res.lines)
|
| 460 |
+
['abcd\n', '1234\n']
|
| 461 |
+
"""
|
| 462 |
+
|
| 463 |
+
def __init__(self, prefix, lines):
|
| 464 |
+
self.prefix = prefix
|
| 465 |
+
self.lines = map(self, lines)
|
| 466 |
+
|
| 467 |
+
@classmethod
|
| 468 |
+
def strip_prefix(cls, lines):
|
| 469 |
+
prefix_lines, lines = itertools.tee(lines)
|
| 470 |
+
prefix = functools.reduce(cls.common_prefix, prefix_lines)
|
| 471 |
+
return cls(prefix, lines)
|
| 472 |
+
|
| 473 |
+
def __call__(self, line):
|
| 474 |
+
if not self.prefix:
|
| 475 |
+
return line
|
| 476 |
+
null, prefix, rest = line.partition(self.prefix)
|
| 477 |
+
return rest
|
| 478 |
+
|
| 479 |
+
@staticmethod
|
| 480 |
+
def common_prefix(s1, s2):
|
| 481 |
+
"""
|
| 482 |
+
Return the common prefix of two lines.
|
| 483 |
+
"""
|
| 484 |
+
index = min(len(s1), len(s2))
|
| 485 |
+
while s1[:index] != s2[:index]:
|
| 486 |
+
index -= 1
|
| 487 |
+
return s1[:index]
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
def remove_prefix(text, prefix):
|
| 491 |
+
"""
|
| 492 |
+
Remove the prefix from the text if it exists.
|
| 493 |
+
|
| 494 |
+
>>> remove_prefix('underwhelming performance', 'underwhelming ')
|
| 495 |
+
'performance'
|
| 496 |
+
|
| 497 |
+
>>> remove_prefix('something special', 'sample')
|
| 498 |
+
'something special'
|
| 499 |
+
"""
|
| 500 |
+
null, prefix, rest = text.rpartition(prefix)
|
| 501 |
+
return rest
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
def remove_suffix(text, suffix):
|
| 505 |
+
"""
|
| 506 |
+
Remove the suffix from the text if it exists.
|
| 507 |
+
|
| 508 |
+
>>> remove_suffix('name.git', '.git')
|
| 509 |
+
'name'
|
| 510 |
+
|
| 511 |
+
>>> remove_suffix('something special', 'sample')
|
| 512 |
+
'something special'
|
| 513 |
+
"""
|
| 514 |
+
rest, suffix, null = text.partition(suffix)
|
| 515 |
+
return rest
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
def normalize_newlines(text):
|
| 519 |
+
r"""
|
| 520 |
+
Replace alternate newlines with the canonical newline.
|
| 521 |
+
|
| 522 |
+
>>> normalize_newlines('Lorem Ipsum\u2029')
|
| 523 |
+
'Lorem Ipsum\n'
|
| 524 |
+
>>> normalize_newlines('Lorem Ipsum\r\n')
|
| 525 |
+
'Lorem Ipsum\n'
|
| 526 |
+
>>> normalize_newlines('Lorem Ipsum\x85')
|
| 527 |
+
'Lorem Ipsum\n'
|
| 528 |
+
"""
|
| 529 |
+
newlines = ['\r\n', '\r', '\n', '\u0085', '\u2028', '\u2029']
|
| 530 |
+
pattern = '|'.join(newlines)
|
| 531 |
+
return re.sub(pattern, '\n', text)
|
| 532 |
+
|
| 533 |
+
|
| 534 |
+
def _nonblank(str):
|
| 535 |
+
return str and not str.startswith('#')
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
@functools.singledispatch
|
| 539 |
+
def yield_lines(iterable):
|
| 540 |
+
r"""
|
| 541 |
+
Yield valid lines of a string or iterable.
|
| 542 |
+
|
| 543 |
+
>>> list(yield_lines(''))
|
| 544 |
+
[]
|
| 545 |
+
>>> list(yield_lines(['foo', 'bar']))
|
| 546 |
+
['foo', 'bar']
|
| 547 |
+
>>> list(yield_lines('foo\nbar'))
|
| 548 |
+
['foo', 'bar']
|
| 549 |
+
>>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
|
| 550 |
+
['foo', 'baz #comment']
|
| 551 |
+
>>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
|
| 552 |
+
['foo', 'bar', 'baz', 'bing']
|
| 553 |
+
"""
|
| 554 |
+
return itertools.chain.from_iterable(map(yield_lines, iterable))
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
@yield_lines.register(str)
|
| 558 |
+
def _(text):
|
| 559 |
+
return clean(text.splitlines())
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
def clean(lines: Iterable[str]):
|
| 563 |
+
"""
|
| 564 |
+
Yield non-blank, non-comment elements from lines.
|
| 565 |
+
"""
|
| 566 |
+
return filter(_nonblank, map(str.strip, lines))
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
def drop_comment(line):
|
| 570 |
+
"""
|
| 571 |
+
Drop comments.
|
| 572 |
+
|
| 573 |
+
>>> drop_comment('foo # bar')
|
| 574 |
+
'foo'
|
| 575 |
+
|
| 576 |
+
A hash without a space may be in a URL.
|
| 577 |
+
|
| 578 |
+
>>> drop_comment('http://example.com/foo#bar')
|
| 579 |
+
'http://example.com/foo#bar'
|
| 580 |
+
"""
|
| 581 |
+
return line.partition(' #')[0]
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
def join_continuation(lines):
|
| 585 |
+
r"""
|
| 586 |
+
Join lines continued by a trailing backslash.
|
| 587 |
+
|
| 588 |
+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
|
| 589 |
+
['foobar', 'baz']
|
| 590 |
+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
|
| 591 |
+
['foobar', 'baz']
|
| 592 |
+
>>> list(join_continuation(['foo \\', 'bar \\', 'baz']))
|
| 593 |
+
['foobarbaz']
|
| 594 |
+
|
| 595 |
+
Not sure why, but...
|
| 596 |
+
The character preceding the backslash is also elided.
|
| 597 |
+
|
| 598 |
+
>>> list(join_continuation(['goo\\', 'dly']))
|
| 599 |
+
['godly']
|
| 600 |
+
|
| 601 |
+
A terrible idea, but...
|
| 602 |
+
If no line is available to continue, suppress the lines.
|
| 603 |
+
|
| 604 |
+
>>> list(join_continuation(['foo', 'bar\\', 'baz\\']))
|
| 605 |
+
['foo']
|
| 606 |
+
"""
|
| 607 |
+
lines = iter(lines)
|
| 608 |
+
for item in lines:
|
| 609 |
+
while item.endswith('\\'):
|
| 610 |
+
try:
|
| 611 |
+
item = item[:-2].strip() + next(lines)
|
| 612 |
+
except StopIteration:
|
| 613 |
+
return
|
| 614 |
+
yield item
|
| 615 |
+
|
| 616 |
+
|
| 617 |
+
def read_newlines(filename, limit=1024):
|
| 618 |
+
r"""
|
| 619 |
+
>>> tmp_path = getfixture('tmp_path')
|
| 620 |
+
>>> filename = tmp_path / 'out.txt'
|
| 621 |
+
>>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
|
| 622 |
+
>>> read_newlines(filename)
|
| 623 |
+
'\n'
|
| 624 |
+
>>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
|
| 625 |
+
>>> read_newlines(filename)
|
| 626 |
+
'\r\n'
|
| 627 |
+
>>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
|
| 628 |
+
>>> read_newlines(filename)
|
| 629 |
+
('\r', '\n', '\r\n')
|
| 630 |
+
"""
|
| 631 |
+
with open(filename, encoding='utf-8') as fp:
|
| 632 |
+
fp.read(limit)
|
| 633 |
+
return fp.newlines
|
| 634 |
+
|
| 635 |
+
|
| 636 |
+
def lines_from(input):
|
| 637 |
+
"""
|
| 638 |
+
Generate lines from a :class:`importlib.resources.abc.Traversable` path.
|
| 639 |
+
|
| 640 |
+
>>> lines = lines_from(files(__name__).joinpath('Lorem ipsum.txt'))
|
| 641 |
+
>>> next(lines)
|
| 642 |
+
'Lorem ipsum...'
|
| 643 |
+
>>> next(lines)
|
| 644 |
+
'Curabitur pretium...'
|
| 645 |
+
"""
|
| 646 |
+
with input.open(encoding='utf-8') as stream:
|
| 647 |
+
yield from stream
|