Spaces:
Paused
Paused
feat(ui): central live preview SPACE + iframe/proxy hardening (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/INSTALLER +1 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/METADATA +90 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/RECORD +850 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/REQUESTED +0 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/WHEEL +5 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/entry_points.txt +3 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/licenses/AUTHORS.txt +821 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/licenses/LICENSE.txt +20 -0
- .venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/top_level.txt +1 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/columns.py +187 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/console.py +0 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/constrain.py +37 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/containers.py +167 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/control.py +225 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/default_styles.py +193 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/diagnose.py +38 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/emoji.py +96 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/errors.py +34 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/filesize.py +88 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/highlighter.py +232 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/json.py +139 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/jupyter.py +101 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/layout.py +442 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/live.py +375 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/live_render.py +112 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/logging.py +297 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/markup.py +251 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/measure.py +151 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/padding.py +141 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/pager.py +34 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/palette.py +100 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/panel.py +318 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/pretty.py +1016 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/progress.py +1715 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/prompt.py +400 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/protocol.py +42 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/py.typed +0 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/region.py +10 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/repr.py +149 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/rule.py +130 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/scope.py +86 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/screen.py +54 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/segment.py +752 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/spinner.py +138 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/status.py +131 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/style.py +796 -0
- .venv/lib/python3.13/site-packages/pip/_vendor/rich/styled.py +42 -0
.gitattributes
CHANGED
|
@@ -38,3 +38,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 38 |
.venv/bin/python3.13 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
.venv/lib/python3.13/site-packages/httptools/parser/parser.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 40 |
.venv/lib/python3.13/site-packages/httptools/parser/url_parser.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 38 |
.venv/bin/python3.13 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
.venv/lib/python3.13/site-packages/httptools/parser/parser.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 40 |
.venv/lib/python3.13/site-packages/httptools/parser/url_parser.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
.venv/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: pip
|
| 3 |
+
Version: 25.1.1
|
| 4 |
+
Summary: The PyPA recommended tool for installing Python packages.
|
| 5 |
+
Author-email: The pip developers <distutils-sig@python.org>
|
| 6 |
+
License: MIT
|
| 7 |
+
Project-URL: Homepage, https://pip.pypa.io/
|
| 8 |
+
Project-URL: Documentation, https://pip.pypa.io
|
| 9 |
+
Project-URL: Source, https://github.com/pypa/pip
|
| 10 |
+
Project-URL: Changelog, https://pip.pypa.io/en/stable/news/
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 14 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 15 |
+
Classifier: Programming Language :: Python
|
| 16 |
+
Classifier: Programming Language :: Python :: 3
|
| 17 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 23 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 24 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 25 |
+
Requires-Python: >=3.9
|
| 26 |
+
Description-Content-Type: text/x-rst
|
| 27 |
+
License-File: LICENSE.txt
|
| 28 |
+
License-File: AUTHORS.txt
|
| 29 |
+
Dynamic: license-file
|
| 30 |
+
|
| 31 |
+
pip - The Python Package Installer
|
| 32 |
+
==================================
|
| 33 |
+
|
| 34 |
+
.. |pypi-version| image:: https://img.shields.io/pypi/v/pip.svg
|
| 35 |
+
:target: https://pypi.org/project/pip/
|
| 36 |
+
:alt: PyPI
|
| 37 |
+
|
| 38 |
+
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/pip
|
| 39 |
+
:target: https://pypi.org/project/pip
|
| 40 |
+
:alt: PyPI - Python Version
|
| 41 |
+
|
| 42 |
+
.. |docs-badge| image:: https://readthedocs.org/projects/pip/badge/?version=latest
|
| 43 |
+
:target: https://pip.pypa.io/en/latest
|
| 44 |
+
:alt: Documentation
|
| 45 |
+
|
| 46 |
+
|pypi-version| |python-versions| |docs-badge|
|
| 47 |
+
|
| 48 |
+
pip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.
|
| 49 |
+
|
| 50 |
+
Please take a look at our documentation for how to install and use pip:
|
| 51 |
+
|
| 52 |
+
* `Installation`_
|
| 53 |
+
* `Usage`_
|
| 54 |
+
|
| 55 |
+
We release updates regularly, with a new version every 3 months. Find more details in our documentation:
|
| 56 |
+
|
| 57 |
+
* `Release notes`_
|
| 58 |
+
* `Release process`_
|
| 59 |
+
|
| 60 |
+
If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:
|
| 61 |
+
|
| 62 |
+
* `Issue tracking`_
|
| 63 |
+
* `Discourse channel`_
|
| 64 |
+
* `User IRC`_
|
| 65 |
+
|
| 66 |
+
If you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:
|
| 67 |
+
|
| 68 |
+
* `GitHub page`_
|
| 69 |
+
* `Development documentation`_
|
| 70 |
+
* `Development IRC`_
|
| 71 |
+
|
| 72 |
+
Code of Conduct
|
| 73 |
+
---------------
|
| 74 |
+
|
| 75 |
+
Everyone interacting in the pip project's codebases, issue trackers, chat
|
| 76 |
+
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
| 77 |
+
|
| 78 |
+
.. _package installer: https://packaging.python.org/guides/tool-recommendations/
|
| 79 |
+
.. _Python Package Index: https://pypi.org
|
| 80 |
+
.. _Installation: https://pip.pypa.io/en/stable/installation/
|
| 81 |
+
.. _Usage: https://pip.pypa.io/en/stable/
|
| 82 |
+
.. _Release notes: https://pip.pypa.io/en/stable/news.html
|
| 83 |
+
.. _Release process: https://pip.pypa.io/en/latest/development/release-process/
|
| 84 |
+
.. _GitHub page: https://github.com/pypa/pip
|
| 85 |
+
.. _Development documentation: https://pip.pypa.io/en/latest/development
|
| 86 |
+
.. _Issue tracking: https://github.com/pypa/pip/issues
|
| 87 |
+
.. _Discourse channel: https://discuss.python.org/c/packaging
|
| 88 |
+
.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa
|
| 89 |
+
.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev
|
| 90 |
+
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,850 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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25.1.1.dist-info/RECORD,,
|
| 7 |
+
pip-25.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 8 |
+
pip-25.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
| 9 |
+
pip-25.1.1.dist-info/entry_points.txt,sha256=eeIjuzfnfR2PrhbjnbzFU6MnSS70kZLxwaHHq6M-bD0,87
|
| 10 |
+
pip-25.1.1.dist-info/licenses/AUTHORS.txt,sha256=YzDFTYpeYnwpmODDFTgyKZNKWcfdO10L5Ex_U6kJLRc,11223
|
| 11 |
+
pip-25.1.1.dist-info/licenses/LICENSE.txt,sha256=Y0MApmnUmurmWxLGxIySTFGkzfPR_whtw0VtyLyqIQQ,1093
|
| 12 |
+
pip-25.1.1.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 13 |
+
pip/__init__.py,sha256=zQQ7Na8YWi0IN86IUKEzDAJtyVpXdJXYDkQ536caUiQ,357
|
| 14 |
+
pip/__main__.py,sha256=WzbhHXTbSE6gBY19mNN9m4s5o_365LOvTYSgqgbdBhE,854
|
| 15 |
+
pip/__pip-runner__.py,sha256=JOoEZTwrtv7jRaXBkgSQKAE04yNyfFmGHxqpHiGHvL0,1450
|
| 16 |
+
pip/__pycache__/__init__.cpython-313.pyc,,
|
| 17 |
+
pip/__pycache__/__main__.cpython-313.pyc,,
|
| 18 |
+
pip/__pycache__/__pip-runner__.cpython-313.pyc,,
|
| 19 |
+
pip/_internal/__init__.py,sha256=MfcoOluDZ8QMCFYal04IqOJ9q6m2V7a0aOsnI-WOxUo,513
|
| 20 |
+
pip/_internal/__pycache__/__init__.cpython-313.pyc,,
|
| 21 |
+
pip/_internal/__pycache__/build_env.cpython-313.pyc,,
|
| 22 |
+
pip/_internal/__pycache__/cache.cpython-313.pyc,,
|
| 23 |
+
pip/_internal/__pycache__/configuration.cpython-313.pyc,,
|
| 24 |
+
pip/_internal/__pycache__/exceptions.cpython-313.pyc,,
|
| 25 |
+
pip/_internal/__pycache__/main.cpython-313.pyc,,
|
| 26 |
+
pip/_internal/__pycache__/pyproject.cpython-313.pyc,,
|
| 27 |
+
pip/_internal/__pycache__/self_outdated_check.cpython-313.pyc,,
|
| 28 |
+
pip/_internal/__pycache__/wheel_builder.cpython-313.pyc,,
|
| 29 |
+
pip/_internal/build_env.py,sha256=60_espLI9X3C2db3Ww2gIcyjNk2cAPNcc5gsVO4DOqg,10924
|
| 30 |
+
pip/_internal/cache.py,sha256=SjhJK1C6NbonrU4AyYXKTOH0CGOk5cJrYt60mRANnPM,10368
|
| 31 |
+
pip/_internal/cli/__init__.py,sha256=Iqg_tKA771XuMO1P4t_sDHnSKPzkUb9D0DqunAmw_ko,131
|
| 32 |
+
pip/_internal/cli/__pycache__/__init__.cpython-313.pyc,,
|
| 33 |
+
pip/_internal/cli/__pycache__/autocompletion.cpython-313.pyc,,
|
| 34 |
+
pip/_internal/cli/__pycache__/base_command.cpython-313.pyc,,
|
| 35 |
+
pip/_internal/cli/__pycache__/cmdoptions.cpython-313.pyc,,
|
| 36 |
+
pip/_internal/cli/__pycache__/command_context.cpython-313.pyc,,
|
| 37 |
+
pip/_internal/cli/__pycache__/index_command.cpython-313.pyc,,
|
| 38 |
+
pip/_internal/cli/__pycache__/main.cpython-313.pyc,,
|
| 39 |
+
pip/_internal/cli/__pycache__/main_parser.cpython-313.pyc,,
|
| 40 |
+
pip/_internal/cli/__pycache__/parser.cpython-313.pyc,,
|
| 41 |
+
pip/_internal/cli/__pycache__/progress_bars.cpython-313.pyc,,
|
| 42 |
+
pip/_internal/cli/__pycache__/req_command.cpython-313.pyc,,
|
| 43 |
+
pip/_internal/cli/__pycache__/spinners.cpython-313.pyc,,
|
| 44 |
+
pip/_internal/cli/__pycache__/status_codes.cpython-313.pyc,,
|
| 45 |
+
pip/_internal/cli/autocompletion.py,sha256=fs0Wy16Ga5tX1IZKvww5BDi7i5zyzfCPvu7cgXlgXys,6864
|
| 46 |
+
pip/_internal/cli/base_command.py,sha256=0A8YuJVJh2YyXU8pdW0eidLg1eklCW5cU01mpI-FAxA,8351
|
| 47 |
+
pip/_internal/cli/cmdoptions.py,sha256=VHJ-32dTF1X3iQz1jaVPt3JxksyZcCfGZ5qrStZmvTM,31908
|
| 48 |
+
pip/_internal/cli/command_context.py,sha256=RHgIPwtObh5KhMrd3YZTkl8zbVG-6Okml7YbFX4Ehg0,774
|
| 49 |
+
pip/_internal/cli/index_command.py,sha256=kplkusUgCZy75jNCo-etaDmSG8UvqcR2W50ALDdm6dk,5720
|
| 50 |
+
pip/_internal/cli/main.py,sha256=1bXC7uL3tdb_EZlGVKs6_TgzC9tlKU7zhAZsbZA-IzY,2816
|
| 51 |
+
pip/_internal/cli/main_parser.py,sha256=chZqNmCuO_JYt8ynBCumh4crURaRoXBZ0RxoSYQIwCw,4337
|
| 52 |
+
pip/_internal/cli/parser.py,sha256=VCMtduzECUV87KaHNu-xJ-wLNL82yT3x16V4XBxOAqI,10825
|
| 53 |
+
pip/_internal/cli/progress_bars.py,sha256=r9BD4T2-egcInB1Uh9Jjw3EP9F3INy5kZhGwSePm9jo,4435
|
| 54 |
+
pip/_internal/cli/req_command.py,sha256=1yfssBvnUKNer8D7iT3OHqdJJNdCqRhwDqUFWgieppk,12934
|
| 55 |
+
pip/_internal/cli/spinners.py,sha256=hIJ83GerdFgFCdobIA23Jggetegl_uC4Sp586nzFbPE,5118
|
| 56 |
+
pip/_internal/cli/status_codes.py,sha256=sEFHUaUJbqv8iArL3HAtcztWZmGOFX01hTesSytDEh0,116
|
| 57 |
+
pip/_internal/commands/__init__.py,sha256=3405KyFv4l0ruxeF69oosFanxNQcC_fHBGv7Rpt0PXg,4009
|
| 58 |
+
pip/_internal/commands/__pycache__/__init__.cpython-313.pyc,,
|
| 59 |
+
pip/_internal/commands/__pycache__/cache.cpython-313.pyc,,
|
| 60 |
+
pip/_internal/commands/__pycache__/check.cpython-313.pyc,,
|
| 61 |
+
pip/_internal/commands/__pycache__/completion.cpython-313.pyc,,
|
| 62 |
+
pip/_internal/commands/__pycache__/configuration.cpython-313.pyc,,
|
| 63 |
+
pip/_internal/commands/__pycache__/debug.cpython-313.pyc,,
|
| 64 |
+
pip/_internal/commands/__pycache__/download.cpython-313.pyc,,
|
| 65 |
+
pip/_internal/commands/__pycache__/freeze.cpython-313.pyc,,
|
| 66 |
+
pip/_internal/commands/__pycache__/hash.cpython-313.pyc,,
|
| 67 |
+
pip/_internal/commands/__pycache__/help.cpython-313.pyc,,
|
| 68 |
+
pip/_internal/commands/__pycache__/index.cpython-313.pyc,,
|
| 69 |
+
pip/_internal/commands/__pycache__/inspect.cpython-313.pyc,,
|
| 70 |
+
pip/_internal/commands/__pycache__/install.cpython-313.pyc,,
|
| 71 |
+
pip/_internal/commands/__pycache__/list.cpython-313.pyc,,
|
| 72 |
+
pip/_internal/commands/__pycache__/lock.cpython-313.pyc,,
|
| 73 |
+
pip/_internal/commands/__pycache__/search.cpython-313.pyc,,
|
| 74 |
+
pip/_internal/commands/__pycache__/show.cpython-313.pyc,,
|
| 75 |
+
pip/_internal/commands/__pycache__/uninstall.cpython-313.pyc,,
|
| 76 |
+
pip/_internal/commands/__pycache__/wheel.cpython-313.pyc,,
|
| 77 |
+
pip/_internal/commands/cache.py,sha256=IOezTicHjGE5sWdBx2nwPVgbjuJHM3s-BZEkpZLemuY,8107
|
| 78 |
+
pip/_internal/commands/check.py,sha256=Hr_4eiMd9cgVDgEvjtIdw915NmL7ROIWW8enkr8slPQ,2268
|
| 79 |
+
pip/_internal/commands/completion.py,sha256=W9QFQTPLjy2tPACJ_y3g9EgB1pbsh7pvCUX8ocuIdPg,4554
|
| 80 |
+
pip/_internal/commands/configuration.py,sha256=n98enwp6y0b5G6fiRQjaZo43FlJKYve_daMhN-4BRNc,9766
|
| 81 |
+
pip/_internal/commands/debug.py,sha256=DNDRgE9YsKrbYzU0s3VKi8rHtKF4X13CJ_br_8PUXO0,6797
|
| 82 |
+
pip/_internal/commands/download.py,sha256=0qB0nys6ZEPsog451lDsjL5Bx7Z97t-B80oFZKhpzKM,5273
|
| 83 |
+
pip/_internal/commands/freeze.py,sha256=i9LzK6tJDgtfShSrS38Gn6aCfFlj7K4ZZTMbBwZTPmA,3215
|
| 84 |
+
pip/_internal/commands/hash.py,sha256=EVVOuvGtoPEdFi8SNnmdqlCQrhCxV-kJsdwtdcCnXGQ,1703
|
| 85 |
+
pip/_internal/commands/help.py,sha256=gcc6QDkcgHMOuAn5UxaZwAStsRBrnGSn_yxjS57JIoM,1132
|
| 86 |
+
pip/_internal/commands/index.py,sha256=8UucFVwx6FmM8cNbaPY8iI5kZdV3f6jhqDa-S8aGgpg,5068
|
| 87 |
+
pip/_internal/commands/inspect.py,sha256=PGrY9TRTRCM3y5Ml8Bdk8DEOXquWRfscr4DRo1LOTPc,3189
|
| 88 |
+
pip/_internal/commands/install.py,sha256=SRsiLpead7A8bLdxMqxTAJM3sUFHtgN9zgBT98UQz5E,29757
|
| 89 |
+
pip/_internal/commands/list.py,sha256=3ciKAsDVrmmuUWQKDttrKeGv9N5Dk8lUli8G5Q6YzAE,13371
|
| 90 |
+
pip/_internal/commands/lock.py,sha256=bUYrryKa769UXM61imojoeVVgc_1ZHK-9a0hIJmmlCg,5941
|
| 91 |
+
pip/_internal/commands/search.py,sha256=IrfvxcRCSoZY9A5XAlCF1wtl_y2HPcXslQdHcjzwMNk,5784
|
| 92 |
+
pip/_internal/commands/show.py,sha256=Yh5rGYhR2Io5TkL0fFCMWE1VqqM4xhPHjhbdS3QgEac,8028
|
| 93 |
+
pip/_internal/commands/uninstall.py,sha256=7pOR7enK76gimyxQbzxcG1OsyLXL3DvX939xmM8Fvtg,3892
|
| 94 |
+
pip/_internal/commands/wheel.py,sha256=NEfaVF4f41VBNSn93RL8gkfCEDmdGhbP9xu_dE6cdUk,6346
|
| 95 |
+
pip/_internal/configuration.py,sha256=-KOok6jh3hFzXMPQFPJ1_EFjBpAsge-RSreQuLHLmzo,14005
|
| 96 |
+
pip/_internal/distributions/__init__.py,sha256=Hq6kt6gXBgjNit5hTTWLAzeCNOKoB-N0pGYSqehrli8,858
|
| 97 |
+
pip/_internal/distributions/__pycache__/__init__.cpython-313.pyc,,
|
| 98 |
+
pip/_internal/distributions/__pycache__/base.cpython-313.pyc,,
|
| 99 |
+
pip/_internal/distributions/__pycache__/installed.cpython-313.pyc,,
|
| 100 |
+
pip/_internal/distributions/__pycache__/sdist.cpython-313.pyc,,
|
| 101 |
+
pip/_internal/distributions/__pycache__/wheel.cpython-313.pyc,,
|
| 102 |
+
pip/_internal/distributions/base.py,sha256=QeB9qvKXDIjLdPBDE5fMgpfGqMMCr-govnuoQnGuiF8,1783
|
| 103 |
+
pip/_internal/distributions/installed.py,sha256=QinHFbWAQ8oE0pbD8MFZWkwlnfU1QYTccA1vnhrlYOU,842
|
| 104 |
+
pip/_internal/distributions/sdist.py,sha256=PlcP4a6-R6c98XnOM-b6Lkb3rsvh9iG4ok8shaanrzs,6751
|
| 105 |
+
pip/_internal/distributions/wheel.py,sha256=THBYfnv7VVt8mYhMYUtH13S1E7FDwtDyDfmUcl8ai0E,1317
|
| 106 |
+
pip/_internal/exceptions.py,sha256=wpE11H0e4L9G6AH70sRG149z82X7wX530HK-9eA_DIQ,28464
|
| 107 |
+
pip/_internal/index/__init__.py,sha256=tzwMH_fhQeubwMqHdSivasg1cRgTSbNg2CiMVnzMmyU,29
|
| 108 |
+
pip/_internal/index/__pycache__/__init__.cpython-313.pyc,,
|
| 109 |
+
pip/_internal/index/__pycache__/collector.cpython-313.pyc,,
|
| 110 |
+
pip/_internal/index/__pycache__/package_finder.cpython-313.pyc,,
|
| 111 |
+
pip/_internal/index/__pycache__/sources.cpython-313.pyc,,
|
| 112 |
+
pip/_internal/index/collector.py,sha256=RdPO0JLAlmyBWPAWYHPyRoGjz3GNAeTngCNkbGey_mE,16265
|
| 113 |
+
pip/_internal/index/package_finder.py,sha256=RohRzzLExoXl7QDdTiqyxIaQEcHUn6UNOr9KzC1vjL0,38446
|
| 114 |
+
pip/_internal/index/sources.py,sha256=lPBLK5Xiy8Q6IQMio26Wl7ocfZOKkgGklIBNyUJ23fI,8632
|
| 115 |
+
pip/_internal/locations/__init__.py,sha256=vvTMNxghT0aEXrSdqpNtuRDGx08bzJxfDAUUfQ0Vb0A,14309
|
| 116 |
+
pip/_internal/locations/__pycache__/__init__.cpython-313.pyc,,
|
| 117 |
+
pip/_internal/locations/__pycache__/_distutils.cpython-313.pyc,,
|
| 118 |
+
pip/_internal/locations/__pycache__/_sysconfig.cpython-313.pyc,,
|
| 119 |
+
pip/_internal/locations/__pycache__/base.cpython-313.pyc,,
|
| 120 |
+
pip/_internal/locations/_distutils.py,sha256=x6nyVLj7X11Y4khIdf-mFlxMl2FWadtVEgeb8upc_WI,6013
|
| 121 |
+
pip/_internal/locations/_sysconfig.py,sha256=IGzds60qsFneRogC-oeBaY7bEh3lPt_v47kMJChQXsU,7724
|
| 122 |
+
pip/_internal/locations/base.py,sha256=RQiPi1d4FVM2Bxk04dQhXZ2PqkeljEL2fZZ9SYqIQ78,2556
|
| 123 |
+
pip/_internal/main.py,sha256=r-UnUe8HLo5XFJz8inTcOOTiu_sxNhgHb6VwlGUllOI,340
|
| 124 |
+
pip/_internal/metadata/__init__.py,sha256=nGWuZvjQlIHudlMz_-bsUs2LDA2ZKNPGevZoEGcd64Y,5723
|
| 125 |
+
pip/_internal/metadata/__pycache__/__init__.cpython-313.pyc,,
|
| 126 |
+
pip/_internal/metadata/__pycache__/_json.cpython-313.pyc,,
|
| 127 |
+
pip/_internal/metadata/__pycache__/base.cpython-313.pyc,,
|
| 128 |
+
pip/_internal/metadata/__pycache__/pkg_resources.cpython-313.pyc,,
|
| 129 |
+
pip/_internal/metadata/_json.py,sha256=ezrIYazHCINM2QUk1eA9wEAMj3aeGWeDVgGalgUzKpc,2707
|
| 130 |
+
pip/_internal/metadata/base.py,sha256=jCbzdIc8MgWnPR4rfrvSQhSVzSoOyKOXhj3xe8BoG8c,25467
|
| 131 |
+
pip/_internal/metadata/importlib/__init__.py,sha256=jUUidoxnHcfITHHaAWG1G2i5fdBYklv_uJcjo2x7VYE,135
|
| 132 |
+
pip/_internal/metadata/importlib/__pycache__/__init__.cpython-313.pyc,,
|
| 133 |
+
pip/_internal/metadata/importlib/__pycache__/_compat.cpython-313.pyc,,
|
| 134 |
+
pip/_internal/metadata/importlib/__pycache__/_dists.cpython-313.pyc,,
|
| 135 |
+
pip/_internal/metadata/importlib/__pycache__/_envs.cpython-313.pyc,,
|
| 136 |
+
pip/_internal/metadata/importlib/_compat.py,sha256=c6av8sP8BBjAZuFSJow1iWfygUXNM3xRTCn5nqw6B9M,2796
|
| 137 |
+
pip/_internal/metadata/importlib/_dists.py,sha256=ftmYiyfUGUIjnVwt6W-Ijsimy5c28KgmXly5Q5IQ2P4,8279
|
| 138 |
+
pip/_internal/metadata/importlib/_envs.py,sha256=X63CkdAPJCYPhefYSLiQzPf9ijMXm5nL_A_Z68yp2-w,5297
|
| 139 |
+
pip/_internal/metadata/pkg_resources.py,sha256=U07ETAINSGeSRBfWUG93E4tZZbaW_f7PGzEqZN0hulc,10542
|
| 140 |
+
pip/_internal/models/__init__.py,sha256=AjmCEBxX_MH9f_jVjIGNCFJKYCYeSEe18yyvNx4uRKQ,62
|
| 141 |
+
pip/_internal/models/__pycache__/__init__.cpython-313.pyc,,
|
| 142 |
+
pip/_internal/models/__pycache__/candidate.cpython-313.pyc,,
|
| 143 |
+
pip/_internal/models/__pycache__/direct_url.cpython-313.pyc,,
|
| 144 |
+
pip/_internal/models/__pycache__/format_control.cpython-313.pyc,,
|
| 145 |
+
pip/_internal/models/__pycache__/index.cpython-313.pyc,,
|
| 146 |
+
pip/_internal/models/__pycache__/installation_report.cpython-313.pyc,,
|
| 147 |
+
pip/_internal/models/__pycache__/link.cpython-313.pyc,,
|
| 148 |
+
pip/_internal/models/__pycache__/pylock.cpython-313.pyc,,
|
| 149 |
+
pip/_internal/models/__pycache__/scheme.cpython-313.pyc,,
|
| 150 |
+
pip/_internal/models/__pycache__/search_scope.cpython-313.pyc,,
|
| 151 |
+
pip/_internal/models/__pycache__/selection_prefs.cpython-313.pyc,,
|
| 152 |
+
pip/_internal/models/__pycache__/target_python.cpython-313.pyc,,
|
| 153 |
+
pip/_internal/models/__pycache__/wheel.cpython-313.pyc,,
|
| 154 |
+
pip/_internal/models/candidate.py,sha256=zzgFRuw_kWPjKpGw7LC0ZUMD2CQ2EberUIYs8izjdCA,753
|
| 155 |
+
pip/_internal/models/direct_url.py,sha256=lJ1fIVTgk5UG5SzTNR0FpgSGAQjChlH-3otgiEJAhIs,6576
|
| 156 |
+
pip/_internal/models/format_control.py,sha256=wtsQqSK9HaUiNxQEuB-C62eVimw6G4_VQFxV9-_KDBE,2486
|
| 157 |
+
pip/_internal/models/index.py,sha256=tYnL8oxGi4aSNWur0mG8DAP7rC6yuha_MwJO8xw0crI,1030
|
| 158 |
+
pip/_internal/models/installation_report.py,sha256=zRVZoaz-2vsrezj_H3hLOhMZCK9c7TbzWgC-jOalD00,2818
|
| 159 |
+
pip/_internal/models/link.py,sha256=wIAgxhiu05ycLhbtAibknXX5L6X9ju_PPLVnMcvh9B4,21511
|
| 160 |
+
pip/_internal/models/pylock.py,sha256=n3-I26bf2v-Kn6qcx4ATB_Zel2SLhaUxZBmsMeGgYAo,6196
|
| 161 |
+
pip/_internal/models/scheme.py,sha256=PakmHJM3e8OOWSZFtfz1Az7f1meONJnkGuQxFlt3wBE,575
|
| 162 |
+
pip/_internal/models/search_scope.py,sha256=67NEnsYY84784S-MM7ekQuo9KXLH-7MzFntXjapvAo0,4531
|
| 163 |
+
pip/_internal/models/selection_prefs.py,sha256=qaFfDs3ciqoXPg6xx45N1jPLqccLJw4N0s4P0PyHTQ8,2015
|
| 164 |
+
pip/_internal/models/target_python.py,sha256=2XaH2rZ5ZF-K5wcJbEMGEl7SqrTToDDNkrtQ2v_v_-Q,4271
|
| 165 |
+
pip/_internal/models/wheel.py,sha256=10NUTXIRjf2P8oe1Wzolv8oUv7-YurrOduVFUIaDhdM,5506
|
| 166 |
+
pip/_internal/network/__init__.py,sha256=FMy06P__y6jMjUc8z3ZcQdKF-pmZ2zM14_vBeHPGhUI,49
|
| 167 |
+
pip/_internal/network/__pycache__/__init__.cpython-313.pyc,,
|
| 168 |
+
pip/_internal/network/__pycache__/auth.cpython-313.pyc,,
|
| 169 |
+
pip/_internal/network/__pycache__/cache.cpython-313.pyc,,
|
| 170 |
+
pip/_internal/network/__pycache__/download.cpython-313.pyc,,
|
| 171 |
+
pip/_internal/network/__pycache__/lazy_wheel.cpython-313.pyc,,
|
| 172 |
+
pip/_internal/network/__pycache__/session.cpython-313.pyc,,
|
| 173 |
+
pip/_internal/network/__pycache__/utils.cpython-313.pyc,,
|
| 174 |
+
pip/_internal/network/__pycache__/xmlrpc.cpython-313.pyc,,
|
| 175 |
+
pip/_internal/network/auth.py,sha256=D4gASjUrqoDFlSt6gQ767KAAjv6PUyJU0puDlhXNVRE,20809
|
| 176 |
+
pip/_internal/network/cache.py,sha256=JGYT-BUaSMdEBwII_K1UE6qyBItz7hzGkyLl_JRzkBY,4613
|
| 177 |
+
pip/_internal/network/download.py,sha256=6IdZyoERWIsXXFUFL_h_e_xi8Z0G0UlpkodPy8qKv2U,11078
|
| 178 |
+
pip/_internal/network/lazy_wheel.py,sha256=PBdoMoNQQIA84Fhgne38jWF52W4x_KtsHjxgv4dkRKA,7622
|
| 179 |
+
pip/_internal/network/session.py,sha256=msM4es16LmmNEYNkrYyg8fTc7gAHbKFltawfKP27LOI,18771
|
| 180 |
+
pip/_internal/network/utils.py,sha256=Inaxel-NxBu4PQWkjyErdnfewsFCcgHph7dzR1-FboY,4088
|
| 181 |
+
pip/_internal/network/xmlrpc.py,sha256=jW9oDSWamMld3iZOO9RbonVC8ZStkHyppCszoevkuJg,1837
|
| 182 |
+
pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 183 |
+
pip/_internal/operations/__pycache__/__init__.cpython-313.pyc,,
|
| 184 |
+
pip/_internal/operations/__pycache__/check.cpython-313.pyc,,
|
| 185 |
+
pip/_internal/operations/__pycache__/freeze.cpython-313.pyc,,
|
| 186 |
+
pip/_internal/operations/__pycache__/prepare.cpython-313.pyc,,
|
| 187 |
+
pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 188 |
+
pip/_internal/operations/build/__pycache__/__init__.cpython-313.pyc,,
|
| 189 |
+
pip/_internal/operations/build/__pycache__/build_tracker.cpython-313.pyc,,
|
| 190 |
+
pip/_internal/operations/build/__pycache__/metadata.cpython-313.pyc,,
|
| 191 |
+
pip/_internal/operations/build/__pycache__/metadata_editable.cpython-313.pyc,,
|
| 192 |
+
pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-313.pyc,,
|
| 193 |
+
pip/_internal/operations/build/__pycache__/wheel.cpython-313.pyc,,
|
| 194 |
+
pip/_internal/operations/build/__pycache__/wheel_editable.cpython-313.pyc,,
|
| 195 |
+
pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-313.pyc,,
|
| 196 |
+
pip/_internal/operations/build/build_tracker.py,sha256=-ARW_TcjHCOX7D2NUOGntB4Fgc6b4aolsXkAK6BWL7w,4774
|
| 197 |
+
pip/_internal/operations/build/metadata.py,sha256=INHaeiRfOiLYCXApfDNRo9Cw2xI4VwTc0KItvfdfOjk,1421
|
| 198 |
+
pip/_internal/operations/build/metadata_editable.py,sha256=oWudMsnjy4loO_Jy7g4N9nxsnaEX_iDlVRgCy7pu1rs,1509
|
| 199 |
+
pip/_internal/operations/build/metadata_legacy.py,sha256=wv8cFA0wTqF62Jlm9QwloYZsofOyQ7sWBBmvCcVvn1k,2189
|
| 200 |
+
pip/_internal/operations/build/wheel.py,sha256=sT12FBLAxDC6wyrDorh8kvcZ1jG5qInCRWzzP-UkJiQ,1075
|
| 201 |
+
pip/_internal/operations/build/wheel_editable.py,sha256=yOtoH6zpAkoKYEUtr8FhzrYnkNHQaQBjWQ2HYae1MQg,1417
|
| 202 |
+
pip/_internal/operations/build/wheel_legacy.py,sha256=KXpyGYoCQYcudXNZvohLXgWHaCk4Gf3z0dbS9ol4uu0,3620
|
| 203 |
+
pip/_internal/operations/check.py,sha256=4cnD_2eglsDe5s2CoYkxDt4HcRitTywzLMfTZ-tGQ4U,5911
|
| 204 |
+
pip/_internal/operations/freeze.py,sha256=1_M79jAQKnCxWr-KCCmHuVXOVFGaUJHmoWLfFzgh7K4,9843
|
| 205 |
+
pip/_internal/operations/install/__init__.py,sha256=ak-UETcQPKlFZaWoYKWu5QVXbpFBvg0sXc3i0O4vSYY,50
|
| 206 |
+
pip/_internal/operations/install/__pycache__/__init__.cpython-313.pyc,,
|
| 207 |
+
pip/_internal/operations/install/__pycache__/editable_legacy.cpython-313.pyc,,
|
| 208 |
+
pip/_internal/operations/install/__pycache__/wheel.cpython-313.pyc,,
|
| 209 |
+
pip/_internal/operations/install/editable_legacy.py,sha256=TI6wT8sLqDTprWZLYEOBOe7a6-1B9uwKb7kTBxLIaWY,1282
|
| 210 |
+
pip/_internal/operations/install/wheel.py,sha256=4NYSQ9ypl69iiduh5gUPCK3WNYqouTHZ0rMXoVgkiZw,27553
|
| 211 |
+
pip/_internal/operations/prepare.py,sha256=-i9dYwwJJjN7h6sZTabcz84tizgn7EAsY0sHnLAfs3Q,28363
|
| 212 |
+
pip/_internal/pyproject.py,sha256=GLJ6rWRS5_2noKdajohoLyDty57Z7QXhcUAYghmTnWc,7286
|
| 213 |
+
pip/_internal/req/__init__.py,sha256=dX2QGlfDwEqE5pLjOeM-f2qEgXFn6f2Vdi_zIHAYy1k,3096
|
| 214 |
+
pip/_internal/req/__pycache__/__init__.cpython-313.pyc,,
|
| 215 |
+
pip/_internal/req/__pycache__/constructors.cpython-313.pyc,,
|
| 216 |
+
pip/_internal/req/__pycache__/req_dependency_group.cpython-313.pyc,,
|
| 217 |
+
pip/_internal/req/__pycache__/req_file.cpython-313.pyc,,
|
| 218 |
+
pip/_internal/req/__pycache__/req_install.cpython-313.pyc,,
|
| 219 |
+
pip/_internal/req/__pycache__/req_set.cpython-313.pyc,,
|
| 220 |
+
pip/_internal/req/__pycache__/req_uninstall.cpython-313.pyc,,
|
| 221 |
+
pip/_internal/req/constructors.py,sha256=v1qzCN1mIldwx-nCrPc8JO4lxkm3Fv8M5RWvt8LISjc,18430
|
| 222 |
+
pip/_internal/req/req_dependency_group.py,sha256=5PGuZidqwDeTHZkP4tnNrlPrasfvJBONd1B5S0146zs,2677
|
| 223 |
+
pip/_internal/req/req_file.py,sha256=eys82McgaICOGic2UZRHjD720piKJPwmeSYdXlWwl6w,20234
|
| 224 |
+
pip/_internal/req/req_install.py,sha256=gMoFak9zrhjHlHaOQxPFheHKtIobppFgq1WrKel_nTE,35788
|
| 225 |
+
pip/_internal/req/req_set.py,sha256=j3esG0s6SzoVReX9rWn4rpYNtyET_fwxbwJPRimvRxo,2858
|
| 226 |
+
pip/_internal/req/req_uninstall.py,sha256=PQ6SyocDycUYsLAsTpjkbdwO_qjdo-y8BvQfZ5Avdrw,24075
|
| 227 |
+
pip/_internal/resolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 228 |
+
pip/_internal/resolution/__pycache__/__init__.cpython-313.pyc,,
|
| 229 |
+
pip/_internal/resolution/__pycache__/base.cpython-313.pyc,,
|
| 230 |
+
pip/_internal/resolution/base.py,sha256=qlmh325SBVfvG6Me9gc5Nsh5sdwHBwzHBq6aEXtKsLA,583
|
| 231 |
+
pip/_internal/resolution/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 232 |
+
pip/_internal/resolution/legacy/__pycache__/__init__.cpython-313.pyc,,
|
| 233 |
+
pip/_internal/resolution/legacy/__pycache__/resolver.cpython-313.pyc,,
|
| 234 |
+
pip/_internal/resolution/legacy/resolver.py,sha256=3HZiJBRd1FTN6jQpI4qRO8-TbLYeIbUTS6PFvXnXs2w,24068
|
| 235 |
+
pip/_internal/resolution/resolvelib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 236 |
+
pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-313.pyc,,
|
| 237 |
+
pip/_internal/resolution/resolvelib/__pycache__/base.cpython-313.pyc,,
|
| 238 |
+
pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-313.pyc,,
|
| 239 |
+
pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-313.pyc,,
|
| 240 |
+
pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-313.pyc,,
|
| 241 |
+
pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-313.pyc,,
|
| 242 |
+
pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-313.pyc,,
|
| 243 |
+
pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-313.pyc,,
|
| 244 |
+
pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-313.pyc,,
|
| 245 |
+
pip/_internal/resolution/resolvelib/base.py,sha256=DCf669FsqyQY5uqXeePDHQY1e4QO-pBzWH8O0s9-K94,5023
|
| 246 |
+
pip/_internal/resolution/resolvelib/candidates.py,sha256=U3Qp83jhM_RiJviyrlPCijbps6wYO6VsTDaTnCf_B3o,20241
|
| 247 |
+
pip/_internal/resolution/resolvelib/factory.py,sha256=FCvHc9M8UJ_7iU63QtPiHuq_BmfdnBiMJ8WaDBJNFxk,32668
|
| 248 |
+
pip/_internal/resolution/resolvelib/found_candidates.py,sha256=6lAF_pLQ2_Z0CBOHIFxGp6NfvT1uwIpCui6e-GgI5tk,6000
|
| 249 |
+
pip/_internal/resolution/resolvelib/provider.py,sha256=8ptYOOjfa336D4FZ751EQHR0LDq8jJhIGJXDou8Cv8Y,11190
|
| 250 |
+
pip/_internal/resolution/resolvelib/reporter.py,sha256=EwJAHOjWZ8eTHQWss7zJjmQEj6ooP6oWSwwVXFtgpqQ,3260
|
| 251 |
+
pip/_internal/resolution/resolvelib/requirements.py,sha256=7JG4Z72e5Yk4vU0S5ulGvbqTy4FMQGYhY5zQhX9zTtY,8065
|
| 252 |
+
pip/_internal/resolution/resolvelib/resolver.py,sha256=9zcR4c7UZV1j2ILTmb68Ck_5HdvQvf4cmTBE2bWHkKg,12785
|
| 253 |
+
pip/_internal/self_outdated_check.py,sha256=1PFtttvLAeyCVR3tPoBq2sOlPD0IJ-KSqU6bc1HUk9c,8318
|
| 254 |
+
pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 255 |
+
pip/_internal/utils/__pycache__/__init__.cpython-313.pyc,,
|
| 256 |
+
pip/_internal/utils/__pycache__/_jaraco_text.cpython-313.pyc,,
|
| 257 |
+
pip/_internal/utils/__pycache__/_log.cpython-313.pyc,,
|
| 258 |
+
pip/_internal/utils/__pycache__/appdirs.cpython-313.pyc,,
|
| 259 |
+
pip/_internal/utils/__pycache__/compat.cpython-313.pyc,,
|
| 260 |
+
pip/_internal/utils/__pycache__/compatibility_tags.cpython-313.pyc,,
|
| 261 |
+
pip/_internal/utils/__pycache__/datetime.cpython-313.pyc,,
|
| 262 |
+
pip/_internal/utils/__pycache__/deprecation.cpython-313.pyc,,
|
| 263 |
+
pip/_internal/utils/__pycache__/direct_url_helpers.cpython-313.pyc,,
|
| 264 |
+
pip/_internal/utils/__pycache__/egg_link.cpython-313.pyc,,
|
| 265 |
+
pip/_internal/utils/__pycache__/entrypoints.cpython-313.pyc,,
|
| 266 |
+
pip/_internal/utils/__pycache__/filesystem.cpython-313.pyc,,
|
| 267 |
+
pip/_internal/utils/__pycache__/filetypes.cpython-313.pyc,,
|
| 268 |
+
pip/_internal/utils/__pycache__/glibc.cpython-313.pyc,,
|
| 269 |
+
pip/_internal/utils/__pycache__/hashes.cpython-313.pyc,,
|
| 270 |
+
pip/_internal/utils/__pycache__/logging.cpython-313.pyc,,
|
| 271 |
+
pip/_internal/utils/__pycache__/misc.cpython-313.pyc,,
|
| 272 |
+
pip/_internal/utils/__pycache__/packaging.cpython-313.pyc,,
|
| 273 |
+
pip/_internal/utils/__pycache__/retry.cpython-313.pyc,,
|
| 274 |
+
pip/_internal/utils/__pycache__/setuptools_build.cpython-313.pyc,,
|
| 275 |
+
pip/_internal/utils/__pycache__/subprocess.cpython-313.pyc,,
|
| 276 |
+
pip/_internal/utils/__pycache__/temp_dir.cpython-313.pyc,,
|
| 277 |
+
pip/_internal/utils/__pycache__/unpacking.cpython-313.pyc,,
|
| 278 |
+
pip/_internal/utils/__pycache__/urls.cpython-313.pyc,,
|
| 279 |
+
pip/_internal/utils/__pycache__/virtualenv.cpython-313.pyc,,
|
| 280 |
+
pip/_internal/utils/__pycache__/wheel.cpython-313.pyc,,
|
| 281 |
+
pip/_internal/utils/_jaraco_text.py,sha256=M15uUPIh5NpP1tdUGBxRau6q1ZAEtI8-XyLEETscFfE,3350
|
| 282 |
+
pip/_internal/utils/_log.py,sha256=-jHLOE_THaZz5BFcCnoSL9EYAtJ0nXem49s9of4jvKw,1015
|
| 283 |
+
pip/_internal/utils/appdirs.py,sha256=zrIISCn2QxlXYw-zJZZBTrFNTyy_0WNKiI-TOoN6wJo,1705
|
| 284 |
+
pip/_internal/utils/compat.py,sha256=ckkFveBiYQjRWjkNsajt_oWPS57tJvE8XxoC4OIYgCY,2399
|
| 285 |
+
pip/_internal/utils/compatibility_tags.py,sha256=q5W7IrNlqC5ke0AqWRG6aX5pimiqh--xuPCCNwCKPsU,6662
|
| 286 |
+
pip/_internal/utils/datetime.py,sha256=Gt29Ml4ToPSM88j54iu43WKtrU9A-moP4QmMiiqzedU,241
|
| 287 |
+
pip/_internal/utils/deprecation.py,sha256=k7Qg_UBAaaTdyq82YVARA6D7RmcGTXGv7fnfcgigj4Q,3707
|
| 288 |
+
pip/_internal/utils/direct_url_helpers.py,sha256=r2MRtkVDACv9AGqYODBUC9CjwgtsUU1s68hmgfCJMtA,3196
|
| 289 |
+
pip/_internal/utils/egg_link.py,sha256=0FePZoUYKv4RGQ2t6x7w5Z427wbA_Uo3WZnAkrgsuqo,2463
|
| 290 |
+
pip/_internal/utils/entrypoints.py,sha256=4CheZ81OBPPLb3Gn-X_WEPtllUibpwDVzlVQ4RFh7PM,3325
|
| 291 |
+
pip/_internal/utils/filesystem.py,sha256=ajvA-q4ocliW9kPp8Yquh-4vssXbu-UKbo5FV9V4X64,4950
|
| 292 |
+
pip/_internal/utils/filetypes.py,sha256=OCPzUxq3Aa6k_95MiI8DYgkOzutTs47fA-v-vYUJp9E,715
|
| 293 |
+
pip/_internal/utils/glibc.py,sha256=vUkWq_1pJuzcYNcGKLlQmABoUiisK8noYY1yc8Wq4w4,3734
|
| 294 |
+
pip/_internal/utils/hashes.py,sha256=XGGLL0AG8-RhWnyz87xF6MFZ--BKadHU35D47eApCKI,4972
|
| 295 |
+
pip/_internal/utils/logging.py,sha256=zMZK1NxfhM4QMGUyaU9q1grNuDhLSVbSkGCvZBKmaPw,12076
|
| 296 |
+
pip/_internal/utils/misc.py,sha256=DWnYxBUItjRp7hhxEg4ih6P6YpKrykM86dbi_EcU8SQ,23450
|
| 297 |
+
pip/_internal/utils/packaging.py,sha256=CjJOqLNENW-U88ojOllVL40f1ab2W2Bm3KHCavwNNfw,1603
|
| 298 |
+
pip/_internal/utils/retry.py,sha256=mhFbykXjhTnZfgzeuy-vl9c8nECnYn_CMtwNJX2tYzQ,1392
|
| 299 |
+
pip/_internal/utils/setuptools_build.py,sha256=J9EyRantVgu4V-xS_qfQy2mcPLVUM7A-227QdKGUZCA,4482
|
| 300 |
+
pip/_internal/utils/subprocess.py,sha256=EsvqSRiSMHF98T8Txmu6NLU3U--MpTTQjtNgKP0P--M,8988
|
| 301 |
+
pip/_internal/utils/temp_dir.py,sha256=5qOXe8M4JeY6vaFQM867d5zkp1bSwMZ-KT5jymmP0Zg,9310
|
| 302 |
+
pip/_internal/utils/unpacking.py,sha256=4yCqlRAI2zxl5tfxlnLoWLNcEn-k1c3vaet_oaJ42iI,11926
|
| 303 |
+
pip/_internal/utils/urls.py,sha256=qceSOZb5lbNDrHNsv7_S4L4Ytszja5NwPKUMnZHbYnM,1599
|
| 304 |
+
pip/_internal/utils/virtualenv.py,sha256=S6f7csYorRpiD6cvn3jISZYc3I8PJC43H5iMFpRAEDU,3456
|
| 305 |
+
pip/_internal/utils/wheel.py,sha256=MHObYn6d7VyZL10i-W1xoJZ2hT5-wB1WkII70AsYUE8,4493
|
| 306 |
+
pip/_internal/vcs/__init__.py,sha256=UAqvzpbi0VbZo3Ub6skEeZAw-ooIZR-zX_WpCbxyCoU,596
|
| 307 |
+
pip/_internal/vcs/__pycache__/__init__.cpython-313.pyc,,
|
| 308 |
+
pip/_internal/vcs/__pycache__/bazaar.cpython-313.pyc,,
|
| 309 |
+
pip/_internal/vcs/__pycache__/git.cpython-313.pyc,,
|
| 310 |
+
pip/_internal/vcs/__pycache__/mercurial.cpython-313.pyc,,
|
| 311 |
+
pip/_internal/vcs/__pycache__/subversion.cpython-313.pyc,,
|
| 312 |
+
pip/_internal/vcs/__pycache__/versioncontrol.cpython-313.pyc,,
|
| 313 |
+
pip/_internal/vcs/bazaar.py,sha256=EKStcQaKpNu0NK4p5Q10Oc4xb3DUxFw024XrJy40bFQ,3528
|
| 314 |
+
pip/_internal/vcs/git.py,sha256=3KLPrKsDL9xZchmz4H1Obo8fM2Fh8ChrhtDHWjbkj-I,18591
|
| 315 |
+
pip/_internal/vcs/mercurial.py,sha256=oULOhzJ2Uie-06d1omkL-_Gc6meGaUkyogvqG9ZCyPs,5249
|
| 316 |
+
pip/_internal/vcs/subversion.py,sha256=ddTugHBqHzV3ebKlU5QXHPN4gUqlyXbOx8q8NgXKvs8,11735
|
| 317 |
+
pip/_internal/vcs/versioncontrol.py,sha256=cvf_-hnTAjQLXJ3d17FMNhQfcO1AcKWUF10tfrYyP-c,22440
|
| 318 |
+
pip/_internal/wheel_builder.py,sha256=Z5Z2ANADbKdSHY9BHqw9zG5-1AxstO6YM6m9yLWe7Vw,11212
|
| 319 |
+
pip/_vendor/__init__.py,sha256=WzusPTGWIMeQQWSVJ0h2rafGkVTa9WKJ2HT-2-EoZrU,4907
|
| 320 |
+
pip/_vendor/__pycache__/__init__.cpython-313.pyc,,
|
| 321 |
+
pip/_vendor/__pycache__/typing_extensions.cpython-313.pyc,,
|
| 322 |
+
pip/_vendor/cachecontrol/__init__.py,sha256=x9ecUkiwNvAGfE3g0eaRx3VrJZnZWAluA2LRcvab3HQ,677
|
| 323 |
+
pip/_vendor/cachecontrol/__pycache__/__init__.cpython-313.pyc,,
|
| 324 |
+
pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-313.pyc,,
|
| 325 |
+
pip/_vendor/cachecontrol/__pycache__/adapter.cpython-313.pyc,,
|
| 326 |
+
pip/_vendor/cachecontrol/__pycache__/cache.cpython-313.pyc,,
|
| 327 |
+
pip/_vendor/cachecontrol/__pycache__/controller.cpython-313.pyc,,
|
| 328 |
+
pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-313.pyc,,
|
| 329 |
+
pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-313.pyc,,
|
| 330 |
+
pip/_vendor/cachecontrol/__pycache__/serialize.cpython-313.pyc,,
|
| 331 |
+
pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-313.pyc,,
|
| 332 |
+
pip/_vendor/cachecontrol/_cmd.py,sha256=iist2EpzJvDVIhMAxXq8iFnTBsiZAd6iplxfmNboNyk,1737
|
| 333 |
+
pip/_vendor/cachecontrol/adapter.py,sha256=8y6rTPXOzVHmDKCW5CR9sivLVuDv-cpdGcZYdRWNaPw,6599
|
| 334 |
+
pip/_vendor/cachecontrol/cache.py,sha256=OXwv7Fn2AwnKNiahJHnjtvaKLndvVLv_-zO-ltlV9qI,1953
|
| 335 |
+
pip/_vendor/cachecontrol/caches/__init__.py,sha256=dtrrroK5BnADR1GWjCZ19aZ0tFsMfvFBtLQQU1sp_ag,303
|
| 336 |
+
pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-313.pyc,,
|
| 337 |
+
pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-313.pyc,,
|
| 338 |
+
pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-313.pyc,,
|
| 339 |
+
pip/_vendor/cachecontrol/caches/file_cache.py,sha256=d8upFmy_zwaCmlbWEVBlLXFddt8Zw8c5SFpxeOZsdfw,4117
|
| 340 |
+
pip/_vendor/cachecontrol/caches/redis_cache.py,sha256=9rmqwtYu_ljVkW6_oLqbC7EaX_a8YT_yLuna-eS0dgo,1386
|
| 341 |
+
pip/_vendor/cachecontrol/controller.py,sha256=cx0Hl8xLZgUuXuy78Gih9AYjCtqurmYjVJxyA4yWt7w,19101
|
| 342 |
+
pip/_vendor/cachecontrol/filewrapper.py,sha256=2ktXNPE0KqnyzF24aOsKCA58HQq1xeC6l2g6_zwjghc,4291
|
| 343 |
+
pip/_vendor/cachecontrol/heuristics.py,sha256=gqMXU8w0gQuEQiSdu3Yg-0vd9kW7nrWKbLca75rheGE,4881
|
| 344 |
+
pip/_vendor/cachecontrol/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 345 |
+
pip/_vendor/cachecontrol/serialize.py,sha256=HQd2IllQ05HzPkVLMXTF2uX5mjEQjDBkxCqUJUODpZk,5163
|
| 346 |
+
pip/_vendor/cachecontrol/wrapper.py,sha256=hsGc7g8QGQTT-4f8tgz3AM5qwScg6FO0BSdLSRdEvpU,1417
|
| 347 |
+
pip/_vendor/certifi/__init__.py,sha256=neIaAf7BM36ygmQCmy-ZsSyjnvjWghFeu13wwEAnjj0,94
|
| 348 |
+
pip/_vendor/certifi/__main__.py,sha256=1k3Cr95vCxxGRGDljrW3wMdpZdL3Nhf0u1n-k2qdsCY,255
|
| 349 |
+
pip/_vendor/certifi/__pycache__/__init__.cpython-313.pyc,,
|
| 350 |
+
pip/_vendor/certifi/__pycache__/__main__.cpython-313.pyc,,
|
| 351 |
+
pip/_vendor/certifi/__pycache__/core.cpython-313.pyc,,
|
| 352 |
+
pip/_vendor/certifi/cacert.pem,sha256=xVsh-Qf3-G1IrdCTVS-1ZRdJ_1-GBQjMu0I9bB-9gMc,297255
|
| 353 |
+
pip/_vendor/certifi/core.py,sha256=vHXkYJt_CVYbDuS-aPFRfDZu7RkKcP9ltm-DiL4Zo30,4738
|
| 354 |
+
pip/_vendor/certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 355 |
+
pip/_vendor/dependency_groups/__init__.py,sha256=C3OFu0NGwDzQ4LOmmSOFPsRSvkbBn-mdd4j_5YqJw-s,250
|
| 356 |
+
pip/_vendor/dependency_groups/__main__.py,sha256=UNTM7P5mfVtT7wDi9kOTXWgV3fu3e8bTrt1Qp1jvjKo,1709
|
| 357 |
+
pip/_vendor/dependency_groups/__pycache__/__init__.cpython-313.pyc,,
|
| 358 |
+
pip/_vendor/dependency_groups/__pycache__/__main__.cpython-313.pyc,,
|
| 359 |
+
pip/_vendor/dependency_groups/__pycache__/_implementation.cpython-313.pyc,,
|
| 360 |
+
pip/_vendor/dependency_groups/__pycache__/_lint_dependency_groups.cpython-313.pyc,,
|
| 361 |
+
pip/_vendor/dependency_groups/__pycache__/_pip_wrapper.cpython-313.pyc,,
|
| 362 |
+
pip/_vendor/dependency_groups/__pycache__/_toml_compat.cpython-313.pyc,,
|
| 363 |
+
pip/_vendor/dependency_groups/_implementation.py,sha256=Gqb2DlQELRakeHlKf6QtQSW0M-bcEomxHw4JsvID1ls,8041
|
| 364 |
+
pip/_vendor/dependency_groups/_lint_dependency_groups.py,sha256=yp-DDqKXtbkDTNa0ifa-FmOA8ra24lPZEXftW-R5AuI,1710
|
| 365 |
+
pip/_vendor/dependency_groups/_pip_wrapper.py,sha256=nuVW_w_ntVxpE26ELEvngMY0N04sFLsijXRyZZROFG8,1865
|
| 366 |
+
pip/_vendor/dependency_groups/_toml_compat.py,sha256=BHnXnFacm3DeolsA35GjI6qkDApvua-1F20kv3BfZWE,285
|
| 367 |
+
pip/_vendor/dependency_groups/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 368 |
+
pip/_vendor/distlib/__init__.py,sha256=dcwgYGYGQqAEawBXPDtIx80DO_3cOmFv8HTc8JMzknQ,625
|
| 369 |
+
pip/_vendor/distlib/__pycache__/__init__.cpython-313.pyc,,
|
| 370 |
+
pip/_vendor/distlib/__pycache__/compat.cpython-313.pyc,,
|
| 371 |
+
pip/_vendor/distlib/__pycache__/database.cpython-313.pyc,,
|
| 372 |
+
pip/_vendor/distlib/__pycache__/index.cpython-313.pyc,,
|
| 373 |
+
pip/_vendor/distlib/__pycache__/locators.cpython-313.pyc,,
|
| 374 |
+
pip/_vendor/distlib/__pycache__/manifest.cpython-313.pyc,,
|
| 375 |
+
pip/_vendor/distlib/__pycache__/markers.cpython-313.pyc,,
|
| 376 |
+
pip/_vendor/distlib/__pycache__/metadata.cpython-313.pyc,,
|
| 377 |
+
pip/_vendor/distlib/__pycache__/resources.cpython-313.pyc,,
|
| 378 |
+
pip/_vendor/distlib/__pycache__/scripts.cpython-313.pyc,,
|
| 379 |
+
pip/_vendor/distlib/__pycache__/util.cpython-313.pyc,,
|
| 380 |
+
pip/_vendor/distlib/__pycache__/version.cpython-313.pyc,,
|
| 381 |
+
pip/_vendor/distlib/__pycache__/wheel.cpython-313.pyc,,
|
| 382 |
+
pip/_vendor/distlib/compat.py,sha256=2jRSjRI4o-vlXeTK2BCGIUhkc6e9ZGhSsacRM5oseTw,41467
|
| 383 |
+
pip/_vendor/distlib/database.py,sha256=mHy_LxiXIsIVRb-T0-idBrVLw3Ffij5teHCpbjmJ9YU,51160
|
| 384 |
+
pip/_vendor/distlib/index.py,sha256=lTbw268rRhj8dw1sib3VZ_0EhSGgoJO3FKJzSFMOaeA,20797
|
| 385 |
+
pip/_vendor/distlib/locators.py,sha256=oBeAZpFuPQSY09MgNnLfQGGAXXvVO96BFpZyKMuK4tM,51026
|
| 386 |
+
pip/_vendor/distlib/manifest.py,sha256=3qfmAmVwxRqU1o23AlfXrQGZzh6g_GGzTAP_Hb9C5zQ,14168
|
| 387 |
+
pip/_vendor/distlib/markers.py,sha256=X6sDvkFGcYS8gUW8hfsWuKEKAqhQZAJ7iXOMLxRYjYk,5164
|
| 388 |
+
pip/_vendor/distlib/metadata.py,sha256=zil3sg2EUfLXVigljY2d_03IJt-JSs7nX-73fECMX2s,38724
|
| 389 |
+
pip/_vendor/distlib/resources.py,sha256=LwbPksc0A1JMbi6XnuPdMBUn83X7BPuFNWqPGEKI698,10820
|
| 390 |
+
pip/_vendor/distlib/scripts.py,sha256=BJliaDAZaVB7WAkwokgC3HXwLD2iWiHaVI50H7C6eG8,18608
|
| 391 |
+
pip/_vendor/distlib/util.py,sha256=vMPGvsS4j9hF6Y9k3Tyom1aaHLb0rFmZAEyzeAdel9w,66682
|
| 392 |
+
pip/_vendor/distlib/version.py,sha256=s5VIs8wBn0fxzGxWM_aA2ZZyx525HcZbMvcTlTyZ3Rg,23727
|
| 393 |
+
pip/_vendor/distlib/wheel.py,sha256=DFIVguEQHCdxnSdAO0dfFsgMcvVZitg7bCOuLwZ7A_s,43979
|
| 394 |
+
pip/_vendor/distro/__init__.py,sha256=2fHjF-SfgPvjyNZ1iHh_wjqWdR_Yo5ODHwZC0jLBPhc,981
|
| 395 |
+
pip/_vendor/distro/__main__.py,sha256=bu9d3TifoKciZFcqRBuygV3GSuThnVD_m2IK4cz96Vs,64
|
| 396 |
+
pip/_vendor/distro/__pycache__/__init__.cpython-313.pyc,,
|
| 397 |
+
pip/_vendor/distro/__pycache__/__main__.cpython-313.pyc,,
|
| 398 |
+
pip/_vendor/distro/__pycache__/distro.cpython-313.pyc,,
|
| 399 |
+
pip/_vendor/distro/distro.py,sha256=XqbefacAhDT4zr_trnbA15eY8vdK4GTghgmvUGrEM_4,49430
|
| 400 |
+
pip/_vendor/distro/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 401 |
+
pip/_vendor/idna/__init__.py,sha256=MPqNDLZbXqGaNdXxAFhiqFPKEQXju2jNQhCey6-5eJM,868
|
| 402 |
+
pip/_vendor/idna/__pycache__/__init__.cpython-313.pyc,,
|
| 403 |
+
pip/_vendor/idna/__pycache__/codec.cpython-313.pyc,,
|
| 404 |
+
pip/_vendor/idna/__pycache__/compat.cpython-313.pyc,,
|
| 405 |
+
pip/_vendor/idna/__pycache__/core.cpython-313.pyc,,
|
| 406 |
+
pip/_vendor/idna/__pycache__/idnadata.cpython-313.pyc,,
|
| 407 |
+
pip/_vendor/idna/__pycache__/intranges.cpython-313.pyc,,
|
| 408 |
+
pip/_vendor/idna/__pycache__/package_data.cpython-313.pyc,,
|
| 409 |
+
pip/_vendor/idna/__pycache__/uts46data.cpython-313.pyc,,
|
| 410 |
+
pip/_vendor/idna/codec.py,sha256=PEew3ItwzjW4hymbasnty2N2OXvNcgHB-JjrBuxHPYY,3422
|
| 411 |
+
pip/_vendor/idna/compat.py,sha256=RzLy6QQCdl9784aFhb2EX9EKGCJjg0P3PilGdeXXcx8,316
|
| 412 |
+
pip/_vendor/idna/core.py,sha256=YJYyAMnwiQEPjVC4-Fqu_p4CJ6yKKuDGmppBNQNQpFs,13239
|
| 413 |
+
pip/_vendor/idna/idnadata.py,sha256=W30GcIGvtOWYwAjZj4ZjuouUutC6ffgNuyjJy7fZ-lo,78306
|
| 414 |
+
pip/_vendor/idna/intranges.py,sha256=amUtkdhYcQG8Zr-CoMM_kVRacxkivC1WgxN1b63KKdU,1898
|
| 415 |
+
pip/_vendor/idna/package_data.py,sha256=q59S3OXsc5VI8j6vSD0sGBMyk6zZ4vWFREE88yCJYKs,21
|
| 416 |
+
pip/_vendor/idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 417 |
+
pip/_vendor/idna/uts46data.py,sha256=rt90K9J40gUSwppDPCrhjgi5AA6pWM65dEGRSf6rIhM,239289
|
| 418 |
+
pip/_vendor/msgpack/__init__.py,sha256=reRaiOtEzSjPnr7TpxjgIvbfln5pV66FhricAs2eC-g,1109
|
| 419 |
+
pip/_vendor/msgpack/__pycache__/__init__.cpython-313.pyc,,
|
| 420 |
+
pip/_vendor/msgpack/__pycache__/exceptions.cpython-313.pyc,,
|
| 421 |
+
pip/_vendor/msgpack/__pycache__/ext.cpython-313.pyc,,
|
| 422 |
+
pip/_vendor/msgpack/__pycache__/fallback.cpython-313.pyc,,
|
| 423 |
+
pip/_vendor/msgpack/exceptions.py,sha256=dCTWei8dpkrMsQDcjQk74ATl9HsIBH0ybt8zOPNqMYc,1081
|
| 424 |
+
pip/_vendor/msgpack/ext.py,sha256=kteJv03n9tYzd5oo3xYopVTo4vRaAxonBQQJhXohZZo,5726
|
| 425 |
+
pip/_vendor/msgpack/fallback.py,sha256=0g1Pzp0vtmBEmJ5w9F3s_-JMVURP8RS4G1cc5TRaAsI,32390
|
| 426 |
+
pip/_vendor/packaging/__init__.py,sha256=_0cDiPVf2S-bNfVmZguxxzmrIYWlyASxpqph4qsJWUc,494
|
| 427 |
+
pip/_vendor/packaging/__pycache__/__init__.cpython-313.pyc,,
|
| 428 |
+
pip/_vendor/packaging/__pycache__/_elffile.cpython-313.pyc,,
|
| 429 |
+
pip/_vendor/packaging/__pycache__/_manylinux.cpython-313.pyc,,
|
| 430 |
+
pip/_vendor/packaging/__pycache__/_musllinux.cpython-313.pyc,,
|
| 431 |
+
pip/_vendor/packaging/__pycache__/_parser.cpython-313.pyc,,
|
| 432 |
+
pip/_vendor/packaging/__pycache__/_structures.cpython-313.pyc,,
|
| 433 |
+
pip/_vendor/packaging/__pycache__/_tokenizer.cpython-313.pyc,,
|
| 434 |
+
pip/_vendor/packaging/__pycache__/markers.cpython-313.pyc,,
|
| 435 |
+
pip/_vendor/packaging/__pycache__/metadata.cpython-313.pyc,,
|
| 436 |
+
pip/_vendor/packaging/__pycache__/requirements.cpython-313.pyc,,
|
| 437 |
+
pip/_vendor/packaging/__pycache__/specifiers.cpython-313.pyc,,
|
| 438 |
+
pip/_vendor/packaging/__pycache__/tags.cpython-313.pyc,,
|
| 439 |
+
pip/_vendor/packaging/__pycache__/utils.cpython-313.pyc,,
|
| 440 |
+
pip/_vendor/packaging/__pycache__/version.cpython-313.pyc,,
|
| 441 |
+
pip/_vendor/packaging/_elffile.py,sha256=UkrbDtW7aeq3qqoAfU16ojyHZ1xsTvGke_WqMTKAKd0,3286
|
| 442 |
+
pip/_vendor/packaging/_manylinux.py,sha256=t4y_-dTOcfr36gLY-ztiOpxxJFGO2ikC11HgfysGxiM,9596
|
| 443 |
+
pip/_vendor/packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694
|
| 444 |
+
pip/_vendor/packaging/_parser.py,sha256=gYfnj0pRHflVc4RHZit13KNTyN9iiVcU2RUCGi22BwM,10221
|
| 445 |
+
pip/_vendor/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
|
| 446 |
+
pip/_vendor/packaging/_tokenizer.py,sha256=OYzt7qKxylOAJ-q0XyK1qAycyPRYLfMPdGQKRXkZWyI,5310
|
| 447 |
+
pip/_vendor/packaging/licenses/__init__.py,sha256=3bx-gryo4sRv5LsrwApouy65VIs3u6irSORJzALkrzU,5727
|
| 448 |
+
pip/_vendor/packaging/licenses/__pycache__/__init__.cpython-313.pyc,,
|
| 449 |
+
pip/_vendor/packaging/licenses/__pycache__/_spdx.cpython-313.pyc,,
|
| 450 |
+
pip/_vendor/packaging/licenses/_spdx.py,sha256=oAm1ztPFwlsmCKe7lAAsv_OIOfS1cWDu9bNBkeu-2ns,48398
|
| 451 |
+
pip/_vendor/packaging/markers.py,sha256=P0we27jm1xUzgGMJxBjtUFCIWeBxTsMeJTOJ6chZmAY,12049
|
| 452 |
+
pip/_vendor/packaging/metadata.py,sha256=8IZErqQQnNm53dZZuYq4FGU4_dpyinMeH1QFBIWIkfE,34739
|
| 453 |
+
pip/_vendor/packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 454 |
+
pip/_vendor/packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947
|
| 455 |
+
pip/_vendor/packaging/specifiers.py,sha256=yc9D_MycJEmwUpZvcs1OZL9HfiNFmyw0RZaeHRNHkPw,40079
|
| 456 |
+
pip/_vendor/packaging/tags.py,sha256=41s97W9Zatrq2Ed7Rc3qeBDaHe8pKKvYq2mGjwahfXk,22745
|
| 457 |
+
pip/_vendor/packaging/utils.py,sha256=0F3Hh9OFuRgrhTgGZUl5K22Fv1YP2tZl1z_2gO6kJiA,5050
|
| 458 |
+
pip/_vendor/packaging/version.py,sha256=oiHqzTUv_p12hpjgsLDVcaF5hT7pDaSOViUNMD4GTW0,16688
|
| 459 |
+
pip/_vendor/pkg_resources/__init__.py,sha256=jrhDRbOubP74QuPXxd7U7Po42PH2l-LZ2XfcO7llpZ4,124463
|
| 460 |
+
pip/_vendor/pkg_resources/__pycache__/__init__.cpython-313.pyc,,
|
| 461 |
+
pip/_vendor/platformdirs/__init__.py,sha256=UfeSHWl8AeTtbOBOoHAxK4dODOWkZtfy-m_i7cWdJ8c,22344
|
| 462 |
+
pip/_vendor/platformdirs/__main__.py,sha256=jBJ8zb7Mpx5ebcqF83xrpO94MaeCpNGHVf9cvDN2JLg,1505
|
| 463 |
+
pip/_vendor/platformdirs/__pycache__/__init__.cpython-313.pyc,,
|
| 464 |
+
pip/_vendor/platformdirs/__pycache__/__main__.cpython-313.pyc,,
|
| 465 |
+
pip/_vendor/platformdirs/__pycache__/android.cpython-313.pyc,,
|
| 466 |
+
pip/_vendor/platformdirs/__pycache__/api.cpython-313.pyc,,
|
| 467 |
+
pip/_vendor/platformdirs/__pycache__/macos.cpython-313.pyc,,
|
| 468 |
+
pip/_vendor/platformdirs/__pycache__/unix.cpython-313.pyc,,
|
| 469 |
+
pip/_vendor/platformdirs/__pycache__/version.cpython-313.pyc,,
|
| 470 |
+
pip/_vendor/platformdirs/__pycache__/windows.cpython-313.pyc,,
|
| 471 |
+
pip/_vendor/platformdirs/android.py,sha256=r0DshVBf-RO1jXJGX8C4Til7F1XWt-bkdWMgmvEiaYg,9013
|
| 472 |
+
pip/_vendor/platformdirs/api.py,sha256=U9EzI3EYxcXWUCtIGRllqrcN99i2LSY1mq2-GtsUwEQ,9277
|
| 473 |
+
pip/_vendor/platformdirs/macos.py,sha256=UlbyFZ8Rzu3xndCqQEHrfsYTeHwYdFap1Ioz-yxveT4,6154
|
| 474 |
+
pip/_vendor/platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 475 |
+
pip/_vendor/platformdirs/unix.py,sha256=WZmkUA--L3JNRGmz32s35YfoD3ica6xKIPdCV_HhLcs,10458
|
| 476 |
+
pip/_vendor/platformdirs/version.py,sha256=0fnw4ljascx7O5PfIeZ2yj6w3pAkqwp099vDcivxuvY,511
|
| 477 |
+
pip/_vendor/platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125
|
| 478 |
+
pip/_vendor/pygments/__init__.py,sha256=qMm7-KYqNpMrmjymZaqfH-_9iJtjnexAKodkb9G5D5g,2983
|
| 479 |
+
pip/_vendor/pygments/__main__.py,sha256=WrndpSe6i1ckX_SQ1KaxD9CTKGzD0EuCOFxcbwFpoLU,353
|
| 480 |
+
pip/_vendor/pygments/__pycache__/__init__.cpython-313.pyc,,
|
| 481 |
+
pip/_vendor/pygments/__pycache__/__main__.cpython-313.pyc,,
|
| 482 |
+
pip/_vendor/pygments/__pycache__/console.cpython-313.pyc,,
|
| 483 |
+
pip/_vendor/pygments/__pycache__/filter.cpython-313.pyc,,
|
| 484 |
+
pip/_vendor/pygments/__pycache__/formatter.cpython-313.pyc,,
|
| 485 |
+
pip/_vendor/pygments/__pycache__/lexer.cpython-313.pyc,,
|
| 486 |
+
pip/_vendor/pygments/__pycache__/modeline.cpython-313.pyc,,
|
| 487 |
+
pip/_vendor/pygments/__pycache__/plugin.cpython-313.pyc,,
|
| 488 |
+
pip/_vendor/pygments/__pycache__/regexopt.cpython-313.pyc,,
|
| 489 |
+
pip/_vendor/pygments/__pycache__/scanner.cpython-313.pyc,,
|
| 490 |
+
pip/_vendor/pygments/__pycache__/sphinxext.cpython-313.pyc,,
|
| 491 |
+
pip/_vendor/pygments/__pycache__/style.cpython-313.pyc,,
|
| 492 |
+
pip/_vendor/pygments/__pycache__/token.cpython-313.pyc,,
|
| 493 |
+
pip/_vendor/pygments/__pycache__/unistring.cpython-313.pyc,,
|
| 494 |
+
pip/_vendor/pygments/__pycache__/util.cpython-313.pyc,,
|
| 495 |
+
pip/_vendor/pygments/console.py,sha256=AagDWqwea2yBWf10KC9ptBgMpMjxKp8yABAmh-NQOVk,1718
|
| 496 |
+
pip/_vendor/pygments/filter.py,sha256=YLtpTnZiu07nY3oK9nfR6E9Y1FBHhP5PX8gvkJWcfag,1910
|
| 497 |
+
pip/_vendor/pygments/filters/__init__.py,sha256=4U4jtA0X3iP83uQnB9-TI-HDSw8E8y8zMYHa0UjbbaI,40392
|
| 498 |
+
pip/_vendor/pygments/filters/__pycache__/__init__.cpython-313.pyc,,
|
| 499 |
+
pip/_vendor/pygments/formatter.py,sha256=KZQMmyo_xkOIkQG8g66LYEkBh1bx7a0HyGCBcvhI9Ew,4390
|
| 500 |
+
pip/_vendor/pygments/formatters/__init__.py,sha256=KTwBmnXlaopJhQDOemVHYHskiDghuq-08YtP6xPNJPg,5385
|
| 501 |
+
pip/_vendor/pygments/formatters/__pycache__/__init__.cpython-313.pyc,,
|
| 502 |
+
pip/_vendor/pygments/formatters/__pycache__/_mapping.cpython-313.pyc,,
|
| 503 |
+
pip/_vendor/pygments/formatters/_mapping.py,sha256=1Cw37FuQlNacnxRKmtlPX4nyLoX9_ttko5ZwscNUZZ4,4176
|
| 504 |
+
pip/_vendor/pygments/lexer.py,sha256=_kBrOJ_NT5Tl0IVM0rA9c8eysP6_yrlGzEQI0eVYB-A,35349
|
| 505 |
+
pip/_vendor/pygments/lexers/__init__.py,sha256=wbIME35GH7bI1B9rNPJFqWT-ij_RApZDYPUlZycaLzA,12115
|
| 506 |
+
pip/_vendor/pygments/lexers/__pycache__/__init__.cpython-313.pyc,,
|
| 507 |
+
pip/_vendor/pygments/lexers/__pycache__/_mapping.cpython-313.pyc,,
|
| 508 |
+
pip/_vendor/pygments/lexers/__pycache__/python.cpython-313.pyc,,
|
| 509 |
+
pip/_vendor/pygments/lexers/_mapping.py,sha256=l4tCXM8e9aPC2BD6sjIr0deT-J-z5tHgCwL-p1fS0PE,77602
|
| 510 |
+
pip/_vendor/pygments/lexers/python.py,sha256=vxjn1cOHclIKJKxoyiBsQTY65GHbkZtZRuKQ2AVCKaw,53853
|
| 511 |
+
pip/_vendor/pygments/modeline.py,sha256=K5eSkR8GS1r5OkXXTHOcV0aM_6xpk9eWNEIAW-OOJ2g,1005
|
| 512 |
+
pip/_vendor/pygments/plugin.py,sha256=tPx0rJCTIZ9ioRgLNYG4pifCbAwTRUZddvLw-NfAk2w,1891
|
| 513 |
+
pip/_vendor/pygments/regexopt.py,sha256=wXaP9Gjp_hKAdnICqoDkRxAOQJSc4v3X6mcxx3z-TNs,3072
|
| 514 |
+
pip/_vendor/pygments/scanner.py,sha256=nNcETRR1tRuiTaHmHSTTECVYFPcLf6mDZu1e4u91A9E,3092
|
| 515 |
+
pip/_vendor/pygments/sphinxext.py,sha256=5x7Zh9YlU6ISJ31dMwduiaanb5dWZnKg3MyEQsseNnQ,7981
|
| 516 |
+
pip/_vendor/pygments/style.py,sha256=PlOZqlsnTVd58RGy50vkA2cXQ_lP5bF5EGMEBTno6DA,6420
|
| 517 |
+
pip/_vendor/pygments/styles/__init__.py,sha256=x9ebctfyvCAFpMTlMJ5YxwcNYBzjgq6zJaKkNm78r4M,2042
|
| 518 |
+
pip/_vendor/pygments/styles/__pycache__/__init__.cpython-313.pyc,,
|
| 519 |
+
pip/_vendor/pygments/styles/__pycache__/_mapping.cpython-313.pyc,,
|
| 520 |
+
pip/_vendor/pygments/styles/_mapping.py,sha256=6lovFUE29tz6EsV3XYY4hgozJ7q1JL7cfO3UOlgnS8w,3312
|
| 521 |
+
pip/_vendor/pygments/token.py,sha256=WbdWGhYm_Vosb0DDxW9lHNPgITXfWTsQmHt6cy9RbcM,6226
|
| 522 |
+
pip/_vendor/pygments/unistring.py,sha256=al-_rBemRuGvinsrM6atNsHTmJ6DUbw24q2O2Ru1cBc,63208
|
| 523 |
+
pip/_vendor/pygments/util.py,sha256=oRtSpiAo5jM9ulntkvVbgXUdiAW57jnuYGB7t9fYuhc,10031
|
| 524 |
+
pip/_vendor/pyproject_hooks/__init__.py,sha256=cPB_a9LXz5xvsRbX1o2qyAdjLatZJdQ_Lc5McNX-X7Y,691
|
| 525 |
+
pip/_vendor/pyproject_hooks/__pycache__/__init__.cpython-313.pyc,,
|
| 526 |
+
pip/_vendor/pyproject_hooks/__pycache__/_impl.cpython-313.pyc,,
|
| 527 |
+
pip/_vendor/pyproject_hooks/_impl.py,sha256=jY-raxnmyRyB57ruAitrJRUzEexuAhGTpgMygqx67Z4,14936
|
| 528 |
+
pip/_vendor/pyproject_hooks/_in_process/__init__.py,sha256=MJNPpfIxcO-FghxpBbxkG1rFiQf6HOUbV4U5mq0HFns,557
|
| 529 |
+
pip/_vendor/pyproject_hooks/_in_process/__pycache__/__init__.cpython-313.pyc,,
|
| 530 |
+
pip/_vendor/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-313.pyc,,
|
| 531 |
+
pip/_vendor/pyproject_hooks/_in_process/_in_process.py,sha256=qcXMhmx__MIJq10gGHW3mA4Tl8dy8YzHMccwnNoKlw0,12216
|
| 532 |
+
pip/_vendor/pyproject_hooks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 533 |
+
pip/_vendor/requests/__init__.py,sha256=HlB_HzhrzGtfD_aaYUwUh1zWXLZ75_YCLyit75d0Vz8,5057
|
| 534 |
+
pip/_vendor/requests/__pycache__/__init__.cpython-313.pyc,,
|
| 535 |
+
pip/_vendor/requests/__pycache__/__version__.cpython-313.pyc,,
|
| 536 |
+
pip/_vendor/requests/__pycache__/_internal_utils.cpython-313.pyc,,
|
| 537 |
+
pip/_vendor/requests/__pycache__/adapters.cpython-313.pyc,,
|
| 538 |
+
pip/_vendor/requests/__pycache__/api.cpython-313.pyc,,
|
| 539 |
+
pip/_vendor/requests/__pycache__/auth.cpython-313.pyc,,
|
| 540 |
+
pip/_vendor/requests/__pycache__/certs.cpython-313.pyc,,
|
| 541 |
+
pip/_vendor/requests/__pycache__/compat.cpython-313.pyc,,
|
| 542 |
+
pip/_vendor/requests/__pycache__/cookies.cpython-313.pyc,,
|
| 543 |
+
pip/_vendor/requests/__pycache__/exceptions.cpython-313.pyc,,
|
| 544 |
+
pip/_vendor/requests/__pycache__/help.cpython-313.pyc,,
|
| 545 |
+
pip/_vendor/requests/__pycache__/hooks.cpython-313.pyc,,
|
| 546 |
+
pip/_vendor/requests/__pycache__/models.cpython-313.pyc,,
|
| 547 |
+
pip/_vendor/requests/__pycache__/packages.cpython-313.pyc,,
|
| 548 |
+
pip/_vendor/requests/__pycache__/sessions.cpython-313.pyc,,
|
| 549 |
+
pip/_vendor/requests/__pycache__/status_codes.cpython-313.pyc,,
|
| 550 |
+
pip/_vendor/requests/__pycache__/structures.cpython-313.pyc,,
|
| 551 |
+
pip/_vendor/requests/__pycache__/utils.cpython-313.pyc,,
|
| 552 |
+
pip/_vendor/requests/__version__.py,sha256=FVfglgZmNQnmYPXpOohDU58F5EUb_-VnSTaAesS187g,435
|
| 553 |
+
pip/_vendor/requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495
|
| 554 |
+
pip/_vendor/requests/adapters.py,sha256=J7VeVxKBvawbtlX2DERVo05J9BXTcWYLMHNd1Baa-bk,27607
|
| 555 |
+
pip/_vendor/requests/api.py,sha256=_Zb9Oa7tzVIizTKwFrPjDEY9ejtm_OnSRERnADxGsQs,6449
|
| 556 |
+
pip/_vendor/requests/auth.py,sha256=kF75tqnLctZ9Mf_hm9TZIj4cQWnN5uxRz8oWsx5wmR0,10186
|
| 557 |
+
pip/_vendor/requests/certs.py,sha256=kHDlkK_beuHXeMPc5jta2wgl8gdKeUWt5f2nTDVrvt8,441
|
| 558 |
+
pip/_vendor/requests/compat.py,sha256=Mo9f9xZpefod8Zm-n9_StJcVTmwSukXR2p3IQyyVXvU,1485
|
| 559 |
+
pip/_vendor/requests/cookies.py,sha256=bNi-iqEj4NPZ00-ob-rHvzkvObzN3lEpgw3g6paS3Xw,18590
|
| 560 |
+
pip/_vendor/requests/exceptions.py,sha256=D1wqzYWne1mS2rU43tP9CeN1G7QAy7eqL9o1god6Ejw,4272
|
| 561 |
+
pip/_vendor/requests/help.py,sha256=hRKaf9u0G7fdwrqMHtF3oG16RKktRf6KiwtSq2Fo1_0,3813
|
| 562 |
+
pip/_vendor/requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733
|
| 563 |
+
pip/_vendor/requests/models.py,sha256=x4K4CmH-lC0l2Kb-iPfMN4dRXxHEcbOaEWBL_i09AwI,35483
|
| 564 |
+
pip/_vendor/requests/packages.py,sha256=_ZQDCJTJ8SP3kVWunSqBsRZNPzj2c1WFVqbdr08pz3U,1057
|
| 565 |
+
pip/_vendor/requests/sessions.py,sha256=ykTI8UWGSltOfH07HKollH7kTBGw4WhiBVaQGmckTw4,30495
|
| 566 |
+
pip/_vendor/requests/status_codes.py,sha256=iJUAeA25baTdw-6PfD0eF4qhpINDJRJI-yaMqxs4LEI,4322
|
| 567 |
+
pip/_vendor/requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912
|
| 568 |
+
pip/_vendor/requests/utils.py,sha256=L79vnFbzJ3SFLKtJwpoWe41Tozi3RlZv94pY1TFIyow,33631
|
| 569 |
+
pip/_vendor/resolvelib/__init__.py,sha256=4LcBWHMH317EKEkpV5XLVnqiU1lrmCiygjsADuCgz4s,541
|
| 570 |
+
pip/_vendor/resolvelib/__pycache__/__init__.cpython-313.pyc,,
|
| 571 |
+
pip/_vendor/resolvelib/__pycache__/providers.cpython-313.pyc,,
|
| 572 |
+
pip/_vendor/resolvelib/__pycache__/reporters.cpython-313.pyc,,
|
| 573 |
+
pip/_vendor/resolvelib/__pycache__/structs.cpython-313.pyc,,
|
| 574 |
+
pip/_vendor/resolvelib/providers.py,sha256=pIWJbIdJJ9GFtNbtwTH0Ia43Vj6hYCEJj2DOLue15FM,8914
|
| 575 |
+
pip/_vendor/resolvelib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 576 |
+
pip/_vendor/resolvelib/reporters.py,sha256=8BNa7G9cKW4Lie4BhDhd7Z57J_Vlb1CYPGSgVN2erMA,2038
|
| 577 |
+
pip/_vendor/resolvelib/resolvers/__init__.py,sha256=GMYuhrbSsYTIjOij0tuJKLvlk6UXmp3nXQetn2sOvpQ,640
|
| 578 |
+
pip/_vendor/resolvelib/resolvers/__pycache__/__init__.cpython-313.pyc,,
|
| 579 |
+
pip/_vendor/resolvelib/resolvers/__pycache__/abstract.cpython-313.pyc,,
|
| 580 |
+
pip/_vendor/resolvelib/resolvers/__pycache__/criterion.cpython-313.pyc,,
|
| 581 |
+
pip/_vendor/resolvelib/resolvers/__pycache__/exceptions.cpython-313.pyc,,
|
| 582 |
+
pip/_vendor/resolvelib/resolvers/__pycache__/resolution.cpython-313.pyc,,
|
| 583 |
+
pip/_vendor/resolvelib/resolvers/abstract.py,sha256=jZOBVigE4PUub9i3F-bTvBwaIXX8S9EU3CGASBvFqEU,1558
|
| 584 |
+
pip/_vendor/resolvelib/resolvers/criterion.py,sha256=lcmZGv5sKHOnFD_RzZwvlGSj19MeA-5rCMpdf2Sgw7Y,1768
|
| 585 |
+
pip/_vendor/resolvelib/resolvers/exceptions.py,sha256=ln_jaQtgLlRUSFY627yiHG2gD7AgaXzRKaElFVh7fDQ,1768
|
| 586 |
+
pip/_vendor/resolvelib/resolvers/resolution.py,sha256=yQegMuOmlzAElLLpgD-k6NbPDMCQf29rWhiFC26OdkM,20671
|
| 587 |
+
pip/_vendor/resolvelib/structs.py,sha256=pu-EJiR2IBITr2SQeNPRa0rXhjlStfmO_GEgAhr3004,6420
|
| 588 |
+
pip/_vendor/rich/__init__.py,sha256=dRxjIL-SbFVY0q3IjSMrfgBTHrm1LZDgLOygVBwiYZc,6090
|
| 589 |
+
pip/_vendor/rich/__main__.py,sha256=eO7Cq8JnrgG8zVoeImiAs92q3hXNMIfp0w5lMsO7Q2Y,8477
|
| 590 |
+
pip/_vendor/rich/__pycache__/__init__.cpython-313.pyc,,
|
| 591 |
+
pip/_vendor/rich/__pycache__/__main__.cpython-313.pyc,,
|
| 592 |
+
pip/_vendor/rich/__pycache__/_cell_widths.cpython-313.pyc,,
|
| 593 |
+
pip/_vendor/rich/__pycache__/_emoji_codes.cpython-313.pyc,,
|
| 594 |
+
pip/_vendor/rich/__pycache__/_emoji_replace.cpython-313.pyc,,
|
| 595 |
+
pip/_vendor/rich/__pycache__/_export_format.cpython-313.pyc,,
|
| 596 |
+
pip/_vendor/rich/__pycache__/_extension.cpython-313.pyc,,
|
| 597 |
+
pip/_vendor/rich/__pycache__/_fileno.cpython-313.pyc,,
|
| 598 |
+
pip/_vendor/rich/__pycache__/_inspect.cpython-313.pyc,,
|
| 599 |
+
pip/_vendor/rich/__pycache__/_log_render.cpython-313.pyc,,
|
| 600 |
+
pip/_vendor/rich/__pycache__/_loop.cpython-313.pyc,,
|
| 601 |
+
pip/_vendor/rich/__pycache__/_null_file.cpython-313.pyc,,
|
| 602 |
+
pip/_vendor/rich/__pycache__/_palettes.cpython-313.pyc,,
|
| 603 |
+
pip/_vendor/rich/__pycache__/_pick.cpython-313.pyc,,
|
| 604 |
+
pip/_vendor/rich/__pycache__/_ratio.cpython-313.pyc,,
|
| 605 |
+
pip/_vendor/rich/__pycache__/_spinners.cpython-313.pyc,,
|
| 606 |
+
pip/_vendor/rich/__pycache__/_stack.cpython-313.pyc,,
|
| 607 |
+
pip/_vendor/rich/__pycache__/_timer.cpython-313.pyc,,
|
| 608 |
+
pip/_vendor/rich/__pycache__/_win32_console.cpython-313.pyc,,
|
| 609 |
+
pip/_vendor/rich/__pycache__/_windows.cpython-313.pyc,,
|
| 610 |
+
pip/_vendor/rich/__pycache__/_windows_renderer.cpython-313.pyc,,
|
| 611 |
+
pip/_vendor/rich/__pycache__/_wrap.cpython-313.pyc,,
|
| 612 |
+
pip/_vendor/rich/__pycache__/abc.cpython-313.pyc,,
|
| 613 |
+
pip/_vendor/rich/__pycache__/align.cpython-313.pyc,,
|
| 614 |
+
pip/_vendor/rich/__pycache__/ansi.cpython-313.pyc,,
|
| 615 |
+
pip/_vendor/rich/__pycache__/bar.cpython-313.pyc,,
|
| 616 |
+
pip/_vendor/rich/__pycache__/box.cpython-313.pyc,,
|
| 617 |
+
pip/_vendor/rich/__pycache__/cells.cpython-313.pyc,,
|
| 618 |
+
pip/_vendor/rich/__pycache__/color.cpython-313.pyc,,
|
| 619 |
+
pip/_vendor/rich/__pycache__/color_triplet.cpython-313.pyc,,
|
| 620 |
+
pip/_vendor/rich/__pycache__/columns.cpython-313.pyc,,
|
| 621 |
+
pip/_vendor/rich/__pycache__/console.cpython-313.pyc,,
|
| 622 |
+
pip/_vendor/rich/__pycache__/constrain.cpython-313.pyc,,
|
| 623 |
+
pip/_vendor/rich/__pycache__/containers.cpython-313.pyc,,
|
| 624 |
+
pip/_vendor/rich/__pycache__/control.cpython-313.pyc,,
|
| 625 |
+
pip/_vendor/rich/__pycache__/default_styles.cpython-313.pyc,,
|
| 626 |
+
pip/_vendor/rich/__pycache__/diagnose.cpython-313.pyc,,
|
| 627 |
+
pip/_vendor/rich/__pycache__/emoji.cpython-313.pyc,,
|
| 628 |
+
pip/_vendor/rich/__pycache__/errors.cpython-313.pyc,,
|
| 629 |
+
pip/_vendor/rich/__pycache__/file_proxy.cpython-313.pyc,,
|
| 630 |
+
pip/_vendor/rich/__pycache__/filesize.cpython-313.pyc,,
|
| 631 |
+
pip/_vendor/rich/__pycache__/highlighter.cpython-313.pyc,,
|
| 632 |
+
pip/_vendor/rich/__pycache__/json.cpython-313.pyc,,
|
| 633 |
+
pip/_vendor/rich/__pycache__/jupyter.cpython-313.pyc,,
|
| 634 |
+
pip/_vendor/rich/__pycache__/layout.cpython-313.pyc,,
|
| 635 |
+
pip/_vendor/rich/__pycache__/live.cpython-313.pyc,,
|
| 636 |
+
pip/_vendor/rich/__pycache__/live_render.cpython-313.pyc,,
|
| 637 |
+
pip/_vendor/rich/__pycache__/logging.cpython-313.pyc,,
|
| 638 |
+
pip/_vendor/rich/__pycache__/markup.cpython-313.pyc,,
|
| 639 |
+
pip/_vendor/rich/__pycache__/measure.cpython-313.pyc,,
|
| 640 |
+
pip/_vendor/rich/__pycache__/padding.cpython-313.pyc,,
|
| 641 |
+
pip/_vendor/rich/__pycache__/pager.cpython-313.pyc,,
|
| 642 |
+
pip/_vendor/rich/__pycache__/palette.cpython-313.pyc,,
|
| 643 |
+
pip/_vendor/rich/__pycache__/panel.cpython-313.pyc,,
|
| 644 |
+
pip/_vendor/rich/__pycache__/pretty.cpython-313.pyc,,
|
| 645 |
+
pip/_vendor/rich/__pycache__/progress.cpython-313.pyc,,
|
| 646 |
+
pip/_vendor/rich/__pycache__/progress_bar.cpython-313.pyc,,
|
| 647 |
+
pip/_vendor/rich/__pycache__/prompt.cpython-313.pyc,,
|
| 648 |
+
pip/_vendor/rich/__pycache__/protocol.cpython-313.pyc,,
|
| 649 |
+
pip/_vendor/rich/__pycache__/region.cpython-313.pyc,,
|
| 650 |
+
pip/_vendor/rich/__pycache__/repr.cpython-313.pyc,,
|
| 651 |
+
pip/_vendor/rich/__pycache__/rule.cpython-313.pyc,,
|
| 652 |
+
pip/_vendor/rich/__pycache__/scope.cpython-313.pyc,,
|
| 653 |
+
pip/_vendor/rich/__pycache__/screen.cpython-313.pyc,,
|
| 654 |
+
pip/_vendor/rich/__pycache__/segment.cpython-313.pyc,,
|
| 655 |
+
pip/_vendor/rich/__pycache__/spinner.cpython-313.pyc,,
|
| 656 |
+
pip/_vendor/rich/__pycache__/status.cpython-313.pyc,,
|
| 657 |
+
pip/_vendor/rich/__pycache__/style.cpython-313.pyc,,
|
| 658 |
+
pip/_vendor/rich/__pycache__/styled.cpython-313.pyc,,
|
| 659 |
+
pip/_vendor/rich/__pycache__/syntax.cpython-313.pyc,,
|
| 660 |
+
pip/_vendor/rich/__pycache__/table.cpython-313.pyc,,
|
| 661 |
+
pip/_vendor/rich/__pycache__/terminal_theme.cpython-313.pyc,,
|
| 662 |
+
pip/_vendor/rich/__pycache__/text.cpython-313.pyc,,
|
| 663 |
+
pip/_vendor/rich/__pycache__/theme.cpython-313.pyc,,
|
| 664 |
+
pip/_vendor/rich/__pycache__/themes.cpython-313.pyc,,
|
| 665 |
+
pip/_vendor/rich/__pycache__/traceback.cpython-313.pyc,,
|
| 666 |
+
pip/_vendor/rich/__pycache__/tree.cpython-313.pyc,,
|
| 667 |
+
pip/_vendor/rich/_cell_widths.py,sha256=fbmeyetEdHjzE_Vx2l1uK7tnPOhMs2X1lJfO3vsKDpA,10209
|
| 668 |
+
pip/_vendor/rich/_emoji_codes.py,sha256=hu1VL9nbVdppJrVoijVshRlcRRe_v3dju3Mmd2sKZdY,140235
|
| 669 |
+
pip/_vendor/rich/_emoji_replace.py,sha256=n-kcetsEUx2ZUmhQrfeMNc-teeGhpuSQ5F8VPBsyvDo,1064
|
| 670 |
+
pip/_vendor/rich/_export_format.py,sha256=RI08pSrm5tBSzPMvnbTqbD9WIalaOoN5d4M1RTmLq1Y,2128
|
| 671 |
+
pip/_vendor/rich/_extension.py,sha256=Xt47QacCKwYruzjDi-gOBq724JReDj9Cm9xUi5fr-34,265
|
| 672 |
+
pip/_vendor/rich/_fileno.py,sha256=HWZxP5C2ajMbHryvAQZseflVfQoGzsKOHzKGsLD8ynQ,799
|
| 673 |
+
pip/_vendor/rich/_inspect.py,sha256=QM05lEFnFoTaFqpnbx-zBEI6k8oIKrD3cvjEOQNhKig,9655
|
| 674 |
+
pip/_vendor/rich/_log_render.py,sha256=1ByI0PA1ZpxZY3CGJOK54hjlq4X-Bz_boIjIqCd8Kns,3225
|
| 675 |
+
pip/_vendor/rich/_loop.py,sha256=hV_6CLdoPm0va22Wpw4zKqM0RYsz3TZxXj0PoS-9eDQ,1236
|
| 676 |
+
pip/_vendor/rich/_null_file.py,sha256=ADGKp1yt-k70FMKV6tnqCqecB-rSJzp-WQsD7LPL-kg,1394
|
| 677 |
+
pip/_vendor/rich/_palettes.py,sha256=cdev1JQKZ0JvlguV9ipHgznTdnvlIzUFDBb0It2PzjI,7063
|
| 678 |
+
pip/_vendor/rich/_pick.py,sha256=evDt8QN4lF5CiwrUIXlOJCntitBCOsI3ZLPEIAVRLJU,423
|
| 679 |
+
pip/_vendor/rich/_ratio.py,sha256=Zt58apszI6hAAcXPpgdWKpu3c31UBWebOeR4mbyptvU,5471
|
| 680 |
+
pip/_vendor/rich/_spinners.py,sha256=U2r1_g_1zSjsjiUdAESc2iAMc3i4ri_S8PYP6kQ5z1I,19919
|
| 681 |
+
pip/_vendor/rich/_stack.py,sha256=-C8OK7rxn3sIUdVwxZBBpeHhIzX0eI-VM3MemYfaXm0,351
|
| 682 |
+
pip/_vendor/rich/_timer.py,sha256=zelxbT6oPFZnNrwWPpc1ktUeAT-Vc4fuFcRZLQGLtMI,417
|
| 683 |
+
pip/_vendor/rich/_win32_console.py,sha256=BSaDRIMwBLITn_m0mTRLPqME5q-quGdSMuYMpYeYJwc,22755
|
| 684 |
+
pip/_vendor/rich/_windows.py,sha256=aBwaD_S56SbgopIvayVmpk0Y28uwY2C5Bab1wl3Bp-I,1925
|
| 685 |
+
pip/_vendor/rich/_windows_renderer.py,sha256=t74ZL3xuDCP3nmTp9pH1L5LiI2cakJuQRQleHCJerlk,2783
|
| 686 |
+
pip/_vendor/rich/_wrap.py,sha256=FlSsom5EX0LVkA3KWy34yHnCfLtqX-ZIepXKh-70rpc,3404
|
| 687 |
+
pip/_vendor/rich/abc.py,sha256=ON-E-ZqSSheZ88VrKX2M3PXpFbGEUUZPMa_Af0l-4f0,890
|
| 688 |
+
pip/_vendor/rich/align.py,sha256=Rh-3adnDaN1Ao07EjR2PhgE62PGLPgO8SMwJBku1urQ,10469
|
| 689 |
+
pip/_vendor/rich/ansi.py,sha256=Avs1LHbSdcyOvDOdpELZUoULcBiYewY76eNBp6uFBhs,6921
|
| 690 |
+
pip/_vendor/rich/bar.py,sha256=ldbVHOzKJOnflVNuv1xS7g6dLX2E3wMnXkdPbpzJTcs,3263
|
| 691 |
+
pip/_vendor/rich/box.py,sha256=nr5fYIUghB_iUCEq6y0Z3LlCT8gFPDrzN9u2kn7tJl4,10831
|
| 692 |
+
pip/_vendor/rich/cells.py,sha256=KrQkj5-LghCCpJLSNQIyAZjndc4bnEqOEmi5YuZ9UCY,5130
|
| 693 |
+
pip/_vendor/rich/color.py,sha256=3HSULVDj7qQkXUdFWv78JOiSZzfy5y1nkcYhna296V0,18211
|
| 694 |
+
pip/_vendor/rich/color_triplet.py,sha256=3lhQkdJbvWPoLDO-AnYImAWmJvV5dlgYNCVZ97ORaN4,1054
|
| 695 |
+
pip/_vendor/rich/columns.py,sha256=HUX0KcMm9dsKNi11fTbiM_h2iDtl8ySCaVcxlalEzq8,7131
|
| 696 |
+
pip/_vendor/rich/console.py,sha256=_RJizBQIn9qxr4Ln7Q_SC5N9ekPWPAxH0KGVxsgg69Y,100565
|
| 697 |
+
pip/_vendor/rich/constrain.py,sha256=1VIPuC8AgtKWrcncQrjBdYqA3JVWysu6jZo1rrh7c7Q,1288
|
| 698 |
+
pip/_vendor/rich/containers.py,sha256=c_56TxcedGYqDepHBMTuZdUIijitAQgnox-Qde0Z1qo,5502
|
| 699 |
+
pip/_vendor/rich/control.py,sha256=DSkHTUQLorfSERAKE_oTAEUFefZnZp4bQb4q8rHbKws,6630
|
| 700 |
+
pip/_vendor/rich/default_styles.py,sha256=khQFqqaoDs3bprMqWpHw8nO5UpG2DN6QtuTd6LzZwYc,8257
|
| 701 |
+
pip/_vendor/rich/diagnose.py,sha256=WNPjU2pEdrPICJ24KOaTD_hzP839qArpmF1JIM5x_EQ,998
|
| 702 |
+
pip/_vendor/rich/emoji.py,sha256=omTF9asaAnsM4yLY94eR_9dgRRSm1lHUszX20D1yYCQ,2501
|
| 703 |
+
pip/_vendor/rich/errors.py,sha256=5pP3Kc5d4QJ_c0KFsxrfyhjiPVe7J1zOqSFbFAzcV-Y,642
|
| 704 |
+
pip/_vendor/rich/file_proxy.py,sha256=Tl9THMDZ-Pk5Wm8sI1gGg_U5DhusmxD-FZ0fUbcU0W0,1683
|
| 705 |
+
pip/_vendor/rich/filesize.py,sha256=_iz9lIpRgvW7MNSeCZnLg-HwzbP4GETg543WqD8SFs0,2484
|
| 706 |
+
pip/_vendor/rich/highlighter.py,sha256=G_sn-8DKjM1sEjLG_oc4ovkWmiUpWvj8bXi0yed2LnY,9586
|
| 707 |
+
pip/_vendor/rich/json.py,sha256=vVEoKdawoJRjAFayPwXkMBPLy7RSTs-f44wSQDR2nJ0,5031
|
| 708 |
+
pip/_vendor/rich/jupyter.py,sha256=QyoKoE_8IdCbrtiSHp9TsTSNyTHY0FO5whE7jOTd9UE,3252
|
| 709 |
+
pip/_vendor/rich/layout.py,sha256=ajkSFAtEVv9EFTcFs-w4uZfft7nEXhNzL7ZVdgrT5rI,14004
|
| 710 |
+
pip/_vendor/rich/live.py,sha256=DhzAPEnjTxQuq9_0Y2xh2MUwQcP_aGPkenLfKETslwM,14270
|
| 711 |
+
pip/_vendor/rich/live_render.py,sha256=zJtB471jGziBtEwxc54x12wEQtH4BuQr1SA8v9kU82w,3666
|
| 712 |
+
pip/_vendor/rich/logging.py,sha256=ZgpKMMBY_BuMAI_BYzo-UtXak6t5oH9VK8m9Q2Lm0f4,12458
|
| 713 |
+
pip/_vendor/rich/markup.py,sha256=3euGKP5s41NCQwaSjTnJxus5iZMHjxpIM0W6fCxra38,8451
|
| 714 |
+
pip/_vendor/rich/measure.py,sha256=HmrIJX8sWRTHbgh8MxEay_83VkqNW_70s8aKP5ZcYI8,5305
|
| 715 |
+
pip/_vendor/rich/padding.py,sha256=KVEI3tOwo9sgK1YNSuH__M1_jUWmLZwRVV_KmOtVzyM,4908
|
| 716 |
+
pip/_vendor/rich/pager.py,sha256=SO_ETBFKbg3n_AgOzXm41Sv36YxXAyI3_R-KOY2_uSc,828
|
| 717 |
+
pip/_vendor/rich/palette.py,sha256=lInvR1ODDT2f3UZMfL1grq7dY_pDdKHw4bdUgOGaM4Y,3396
|
| 718 |
+
pip/_vendor/rich/panel.py,sha256=SUDaa3z4MU7vIjzvbi0SXuc6BslDzADwdY1AX4TbTdY,11225
|
| 719 |
+
pip/_vendor/rich/pretty.py,sha256=gy3S72u4FRg2ytoo7N1ZDWDIvB4unbzd5iUGdgm-8fc,36391
|
| 720 |
+
pip/_vendor/rich/progress.py,sha256=MtmCjTk5zYU_XtRHxRHTAEHG6hF9PeF7EMWbEPleIC0,60357
|
| 721 |
+
pip/_vendor/rich/progress_bar.py,sha256=mZTPpJUwcfcdgQCTTz3kyY-fc79ddLwtx6Ghhxfo064,8162
|
| 722 |
+
pip/_vendor/rich/prompt.py,sha256=l0RhQU-0UVTV9e08xW1BbIj0Jq2IXyChX4lC0lFNzt4,12447
|
| 723 |
+
pip/_vendor/rich/protocol.py,sha256=5hHHDDNHckdk8iWH5zEbi-zuIVSF5hbU2jIo47R7lTE,1391
|
| 724 |
+
pip/_vendor/rich/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 725 |
+
pip/_vendor/rich/region.py,sha256=rNT9xZrVZTYIXZC0NYn41CJQwYNbR-KecPOxTgQvB8Y,166
|
| 726 |
+
pip/_vendor/rich/repr.py,sha256=5MZJZmONgC6kud-QW-_m1okXwL2aR6u6y-pUcUCJz28,4431
|
| 727 |
+
pip/_vendor/rich/rule.py,sha256=0fNaS_aERa3UMRc3T5WMpN_sumtDxfaor2y3of1ftBk,4602
|
| 728 |
+
pip/_vendor/rich/scope.py,sha256=TMUU8qo17thyqQCPqjDLYpg_UU1k5qVd-WwiJvnJVas,2843
|
| 729 |
+
pip/_vendor/rich/screen.py,sha256=YoeReESUhx74grqb0mSSb9lghhysWmFHYhsbMVQjXO8,1591
|
| 730 |
+
pip/_vendor/rich/segment.py,sha256=otnKeKGEV-WRlQVosfJVeFDcDxAKHpvJ_hLzSu5lumM,24743
|
| 731 |
+
pip/_vendor/rich/spinner.py,sha256=PT5qgXPG3ZpqRj7n3EZQ6NW56mx3ldZqZCU7gEMyZk4,4364
|
| 732 |
+
pip/_vendor/rich/status.py,sha256=kkPph3YeAZBo-X-4wPp8gTqZyU466NLwZBA4PZTTewo,4424
|
| 733 |
+
pip/_vendor/rich/style.py,sha256=xpj4uMBZMtuNuNomfUiamigl3p1sDvTCZwrG1tcTVeg,27059
|
| 734 |
+
pip/_vendor/rich/styled.py,sha256=eZNnzGrI4ki_54pgY3Oj0T-x3lxdXTYh4_ryDB24wBU,1258
|
| 735 |
+
pip/_vendor/rich/syntax.py,sha256=qqAnEUZ4K57Po81_5RBxnsuU4KRzSdvDPAhKw8ma_3E,35763
|
| 736 |
+
pip/_vendor/rich/table.py,sha256=ZmT7V7MMCOYKw7TGY9SZLyYDf6JdM-WVf07FdVuVhTI,40049
|
| 737 |
+
pip/_vendor/rich/terminal_theme.py,sha256=1j5-ufJfnvlAo5Qsi_ACZiXDmwMXzqgmFByObT9-yJY,3370
|
| 738 |
+
pip/_vendor/rich/text.py,sha256=AO7JPCz6-gaN1thVLXMBntEmDPVYFgFNG1oM61_sanU,47552
|
| 739 |
+
pip/_vendor/rich/theme.py,sha256=oNyhXhGagtDlbDye3tVu3esWOWk0vNkuxFw-_unlaK0,3771
|
| 740 |
+
pip/_vendor/rich/themes.py,sha256=0xgTLozfabebYtcJtDdC5QkX5IVUEaviqDUJJh4YVFk,102
|
| 741 |
+
pip/_vendor/rich/traceback.py,sha256=ZA8Q67DyP5a_stpIh6GPf9IiXj_s3dAhDIr6Zbfkahk,35170
|
| 742 |
+
pip/_vendor/rich/tree.py,sha256=yWnQ6rAvRGJ3qZGqBrxS2SW2TKBTNrP0SdY8QxOFPuw,9451
|
| 743 |
+
pip/_vendor/tomli/__init__.py,sha256=PhNw_eyLgdn7McJ6nrAN8yIm3dXC75vr1sVGVVwDSpA,314
|
| 744 |
+
pip/_vendor/tomli/__pycache__/__init__.cpython-313.pyc,,
|
| 745 |
+
pip/_vendor/tomli/__pycache__/_parser.cpython-313.pyc,,
|
| 746 |
+
pip/_vendor/tomli/__pycache__/_re.cpython-313.pyc,,
|
| 747 |
+
pip/_vendor/tomli/__pycache__/_types.cpython-313.pyc,,
|
| 748 |
+
pip/_vendor/tomli/_parser.py,sha256=9w8LG0jB7fwmZZWB0vVXbeejDHcl4ANIJxB2scEnDlA,25591
|
| 749 |
+
pip/_vendor/tomli/_re.py,sha256=sh4sBDRgO94KJZwNIrgdcyV_qQast50YvzOAUGpRDKA,3171
|
| 750 |
+
pip/_vendor/tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254
|
| 751 |
+
pip/_vendor/tomli/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
| 752 |
+
pip/_vendor/tomli_w/__init__.py,sha256=0F8yDtXx3Uunhm874KrAcP76srsM98y7WyHQwCulZbo,169
|
| 753 |
+
pip/_vendor/tomli_w/__pycache__/__init__.cpython-313.pyc,,
|
| 754 |
+
pip/_vendor/tomli_w/__pycache__/_writer.cpython-313.pyc,,
|
| 755 |
+
pip/_vendor/tomli_w/_writer.py,sha256=dsifFS2xYf1i76mmRyfz9y125xC7Z_HQ845ZKhJsYXs,6961
|
| 756 |
+
pip/_vendor/tomli_w/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
| 757 |
+
pip/_vendor/truststore/__init__.py,sha256=2wRSVijjRzPLVXUzWqvdZLNsEOhDfopKLd2EKAYLwKU,1320
|
| 758 |
+
pip/_vendor/truststore/__pycache__/__init__.cpython-313.pyc,,
|
| 759 |
+
pip/_vendor/truststore/__pycache__/_api.cpython-313.pyc,,
|
| 760 |
+
pip/_vendor/truststore/__pycache__/_macos.cpython-313.pyc,,
|
| 761 |
+
pip/_vendor/truststore/__pycache__/_openssl.cpython-313.pyc,,
|
| 762 |
+
pip/_vendor/truststore/__pycache__/_ssl_constants.cpython-313.pyc,,
|
| 763 |
+
pip/_vendor/truststore/__pycache__/_windows.cpython-313.pyc,,
|
| 764 |
+
pip/_vendor/truststore/_api.py,sha256=40I0ojO2DnITiHvOnUYvJ1bfQMBKHOkci14noNxEnCs,11246
|
| 765 |
+
pip/_vendor/truststore/_macos.py,sha256=nZlLkOmszUE0g6ryRwBVGY5COzPyudcsiJtDWarM5LQ,20503
|
| 766 |
+
pip/_vendor/truststore/_openssl.py,sha256=LLUZ7ZGaio-i5dpKKjKCSeSufmn6T8pi9lDcFnvSyq0,2324
|
| 767 |
+
pip/_vendor/truststore/_ssl_constants.py,sha256=NUD4fVKdSD02ri7-db0tnO0VqLP9aHuzmStcW7tAl08,1130
|
| 768 |
+
pip/_vendor/truststore/_windows.py,sha256=rAHyKYD8M7t-bXfG8VgOVa3TpfhVhbt4rZQlO45YuP8,17993
|
| 769 |
+
pip/_vendor/truststore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 770 |
+
pip/_vendor/typing_extensions.py,sha256=ipKHUPtZCqL6c-HfvGl-9t0opsXcSL72y4GYjyJXs_g,172702
|
| 771 |
+
pip/_vendor/urllib3/__init__.py,sha256=iXLcYiJySn0GNbWOOZDDApgBL1JgP44EZ8i1760S8Mc,3333
|
| 772 |
+
pip/_vendor/urllib3/__pycache__/__init__.cpython-313.pyc,,
|
| 773 |
+
pip/_vendor/urllib3/__pycache__/_collections.cpython-313.pyc,,
|
| 774 |
+
pip/_vendor/urllib3/__pycache__/_version.cpython-313.pyc,,
|
| 775 |
+
pip/_vendor/urllib3/__pycache__/connection.cpython-313.pyc,,
|
| 776 |
+
pip/_vendor/urllib3/__pycache__/connectionpool.cpython-313.pyc,,
|
| 777 |
+
pip/_vendor/urllib3/__pycache__/exceptions.cpython-313.pyc,,
|
| 778 |
+
pip/_vendor/urllib3/__pycache__/fields.cpython-313.pyc,,
|
| 779 |
+
pip/_vendor/urllib3/__pycache__/filepost.cpython-313.pyc,,
|
| 780 |
+
pip/_vendor/urllib3/__pycache__/poolmanager.cpython-313.pyc,,
|
| 781 |
+
pip/_vendor/urllib3/__pycache__/request.cpython-313.pyc,,
|
| 782 |
+
pip/_vendor/urllib3/__pycache__/response.cpython-313.pyc,,
|
| 783 |
+
pip/_vendor/urllib3/_collections.py,sha256=pyASJJhW7wdOpqJj9QJA8FyGRfr8E8uUUhqUvhF0728,11372
|
| 784 |
+
pip/_vendor/urllib3/_version.py,sha256=t9wGB6ooOTXXgiY66K1m6BZS1CJyXHAU8EoWDTe6Shk,64
|
| 785 |
+
pip/_vendor/urllib3/connection.py,sha256=ttIA909BrbTUzwkqEe_TzZVh4JOOj7g61Ysei2mrwGg,20314
|
| 786 |
+
pip/_vendor/urllib3/connectionpool.py,sha256=e2eiAwNbFNCKxj4bwDKNK-w7HIdSz3OmMxU_TIt-evQ,40408
|
| 787 |
+
pip/_vendor/urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 788 |
+
pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-313.pyc,,
|
| 789 |
+
pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-313.pyc,,
|
| 790 |
+
pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-313.pyc,,
|
| 791 |
+
pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-313.pyc,,
|
| 792 |
+
pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-313.pyc,,
|
| 793 |
+
pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-313.pyc,,
|
| 794 |
+
pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-313.pyc,,
|
| 795 |
+
pip/_vendor/urllib3/contrib/_appengine_environ.py,sha256=bDbyOEhW2CKLJcQqAKAyrEHN-aklsyHFKq6vF8ZFsmk,957
|
| 796 |
+
pip/_vendor/urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 797 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-313.pyc,,
|
| 798 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-313.pyc,,
|
| 799 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-313.pyc,,
|
| 800 |
+
pip/_vendor/urllib3/contrib/_securetransport/bindings.py,sha256=4Xk64qIkPBt09A5q-RIFUuDhNc9mXilVapm7WnYnzRw,17632
|
| 801 |
+
pip/_vendor/urllib3/contrib/_securetransport/low_level.py,sha256=B2JBB2_NRP02xK6DCa1Pa9IuxrPwxzDzZbixQkb7U9M,13922
|
| 802 |
+
pip/_vendor/urllib3/contrib/appengine.py,sha256=VR68eAVE137lxTgjBDwCna5UiBZTOKa01Aj_-5BaCz4,11036
|
| 803 |
+
pip/_vendor/urllib3/contrib/ntlmpool.py,sha256=NlfkW7WMdW8ziqudopjHoW299og1BTWi0IeIibquFwk,4528
|
| 804 |
+
pip/_vendor/urllib3/contrib/pyopenssl.py,sha256=hDJh4MhyY_p-oKlFcYcQaVQRDv6GMmBGuW9yjxyeejM,17081
|
| 805 |
+
pip/_vendor/urllib3/contrib/securetransport.py,sha256=Fef1IIUUFHqpevzXiDPbIGkDKchY2FVKeVeLGR1Qq3g,34446
|
| 806 |
+
pip/_vendor/urllib3/contrib/socks.py,sha256=aRi9eWXo9ZEb95XUxef4Z21CFlnnjbEiAo9HOseoMt4,7097
|
| 807 |
+
pip/_vendor/urllib3/exceptions.py,sha256=0Mnno3KHTNfXRfY7638NufOPkUb6mXOm-Lqj-4x2w8A,8217
|
| 808 |
+
pip/_vendor/urllib3/fields.py,sha256=kvLDCg_JmH1lLjUUEY_FLS8UhY7hBvDPuVETbY8mdrM,8579
|
| 809 |
+
pip/_vendor/urllib3/filepost.py,sha256=5b_qqgRHVlL7uLtdAYBzBh-GHmU5AfJVt_2N0XS3PeY,2440
|
| 810 |
+
pip/_vendor/urllib3/packages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 811 |
+
pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-313.pyc,,
|
| 812 |
+
pip/_vendor/urllib3/packages/__pycache__/six.cpython-313.pyc,,
|
| 813 |
+
pip/_vendor/urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 814 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-313.pyc,,
|
| 815 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-313.pyc,,
|
| 816 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/weakref_finalize.cpython-313.pyc,,
|
| 817 |
+
pip/_vendor/urllib3/packages/backports/makefile.py,sha256=nbzt3i0agPVP07jqqgjhaYjMmuAi_W5E0EywZivVO8E,1417
|
| 818 |
+
pip/_vendor/urllib3/packages/backports/weakref_finalize.py,sha256=tRCal5OAhNSRyb0DhHp-38AtIlCsRP8BxF3NX-6rqIA,5343
|
| 819 |
+
pip/_vendor/urllib3/packages/six.py,sha256=b9LM0wBXv7E7SrbCjAm4wwN-hrH-iNxv18LgWNMMKPo,34665
|
| 820 |
+
pip/_vendor/urllib3/poolmanager.py,sha256=aWyhXRtNO4JUnCSVVqKTKQd8EXTvUm1VN9pgs2bcONo,19990
|
| 821 |
+
pip/_vendor/urllib3/request.py,sha256=YTWFNr7QIwh7E1W9dde9LM77v2VWTJ5V78XuTTw7D1A,6691
|
| 822 |
+
pip/_vendor/urllib3/response.py,sha256=fmDJAFkG71uFTn-sVSTh2Iw0WmcXQYqkbRjihvwBjU8,30641
|
| 823 |
+
pip/_vendor/urllib3/util/__init__.py,sha256=JEmSmmqqLyaw8P51gUImZh8Gwg9i1zSe-DoqAitn2nc,1155
|
| 824 |
+
pip/_vendor/urllib3/util/__pycache__/__init__.cpython-313.pyc,,
|
| 825 |
+
pip/_vendor/urllib3/util/__pycache__/connection.cpython-313.pyc,,
|
| 826 |
+
pip/_vendor/urllib3/util/__pycache__/proxy.cpython-313.pyc,,
|
| 827 |
+
pip/_vendor/urllib3/util/__pycache__/queue.cpython-313.pyc,,
|
| 828 |
+
pip/_vendor/urllib3/util/__pycache__/request.cpython-313.pyc,,
|
| 829 |
+
pip/_vendor/urllib3/util/__pycache__/response.cpython-313.pyc,,
|
| 830 |
+
pip/_vendor/urllib3/util/__pycache__/retry.cpython-313.pyc,,
|
| 831 |
+
pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-313.pyc,,
|
| 832 |
+
pip/_vendor/urllib3/util/__pycache__/ssl_match_hostname.cpython-313.pyc,,
|
| 833 |
+
pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-313.pyc,,
|
| 834 |
+
pip/_vendor/urllib3/util/__pycache__/timeout.cpython-313.pyc,,
|
| 835 |
+
pip/_vendor/urllib3/util/__pycache__/url.cpython-313.pyc,,
|
| 836 |
+
pip/_vendor/urllib3/util/__pycache__/wait.cpython-313.pyc,,
|
| 837 |
+
pip/_vendor/urllib3/util/connection.py,sha256=5Lx2B1PW29KxBn2T0xkN1CBgRBa3gGVJBKoQoRogEVk,4901
|
| 838 |
+
pip/_vendor/urllib3/util/proxy.py,sha256=zUvPPCJrp6dOF0N4GAVbOcl6o-4uXKSrGiTkkr5vUS4,1605
|
| 839 |
+
pip/_vendor/urllib3/util/queue.py,sha256=nRgX8_eX-_VkvxoX096QWoz8Ps0QHUAExILCY_7PncM,498
|
| 840 |
+
pip/_vendor/urllib3/util/request.py,sha256=C0OUt2tcU6LRiQJ7YYNP9GvPrSvl7ziIBekQ-5nlBZk,3997
|
| 841 |
+
pip/_vendor/urllib3/util/response.py,sha256=GJpg3Egi9qaJXRwBh5wv-MNuRWan5BIu40oReoxWP28,3510
|
| 842 |
+
pip/_vendor/urllib3/util/retry.py,sha256=6ENvOZ8PBDzh8kgixpql9lIrb2dxH-k7ZmBanJF2Ng4,22050
|
| 843 |
+
pip/_vendor/urllib3/util/ssl_.py,sha256=QDuuTxPSCj1rYtZ4xpD7Ux-r20TD50aHyqKyhQ7Bq4A,17460
|
| 844 |
+
pip/_vendor/urllib3/util/ssl_match_hostname.py,sha256=Ir4cZVEjmAk8gUAIHWSi7wtOO83UCYABY2xFD1Ql_WA,5758
|
| 845 |
+
pip/_vendor/urllib3/util/ssltransport.py,sha256=NA-u5rMTrDFDFC8QzRKUEKMG0561hOD4qBTr3Z4pv6E,6895
|
| 846 |
+
pip/_vendor/urllib3/util/timeout.py,sha256=cwq4dMk87mJHSBktK1miYJ-85G-3T3RmT20v7SFCpno,10168
|
| 847 |
+
pip/_vendor/urllib3/util/url.py,sha256=lCAE7M5myA8EDdW0sJuyyZhVB9K_j38ljWhHAnFaWoE,14296
|
| 848 |
+
pip/_vendor/urllib3/util/wait.py,sha256=fOX0_faozG2P7iVojQoE1mbydweNyTcm-hXEfFrTtLI,5403
|
| 849 |
+
pip/_vendor/vendor.txt,sha256=Fym1hhuw75IJOl33NPi5nIJJc66DioBSUWrVRIVtRUE,373
|
| 850 |
+
pip/py.typed,sha256=EBVvvPRTn_eIpz5e5QztSCdrMX7Qwd7VP93RSoIlZ2I,286
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/REQUESTED
ADDED
|
File without changes
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (78.1.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
pip = pip._internal.cli.main:main
|
| 3 |
+
pip3 = pip._internal.cli.main:main
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/licenses/AUTHORS.txt
ADDED
|
@@ -0,0 +1,821 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@Switch01
|
| 2 |
+
A_Rog
|
| 3 |
+
Aakanksha Agrawal
|
| 4 |
+
Abhinav Sagar
|
| 5 |
+
ABHYUDAY PRATAP SINGH
|
| 6 |
+
abs51295
|
| 7 |
+
AceGentile
|
| 8 |
+
Adam Chainz
|
| 9 |
+
Adam Tse
|
| 10 |
+
Adam Turner
|
| 11 |
+
Adam Wentz
|
| 12 |
+
admin
|
| 13 |
+
Adolfo Ochagavía
|
| 14 |
+
Adrien Morison
|
| 15 |
+
Agus
|
| 16 |
+
ahayrapetyan
|
| 17 |
+
Ahilya
|
| 18 |
+
AinsworthK
|
| 19 |
+
Akash Srivastava
|
| 20 |
+
Alan Yee
|
| 21 |
+
Albert Tugushev
|
| 22 |
+
Albert-Guan
|
| 23 |
+
albertg
|
| 24 |
+
Alberto Sottile
|
| 25 |
+
Aleks Bunin
|
| 26 |
+
Ales Erjavec
|
| 27 |
+
Alethea Flowers
|
| 28 |
+
Alex Gaynor
|
| 29 |
+
Alex Grönholm
|
| 30 |
+
Alex Hedges
|
| 31 |
+
Alex Loosley
|
| 32 |
+
Alex Morega
|
| 33 |
+
Alex Stachowiak
|
| 34 |
+
Alexander Regueiro
|
| 35 |
+
Alexander Shtyrov
|
| 36 |
+
Alexandre Conrad
|
| 37 |
+
Alexey Popravka
|
| 38 |
+
Aleš Erjavec
|
| 39 |
+
Alli
|
| 40 |
+
Ami Fischman
|
| 41 |
+
Ananya Maiti
|
| 42 |
+
Anatoly Techtonik
|
| 43 |
+
Anders Kaseorg
|
| 44 |
+
Andre Aguiar
|
| 45 |
+
Andreas Lutro
|
| 46 |
+
Andrei Geacar
|
| 47 |
+
Andrew Gaul
|
| 48 |
+
Andrew Shymanel
|
| 49 |
+
Andrey Bienkowski
|
| 50 |
+
Andrey Bulgakov
|
| 51 |
+
Andrés Delfino
|
| 52 |
+
Andy Freeland
|
| 53 |
+
Andy Kluger
|
| 54 |
+
Ani Hayrapetyan
|
| 55 |
+
Aniruddha Basak
|
| 56 |
+
Anish Tambe
|
| 57 |
+
Anrs Hu
|
| 58 |
+
Anthony Sottile
|
| 59 |
+
Antoine Musso
|
| 60 |
+
Anton Ovchinnikov
|
| 61 |
+
Anton Patrushev
|
| 62 |
+
Anton Zelenov
|
| 63 |
+
Antonio Alvarado Hernandez
|
| 64 |
+
Antony Lee
|
| 65 |
+
Antti Kaihola
|
| 66 |
+
Anubhav Patel
|
| 67 |
+
Anudit Nagar
|
| 68 |
+
Anuj Godase
|
| 69 |
+
AQNOUCH Mohammed
|
| 70 |
+
AraHaan
|
| 71 |
+
arena
|
| 72 |
+
arenasys
|
| 73 |
+
Arindam Choudhury
|
| 74 |
+
Armin Ronacher
|
| 75 |
+
Arnon Yaari
|
| 76 |
+
Artem
|
| 77 |
+
Arun Babu Neelicattu
|
| 78 |
+
Ashley Manton
|
| 79 |
+
Ashwin Ramaswami
|
| 80 |
+
atse
|
| 81 |
+
Atsushi Odagiri
|
| 82 |
+
Avinash Karhana
|
| 83 |
+
Avner Cohen
|
| 84 |
+
Awit (Ah-Wit) Ghirmai
|
| 85 |
+
Baptiste Mispelon
|
| 86 |
+
Barney Gale
|
| 87 |
+
barneygale
|
| 88 |
+
Bartek Ogryczak
|
| 89 |
+
Bastian Venthur
|
| 90 |
+
Ben Bodenmiller
|
| 91 |
+
Ben Darnell
|
| 92 |
+
Ben Hoyt
|
| 93 |
+
Ben Mares
|
| 94 |
+
Ben Rosser
|
| 95 |
+
Bence Nagy
|
| 96 |
+
Benjamin Peterson
|
| 97 |
+
Benjamin VanEvery
|
| 98 |
+
Benoit Pierre
|
| 99 |
+
Berker Peksag
|
| 100 |
+
Bernard
|
| 101 |
+
Bernard Tyers
|
| 102 |
+
Bernardo B. Marques
|
| 103 |
+
Bernhard M. Wiedemann
|
| 104 |
+
Bertil Hatt
|
| 105 |
+
Bhavam Vidyarthi
|
| 106 |
+
Blazej Michalik
|
| 107 |
+
Bogdan Opanchuk
|
| 108 |
+
BorisZZZ
|
| 109 |
+
Brad Erickson
|
| 110 |
+
Bradley Ayers
|
| 111 |
+
Bradley Reynolds
|
| 112 |
+
Branch Vincent
|
| 113 |
+
Brandon L. Reiss
|
| 114 |
+
Brandt Bucher
|
| 115 |
+
Brannon Dorsey
|
| 116 |
+
Brett Randall
|
| 117 |
+
Brett Rosen
|
| 118 |
+
Brian Cristante
|
| 119 |
+
Brian Rosner
|
| 120 |
+
briantracy
|
| 121 |
+
BrownTruck
|
| 122 |
+
Bruno Oliveira
|
| 123 |
+
Bruno Renié
|
| 124 |
+
Bruno S
|
| 125 |
+
Bstrdsmkr
|
| 126 |
+
Buck Golemon
|
| 127 |
+
burrows
|
| 128 |
+
Bussonnier Matthias
|
| 129 |
+
bwoodsend
|
| 130 |
+
c22
|
| 131 |
+
Caleb Brown
|
| 132 |
+
Caleb Martinez
|
| 133 |
+
Calvin Smith
|
| 134 |
+
Carl Meyer
|
| 135 |
+
Carlos Liam
|
| 136 |
+
Carol Willing
|
| 137 |
+
Carter Thayer
|
| 138 |
+
Cass
|
| 139 |
+
Chandrasekhar Atina
|
| 140 |
+
Charlie Marsh
|
| 141 |
+
charwick
|
| 142 |
+
Chih-Hsuan Yen
|
| 143 |
+
Chris Brinker
|
| 144 |
+
Chris Hunt
|
| 145 |
+
Chris Jerdonek
|
| 146 |
+
Chris Kuehl
|
| 147 |
+
Chris Markiewicz
|
| 148 |
+
Chris McDonough
|
| 149 |
+
Chris Pawley
|
| 150 |
+
Chris Pryer
|
| 151 |
+
Chris Wolfe
|
| 152 |
+
Christian Clauss
|
| 153 |
+
Christian Heimes
|
| 154 |
+
Christian Oudard
|
| 155 |
+
Christoph Reiter
|
| 156 |
+
Christopher Hunt
|
| 157 |
+
Christopher Snyder
|
| 158 |
+
chrysle
|
| 159 |
+
cjc7373
|
| 160 |
+
Clark Boylan
|
| 161 |
+
Claudio Jolowicz
|
| 162 |
+
Clay McClure
|
| 163 |
+
Cody
|
| 164 |
+
Cody Soyland
|
| 165 |
+
Colin Watson
|
| 166 |
+
Collin Anderson
|
| 167 |
+
Connor Osborn
|
| 168 |
+
Cooper Lees
|
| 169 |
+
Cooper Ry Lees
|
| 170 |
+
Cory Benfield
|
| 171 |
+
Cory Wright
|
| 172 |
+
Craig Kerstiens
|
| 173 |
+
Cristian Sorinel
|
| 174 |
+
Cristina
|
| 175 |
+
Cristina Muñoz
|
| 176 |
+
ctg123
|
| 177 |
+
Curtis Doty
|
| 178 |
+
cytolentino
|
| 179 |
+
Daan De Meyer
|
| 180 |
+
Dale
|
| 181 |
+
Damian
|
| 182 |
+
Damian Quiroga
|
| 183 |
+
Damian Shaw
|
| 184 |
+
Dan Black
|
| 185 |
+
Dan Savilonis
|
| 186 |
+
Dan Sully
|
| 187 |
+
Dane Hillard
|
| 188 |
+
daniel
|
| 189 |
+
Daniel Collins
|
| 190 |
+
Daniel Hahler
|
| 191 |
+
Daniel Holth
|
| 192 |
+
Daniel Jost
|
| 193 |
+
Daniel Katz
|
| 194 |
+
Daniel Shaulov
|
| 195 |
+
Daniele Esposti
|
| 196 |
+
Daniele Nicolodi
|
| 197 |
+
Daniele Procida
|
| 198 |
+
Daniil Konovalenko
|
| 199 |
+
Danny Hermes
|
| 200 |
+
Danny McClanahan
|
| 201 |
+
Darren Kavanagh
|
| 202 |
+
Dav Clark
|
| 203 |
+
Dave Abrahams
|
| 204 |
+
Dave Jones
|
| 205 |
+
David Aguilar
|
| 206 |
+
David Black
|
| 207 |
+
David Bordeynik
|
| 208 |
+
David Caro
|
| 209 |
+
David D Lowe
|
| 210 |
+
David Evans
|
| 211 |
+
David Hewitt
|
| 212 |
+
David Linke
|
| 213 |
+
David Poggi
|
| 214 |
+
David Poznik
|
| 215 |
+
David Pursehouse
|
| 216 |
+
David Runge
|
| 217 |
+
David Tucker
|
| 218 |
+
David Wales
|
| 219 |
+
Davidovich
|
| 220 |
+
ddelange
|
| 221 |
+
Deepak Sharma
|
| 222 |
+
Deepyaman Datta
|
| 223 |
+
Denise Yu
|
| 224 |
+
dependabot[bot]
|
| 225 |
+
derwolfe
|
| 226 |
+
Desetude
|
| 227 |
+
developer
|
| 228 |
+
Devesh Kumar Singh
|
| 229 |
+
devsagul
|
| 230 |
+
Diego Caraballo
|
| 231 |
+
Diego Ramirez
|
| 232 |
+
DiegoCaraballo
|
| 233 |
+
Dimitri Merejkowsky
|
| 234 |
+
Dimitri Papadopoulos
|
| 235 |
+
Dimitri Papadopoulos Orfanos
|
| 236 |
+
Dirk Stolle
|
| 237 |
+
Dmitry Gladkov
|
| 238 |
+
Dmitry Volodin
|
| 239 |
+
Domen Kožar
|
| 240 |
+
Dominic Davis-Foster
|
| 241 |
+
Donald Stufft
|
| 242 |
+
Dongweiming
|
| 243 |
+
doron zarhi
|
| 244 |
+
Dos Moonen
|
| 245 |
+
Douglas Thor
|
| 246 |
+
DrFeathers
|
| 247 |
+
Dustin Ingram
|
| 248 |
+
Dustin Rodrigues
|
| 249 |
+
Dwayne Bailey
|
| 250 |
+
Ed Morley
|
| 251 |
+
Edgar Ramírez
|
| 252 |
+
Edgar Ramírez Mondragón
|
| 253 |
+
Ee Durbin
|
| 254 |
+
Efflam Lemaillet
|
| 255 |
+
efflamlemaillet
|
| 256 |
+
Eitan Adler
|
| 257 |
+
ekristina
|
| 258 |
+
elainechan
|
| 259 |
+
Eli Schwartz
|
| 260 |
+
Elisha Hollander
|
| 261 |
+
Ellen Marie Dash
|
| 262 |
+
Emil Burzo
|
| 263 |
+
Emil Styrke
|
| 264 |
+
Emmanuel Arias
|
| 265 |
+
Endoh Takanao
|
| 266 |
+
enoch
|
| 267 |
+
Erdinc Mutlu
|
| 268 |
+
Eric Cousineau
|
| 269 |
+
Eric Gillingham
|
| 270 |
+
Eric Hanchrow
|
| 271 |
+
Eric Hopper
|
| 272 |
+
Erik M. Bray
|
| 273 |
+
Erik Rose
|
| 274 |
+
Erwin Janssen
|
| 275 |
+
Eugene Vereshchagin
|
| 276 |
+
everdimension
|
| 277 |
+
Federico
|
| 278 |
+
Felipe Peter
|
| 279 |
+
Felix Yan
|
| 280 |
+
fiber-space
|
| 281 |
+
Filip Kokosiński
|
| 282 |
+
Filipe Laíns
|
| 283 |
+
Finn Womack
|
| 284 |
+
finnagin
|
| 285 |
+
Flavio Amurrio
|
| 286 |
+
Florian Briand
|
| 287 |
+
Florian Rathgeber
|
| 288 |
+
Francesco
|
| 289 |
+
Francesco Montesano
|
| 290 |
+
Fredrik Orderud
|
| 291 |
+
Fredrik Roubert
|
| 292 |
+
Frost Ming
|
| 293 |
+
Gabriel Curio
|
| 294 |
+
Gabriel de Perthuis
|
| 295 |
+
Garry Polley
|
| 296 |
+
gavin
|
| 297 |
+
gdanielson
|
| 298 |
+
Geoffrey Sneddon
|
| 299 |
+
George Margaritis
|
| 300 |
+
George Song
|
| 301 |
+
Georgi Valkov
|
| 302 |
+
Georgy Pchelkin
|
| 303 |
+
ghost
|
| 304 |
+
Giftlin Rajaiah
|
| 305 |
+
gizmoguy1
|
| 306 |
+
gkdoc
|
| 307 |
+
Godefroid Chapelle
|
| 308 |
+
Gopinath M
|
| 309 |
+
GOTO Hayato
|
| 310 |
+
gousaiyang
|
| 311 |
+
gpiks
|
| 312 |
+
Greg Roodt
|
| 313 |
+
Greg Ward
|
| 314 |
+
Guilherme Espada
|
| 315 |
+
Guillaume Seguin
|
| 316 |
+
gutsytechster
|
| 317 |
+
Guy Rozendorn
|
| 318 |
+
Guy Tuval
|
| 319 |
+
gzpan123
|
| 320 |
+
Hanjun Kim
|
| 321 |
+
Hari Charan
|
| 322 |
+
Harsh Vardhan
|
| 323 |
+
harupy
|
| 324 |
+
Harutaka Kawamura
|
| 325 |
+
hauntsaninja
|
| 326 |
+
Henrich Hartzer
|
| 327 |
+
Henry Schreiner
|
| 328 |
+
Herbert Pfennig
|
| 329 |
+
Holly Stotelmyer
|
| 330 |
+
Honnix
|
| 331 |
+
Hsiaoming Yang
|
| 332 |
+
Hugo Lopes Tavares
|
| 333 |
+
Hugo van Kemenade
|
| 334 |
+
Hugues Bruant
|
| 335 |
+
Hynek Schlawack
|
| 336 |
+
Ian Bicking
|
| 337 |
+
Ian Cordasco
|
| 338 |
+
Ian Lee
|
| 339 |
+
Ian Stapleton Cordasco
|
| 340 |
+
Ian Wienand
|
| 341 |
+
Igor Kuzmitshov
|
| 342 |
+
Igor Sobreira
|
| 343 |
+
Ikko Ashimine
|
| 344 |
+
Ilan Schnell
|
| 345 |
+
Illia Volochii
|
| 346 |
+
Ilya Baryshev
|
| 347 |
+
Inada Naoki
|
| 348 |
+
Ionel Cristian Mărieș
|
| 349 |
+
Ionel Maries Cristian
|
| 350 |
+
Itamar Turner-Trauring
|
| 351 |
+
iTrooz
|
| 352 |
+
Ivan Pozdeev
|
| 353 |
+
J. Nick Koston
|
| 354 |
+
Jacob Kim
|
| 355 |
+
Jacob Walls
|
| 356 |
+
Jaime Sanz
|
| 357 |
+
Jake Lishman
|
| 358 |
+
jakirkham
|
| 359 |
+
Jakub Kuczys
|
| 360 |
+
Jakub Stasiak
|
| 361 |
+
Jakub Vysoky
|
| 362 |
+
Jakub Wilk
|
| 363 |
+
James Cleveland
|
| 364 |
+
James Curtin
|
| 365 |
+
James Firth
|
| 366 |
+
James Gerity
|
| 367 |
+
James Polley
|
| 368 |
+
Jan Pokorný
|
| 369 |
+
Jannis Leidel
|
| 370 |
+
Jarek Potiuk
|
| 371 |
+
jarondl
|
| 372 |
+
Jason Curtis
|
| 373 |
+
Jason R. Coombs
|
| 374 |
+
JasonMo
|
| 375 |
+
JasonMo1
|
| 376 |
+
Jay Graves
|
| 377 |
+
Jean Abou Samra
|
| 378 |
+
Jean-Christophe Fillion-Robin
|
| 379 |
+
Jeff Barber
|
| 380 |
+
Jeff Dairiki
|
| 381 |
+
Jeff Widman
|
| 382 |
+
Jelmer Vernooij
|
| 383 |
+
jenix21
|
| 384 |
+
Jeremy Fleischman
|
| 385 |
+
Jeremy Stanley
|
| 386 |
+
Jeremy Zafran
|
| 387 |
+
Jesse Rittner
|
| 388 |
+
Jiashuo Li
|
| 389 |
+
Jim Fisher
|
| 390 |
+
Jim Garrison
|
| 391 |
+
Jinzhe Zeng
|
| 392 |
+
Jiun Bae
|
| 393 |
+
Jivan Amara
|
| 394 |
+
Joa
|
| 395 |
+
Joe Bylund
|
| 396 |
+
Joe Michelini
|
| 397 |
+
Johannes Altmanninger
|
| 398 |
+
John Paton
|
| 399 |
+
John Sirois
|
| 400 |
+
John T. Wodder II
|
| 401 |
+
John-Scott Atlakson
|
| 402 |
+
johnthagen
|
| 403 |
+
Jon Banafato
|
| 404 |
+
Jon Dufresne
|
| 405 |
+
Jon Parise
|
| 406 |
+
Jonas Nockert
|
| 407 |
+
Jonathan Herbert
|
| 408 |
+
Joonatan Partanen
|
| 409 |
+
Joost Molenaar
|
| 410 |
+
Jorge Niedbalski
|
| 411 |
+
Joseph Bylund
|
| 412 |
+
Joseph Long
|
| 413 |
+
Josh Bronson
|
| 414 |
+
Josh Cannon
|
| 415 |
+
Josh Hansen
|
| 416 |
+
Josh Schneier
|
| 417 |
+
Joshua
|
| 418 |
+
JoshuaPerdue
|
| 419 |
+
Juan Luis Cano Rodríguez
|
| 420 |
+
Juanjo Bazán
|
| 421 |
+
Judah Rand
|
| 422 |
+
Julian Berman
|
| 423 |
+
Julian Gethmann
|
| 424 |
+
Julien Demoor
|
| 425 |
+
July Tikhonov
|
| 426 |
+
Jussi Kukkonen
|
| 427 |
+
Justin van Heek
|
| 428 |
+
jwg4
|
| 429 |
+
Jyrki Pulliainen
|
| 430 |
+
Kai Chen
|
| 431 |
+
Kai Mueller
|
| 432 |
+
Kamal Bin Mustafa
|
| 433 |
+
Karolina Surma
|
| 434 |
+
kasium
|
| 435 |
+
kaustav haldar
|
| 436 |
+
keanemind
|
| 437 |
+
Keith Maxwell
|
| 438 |
+
Kelsey Hightower
|
| 439 |
+
Kenneth Belitzky
|
| 440 |
+
Kenneth Reitz
|
| 441 |
+
Kevin Burke
|
| 442 |
+
Kevin Carter
|
| 443 |
+
Kevin Frommelt
|
| 444 |
+
Kevin R Patterson
|
| 445 |
+
Kexuan Sun
|
| 446 |
+
Kit Randel
|
| 447 |
+
Klaas van Schelven
|
| 448 |
+
KOLANICH
|
| 449 |
+
konstin
|
| 450 |
+
kpinc
|
| 451 |
+
Krishan Bhasin
|
| 452 |
+
Krishna Oza
|
| 453 |
+
Kumar McMillan
|
| 454 |
+
Kuntal Majumder
|
| 455 |
+
Kurt McKee
|
| 456 |
+
Kyle Persohn
|
| 457 |
+
lakshmanaram
|
| 458 |
+
Laszlo Kiss-Kollar
|
| 459 |
+
Laurent Bristiel
|
| 460 |
+
Laurent LAPORTE
|
| 461 |
+
Laurie O
|
| 462 |
+
Laurie Opperman
|
| 463 |
+
layday
|
| 464 |
+
Leon Sasson
|
| 465 |
+
Lev Givon
|
| 466 |
+
Lincoln de Sousa
|
| 467 |
+
Lipis
|
| 468 |
+
lorddavidiii
|
| 469 |
+
Loren Carvalho
|
| 470 |
+
Lucas Cimon
|
| 471 |
+
Ludovic Gasc
|
| 472 |
+
Luis Medel
|
| 473 |
+
Lukas Geiger
|
| 474 |
+
Lukas Juhrich
|
| 475 |
+
Luke Macken
|
| 476 |
+
Luo Jiebin
|
| 477 |
+
luojiebin
|
| 478 |
+
luz.paz
|
| 479 |
+
László Kiss Kollár
|
| 480 |
+
M00nL1ght
|
| 481 |
+
Malcolm Smith
|
| 482 |
+
Marc Abramowitz
|
| 483 |
+
Marc Tamlyn
|
| 484 |
+
Marcus Smith
|
| 485 |
+
Mariatta
|
| 486 |
+
Mark Kohler
|
| 487 |
+
Mark McLoughlin
|
| 488 |
+
Mark Williams
|
| 489 |
+
Markus Hametner
|
| 490 |
+
Martey Dodoo
|
| 491 |
+
Martin Fischer
|
| 492 |
+
Martin Häcker
|
| 493 |
+
Martin Pavlasek
|
| 494 |
+
Masaki
|
| 495 |
+
Masklinn
|
| 496 |
+
Matej Stuchlik
|
| 497 |
+
Mathew Jennings
|
| 498 |
+
Mathieu Bridon
|
| 499 |
+
Mathieu Kniewallner
|
| 500 |
+
Matt Bacchi
|
| 501 |
+
Matt Good
|
| 502 |
+
Matt Maker
|
| 503 |
+
Matt Robenolt
|
| 504 |
+
Matt Wozniski
|
| 505 |
+
matthew
|
| 506 |
+
Matthew Einhorn
|
| 507 |
+
Matthew Feickert
|
| 508 |
+
Matthew Gilliard
|
| 509 |
+
Matthew Hughes
|
| 510 |
+
Matthew Iversen
|
| 511 |
+
Matthew Treinish
|
| 512 |
+
Matthew Trumbell
|
| 513 |
+
Matthew Willson
|
| 514 |
+
Matthias Bussonnier
|
| 515 |
+
mattip
|
| 516 |
+
Maurits van Rees
|
| 517 |
+
Max W Chase
|
| 518 |
+
Maxim Kurnikov
|
| 519 |
+
Maxime Rouyrre
|
| 520 |
+
mayeut
|
| 521 |
+
mbaluna
|
| 522 |
+
Md Sujauddin Sekh
|
| 523 |
+
mdebi
|
| 524 |
+
memoselyk
|
| 525 |
+
meowmeowcat
|
| 526 |
+
Michael
|
| 527 |
+
Michael Aquilina
|
| 528 |
+
Michael E. Karpeles
|
| 529 |
+
Michael Klich
|
| 530 |
+
Michael Mintz
|
| 531 |
+
Michael Williamson
|
| 532 |
+
michaelpacer
|
| 533 |
+
Michał Górny
|
| 534 |
+
Mickaël Schoentgen
|
| 535 |
+
Miguel Araujo Perez
|
| 536 |
+
Mihir Singh
|
| 537 |
+
Mike
|
| 538 |
+
Mike Hendricks
|
| 539 |
+
Min RK
|
| 540 |
+
MinRK
|
| 541 |
+
Miro Hrončok
|
| 542 |
+
Monica Baluna
|
| 543 |
+
montefra
|
| 544 |
+
Monty Taylor
|
| 545 |
+
morotti
|
| 546 |
+
mrKazzila
|
| 547 |
+
Muha Ajjan
|
| 548 |
+
Nadav Wexler
|
| 549 |
+
Nahuel Ambrosini
|
| 550 |
+
Nate Coraor
|
| 551 |
+
Nate Prewitt
|
| 552 |
+
Nathan Houghton
|
| 553 |
+
Nathaniel J. Smith
|
| 554 |
+
Nehal J Wani
|
| 555 |
+
Neil Botelho
|
| 556 |
+
Nguyễn Gia Phong
|
| 557 |
+
Nicholas Serra
|
| 558 |
+
Nick Coghlan
|
| 559 |
+
Nick Stenning
|
| 560 |
+
Nick Timkovich
|
| 561 |
+
Nicolas Bock
|
| 562 |
+
Nicole Harris
|
| 563 |
+
Nikhil Benesch
|
| 564 |
+
Nikhil Ladha
|
| 565 |
+
Nikita Chepanov
|
| 566 |
+
Nikolay Korolev
|
| 567 |
+
Nipunn Koorapati
|
| 568 |
+
Nitesh Sharma
|
| 569 |
+
Niyas Sait
|
| 570 |
+
Noah
|
| 571 |
+
Noah Gorny
|
| 572 |
+
Nowell Strite
|
| 573 |
+
NtaleGrey
|
| 574 |
+
nucccc
|
| 575 |
+
nvdv
|
| 576 |
+
OBITORASU
|
| 577 |
+
Ofek Lev
|
| 578 |
+
ofrinevo
|
| 579 |
+
Oleg Burnaev
|
| 580 |
+
Oliver Freund
|
| 581 |
+
Oliver Jeeves
|
| 582 |
+
Oliver Mannion
|
| 583 |
+
Oliver Tonnhofer
|
| 584 |
+
Olivier Girardot
|
| 585 |
+
Olivier Grisel
|
| 586 |
+
Ollie Rutherfurd
|
| 587 |
+
OMOTO Kenji
|
| 588 |
+
Omry Yadan
|
| 589 |
+
onlinejudge95
|
| 590 |
+
Oren Held
|
| 591 |
+
Oscar Benjamin
|
| 592 |
+
Oz N Tiram
|
| 593 |
+
Pachwenko
|
| 594 |
+
Patrick Dubroy
|
| 595 |
+
Patrick Jenkins
|
| 596 |
+
Patrick Lawson
|
| 597 |
+
patricktokeeffe
|
| 598 |
+
Patrik Kopkan
|
| 599 |
+
Paul Ganssle
|
| 600 |
+
Paul Kehrer
|
| 601 |
+
Paul Moore
|
| 602 |
+
Paul Nasrat
|
| 603 |
+
Paul Oswald
|
| 604 |
+
Paul van der Linden
|
| 605 |
+
Paulus Schoutsen
|
| 606 |
+
Pavel Safronov
|
| 607 |
+
Pavithra Eswaramoorthy
|
| 608 |
+
Pawel Jasinski
|
| 609 |
+
Paweł Szramowski
|
| 610 |
+
Pekka Klärck
|
| 611 |
+
Peter Gessler
|
| 612 |
+
Peter Lisák
|
| 613 |
+
Peter Shen
|
| 614 |
+
Peter Waller
|
| 615 |
+
Petr Viktorin
|
| 616 |
+
petr-tik
|
| 617 |
+
Phaneendra Chiruvella
|
| 618 |
+
Phil Elson
|
| 619 |
+
Phil Freo
|
| 620 |
+
Phil Pennock
|
| 621 |
+
Phil Whelan
|
| 622 |
+
Philip Jägenstedt
|
| 623 |
+
Philip Molloy
|
| 624 |
+
Philippe Ombredanne
|
| 625 |
+
Pi Delport
|
| 626 |
+
Pierre-Yves Rofes
|
| 627 |
+
Pieter Degroote
|
| 628 |
+
pip
|
| 629 |
+
Prabakaran Kumaresshan
|
| 630 |
+
Prabhjyotsing Surjit Singh Sodhi
|
| 631 |
+
Prabhu Marappan
|
| 632 |
+
Pradyun Gedam
|
| 633 |
+
Prashant Sharma
|
| 634 |
+
Pratik Mallya
|
| 635 |
+
pre-commit-ci[bot]
|
| 636 |
+
Preet Thakkar
|
| 637 |
+
Preston Holmes
|
| 638 |
+
Przemek Wrzos
|
| 639 |
+
Pulkit Goyal
|
| 640 |
+
q0w
|
| 641 |
+
Qiangning Hong
|
| 642 |
+
Qiming Xu
|
| 643 |
+
Quentin Lee
|
| 644 |
+
Quentin Pradet
|
| 645 |
+
R. David Murray
|
| 646 |
+
Rafael Caricio
|
| 647 |
+
Ralf Schmitt
|
| 648 |
+
Ran Benita
|
| 649 |
+
Randy Döring
|
| 650 |
+
Razzi Abuissa
|
| 651 |
+
rdb
|
| 652 |
+
Reece Dunham
|
| 653 |
+
Remi Rampin
|
| 654 |
+
Rene Dudfield
|
| 655 |
+
Riccardo Magliocchetti
|
| 656 |
+
Riccardo Schirone
|
| 657 |
+
Richard Jones
|
| 658 |
+
Richard Si
|
| 659 |
+
Ricky Ng-Adam
|
| 660 |
+
Rishi
|
| 661 |
+
rmorotti
|
| 662 |
+
RobberPhex
|
| 663 |
+
Robert Collins
|
| 664 |
+
Robert McGibbon
|
| 665 |
+
Robert Pollak
|
| 666 |
+
Robert T. McGibbon
|
| 667 |
+
robin elisha robinson
|
| 668 |
+
Roey Berman
|
| 669 |
+
Rohan Jain
|
| 670 |
+
Roman Bogorodskiy
|
| 671 |
+
Roman Donchenko
|
| 672 |
+
Romuald Brunet
|
| 673 |
+
ronaudinho
|
| 674 |
+
Ronny Pfannschmidt
|
| 675 |
+
Rory McCann
|
| 676 |
+
Ross Brattain
|
| 677 |
+
Roy Wellington Ⅳ
|
| 678 |
+
Ruairidh MacLeod
|
| 679 |
+
Russell Keith-Magee
|
| 680 |
+
Ryan Shepherd
|
| 681 |
+
Ryan Wooden
|
| 682 |
+
ryneeverett
|
| 683 |
+
S. Guliaev
|
| 684 |
+
Sachi King
|
| 685 |
+
Salvatore Rinchiera
|
| 686 |
+
sandeepkiran-js
|
| 687 |
+
Sander Van Balen
|
| 688 |
+
Savio Jomton
|
| 689 |
+
schlamar
|
| 690 |
+
Scott Kitterman
|
| 691 |
+
Sean
|
| 692 |
+
seanj
|
| 693 |
+
Sebastian Jordan
|
| 694 |
+
Sebastian Schaetz
|
| 695 |
+
Segev Finer
|
| 696 |
+
SeongSoo Cho
|
| 697 |
+
Sergey Vasilyev
|
| 698 |
+
Seth Michael Larson
|
| 699 |
+
Seth Woodworth
|
| 700 |
+
Shahar Epstein
|
| 701 |
+
Shantanu
|
| 702 |
+
shenxianpeng
|
| 703 |
+
shireenrao
|
| 704 |
+
Shivansh-007
|
| 705 |
+
Shixian Sheng
|
| 706 |
+
Shlomi Fish
|
| 707 |
+
Shovan Maity
|
| 708 |
+
Simeon Visser
|
| 709 |
+
Simon Cross
|
| 710 |
+
Simon Pichugin
|
| 711 |
+
sinoroc
|
| 712 |
+
sinscary
|
| 713 |
+
snook92
|
| 714 |
+
socketubs
|
| 715 |
+
Sorin Sbarnea
|
| 716 |
+
Srinivas Nyayapati
|
| 717 |
+
Srishti Hegde
|
| 718 |
+
Stavros Korokithakis
|
| 719 |
+
Stefan Scherfke
|
| 720 |
+
Stefano Rivera
|
| 721 |
+
Stephan Erb
|
| 722 |
+
Stephen Rosen
|
| 723 |
+
stepshal
|
| 724 |
+
Steve (Gadget) Barnes
|
| 725 |
+
Steve Barnes
|
| 726 |
+
Steve Dower
|
| 727 |
+
Steve Kowalik
|
| 728 |
+
Steven Myint
|
| 729 |
+
Steven Silvester
|
| 730 |
+
stonebig
|
| 731 |
+
studioj
|
| 732 |
+
Stéphane Bidoul
|
| 733 |
+
Stéphane Bidoul (ACSONE)
|
| 734 |
+
Stéphane Klein
|
| 735 |
+
Sumana Harihareswara
|
| 736 |
+
Surbhi Sharma
|
| 737 |
+
Sviatoslav Sydorenko
|
| 738 |
+
Sviatoslav Sydorenko (Святослав Сидоренко)
|
| 739 |
+
Swat009
|
| 740 |
+
Sylvain
|
| 741 |
+
Takayuki SHIMIZUKAWA
|
| 742 |
+
Taneli Hukkinen
|
| 743 |
+
tbeswick
|
| 744 |
+
Thiago
|
| 745 |
+
Thijs Triemstra
|
| 746 |
+
Thomas Fenzl
|
| 747 |
+
Thomas Grainger
|
| 748 |
+
Thomas Guettler
|
| 749 |
+
Thomas Johansson
|
| 750 |
+
Thomas Kluyver
|
| 751 |
+
Thomas Smith
|
| 752 |
+
Thomas VINCENT
|
| 753 |
+
Tim D. Smith
|
| 754 |
+
Tim Gates
|
| 755 |
+
Tim Harder
|
| 756 |
+
Tim Heap
|
| 757 |
+
tim smith
|
| 758 |
+
tinruufu
|
| 759 |
+
Tobias Hermann
|
| 760 |
+
Tom Forbes
|
| 761 |
+
Tom Freudenheim
|
| 762 |
+
Tom V
|
| 763 |
+
Tomas Hrnciar
|
| 764 |
+
Tomas Orsava
|
| 765 |
+
Tomer Chachamu
|
| 766 |
+
Tommi Enenkel | AnB
|
| 767 |
+
Tomáš Hrnčiar
|
| 768 |
+
Tony Beswick
|
| 769 |
+
Tony Narlock
|
| 770 |
+
Tony Zhaocheng Tan
|
| 771 |
+
TonyBeswick
|
| 772 |
+
toonarmycaptain
|
| 773 |
+
Toshio Kuratomi
|
| 774 |
+
toxinu
|
| 775 |
+
Travis Swicegood
|
| 776 |
+
Tushar Sadhwani
|
| 777 |
+
Tzu-ping Chung
|
| 778 |
+
Valentin Haenel
|
| 779 |
+
Victor Stinner
|
| 780 |
+
victorvpaulo
|
| 781 |
+
Vikram - Google
|
| 782 |
+
Viktor Szépe
|
| 783 |
+
Ville Skyttä
|
| 784 |
+
Vinay Sajip
|
| 785 |
+
Vincent Philippon
|
| 786 |
+
Vinicyus Macedo
|
| 787 |
+
Vipul Kumar
|
| 788 |
+
Vitaly Babiy
|
| 789 |
+
Vladimir Fokow
|
| 790 |
+
Vladimir Rutsky
|
| 791 |
+
W. Trevor King
|
| 792 |
+
Wil Tan
|
| 793 |
+
Wilfred Hughes
|
| 794 |
+
William Edwards
|
| 795 |
+
William ML Leslie
|
| 796 |
+
William T Olson
|
| 797 |
+
William Woodruff
|
| 798 |
+
Wilson Mo
|
| 799 |
+
wim glenn
|
| 800 |
+
Winson Luk
|
| 801 |
+
Wolfgang Maier
|
| 802 |
+
Wu Zhenyu
|
| 803 |
+
XAMES3
|
| 804 |
+
Xavier Fernandez
|
| 805 |
+
Xianpeng Shen
|
| 806 |
+
xoviat
|
| 807 |
+
xtreak
|
| 808 |
+
YAMAMOTO Takashi
|
| 809 |
+
Yen Chi Hsuan
|
| 810 |
+
Yeray Diaz Diaz
|
| 811 |
+
Yoval P
|
| 812 |
+
Yu Jian
|
| 813 |
+
Yuan Jing Vincent Yan
|
| 814 |
+
Yusuke Hayashi
|
| 815 |
+
Zearin
|
| 816 |
+
Zhiping Deng
|
| 817 |
+
ziebam
|
| 818 |
+
Zvezdan Petkovic
|
| 819 |
+
Łukasz Langa
|
| 820 |
+
Роман Донченко
|
| 821 |
+
Семён Марьясин
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/licenses/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2008-present The pip developers (see AUTHORS.txt file)
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
a copy of this software and associated documentation files (the
|
| 5 |
+
"Software"), to deal in the Software without restriction, including
|
| 6 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
the following conditions:
|
| 10 |
+
|
| 11 |
+
The above copyright notice and this permission notice shall be
|
| 12 |
+
included in all copies or substantial portions of the Software.
|
| 13 |
+
|
| 14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
.venv/lib/python3.13/site-packages/pip-25.1.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/columns.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import defaultdict
|
| 2 |
+
from itertools import chain
|
| 3 |
+
from operator import itemgetter
|
| 4 |
+
from typing import Dict, Iterable, List, Optional, Tuple
|
| 5 |
+
|
| 6 |
+
from .align import Align, AlignMethod
|
| 7 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 8 |
+
from .constrain import Constrain
|
| 9 |
+
from .measure import Measurement
|
| 10 |
+
from .padding import Padding, PaddingDimensions
|
| 11 |
+
from .table import Table
|
| 12 |
+
from .text import TextType
|
| 13 |
+
from .jupyter import JupyterMixin
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class Columns(JupyterMixin):
|
| 17 |
+
"""Display renderables in neat columns.
|
| 18 |
+
|
| 19 |
+
Args:
|
| 20 |
+
renderables (Iterable[RenderableType]): Any number of Rich renderables (including str).
|
| 21 |
+
width (int, optional): The desired width of the columns, or None to auto detect. Defaults to None.
|
| 22 |
+
padding (PaddingDimensions, optional): Optional padding around cells. Defaults to (0, 1).
|
| 23 |
+
expand (bool, optional): Expand columns to full width. Defaults to False.
|
| 24 |
+
equal (bool, optional): Arrange in to equal sized columns. Defaults to False.
|
| 25 |
+
column_first (bool, optional): Align items from top to bottom (rather than left to right). Defaults to False.
|
| 26 |
+
right_to_left (bool, optional): Start column from right hand side. Defaults to False.
|
| 27 |
+
align (str, optional): Align value ("left", "right", or "center") or None for default. Defaults to None.
|
| 28 |
+
title (TextType, optional): Optional title for Columns.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
def __init__(
|
| 32 |
+
self,
|
| 33 |
+
renderables: Optional[Iterable[RenderableType]] = None,
|
| 34 |
+
padding: PaddingDimensions = (0, 1),
|
| 35 |
+
*,
|
| 36 |
+
width: Optional[int] = None,
|
| 37 |
+
expand: bool = False,
|
| 38 |
+
equal: bool = False,
|
| 39 |
+
column_first: bool = False,
|
| 40 |
+
right_to_left: bool = False,
|
| 41 |
+
align: Optional[AlignMethod] = None,
|
| 42 |
+
title: Optional[TextType] = None,
|
| 43 |
+
) -> None:
|
| 44 |
+
self.renderables = list(renderables or [])
|
| 45 |
+
self.width = width
|
| 46 |
+
self.padding = padding
|
| 47 |
+
self.expand = expand
|
| 48 |
+
self.equal = equal
|
| 49 |
+
self.column_first = column_first
|
| 50 |
+
self.right_to_left = right_to_left
|
| 51 |
+
self.align: Optional[AlignMethod] = align
|
| 52 |
+
self.title = title
|
| 53 |
+
|
| 54 |
+
def add_renderable(self, renderable: RenderableType) -> None:
|
| 55 |
+
"""Add a renderable to the columns.
|
| 56 |
+
|
| 57 |
+
Args:
|
| 58 |
+
renderable (RenderableType): Any renderable object.
|
| 59 |
+
"""
|
| 60 |
+
self.renderables.append(renderable)
|
| 61 |
+
|
| 62 |
+
def __rich_console__(
|
| 63 |
+
self, console: Console, options: ConsoleOptions
|
| 64 |
+
) -> RenderResult:
|
| 65 |
+
render_str = console.render_str
|
| 66 |
+
renderables = [
|
| 67 |
+
render_str(renderable) if isinstance(renderable, str) else renderable
|
| 68 |
+
for renderable in self.renderables
|
| 69 |
+
]
|
| 70 |
+
if not renderables:
|
| 71 |
+
return
|
| 72 |
+
_top, right, _bottom, left = Padding.unpack(self.padding)
|
| 73 |
+
width_padding = max(left, right)
|
| 74 |
+
max_width = options.max_width
|
| 75 |
+
widths: Dict[int, int] = defaultdict(int)
|
| 76 |
+
column_count = len(renderables)
|
| 77 |
+
|
| 78 |
+
get_measurement = Measurement.get
|
| 79 |
+
renderable_widths = [
|
| 80 |
+
get_measurement(console, options, renderable).maximum
|
| 81 |
+
for renderable in renderables
|
| 82 |
+
]
|
| 83 |
+
if self.equal:
|
| 84 |
+
renderable_widths = [max(renderable_widths)] * len(renderable_widths)
|
| 85 |
+
|
| 86 |
+
def iter_renderables(
|
| 87 |
+
column_count: int,
|
| 88 |
+
) -> Iterable[Tuple[int, Optional[RenderableType]]]:
|
| 89 |
+
item_count = len(renderables)
|
| 90 |
+
if self.column_first:
|
| 91 |
+
width_renderables = list(zip(renderable_widths, renderables))
|
| 92 |
+
|
| 93 |
+
column_lengths: List[int] = [item_count // column_count] * column_count
|
| 94 |
+
for col_no in range(item_count % column_count):
|
| 95 |
+
column_lengths[col_no] += 1
|
| 96 |
+
|
| 97 |
+
row_count = (item_count + column_count - 1) // column_count
|
| 98 |
+
cells = [[-1] * column_count for _ in range(row_count)]
|
| 99 |
+
row = col = 0
|
| 100 |
+
for index in range(item_count):
|
| 101 |
+
cells[row][col] = index
|
| 102 |
+
column_lengths[col] -= 1
|
| 103 |
+
if column_lengths[col]:
|
| 104 |
+
row += 1
|
| 105 |
+
else:
|
| 106 |
+
col += 1
|
| 107 |
+
row = 0
|
| 108 |
+
for index in chain.from_iterable(cells):
|
| 109 |
+
if index == -1:
|
| 110 |
+
break
|
| 111 |
+
yield width_renderables[index]
|
| 112 |
+
else:
|
| 113 |
+
yield from zip(renderable_widths, renderables)
|
| 114 |
+
# Pad odd elements with spaces
|
| 115 |
+
if item_count % column_count:
|
| 116 |
+
for _ in range(column_count - (item_count % column_count)):
|
| 117 |
+
yield 0, None
|
| 118 |
+
|
| 119 |
+
table = Table.grid(padding=self.padding, collapse_padding=True, pad_edge=False)
|
| 120 |
+
table.expand = self.expand
|
| 121 |
+
table.title = self.title
|
| 122 |
+
|
| 123 |
+
if self.width is not None:
|
| 124 |
+
column_count = (max_width) // (self.width + width_padding)
|
| 125 |
+
for _ in range(column_count):
|
| 126 |
+
table.add_column(width=self.width)
|
| 127 |
+
else:
|
| 128 |
+
while column_count > 1:
|
| 129 |
+
widths.clear()
|
| 130 |
+
column_no = 0
|
| 131 |
+
for renderable_width, _ in iter_renderables(column_count):
|
| 132 |
+
widths[column_no] = max(widths[column_no], renderable_width)
|
| 133 |
+
total_width = sum(widths.values()) + width_padding * (
|
| 134 |
+
len(widths) - 1
|
| 135 |
+
)
|
| 136 |
+
if total_width > max_width:
|
| 137 |
+
column_count = len(widths) - 1
|
| 138 |
+
break
|
| 139 |
+
else:
|
| 140 |
+
column_no = (column_no + 1) % column_count
|
| 141 |
+
else:
|
| 142 |
+
break
|
| 143 |
+
|
| 144 |
+
get_renderable = itemgetter(1)
|
| 145 |
+
_renderables = [
|
| 146 |
+
get_renderable(_renderable)
|
| 147 |
+
for _renderable in iter_renderables(column_count)
|
| 148 |
+
]
|
| 149 |
+
if self.equal:
|
| 150 |
+
_renderables = [
|
| 151 |
+
None
|
| 152 |
+
if renderable is None
|
| 153 |
+
else Constrain(renderable, renderable_widths[0])
|
| 154 |
+
for renderable in _renderables
|
| 155 |
+
]
|
| 156 |
+
if self.align:
|
| 157 |
+
align = self.align
|
| 158 |
+
_Align = Align
|
| 159 |
+
_renderables = [
|
| 160 |
+
None if renderable is None else _Align(renderable, align)
|
| 161 |
+
for renderable in _renderables
|
| 162 |
+
]
|
| 163 |
+
|
| 164 |
+
right_to_left = self.right_to_left
|
| 165 |
+
add_row = table.add_row
|
| 166 |
+
for start in range(0, len(_renderables), column_count):
|
| 167 |
+
row = _renderables[start : start + column_count]
|
| 168 |
+
if right_to_left:
|
| 169 |
+
row = row[::-1]
|
| 170 |
+
add_row(*row)
|
| 171 |
+
yield table
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__": # pragma: no cover
|
| 175 |
+
import os
|
| 176 |
+
|
| 177 |
+
console = Console()
|
| 178 |
+
|
| 179 |
+
files = [f"{i} {s}" for i, s in enumerate(sorted(os.listdir()))]
|
| 180 |
+
columns = Columns(files, padding=(0, 1), expand=False, equal=False)
|
| 181 |
+
console.print(columns)
|
| 182 |
+
console.rule()
|
| 183 |
+
columns.column_first = True
|
| 184 |
+
console.print(columns)
|
| 185 |
+
columns.right_to_left = True
|
| 186 |
+
console.rule()
|
| 187 |
+
console.print(columns)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/console.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/constrain.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, TYPE_CHECKING
|
| 2 |
+
|
| 3 |
+
from .jupyter import JupyterMixin
|
| 4 |
+
from .measure import Measurement
|
| 5 |
+
|
| 6 |
+
if TYPE_CHECKING:
|
| 7 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class Constrain(JupyterMixin):
|
| 11 |
+
"""Constrain the width of a renderable to a given number of characters.
|
| 12 |
+
|
| 13 |
+
Args:
|
| 14 |
+
renderable (RenderableType): A renderable object.
|
| 15 |
+
width (int, optional): The maximum width (in characters) to render. Defaults to 80.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
def __init__(self, renderable: "RenderableType", width: Optional[int] = 80) -> None:
|
| 19 |
+
self.renderable = renderable
|
| 20 |
+
self.width = width
|
| 21 |
+
|
| 22 |
+
def __rich_console__(
|
| 23 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 24 |
+
) -> "RenderResult":
|
| 25 |
+
if self.width is None:
|
| 26 |
+
yield self.renderable
|
| 27 |
+
else:
|
| 28 |
+
child_options = options.update_width(min(self.width, options.max_width))
|
| 29 |
+
yield from console.render(self.renderable, child_options)
|
| 30 |
+
|
| 31 |
+
def __rich_measure__(
|
| 32 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 33 |
+
) -> "Measurement":
|
| 34 |
+
if self.width is not None:
|
| 35 |
+
options = options.update_width(self.width)
|
| 36 |
+
measurement = Measurement.get(console, options, self.renderable)
|
| 37 |
+
return measurement
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/containers.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from itertools import zip_longest
|
| 2 |
+
from typing import (
|
| 3 |
+
TYPE_CHECKING,
|
| 4 |
+
Iterable,
|
| 5 |
+
Iterator,
|
| 6 |
+
List,
|
| 7 |
+
Optional,
|
| 8 |
+
TypeVar,
|
| 9 |
+
Union,
|
| 10 |
+
overload,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING:
|
| 14 |
+
from .console import (
|
| 15 |
+
Console,
|
| 16 |
+
ConsoleOptions,
|
| 17 |
+
JustifyMethod,
|
| 18 |
+
OverflowMethod,
|
| 19 |
+
RenderResult,
|
| 20 |
+
RenderableType,
|
| 21 |
+
)
|
| 22 |
+
from .text import Text
|
| 23 |
+
|
| 24 |
+
from .cells import cell_len
|
| 25 |
+
from .measure import Measurement
|
| 26 |
+
|
| 27 |
+
T = TypeVar("T")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class Renderables:
|
| 31 |
+
"""A list subclass which renders its contents to the console."""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self, renderables: Optional[Iterable["RenderableType"]] = None
|
| 35 |
+
) -> None:
|
| 36 |
+
self._renderables: List["RenderableType"] = (
|
| 37 |
+
list(renderables) if renderables is not None else []
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
def __rich_console__(
|
| 41 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 42 |
+
) -> "RenderResult":
|
| 43 |
+
"""Console render method to insert line-breaks."""
|
| 44 |
+
yield from self._renderables
|
| 45 |
+
|
| 46 |
+
def __rich_measure__(
|
| 47 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 48 |
+
) -> "Measurement":
|
| 49 |
+
dimensions = [
|
| 50 |
+
Measurement.get(console, options, renderable)
|
| 51 |
+
for renderable in self._renderables
|
| 52 |
+
]
|
| 53 |
+
if not dimensions:
|
| 54 |
+
return Measurement(1, 1)
|
| 55 |
+
_min = max(dimension.minimum for dimension in dimensions)
|
| 56 |
+
_max = max(dimension.maximum for dimension in dimensions)
|
| 57 |
+
return Measurement(_min, _max)
|
| 58 |
+
|
| 59 |
+
def append(self, renderable: "RenderableType") -> None:
|
| 60 |
+
self._renderables.append(renderable)
|
| 61 |
+
|
| 62 |
+
def __iter__(self) -> Iterable["RenderableType"]:
|
| 63 |
+
return iter(self._renderables)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class Lines:
|
| 67 |
+
"""A list subclass which can render to the console."""
|
| 68 |
+
|
| 69 |
+
def __init__(self, lines: Iterable["Text"] = ()) -> None:
|
| 70 |
+
self._lines: List["Text"] = list(lines)
|
| 71 |
+
|
| 72 |
+
def __repr__(self) -> str:
|
| 73 |
+
return f"Lines({self._lines!r})"
|
| 74 |
+
|
| 75 |
+
def __iter__(self) -> Iterator["Text"]:
|
| 76 |
+
return iter(self._lines)
|
| 77 |
+
|
| 78 |
+
@overload
|
| 79 |
+
def __getitem__(self, index: int) -> "Text":
|
| 80 |
+
...
|
| 81 |
+
|
| 82 |
+
@overload
|
| 83 |
+
def __getitem__(self, index: slice) -> List["Text"]:
|
| 84 |
+
...
|
| 85 |
+
|
| 86 |
+
def __getitem__(self, index: Union[slice, int]) -> Union["Text", List["Text"]]:
|
| 87 |
+
return self._lines[index]
|
| 88 |
+
|
| 89 |
+
def __setitem__(self, index: int, value: "Text") -> "Lines":
|
| 90 |
+
self._lines[index] = value
|
| 91 |
+
return self
|
| 92 |
+
|
| 93 |
+
def __len__(self) -> int:
|
| 94 |
+
return self._lines.__len__()
|
| 95 |
+
|
| 96 |
+
def __rich_console__(
|
| 97 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 98 |
+
) -> "RenderResult":
|
| 99 |
+
"""Console render method to insert line-breaks."""
|
| 100 |
+
yield from self._lines
|
| 101 |
+
|
| 102 |
+
def append(self, line: "Text") -> None:
|
| 103 |
+
self._lines.append(line)
|
| 104 |
+
|
| 105 |
+
def extend(self, lines: Iterable["Text"]) -> None:
|
| 106 |
+
self._lines.extend(lines)
|
| 107 |
+
|
| 108 |
+
def pop(self, index: int = -1) -> "Text":
|
| 109 |
+
return self._lines.pop(index)
|
| 110 |
+
|
| 111 |
+
def justify(
|
| 112 |
+
self,
|
| 113 |
+
console: "Console",
|
| 114 |
+
width: int,
|
| 115 |
+
justify: "JustifyMethod" = "left",
|
| 116 |
+
overflow: "OverflowMethod" = "fold",
|
| 117 |
+
) -> None:
|
| 118 |
+
"""Justify and overflow text to a given width.
|
| 119 |
+
|
| 120 |
+
Args:
|
| 121 |
+
console (Console): Console instance.
|
| 122 |
+
width (int): Number of cells available per line.
|
| 123 |
+
justify (str, optional): Default justify method for text: "left", "center", "full" or "right". Defaults to "left".
|
| 124 |
+
overflow (str, optional): Default overflow for text: "crop", "fold", or "ellipsis". Defaults to "fold".
|
| 125 |
+
|
| 126 |
+
"""
|
| 127 |
+
from .text import Text
|
| 128 |
+
|
| 129 |
+
if justify == "left":
|
| 130 |
+
for line in self._lines:
|
| 131 |
+
line.truncate(width, overflow=overflow, pad=True)
|
| 132 |
+
elif justify == "center":
|
| 133 |
+
for line in self._lines:
|
| 134 |
+
line.rstrip()
|
| 135 |
+
line.truncate(width, overflow=overflow)
|
| 136 |
+
line.pad_left((width - cell_len(line.plain)) // 2)
|
| 137 |
+
line.pad_right(width - cell_len(line.plain))
|
| 138 |
+
elif justify == "right":
|
| 139 |
+
for line in self._lines:
|
| 140 |
+
line.rstrip()
|
| 141 |
+
line.truncate(width, overflow=overflow)
|
| 142 |
+
line.pad_left(width - cell_len(line.plain))
|
| 143 |
+
elif justify == "full":
|
| 144 |
+
for line_index, line in enumerate(self._lines):
|
| 145 |
+
if line_index == len(self._lines) - 1:
|
| 146 |
+
break
|
| 147 |
+
words = line.split(" ")
|
| 148 |
+
words_size = sum(cell_len(word.plain) for word in words)
|
| 149 |
+
num_spaces = len(words) - 1
|
| 150 |
+
spaces = [1 for _ in range(num_spaces)]
|
| 151 |
+
index = 0
|
| 152 |
+
if spaces:
|
| 153 |
+
while words_size + num_spaces < width:
|
| 154 |
+
spaces[len(spaces) - index - 1] += 1
|
| 155 |
+
num_spaces += 1
|
| 156 |
+
index = (index + 1) % len(spaces)
|
| 157 |
+
tokens: List[Text] = []
|
| 158 |
+
for index, (word, next_word) in enumerate(
|
| 159 |
+
zip_longest(words, words[1:])
|
| 160 |
+
):
|
| 161 |
+
tokens.append(word)
|
| 162 |
+
if index < len(spaces):
|
| 163 |
+
style = word.get_style_at_offset(console, -1)
|
| 164 |
+
next_style = next_word.get_style_at_offset(console, 0)
|
| 165 |
+
space_style = style if style == next_style else line.style
|
| 166 |
+
tokens.append(Text(" " * spaces[index], style=space_style))
|
| 167 |
+
self[line_index] = Text("").join(tokens)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/control.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import time
|
| 3 |
+
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Union
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 8):
|
| 6 |
+
from typing import Final
|
| 7 |
+
else:
|
| 8 |
+
from pip._vendor.typing_extensions import Final # pragma: no cover
|
| 9 |
+
|
| 10 |
+
from .segment import ControlCode, ControlType, Segment
|
| 11 |
+
|
| 12 |
+
if TYPE_CHECKING:
|
| 13 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 14 |
+
|
| 15 |
+
STRIP_CONTROL_CODES: Final = [
|
| 16 |
+
7, # Bell
|
| 17 |
+
8, # Backspace
|
| 18 |
+
11, # Vertical tab
|
| 19 |
+
12, # Form feed
|
| 20 |
+
13, # Carriage return
|
| 21 |
+
]
|
| 22 |
+
_CONTROL_STRIP_TRANSLATE: Final = {
|
| 23 |
+
_codepoint: None for _codepoint in STRIP_CONTROL_CODES
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
CONTROL_ESCAPE: Final = {
|
| 27 |
+
7: "\\a",
|
| 28 |
+
8: "\\b",
|
| 29 |
+
11: "\\v",
|
| 30 |
+
12: "\\f",
|
| 31 |
+
13: "\\r",
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
CONTROL_CODES_FORMAT: Dict[int, Callable[..., str]] = {
|
| 35 |
+
ControlType.BELL: lambda: "\x07",
|
| 36 |
+
ControlType.CARRIAGE_RETURN: lambda: "\r",
|
| 37 |
+
ControlType.HOME: lambda: "\x1b[H",
|
| 38 |
+
ControlType.CLEAR: lambda: "\x1b[2J",
|
| 39 |
+
ControlType.ENABLE_ALT_SCREEN: lambda: "\x1b[?1049h",
|
| 40 |
+
ControlType.DISABLE_ALT_SCREEN: lambda: "\x1b[?1049l",
|
| 41 |
+
ControlType.SHOW_CURSOR: lambda: "\x1b[?25h",
|
| 42 |
+
ControlType.HIDE_CURSOR: lambda: "\x1b[?25l",
|
| 43 |
+
ControlType.CURSOR_UP: lambda param: f"\x1b[{param}A",
|
| 44 |
+
ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B",
|
| 45 |
+
ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C",
|
| 46 |
+
ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D",
|
| 47 |
+
ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G",
|
| 48 |
+
ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K",
|
| 49 |
+
ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H",
|
| 50 |
+
ControlType.SET_WINDOW_TITLE: lambda title: f"\x1b]0;{title}\x07",
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Control:
|
| 55 |
+
"""A renderable that inserts a control code (non printable but may move cursor).
|
| 56 |
+
|
| 57 |
+
Args:
|
| 58 |
+
*codes (str): Positional arguments are either a :class:`~rich.segment.ControlType` enum or a
|
| 59 |
+
tuple of ControlType and an integer parameter
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
__slots__ = ["segment"]
|
| 63 |
+
|
| 64 |
+
def __init__(self, *codes: Union[ControlType, ControlCode]) -> None:
|
| 65 |
+
control_codes: List[ControlCode] = [
|
| 66 |
+
(code,) if isinstance(code, ControlType) else code for code in codes
|
| 67 |
+
]
|
| 68 |
+
_format_map = CONTROL_CODES_FORMAT
|
| 69 |
+
rendered_codes = "".join(
|
| 70 |
+
_format_map[code](*parameters) for code, *parameters in control_codes
|
| 71 |
+
)
|
| 72 |
+
self.segment = Segment(rendered_codes, None, control_codes)
|
| 73 |
+
|
| 74 |
+
@classmethod
|
| 75 |
+
def bell(cls) -> "Control":
|
| 76 |
+
"""Ring the 'bell'."""
|
| 77 |
+
return cls(ControlType.BELL)
|
| 78 |
+
|
| 79 |
+
@classmethod
|
| 80 |
+
def home(cls) -> "Control":
|
| 81 |
+
"""Move cursor to 'home' position."""
|
| 82 |
+
return cls(ControlType.HOME)
|
| 83 |
+
|
| 84 |
+
@classmethod
|
| 85 |
+
def move(cls, x: int = 0, y: int = 0) -> "Control":
|
| 86 |
+
"""Move cursor relative to current position.
|
| 87 |
+
|
| 88 |
+
Args:
|
| 89 |
+
x (int): X offset.
|
| 90 |
+
y (int): Y offset.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
~Control: Control object.
|
| 94 |
+
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
def get_codes() -> Iterable[ControlCode]:
|
| 98 |
+
control = ControlType
|
| 99 |
+
if x:
|
| 100 |
+
yield (
|
| 101 |
+
control.CURSOR_FORWARD if x > 0 else control.CURSOR_BACKWARD,
|
| 102 |
+
abs(x),
|
| 103 |
+
)
|
| 104 |
+
if y:
|
| 105 |
+
yield (
|
| 106 |
+
control.CURSOR_DOWN if y > 0 else control.CURSOR_UP,
|
| 107 |
+
abs(y),
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
control = cls(*get_codes())
|
| 111 |
+
return control
|
| 112 |
+
|
| 113 |
+
@classmethod
|
| 114 |
+
def move_to_column(cls, x: int, y: int = 0) -> "Control":
|
| 115 |
+
"""Move to the given column, optionally add offset to row.
|
| 116 |
+
|
| 117 |
+
Returns:
|
| 118 |
+
x (int): absolute x (column)
|
| 119 |
+
y (int): optional y offset (row)
|
| 120 |
+
|
| 121 |
+
Returns:
|
| 122 |
+
~Control: Control object.
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
return (
|
| 126 |
+
cls(
|
| 127 |
+
(ControlType.CURSOR_MOVE_TO_COLUMN, x),
|
| 128 |
+
(
|
| 129 |
+
ControlType.CURSOR_DOWN if y > 0 else ControlType.CURSOR_UP,
|
| 130 |
+
abs(y),
|
| 131 |
+
),
|
| 132 |
+
)
|
| 133 |
+
if y
|
| 134 |
+
else cls((ControlType.CURSOR_MOVE_TO_COLUMN, x))
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
@classmethod
|
| 138 |
+
def move_to(cls, x: int, y: int) -> "Control":
|
| 139 |
+
"""Move cursor to absolute position.
|
| 140 |
+
|
| 141 |
+
Args:
|
| 142 |
+
x (int): x offset (column)
|
| 143 |
+
y (int): y offset (row)
|
| 144 |
+
|
| 145 |
+
Returns:
|
| 146 |
+
~Control: Control object.
|
| 147 |
+
"""
|
| 148 |
+
return cls((ControlType.CURSOR_MOVE_TO, x, y))
|
| 149 |
+
|
| 150 |
+
@classmethod
|
| 151 |
+
def clear(cls) -> "Control":
|
| 152 |
+
"""Clear the screen."""
|
| 153 |
+
return cls(ControlType.CLEAR)
|
| 154 |
+
|
| 155 |
+
@classmethod
|
| 156 |
+
def show_cursor(cls, show: bool) -> "Control":
|
| 157 |
+
"""Show or hide the cursor."""
|
| 158 |
+
return cls(ControlType.SHOW_CURSOR if show else ControlType.HIDE_CURSOR)
|
| 159 |
+
|
| 160 |
+
@classmethod
|
| 161 |
+
def alt_screen(cls, enable: bool) -> "Control":
|
| 162 |
+
"""Enable or disable alt screen."""
|
| 163 |
+
if enable:
|
| 164 |
+
return cls(ControlType.ENABLE_ALT_SCREEN, ControlType.HOME)
|
| 165 |
+
else:
|
| 166 |
+
return cls(ControlType.DISABLE_ALT_SCREEN)
|
| 167 |
+
|
| 168 |
+
@classmethod
|
| 169 |
+
def title(cls, title: str) -> "Control":
|
| 170 |
+
"""Set the terminal window title
|
| 171 |
+
|
| 172 |
+
Args:
|
| 173 |
+
title (str): The new terminal window title
|
| 174 |
+
"""
|
| 175 |
+
return cls((ControlType.SET_WINDOW_TITLE, title))
|
| 176 |
+
|
| 177 |
+
def __str__(self) -> str:
|
| 178 |
+
return self.segment.text
|
| 179 |
+
|
| 180 |
+
def __rich_console__(
|
| 181 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 182 |
+
) -> "RenderResult":
|
| 183 |
+
if self.segment.text:
|
| 184 |
+
yield self.segment
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def strip_control_codes(
|
| 188 |
+
text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE
|
| 189 |
+
) -> str:
|
| 190 |
+
"""Remove control codes from text.
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
text (str): A string possibly contain control codes.
|
| 194 |
+
|
| 195 |
+
Returns:
|
| 196 |
+
str: String with control codes removed.
|
| 197 |
+
"""
|
| 198 |
+
return text.translate(_translate_table)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def escape_control_codes(
|
| 202 |
+
text: str,
|
| 203 |
+
_translate_table: Dict[int, str] = CONTROL_ESCAPE,
|
| 204 |
+
) -> str:
|
| 205 |
+
"""Replace control codes with their "escaped" equivalent in the given text.
|
| 206 |
+
(e.g. "\b" becomes "\\b")
|
| 207 |
+
|
| 208 |
+
Args:
|
| 209 |
+
text (str): A string possibly containing control codes.
|
| 210 |
+
|
| 211 |
+
Returns:
|
| 212 |
+
str: String with control codes replaced with their escaped version.
|
| 213 |
+
"""
|
| 214 |
+
return text.translate(_translate_table)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
if __name__ == "__main__": # pragma: no cover
|
| 218 |
+
from pip._vendor.rich.console import Console
|
| 219 |
+
|
| 220 |
+
console = Console()
|
| 221 |
+
console.print("Look at the title of your terminal window ^")
|
| 222 |
+
# console.print(Control((ControlType.SET_WINDOW_TITLE, "Hello, world!")))
|
| 223 |
+
for i in range(10):
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict
|
| 2 |
+
|
| 3 |
+
from .style import Style
|
| 4 |
+
|
| 5 |
+
DEFAULT_STYLES: Dict[str, Style] = {
|
| 6 |
+
"none": Style.null(),
|
| 7 |
+
"reset": Style(
|
| 8 |
+
color="default",
|
| 9 |
+
bgcolor="default",
|
| 10 |
+
dim=False,
|
| 11 |
+
bold=False,
|
| 12 |
+
italic=False,
|
| 13 |
+
underline=False,
|
| 14 |
+
blink=False,
|
| 15 |
+
blink2=False,
|
| 16 |
+
reverse=False,
|
| 17 |
+
conceal=False,
|
| 18 |
+
strike=False,
|
| 19 |
+
),
|
| 20 |
+
"dim": Style(dim=True),
|
| 21 |
+
"bright": Style(dim=False),
|
| 22 |
+
"bold": Style(bold=True),
|
| 23 |
+
"strong": Style(bold=True),
|
| 24 |
+
"code": Style(reverse=True, bold=True),
|
| 25 |
+
"italic": Style(italic=True),
|
| 26 |
+
"emphasize": Style(italic=True),
|
| 27 |
+
"underline": Style(underline=True),
|
| 28 |
+
"blink": Style(blink=True),
|
| 29 |
+
"blink2": Style(blink2=True),
|
| 30 |
+
"reverse": Style(reverse=True),
|
| 31 |
+
"strike": Style(strike=True),
|
| 32 |
+
"black": Style(color="black"),
|
| 33 |
+
"red": Style(color="red"),
|
| 34 |
+
"green": Style(color="green"),
|
| 35 |
+
"yellow": Style(color="yellow"),
|
| 36 |
+
"magenta": Style(color="magenta"),
|
| 37 |
+
"cyan": Style(color="cyan"),
|
| 38 |
+
"white": Style(color="white"),
|
| 39 |
+
"inspect.attr": Style(color="yellow", italic=True),
|
| 40 |
+
"inspect.attr.dunder": Style(color="yellow", italic=True, dim=True),
|
| 41 |
+
"inspect.callable": Style(bold=True, color="red"),
|
| 42 |
+
"inspect.async_def": Style(italic=True, color="bright_cyan"),
|
| 43 |
+
"inspect.def": Style(italic=True, color="bright_cyan"),
|
| 44 |
+
"inspect.class": Style(italic=True, color="bright_cyan"),
|
| 45 |
+
"inspect.error": Style(bold=True, color="red"),
|
| 46 |
+
"inspect.equals": Style(),
|
| 47 |
+
"inspect.help": Style(color="cyan"),
|
| 48 |
+
"inspect.doc": Style(dim=True),
|
| 49 |
+
"inspect.value.border": Style(color="green"),
|
| 50 |
+
"live.ellipsis": Style(bold=True, color="red"),
|
| 51 |
+
"layout.tree.row": Style(dim=False, color="red"),
|
| 52 |
+
"layout.tree.column": Style(dim=False, color="blue"),
|
| 53 |
+
"logging.keyword": Style(bold=True, color="yellow"),
|
| 54 |
+
"logging.level.notset": Style(dim=True),
|
| 55 |
+
"logging.level.debug": Style(color="green"),
|
| 56 |
+
"logging.level.info": Style(color="blue"),
|
| 57 |
+
"logging.level.warning": Style(color="yellow"),
|
| 58 |
+
"logging.level.error": Style(color="red", bold=True),
|
| 59 |
+
"logging.level.critical": Style(color="red", bold=True, reverse=True),
|
| 60 |
+
"log.level": Style.null(),
|
| 61 |
+
"log.time": Style(color="cyan", dim=True),
|
| 62 |
+
"log.message": Style.null(),
|
| 63 |
+
"log.path": Style(dim=True),
|
| 64 |
+
"repr.ellipsis": Style(color="yellow"),
|
| 65 |
+
"repr.indent": Style(color="green", dim=True),
|
| 66 |
+
"repr.error": Style(color="red", bold=True),
|
| 67 |
+
"repr.str": Style(color="green", italic=False, bold=False),
|
| 68 |
+
"repr.brace": Style(bold=True),
|
| 69 |
+
"repr.comma": Style(bold=True),
|
| 70 |
+
"repr.ipv4": Style(bold=True, color="bright_green"),
|
| 71 |
+
"repr.ipv6": Style(bold=True, color="bright_green"),
|
| 72 |
+
"repr.eui48": Style(bold=True, color="bright_green"),
|
| 73 |
+
"repr.eui64": Style(bold=True, color="bright_green"),
|
| 74 |
+
"repr.tag_start": Style(bold=True),
|
| 75 |
+
"repr.tag_name": Style(color="bright_magenta", bold=True),
|
| 76 |
+
"repr.tag_contents": Style(color="default"),
|
| 77 |
+
"repr.tag_end": Style(bold=True),
|
| 78 |
+
"repr.attrib_name": Style(color="yellow", italic=False),
|
| 79 |
+
"repr.attrib_equal": Style(bold=True),
|
| 80 |
+
"repr.attrib_value": Style(color="magenta", italic=False),
|
| 81 |
+
"repr.number": Style(color="cyan", bold=True, italic=False),
|
| 82 |
+
"repr.number_complex": Style(color="cyan", bold=True, italic=False), # same
|
| 83 |
+
"repr.bool_true": Style(color="bright_green", italic=True),
|
| 84 |
+
"repr.bool_false": Style(color="bright_red", italic=True),
|
| 85 |
+
"repr.none": Style(color="magenta", italic=True),
|
| 86 |
+
"repr.url": Style(underline=True, color="bright_blue", italic=False, bold=False),
|
| 87 |
+
"repr.uuid": Style(color="bright_yellow", bold=False),
|
| 88 |
+
"repr.call": Style(color="magenta", bold=True),
|
| 89 |
+
"repr.path": Style(color="magenta"),
|
| 90 |
+
"repr.filename": Style(color="bright_magenta"),
|
| 91 |
+
"rule.line": Style(color="bright_green"),
|
| 92 |
+
"rule.text": Style.null(),
|
| 93 |
+
"json.brace": Style(bold=True),
|
| 94 |
+
"json.bool_true": Style(color="bright_green", italic=True),
|
| 95 |
+
"json.bool_false": Style(color="bright_red", italic=True),
|
| 96 |
+
"json.null": Style(color="magenta", italic=True),
|
| 97 |
+
"json.number": Style(color="cyan", bold=True, italic=False),
|
| 98 |
+
"json.str": Style(color="green", italic=False, bold=False),
|
| 99 |
+
"json.key": Style(color="blue", bold=True),
|
| 100 |
+
"prompt": Style.null(),
|
| 101 |
+
"prompt.choices": Style(color="magenta", bold=True),
|
| 102 |
+
"prompt.default": Style(color="cyan", bold=True),
|
| 103 |
+
"prompt.invalid": Style(color="red"),
|
| 104 |
+
"prompt.invalid.choice": Style(color="red"),
|
| 105 |
+
"pretty": Style.null(),
|
| 106 |
+
"scope.border": Style(color="blue"),
|
| 107 |
+
"scope.key": Style(color="yellow", italic=True),
|
| 108 |
+
"scope.key.special": Style(color="yellow", italic=True, dim=True),
|
| 109 |
+
"scope.equals": Style(color="red"),
|
| 110 |
+
"table.header": Style(bold=True),
|
| 111 |
+
"table.footer": Style(bold=True),
|
| 112 |
+
"table.cell": Style.null(),
|
| 113 |
+
"table.title": Style(italic=True),
|
| 114 |
+
"table.caption": Style(italic=True, dim=True),
|
| 115 |
+
"traceback.error": Style(color="red", italic=True),
|
| 116 |
+
"traceback.border.syntax_error": Style(color="bright_red"),
|
| 117 |
+
"traceback.border": Style(color="red"),
|
| 118 |
+
"traceback.text": Style.null(),
|
| 119 |
+
"traceback.title": Style(color="red", bold=True),
|
| 120 |
+
"traceback.exc_type": Style(color="bright_red", bold=True),
|
| 121 |
+
"traceback.exc_value": Style.null(),
|
| 122 |
+
"traceback.offset": Style(color="bright_red", bold=True),
|
| 123 |
+
"traceback.error_range": Style(underline=True, bold=True),
|
| 124 |
+
"traceback.note": Style(color="green", bold=True),
|
| 125 |
+
"traceback.group.border": Style(color="magenta"),
|
| 126 |
+
"bar.back": Style(color="grey23"),
|
| 127 |
+
"bar.complete": Style(color="rgb(249,38,114)"),
|
| 128 |
+
"bar.finished": Style(color="rgb(114,156,31)"),
|
| 129 |
+
"bar.pulse": Style(color="rgb(249,38,114)"),
|
| 130 |
+
"progress.description": Style.null(),
|
| 131 |
+
"progress.filesize": Style(color="green"),
|
| 132 |
+
"progress.filesize.total": Style(color="green"),
|
| 133 |
+
"progress.download": Style(color="green"),
|
| 134 |
+
"progress.elapsed": Style(color="yellow"),
|
| 135 |
+
"progress.percentage": Style(color="magenta"),
|
| 136 |
+
"progress.remaining": Style(color="cyan"),
|
| 137 |
+
"progress.data.speed": Style(color="red"),
|
| 138 |
+
"progress.spinner": Style(color="green"),
|
| 139 |
+
"status.spinner": Style(color="green"),
|
| 140 |
+
"tree": Style(),
|
| 141 |
+
"tree.line": Style(),
|
| 142 |
+
"markdown.paragraph": Style(),
|
| 143 |
+
"markdown.text": Style(),
|
| 144 |
+
"markdown.em": Style(italic=True),
|
| 145 |
+
"markdown.emph": Style(italic=True), # For commonmark backwards compatibility
|
| 146 |
+
"markdown.strong": Style(bold=True),
|
| 147 |
+
"markdown.code": Style(bold=True, color="cyan", bgcolor="black"),
|
| 148 |
+
"markdown.code_block": Style(color="cyan", bgcolor="black"),
|
| 149 |
+
"markdown.block_quote": Style(color="magenta"),
|
| 150 |
+
"markdown.list": Style(color="cyan"),
|
| 151 |
+
"markdown.item": Style(),
|
| 152 |
+
"markdown.item.bullet": Style(color="yellow", bold=True),
|
| 153 |
+
"markdown.item.number": Style(color="yellow", bold=True),
|
| 154 |
+
"markdown.hr": Style(color="yellow"),
|
| 155 |
+
"markdown.h1.border": Style(),
|
| 156 |
+
"markdown.h1": Style(bold=True),
|
| 157 |
+
"markdown.h2": Style(bold=True, underline=True),
|
| 158 |
+
"markdown.h3": Style(bold=True),
|
| 159 |
+
"markdown.h4": Style(bold=True, dim=True),
|
| 160 |
+
"markdown.h5": Style(underline=True),
|
| 161 |
+
"markdown.h6": Style(italic=True),
|
| 162 |
+
"markdown.h7": Style(italic=True, dim=True),
|
| 163 |
+
"markdown.link": Style(color="bright_blue"),
|
| 164 |
+
"markdown.link_url": Style(color="blue", underline=True),
|
| 165 |
+
"markdown.s": Style(strike=True),
|
| 166 |
+
"iso8601.date": Style(color="blue"),
|
| 167 |
+
"iso8601.time": Style(color="magenta"),
|
| 168 |
+
"iso8601.timezone": Style(color="yellow"),
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
if __name__ == "__main__": # pragma: no cover
|
| 173 |
+
import argparse
|
| 174 |
+
import io
|
| 175 |
+
|
| 176 |
+
from pip._vendor.rich.console import Console
|
| 177 |
+
from pip._vendor.rich.table import Table
|
| 178 |
+
from pip._vendor.rich.text import Text
|
| 179 |
+
|
| 180 |
+
parser = argparse.ArgumentParser()
|
| 181 |
+
parser.add_argument("--html", action="store_true", help="Export as HTML table")
|
| 182 |
+
args = parser.parse_args()
|
| 183 |
+
html: bool = args.html
|
| 184 |
+
console = Console(record=True, width=70, file=io.StringIO()) if html else Console()
|
| 185 |
+
|
| 186 |
+
table = Table("Name", "Styling")
|
| 187 |
+
|
| 188 |
+
for style_name, style in DEFAULT_STYLES.items():
|
| 189 |
+
table.add_row(Text(style_name, style=style), str(style))
|
| 190 |
+
|
| 191 |
+
console.print(table)
|
| 192 |
+
if html:
|
| 193 |
+
print(console.export_html(inline_styles=True))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/diagnose.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import platform
|
| 3 |
+
|
| 4 |
+
from pip._vendor.rich import inspect
|
| 5 |
+
from pip._vendor.rich.console import Console, get_windows_console_features
|
| 6 |
+
from pip._vendor.rich.panel import Panel
|
| 7 |
+
from pip._vendor.rich.pretty import Pretty
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def report() -> None: # pragma: no cover
|
| 11 |
+
"""Print a report to the terminal with debugging information"""
|
| 12 |
+
console = Console()
|
| 13 |
+
inspect(console)
|
| 14 |
+
features = get_windows_console_features()
|
| 15 |
+
inspect(features)
|
| 16 |
+
|
| 17 |
+
env_names = (
|
| 18 |
+
"CLICOLOR",
|
| 19 |
+
"COLORTERM",
|
| 20 |
+
"COLUMNS",
|
| 21 |
+
"JPY_PARENT_PID",
|
| 22 |
+
"JUPYTER_COLUMNS",
|
| 23 |
+
"JUPYTER_LINES",
|
| 24 |
+
"LINES",
|
| 25 |
+
"NO_COLOR",
|
| 26 |
+
"TERM_PROGRAM",
|
| 27 |
+
"TERM",
|
| 28 |
+
"TTY_COMPATIBLE",
|
| 29 |
+
"VSCODE_VERBOSE_LOGGING",
|
| 30 |
+
)
|
| 31 |
+
env = {name: os.getenv(name) for name in env_names}
|
| 32 |
+
console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables"))
|
| 33 |
+
|
| 34 |
+
console.print(f'platform="{platform.system()}"')
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
if __name__ == "__main__": # pragma: no cover
|
| 38 |
+
report()
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/emoji.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import TYPE_CHECKING, Optional, Union
|
| 3 |
+
|
| 4 |
+
from .jupyter import JupyterMixin
|
| 5 |
+
from .segment import Segment
|
| 6 |
+
from .style import Style
|
| 7 |
+
from ._emoji_codes import EMOJI
|
| 8 |
+
from ._emoji_replace import _emoji_replace
|
| 9 |
+
|
| 10 |
+
if sys.version_info >= (3, 8):
|
| 11 |
+
from typing import Literal
|
| 12 |
+
else:
|
| 13 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
if TYPE_CHECKING:
|
| 17 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
EmojiVariant = Literal["emoji", "text"]
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class NoEmoji(Exception):
|
| 24 |
+
"""No emoji by that name."""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class Emoji(JupyterMixin):
|
| 28 |
+
__slots__ = ["name", "style", "_char", "variant"]
|
| 29 |
+
|
| 30 |
+
VARIANTS = {"text": "\uFE0E", "emoji": "\uFE0F"}
|
| 31 |
+
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
name: str,
|
| 35 |
+
style: Union[str, Style] = "none",
|
| 36 |
+
variant: Optional[EmojiVariant] = None,
|
| 37 |
+
) -> None:
|
| 38 |
+
"""A single emoji character.
|
| 39 |
+
|
| 40 |
+
Args:
|
| 41 |
+
name (str): Name of emoji.
|
| 42 |
+
style (Union[str, Style], optional): Optional style. Defaults to None.
|
| 43 |
+
|
| 44 |
+
Raises:
|
| 45 |
+
NoEmoji: If the emoji doesn't exist.
|
| 46 |
+
"""
|
| 47 |
+
self.name = name
|
| 48 |
+
self.style = style
|
| 49 |
+
self.variant = variant
|
| 50 |
+
try:
|
| 51 |
+
self._char = EMOJI[name]
|
| 52 |
+
except KeyError:
|
| 53 |
+
raise NoEmoji(f"No emoji called {name!r}")
|
| 54 |
+
if variant is not None:
|
| 55 |
+
self._char += self.VARIANTS.get(variant, "")
|
| 56 |
+
|
| 57 |
+
@classmethod
|
| 58 |
+
def replace(cls, text: str) -> str:
|
| 59 |
+
"""Replace emoji markup with corresponding unicode characters.
|
| 60 |
+
|
| 61 |
+
Args:
|
| 62 |
+
text (str): A string with emojis codes, e.g. "Hello :smiley:!"
|
| 63 |
+
|
| 64 |
+
Returns:
|
| 65 |
+
str: A string with emoji codes replaces with actual emoji.
|
| 66 |
+
"""
|
| 67 |
+
return _emoji_replace(text)
|
| 68 |
+
|
| 69 |
+
def __repr__(self) -> str:
|
| 70 |
+
return f"<emoji {self.name!r}>"
|
| 71 |
+
|
| 72 |
+
def __str__(self) -> str:
|
| 73 |
+
return self._char
|
| 74 |
+
|
| 75 |
+
def __rich_console__(
|
| 76 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 77 |
+
) -> "RenderResult":
|
| 78 |
+
yield Segment(self._char, console.get_style(self.style))
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
if __name__ == "__main__": # pragma: no cover
|
| 82 |
+
import sys
|
| 83 |
+
|
| 84 |
+
from pip._vendor.rich.columns import Columns
|
| 85 |
+
from pip._vendor.rich.console import Console
|
| 86 |
+
|
| 87 |
+
console = Console(record=True)
|
| 88 |
+
|
| 89 |
+
columns = Columns(
|
| 90 |
+
(f":{name}: {name}" for name in sorted(EMOJI.keys()) if "\u200D" not in name),
|
| 91 |
+
column_first=True,
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
console.print(columns)
|
| 95 |
+
if len(sys.argv) > 1:
|
| 96 |
+
console.save_html(sys.argv[1])
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/errors.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ConsoleError(Exception):
|
| 2 |
+
"""An error in console operation."""
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class StyleError(Exception):
|
| 6 |
+
"""An error in styles."""
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class StyleSyntaxError(ConsoleError):
|
| 10 |
+
"""Style was badly formatted."""
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class MissingStyle(StyleError):
|
| 14 |
+
"""No such style."""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class StyleStackError(ConsoleError):
|
| 18 |
+
"""Style stack is invalid."""
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class NotRenderableError(ConsoleError):
|
| 22 |
+
"""Object is not renderable."""
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class MarkupError(ConsoleError):
|
| 26 |
+
"""Markup was badly formatted."""
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class LiveError(ConsoleError):
|
| 30 |
+
"""Error related to Live display."""
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class NoAltScreen(ConsoleError):
|
| 34 |
+
"""Alt screen mode was required."""
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/file_proxy.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
from typing import IO, TYPE_CHECKING, Any, List
|
| 3 |
+
|
| 4 |
+
from .ansi import AnsiDecoder
|
| 5 |
+
from .text import Text
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from .console import Console
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class FileProxy(io.TextIOBase):
|
| 12 |
+
"""Wraps a file (e.g. sys.stdout) and redirects writes to a console."""
|
| 13 |
+
|
| 14 |
+
def __init__(self, console: "Console", file: IO[str]) -> None:
|
| 15 |
+
self.__console = console
|
| 16 |
+
self.__file = file
|
| 17 |
+
self.__buffer: List[str] = []
|
| 18 |
+
self.__ansi_decoder = AnsiDecoder()
|
| 19 |
+
|
| 20 |
+
@property
|
| 21 |
+
def rich_proxied_file(self) -> IO[str]:
|
| 22 |
+
"""Get proxied file."""
|
| 23 |
+
return self.__file
|
| 24 |
+
|
| 25 |
+
def __getattr__(self, name: str) -> Any:
|
| 26 |
+
return getattr(self.__file, name)
|
| 27 |
+
|
| 28 |
+
def write(self, text: str) -> int:
|
| 29 |
+
if not isinstance(text, str):
|
| 30 |
+
raise TypeError(f"write() argument must be str, not {type(text).__name__}")
|
| 31 |
+
buffer = self.__buffer
|
| 32 |
+
lines: List[str] = []
|
| 33 |
+
while text:
|
| 34 |
+
line, new_line, text = text.partition("\n")
|
| 35 |
+
if new_line:
|
| 36 |
+
lines.append("".join(buffer) + line)
|
| 37 |
+
buffer.clear()
|
| 38 |
+
else:
|
| 39 |
+
buffer.append(line)
|
| 40 |
+
break
|
| 41 |
+
if lines:
|
| 42 |
+
console = self.__console
|
| 43 |
+
with console:
|
| 44 |
+
output = Text("\n").join(
|
| 45 |
+
self.__ansi_decoder.decode_line(line) for line in lines
|
| 46 |
+
)
|
| 47 |
+
console.print(output)
|
| 48 |
+
return len(text)
|
| 49 |
+
|
| 50 |
+
def flush(self) -> None:
|
| 51 |
+
output = "".join(self.__buffer)
|
| 52 |
+
if output:
|
| 53 |
+
self.__console.print(output)
|
| 54 |
+
del self.__buffer[:]
|
| 55 |
+
|
| 56 |
+
def fileno(self) -> int:
|
| 57 |
+
return self.__file.fileno()
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/filesize.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2
|
| 2 |
+
|
| 3 |
+
The functions declared in this module should cover the different
|
| 4 |
+
use cases needed to generate a string representation of a file size
|
| 5 |
+
using several different units. Since there are many standards regarding
|
| 6 |
+
file size units, three different functions have been implemented.
|
| 7 |
+
|
| 8 |
+
See Also:
|
| 9 |
+
* `Wikipedia: Binary prefix <https://en.wikipedia.org/wiki/Binary_prefix>`_
|
| 10 |
+
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
__all__ = ["decimal"]
|
| 14 |
+
|
| 15 |
+
from typing import Iterable, List, Optional, Tuple
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def _to_str(
|
| 19 |
+
size: int,
|
| 20 |
+
suffixes: Iterable[str],
|
| 21 |
+
base: int,
|
| 22 |
+
*,
|
| 23 |
+
precision: Optional[int] = 1,
|
| 24 |
+
separator: Optional[str] = " ",
|
| 25 |
+
) -> str:
|
| 26 |
+
if size == 1:
|
| 27 |
+
return "1 byte"
|
| 28 |
+
elif size < base:
|
| 29 |
+
return f"{size:,} bytes"
|
| 30 |
+
|
| 31 |
+
for i, suffix in enumerate(suffixes, 2): # noqa: B007
|
| 32 |
+
unit = base**i
|
| 33 |
+
if size < unit:
|
| 34 |
+
break
|
| 35 |
+
return "{:,.{precision}f}{separator}{}".format(
|
| 36 |
+
(base * size / unit),
|
| 37 |
+
suffix,
|
| 38 |
+
precision=precision,
|
| 39 |
+
separator=separator,
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def pick_unit_and_suffix(size: int, suffixes: List[str], base: int) -> Tuple[int, str]:
|
| 44 |
+
"""Pick a suffix and base for the given size."""
|
| 45 |
+
for i, suffix in enumerate(suffixes):
|
| 46 |
+
unit = base**i
|
| 47 |
+
if size < unit * base:
|
| 48 |
+
break
|
| 49 |
+
return unit, suffix
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def decimal(
|
| 53 |
+
size: int,
|
| 54 |
+
*,
|
| 55 |
+
precision: Optional[int] = 1,
|
| 56 |
+
separator: Optional[str] = " ",
|
| 57 |
+
) -> str:
|
| 58 |
+
"""Convert a filesize in to a string (powers of 1000, SI prefixes).
|
| 59 |
+
|
| 60 |
+
In this convention, ``1000 B = 1 kB``.
|
| 61 |
+
|
| 62 |
+
This is typically the format used to advertise the storage
|
| 63 |
+
capacity of USB flash drives and the like (*256 MB* meaning
|
| 64 |
+
actually a storage capacity of more than *256 000 000 B*),
|
| 65 |
+
or used by **Mac OS X** since v10.6 to report file sizes.
|
| 66 |
+
|
| 67 |
+
Arguments:
|
| 68 |
+
int (size): A file size.
|
| 69 |
+
int (precision): The number of decimal places to include (default = 1).
|
| 70 |
+
str (separator): The string to separate the value from the units (default = " ").
|
| 71 |
+
|
| 72 |
+
Returns:
|
| 73 |
+
`str`: A string containing a abbreviated file size and units.
|
| 74 |
+
|
| 75 |
+
Example:
|
| 76 |
+
>>> filesize.decimal(30000)
|
| 77 |
+
'30.0 kB'
|
| 78 |
+
>>> filesize.decimal(30000, precision=2, separator="")
|
| 79 |
+
'30.00kB'
|
| 80 |
+
|
| 81 |
+
"""
|
| 82 |
+
return _to_str(
|
| 83 |
+
size,
|
| 84 |
+
("kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"),
|
| 85 |
+
1000,
|
| 86 |
+
precision=precision,
|
| 87 |
+
separator=separator,
|
| 88 |
+
)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/highlighter.py
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ine_regex(*regexes: str) -> str:
|
| 9 |
+
"""Combine a number of regexes in to a single regex.
|
| 10 |
+
|
| 11 |
+
Returns:
|
| 12 |
+
str: New regex with all regexes ORed together.
|
| 13 |
+
"""
|
| 14 |
+
return "|".join(regexes)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Highlighter(ABC):
|
| 18 |
+
"""Abstract base class for highlighters."""
|
| 19 |
+
|
| 20 |
+
def __call__(self, text: Union[str, Text]) -> Text:
|
| 21 |
+
"""Highlight a str or Text instance.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
text (Union[str, ~Text]): Text to highlight.
|
| 25 |
+
|
| 26 |
+
Raises:
|
| 27 |
+
TypeError: If not called with text or str.
|
| 28 |
+
|
| 29 |
+
Returns:
|
| 30 |
+
Text: A test instance with highlighting applied.
|
| 31 |
+
"""
|
| 32 |
+
if isinstance(text, str):
|
| 33 |
+
highlight_text = Text(text)
|
| 34 |
+
elif isinstance(text, Text):
|
| 35 |
+
highlight_text = text.copy()
|
| 36 |
+
else:
|
| 37 |
+
raise TypeError(f"str or Text instance required, not {text!r}")
|
| 38 |
+
self.highlight(highlight_text)
|
| 39 |
+
return highlight_text
|
| 40 |
+
|
| 41 |
+
@abstractmethod
|
| 42 |
+
def highlight(self, text: Text) -> None:
|
| 43 |
+
"""Apply highlighting in place to text.
|
| 44 |
+
|
| 45 |
+
Args:
|
| 46 |
+
text (~Text): A text object highlight.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class NullHighlighter(Highlighter):
|
| 51 |
+
"""A highlighter object that doesn't highlight.
|
| 52 |
+
|
| 53 |
+
May be used to disable highlighting entirely.
|
| 54 |
+
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
def highlight(self, text: Text) -> None:
|
| 58 |
+
"""Nothing to do"""
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class RegexHighlighter(Highlighter):
|
| 62 |
+
"""Applies highlighting from a list of regular expressions."""
|
| 63 |
+
|
| 64 |
+
highlights: List[str] = []
|
| 65 |
+
base_style: str = ""
|
| 66 |
+
|
| 67 |
+
def highlight(self, text: Text) -> None:
|
| 68 |
+
"""Highlight :class:`rich.text.Text` using regular expressions.
|
| 69 |
+
|
| 70 |
+
Args:
|
| 71 |
+
text (~Text): Text to highlighted.
|
| 72 |
+
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
highlight_regex = text.highlight_regex
|
| 76 |
+
for re_highlight in self.highlights:
|
| 77 |
+
highlight_regex(re_highlight, style_prefix=self.base_style)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class ReprHighlighter(RegexHighlighter):
|
| 81 |
+
"""Highlights the text typically produced from ``__repr__`` methods."""
|
| 82 |
+
|
| 83 |
+
base_style = "repr."
|
| 84 |
+
highlights = [
|
| 85 |
+
r"(?P<tag_start><)(?P<tag_name>[-\w.:|]*)(?P<tag_contents>[\w\W]*)(?P<tag_end>>)",
|
| 86 |
+
r'(?P<attrib_name>[\w_]{1,50})=(?P<attrib_value>"?[\w_]+"?)?',
|
| 87 |
+
r"(?P<brace>[][{}()])",
|
| 88 |
+
_combine_regex(
|
| 89 |
+
r"(?P<ipv4>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})",
|
| 90 |
+
r"(?P<ipv6>([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})",
|
| 91 |
+
r"(?P<eui64>(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})",
|
| 92 |
+
r"(?P<eui48>(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})",
|
| 93 |
+
r"(?P<uuid>[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})",
|
| 94 |
+
r"(?P<call>[\w.]*?)\(",
|
| 95 |
+
r"\b(?P<bool_true>True)\b|\b(?P<bool_false>False)\b|\b(?P<none>None)\b",
|
| 96 |
+
r"(?P<ellipsis>\.\.\.)",
|
| 97 |
+
r"(?P<number_complex>(?<!\w)(?:\-?[0-9]+\.?[0-9]*(?:e[-+]?\d+?)?)(?:[-+](?:[0-9]+\.?[0-9]*(?:e[-+]?\d+)?))?j)",
|
| 98 |
+
r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[-+]?\d+?)?\b|0x[0-9a-fA-F]*)",
|
| 99 |
+
r"(?P<path>\B(/[-\w._+]+)*\/)(?P<filename>[-\w._+]*)?",
|
| 100 |
+
r"(?<![\\\w])(?P<str>b?'''.*?(?<!\\)'''|b?'.*?(?<!\\)'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
|
| 101 |
+
r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~@]*)",
|
| 102 |
+
),
|
| 103 |
+
]
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class JSONHighlighter(RegexHighlighter):
|
| 107 |
+
"""Highlights JSON"""
|
| 108 |
+
|
| 109 |
+
# Captures the start and end of JSON strings, handling escaped quotes
|
| 110 |
+
JSON_STR = r"(?<![\\\w])(?P<str>b?\".*?(?<!\\)\")"
|
| 111 |
+
JSON_WHITESPACE = {" ", "\n", "\r", "\t"}
|
| 112 |
+
|
| 113 |
+
base_style = "json."
|
| 114 |
+
highlights = [
|
| 115 |
+
_combine_regex(
|
| 116 |
+
r"(?P<brace>[\{\[\(\)\]\}])",
|
| 117 |
+
r"\b(?P<bool_true>true)\b|\b(?P<bool_false>false)\b|\b(?P<null>null)\b",
|
| 118 |
+
r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[\-\+]?\d+?)?\b|0x[0-9a-fA-F]*)",
|
| 119 |
+
JSON_STR,
|
| 120 |
+
),
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
def highlight(self, text: Text) -> None:
|
| 124 |
+
super().highlight(text)
|
| 125 |
+
|
| 126 |
+
# Additional work to handle highlighting JSON keys
|
| 127 |
+
plain = text.plain
|
| 128 |
+
append = text.spans.append
|
| 129 |
+
whitespace = self.JSON_WHITESPACE
|
| 130 |
+
for match in re.finditer(self.JSON_STR, plain):
|
| 131 |
+
start, end = match.span()
|
| 132 |
+
cursor = end
|
| 133 |
+
while cursor < len(plain):
|
| 134 |
+
char = plain[cursor]
|
| 135 |
+
cursor += 1
|
| 136 |
+
if char == ":":
|
| 137 |
+
append(Span(start, end, "json.key"))
|
| 138 |
+
elif char in whitespace:
|
| 139 |
+
continue
|
| 140 |
+
break
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class ISO8601Highlighter(RegexHighlighter):
|
| 144 |
+
"""Highlights the ISO8601 date time strings.
|
| 145 |
+
Regex reference: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
base_style = "iso8601."
|
| 149 |
+
highlights = [
|
| 150 |
+
#
|
| 151 |
+
# Dates
|
| 152 |
+
#
|
| 153 |
+
# Calendar month (e.g. 2008-08). The hyphen is required
|
| 154 |
+
r"^(?P<year>[0-9]{4})-(?P<month>1[0-2]|0[1-9])$",
|
| 155 |
+
# Calendar date w/o hyphens (e.g. 20080830)
|
| 156 |
+
r"^(?P<date>(?P<year>[0-9]{4})(?P<month>1[0-2]|0[1-9])(?P<day>3[01]|0[1-9]|[12][0-9]))$",
|
| 157 |
+
# Ordinal date (e.g. 2008-243). The hyphen is optional
|
| 158 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?(?P<day>36[0-6]|3[0-5][0-9]|[12][0-9]{2}|0[1-9][0-9]|00[1-9]))$",
|
| 159 |
+
#
|
| 160 |
+
# Weeks
|
| 161 |
+
#
|
| 162 |
+
# Week of the year (e.g., 2008-W35). The hyphen is optional
|
| 163 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9]))$",
|
| 164 |
+
# Week date (e.g., 2008-W35-6). The hyphens are optional
|
| 165 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9])-?(?P<day>[1-7]))$",
|
| 166 |
+
#
|
| 167 |
+
# Times
|
| 168 |
+
#
|
| 169 |
+
# Hours and minutes (e.g., 17:21). The colon is optional
|
| 170 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):?(?P<minute>[0-5][0-9]))$",
|
| 171 |
+
# Hours, minutes, and seconds w/o colons (e.g., 172159)
|
| 172 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))$",
|
| 173 |
+
# Time zone designator (e.g., Z, +07 or +07:00). The colons and the minutes are optional
|
| 174 |
+
r"^(?P<timezone>(Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?))$",
|
| 175 |
+
# Hours, minutes, and seconds with time zone designator (e.g., 17:21:59+07:00).
|
| 176 |
+
# All the colons are optional. The minutes in the time zone designator are also optional
|
| 177 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?)$",
|
| 178 |
+
#
|
| 179 |
+
# Date and Time
|
| 180 |
+
#
|
| 181 |
+
# Calendar date with hours, minutes, and seconds (e.g., 2008-08-30 17:21:59 or 20080830 172159).
|
| 182 |
+
# A space is required between the date and the time. The hyphens and colons are optional.
|
| 183 |
+
# This regex matches dates and times that specify some hyphens or colons but omit others.
|
| 184 |
+
# This does not follow ISO 8601
|
| 185 |
+
r"^(?P<date>(?P<year>[0-9]{4})(?P<hyphen>-)?(?P<month>1[0-2]|0[1-9])(?(hyphen)-)(?P<day>3[01]|0[1-9]|[12][0-9])) (?P<time>(?P<hour>2[0-3]|[01][0-9])(?(hyphen):)(?P<minute>[0-5][0-9])(?(hyphen):)(?P<second>[0-5][0-9]))$",
|
| 186 |
+
#
|
| 187 |
+
# XML Schema dates and times
|
| 188 |
+
#
|
| 189 |
+
# Date, with optional time zone (e.g., 2008-08-30 or 2008-08-30+07:00).
|
| 190 |
+
# Hyphens are required. This is the XML Schema 'date' type
|
| 191 |
+
r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 192 |
+
# Time, with optional fractional seconds and time zone (e.g., 01:45:36 or 01:45:36.123+07:00).
|
| 193 |
+
# There is no limit on the number of digits for the fractional seconds. This is the XML Schema 'time' type
|
| 194 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<frac>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 195 |
+
# Date and time, with optional fractional seconds and time zone (e.g., 2008-08-30T01:45:36 or 2008-08-30T01:45:36.123Z).
|
| 196 |
+
# This is the XML Schema 'dateTime' type
|
| 197 |
+
r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))T(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<ms>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 198 |
+
]
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
if __name__ == "__main__": # pragma: no cover
|
| 202 |
+
from .console import Console
|
| 203 |
+
|
| 204 |
+
console = Console()
|
| 205 |
+
console.print("[bold green]hello world![/bold green]")
|
| 206 |
+
console.print("'[bold green]hello world![/bold green]'")
|
| 207 |
+
|
| 208 |
+
console.print(" /foo")
|
| 209 |
+
console.print("/foo/")
|
| 210 |
+
console.print("/foo/bar")
|
| 211 |
+
console.print("foo/bar/baz")
|
| 212 |
+
|
| 213 |
+
console.print("/foo/bar/baz?foo=bar+egg&egg=baz")
|
| 214 |
+
console.print("/foo/bar/baz/")
|
| 215 |
+
console.print("/foo/bar/baz/egg")
|
| 216 |
+
console.print("/foo/bar/baz/egg.py")
|
| 217 |
+
console.print("/foo/bar/baz/egg.py word")
|
| 218 |
+
console.print(" /foo/bar/baz/egg.py word")
|
| 219 |
+
console.print("foo /foo/bar/baz/egg.py word")
|
| 220 |
+
console.print("foo /foo/bar/ba._++z/egg+.py word")
|
| 221 |
+
console.print("https://example.org?foo=bar#header")
|
| 222 |
+
|
| 223 |
+
console.print(1234567.34)
|
| 224 |
+
console.print(1 / 2)
|
| 225 |
+
console.print(-1 / 123123123123)
|
| 226 |
+
|
| 227 |
+
console.print(
|
| 228 |
+
"127.0.1.1 bar 192.168.1.4 2001:0db8:85a3:0000:0000:8a2e:0370:7334 foo"
|
| 229 |
+
)
|
| 230 |
+
import json
|
| 231 |
+
|
| 232 |
+
console.print_json(json.dumps(obj={"name": "apple", "count": 1}), indent=None)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/json.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from json import loads, dumps
|
| 3 |
+
from typing import Any, Callable, Optional, Union
|
| 4 |
+
|
| 5 |
+
from .text import Text
|
| 6 |
+
from .highlighter import JSONHighlighter, NullHighlighter
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class JSON:
|
| 10 |
+
"""A renderable which pretty prints JSON.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
json (str): JSON encoded data.
|
| 14 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 15 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 16 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 17 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 18 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 19 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 20 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 21 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 22 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
json: str,
|
| 28 |
+
indent: Union[None, int, str] = 2,
|
| 29 |
+
highlight: bool = True,
|
| 30 |
+
skip_keys: bool = False,
|
| 31 |
+
ensure_ascii: bool = False,
|
| 32 |
+
check_circular: bool = True,
|
| 33 |
+
allow_nan: bool = True,
|
| 34 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 35 |
+
sort_keys: bool = False,
|
| 36 |
+
) -> None:
|
| 37 |
+
data = loads(json)
|
| 38 |
+
json = dumps(
|
| 39 |
+
data,
|
| 40 |
+
indent=indent,
|
| 41 |
+
skipkeys=skip_keys,
|
| 42 |
+
ensure_ascii=ensure_ascii,
|
| 43 |
+
check_circular=check_circular,
|
| 44 |
+
allow_nan=allow_nan,
|
| 45 |
+
default=default,
|
| 46 |
+
sort_keys=sort_keys,
|
| 47 |
+
)
|
| 48 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 49 |
+
self.text = highlighter(json)
|
| 50 |
+
self.text.no_wrap = True
|
| 51 |
+
self.text.overflow = None
|
| 52 |
+
|
| 53 |
+
@classmethod
|
| 54 |
+
def from_data(
|
| 55 |
+
cls,
|
| 56 |
+
data: Any,
|
| 57 |
+
indent: Union[None, int, str] = 2,
|
| 58 |
+
highlight: bool = True,
|
| 59 |
+
skip_keys: bool = False,
|
| 60 |
+
ensure_ascii: bool = False,
|
| 61 |
+
check_circular: bool = True,
|
| 62 |
+
allow_nan: bool = True,
|
| 63 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 64 |
+
sort_keys: bool = False,
|
| 65 |
+
) -> "JSON":
|
| 66 |
+
"""Encodes a JSON object from arbitrary data.
|
| 67 |
+
|
| 68 |
+
Args:
|
| 69 |
+
data (Any): An object that may be encoded in to JSON
|
| 70 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 71 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 72 |
+
default (Callable, optional): Optional callable which will be called for objects that cannot be serialized. Defaults to None.
|
| 73 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 74 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 75 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 76 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 77 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 78 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 79 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
JSON: New JSON object from the given data.
|
| 83 |
+
"""
|
| 84 |
+
json_instance: "JSON" = cls.__new__(cls)
|
| 85 |
+
json = dumps(
|
| 86 |
+
data,
|
| 87 |
+
indent=indent,
|
| 88 |
+
skipkeys=skip_keys,
|
| 89 |
+
ensure_ascii=ensure_ascii,
|
| 90 |
+
check_circular=check_circular,
|
| 91 |
+
allow_nan=allow_nan,
|
| 92 |
+
default=default,
|
| 93 |
+
sort_keys=sort_keys,
|
| 94 |
+
)
|
| 95 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 96 |
+
json_instance.text = highlighter(json)
|
| 97 |
+
json_instance.text.no_wrap = True
|
| 98 |
+
json_instance.text.overflow = None
|
| 99 |
+
return json_instance
|
| 100 |
+
|
| 101 |
+
def __rich__(self) -> Text:
|
| 102 |
+
return self.text
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
if __name__ == "__main__":
|
| 106 |
+
import argparse
|
| 107 |
+
import sys
|
| 108 |
+
|
| 109 |
+
parser = argparse.ArgumentParser(description="Pretty print json")
|
| 110 |
+
parser.add_argument(
|
| 111 |
+
"path",
|
| 112 |
+
metavar="PATH",
|
| 113 |
+
help="path to file, or - for stdin",
|
| 114 |
+
)
|
| 115 |
+
parser.add_argument(
|
| 116 |
+
"-i",
|
| 117 |
+
"--indent",
|
| 118 |
+
metavar="SPACES",
|
| 119 |
+
type=int,
|
| 120 |
+
help="Number of spaces in an indent",
|
| 121 |
+
default=2,
|
| 122 |
+
)
|
| 123 |
+
args = parser.parse_args()
|
| 124 |
+
|
| 125 |
+
from pip._vendor.rich.console import Console
|
| 126 |
+
|
| 127 |
+
console = Console()
|
| 128 |
+
error_console = Console(stderr=True)
|
| 129 |
+
|
| 130 |
+
try:
|
| 131 |
+
if args.path == "-":
|
| 132 |
+
json_data = sys.stdin.read()
|
| 133 |
+
else:
|
| 134 |
+
json_data = Path(args.path).read_text()
|
| 135 |
+
except Exception as error:
|
| 136 |
+
error_console.print(f"Unable to read {args.path!r}; {error}")
|
| 137 |
+
sys.exit(-1)
|
| 138 |
+
|
| 139 |
+
console.print(JSON(json_data, indent=args.indent), soft_wrap=True)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/jupyter.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Sequence
|
| 2 |
+
|
| 3 |
+
if TYPE_CHECKING:
|
| 4 |
+
from pip._vendor.rich.console import ConsoleRenderable
|
| 5 |
+
|
| 6 |
+
from . import get_console
|
| 7 |
+
from .segment import Segment
|
| 8 |
+
from .terminal_theme import DEFAULT_TERMINAL_THEME
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from pip._vendor.rich.console import ConsoleRenderable
|
| 12 |
+
|
| 13 |
+
JUPYTER_HTML_FORMAT = """\
|
| 14 |
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">{code}</pre>
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class JupyterRenderable:
|
| 19 |
+
"""A shim to write html to Jupyter notebook."""
|
| 20 |
+
|
| 21 |
+
def __init__(self, html: str, text: str) -> None:
|
| 22 |
+
self.html = html
|
| 23 |
+
self.text = text
|
| 24 |
+
|
| 25 |
+
def _repr_mimebundle_(
|
| 26 |
+
self, include: Sequence[str], exclude: Sequence[str], **kwargs: Any
|
| 27 |
+
) -> Dict[str, str]:
|
| 28 |
+
data = {"text/plain": self.text, "text/html": self.html}
|
| 29 |
+
if include:
|
| 30 |
+
data = {k: v for (k, v) in data.items() if k in include}
|
| 31 |
+
if exclude:
|
| 32 |
+
data = {k: v for (k, v) in data.items() if k not in exclude}
|
| 33 |
+
return data
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class JupyterMixin:
|
| 37 |
+
"""Add to an Rich renderable to make it render in Jupyter notebook."""
|
| 38 |
+
|
| 39 |
+
__slots__ = ()
|
| 40 |
+
|
| 41 |
+
def _repr_mimebundle_(
|
| 42 |
+
self: "ConsoleRenderable",
|
| 43 |
+
include: Sequence[str],
|
| 44 |
+
exclude: Sequence[str],
|
| 45 |
+
**kwargs: Any,
|
| 46 |
+
) -> Dict[str, str]:
|
| 47 |
+
console = get_console()
|
| 48 |
+
segments = list(console.render(self, console.options))
|
| 49 |
+
html = _render_segments(segments)
|
| 50 |
+
text = console._render_buffer(segments)
|
| 51 |
+
data = {"text/plain": text, "text/html": html}
|
| 52 |
+
if include:
|
| 53 |
+
data = {k: v for (k, v) in data.items() if k in include}
|
| 54 |
+
if exclude:
|
| 55 |
+
data = {k: v for (k, v) in data.items() if k not in exclude}
|
| 56 |
+
return data
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def _render_segments(segments: Iterable[Segment]) -> str:
|
| 60 |
+
def escape(text: str) -> str:
|
| 61 |
+
"""Escape html."""
|
| 62 |
+
return text.replace("&", "&").replace("<", "<").replace(">", ">")
|
| 63 |
+
|
| 64 |
+
fragments: List[str] = []
|
| 65 |
+
append_fragment = fragments.append
|
| 66 |
+
theme = DEFAULT_TERMINAL_THEME
|
| 67 |
+
for text, style, control in Segment.simplify(segments):
|
| 68 |
+
if control:
|
| 69 |
+
continue
|
| 70 |
+
text = escape(text)
|
| 71 |
+
if style:
|
| 72 |
+
rule = style.get_html_style(theme)
|
| 73 |
+
text = f'<span style="{rule}">{text}</span>' if rule else text
|
| 74 |
+
if style.link:
|
| 75 |
+
text = f'<a href="{style.link}" target="_blank">{text}</a>'
|
| 76 |
+
append_fragment(text)
|
| 77 |
+
|
| 78 |
+
code = "".join(fragments)
|
| 79 |
+
html = JUPYTER_HTML_FORMAT.format(code=code)
|
| 80 |
+
|
| 81 |
+
return html
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def display(segments: Iterable[Segment], text: str) -> None:
|
| 85 |
+
"""Render segments to Jupyter."""
|
| 86 |
+
html = _render_segments(segments)
|
| 87 |
+
jupyter_renderable = JupyterRenderable(html, text)
|
| 88 |
+
try:
|
| 89 |
+
from IPython.display import display as ipython_display
|
| 90 |
+
|
| 91 |
+
ipython_display(jupyter_renderable)
|
| 92 |
+
except ModuleNotFoundError:
|
| 93 |
+
# Handle the case where the Console has force_jupyter=True,
|
| 94 |
+
# but IPython is not installed.
|
| 95 |
+
pass
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def print(*args: Any, **kwargs: Any) -> None:
|
| 99 |
+
"""Proxy for Console print."""
|
| 100 |
+
console = get_console()
|
| 101 |
+
return console.print(*args, **kwargs)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/layout.py
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
from itertools import islice
|
| 3 |
+
from operator import itemgetter
|
| 4 |
+
from threading import RLock
|
| 5 |
+
from typing import (
|
| 6 |
+
TYPE_CHECKING,
|
| 7 |
+
Dict,
|
| 8 |
+
Iterable,
|
| 9 |
+
List,
|
| 10 |
+
NamedTuple,
|
| 11 |
+
Optional,
|
| 12 |
+
Sequence,
|
| 13 |
+
Tuple,
|
| 14 |
+
Union,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
from ._ratio import ratio_resolve
|
| 18 |
+
from .align import Align
|
| 19 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 20 |
+
from .highlighter import ReprHighlighter
|
| 21 |
+
from .panel import Panel
|
| 22 |
+
from .pretty import Pretty
|
| 23 |
+
from .region import Region
|
| 24 |
+
from .repr import Result, rich_repr
|
| 25 |
+
from .segment import Segment
|
| 26 |
+
from .style import StyleType
|
| 27 |
+
|
| 28 |
+
if TYPE_CHECKING:
|
| 29 |
+
from pip._vendor.rich.tree import Tree
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class LayoutRender(NamedTuple):
|
| 33 |
+
"""An individual layout render."""
|
| 34 |
+
|
| 35 |
+
region: Region
|
| 36 |
+
render: List[List[Segment]]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
RegionMap = Dict["Layout", Region]
|
| 40 |
+
RenderMap = Dict["Layout", LayoutRender]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class LayoutError(Exception):
|
| 44 |
+
"""Layout related error."""
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class NoSplitter(LayoutError):
|
| 48 |
+
"""Requested splitter does not exist."""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class _Placeholder:
|
| 52 |
+
"""An internal renderable used as a Layout placeholder."""
|
| 53 |
+
|
| 54 |
+
highlighter = ReprHighlighter()
|
| 55 |
+
|
| 56 |
+
def __init__(self, layout: "Layout", style: StyleType = "") -> None:
|
| 57 |
+
self.layout = layout
|
| 58 |
+
self.style = style
|
| 59 |
+
|
| 60 |
+
def __rich_console__(
|
| 61 |
+
self, console: Console, options: ConsoleOptions
|
| 62 |
+
) -> RenderResult:
|
| 63 |
+
width = options.max_width
|
| 64 |
+
height = options.height or options.size.height
|
| 65 |
+
layout = self.layout
|
| 66 |
+
title = (
|
| 67 |
+
f"{layout.name!r} ({width} x {height})"
|
| 68 |
+
if layout.name
|
| 69 |
+
else f"({width} x {height})"
|
| 70 |
+
)
|
| 71 |
+
yield Panel(
|
| 72 |
+
Align.center(Pretty(layout), vertical="middle"),
|
| 73 |
+
style=self.style,
|
| 74 |
+
title=self.highlighter(title),
|
| 75 |
+
border_style="blue",
|
| 76 |
+
height=height,
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class Splitter(ABC):
|
| 81 |
+
"""Base class for a splitter."""
|
| 82 |
+
|
| 83 |
+
name: str = ""
|
| 84 |
+
|
| 85 |
+
@abstractmethod
|
| 86 |
+
def get_tree_icon(self) -> str:
|
| 87 |
+
"""Get the icon (emoji) used in layout.tree"""
|
| 88 |
+
|
| 89 |
+
@abstractmethod
|
| 90 |
+
def divide(
|
| 91 |
+
self, children: Sequence["Layout"], region: Region
|
| 92 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 93 |
+
"""Divide a region amongst several child layouts.
|
| 94 |
+
|
| 95 |
+
Args:
|
| 96 |
+
children (Sequence(Layout)): A number of child layouts.
|
| 97 |
+
region (Region): A rectangular region to divide.
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class RowSplitter(Splitter):
|
| 102 |
+
"""Split a layout region in to rows."""
|
| 103 |
+
|
| 104 |
+
name = "row"
|
| 105 |
+
|
| 106 |
+
def get_tree_icon(self) -> str:
|
| 107 |
+
return "[layout.tree.row]⬌"
|
| 108 |
+
|
| 109 |
+
def divide(
|
| 110 |
+
self, children: Sequence["Layout"], region: Region
|
| 111 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 112 |
+
x, y, width, height = region
|
| 113 |
+
render_widths = ratio_resolve(width, children)
|
| 114 |
+
offset = 0
|
| 115 |
+
_Region = Region
|
| 116 |
+
for child, child_width in zip(children, render_widths):
|
| 117 |
+
yield child, _Region(x + offset, y, child_width, height)
|
| 118 |
+
offset += child_width
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
class ColumnSplitter(Splitter):
|
| 122 |
+
"""Split a layout region in to columns."""
|
| 123 |
+
|
| 124 |
+
name = "column"
|
| 125 |
+
|
| 126 |
+
def get_tree_icon(self) -> str:
|
| 127 |
+
return "[layout.tree.column]⬍"
|
| 128 |
+
|
| 129 |
+
def divide(
|
| 130 |
+
self, children: Sequence["Layout"], region: Region
|
| 131 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 132 |
+
x, y, width, height = region
|
| 133 |
+
render_heights = ratio_resolve(height, children)
|
| 134 |
+
offset = 0
|
| 135 |
+
_Region = Region
|
| 136 |
+
for child, child_height in zip(children, render_heights):
|
| 137 |
+
yield child, _Region(x, y + offset, width, child_height)
|
| 138 |
+
offset += child_height
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
@rich_repr
|
| 142 |
+
class Layout:
|
| 143 |
+
"""A renderable to divide a fixed height in to rows or columns.
|
| 144 |
+
|
| 145 |
+
Args:
|
| 146 |
+
renderable (RenderableType, optional): Renderable content, or None for placeholder. Defaults to None.
|
| 147 |
+
name (str, optional): Optional identifier for Layout. Defaults to None.
|
| 148 |
+
size (int, optional): Optional fixed size of layout. Defaults to None.
|
| 149 |
+
minimum_size (int, optional): Minimum size of layout. Defaults to 1.
|
| 150 |
+
ratio (int, optional): Optional ratio for flexible layout. Defaults to 1.
|
| 151 |
+
visible (bool, optional): Visibility of layout. Defaults to True.
|
| 152 |
+
"""
|
| 153 |
+
|
| 154 |
+
splitters = {"row": RowSplitter, "column": ColumnSplitter}
|
| 155 |
+
|
| 156 |
+
def __init__(
|
| 157 |
+
self,
|
| 158 |
+
renderable: Optional[RenderableType] = None,
|
| 159 |
+
*,
|
| 160 |
+
name: Optional[str] = None,
|
| 161 |
+
size: Optional[int] = None,
|
| 162 |
+
minimum_size: int = 1,
|
| 163 |
+
ratio: int = 1,
|
| 164 |
+
visible: bool = True,
|
| 165 |
+
) -> None:
|
| 166 |
+
self._renderable = renderable or _Placeholder(self)
|
| 167 |
+
self.size = size
|
| 168 |
+
self.minimum_size = minimum_size
|
| 169 |
+
self.ratio = ratio
|
| 170 |
+
self.name = name
|
| 171 |
+
self.visible = visible
|
| 172 |
+
self.splitter: Splitter = self.splitters["column"]()
|
| 173 |
+
self._children: List[Layout] = []
|
| 174 |
+
self._render_map: RenderMap = {}
|
| 175 |
+
self._lock = RLock()
|
| 176 |
+
|
| 177 |
+
def __rich_repr__(self) -> Result:
|
| 178 |
+
yield "name", self.name, None
|
| 179 |
+
yield "size", self.size, None
|
| 180 |
+
yield "minimum_size", self.minimum_size, 1
|
| 181 |
+
yield "ratio", self.ratio, 1
|
| 182 |
+
|
| 183 |
+
@property
|
| 184 |
+
def renderable(self) -> RenderableType:
|
| 185 |
+
"""Layout renderable."""
|
| 186 |
+
return self if self._children else self._renderable
|
| 187 |
+
|
| 188 |
+
@property
|
| 189 |
+
def children(self) -> List["Layout"]:
|
| 190 |
+
"""Gets (visible) layout children."""
|
| 191 |
+
return [child for child in self._children if child.visible]
|
| 192 |
+
|
| 193 |
+
@property
|
| 194 |
+
def map(self) -> RenderMap:
|
| 195 |
+
"""Get a map of the last render."""
|
| 196 |
+
return self._render_map
|
| 197 |
+
|
| 198 |
+
def get(self, name: str) -> Optional["Layout"]:
|
| 199 |
+
"""Get a named layout, or None if it doesn't exist.
|
| 200 |
+
|
| 201 |
+
Args:
|
| 202 |
+
name (str): Name of layout.
|
| 203 |
+
|
| 204 |
+
Returns:
|
| 205 |
+
Optional[Layout]: Layout instance or None if no layout was found.
|
| 206 |
+
"""
|
| 207 |
+
if self.name == name:
|
| 208 |
+
return self
|
| 209 |
+
else:
|
| 210 |
+
for child in self._children:
|
| 211 |
+
named_layout = child.get(name)
|
| 212 |
+
if named_layout is not None:
|
| 213 |
+
return named_layout
|
| 214 |
+
return None
|
| 215 |
+
|
| 216 |
+
def __getitem__(self, name: str) -> "Layout":
|
| 217 |
+
layout = self.get(name)
|
| 218 |
+
if layout is None:
|
| 219 |
+
raise KeyError(f"No layout with name {name!r}")
|
| 220 |
+
return layout
|
| 221 |
+
|
| 222 |
+
@property
|
| 223 |
+
def tree(self) -> "Tree":
|
| 224 |
+
"""Get a tree renderable to show layout structure."""
|
| 225 |
+
from pip._vendor.rich.styled import Styled
|
| 226 |
+
from pip._vendor.rich.table import Table
|
| 227 |
+
from pip._vendor.rich.tree import Tree
|
| 228 |
+
|
| 229 |
+
def summary(layout: "Layout") -> Table:
|
| 230 |
+
icon = layout.splitter.get_tree_icon()
|
| 231 |
+
|
| 232 |
+
table = Table.grid(padding=(0, 1, 0, 0))
|
| 233 |
+
|
| 234 |
+
text: RenderableType = (
|
| 235 |
+
Pretty(layout) if layout.visible else Styled(Pretty(layout), "dim")
|
| 236 |
+
)
|
| 237 |
+
table.add_row(icon, text)
|
| 238 |
+
_summary = table
|
| 239 |
+
return _summary
|
| 240 |
+
|
| 241 |
+
layout = self
|
| 242 |
+
tree = Tree(
|
| 243 |
+
summary(layout),
|
| 244 |
+
guide_style=f"layout.tree.{layout.splitter.name}",
|
| 245 |
+
highlight=True,
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
def recurse(tree: "Tree", layout: "Layout") -> None:
|
| 249 |
+
for child in layout._children:
|
| 250 |
+
recurse(
|
| 251 |
+
tree.add(
|
| 252 |
+
summary(child),
|
| 253 |
+
guide_style=f"layout.tree.{child.splitter.name}",
|
| 254 |
+
),
|
| 255 |
+
child,
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
+
recurse(tree, self)
|
| 259 |
+
return tree
|
| 260 |
+
|
| 261 |
+
def split(
|
| 262 |
+
self,
|
| 263 |
+
*layouts: Union["Layout", RenderableType],
|
| 264 |
+
splitter: Union[Splitter, str] = "column",
|
| 265 |
+
) -> None:
|
| 266 |
+
"""Split the layout in to multiple sub-layouts.
|
| 267 |
+
|
| 268 |
+
Args:
|
| 269 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 270 |
+
splitter (Union[Splitter, str]): Splitter instance or name of splitter.
|
| 271 |
+
"""
|
| 272 |
+
_layouts = [
|
| 273 |
+
layout if isinstance(layout, Layout) else Layout(layout)
|
| 274 |
+
for layout in layouts
|
| 275 |
+
]
|
| 276 |
+
try:
|
| 277 |
+
self.splitter = (
|
| 278 |
+
splitter
|
| 279 |
+
if isinstance(splitter, Splitter)
|
| 280 |
+
else self.splitters[splitter]()
|
| 281 |
+
)
|
| 282 |
+
except KeyError:
|
| 283 |
+
raise NoSplitter(f"No splitter called {splitter!r}")
|
| 284 |
+
self._children[:] = _layouts
|
| 285 |
+
|
| 286 |
+
def add_split(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 287 |
+
"""Add a new layout(s) to existing split.
|
| 288 |
+
|
| 289 |
+
Args:
|
| 290 |
+
*layouts (Union[Layout, RenderableType]): Positional arguments should be renderables or (sub) Layout instances.
|
| 291 |
+
|
| 292 |
+
"""
|
| 293 |
+
_layouts = (
|
| 294 |
+
layout if isinstance(layout, Layout) else Layout(layout)
|
| 295 |
+
for layout in layouts
|
| 296 |
+
)
|
| 297 |
+
self._children.extend(_layouts)
|
| 298 |
+
|
| 299 |
+
def split_row(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 300 |
+
"""Split the layout in to a row (layouts side by side).
|
| 301 |
+
|
| 302 |
+
Args:
|
| 303 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 304 |
+
"""
|
| 305 |
+
self.split(*layouts, splitter="row")
|
| 306 |
+
|
| 307 |
+
def split_column(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 308 |
+
"""Split the layout in to a column (layouts stacked on top of each other).
|
| 309 |
+
|
| 310 |
+
Args:
|
| 311 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 312 |
+
"""
|
| 313 |
+
self.split(*layouts, splitter="column")
|
| 314 |
+
|
| 315 |
+
def unsplit(self) -> None:
|
| 316 |
+
"""Reset splits to initial state."""
|
| 317 |
+
del self._children[:]
|
| 318 |
+
|
| 319 |
+
def update(self, renderable: RenderableType) -> None:
|
| 320 |
+
"""Update renderable.
|
| 321 |
+
|
| 322 |
+
Args:
|
| 323 |
+
renderable (RenderableType): New renderable object.
|
| 324 |
+
"""
|
| 325 |
+
with self._lock:
|
| 326 |
+
self._renderable = renderable
|
| 327 |
+
|
| 328 |
+
def refresh_screen(self, console: "Console", layout_name: str) -> None:
|
| 329 |
+
"""Refresh a sub-layout.
|
| 330 |
+
|
| 331 |
+
Args:
|
| 332 |
+
console (Console): Console instance where Layout is to be rendered.
|
| 333 |
+
layout_name (str): Name of layout.
|
| 334 |
+
"""
|
| 335 |
+
with self._lock:
|
| 336 |
+
layout = self[layout_name]
|
| 337 |
+
region, _lines = self._render_map[layout]
|
| 338 |
+
(x, y, width, height) = region
|
| 339 |
+
lines = console.render_lines(
|
| 340 |
+
layout, console.options.update_dimensions(width, height)
|
| 341 |
+
)
|
| 342 |
+
self._render_map[layout] = LayoutRender(region, lines)
|
| 343 |
+
console.update_screen_lines(lines, x, y)
|
| 344 |
+
|
| 345 |
+
def _make_region_map(self, width: int, height: int) -> RegionMap:
|
| 346 |
+
"""Create a dict that maps layout on to Region."""
|
| 347 |
+
stack: List[Tuple[Layout, Region]] = [(self, Region(0, 0, width, height))]
|
| 348 |
+
push = stack.append
|
| 349 |
+
pop = stack.pop
|
| 350 |
+
layout_regions: List[Tuple[Layout, Region]] = []
|
| 351 |
+
append_layout_region = layout_regions.append
|
| 352 |
+
while stack:
|
| 353 |
+
append_layout_region(pop())
|
| 354 |
+
layout, region = layout_regions[-1]
|
| 355 |
+
children = layout.children
|
| 356 |
+
if children:
|
| 357 |
+
for child_and_region in layout.splitter.divide(children, region):
|
| 358 |
+
push(child_and_region)
|
| 359 |
+
|
| 360 |
+
region_map = {
|
| 361 |
+
layout: region
|
| 362 |
+
for layout, region in sorted(layout_regions, key=itemgetter(1))
|
| 363 |
+
}
|
| 364 |
+
return region_map
|
| 365 |
+
|
| 366 |
+
def render(self, console: Console, options: ConsoleOptions) -> RenderMap:
|
| 367 |
+
"""Render the sub_layouts.
|
| 368 |
+
|
| 369 |
+
Args:
|
| 370 |
+
console (Console): Console instance.
|
| 371 |
+
options (ConsoleOptions): Console options.
|
| 372 |
+
|
| 373 |
+
Returns:
|
| 374 |
+
RenderMap: A dict that maps Layout on to a tuple of Region, lines
|
| 375 |
+
"""
|
| 376 |
+
render_width = options.max_width
|
| 377 |
+
render_height = options.height or console.height
|
| 378 |
+
region_map = self._make_region_map(render_width, render_height)
|
| 379 |
+
layout_regions = [
|
| 380 |
+
(layout, region)
|
| 381 |
+
for layout, region in region_map.items()
|
| 382 |
+
if not layout.children
|
| 383 |
+
]
|
| 384 |
+
render_map: Dict["Layout", "LayoutRender"] = {}
|
| 385 |
+
render_lines = console.render_lines
|
| 386 |
+
update_dimensions = options.update_dimensions
|
| 387 |
+
|
| 388 |
+
for layout, region in layout_regions:
|
| 389 |
+
lines = render_lines(
|
| 390 |
+
layout.renderable, update_dimensions(region.width, region.height)
|
| 391 |
+
)
|
| 392 |
+
render_map[layout] = LayoutRender(region, lines)
|
| 393 |
+
return render_map
|
| 394 |
+
|
| 395 |
+
def __rich_console__(
|
| 396 |
+
self, console: Console, options: ConsoleOptions
|
| 397 |
+
) -> RenderResult:
|
| 398 |
+
with self._lock:
|
| 399 |
+
width = options.max_width or console.width
|
| 400 |
+
height = options.height or console.height
|
| 401 |
+
render_map = self.render(console, options.update_dimensions(width, height))
|
| 402 |
+
self._render_map = render_map
|
| 403 |
+
layout_lines: List[List[Segment]] = [[] for _ in range(height)]
|
| 404 |
+
_islice = islice
|
| 405 |
+
for region, lines in render_map.values():
|
| 406 |
+
_x, y, _layout_width, layout_height = region
|
| 407 |
+
for row, line in zip(
|
| 408 |
+
_islice(layout_lines, y, y + layout_height), lines
|
| 409 |
+
):
|
| 410 |
+
row.extend(line)
|
| 411 |
+
|
| 412 |
+
new_line = Segment.line()
|
| 413 |
+
for layout_row in layout_lines:
|
| 414 |
+
yield from layout_row
|
| 415 |
+
yield new_line
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
if __name__ == "__main__":
|
| 419 |
+
from pip._vendor.rich.console import Console
|
| 420 |
+
|
| 421 |
+
console = Console()
|
| 422 |
+
layout = Layout()
|
| 423 |
+
|
| 424 |
+
layout.split_column(
|
| 425 |
+
Layout(name="header", size=3),
|
| 426 |
+
Layout(ratio=1, name="main"),
|
| 427 |
+
Layout(size=10, name="footer"),
|
| 428 |
+
)
|
| 429 |
+
|
| 430 |
+
layout["main"].split_row(Layout(name="side"), Layout(name="body", ratio=2))
|
| 431 |
+
|
| 432 |
+
layout["body"].split_row(Layout(name="content", ratio=2), Layout(name="s2"))
|
| 433 |
+
|
| 434 |
+
layout["s2"].split_column(
|
| 435 |
+
Layout(name="top"), Layout(name="middle"), Layout(name="bottom")
|
| 436 |
+
)
|
| 437 |
+
|
| 438 |
+
layout["side"].split_column(Layout(layout.tree, name="left1"), Layout(name="left2"))
|
| 439 |
+
|
| 440 |
+
layout["content"].update("foo")
|
| 441 |
+
|
| 442 |
+
console.print(layout)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/live.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from threading import Event, RLock, Thread
|
| 3 |
+
from types import TracebackType
|
| 4 |
+
from typing import IO, Any, Callable, List, Optional, TextIO, Type, cast
|
| 5 |
+
|
| 6 |
+
from . import get_console
|
| 7 |
+
from .console import Console, ConsoleRenderable, RenderableType, RenderHook
|
| 8 |
+
from .control import Control
|
| 9 |
+
from .file_proxy import FileProxy
|
| 10 |
+
from .jupyter import JupyterMixin
|
| 11 |
+
from .live_render import LiveRender, VerticalOverflowMethod
|
| 12 |
+
from .screen import Screen
|
| 13 |
+
from .text import Text
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class _RefreshThread(Thread):
|
| 17 |
+
"""A thread that calls refresh() at regular intervals."""
|
| 18 |
+
|
| 19 |
+
def __init__(self, live: "Live", refresh_per_second: float) -> None:
|
| 20 |
+
self.live = live
|
| 21 |
+
self.refresh_per_second = refresh_per_second
|
| 22 |
+
self.done = Event()
|
| 23 |
+
super().__init__(daemon=True)
|
| 24 |
+
|
| 25 |
+
def stop(self) -> None:
|
| 26 |
+
self.done.set()
|
| 27 |
+
|
| 28 |
+
def run(self) -> None:
|
| 29 |
+
while not self.done.wait(1 / self.refresh_per_second):
|
| 30 |
+
with self.live._lock:
|
| 31 |
+
if not self.done.is_set():
|
| 32 |
+
self.live.refresh()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Live(JupyterMixin, RenderHook):
|
| 36 |
+
"""Renders an auto-updating live display of any given renderable.
|
| 37 |
+
|
| 38 |
+
Args:
|
| 39 |
+
renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
|
| 40 |
+
console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.
|
| 41 |
+
screen (bool, optional): Enable alternate screen mode. Defaults to False.
|
| 42 |
+
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()` or `update()` with refresh flag. Defaults to True
|
| 43 |
+
refresh_per_second (float, optional): Number of times per second to refresh the live display. Defaults to 4.
|
| 44 |
+
transient (bool, optional): Clear the renderable on exit (has no effect when screen=True). Defaults to False.
|
| 45 |
+
redirect_stdout (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
|
| 46 |
+
redirect_stderr (bool, optional): Enable redirection of stderr. Defaults to True.
|
| 47 |
+
vertical_overflow (VerticalOverflowMethod, optional): How to handle renderable when it is too tall for the console. Defaults to "ellipsis".
|
| 48 |
+
get_renderable (Callable[[], RenderableType], optional): Optional callable to get renderable. Defaults to None.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
def __init__(
|
| 52 |
+
self,
|
| 53 |
+
renderable: Optional[RenderableType] = None,
|
| 54 |
+
*,
|
| 55 |
+
console: Optional[Console] = None,
|
| 56 |
+
screen: bool = False,
|
| 57 |
+
auto_refresh: bool = True,
|
| 58 |
+
refresh_per_second: float = 4,
|
| 59 |
+
transient: bool = False,
|
| 60 |
+
redirect_stdout: bool = True,
|
| 61 |
+
redirect_stderr: bool = True,
|
| 62 |
+
vertical_overflow: VerticalOverflowMethod = "ellipsis",
|
| 63 |
+
get_renderable: Optional[Callable[[], RenderableType]] = None,
|
| 64 |
+
) -> None:
|
| 65 |
+
assert refresh_per_second > 0, "refresh_per_second must be > 0"
|
| 66 |
+
self._renderable = renderable
|
| 67 |
+
self.console = console if console is not None else get_console()
|
| 68 |
+
self._screen = screen
|
| 69 |
+
self._alt_screen = False
|
| 70 |
+
|
| 71 |
+
self._redirect_stdout = redirect_stdout
|
| 72 |
+
self._redirect_stderr = redirect_stderr
|
| 73 |
+
self._restore_stdout: Optional[IO[str]] = None
|
| 74 |
+
self._restore_stderr: Optional[IO[str]] = None
|
| 75 |
+
|
| 76 |
+
self._lock = RLock()
|
| 77 |
+
self.ipy_widget: Optional[Any] = None
|
| 78 |
+
self.auto_refresh = auto_refresh
|
| 79 |
+
self._started: bool = False
|
| 80 |
+
self.transient = True if screen else transient
|
| 81 |
+
|
| 82 |
+
self._refresh_thread: Optional[_RefreshThread] = None
|
| 83 |
+
self.refresh_per_second = refresh_per_second
|
| 84 |
+
|
| 85 |
+
self.vertical_overflow = vertical_overflow
|
| 86 |
+
self._get_renderable = get_renderable
|
| 87 |
+
self._live_render = LiveRender(
|
| 88 |
+
self.get_renderable(), vertical_overflow=vertical_overflow
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
@property
|
| 92 |
+
def is_started(self) -> bool:
|
| 93 |
+
"""Check if live display has been started."""
|
| 94 |
+
return self._started
|
| 95 |
+
|
| 96 |
+
def get_renderable(self) -> RenderableType:
|
| 97 |
+
renderable = (
|
| 98 |
+
self._get_renderable()
|
| 99 |
+
if self._get_renderable is not None
|
| 100 |
+
else self._renderable
|
| 101 |
+
)
|
| 102 |
+
return renderable or ""
|
| 103 |
+
|
| 104 |
+
def start(self, refresh: bool = False) -> None:
|
| 105 |
+
"""Start live rendering display.
|
| 106 |
+
|
| 107 |
+
Args:
|
| 108 |
+
refresh (bool, optional): Also refresh. Defaults to False.
|
| 109 |
+
"""
|
| 110 |
+
with self._lock:
|
| 111 |
+
if self._started:
|
| 112 |
+
return
|
| 113 |
+
self.console.set_live(self)
|
| 114 |
+
self._started = True
|
| 115 |
+
if self._screen:
|
| 116 |
+
self._alt_screen = self.console.set_alt_screen(True)
|
| 117 |
+
self.console.show_cursor(False)
|
| 118 |
+
self._enable_redirect_io()
|
| 119 |
+
self.console.push_render_hook(self)
|
| 120 |
+
if refresh:
|
| 121 |
+
try:
|
| 122 |
+
self.refresh()
|
| 123 |
+
except Exception:
|
| 124 |
+
# If refresh fails, we want to stop the redirection of sys.stderr,
|
| 125 |
+
# so the error stacktrace is properly displayed in the terminal.
|
| 126 |
+
# (or, if the code that calls Rich captures the exception and wants to display something,
|
| 127 |
+
# let this be displayed in the terminal).
|
| 128 |
+
self.stop()
|
| 129 |
+
raise
|
| 130 |
+
if self.auto_refresh:
|
| 131 |
+
self._refresh_thread = _RefreshThread(self, self.refresh_per_second)
|
| 132 |
+
self._refresh_thread.start()
|
| 133 |
+
|
| 134 |
+
def stop(self) -> None:
|
| 135 |
+
"""Stop live rendering display."""
|
| 136 |
+
with self._lock:
|
| 137 |
+
if not self._started:
|
| 138 |
+
return
|
| 139 |
+
self.console.clear_live()
|
| 140 |
+
self._started = False
|
| 141 |
+
|
| 142 |
+
if self.auto_refresh and self._refresh_thread is not None:
|
| 143 |
+
self._refresh_thread.stop()
|
| 144 |
+
self._refresh_thread = None
|
| 145 |
+
# allow it to fully render on the last even if overflow
|
| 146 |
+
self.vertical_overflow = "visible"
|
| 147 |
+
with self.console:
|
| 148 |
+
try:
|
| 149 |
+
if not self._alt_screen and not self.console.is_jupyter:
|
| 150 |
+
self.refresh()
|
| 151 |
+
finally:
|
| 152 |
+
self._disable_redirect_io()
|
| 153 |
+
self.console.pop_render_hook()
|
| 154 |
+
if not self._alt_screen and self.console.is_terminal:
|
| 155 |
+
self.console.line()
|
| 156 |
+
self.console.show_cursor(True)
|
| 157 |
+
if self._alt_screen:
|
| 158 |
+
self.console.set_alt_screen(False)
|
| 159 |
+
|
| 160 |
+
if self.transient and not self._alt_screen:
|
| 161 |
+
self.console.control(self._live_render.restore_cursor())
|
| 162 |
+
if self.ipy_widget is not None and self.transient:
|
| 163 |
+
self.ipy_widget.close() # pragma: no cover
|
| 164 |
+
|
| 165 |
+
def __enter__(self) -> "Live":
|
| 166 |
+
self.start(refresh=self._renderable is not None)
|
| 167 |
+
return self
|
| 168 |
+
|
| 169 |
+
def __exit__(
|
| 170 |
+
self,
|
| 171 |
+
exc_type: Optional[Type[BaseException]],
|
| 172 |
+
exc_val: Optional[BaseException],
|
| 173 |
+
exc_tb: Optional[TracebackType],
|
| 174 |
+
) -> None:
|
| 175 |
+
self.stop()
|
| 176 |
+
|
| 177 |
+
def _enable_redirect_io(self) -> None:
|
| 178 |
+
"""Enable redirecting of stdout / stderr."""
|
| 179 |
+
if self.console.is_terminal or self.console.is_jupyter:
|
| 180 |
+
if self._redirect_stdout and not isinstance(sys.stdout, FileProxy):
|
| 181 |
+
self._restore_stdout = sys.stdout
|
| 182 |
+
sys.stdout = cast("TextIO", FileProxy(self.console, sys.stdout))
|
| 183 |
+
if self._redirect_stderr and not isinstance(sys.stderr, FileProxy):
|
| 184 |
+
self._restore_stderr = sys.stderr
|
| 185 |
+
sys.stderr = cast("TextIO", FileProxy(self.console, sys.stderr))
|
| 186 |
+
|
| 187 |
+
def _disable_redirect_io(self) -> None:
|
| 188 |
+
"""Disable redirecting of stdout / stderr."""
|
| 189 |
+
if self._restore_stdout:
|
| 190 |
+
sys.stdout = cast("TextIO", self._restore_stdout)
|
| 191 |
+
self._restore_stdout = None
|
| 192 |
+
if self._restore_stderr:
|
| 193 |
+
sys.stderr = cast("TextIO", self._restore_stderr)
|
| 194 |
+
self._restore_stderr = None
|
| 195 |
+
|
| 196 |
+
@property
|
| 197 |
+
def renderable(self) -> RenderableType:
|
| 198 |
+
"""Get the renderable that is being displayed
|
| 199 |
+
|
| 200 |
+
Returns:
|
| 201 |
+
RenderableType: Displayed renderable.
|
| 202 |
+
"""
|
| 203 |
+
renderable = self.get_renderable()
|
| 204 |
+
return Screen(renderable) if self._alt_screen else renderable
|
| 205 |
+
|
| 206 |
+
def update(self, renderable: RenderableType, *, refresh: bool = False) -> None:
|
| 207 |
+
"""Update the renderable that is being displayed
|
| 208 |
+
|
| 209 |
+
Args:
|
| 210 |
+
renderable (RenderableType): New renderable to use.
|
| 211 |
+
refresh (bool, optional): Refresh the display. Defaults to False.
|
| 212 |
+
"""
|
| 213 |
+
if isinstance(renderable, str):
|
| 214 |
+
renderable = self.console.render_str(renderable)
|
| 215 |
+
with self._lock:
|
| 216 |
+
self._renderable = renderable
|
| 217 |
+
if refresh:
|
| 218 |
+
self.refresh()
|
| 219 |
+
|
| 220 |
+
def refresh(self) -> None:
|
| 221 |
+
"""Update the display of the Live Render."""
|
| 222 |
+
with self._lock:
|
| 223 |
+
self._live_render.set_renderable(self.renderable)
|
| 224 |
+
if self.console.is_jupyter: # pragma: no cover
|
| 225 |
+
try:
|
| 226 |
+
from IPython.display import display
|
| 227 |
+
from ipywidgets import Output
|
| 228 |
+
except ImportError:
|
| 229 |
+
import warnings
|
| 230 |
+
|
| 231 |
+
warnings.warn('install "ipywidgets" for Jupyter support')
|
| 232 |
+
else:
|
| 233 |
+
if self.ipy_widget is None:
|
| 234 |
+
self.ipy_widget = Output()
|
| 235 |
+
display(self.ipy_widget)
|
| 236 |
+
|
| 237 |
+
with self.ipy_widget:
|
| 238 |
+
self.ipy_widget.clear_output(wait=True)
|
| 239 |
+
self.console.print(self._live_render.renderable)
|
| 240 |
+
elif self.console.is_terminal and not self.console.is_dumb_terminal:
|
| 241 |
+
with self.console:
|
| 242 |
+
self.console.print(Control())
|
| 243 |
+
elif (
|
| 244 |
+
not self._started and not self.transient
|
| 245 |
+
): # if it is finished allow files or dumb-terminals to see final result
|
| 246 |
+
with self.console:
|
| 247 |
+
self.console.print(Control())
|
| 248 |
+
|
| 249 |
+
def process_renderables(
|
| 250 |
+
self, renderables: List[ConsoleRenderable]
|
| 251 |
+
) -> List[ConsoleRenderable]:
|
| 252 |
+
"""Process renderables to restore cursor and display progress."""
|
| 253 |
+
self._live_render.vertical_overflow = self.vertical_overflow
|
| 254 |
+
if self.console.is_interactive:
|
| 255 |
+
# lock needs acquiring as user can modify live_render renderable at any time unlike in Progress.
|
| 256 |
+
with self._lock:
|
| 257 |
+
reset = (
|
| 258 |
+
Control.home()
|
| 259 |
+
if self._alt_screen
|
| 260 |
+
else self._live_render.position_cursor()
|
| 261 |
+
)
|
| 262 |
+
renderables = [reset, *renderables, self._live_render]
|
| 263 |
+
elif (
|
| 264 |
+
not self._started and not self.transient
|
| 265 |
+
): # if it is finished render the final output for files or dumb_terminals
|
| 266 |
+
renderables = [*renderables, self._live_render]
|
| 267 |
+
|
| 268 |
+
return renderables
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
if __name__ == "__main__": # pragma: no cover
|
| 272 |
+
import random
|
| 273 |
+
import time
|
| 274 |
+
from itertools import cycle
|
| 275 |
+
from typing import Dict, List, Tuple
|
| 276 |
+
|
| 277 |
+
from .align import Align
|
| 278 |
+
from .console import Console
|
| 279 |
+
from .live import Live as Live
|
| 280 |
+
from .panel import Panel
|
| 281 |
+
from .rule import Rule
|
| 282 |
+
from .syntax import Syntax
|
| 283 |
+
from .table import Table
|
| 284 |
+
|
| 285 |
+
console = Console()
|
| 286 |
+
|
| 287 |
+
syntax = Syntax(
|
| 288 |
+
'''def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
|
| 289 |
+
"""Iterate and generate a tuple with a flag for last value."""
|
| 290 |
+
iter_values = iter(values)
|
| 291 |
+
try:
|
| 292 |
+
previous_value = next(iter_values)
|
| 293 |
+
except StopIteration:
|
| 294 |
+
return
|
| 295 |
+
for value in iter_values:
|
| 296 |
+
yield False, previous_value
|
| 297 |
+
previous_value = value
|
| 298 |
+
yield True, previous_value''',
|
| 299 |
+
"python",
|
| 300 |
+
line_numbers=True,
|
| 301 |
+
)
|
| 302 |
+
|
| 303 |
+
table = Table("foo", "bar", "baz")
|
| 304 |
+
table.add_row("1", "2", "3")
|
| 305 |
+
|
| 306 |
+
progress_renderables = [
|
| 307 |
+
"You can make the terminal shorter and taller to see the live table hide"
|
| 308 |
+
"Text may be printed while the progress bars are rendering.",
|
| 309 |
+
Panel("In fact, [i]any[/i] renderable will work"),
|
| 310 |
+
"Such as [magenta]tables[/]...",
|
| 311 |
+
table,
|
| 312 |
+
"Pretty printed structures...",
|
| 313 |
+
{"type": "example", "text": "Pretty printed"},
|
| 314 |
+
"Syntax...",
|
| 315 |
+
syntax,
|
| 316 |
+
Rule("Give it a try!"),
|
| 317 |
+
]
|
| 318 |
+
|
| 319 |
+
examples = cycle(progress_renderables)
|
| 320 |
+
|
| 321 |
+
exchanges = [
|
| 322 |
+
"SGD",
|
| 323 |
+
"MYR",
|
| 324 |
+
"EUR",
|
| 325 |
+
"USD",
|
| 326 |
+
"AUD",
|
| 327 |
+
"JPY",
|
| 328 |
+
"CNH",
|
| 329 |
+
"HKD",
|
| 330 |
+
"CAD",
|
| 331 |
+
"INR",
|
| 332 |
+
"DKK",
|
| 333 |
+
"GBP",
|
| 334 |
+
"RUB",
|
| 335 |
+
"NZD",
|
| 336 |
+
"MXN",
|
| 337 |
+
"IDR",
|
| 338 |
+
"TWD",
|
| 339 |
+
"THB",
|
| 340 |
+
"VND",
|
| 341 |
+
]
|
| 342 |
+
with Live(console=console) as live_table:
|
| 343 |
+
exchange_rate_dict: Dict[Tuple[str, str], float] = {}
|
| 344 |
+
|
| 345 |
+
for index in range(100):
|
| 346 |
+
select_exchange = exchanges[index % len(exchanges)]
|
| 347 |
+
|
| 348 |
+
for exchange in exchanges:
|
| 349 |
+
if exchange == select_exchange:
|
| 350 |
+
continue
|
| 351 |
+
time.sleep(0.4)
|
| 352 |
+
if random.randint(0, 10) < 1:
|
| 353 |
+
console.log(next(examples))
|
| 354 |
+
exchange_rate_dict[(select_exchange, exchange)] = 200 / (
|
| 355 |
+
(random.random() * 320) + 1
|
| 356 |
+
)
|
| 357 |
+
if len(exchange_rate_dict) > len(exchanges) - 1:
|
| 358 |
+
exchange_rate_dict.pop(list(exchange_rate_dict.keys())[0])
|
| 359 |
+
table = Table(title="Exchange Rates")
|
| 360 |
+
|
| 361 |
+
table.add_column("Source Currency")
|
| 362 |
+
table.add_column("Destination Currency")
|
| 363 |
+
table.add_column("Exchange Rate")
|
| 364 |
+
|
| 365 |
+
for (source, dest), exchange_rate in exchange_rate_dict.items():
|
| 366 |
+
table.add_row(
|
| 367 |
+
source,
|
| 368 |
+
dest,
|
| 369 |
+
Text(
|
| 370 |
+
f"{exchange_rate:.4f}",
|
| 371 |
+
style="red" if exchange_rate < 1.0 else "green",
|
| 372 |
+
),
|
| 373 |
+
)
|
| 374 |
+
|
| 375 |
+
live_table.update(Align.center(table))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/live_render.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import Optional, Tuple
|
| 3 |
+
|
| 4 |
+
if sys.version_info >= (3, 8):
|
| 5 |
+
from typing import Literal
|
| 6 |
+
else:
|
| 7 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from ._loop import loop_last
|
| 11 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 12 |
+
from .control import Control
|
| 13 |
+
from .segment import ControlType, Segment
|
| 14 |
+
from .style import StyleType
|
| 15 |
+
from .text import Text
|
| 16 |
+
|
| 17 |
+
VerticalOverflowMethod = Literal["crop", "ellipsis", "visible"]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class LiveRender:
|
| 21 |
+
"""Creates a renderable that may be updated.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
renderable (RenderableType): Any renderable object.
|
| 25 |
+
style (StyleType, optional): An optional style to apply to the renderable. Defaults to "".
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
renderable: RenderableType,
|
| 31 |
+
style: StyleType = "",
|
| 32 |
+
vertical_overflow: VerticalOverflowMethod = "ellipsis",
|
| 33 |
+
) -> None:
|
| 34 |
+
self.renderable = renderable
|
| 35 |
+
self.style = style
|
| 36 |
+
self.vertical_overflow = vertical_overflow
|
| 37 |
+
self._shape: Optional[Tuple[int, int]] = None
|
| 38 |
+
|
| 39 |
+
def set_renderable(self, renderable: RenderableType) -> None:
|
| 40 |
+
"""Set a new renderable.
|
| 41 |
+
|
| 42 |
+
Args:
|
| 43 |
+
renderable (RenderableType): Any renderable object, including str.
|
| 44 |
+
"""
|
| 45 |
+
self.renderable = renderable
|
| 46 |
+
|
| 47 |
+
def position_cursor(self) -> Control:
|
| 48 |
+
"""Get control codes to move cursor to beginning of live render.
|
| 49 |
+
|
| 50 |
+
Returns:
|
| 51 |
+
Control: A control instance that may be printed.
|
| 52 |
+
"""
|
| 53 |
+
if self._shape is not None:
|
| 54 |
+
_, height = self._shape
|
| 55 |
+
return Control(
|
| 56 |
+
ControlType.CARRIAGE_RETURN,
|
| 57 |
+
(ControlType.ERASE_IN_LINE, 2),
|
| 58 |
+
*(
|
| 59 |
+
(
|
| 60 |
+
(ControlType.CURSOR_UP, 1),
|
| 61 |
+
(ControlType.ERASE_IN_LINE, 2),
|
| 62 |
+
)
|
| 63 |
+
* (height - 1)
|
| 64 |
+
)
|
| 65 |
+
)
|
| 66 |
+
return Control()
|
| 67 |
+
|
| 68 |
+
def restore_cursor(self) -> Control:
|
| 69 |
+
"""Get control codes to clear the render and restore the cursor to its previous position.
|
| 70 |
+
|
| 71 |
+
Returns:
|
| 72 |
+
Control: A Control instance that may be printed.
|
| 73 |
+
"""
|
| 74 |
+
if self._shape is not None:
|
| 75 |
+
_, height = self._shape
|
| 76 |
+
return Control(
|
| 77 |
+
ControlType.CARRIAGE_RETURN,
|
| 78 |
+
*((ControlType.CURSOR_UP, 1), (ControlType.ERASE_IN_LINE, 2)) * height
|
| 79 |
+
)
|
| 80 |
+
return Control()
|
| 81 |
+
|
| 82 |
+
def __rich_console__(
|
| 83 |
+
self, console: Console, options: ConsoleOptions
|
| 84 |
+
) -> RenderResult:
|
| 85 |
+
renderable = self.renderable
|
| 86 |
+
style = console.get_style(self.style)
|
| 87 |
+
lines = console.render_lines(renderable, options, style=style, pad=False)
|
| 88 |
+
shape = Segment.get_shape(lines)
|
| 89 |
+
|
| 90 |
+
_, height = shape
|
| 91 |
+
if height > options.size.height:
|
| 92 |
+
if self.vertical_overflow == "crop":
|
| 93 |
+
lines = lines[: options.size.height]
|
| 94 |
+
shape = Segment.get_shape(lines)
|
| 95 |
+
elif self.vertical_overflow == "ellipsis":
|
| 96 |
+
lines = lines[: (options.size.height - 1)]
|
| 97 |
+
overflow_text = Text(
|
| 98 |
+
"...",
|
| 99 |
+
overflow="crop",
|
| 100 |
+
justify="center",
|
| 101 |
+
end="",
|
| 102 |
+
style="live.ellipsis",
|
| 103 |
+
)
|
| 104 |
+
lines.append(list(console.render(overflow_text)))
|
| 105 |
+
shape = Segment.get_shape(lines)
|
| 106 |
+
self._shape = shape
|
| 107 |
+
|
| 108 |
+
new_line = Segment.line()
|
| 109 |
+
for last, line in loop_last(lines):
|
| 110 |
+
yield from line
|
| 111 |
+
if not last:
|
| 112 |
+
yield new_line
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/logging.py
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
from datetime import datetime
|
| 3 |
+
from logging import Handler, LogRecord
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from types import ModuleType
|
| 6 |
+
from typing import ClassVar, Iterable, List, Optional, Type, Union
|
| 7 |
+
|
| 8 |
+
from pip._vendor.rich._null_file import NullFile
|
| 9 |
+
|
| 10 |
+
from . import get_console
|
| 11 |
+
from ._log_render import FormatTimeCallable, LogRender
|
| 12 |
+
from .console import Console, ConsoleRenderable
|
| 13 |
+
from .highlighter import Highlighter, ReprHighlighter
|
| 14 |
+
from .text import Text
|
| 15 |
+
from .traceback import Traceback
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class RichHandler(Handler):
|
| 19 |
+
"""A logging handler that renders output with Rich. The time / level / message and file are displayed in columns.
|
| 20 |
+
The level is color coded, and the message is syntax highlighted.
|
| 21 |
+
|
| 22 |
+
Note:
|
| 23 |
+
Be careful when enabling console markup in log messages if you have configured logging for libraries not
|
| 24 |
+
under your control. If a dependency writes messages containing square brackets, it may not produce the intended output.
|
| 25 |
+
|
| 26 |
+
Args:
|
| 27 |
+
level (Union[int, str], optional): Log level. Defaults to logging.NOTSET.
|
| 28 |
+
console (:class:`~rich.console.Console`, optional): Optional console instance to write logs.
|
| 29 |
+
Default will use a global console instance writing to stdout.
|
| 30 |
+
show_time (bool, optional): Show a column for the time. Defaults to True.
|
| 31 |
+
omit_repeated_times (bool, optional): Omit repetition of the same time. Defaults to True.
|
| 32 |
+
show_level (bool, optional): Show a column for the level. Defaults to True.
|
| 33 |
+
show_path (bool, optional): Show the path to the original log call. Defaults to True.
|
| 34 |
+
enable_link_path (bool, optional): Enable terminal link of path column to file. Defaults to True.
|
| 35 |
+
highlighter (Highlighter, optional): Highlighter to style log messages, or None to use ReprHighlighter. Defaults to None.
|
| 36 |
+
markup (bool, optional): Enable console markup in log messages. Defaults to False.
|
| 37 |
+
rich_tracebacks (bool, optional): Enable rich tracebacks with syntax highlighting and formatting. Defaults to False.
|
| 38 |
+
tracebacks_width (Optional[int], optional): Number of characters used to render tracebacks, or None for full width. Defaults to None.
|
| 39 |
+
tracebacks_code_width (int, optional): Number of code characters used to render tracebacks, or None for full width. Defaults to 88.
|
| 40 |
+
tracebacks_extra_lines (int, optional): Additional lines of code to render tracebacks, or None for full width. Defaults to None.
|
| 41 |
+
tracebacks_theme (str, optional): Override pygments theme used in traceback.
|
| 42 |
+
tracebacks_word_wrap (bool, optional): Enable word wrapping of long tracebacks lines. Defaults to True.
|
| 43 |
+
tracebacks_show_locals (bool, optional): Enable display of locals in tracebacks. Defaults to False.
|
| 44 |
+
tracebacks_suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
|
| 45 |
+
tracebacks_max_frames (int, optional): Optional maximum number of frames returned by traceback.
|
| 46 |
+
locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 47 |
+
Defaults to 10.
|
| 48 |
+
locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
|
| 49 |
+
log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%x %X] ".
|
| 50 |
+
keywords (List[str], optional): List of words to highlight instead of ``RichHandler.KEYWORDS``.
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
KEYWORDS: ClassVar[Optional[List[str]]] = [
|
| 54 |
+
"GET",
|
| 55 |
+
"POST",
|
| 56 |
+
"HEAD",
|
| 57 |
+
"PUT",
|
| 58 |
+
"DELETE",
|
| 59 |
+
"OPTIONS",
|
| 60 |
+
"TRACE",
|
| 61 |
+
"PATCH",
|
| 62 |
+
]
|
| 63 |
+
HIGHLIGHTER_CLASS: ClassVar[Type[Highlighter]] = ReprHighlighter
|
| 64 |
+
|
| 65 |
+
def __init__(
|
| 66 |
+
self,
|
| 67 |
+
level: Union[int, str] = logging.NOTSET,
|
| 68 |
+
console: Optional[Console] = None,
|
| 69 |
+
*,
|
| 70 |
+
show_time: bool = True,
|
| 71 |
+
omit_repeated_times: bool = True,
|
| 72 |
+
show_level: bool = True,
|
| 73 |
+
show_path: bool = True,
|
| 74 |
+
enable_link_path: bool = True,
|
| 75 |
+
highlighter: Optional[Highlighter] = None,
|
| 76 |
+
markup: bool = False,
|
| 77 |
+
rich_tracebacks: bool = False,
|
| 78 |
+
tracebacks_width: Optional[int] = None,
|
| 79 |
+
tracebacks_code_width: int = 88,
|
| 80 |
+
tracebacks_extra_lines: int = 3,
|
| 81 |
+
tracebacks_theme: Optional[str] = None,
|
| 82 |
+
tracebacks_word_wrap: bool = True,
|
| 83 |
+
tracebacks_show_locals: bool = False,
|
| 84 |
+
tracebacks_suppress: Iterable[Union[str, ModuleType]] = (),
|
| 85 |
+
tracebacks_max_frames: int = 100,
|
| 86 |
+
locals_max_length: int = 10,
|
| 87 |
+
locals_max_string: int = 80,
|
| 88 |
+
log_time_format: Union[str, FormatTimeCallable] = "[%x %X]",
|
| 89 |
+
keywords: Optional[List[str]] = None,
|
| 90 |
+
) -> None:
|
| 91 |
+
super().__init__(level=level)
|
| 92 |
+
self.console = console or get_console()
|
| 93 |
+
self.highlighter = highlighter or self.HIGHLIGHTER_CLASS()
|
| 94 |
+
self._log_render = LogRender(
|
| 95 |
+
show_time=show_time,
|
| 96 |
+
show_level=show_level,
|
| 97 |
+
show_path=show_path,
|
| 98 |
+
time_format=log_time_format,
|
| 99 |
+
omit_repeated_times=omit_repeated_times,
|
| 100 |
+
level_width=None,
|
| 101 |
+
)
|
| 102 |
+
self.enable_link_path = enable_link_path
|
| 103 |
+
self.markup = markup
|
| 104 |
+
self.rich_tracebacks = rich_tracebacks
|
| 105 |
+
self.tracebacks_width = tracebacks_width
|
| 106 |
+
self.tracebacks_extra_lines = tracebacks_extra_lines
|
| 107 |
+
self.tracebacks_theme = tracebacks_theme
|
| 108 |
+
self.tracebacks_word_wrap = tracebacks_word_wrap
|
| 109 |
+
self.tracebacks_show_locals = tracebacks_show_locals
|
| 110 |
+
self.tracebacks_suppress = tracebacks_suppress
|
| 111 |
+
self.tracebacks_max_frames = tracebacks_max_frames
|
| 112 |
+
self.tracebacks_code_width = tracebacks_code_width
|
| 113 |
+
self.locals_max_length = locals_max_length
|
| 114 |
+
self.locals_max_string = locals_max_string
|
| 115 |
+
self.keywords = keywords
|
| 116 |
+
|
| 117 |
+
def get_level_text(self, record: LogRecord) -> Text:
|
| 118 |
+
"""Get the level name from the record.
|
| 119 |
+
|
| 120 |
+
Args:
|
| 121 |
+
record (LogRecord): LogRecord instance.
|
| 122 |
+
|
| 123 |
+
Returns:
|
| 124 |
+
Text: A tuple of the style and level name.
|
| 125 |
+
"""
|
| 126 |
+
level_name = record.levelname
|
| 127 |
+
level_text = Text.styled(
|
| 128 |
+
level_name.ljust(8), f"logging.level.{level_name.lower()}"
|
| 129 |
+
)
|
| 130 |
+
return level_text
|
| 131 |
+
|
| 132 |
+
def emit(self, record: LogRecord) -> None:
|
| 133 |
+
"""Invoked by logging."""
|
| 134 |
+
message = self.format(record)
|
| 135 |
+
traceback = None
|
| 136 |
+
if (
|
| 137 |
+
self.rich_tracebacks
|
| 138 |
+
and record.exc_info
|
| 139 |
+
and record.exc_info != (None, None, None)
|
| 140 |
+
):
|
| 141 |
+
exc_type, exc_value, exc_traceback = record.exc_info
|
| 142 |
+
assert exc_type is not None
|
| 143 |
+
assert exc_value is not None
|
| 144 |
+
traceback = Traceback.from_exception(
|
| 145 |
+
exc_type,
|
| 146 |
+
exc_value,
|
| 147 |
+
exc_traceback,
|
| 148 |
+
width=self.tracebacks_width,
|
| 149 |
+
code_width=self.tracebacks_code_width,
|
| 150 |
+
extra_lines=self.tracebacks_extra_lines,
|
| 151 |
+
theme=self.tracebacks_theme,
|
| 152 |
+
word_wrap=self.tracebacks_word_wrap,
|
| 153 |
+
show_locals=self.tracebacks_show_locals,
|
| 154 |
+
locals_max_length=self.locals_max_length,
|
| 155 |
+
locals_max_string=self.locals_max_string,
|
| 156 |
+
suppress=self.tracebacks_suppress,
|
| 157 |
+
max_frames=self.tracebacks_max_frames,
|
| 158 |
+
)
|
| 159 |
+
message = record.getMessage()
|
| 160 |
+
if self.formatter:
|
| 161 |
+
record.message = record.getMessage()
|
| 162 |
+
formatter = self.formatter
|
| 163 |
+
if hasattr(formatter, "usesTime") and formatter.usesTime():
|
| 164 |
+
record.asctime = formatter.formatTime(record, formatter.datefmt)
|
| 165 |
+
message = formatter.formatMessage(record)
|
| 166 |
+
|
| 167 |
+
message_renderable = self.render_message(record, message)
|
| 168 |
+
log_renderable = self.render(
|
| 169 |
+
record=record, traceback=traceback, message_renderable=message_renderable
|
| 170 |
+
)
|
| 171 |
+
if isinstance(self.console.file, NullFile):
|
| 172 |
+
# Handles pythonw, where stdout/stderr are null, and we return NullFile
|
| 173 |
+
# instance from Console.file. In this case, we still want to make a log record
|
| 174 |
+
# even though we won't be writing anything to a file.
|
| 175 |
+
self.handleError(record)
|
| 176 |
+
else:
|
| 177 |
+
try:
|
| 178 |
+
self.console.print(log_renderable)
|
| 179 |
+
except Exception:
|
| 180 |
+
self.handleError(record)
|
| 181 |
+
|
| 182 |
+
def render_message(self, record: LogRecord, message: str) -> "ConsoleRenderable":
|
| 183 |
+
"""Render message text in to Text.
|
| 184 |
+
|
| 185 |
+
Args:
|
| 186 |
+
record (LogRecord): logging Record.
|
| 187 |
+
message (str): String containing log message.
|
| 188 |
+
|
| 189 |
+
Returns:
|
| 190 |
+
ConsoleRenderable: Renderable to display log message.
|
| 191 |
+
"""
|
| 192 |
+
use_markup = getattr(record, "markup", self.markup)
|
| 193 |
+
message_text = Text.from_markup(message) if use_markup else Text(message)
|
| 194 |
+
|
| 195 |
+
highlighter = getattr(record, "highlighter", self.highlighter)
|
| 196 |
+
if highlighter:
|
| 197 |
+
message_text = highlighter(message_text)
|
| 198 |
+
|
| 199 |
+
if self.keywords is None:
|
| 200 |
+
self.keywords = self.KEYWORDS
|
| 201 |
+
|
| 202 |
+
if self.keywords:
|
| 203 |
+
message_text.highlight_words(self.keywords, "logging.keyword")
|
| 204 |
+
|
| 205 |
+
return message_text
|
| 206 |
+
|
| 207 |
+
def render(
|
| 208 |
+
self,
|
| 209 |
+
*,
|
| 210 |
+
record: LogRecord,
|
| 211 |
+
traceback: Optional[Traceback],
|
| 212 |
+
message_renderable: "ConsoleRenderable",
|
| 213 |
+
) -> "ConsoleRenderable":
|
| 214 |
+
"""Render log for display.
|
| 215 |
+
|
| 216 |
+
Args:
|
| 217 |
+
record (LogRecord): logging Record.
|
| 218 |
+
traceback (Optional[Traceback]): Traceback instance or None for no Traceback.
|
| 219 |
+
message_renderable (ConsoleRenderable): Renderable (typically Text) containing log message contents.
|
| 220 |
+
|
| 221 |
+
Returns:
|
| 222 |
+
ConsoleRenderable: Renderable to display log.
|
| 223 |
+
"""
|
| 224 |
+
path = Path(record.pathname).name
|
| 225 |
+
level = self.get_level_text(record)
|
| 226 |
+
time_format = None if self.formatter is None else self.formatter.datefmt
|
| 227 |
+
log_time = datetime.fromtimestamp(record.created)
|
| 228 |
+
|
| 229 |
+
log_renderable = self._log_render(
|
| 230 |
+
self.console,
|
| 231 |
+
[message_renderable] if not traceback else [message_renderable, traceback],
|
| 232 |
+
log_time=log_time,
|
| 233 |
+
time_format=time_format,
|
| 234 |
+
level=level,
|
| 235 |
+
path=path,
|
| 236 |
+
line_no=record.lineno,
|
| 237 |
+
link_path=record.pathname if self.enable_link_path else None,
|
| 238 |
+
)
|
| 239 |
+
return log_renderable
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
if __name__ == "__main__": # pragma: no cover
|
| 243 |
+
from time import sleep
|
| 244 |
+
|
| 245 |
+
FORMAT = "%(message)s"
|
| 246 |
+
# FORMAT = "%(asctime)-15s - %(levelname)s - %(message)s"
|
| 247 |
+
logging.basicConfig(
|
| 248 |
+
level="NOTSET",
|
| 249 |
+
format=FORMAT,
|
| 250 |
+
datefmt="[%X]",
|
| 251 |
+
handlers=[RichHandler(rich_tracebacks=True, tracebacks_show_locals=True)],
|
| 252 |
+
)
|
| 253 |
+
log = logging.getLogger("rich")
|
| 254 |
+
|
| 255 |
+
log.info("Server starting...")
|
| 256 |
+
log.info("Listening on http://127.0.0.1:8080")
|
| 257 |
+
sleep(1)
|
| 258 |
+
|
| 259 |
+
log.info("GET /index.html 200 1298")
|
| 260 |
+
log.info("GET /imgs/backgrounds/back1.jpg 200 54386")
|
| 261 |
+
log.info("GET /css/styles.css 200 54386")
|
| 262 |
+
log.warning("GET /favicon.ico 404 242")
|
| 263 |
+
sleep(1)
|
| 264 |
+
|
| 265 |
+
log.debug(
|
| 266 |
+
"JSONRPC request\n--> %r\n<-- %r",
|
| 267 |
+
{
|
| 268 |
+
"version": "1.1",
|
| 269 |
+
"method": "confirmFruitPurchase",
|
| 270 |
+
"params": [["apple", "orange", "mangoes", "pomelo"], 1.123],
|
| 271 |
+
"id": "194521489",
|
| 272 |
+
},
|
| 273 |
+
{"version": "1.1", "result": True, "error": None, "id": "194521489"},
|
| 274 |
+
)
|
| 275 |
+
log.debug(
|
| 276 |
+
"Loading configuration file /adasd/asdasd/qeqwe/qwrqwrqwr/sdgsdgsdg/werwerwer/dfgerert/ertertert/ertetert/werwerwer"
|
| 277 |
+
)
|
| 278 |
+
log.error("Unable to find 'pomelo' in database!")
|
| 279 |
+
log.info("POST /jsonrpc/ 200 65532")
|
| 280 |
+
log.info("POST /admin/ 401 42234")
|
| 281 |
+
log.warning("password was rejected for admin site.")
|
| 282 |
+
|
| 283 |
+
def divide() -> None:
|
| 284 |
+
number = 1
|
| 285 |
+
divisor = 0
|
| 286 |
+
foos = ["foo"] * 100
|
| 287 |
+
log.debug("in divide")
|
| 288 |
+
try:
|
| 289 |
+
number / divisor
|
| 290 |
+
except:
|
| 291 |
+
log.exception("An error of some kind occurred!")
|
| 292 |
+
|
| 293 |
+
divide()
|
| 294 |
+
sleep(1)
|
| 295 |
+
log.critical("Out of memory!")
|
| 296 |
+
log.info("Server exited with code=-1")
|
| 297 |
+
log.info("[bold]EXITING...[/bold]", extra=dict(markup=True))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/markup.py
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
from ast import literal_eval
|
| 3 |
+
from operator import attrgetter
|
| 4 |
+
from typing import Callable, Iterable, List, Match, NamedTuple, Optional, Tuple, Union
|
| 5 |
+
|
| 6 |
+
from ._emoji_replace import _emoji_replace
|
| 7 |
+
from .emoji import EmojiVariant
|
| 8 |
+
from .errors import MarkupError
|
| 9 |
+
from .style import Style
|
| 10 |
+
from .text import Span, Text
|
| 11 |
+
|
| 12 |
+
RE_TAGS = re.compile(
|
| 13 |
+
r"""((\\*)\[([a-z#/@][^[]*?)])""",
|
| 14 |
+
re.VERBOSE,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
RE_HANDLER = re.compile(r"^([\w.]*?)(\(.*?\))?$")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class Tag(NamedTuple):
|
| 21 |
+
"""A tag in console markup."""
|
| 22 |
+
|
| 23 |
+
name: str
|
| 24 |
+
"""The tag name. e.g. 'bold'."""
|
| 25 |
+
parameters: Optional[str]
|
| 26 |
+
"""Any additional parameters after the name."""
|
| 27 |
+
|
| 28 |
+
def __str__(self) -> str:
|
| 29 |
+
return (
|
| 30 |
+
self.name if self.parameters is None else f"{self.name} {self.parameters}"
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
@property
|
| 34 |
+
def markup(self) -> str:
|
| 35 |
+
"""Get the string representation of this tag."""
|
| 36 |
+
return (
|
| 37 |
+
f"[{self.name}]"
|
| 38 |
+
if self.parameters is None
|
| 39 |
+
else f"[{self.name}={self.parameters}]"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
_ReStringMatch = Match[str] # regex match object
|
| 44 |
+
_ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub
|
| 45 |
+
_EscapeSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def escape(
|
| 49 |
+
markup: str,
|
| 50 |
+
_escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#/@][^[]*?])").sub,
|
| 51 |
+
) -> str:
|
| 52 |
+
"""Escapes text so that it won't be interpreted as markup.
|
| 53 |
+
|
| 54 |
+
Args:
|
| 55 |
+
markup (str): Content to be inserted in to markup.
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
str: Markup with square brackets escaped.
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
def escape_backslashes(match: Match[str]) -> str:
|
| 62 |
+
"""Called by re.sub replace matches."""
|
| 63 |
+
backslashes, text = match.groups()
|
| 64 |
+
return f"{backslashes}{backslashes}\\{text}"
|
| 65 |
+
|
| 66 |
+
markup = _escape(escape_backslashes, markup)
|
| 67 |
+
if markup.endswith("\\") and not markup.endswith("\\\\"):
|
| 68 |
+
return markup + "\\"
|
| 69 |
+
|
| 70 |
+
return markup
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def _parse(markup: str) -> Iterable[Tuple[int, Optional[str], Optional[Tag]]]:
|
| 74 |
+
"""Parse markup in to an iterable of tuples of (position, text, tag).
|
| 75 |
+
|
| 76 |
+
Args:
|
| 77 |
+
markup (str): A string containing console markup
|
| 78 |
+
|
| 79 |
+
"""
|
| 80 |
+
position = 0
|
| 81 |
+
_divmod = divmod
|
| 82 |
+
_Tag = Tag
|
| 83 |
+
for match in RE_TAGS.finditer(markup):
|
| 84 |
+
full_text, escapes, tag_text = match.groups()
|
| 85 |
+
start, end = match.span()
|
| 86 |
+
if start > position:
|
| 87 |
+
yield start, markup[position:start], None
|
| 88 |
+
if escapes:
|
| 89 |
+
backslashes, escaped = _divmod(len(escapes), 2)
|
| 90 |
+
if backslashes:
|
| 91 |
+
# Literal backslashes
|
| 92 |
+
yield start, "\\" * backslashes, None
|
| 93 |
+
start += backslashes * 2
|
| 94 |
+
if escaped:
|
| 95 |
+
# Escape of tag
|
| 96 |
+
yield start, full_text[len(escapes) :], None
|
| 97 |
+
position = end
|
| 98 |
+
continue
|
| 99 |
+
text, equals, parameters = tag_text.partition("=")
|
| 100 |
+
yield start, None, _Tag(text, parameters if equals else None)
|
| 101 |
+
position = end
|
| 102 |
+
if position < len(markup):
|
| 103 |
+
yield position, markup[position:], None
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def render(
|
| 107 |
+
markup: str,
|
| 108 |
+
style: Union[str, Style] = "",
|
| 109 |
+
emoji: bool = True,
|
| 110 |
+
emoji_variant: Optional[EmojiVariant] = None,
|
| 111 |
+
) -> Text:
|
| 112 |
+
"""Render console markup in to a Text instance.
|
| 113 |
+
|
| 114 |
+
Args:
|
| 115 |
+
markup (str): A string containing console markup.
|
| 116 |
+
style: (Union[str, Style]): The style to use.
|
| 117 |
+
emoji (bool, optional): Also render emoji code. Defaults to True.
|
| 118 |
+
emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
Raises:
|
| 122 |
+
MarkupError: If there is a syntax error in the markup.
|
| 123 |
+
|
| 124 |
+
Returns:
|
| 125 |
+
Text: A test instance.
|
| 126 |
+
"""
|
| 127 |
+
emoji_replace = _emoji_replace
|
| 128 |
+
if "[" not in markup:
|
| 129 |
+
return Text(
|
| 130 |
+
emoji_replace(markup, default_variant=emoji_variant) if emoji else markup,
|
| 131 |
+
style=style,
|
| 132 |
+
)
|
| 133 |
+
text = Text(style=style)
|
| 134 |
+
append = text.append
|
| 135 |
+
normalize = Style.normalize
|
| 136 |
+
|
| 137 |
+
style_stack: List[Tuple[int, Tag]] = []
|
| 138 |
+
pop = style_stack.pop
|
| 139 |
+
|
| 140 |
+
spans: List[Span] = []
|
| 141 |
+
append_span = spans.append
|
| 142 |
+
|
| 143 |
+
_Span = Span
|
| 144 |
+
_Tag = Tag
|
| 145 |
+
|
| 146 |
+
def pop_style(style_name: str) -> Tuple[int, Tag]:
|
| 147 |
+
"""Pop tag matching given style name."""
|
| 148 |
+
for index, (_, tag) in enumerate(reversed(style_stack), 1):
|
| 149 |
+
if tag.name == style_name:
|
| 150 |
+
return pop(-index)
|
| 151 |
+
raise KeyError(style_name)
|
| 152 |
+
|
| 153 |
+
for position, plain_text, tag in _parse(markup):
|
| 154 |
+
if plain_text is not None:
|
| 155 |
+
# Handle open brace escapes, where the brace is not part of a tag.
|
| 156 |
+
plain_text = plain_text.replace("\\[", "[")
|
| 157 |
+
append(emoji_replace(plain_text) if emoji else plain_text)
|
| 158 |
+
elif tag is not None:
|
| 159 |
+
if tag.name.startswith("/"): # Closing tag
|
| 160 |
+
style_name = tag.name[1:].strip()
|
| 161 |
+
|
| 162 |
+
if style_name: # explicit close
|
| 163 |
+
style_name = normalize(style_name)
|
| 164 |
+
try:
|
| 165 |
+
start, open_tag = pop_style(style_name)
|
| 166 |
+
except KeyError:
|
| 167 |
+
raise MarkupError(
|
| 168 |
+
f"closing tag '{tag.markup}' at position {position} doesn't match any open tag"
|
| 169 |
+
) from None
|
| 170 |
+
else: # implicit close
|
| 171 |
+
try:
|
| 172 |
+
start, open_tag = pop()
|
| 173 |
+
except IndexError:
|
| 174 |
+
raise MarkupError(
|
| 175 |
+
f"closing tag '[/]' at position {position} has nothing to close"
|
| 176 |
+
) from None
|
| 177 |
+
|
| 178 |
+
if open_tag.name.startswith("@"):
|
| 179 |
+
if open_tag.parameters:
|
| 180 |
+
handler_name = ""
|
| 181 |
+
parameters = open_tag.parameters.strip()
|
| 182 |
+
handler_match = RE_HANDLER.match(parameters)
|
| 183 |
+
if handler_match is not None:
|
| 184 |
+
handler_name, match_parameters = handler_match.groups()
|
| 185 |
+
parameters = (
|
| 186 |
+
"()" if match_parameters is None else match_parameters
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
try:
|
| 190 |
+
meta_params = literal_eval(parameters)
|
| 191 |
+
except SyntaxError as error:
|
| 192 |
+
raise MarkupError(
|
| 193 |
+
f"error parsing {parameters!r} in {open_tag.parameters!r}; {error.msg}"
|
| 194 |
+
)
|
| 195 |
+
except Exception as error:
|
| 196 |
+
raise MarkupError(
|
| 197 |
+
f"error parsing {open_tag.parameters!r}; {error}"
|
| 198 |
+
) from None
|
| 199 |
+
|
| 200 |
+
if handler_name:
|
| 201 |
+
meta_params = (
|
| 202 |
+
handler_name,
|
| 203 |
+
meta_params
|
| 204 |
+
if isinstance(meta_params, tuple)
|
| 205 |
+
else (meta_params,),
|
| 206 |
+
)
|
| 207 |
+
|
| 208 |
+
else:
|
| 209 |
+
meta_params = ()
|
| 210 |
+
|
| 211 |
+
append_span(
|
| 212 |
+
_Span(
|
| 213 |
+
start, len(text), Style(meta={open_tag.name: meta_params})
|
| 214 |
+
)
|
| 215 |
+
)
|
| 216 |
+
else:
|
| 217 |
+
append_span(_Span(start, len(text), str(open_tag)))
|
| 218 |
+
|
| 219 |
+
else: # Opening tag
|
| 220 |
+
normalized_tag = _Tag(normalize(tag.name), tag.parameters)
|
| 221 |
+
style_stack.append((len(text), normalized_tag))
|
| 222 |
+
|
| 223 |
+
text_length = len(text)
|
| 224 |
+
while style_stack:
|
| 225 |
+
start, tag = style_stack.pop()
|
| 226 |
+
style = str(tag)
|
| 227 |
+
if style:
|
| 228 |
+
append_span(_Span(start, text_length, style))
|
| 229 |
+
|
| 230 |
+
text.spans = sorted(spans[::-1], key=attrgetter("start"))
|
| 231 |
+
return text
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
if __name__ == "__main__": # pragma: no cover
|
| 235 |
+
MARKUP = [
|
| 236 |
+
"[red]Hello World[/red]",
|
| 237 |
+
"[magenta]Hello [b]World[/b]",
|
| 238 |
+
"[bold]Bold[italic] bold and italic [/bold]italic[/italic]",
|
| 239 |
+
"Click [link=https://www.willmcgugan.com]here[/link] to visit my Blog",
|
| 240 |
+
":warning-emoji: [bold red blink] DANGER![/]",
|
| 241 |
+
]
|
| 242 |
+
|
| 243 |
+
from pip._vendor.rich import print
|
| 244 |
+
from pip._vendor.rich.table import Table
|
| 245 |
+
|
| 246 |
+
grid = Table("Markup", "Result", padding=(0, 1))
|
| 247 |
+
|
| 248 |
+
for markup in MARKUP:
|
| 249 |
+
grid.add_row(Text(markup), markup)
|
| 250 |
+
|
| 251 |
+
print(grid)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/measure.py
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from operator import itemgetter
|
| 2 |
+
from typing import TYPE_CHECKING, Callable, NamedTuple, Optional, Sequence
|
| 3 |
+
|
| 4 |
+
from . import errors
|
| 5 |
+
from .protocol import is_renderable, rich_cast
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from .console import Console, ConsoleOptions, RenderableType
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Measurement(NamedTuple):
|
| 12 |
+
"""Stores the minimum and maximum widths (in characters) required to render an object."""
|
| 13 |
+
|
| 14 |
+
minimum: int
|
| 15 |
+
"""Minimum number of cells required to render."""
|
| 16 |
+
maximum: int
|
| 17 |
+
"""Maximum number of cells required to render."""
|
| 18 |
+
|
| 19 |
+
@property
|
| 20 |
+
def span(self) -> int:
|
| 21 |
+
"""Get difference between maximum and minimum."""
|
| 22 |
+
return self.maximum - self.minimum
|
| 23 |
+
|
| 24 |
+
def normalize(self) -> "Measurement":
|
| 25 |
+
"""Get measurement that ensures that minimum <= maximum and minimum >= 0
|
| 26 |
+
|
| 27 |
+
Returns:
|
| 28 |
+
Measurement: A normalized measurement.
|
| 29 |
+
"""
|
| 30 |
+
minimum, maximum = self
|
| 31 |
+
minimum = min(max(0, minimum), maximum)
|
| 32 |
+
return Measurement(max(0, minimum), max(0, max(minimum, maximum)))
|
| 33 |
+
|
| 34 |
+
def with_maximum(self, width: int) -> "Measurement":
|
| 35 |
+
"""Get a RenderableWith where the widths are <= width.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
width (int): Maximum desired width.
|
| 39 |
+
|
| 40 |
+
Returns:
|
| 41 |
+
Measurement: New Measurement object.
|
| 42 |
+
"""
|
| 43 |
+
minimum, maximum = self
|
| 44 |
+
return Measurement(min(minimum, width), min(maximum, width))
|
| 45 |
+
|
| 46 |
+
def with_minimum(self, width: int) -> "Measurement":
|
| 47 |
+
"""Get a RenderableWith where the widths are >= width.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
width (int): Minimum desired width.
|
| 51 |
+
|
| 52 |
+
Returns:
|
| 53 |
+
Measurement: New Measurement object.
|
| 54 |
+
"""
|
| 55 |
+
minimum, maximum = self
|
| 56 |
+
width = max(0, width)
|
| 57 |
+
return Measurement(max(minimum, width), max(maximum, width))
|
| 58 |
+
|
| 59 |
+
def clamp(
|
| 60 |
+
self, min_width: Optional[int] = None, max_width: Optional[int] = None
|
| 61 |
+
) -> "Measurement":
|
| 62 |
+
"""Clamp a measurement within the specified range.
|
| 63 |
+
|
| 64 |
+
Args:
|
| 65 |
+
min_width (int): Minimum desired width, or ``None`` for no minimum. Defaults to None.
|
| 66 |
+
max_width (int): Maximum desired width, or ``None`` for no maximum. Defaults to None.
|
| 67 |
+
|
| 68 |
+
Returns:
|
| 69 |
+
Measurement: New Measurement object.
|
| 70 |
+
"""
|
| 71 |
+
measurement = self
|
| 72 |
+
if min_width is not None:
|
| 73 |
+
measurement = measurement.with_minimum(min_width)
|
| 74 |
+
if max_width is not None:
|
| 75 |
+
measurement = measurement.with_maximum(max_width)
|
| 76 |
+
return measurement
|
| 77 |
+
|
| 78 |
+
@classmethod
|
| 79 |
+
def get(
|
| 80 |
+
cls, console: "Console", options: "ConsoleOptions", renderable: "RenderableType"
|
| 81 |
+
) -> "Measurement":
|
| 82 |
+
"""Get a measurement for a renderable.
|
| 83 |
+
|
| 84 |
+
Args:
|
| 85 |
+
console (~rich.console.Console): Console instance.
|
| 86 |
+
options (~rich.console.ConsoleOptions): Console options.
|
| 87 |
+
renderable (RenderableType): An object that may be rendered with Rich.
|
| 88 |
+
|
| 89 |
+
Raises:
|
| 90 |
+
errors.NotRenderableError: If the object is not renderable.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
Measurement: Measurement object containing range of character widths required to render the object.
|
| 94 |
+
"""
|
| 95 |
+
_max_width = options.max_width
|
| 96 |
+
if _max_width < 1:
|
| 97 |
+
return Measurement(0, 0)
|
| 98 |
+
if isinstance(renderable, str):
|
| 99 |
+
renderable = console.render_str(
|
| 100 |
+
renderable, markup=options.markup, highlight=False
|
| 101 |
+
)
|
| 102 |
+
renderable = rich_cast(renderable)
|
| 103 |
+
if is_renderable(renderable):
|
| 104 |
+
get_console_width: Optional[
|
| 105 |
+
Callable[["Console", "ConsoleOptions"], "Measurement"]
|
| 106 |
+
] = getattr(renderable, "__rich_measure__", None)
|
| 107 |
+
if get_console_width is not None:
|
| 108 |
+
render_width = (
|
| 109 |
+
get_console_width(console, options)
|
| 110 |
+
.normalize()
|
| 111 |
+
.with_maximum(_max_width)
|
| 112 |
+
)
|
| 113 |
+
if render_width.maximum < 1:
|
| 114 |
+
return Measurement(0, 0)
|
| 115 |
+
return render_width.normalize()
|
| 116 |
+
else:
|
| 117 |
+
return Measurement(0, _max_width)
|
| 118 |
+
else:
|
| 119 |
+
raise errors.NotRenderableError(
|
| 120 |
+
f"Unable to get render width for {renderable!r}; "
|
| 121 |
+
"a str, Segment, or object with __rich_console__ method is required"
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def measure_renderables(
|
| 126 |
+
console: "Console",
|
| 127 |
+
options: "ConsoleOptions",
|
| 128 |
+
renderables: Sequence["RenderableType"],
|
| 129 |
+
) -> "Measurement":
|
| 130 |
+
"""Get a measurement that would fit a number of renderables.
|
| 131 |
+
|
| 132 |
+
Args:
|
| 133 |
+
console (~rich.console.Console): Console instance.
|
| 134 |
+
options (~rich.console.ConsoleOptions): Console options.
|
| 135 |
+
renderables (Iterable[RenderableType]): One or more renderable objects.
|
| 136 |
+
|
| 137 |
+
Returns:
|
| 138 |
+
Measurement: Measurement object containing range of character widths required to
|
| 139 |
+
contain all given renderables.
|
| 140 |
+
"""
|
| 141 |
+
if not renderables:
|
| 142 |
+
return Measurement(0, 0)
|
| 143 |
+
get_measurement = Measurement.get
|
| 144 |
+
measurements = [
|
| 145 |
+
get_measurement(console, options, renderable) for renderable in renderables
|
| 146 |
+
]
|
| 147 |
+
measured_width = Measurement(
|
| 148 |
+
max(measurements, key=itemgetter(0)).minimum,
|
| 149 |
+
max(measurements, key=itemgetter(1)).maximum,
|
| 150 |
+
)
|
| 151 |
+
return measured_width
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/padding.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
|
| 2 |
+
|
| 3 |
+
if TYPE_CHECKING:
|
| 4 |
+
from .console import (
|
| 5 |
+
Console,
|
| 6 |
+
ConsoleOptions,
|
| 7 |
+
RenderableType,
|
| 8 |
+
RenderResult,
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
from .jupyter import JupyterMixin
|
| 12 |
+
from .measure import Measurement
|
| 13 |
+
from .segment import Segment
|
| 14 |
+
from .style import Style
|
| 15 |
+
|
| 16 |
+
PaddingDimensions = Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int, int]]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Padding(JupyterMixin):
|
| 20 |
+
"""Draw space around content.
|
| 21 |
+
|
| 22 |
+
Example:
|
| 23 |
+
>>> print(Padding("Hello", (2, 4), style="on blue"))
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
renderable (RenderableType): String or other renderable.
|
| 27 |
+
pad (Union[int, Tuple[int]]): Padding for top, right, bottom, and left borders.
|
| 28 |
+
May be specified with 1, 2, or 4 integers (CSS style).
|
| 29 |
+
style (Union[str, Style], optional): Style for padding characters. Defaults to "none".
|
| 30 |
+
expand (bool, optional): Expand padding to fit available width. Defaults to True.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self,
|
| 35 |
+
renderable: "RenderableType",
|
| 36 |
+
pad: "PaddingDimensions" = (0, 0, 0, 0),
|
| 37 |
+
*,
|
| 38 |
+
style: Union[str, Style] = "none",
|
| 39 |
+
expand: bool = True,
|
| 40 |
+
):
|
| 41 |
+
self.renderable = renderable
|
| 42 |
+
self.top, self.right, self.bottom, self.left = self.unpack(pad)
|
| 43 |
+
self.style = style
|
| 44 |
+
self.expand = expand
|
| 45 |
+
|
| 46 |
+
@classmethod
|
| 47 |
+
def indent(cls, renderable: "RenderableType", level: int) -> "Padding":
|
| 48 |
+
"""Make padding instance to render an indent.
|
| 49 |
+
|
| 50 |
+
Args:
|
| 51 |
+
renderable (RenderableType): String or other renderable.
|
| 52 |
+
level (int): Number of characters to indent.
|
| 53 |
+
|
| 54 |
+
Returns:
|
| 55 |
+
Padding: A Padding instance.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
return Padding(renderable, pad=(0, 0, 0, level), expand=False)
|
| 59 |
+
|
| 60 |
+
@staticmethod
|
| 61 |
+
def unpack(pad: "PaddingDimensions") -> Tuple[int, int, int, int]:
|
| 62 |
+
"""Unpack padding specified in CSS style."""
|
| 63 |
+
if isinstance(pad, int):
|
| 64 |
+
return (pad, pad, pad, pad)
|
| 65 |
+
if len(pad) == 1:
|
| 66 |
+
_pad = pad[0]
|
| 67 |
+
return (_pad, _pad, _pad, _pad)
|
| 68 |
+
if len(pad) == 2:
|
| 69 |
+
pad_top, pad_right = pad
|
| 70 |
+
return (pad_top, pad_right, pad_top, pad_right)
|
| 71 |
+
if len(pad) == 4:
|
| 72 |
+
top, right, bottom, left = pad
|
| 73 |
+
return (top, right, bottom, left)
|
| 74 |
+
raise ValueError(f"1, 2 or 4 integers required for padding; {len(pad)} given")
|
| 75 |
+
|
| 76 |
+
def __repr__(self) -> str:
|
| 77 |
+
return f"Padding({self.renderable!r}, ({self.top},{self.right},{self.bottom},{self.left}))"
|
| 78 |
+
|
| 79 |
+
def __rich_console__(
|
| 80 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 81 |
+
) -> "RenderResult":
|
| 82 |
+
style = console.get_style(self.style)
|
| 83 |
+
if self.expand:
|
| 84 |
+
width = options.max_width
|
| 85 |
+
else:
|
| 86 |
+
width = min(
|
| 87 |
+
Measurement.get(console, options, self.renderable).maximum
|
| 88 |
+
+ self.left
|
| 89 |
+
+ self.right,
|
| 90 |
+
options.max_width,
|
| 91 |
+
)
|
| 92 |
+
render_options = options.update_width(width - self.left - self.right)
|
| 93 |
+
if render_options.height is not None:
|
| 94 |
+
render_options = render_options.update_height(
|
| 95 |
+
height=render_options.height - self.top - self.bottom
|
| 96 |
+
)
|
| 97 |
+
lines = console.render_lines(
|
| 98 |
+
self.renderable, render_options, style=style, pad=True
|
| 99 |
+
)
|
| 100 |
+
_Segment = Segment
|
| 101 |
+
|
| 102 |
+
left = _Segment(" " * self.left, style) if self.left else None
|
| 103 |
+
right = (
|
| 104 |
+
[_Segment(f'{" " * self.right}', style), _Segment.line()]
|
| 105 |
+
if self.right
|
| 106 |
+
else [_Segment.line()]
|
| 107 |
+
)
|
| 108 |
+
blank_line: Optional[List[Segment]] = None
|
| 109 |
+
if self.top:
|
| 110 |
+
blank_line = [_Segment(f'{" " * width}\n', style)]
|
| 111 |
+
yield from blank_line * self.top
|
| 112 |
+
if left:
|
| 113 |
+
for line in lines:
|
| 114 |
+
yield left
|
| 115 |
+
yield from line
|
| 116 |
+
yield from right
|
| 117 |
+
else:
|
| 118 |
+
for line in lines:
|
| 119 |
+
yield from line
|
| 120 |
+
yield from right
|
| 121 |
+
if self.bottom:
|
| 122 |
+
blank_line = blank_line or [_Segment(f'{" " * width}\n', style)]
|
| 123 |
+
yield from blank_line * self.bottom
|
| 124 |
+
|
| 125 |
+
def __rich_measure__(
|
| 126 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 127 |
+
) -> "Measurement":
|
| 128 |
+
max_width = options.max_width
|
| 129 |
+
extra_width = self.left + self.right
|
| 130 |
+
if max_width - extra_width < 1:
|
| 131 |
+
return Measurement(max_width, max_width)
|
| 132 |
+
measure_min, measure_max = Measurement.get(console, options, self.renderable)
|
| 133 |
+
measurement = Measurement(measure_min + extra_width, measure_max + extra_width)
|
| 134 |
+
measurement = measurement.with_maximum(max_width)
|
| 135 |
+
return measurement
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
if __name__ == "__main__": # pragma: no cover
|
| 139 |
+
from pip._vendor.rich import print
|
| 140 |
+
|
| 141 |
+
print(Padding("Hello, World", (2, 4), style="on blue"))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/pager.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
from typing import Any
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class Pager(ABC):
|
| 6 |
+
"""Base class for a pager."""
|
| 7 |
+
|
| 8 |
+
@abstractmethod
|
| 9 |
+
def show(self, content: str) -> None:
|
| 10 |
+
"""Show content in pager.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
content (str): Content to be displayed.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class SystemPager(Pager):
|
| 18 |
+
"""Uses the pager installed on the system."""
|
| 19 |
+
|
| 20 |
+
def _pager(self, content: str) -> Any: # pragma: no cover
|
| 21 |
+
return __import__("pydoc").pager(content)
|
| 22 |
+
|
| 23 |
+
def show(self, content: str) -> None:
|
| 24 |
+
"""Use the same pager used by pydoc."""
|
| 25 |
+
self._pager(content)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__": # pragma: no cover
|
| 29 |
+
from .__main__ import make_test_card
|
| 30 |
+
from .console import Console
|
| 31 |
+
|
| 32 |
+
console = Console()
|
| 33 |
+
with console.pager(styles=True):
|
| 34 |
+
console.print(make_test_card())
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/palette.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from math import sqrt
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from typing import Sequence, Tuple, TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
from .color_triplet import ColorTriplet
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from pip._vendor.rich.table import Table
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Palette:
|
| 12 |
+
"""A palette of available colors."""
|
| 13 |
+
|
| 14 |
+
def __init__(self, colors: Sequence[Tuple[int, int, int]]):
|
| 15 |
+
self._colors = colors
|
| 16 |
+
|
| 17 |
+
def __getitem__(self, number: int) -> ColorTriplet:
|
| 18 |
+
return ColorTriplet(*self._colors[number])
|
| 19 |
+
|
| 20 |
+
def __rich__(self) -> "Table":
|
| 21 |
+
from pip._vendor.rich.color import Color
|
| 22 |
+
from pip._vendor.rich.style import Style
|
| 23 |
+
from pip._vendor.rich.text import Text
|
| 24 |
+
from pip._vendor.rich.table import Table
|
| 25 |
+
|
| 26 |
+
table = Table(
|
| 27 |
+
"index",
|
| 28 |
+
"RGB",
|
| 29 |
+
"Color",
|
| 30 |
+
title="Palette",
|
| 31 |
+
caption=f"{len(self._colors)} colors",
|
| 32 |
+
highlight=True,
|
| 33 |
+
caption_justify="right",
|
| 34 |
+
)
|
| 35 |
+
for index, color in enumerate(self._colors):
|
| 36 |
+
table.add_row(
|
| 37 |
+
str(index),
|
| 38 |
+
repr(color),
|
| 39 |
+
Text(" " * 16, style=Style(bgcolor=Color.from_rgb(*color))),
|
| 40 |
+
)
|
| 41 |
+
return table
|
| 42 |
+
|
| 43 |
+
# This is somewhat inefficient and needs caching
|
| 44 |
+
@lru_cache(maxsize=1024)
|
| 45 |
+
def match(self, color: Tuple[int, int, int]) -> int:
|
| 46 |
+
"""Find a color from a palette that most closely matches a given color.
|
| 47 |
+
|
| 48 |
+
Args:
|
| 49 |
+
color (Tuple[int, int, int]): RGB components in range 0 > 255.
|
| 50 |
+
|
| 51 |
+
Returns:
|
| 52 |
+
int: Index of closes matching color.
|
| 53 |
+
"""
|
| 54 |
+
red1, green1, blue1 = color
|
| 55 |
+
_sqrt = sqrt
|
| 56 |
+
get_color = self._colors.__getitem__
|
| 57 |
+
|
| 58 |
+
def get_color_distance(index: int) -> float:
|
| 59 |
+
"""Get the distance to a color."""
|
| 60 |
+
red2, green2, blue2 = get_color(index)
|
| 61 |
+
red_mean = (red1 + red2) // 2
|
| 62 |
+
red = red1 - red2
|
| 63 |
+
green = green1 - green2
|
| 64 |
+
blue = blue1 - blue2
|
| 65 |
+
return _sqrt(
|
| 66 |
+
(((512 + red_mean) * red * red) >> 8)
|
| 67 |
+
+ 4 * green * green
|
| 68 |
+
+ (((767 - red_mean) * blue * blue) >> 8)
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
min_index = min(range(len(self._colors)), key=get_color_distance)
|
| 72 |
+
return min_index
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__": # pragma: no cover
|
| 76 |
+
import colorsys
|
| 77 |
+
from typing import Iterable
|
| 78 |
+
from pip._vendor.rich.color import Color
|
| 79 |
+
from pip._vendor.rich.console import Console, ConsoleOptions
|
| 80 |
+
from pip._vendor.rich.segment import Segment
|
| 81 |
+
from pip._vendor.rich.style import Style
|
| 82 |
+
|
| 83 |
+
class ColorBox:
|
| 84 |
+
def __rich_console__(
|
| 85 |
+
self, console: Console, options: ConsoleOptions
|
| 86 |
+
) -> Iterable[Segment]:
|
| 87 |
+
height = console.size.height - 3
|
| 88 |
+
for y in range(0, height):
|
| 89 |
+
for x in range(options.max_width):
|
| 90 |
+
h = x / options.max_width
|
| 91 |
+
l = y / (height + 1)
|
| 92 |
+
r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0)
|
| 93 |
+
r2, g2, b2 = colorsys.hls_to_rgb(h, l + (1 / height / 2), 1.0)
|
| 94 |
+
bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255)
|
| 95 |
+
color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255)
|
| 96 |
+
yield Segment("▄", Style(color=color, bgcolor=bgcolor))
|
| 97 |
+
yield Segment.line()
|
| 98 |
+
|
| 99 |
+
console = Console()
|
| 100 |
+
console.print(ColorBox())
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/panel.py
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING, Optional
|
| 2 |
+
|
| 3 |
+
from .align import AlignMethod
|
| 4 |
+
from .box import ROUNDED, Box
|
| 5 |
+
from .cells import cell_len
|
| 6 |
+
from .jupyter import JupyterMixin
|
| 7 |
+
from .measure import Measurement, measure_renderables
|
| 8 |
+
from .padding import Padding, PaddingDimensions
|
| 9 |
+
from .segment import Segment
|
| 10 |
+
from .style import Style, StyleType
|
| 11 |
+
from .text import Text, TextType
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING:
|
| 14 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Panel(JupyterMixin):
|
| 18 |
+
"""A console renderable that draws a border around its contents.
|
| 19 |
+
|
| 20 |
+
Example:
|
| 21 |
+
>>> console.print(Panel("Hello, World!"))
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
renderable (RenderableType): A console renderable object.
|
| 25 |
+
box (Box): A Box instance that defines the look of the border (see :ref:`appendix_box`. Defaults to box.ROUNDED.
|
| 26 |
+
title (Optional[TextType], optional): Optional title displayed in panel header. Defaults to None.
|
| 27 |
+
title_align (AlignMethod, optional): Alignment of title. Defaults to "center".
|
| 28 |
+
subtitle (Optional[TextType], optional): Optional subtitle displayed in panel footer. Defaults to None.
|
| 29 |
+
subtitle_align (AlignMethod, optional): Alignment of subtitle. Defaults to "center".
|
| 30 |
+
safe_box (bool, optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
|
| 31 |
+
expand (bool, optional): If True the panel will stretch to fill the console width, otherwise it will be sized to fit the contents. Defaults to True.
|
| 32 |
+
style (str, optional): The style of the panel (border and contents). Defaults to "none".
|
| 33 |
+
border_style (str, optional): The style of the border. Defaults to "none".
|
| 34 |
+
width (Optional[int], optional): Optional width of panel. Defaults to None to auto-detect.
|
| 35 |
+
height (Optional[int], optional): Optional height of panel. Defaults to None to auto-detect.
|
| 36 |
+
padding (Optional[PaddingDimensions]): Optional padding around renderable. Defaults to 0.
|
| 37 |
+
highlight (bool, optional): Enable automatic highlighting of panel title (if str). Defaults to False.
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
def __init__(
|
| 41 |
+
self,
|
| 42 |
+
renderable: "RenderableType",
|
| 43 |
+
box: Box = ROUNDED,
|
| 44 |
+
*,
|
| 45 |
+
title: Optional[TextType] = None,
|
| 46 |
+
title_align: AlignMethod = "center",
|
| 47 |
+
subtitle: Optional[TextType] = None,
|
| 48 |
+
subtitle_align: AlignMethod = "center",
|
| 49 |
+
safe_box: Optional[bool] = None,
|
| 50 |
+
expand: bool = True,
|
| 51 |
+
style: StyleType = "none",
|
| 52 |
+
border_style: StyleType = "none",
|
| 53 |
+
width: Optional[int] = None,
|
| 54 |
+
height: Optional[int] = None,
|
| 55 |
+
padding: PaddingDimensions = (0, 1),
|
| 56 |
+
highlight: bool = False,
|
| 57 |
+
) -> None:
|
| 58 |
+
self.renderable = renderable
|
| 59 |
+
self.box = box
|
| 60 |
+
self.title = title
|
| 61 |
+
self.title_align: AlignMethod = title_align
|
| 62 |
+
self.subtitle = subtitle
|
| 63 |
+
self.subtitle_align = subtitle_align
|
| 64 |
+
self.safe_box = safe_box
|
| 65 |
+
self.expand = expand
|
| 66 |
+
self.style = style
|
| 67 |
+
self.border_style = border_style
|
| 68 |
+
self.width = width
|
| 69 |
+
self.height = height
|
| 70 |
+
self.padding = padding
|
| 71 |
+
self.highlight = highlight
|
| 72 |
+
|
| 73 |
+
@classmethod
|
| 74 |
+
def fit(
|
| 75 |
+
cls,
|
| 76 |
+
renderable: "RenderableType",
|
| 77 |
+
box: Box = ROUNDED,
|
| 78 |
+
*,
|
| 79 |
+
title: Optional[TextType] = None,
|
| 80 |
+
title_align: AlignMethod = "center",
|
| 81 |
+
subtitle: Optional[TextType] = None,
|
| 82 |
+
subtitle_align: AlignMethod = "center",
|
| 83 |
+
safe_box: Optional[bool] = None,
|
| 84 |
+
style: StyleType = "none",
|
| 85 |
+
border_style: StyleType = "none",
|
| 86 |
+
width: Optional[int] = None,
|
| 87 |
+
height: Optional[int] = None,
|
| 88 |
+
padding: PaddingDimensions = (0, 1),
|
| 89 |
+
highlight: bool = False,
|
| 90 |
+
) -> "Panel":
|
| 91 |
+
"""An alternative constructor that sets expand=False."""
|
| 92 |
+
return cls(
|
| 93 |
+
renderable,
|
| 94 |
+
box,
|
| 95 |
+
title=title,
|
| 96 |
+
title_align=title_align,
|
| 97 |
+
subtitle=subtitle,
|
| 98 |
+
subtitle_align=subtitle_align,
|
| 99 |
+
safe_box=safe_box,
|
| 100 |
+
style=style,
|
| 101 |
+
border_style=border_style,
|
| 102 |
+
width=width,
|
| 103 |
+
height=height,
|
| 104 |
+
padding=padding,
|
| 105 |
+
highlight=highlight,
|
| 106 |
+
expand=False,
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def _title(self) -> Optional[Text]:
|
| 111 |
+
if self.title:
|
| 112 |
+
title_text = (
|
| 113 |
+
Text.from_markup(self.title)
|
| 114 |
+
if isinstance(self.title, str)
|
| 115 |
+
else self.title.copy()
|
| 116 |
+
)
|
| 117 |
+
title_text.end = ""
|
| 118 |
+
title_text.plain = title_text.plain.replace("\n", " ")
|
| 119 |
+
title_text.no_wrap = True
|
| 120 |
+
title_text.expand_tabs()
|
| 121 |
+
title_text.pad(1)
|
| 122 |
+
return title_text
|
| 123 |
+
return None
|
| 124 |
+
|
| 125 |
+
@property
|
| 126 |
+
def _subtitle(self) -> Optional[Text]:
|
| 127 |
+
if self.subtitle:
|
| 128 |
+
subtitle_text = (
|
| 129 |
+
Text.from_markup(self.subtitle)
|
| 130 |
+
if isinstance(self.subtitle, str)
|
| 131 |
+
else self.subtitle.copy()
|
| 132 |
+
)
|
| 133 |
+
subtitle_text.end = ""
|
| 134 |
+
subtitle_text.plain = subtitle_text.plain.replace("\n", " ")
|
| 135 |
+
subtitle_text.no_wrap = True
|
| 136 |
+
subtitle_text.expand_tabs()
|
| 137 |
+
subtitle_text.pad(1)
|
| 138 |
+
return subtitle_text
|
| 139 |
+
return None
|
| 140 |
+
|
| 141 |
+
def __rich_console__(
|
| 142 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 143 |
+
) -> "RenderResult":
|
| 144 |
+
_padding = Padding.unpack(self.padding)
|
| 145 |
+
renderable = (
|
| 146 |
+
Padding(self.renderable, _padding) if any(_padding) else self.renderable
|
| 147 |
+
)
|
| 148 |
+
style = console.get_style(self.style)
|
| 149 |
+
partial_border_style = console.get_style(self.border_style)
|
| 150 |
+
border_style = style + partial_border_style
|
| 151 |
+
width = (
|
| 152 |
+
options.max_width
|
| 153 |
+
if self.width is None
|
| 154 |
+
else min(options.max_width, self.width)
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
safe_box: bool = console.safe_box if self.safe_box is None else self.safe_box
|
| 158 |
+
box = self.box.substitute(options, safe=safe_box)
|
| 159 |
+
|
| 160 |
+
def align_text(
|
| 161 |
+
text: Text, width: int, align: str, character: str, style: Style
|
| 162 |
+
) -> Text:
|
| 163 |
+
"""Gets new aligned text.
|
| 164 |
+
|
| 165 |
+
Args:
|
| 166 |
+
text (Text): Title or subtitle text.
|
| 167 |
+
width (int): Desired width.
|
| 168 |
+
align (str): Alignment.
|
| 169 |
+
character (str): Character for alignment.
|
| 170 |
+
style (Style): Border style
|
| 171 |
+
|
| 172 |
+
Returns:
|
| 173 |
+
Text: New text instance
|
| 174 |
+
"""
|
| 175 |
+
text = text.copy()
|
| 176 |
+
text.truncate(width)
|
| 177 |
+
excess_space = width - cell_len(text.plain)
|
| 178 |
+
if text.style:
|
| 179 |
+
text.stylize(console.get_style(text.style))
|
| 180 |
+
|
| 181 |
+
if excess_space:
|
| 182 |
+
if align == "left":
|
| 183 |
+
return Text.assemble(
|
| 184 |
+
text,
|
| 185 |
+
(character * excess_space, style),
|
| 186 |
+
no_wrap=True,
|
| 187 |
+
end="",
|
| 188 |
+
)
|
| 189 |
+
elif align == "center":
|
| 190 |
+
left = excess_space // 2
|
| 191 |
+
return Text.assemble(
|
| 192 |
+
(character * left, style),
|
| 193 |
+
text,
|
| 194 |
+
(character * (excess_space - left), style),
|
| 195 |
+
no_wrap=True,
|
| 196 |
+
end="",
|
| 197 |
+
)
|
| 198 |
+
else:
|
| 199 |
+
return Text.assemble(
|
| 200 |
+
(character * excess_space, style),
|
| 201 |
+
text,
|
| 202 |
+
no_wrap=True,
|
| 203 |
+
end="",
|
| 204 |
+
)
|
| 205 |
+
return text
|
| 206 |
+
|
| 207 |
+
title_text = self._title
|
| 208 |
+
if title_text is not None:
|
| 209 |
+
title_text.stylize_before(partial_border_style)
|
| 210 |
+
|
| 211 |
+
child_width = (
|
| 212 |
+
width - 2
|
| 213 |
+
if self.expand
|
| 214 |
+
else console.measure(
|
| 215 |
+
renderable, options=options.update_width(width - 2)
|
| 216 |
+
).maximum
|
| 217 |
+
)
|
| 218 |
+
child_height = self.height or options.height or None
|
| 219 |
+
if child_height:
|
| 220 |
+
child_height -= 2
|
| 221 |
+
if title_text is not None:
|
| 222 |
+
child_width = min(
|
| 223 |
+
options.max_width - 2, max(child_width, title_text.cell_len + 2)
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
width = child_width + 2
|
| 227 |
+
child_options = options.update(
|
| 228 |
+
width=child_width, height=child_height, highlight=self.highlight
|
| 229 |
+
)
|
| 230 |
+
lines = console.render_lines(renderable, child_options, style=style)
|
| 231 |
+
|
| 232 |
+
line_start = Segment(box.mid_left, border_style)
|
| 233 |
+
line_end = Segment(f"{box.mid_right}", border_style)
|
| 234 |
+
new_line = Segment.line()
|
| 235 |
+
if title_text is None or width <= 4:
|
| 236 |
+
yield Segment(box.get_top([width - 2]), border_style)
|
| 237 |
+
else:
|
| 238 |
+
title_text = align_text(
|
| 239 |
+
title_text,
|
| 240 |
+
width - 4,
|
| 241 |
+
self.title_align,
|
| 242 |
+
box.top,
|
| 243 |
+
border_style,
|
| 244 |
+
)
|
| 245 |
+
yield Segment(box.top_left + box.top, border_style)
|
| 246 |
+
yield from console.render(title_text, child_options.update_width(width - 4))
|
| 247 |
+
yield Segment(box.top + box.top_right, border_style)
|
| 248 |
+
|
| 249 |
+
yield new_line
|
| 250 |
+
for line in lines:
|
| 251 |
+
yield line_start
|
| 252 |
+
yield from line
|
| 253 |
+
yield line_end
|
| 254 |
+
yield new_line
|
| 255 |
+
|
| 256 |
+
subtitle_text = self._subtitle
|
| 257 |
+
if subtitle_text is not None:
|
| 258 |
+
subtitle_text.stylize_before(partial_border_style)
|
| 259 |
+
|
| 260 |
+
if subtitle_text is None or width <= 4:
|
| 261 |
+
yield Segment(box.get_bottom([width - 2]), border_style)
|
| 262 |
+
else:
|
| 263 |
+
subtitle_text = align_text(
|
| 264 |
+
subtitle_text,
|
| 265 |
+
width - 4,
|
| 266 |
+
self.subtitle_align,
|
| 267 |
+
box.bottom,
|
| 268 |
+
border_style,
|
| 269 |
+
)
|
| 270 |
+
yield Segment(box.bottom_left + box.bottom, border_style)
|
| 271 |
+
yield from console.render(
|
| 272 |
+
subtitle_text, child_options.update_width(width - 4)
|
| 273 |
+
)
|
| 274 |
+
yield Segment(box.bottom + box.bottom_right, border_style)
|
| 275 |
+
|
| 276 |
+
yield new_line
|
| 277 |
+
|
| 278 |
+
def __rich_measure__(
|
| 279 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 280 |
+
) -> "Measurement":
|
| 281 |
+
_title = self._title
|
| 282 |
+
_, right, _, left = Padding.unpack(self.padding)
|
| 283 |
+
padding = left + right
|
| 284 |
+
renderables = [self.renderable, _title] if _title else [self.renderable]
|
| 285 |
+
|
| 286 |
+
if self.width is None:
|
| 287 |
+
width = (
|
| 288 |
+
measure_renderables(
|
| 289 |
+
console,
|
| 290 |
+
options.update_width(options.max_width - padding - 2),
|
| 291 |
+
renderables,
|
| 292 |
+
).maximum
|
| 293 |
+
+ padding
|
| 294 |
+
+ 2
|
| 295 |
+
)
|
| 296 |
+
else:
|
| 297 |
+
width = self.width
|
| 298 |
+
return Measurement(width, width)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
if __name__ == "__main__": # pragma: no cover
|
| 302 |
+
from .console import Console
|
| 303 |
+
|
| 304 |
+
c = Console()
|
| 305 |
+
|
| 306 |
+
from .box import DOUBLE, ROUNDED
|
| 307 |
+
from .padding import Padding
|
| 308 |
+
|
| 309 |
+
p = Panel(
|
| 310 |
+
"Hello, World!",
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import builtins
|
| 2 |
+
import collections
|
| 3 |
+
import dataclasses
|
| 4 |
+
import inspect
|
| 5 |
+
import os
|
| 6 |
+
import reprlib
|
| 7 |
+
import sys
|
| 8 |
+
from array import array
|
| 9 |
+
from collections import Counter, UserDict, UserList, defaultdict, deque
|
| 10 |
+
from dataclasses import dataclass, fields, is_dataclass
|
| 11 |
+
from inspect import isclass
|
| 12 |
+
from itertools import islice
|
| 13 |
+
from types import MappingProxyType
|
| 14 |
+
from typing import (
|
| 15 |
+
TYPE_CHECKING,
|
| 16 |
+
Any,
|
| 17 |
+
Callable,
|
| 18 |
+
DefaultDict,
|
| 19 |
+
Deque,
|
| 20 |
+
Dict,
|
| 21 |
+
Iterable,
|
| 22 |
+
List,
|
| 23 |
+
Optional,
|
| 24 |
+
Sequence,
|
| 25 |
+
Set,
|
| 26 |
+
Tuple,
|
| 27 |
+
Union,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
from pip._vendor.rich.repr import RichReprResult
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
import attr as _attr_module
|
| 34 |
+
|
| 35 |
+
_has_attrs = hasattr(_attr_module, "ib")
|
| 36 |
+
except ImportError: # pragma: no cover
|
| 37 |
+
_has_attrs = False
|
| 38 |
+
|
| 39 |
+
from . import get_console
|
| 40 |
+
from ._loop import loop_last
|
| 41 |
+
from ._pick import pick_bool
|
| 42 |
+
from .abc import RichRenderable
|
| 43 |
+
from .cells import cell_len
|
| 44 |
+
from .highlighter import ReprHighlighter
|
| 45 |
+
from .jupyter import JupyterMixin, JupyterRenderable
|
| 46 |
+
from .measure import Measurement
|
| 47 |
+
from .text import Text
|
| 48 |
+
|
| 49 |
+
if TYPE_CHECKING:
|
| 50 |
+
from .console import (
|
| 51 |
+
Console,
|
| 52 |
+
ConsoleOptions,
|
| 53 |
+
HighlighterType,
|
| 54 |
+
JustifyMethod,
|
| 55 |
+
OverflowMethod,
|
| 56 |
+
RenderResult,
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def _is_attr_object(obj: Any) -> bool:
|
| 61 |
+
"""Check if an object was created with attrs module."""
|
| 62 |
+
return _has_attrs and _attr_module.has(type(obj))
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def _get_attr_fields(obj: Any) -> Sequence["_attr_module.Attribute[Any]"]:
|
| 66 |
+
"""Get fields for an attrs object."""
|
| 67 |
+
return _attr_module.fields(type(obj)) if _has_attrs else []
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _is_dataclass_repr(obj: object) -> bool:
|
| 71 |
+
"""Check if an instance of a dataclass contains the default repr.
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
obj (object): A dataclass instance.
|
| 75 |
+
|
| 76 |
+
Returns:
|
| 77 |
+
bool: True if the default repr is used, False if there is a custom repr.
|
| 78 |
+
"""
|
| 79 |
+
# Digging in to a lot of internals here
|
| 80 |
+
# Catching all exceptions in case something is missing on a non CPython implementation
|
| 81 |
+
try:
|
| 82 |
+
return obj.__repr__.__code__.co_filename in (
|
| 83 |
+
dataclasses.__file__,
|
| 84 |
+
reprlib.__file__,
|
| 85 |
+
)
|
| 86 |
+
except Exception: # pragma: no coverage
|
| 87 |
+
return False
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
_dummy_namedtuple = collections.namedtuple("_dummy_namedtuple", [])
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def _has_default_namedtuple_repr(obj: object) -> bool:
|
| 94 |
+
"""Check if an instance of namedtuple contains the default repr
|
| 95 |
+
|
| 96 |
+
Args:
|
| 97 |
+
obj (object): A namedtuple
|
| 98 |
+
|
| 99 |
+
Returns:
|
| 100 |
+
bool: True if the default repr is used, False if there's a custom repr.
|
| 101 |
+
"""
|
| 102 |
+
obj_file = None
|
| 103 |
+
try:
|
| 104 |
+
obj_file = inspect.getfile(obj.__repr__)
|
| 105 |
+
except (OSError, TypeError):
|
| 106 |
+
# OSError handles case where object is defined in __main__ scope, e.g. REPL - no filename available.
|
| 107 |
+
# TypeError trapped defensively, in case of object without filename slips through.
|
| 108 |
+
pass
|
| 109 |
+
default_repr_file = inspect.getfile(_dummy_namedtuple.__repr__)
|
| 110 |
+
return obj_file == default_repr_file
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def _ipy_display_hook(
|
| 114 |
+
value: Any,
|
| 115 |
+
console: Optional["Console"] = None,
|
| 116 |
+
overflow: "OverflowMethod" = "ignore",
|
| 117 |
+
crop: bool = False,
|
| 118 |
+
indent_guides: bool = False,
|
| 119 |
+
max_length: Optional[int] = None,
|
| 120 |
+
max_string: Optional[int] = None,
|
| 121 |
+
max_depth: Optional[int] = None,
|
| 122 |
+
expand_all: bool = False,
|
| 123 |
+
) -> Union[str, None]:
|
| 124 |
+
# needed here to prevent circular import:
|
| 125 |
+
from .console import ConsoleRenderable
|
| 126 |
+
|
| 127 |
+
# always skip rich generated jupyter renderables or None values
|
| 128 |
+
if _safe_isinstance(value, JupyterRenderable) or value is None:
|
| 129 |
+
return None
|
| 130 |
+
|
| 131 |
+
console = console or get_console()
|
| 132 |
+
|
| 133 |
+
with console.capture() as capture:
|
| 134 |
+
# certain renderables should start on a new line
|
| 135 |
+
if _safe_isinstance(value, ConsoleRenderable):
|
| 136 |
+
console.line()
|
| 137 |
+
console.print(
|
| 138 |
+
(
|
| 139 |
+
value
|
| 140 |
+
if _safe_isinstance(value, RichRenderable)
|
| 141 |
+
else Pretty(
|
| 142 |
+
value,
|
| 143 |
+
overflow=overflow,
|
| 144 |
+
indent_guides=indent_guides,
|
| 145 |
+
max_length=max_length,
|
| 146 |
+
max_string=max_string,
|
| 147 |
+
max_depth=max_depth,
|
| 148 |
+
expand_all=expand_all,
|
| 149 |
+
margin=12,
|
| 150 |
+
)
|
| 151 |
+
),
|
| 152 |
+
crop=crop,
|
| 153 |
+
new_line_start=True,
|
| 154 |
+
end="",
|
| 155 |
+
)
|
| 156 |
+
# strip trailing newline, not usually part of a text repr
|
| 157 |
+
# I'm not sure if this should be prevented at a lower level
|
| 158 |
+
return capture.get().rstrip("\n")
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def _safe_isinstance(
|
| 162 |
+
obj: object, class_or_tuple: Union[type, Tuple[type, ...]]
|
| 163 |
+
) -> bool:
|
| 164 |
+
"""isinstance can fail in rare cases, for example types with no __class__"""
|
| 165 |
+
try:
|
| 166 |
+
return isinstance(obj, class_or_tuple)
|
| 167 |
+
except Exception:
|
| 168 |
+
return False
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def install(
|
| 172 |
+
console: Optional["Console"] = None,
|
| 173 |
+
overflow: "OverflowMethod" = "ignore",
|
| 174 |
+
crop: bool = False,
|
| 175 |
+
indent_guides: bool = False,
|
| 176 |
+
max_length: Optional[int] = None,
|
| 177 |
+
max_string: Optional[int] = None,
|
| 178 |
+
max_depth: Optional[int] = None,
|
| 179 |
+
expand_all: bool = False,
|
| 180 |
+
) -> None:
|
| 181 |
+
"""Install automatic pretty printing in the Python REPL.
|
| 182 |
+
|
| 183 |
+
Args:
|
| 184 |
+
console (Console, optional): Console instance or ``None`` to use global console. Defaults to None.
|
| 185 |
+
overflow (Optional[OverflowMethod], optional): Overflow method. Defaults to "ignore".
|
| 186 |
+
crop (Optional[bool], optional): Enable cropping of long lines. Defaults to False.
|
| 187 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 188 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 189 |
+
Defaults to None.
|
| 190 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 191 |
+
max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
|
| 192 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 193 |
+
max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.
|
| 194 |
+
"""
|
| 195 |
+
from pip._vendor.rich import get_console
|
| 196 |
+
|
| 197 |
+
console = console or get_console()
|
| 198 |
+
assert console is not None
|
| 199 |
+
|
| 200 |
+
def display_hook(value: Any) -> None:
|
| 201 |
+
"""Replacement sys.displayhook which prettifies objects with Rich."""
|
| 202 |
+
if value is not None:
|
| 203 |
+
assert console is not None
|
| 204 |
+
builtins._ = None # type: ignore[attr-defined]
|
| 205 |
+
console.print(
|
| 206 |
+
(
|
| 207 |
+
value
|
| 208 |
+
if _safe_isinstance(value, RichRenderable)
|
| 209 |
+
else Pretty(
|
| 210 |
+
value,
|
| 211 |
+
overflow=overflow,
|
| 212 |
+
indent_guides=indent_guides,
|
| 213 |
+
max_length=max_length,
|
| 214 |
+
max_string=max_string,
|
| 215 |
+
max_depth=max_depth,
|
| 216 |
+
expand_all=expand_all,
|
| 217 |
+
)
|
| 218 |
+
),
|
| 219 |
+
crop=crop,
|
| 220 |
+
)
|
| 221 |
+
builtins._ = value # type: ignore[attr-defined]
|
| 222 |
+
|
| 223 |
+
try:
|
| 224 |
+
ip = get_ipython() # type: ignore[name-defined]
|
| 225 |
+
except NameError:
|
| 226 |
+
sys.displayhook = display_hook
|
| 227 |
+
else:
|
| 228 |
+
from IPython.core.formatters import BaseFormatter
|
| 229 |
+
|
| 230 |
+
class RichFormatter(BaseFormatter): # type: ignore[misc]
|
| 231 |
+
pprint: bool = True
|
| 232 |
+
|
| 233 |
+
def __call__(self, value: Any) -> Any:
|
| 234 |
+
if self.pprint:
|
| 235 |
+
return _ipy_display_hook(
|
| 236 |
+
value,
|
| 237 |
+
console=get_console(),
|
| 238 |
+
overflow=overflow,
|
| 239 |
+
indent_guides=indent_guides,
|
| 240 |
+
max_length=max_length,
|
| 241 |
+
max_string=max_string,
|
| 242 |
+
max_depth=max_depth,
|
| 243 |
+
expand_all=expand_all,
|
| 244 |
+
)
|
| 245 |
+
else:
|
| 246 |
+
return repr(value)
|
| 247 |
+
|
| 248 |
+
# replace plain text formatter with rich formatter
|
| 249 |
+
rich_formatter = RichFormatter()
|
| 250 |
+
ip.display_formatter.formatters["text/plain"] = rich_formatter
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
class Pretty(JupyterMixin):
|
| 254 |
+
"""A rich renderable that pretty prints an object.
|
| 255 |
+
|
| 256 |
+
Args:
|
| 257 |
+
_object (Any): An object to pretty print.
|
| 258 |
+
highlighter (HighlighterType, optional): Highlighter object to apply to result, or None for ReprHighlighter. Defaults to None.
|
| 259 |
+
indent_size (int, optional): Number of spaces in indent. Defaults to 4.
|
| 260 |
+
justify (JustifyMethod, optional): Justify method, or None for default. Defaults to None.
|
| 261 |
+
overflow (OverflowMethod, optional): Overflow method, or None for default. Defaults to None.
|
| 262 |
+
no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to False.
|
| 263 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 264 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 265 |
+
Defaults to None.
|
| 266 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 267 |
+
max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
|
| 268 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 269 |
+
margin (int, optional): Subtrace a margin from width to force containers to expand earlier. Defaults to 0.
|
| 270 |
+
insert_line (bool, optional): Insert a new line if the output has multiple new lines. Defaults to False.
|
| 271 |
+
"""
|
| 272 |
+
|
| 273 |
+
def __init__(
|
| 274 |
+
self,
|
| 275 |
+
_object: Any,
|
| 276 |
+
highlighter: Optional["HighlighterType"] = None,
|
| 277 |
+
*,
|
| 278 |
+
indent_size: int = 4,
|
| 279 |
+
justify: Optional["JustifyMethod"] = None,
|
| 280 |
+
overflow: Optional["OverflowMethod"] = None,
|
| 281 |
+
no_wrap: Optional[bool] = False,
|
| 282 |
+
indent_guides: bool = False,
|
| 283 |
+
max_length: Optional[int] = None,
|
| 284 |
+
max_string: Optional[int] = None,
|
| 285 |
+
max_depth: Optional[int] = None,
|
| 286 |
+
expand_all: bool = False,
|
| 287 |
+
margin: int = 0,
|
| 288 |
+
insert_line: bool = False,
|
| 289 |
+
) -> None:
|
| 290 |
+
self._object = _object
|
| 291 |
+
self.highlighter = highlighter or ReprHighlighter()
|
| 292 |
+
self.indent_size = indent_size
|
| 293 |
+
self.justify: Optional["JustifyMethod"] = justify
|
| 294 |
+
self.overflow: Optional["OverflowMethod"] = overflow
|
| 295 |
+
self.no_wrap = no_wrap
|
| 296 |
+
self.indent_guides = indent_guides
|
| 297 |
+
self.max_length = max_length
|
| 298 |
+
self.max_string = max_string
|
| 299 |
+
self.max_depth = max_depth
|
| 300 |
+
self.expand_all = expand_all
|
| 301 |
+
self.margin = margin
|
| 302 |
+
self.insert_line = insert_line
|
| 303 |
+
|
| 304 |
+
def __rich_console__(
|
| 305 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 306 |
+
) -> "RenderResult":
|
| 307 |
+
pretty_str = pretty_repr(
|
| 308 |
+
self._object,
|
| 309 |
+
max_width=options.max_width - self.margin,
|
| 310 |
+
indent_size=self.indent_size,
|
| 311 |
+
max_length=self.max_length,
|
| 312 |
+
max_string=self.max_string,
|
| 313 |
+
max_depth=self.max_depth,
|
| 314 |
+
expand_all=self.expand_all,
|
| 315 |
+
)
|
| 316 |
+
pretty_text = Text.from_ansi(
|
| 317 |
+
pretty_str,
|
| 318 |
+
justify=self.justify or options.justify,
|
| 319 |
+
overflow=self.overflow or options.overflow,
|
| 320 |
+
no_wrap=pick_bool(self.no_wrap, options.no_wrap),
|
| 321 |
+
style="pretty",
|
| 322 |
+
)
|
| 323 |
+
pretty_text = (
|
| 324 |
+
self.highlighter(pretty_text)
|
| 325 |
+
if pretty_text
|
| 326 |
+
else Text(
|
| 327 |
+
f"{type(self._object)}.__repr__ returned empty string",
|
| 328 |
+
style="dim italic",
|
| 329 |
+
)
|
| 330 |
+
)
|
| 331 |
+
if self.indent_guides and not options.ascii_only:
|
| 332 |
+
pretty_text = pretty_text.with_indent_guides(
|
| 333 |
+
self.indent_size, style="repr.indent"
|
| 334 |
+
)
|
| 335 |
+
if self.insert_line and "\n" in pretty_text:
|
| 336 |
+
yield ""
|
| 337 |
+
yield pretty_text
|
| 338 |
+
|
| 339 |
+
def __rich_measure__(
|
| 340 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 341 |
+
) -> "Measurement":
|
| 342 |
+
pretty_str = pretty_repr(
|
| 343 |
+
self._object,
|
| 344 |
+
max_width=options.max_width,
|
| 345 |
+
indent_size=self.indent_size,
|
| 346 |
+
max_length=self.max_length,
|
| 347 |
+
max_string=self.max_string,
|
| 348 |
+
max_depth=self.max_depth,
|
| 349 |
+
expand_all=self.expand_all,
|
| 350 |
+
)
|
| 351 |
+
text_width = (
|
| 352 |
+
max(cell_len(line) for line in pretty_str.splitlines()) if pretty_str else 0
|
| 353 |
+
)
|
| 354 |
+
return Measurement(text_width, text_width)
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def _get_braces_for_defaultdict(_object: DefaultDict[Any, Any]) -> Tuple[str, str, str]:
|
| 358 |
+
return (
|
| 359 |
+
f"defaultdict({_object.default_factory!r}, {{",
|
| 360 |
+
"})",
|
| 361 |
+
f"defaultdict({_object.default_factory!r}, {{}})",
|
| 362 |
+
)
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
def _get_braces_for_deque(_object: Deque[Any]) -> Tuple[str, str, str]:
|
| 366 |
+
if _object.maxlen is None:
|
| 367 |
+
return ("deque([", "])", "deque()")
|
| 368 |
+
return (
|
| 369 |
+
"deque([",
|
| 370 |
+
f"], maxlen={_object.maxlen})",
|
| 371 |
+
f"deque(maxlen={_object.maxlen})",
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
def _get_braces_for_array(_object: "array[Any]") -> Tuple[str, str, str]:
|
| 376 |
+
return (f"array({_object.typecode!r}, [", "])", f"array({_object.typecode!r})")
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
_BRACES: Dict[type, Callable[[Any], Tuple[str, str, str]]] = {
|
| 380 |
+
os._Environ: lambda _object: ("environ({", "})", "environ({})"),
|
| 381 |
+
array: _get_braces_for_array,
|
| 382 |
+
defaultdict: _get_braces_for_defaultdict,
|
| 383 |
+
Counter: lambda _object: ("Counter({", "})", "Counter()"),
|
| 384 |
+
deque: _get_braces_for_deque,
|
| 385 |
+
dict: lambda _object: ("{", "}", "{}"),
|
| 386 |
+
UserDict: lambda _object: ("{", "}", "{}"),
|
| 387 |
+
frozenset: lambda _object: ("frozenset({", "})", "frozenset()"),
|
| 388 |
+
list: lambda _object: ("[", "]", "[]"),
|
| 389 |
+
UserList: lambda _object: ("[", "]", "[]"),
|
| 390 |
+
set: lambda _object: ("{", "}", "set()"),
|
| 391 |
+
tuple: lambda _object: ("(", ")", "()"),
|
| 392 |
+
MappingProxyType: lambda _object: ("mappingproxy({", "})", "mappingproxy({})"),
|
| 393 |
+
}
|
| 394 |
+
_CONTAINERS = tuple(_BRACES.keys())
|
| 395 |
+
_MAPPING_CONTAINERS = (dict, os._Environ, MappingProxyType, UserDict)
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
def is_expandable(obj: Any) -> bool:
|
| 399 |
+
"""Check if an object may be expanded by pretty print."""
|
| 400 |
+
return (
|
| 401 |
+
_safe_isinstance(obj, _CONTAINERS)
|
| 402 |
+
or (is_dataclass(obj))
|
| 403 |
+
or (hasattr(obj, "__rich_repr__"))
|
| 404 |
+
or _is_attr_object(obj)
|
| 405 |
+
) and not isclass(obj)
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
@dataclass
|
| 409 |
+
class Node:
|
| 410 |
+
"""A node in a repr tree. May be atomic or a container."""
|
| 411 |
+
|
| 412 |
+
key_repr: str = ""
|
| 413 |
+
value_repr: str = ""
|
| 414 |
+
open_brace: str = ""
|
| 415 |
+
close_brace: str = ""
|
| 416 |
+
empty: str = ""
|
| 417 |
+
last: bool = False
|
| 418 |
+
is_tuple: bool = False
|
| 419 |
+
is_namedtuple: bool = False
|
| 420 |
+
children: Optional[List["Node"]] = None
|
| 421 |
+
key_separator: str = ": "
|
| 422 |
+
separator: str = ", "
|
| 423 |
+
|
| 424 |
+
def iter_tokens(self) -> Iterable[str]:
|
| 425 |
+
"""Generate tokens for this node."""
|
| 426 |
+
if self.key_repr:
|
| 427 |
+
yield self.key_repr
|
| 428 |
+
yield self.key_separator
|
| 429 |
+
if self.value_repr:
|
| 430 |
+
yield self.value_repr
|
| 431 |
+
elif self.children is not None:
|
| 432 |
+
if self.children:
|
| 433 |
+
yield self.open_brace
|
| 434 |
+
if self.is_tuple and not self.is_namedtuple and len(self.children) == 1:
|
| 435 |
+
yield from self.children[0].iter_tokens()
|
| 436 |
+
yield ","
|
| 437 |
+
else:
|
| 438 |
+
for child in self.children:
|
| 439 |
+
yield from child.iter_tokens()
|
| 440 |
+
if not child.last:
|
| 441 |
+
yield self.separator
|
| 442 |
+
yield self.close_brace
|
| 443 |
+
else:
|
| 444 |
+
yield self.empty
|
| 445 |
+
|
| 446 |
+
def check_length(self, start_length: int, max_length: int) -> bool:
|
| 447 |
+
"""Check the length fits within a limit.
|
| 448 |
+
|
| 449 |
+
Args:
|
| 450 |
+
start_length (int): Starting length of the line (indent, prefix, suffix).
|
| 451 |
+
max_length (int): Maximum length.
|
| 452 |
+
|
| 453 |
+
Returns:
|
| 454 |
+
bool: True if the node can be rendered within max length, otherwise False.
|
| 455 |
+
"""
|
| 456 |
+
total_length = start_length
|
| 457 |
+
for token in self.iter_tokens():
|
| 458 |
+
total_length += cell_len(token)
|
| 459 |
+
if total_length > max_length:
|
| 460 |
+
return False
|
| 461 |
+
return True
|
| 462 |
+
|
| 463 |
+
def __str__(self) -> str:
|
| 464 |
+
repr_text = "".join(self.iter_tokens())
|
| 465 |
+
return repr_text
|
| 466 |
+
|
| 467 |
+
def render(
|
| 468 |
+
self, max_width: int = 80, indent_size: int = 4, expand_all: bool = False
|
| 469 |
+
) -> str:
|
| 470 |
+
"""Render the node to a pretty repr.
|
| 471 |
+
|
| 472 |
+
Args:
|
| 473 |
+
max_width (int, optional): Maximum width of the repr. Defaults to 80.
|
| 474 |
+
indent_size (int, optional): Size of indents. Defaults to 4.
|
| 475 |
+
expand_all (bool, optional): Expand all levels. Defaults to False.
|
| 476 |
+
|
| 477 |
+
Returns:
|
| 478 |
+
str: A repr string of the original object.
|
| 479 |
+
"""
|
| 480 |
+
lines = [_Line(node=self, is_root=True)]
|
| 481 |
+
line_no = 0
|
| 482 |
+
while line_no < len(lines):
|
| 483 |
+
line = lines[line_no]
|
| 484 |
+
if line.expandable and not line.expanded:
|
| 485 |
+
if expand_all or not line.check_length(max_width):
|
| 486 |
+
lines[line_no : line_no + 1] = line.expand(indent_size)
|
| 487 |
+
line_no += 1
|
| 488 |
+
|
| 489 |
+
repr_str = "\n".join(str(line) for line in lines)
|
| 490 |
+
return repr_str
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
@dataclass
|
| 494 |
+
class _Line:
|
| 495 |
+
"""A line in repr output."""
|
| 496 |
+
|
| 497 |
+
parent: Optional["_Line"] = None
|
| 498 |
+
is_root: bool = False
|
| 499 |
+
node: Optional[Node] = None
|
| 500 |
+
text: str = ""
|
| 501 |
+
suffix: str = ""
|
| 502 |
+
whitespace: str = ""
|
| 503 |
+
expanded: bool = False
|
| 504 |
+
last: bool = False
|
| 505 |
+
|
| 506 |
+
@property
|
| 507 |
+
def expandable(self) -> bool:
|
| 508 |
+
"""Check if the line may be expanded."""
|
| 509 |
+
return bool(self.node is not None and self.node.children)
|
| 510 |
+
|
| 511 |
+
def check_length(self, max_length: int) -> bool:
|
| 512 |
+
"""Check this line fits within a given number of cells."""
|
| 513 |
+
start_length = (
|
| 514 |
+
len(self.whitespace) + cell_len(self.text) + cell_len(self.suffix)
|
| 515 |
+
)
|
| 516 |
+
assert self.node is not None
|
| 517 |
+
return self.node.check_length(start_length, max_length)
|
| 518 |
+
|
| 519 |
+
def expand(self, indent_size: int) -> Iterable["_Line"]:
|
| 520 |
+
"""Expand this line by adding children on their own line."""
|
| 521 |
+
node = self.node
|
| 522 |
+
assert node is not None
|
| 523 |
+
whitespace = self.whitespace
|
| 524 |
+
assert node.children
|
| 525 |
+
if node.key_repr:
|
| 526 |
+
new_line = yield _Line(
|
| 527 |
+
text=f"{node.key_repr}{node.key_separator}{node.open_brace}",
|
| 528 |
+
whitespace=whitespace,
|
| 529 |
+
)
|
| 530 |
+
else:
|
| 531 |
+
new_line = yield _Line(text=node.open_brace, whitespace=whitespace)
|
| 532 |
+
child_whitespace = self.whitespace + " " * indent_size
|
| 533 |
+
tuple_of_one = node.is_tuple and len(node.children) == 1
|
| 534 |
+
for last, child in loop_last(node.children):
|
| 535 |
+
separator = "," if tuple_of_one else node.separator
|
| 536 |
+
line = _Line(
|
| 537 |
+
parent=new_line,
|
| 538 |
+
node=child,
|
| 539 |
+
whitespace=child_whitespace,
|
| 540 |
+
suffix=separator,
|
| 541 |
+
last=last and not tuple_of_one,
|
| 542 |
+
)
|
| 543 |
+
yield line
|
| 544 |
+
|
| 545 |
+
yield _Line(
|
| 546 |
+
text=node.close_brace,
|
| 547 |
+
whitespace=whitespace,
|
| 548 |
+
suffix=self.suffix,
|
| 549 |
+
last=self.last,
|
| 550 |
+
)
|
| 551 |
+
|
| 552 |
+
def __str__(self) -> str:
|
| 553 |
+
if self.last:
|
| 554 |
+
return f"{self.whitespace}{self.text}{self.node or ''}"
|
| 555 |
+
else:
|
| 556 |
+
return (
|
| 557 |
+
f"{self.whitespace}{self.text}{self.node or ''}{self.suffix.rstrip()}"
|
| 558 |
+
)
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
def _is_namedtuple(obj: Any) -> bool:
|
| 562 |
+
"""Checks if an object is most likely a namedtuple. It is possible
|
| 563 |
+
to craft an object that passes this check and isn't a namedtuple, but
|
| 564 |
+
there is only a minuscule chance of this happening unintentionally.
|
| 565 |
+
|
| 566 |
+
Args:
|
| 567 |
+
obj (Any): The object to test
|
| 568 |
+
|
| 569 |
+
Returns:
|
| 570 |
+
bool: True if the object is a namedtuple. False otherwise.
|
| 571 |
+
"""
|
| 572 |
+
try:
|
| 573 |
+
fields = getattr(obj, "_fields", None)
|
| 574 |
+
except Exception:
|
| 575 |
+
# Being very defensive - if we cannot get the attr then its not a namedtuple
|
| 576 |
+
return False
|
| 577 |
+
return isinstance(obj, tuple) and isinstance(fields, tuple)
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
def traverse(
|
| 581 |
+
_object: Any,
|
| 582 |
+
max_length: Optional[int] = None,
|
| 583 |
+
max_string: Optional[int] = None,
|
| 584 |
+
max_depth: Optional[int] = None,
|
| 585 |
+
) -> Node:
|
| 586 |
+
"""Traverse object and generate a tree.
|
| 587 |
+
|
| 588 |
+
Args:
|
| 589 |
+
_object (Any): Object to be traversed.
|
| 590 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 591 |
+
Defaults to None.
|
| 592 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
|
| 593 |
+
Defaults to None.
|
| 594 |
+
max_depth (int, optional): Maximum depth of data structures, or None for no maximum.
|
| 595 |
+
Defaults to None.
|
| 596 |
+
|
| 597 |
+
Returns:
|
| 598 |
+
Node: The root of a tree structure which can be used to render a pretty repr.
|
| 599 |
+
"""
|
| 600 |
+
|
| 601 |
+
def to_repr(obj: Any) -> str:
|
| 602 |
+
"""Get repr string for an object, but catch errors."""
|
| 603 |
+
if (
|
| 604 |
+
max_string is not None
|
| 605 |
+
and _safe_isinstance(obj, (bytes, str))
|
| 606 |
+
and len(obj) > max_string
|
| 607 |
+
):
|
| 608 |
+
truncated = len(obj) - max_string
|
| 609 |
+
obj_repr = f"{obj[:max_string]!r}+{truncated}"
|
| 610 |
+
else:
|
| 611 |
+
try:
|
| 612 |
+
obj_repr = repr(obj)
|
| 613 |
+
except Exception as error:
|
| 614 |
+
obj_repr = f"<repr-error {str(error)!r}>"
|
| 615 |
+
return obj_repr
|
| 616 |
+
|
| 617 |
+
visited_ids: Set[int] = set()
|
| 618 |
+
push_visited = visited_ids.add
|
| 619 |
+
pop_visited = visited_ids.remove
|
| 620 |
+
|
| 621 |
+
def _traverse(obj: Any, root: bool = False, depth: int = 0) -> Node:
|
| 622 |
+
"""Walk the object depth first."""
|
| 623 |
+
|
| 624 |
+
obj_id = id(obj)
|
| 625 |
+
if obj_id in visited_ids:
|
| 626 |
+
# Recursion detected
|
| 627 |
+
return Node(value_repr="...")
|
| 628 |
+
|
| 629 |
+
obj_type = type(obj)
|
| 630 |
+
children: List[Node]
|
| 631 |
+
reached_max_depth = max_depth is not None and depth >= max_depth
|
| 632 |
+
|
| 633 |
+
def iter_rich_args(rich_args: Any) -> Iterable[Union[Any, Tuple[str, Any]]]:
|
| 634 |
+
for arg in rich_args:
|
| 635 |
+
if _safe_isinstance(arg, tuple):
|
| 636 |
+
if len(arg) == 3:
|
| 637 |
+
key, child, default = arg
|
| 638 |
+
if default == child:
|
| 639 |
+
continue
|
| 640 |
+
yield key, child
|
| 641 |
+
elif len(arg) == 2:
|
| 642 |
+
key, child = arg
|
| 643 |
+
yield key, child
|
| 644 |
+
elif len(arg) == 1:
|
| 645 |
+
yield arg[0]
|
| 646 |
+
else:
|
| 647 |
+
yield arg
|
| 648 |
+
|
| 649 |
+
try:
|
| 650 |
+
fake_attributes = hasattr(
|
| 651 |
+
obj, "awehoi234_wdfjwljet234_234wdfoijsdfmmnxpi492"
|
| 652 |
+
)
|
| 653 |
+
except Exception:
|
| 654 |
+
fake_attributes = False
|
| 655 |
+
|
| 656 |
+
rich_repr_result: Optional[RichReprResult] = None
|
| 657 |
+
if not fake_attributes:
|
| 658 |
+
try:
|
| 659 |
+
if hasattr(obj, "__rich_repr__") and not isclass(obj):
|
| 660 |
+
rich_repr_result = obj.__rich_repr__()
|
| 661 |
+
except Exception:
|
| 662 |
+
pass
|
| 663 |
+
|
| 664 |
+
if rich_repr_result is not None:
|
| 665 |
+
push_visited(obj_id)
|
| 666 |
+
angular = getattr(obj.__rich_repr__, "angular", False)
|
| 667 |
+
args = list(iter_rich_args(rich_repr_result))
|
| 668 |
+
class_name = obj.__class__.__name__
|
| 669 |
+
|
| 670 |
+
if args:
|
| 671 |
+
children = []
|
| 672 |
+
append = children.append
|
| 673 |
+
|
| 674 |
+
if reached_max_depth:
|
| 675 |
+
if angular:
|
| 676 |
+
node = Node(value_repr=f"<{class_name}...>")
|
| 677 |
+
else:
|
| 678 |
+
node = Node(value_repr=f"{class_name}(...)")
|
| 679 |
+
else:
|
| 680 |
+
if angular:
|
| 681 |
+
node = Node(
|
| 682 |
+
open_brace=f"<{class_name} ",
|
| 683 |
+
close_brace=">",
|
| 684 |
+
children=children,
|
| 685 |
+
last=root,
|
| 686 |
+
separator=" ",
|
| 687 |
+
)
|
| 688 |
+
else:
|
| 689 |
+
node = Node(
|
| 690 |
+
open_brace=f"{class_name}(",
|
| 691 |
+
close_brace=")",
|
| 692 |
+
children=children,
|
| 693 |
+
last=root,
|
| 694 |
+
)
|
| 695 |
+
for last, arg in loop_last(args):
|
| 696 |
+
if _safe_isinstance(arg, tuple):
|
| 697 |
+
key, child = arg
|
| 698 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 699 |
+
child_node.last = last
|
| 700 |
+
child_node.key_repr = key
|
| 701 |
+
child_node.key_separator = "="
|
| 702 |
+
append(child_node)
|
| 703 |
+
else:
|
| 704 |
+
child_node = _traverse(arg, depth=depth + 1)
|
| 705 |
+
child_node.last = last
|
| 706 |
+
append(child_node)
|
| 707 |
+
else:
|
| 708 |
+
node = Node(
|
| 709 |
+
value_repr=f"<{class_name}>" if angular else f"{class_name}()",
|
| 710 |
+
children=[],
|
| 711 |
+
last=root,
|
| 712 |
+
)
|
| 713 |
+
pop_visited(obj_id)
|
| 714 |
+
elif _is_attr_object(obj) and not fake_attributes:
|
| 715 |
+
push_visited(obj_id)
|
| 716 |
+
children = []
|
| 717 |
+
append = children.append
|
| 718 |
+
|
| 719 |
+
attr_fields = _get_attr_fields(obj)
|
| 720 |
+
if attr_fields:
|
| 721 |
+
if reached_max_depth:
|
| 722 |
+
node = Node(value_repr=f"{obj.__class__.__name__}(...)")
|
| 723 |
+
else:
|
| 724 |
+
node = Node(
|
| 725 |
+
open_brace=f"{obj.__class__.__name__}(",
|
| 726 |
+
close_brace=")",
|
| 727 |
+
children=children,
|
| 728 |
+
last=root,
|
| 729 |
+
)
|
| 730 |
+
|
| 731 |
+
def iter_attrs() -> (
|
| 732 |
+
Iterable[Tuple[str, Any, Optional[Callable[[Any], str]]]]
|
| 733 |
+
):
|
| 734 |
+
"""Iterate over attr fields and values."""
|
| 735 |
+
for attr in attr_fields:
|
| 736 |
+
if attr.repr:
|
| 737 |
+
try:
|
| 738 |
+
value = getattr(obj, attr.name)
|
| 739 |
+
except Exception as error:
|
| 740 |
+
# Can happen, albeit rarely
|
| 741 |
+
yield (attr.name, error, None)
|
| 742 |
+
else:
|
| 743 |
+
yield (
|
| 744 |
+
attr.name,
|
| 745 |
+
value,
|
| 746 |
+
attr.repr if callable(attr.repr) else None,
|
| 747 |
+
)
|
| 748 |
+
|
| 749 |
+
for last, (name, value, repr_callable) in loop_last(iter_attrs()):
|
| 750 |
+
if repr_callable:
|
| 751 |
+
child_node = Node(value_repr=str(repr_callable(value)))
|
| 752 |
+
else:
|
| 753 |
+
child_node = _traverse(value, depth=depth + 1)
|
| 754 |
+
child_node.last = last
|
| 755 |
+
child_node.key_repr = name
|
| 756 |
+
child_node.key_separator = "="
|
| 757 |
+
append(child_node)
|
| 758 |
+
else:
|
| 759 |
+
node = Node(
|
| 760 |
+
value_repr=f"{obj.__class__.__name__}()", children=[], last=root
|
| 761 |
+
)
|
| 762 |
+
pop_visited(obj_id)
|
| 763 |
+
elif (
|
| 764 |
+
is_dataclass(obj)
|
| 765 |
+
and not _safe_isinstance(obj, type)
|
| 766 |
+
and not fake_attributes
|
| 767 |
+
and _is_dataclass_repr(obj)
|
| 768 |
+
):
|
| 769 |
+
push_visited(obj_id)
|
| 770 |
+
children = []
|
| 771 |
+
append = children.append
|
| 772 |
+
if reached_max_depth:
|
| 773 |
+
node = Node(value_repr=f"{obj.__class__.__name__}(...)")
|
| 774 |
+
else:
|
| 775 |
+
node = Node(
|
| 776 |
+
open_brace=f"{obj.__class__.__name__}(",
|
| 777 |
+
close_brace=")",
|
| 778 |
+
children=children,
|
| 779 |
+
last=root,
|
| 780 |
+
empty=f"{obj.__class__.__name__}()",
|
| 781 |
+
)
|
| 782 |
+
|
| 783 |
+
for last, field in loop_last(
|
| 784 |
+
field
|
| 785 |
+
for field in fields(obj)
|
| 786 |
+
if field.repr and hasattr(obj, field.name)
|
| 787 |
+
):
|
| 788 |
+
child_node = _traverse(getattr(obj, field.name), depth=depth + 1)
|
| 789 |
+
child_node.key_repr = field.name
|
| 790 |
+
child_node.last = last
|
| 791 |
+
child_node.key_separator = "="
|
| 792 |
+
append(child_node)
|
| 793 |
+
|
| 794 |
+
pop_visited(obj_id)
|
| 795 |
+
elif _is_namedtuple(obj) and _has_default_namedtuple_repr(obj):
|
| 796 |
+
push_visited(obj_id)
|
| 797 |
+
class_name = obj.__class__.__name__
|
| 798 |
+
if reached_max_depth:
|
| 799 |
+
# If we've reached the max depth, we still show the class name, but not its contents
|
| 800 |
+
node = Node(
|
| 801 |
+
value_repr=f"{class_name}(...)",
|
| 802 |
+
)
|
| 803 |
+
else:
|
| 804 |
+
children = []
|
| 805 |
+
append = children.append
|
| 806 |
+
node = Node(
|
| 807 |
+
open_brace=f"{class_name}(",
|
| 808 |
+
close_brace=")",
|
| 809 |
+
children=children,
|
| 810 |
+
empty=f"{class_name}()",
|
| 811 |
+
)
|
| 812 |
+
for last, (key, value) in loop_last(obj._asdict().items()):
|
| 813 |
+
child_node = _traverse(value, depth=depth + 1)
|
| 814 |
+
child_node.key_repr = key
|
| 815 |
+
child_node.last = last
|
| 816 |
+
child_node.key_separator = "="
|
| 817 |
+
append(child_node)
|
| 818 |
+
pop_visited(obj_id)
|
| 819 |
+
elif _safe_isinstance(obj, _CONTAINERS):
|
| 820 |
+
for container_type in _CONTAINERS:
|
| 821 |
+
if _safe_isinstance(obj, container_type):
|
| 822 |
+
obj_type = container_type
|
| 823 |
+
break
|
| 824 |
+
|
| 825 |
+
push_visited(obj_id)
|
| 826 |
+
|
| 827 |
+
open_brace, close_brace, empty = _BRACES[obj_type](obj)
|
| 828 |
+
|
| 829 |
+
if reached_max_depth:
|
| 830 |
+
node = Node(value_repr=f"{open_brace}...{close_brace}")
|
| 831 |
+
elif obj_type.__repr__ != type(obj).__repr__:
|
| 832 |
+
node = Node(value_repr=to_repr(obj), last=root)
|
| 833 |
+
elif obj:
|
| 834 |
+
children = []
|
| 835 |
+
node = Node(
|
| 836 |
+
open_brace=open_brace,
|
| 837 |
+
close_brace=close_brace,
|
| 838 |
+
children=children,
|
| 839 |
+
last=root,
|
| 840 |
+
)
|
| 841 |
+
append = children.append
|
| 842 |
+
num_items = len(obj)
|
| 843 |
+
last_item_index = num_items - 1
|
| 844 |
+
|
| 845 |
+
if _safe_isinstance(obj, _MAPPING_CONTAINERS):
|
| 846 |
+
iter_items = iter(obj.items())
|
| 847 |
+
if max_length is not None:
|
| 848 |
+
iter_items = islice(iter_items, max_length)
|
| 849 |
+
for index, (key, child) in enumerate(iter_items):
|
| 850 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 851 |
+
child_node.key_repr = to_repr(key)
|
| 852 |
+
child_node.last = index == last_item_index
|
| 853 |
+
append(child_node)
|
| 854 |
+
else:
|
| 855 |
+
iter_values = iter(obj)
|
| 856 |
+
if max_length is not None:
|
| 857 |
+
iter_values = islice(iter_values, max_length)
|
| 858 |
+
for index, child in enumerate(iter_values):
|
| 859 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 860 |
+
child_node.last = index == last_item_index
|
| 861 |
+
append(child_node)
|
| 862 |
+
if max_length is not None and num_items > max_length:
|
| 863 |
+
append(Node(value_repr=f"... +{num_items - max_length}", last=True))
|
| 864 |
+
else:
|
| 865 |
+
node = Node(empty=empty, children=[], last=root)
|
| 866 |
+
|
| 867 |
+
pop_visited(obj_id)
|
| 868 |
+
else:
|
| 869 |
+
node = Node(value_repr=to_repr(obj), last=root)
|
| 870 |
+
node.is_tuple = type(obj) == tuple
|
| 871 |
+
node.is_namedtuple = _is_namedtuple(obj)
|
| 872 |
+
return node
|
| 873 |
+
|
| 874 |
+
node = _traverse(_object, root=True)
|
| 875 |
+
return node
|
| 876 |
+
|
| 877 |
+
|
| 878 |
+
def pretty_repr(
|
| 879 |
+
_object: Any,
|
| 880 |
+
*,
|
| 881 |
+
max_width: int = 80,
|
| 882 |
+
indent_size: int = 4,
|
| 883 |
+
max_length: Optional[int] = None,
|
| 884 |
+
max_string: Optional[int] = None,
|
| 885 |
+
max_depth: Optional[int] = None,
|
| 886 |
+
expand_all: bool = False,
|
| 887 |
+
) -> str:
|
| 888 |
+
"""Prettify repr string by expanding on to new lines to fit within a given width.
|
| 889 |
+
|
| 890 |
+
Args:
|
| 891 |
+
_object (Any): Object to repr.
|
| 892 |
+
max_width (int, optional): Desired maximum width of repr string. Defaults to 80.
|
| 893 |
+
indent_size (int, optional): Number of spaces to indent. Defaults to 4.
|
| 894 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 895 |
+
Defaults to None.
|
| 896 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
|
| 897 |
+
Defaults to None.
|
| 898 |
+
max_depth (int, optional): Maximum depth of nested data structure, or None for no depth.
|
| 899 |
+
Defaults to None.
|
| 900 |
+
expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.
|
| 901 |
+
|
| 902 |
+
Returns:
|
| 903 |
+
str: A possibly multi-line representation of the object.
|
| 904 |
+
"""
|
| 905 |
+
|
| 906 |
+
if _safe_isinstance(_object, Node):
|
| 907 |
+
node = _object
|
| 908 |
+
else:
|
| 909 |
+
node = traverse(
|
| 910 |
+
_object, max_length=max_length, max_string=max_string, max_depth=max_depth
|
| 911 |
+
)
|
| 912 |
+
repr_str: str = node.render(
|
| 913 |
+
max_width=max_width, indent_size=indent_size, expand_all=expand_all
|
| 914 |
+
)
|
| 915 |
+
return repr_str
|
| 916 |
+
|
| 917 |
+
|
| 918 |
+
def pprint(
|
| 919 |
+
_object: Any,
|
| 920 |
+
*,
|
| 921 |
+
console: Optional["Console"] = None,
|
| 922 |
+
indent_guides: bool = True,
|
| 923 |
+
max_length: Optional[int] = None,
|
| 924 |
+
max_string: Optional[int] = None,
|
| 925 |
+
max_depth: Optional[int] = None,
|
| 926 |
+
expand_all: bool = False,
|
| 927 |
+
) -> None:
|
| 928 |
+
"""A convenience function for pretty printing.
|
| 929 |
+
|
| 930 |
+
Args:
|
| 931 |
+
_object (Any): Object to pretty print.
|
| 932 |
+
console (Console, optional): Console instance, or None to use default. Defaults to None.
|
| 933 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 934 |
+
Defaults to None.
|
| 935 |
+
max_string (int, optional): Maximum length of strings before truncating, or None to disable. Defaults to None.
|
| 936 |
+
max_depth (int, optional): Maximum depth for nested data structures, or None for unlimited depth. Defaults to None.
|
| 937 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to True.
|
| 938 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 939 |
+
"""
|
| 940 |
+
_console = get_console() if console is None else console
|
| 941 |
+
_console.print(
|
| 942 |
+
Pretty(
|
| 943 |
+
_object,
|
| 944 |
+
max_length=max_length,
|
| 945 |
+
max_string=max_string,
|
| 946 |
+
max_depth=max_depth,
|
| 947 |
+
indent_guides=indent_guides,
|
| 948 |
+
expand_all=expand_all,
|
| 949 |
+
overflow="ignore",
|
| 950 |
+
),
|
| 951 |
+
soft_wrap=True,
|
| 952 |
+
)
|
| 953 |
+
|
| 954 |
+
|
| 955 |
+
if __name__ == "__main__": # pragma: no cover
|
| 956 |
+
|
| 957 |
+
class BrokenRepr:
|
| 958 |
+
def __repr__(self) -> str:
|
| 959 |
+
1 / 0
|
| 960 |
+
return "this will fail"
|
| 961 |
+
|
| 962 |
+
from typing import NamedTuple
|
| 963 |
+
|
| 964 |
+
class StockKeepingUnit(NamedTuple):
|
| 965 |
+
name: str
|
| 966 |
+
description: str
|
| 967 |
+
price: float
|
| 968 |
+
category: str
|
| 969 |
+
reviews: List[str]
|
| 970 |
+
|
| 971 |
+
d = defaultdict(int)
|
| 972 |
+
d["foo"] = 5
|
| 973 |
+
data = {
|
| 974 |
+
"foo": [
|
| 975 |
+
1,
|
| 976 |
+
"Hello World!",
|
| 977 |
+
100.123,
|
| 978 |
+
323.232,
|
| 979 |
+
432324.0,
|
| 980 |
+
{5, 6, 7, (1, 2, 3, 4), 8},
|
| 981 |
+
],
|
| 982 |
+
"bar": frozenset({1, 2, 3}),
|
| 983 |
+
"defaultdict": defaultdict(
|
| 984 |
+
list, {"crumble": ["apple", "rhubarb", "butter", "sugar", "flour"]}
|
| 985 |
+
),
|
| 986 |
+
"counter": Counter(
|
| 987 |
+
[
|
| 988 |
+
"apple",
|
| 989 |
+
"orange",
|
| 990 |
+
"pear",
|
| 991 |
+
"kumquat",
|
| 992 |
+
"kumquat",
|
| 993 |
+
"durian" * 100,
|
| 994 |
+
]
|
| 995 |
+
),
|
| 996 |
+
"atomic": (False, True, None),
|
| 997 |
+
"namedtuple": StockKeepingUnit(
|
| 998 |
+
"Sparkling British Spring Water",
|
| 999 |
+
"Carbonated spring water",
|
| 1000 |
+
0.9,
|
| 1001 |
+
"water",
|
| 1002 |
+
["its amazing!", "its terrible!"],
|
| 1003 |
+
),
|
| 1004 |
+
"Broken": BrokenRepr(),
|
| 1005 |
+
}
|
| 1006 |
+
data["foo"].append(data) # type: ignore[attr-defined]
|
| 1007 |
+
|
| 1008 |
+
from pip._vendor.rich import print
|
| 1009 |
+
|
| 1010 |
+
print(Pretty(data, indent_guides=True, max_string=20))
|
| 1011 |
+
|
| 1012 |
+
class Thing:
|
| 1013 |
+
def __repr__(self) -> str:
|
| 1014 |
+
return "Hello\x1b[38;5;239m World!"
|
| 1015 |
+
|
| 1016 |
+
print(Pretty(Thing()))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/progress.py
ADDED
|
@@ -0,0 +1,1715 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
import sys
|
| 3 |
+
import typing
|
| 4 |
+
import warnings
|
| 5 |
+
from abc import ABC, abstractmethod
|
| 6 |
+
from collections import deque
|
| 7 |
+
from dataclasses import dataclass, field
|
| 8 |
+
from datetime import timedelta
|
| 9 |
+
from io import RawIOBase, UnsupportedOperation
|
| 10 |
+
from math import ceil
|
| 11 |
+
from mmap import mmap
|
| 12 |
+
from operator import length_hint
|
| 13 |
+
from os import PathLike, stat
|
| 14 |
+
from threading import Event, RLock, Thread
|
| 15 |
+
from types import TracebackType
|
| 16 |
+
from typing import (
|
| 17 |
+
Any,
|
| 18 |
+
BinaryIO,
|
| 19 |
+
Callable,
|
| 20 |
+
ContextManager,
|
| 21 |
+
Deque,
|
| 22 |
+
Dict,
|
| 23 |
+
Generic,
|
| 24 |
+
Iterable,
|
| 25 |
+
List,
|
| 26 |
+
NamedTuple,
|
| 27 |
+
NewType,
|
| 28 |
+
Optional,
|
| 29 |
+
Sequence,
|
| 30 |
+
TextIO,
|
| 31 |
+
Tuple,
|
| 32 |
+
Type,
|
| 33 |
+
TypeVar,
|
| 34 |
+
Union,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
if sys.version_info >= (3, 8):
|
| 38 |
+
from typing import Literal
|
| 39 |
+
else:
|
| 40 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 41 |
+
|
| 42 |
+
if sys.version_info >= (3, 11):
|
| 43 |
+
from typing import Self
|
| 44 |
+
else:
|
| 45 |
+
from pip._vendor.typing_extensions import Self # pragma: no cover
|
| 46 |
+
|
| 47 |
+
from . import filesize, get_console
|
| 48 |
+
from .console import Console, Group, JustifyMethod, RenderableType
|
| 49 |
+
from .highlighter import Highlighter
|
| 50 |
+
from .jupyter import JupyterMixin
|
| 51 |
+
from .live import Live
|
| 52 |
+
from .progress_bar import ProgressBar
|
| 53 |
+
from .spinner import Spinner
|
| 54 |
+
from .style import StyleType
|
| 55 |
+
from .table import Column, Table
|
| 56 |
+
from .text import Text, TextType
|
| 57 |
+
|
| 58 |
+
TaskID = NewType("TaskID", int)
|
| 59 |
+
|
| 60 |
+
ProgressType = TypeVar("ProgressType")
|
| 61 |
+
|
| 62 |
+
GetTimeCallable = Callable[[], float]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
_I = typing.TypeVar("_I", TextIO, BinaryIO)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class _TrackThread(Thread):
|
| 69 |
+
"""A thread to periodically update progress."""
|
| 70 |
+
|
| 71 |
+
def __init__(self, progress: "Progress", task_id: "TaskID", update_period: float):
|
| 72 |
+
self.progress = progress
|
| 73 |
+
self.task_id = task_id
|
| 74 |
+
self.update_period = update_period
|
| 75 |
+
self.done = Event()
|
| 76 |
+
|
| 77 |
+
self.completed = 0
|
| 78 |
+
super().__init__(daemon=True)
|
| 79 |
+
|
| 80 |
+
def run(self) -> None:
|
| 81 |
+
task_id = self.task_id
|
| 82 |
+
advance = self.progress.advance
|
| 83 |
+
update_period = self.update_period
|
| 84 |
+
last_completed = 0
|
| 85 |
+
wait = self.done.wait
|
| 86 |
+
while not wait(update_period) and self.progress.live.is_started:
|
| 87 |
+
completed = self.completed
|
| 88 |
+
if last_completed != completed:
|
| 89 |
+
advance(task_id, completed - last_completed)
|
| 90 |
+
last_completed = completed
|
| 91 |
+
|
| 92 |
+
self.progress.update(self.task_id, completed=self.completed, refresh=True)
|
| 93 |
+
|
| 94 |
+
def __enter__(self) -> "_TrackThread":
|
| 95 |
+
self.start()
|
| 96 |
+
return self
|
| 97 |
+
|
| 98 |
+
def __exit__(
|
| 99 |
+
self,
|
| 100 |
+
exc_type: Optional[Type[BaseException]],
|
| 101 |
+
exc_val: Optional[BaseException],
|
| 102 |
+
exc_tb: Optional[TracebackType],
|
| 103 |
+
) -> None:
|
| 104 |
+
self.done.set()
|
| 105 |
+
self.join()
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def track(
|
| 109 |
+
sequence: Union[Sequence[ProgressType], Iterable[ProgressType]],
|
| 110 |
+
description: str = "Working...",
|
| 111 |
+
total: Optional[float] = None,
|
| 112 |
+
completed: int = 0,
|
| 113 |
+
auto_refresh: bool = True,
|
| 114 |
+
console: Optional[Console] = None,
|
| 115 |
+
transient: bool = False,
|
| 116 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 117 |
+
refresh_per_second: float = 10,
|
| 118 |
+
style: StyleType = "bar.back",
|
| 119 |
+
complete_style: StyleType = "bar.complete",
|
| 120 |
+
finished_style: StyleType = "bar.finished",
|
| 121 |
+
pulse_style: StyleType = "bar.pulse",
|
| 122 |
+
update_period: float = 0.1,
|
| 123 |
+
disable: bool = False,
|
| 124 |
+
show_speed: bool = True,
|
| 125 |
+
) -> Iterable[ProgressType]:
|
| 126 |
+
"""Track progress by iterating over a sequence.
|
| 127 |
+
|
| 128 |
+
Args:
|
| 129 |
+
sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
|
| 130 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Working".
|
| 131 |
+
total: (float, optional): Total number of steps. Default is len(sequence).
|
| 132 |
+
completed (int, optional): Number of steps completed so far. Defaults to 0.
|
| 133 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 134 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 135 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 136 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 137 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 138 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 139 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 140 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 141 |
+
update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
|
| 142 |
+
disable (bool, optional): Disable display of progress.
|
| 143 |
+
show_speed (bool, optional): Show speed if total isn't known. Defaults to True.
|
| 144 |
+
Returns:
|
| 145 |
+
Iterable[ProgressType]: An iterable of the values in the sequence.
|
| 146 |
+
|
| 147 |
+
"""
|
| 148 |
+
|
| 149 |
+
columns: List["ProgressColumn"] = (
|
| 150 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 151 |
+
)
|
| 152 |
+
columns.extend(
|
| 153 |
+
(
|
| 154 |
+
BarColumn(
|
| 155 |
+
style=style,
|
| 156 |
+
complete_style=complete_style,
|
| 157 |
+
finished_style=finished_style,
|
| 158 |
+
pulse_style=pulse_style,
|
| 159 |
+
),
|
| 160 |
+
TaskProgressColumn(show_speed=show_speed),
|
| 161 |
+
TimeRemainingColumn(elapsed_when_finished=True),
|
| 162 |
+
)
|
| 163 |
+
)
|
| 164 |
+
progress = Progress(
|
| 165 |
+
*columns,
|
| 166 |
+
auto_refresh=auto_refresh,
|
| 167 |
+
console=console,
|
| 168 |
+
transient=transient,
|
| 169 |
+
get_time=get_time,
|
| 170 |
+
refresh_per_second=refresh_per_second or 10,
|
| 171 |
+
disable=disable,
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
with progress:
|
| 175 |
+
yield from progress.track(
|
| 176 |
+
sequence,
|
| 177 |
+
total=total,
|
| 178 |
+
completed=completed,
|
| 179 |
+
description=description,
|
| 180 |
+
update_period=update_period,
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
class _Reader(RawIOBase, BinaryIO):
|
| 185 |
+
"""A reader that tracks progress while it's being read from."""
|
| 186 |
+
|
| 187 |
+
def __init__(
|
| 188 |
+
self,
|
| 189 |
+
handle: BinaryIO,
|
| 190 |
+
progress: "Progress",
|
| 191 |
+
task: TaskID,
|
| 192 |
+
close_handle: bool = True,
|
| 193 |
+
) -> None:
|
| 194 |
+
self.handle = handle
|
| 195 |
+
self.progress = progress
|
| 196 |
+
self.task = task
|
| 197 |
+
self.close_handle = close_handle
|
| 198 |
+
self._closed = False
|
| 199 |
+
|
| 200 |
+
def __enter__(self) -> "_Reader":
|
| 201 |
+
self.handle.__enter__()
|
| 202 |
+
return self
|
| 203 |
+
|
| 204 |
+
def __exit__(
|
| 205 |
+
self,
|
| 206 |
+
exc_type: Optional[Type[BaseException]],
|
| 207 |
+
exc_val: Optional[BaseException],
|
| 208 |
+
exc_tb: Optional[TracebackType],
|
| 209 |
+
) -> None:
|
| 210 |
+
self.close()
|
| 211 |
+
|
| 212 |
+
def __iter__(self) -> BinaryIO:
|
| 213 |
+
return self
|
| 214 |
+
|
| 215 |
+
def __next__(self) -> bytes:
|
| 216 |
+
line = next(self.handle)
|
| 217 |
+
self.progress.advance(self.task, advance=len(line))
|
| 218 |
+
return line
|
| 219 |
+
|
| 220 |
+
@property
|
| 221 |
+
def closed(self) -> bool:
|
| 222 |
+
return self._closed
|
| 223 |
+
|
| 224 |
+
def fileno(self) -> int:
|
| 225 |
+
return self.handle.fileno()
|
| 226 |
+
|
| 227 |
+
def isatty(self) -> bool:
|
| 228 |
+
return self.handle.isatty()
|
| 229 |
+
|
| 230 |
+
@property
|
| 231 |
+
def mode(self) -> str:
|
| 232 |
+
return self.handle.mode
|
| 233 |
+
|
| 234 |
+
@property
|
| 235 |
+
def name(self) -> str:
|
| 236 |
+
return self.handle.name
|
| 237 |
+
|
| 238 |
+
def readable(self) -> bool:
|
| 239 |
+
return self.handle.readable()
|
| 240 |
+
|
| 241 |
+
def seekable(self) -> bool:
|
| 242 |
+
return self.handle.seekable()
|
| 243 |
+
|
| 244 |
+
def writable(self) -> bool:
|
| 245 |
+
return False
|
| 246 |
+
|
| 247 |
+
def read(self, size: int = -1) -> bytes:
|
| 248 |
+
block = self.handle.read(size)
|
| 249 |
+
self.progress.advance(self.task, advance=len(block))
|
| 250 |
+
return block
|
| 251 |
+
|
| 252 |
+
def readinto(self, b: Union[bytearray, memoryview, mmap]): # type: ignore[no-untyped-def, override]
|
| 253 |
+
n = self.handle.readinto(b) # type: ignore[attr-defined]
|
| 254 |
+
self.progress.advance(self.task, advance=n)
|
| 255 |
+
return n
|
| 256 |
+
|
| 257 |
+
def readline(self, size: int = -1) -> bytes: # type: ignore[override]
|
| 258 |
+
line = self.handle.readline(size)
|
| 259 |
+
self.progress.advance(self.task, advance=len(line))
|
| 260 |
+
return line
|
| 261 |
+
|
| 262 |
+
def readlines(self, hint: int = -1) -> List[bytes]:
|
| 263 |
+
lines = self.handle.readlines(hint)
|
| 264 |
+
self.progress.advance(self.task, advance=sum(map(len, lines)))
|
| 265 |
+
return lines
|
| 266 |
+
|
| 267 |
+
def close(self) -> None:
|
| 268 |
+
if self.close_handle:
|
| 269 |
+
self.handle.close()
|
| 270 |
+
self._closed = True
|
| 271 |
+
|
| 272 |
+
def seek(self, offset: int, whence: int = 0) -> int:
|
| 273 |
+
pos = self.handle.seek(offset, whence)
|
| 274 |
+
self.progress.update(self.task, completed=pos)
|
| 275 |
+
return pos
|
| 276 |
+
|
| 277 |
+
def tell(self) -> int:
|
| 278 |
+
return self.handle.tell()
|
| 279 |
+
|
| 280 |
+
def write(self, s: Any) -> int:
|
| 281 |
+
raise UnsupportedOperation("write")
|
| 282 |
+
|
| 283 |
+
def writelines(self, lines: Iterable[Any]) -> None:
|
| 284 |
+
raise UnsupportedOperation("writelines")
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
class _ReadContext(ContextManager[_I], Generic[_I]):
|
| 288 |
+
"""A utility class to handle a context for both a reader and a progress."""
|
| 289 |
+
|
| 290 |
+
def __init__(self, progress: "Progress", reader: _I) -> None:
|
| 291 |
+
self.progress = progress
|
| 292 |
+
self.reader: _I = reader
|
| 293 |
+
|
| 294 |
+
def __enter__(self) -> _I:
|
| 295 |
+
self.progress.start()
|
| 296 |
+
return self.reader.__enter__()
|
| 297 |
+
|
| 298 |
+
def __exit__(
|
| 299 |
+
self,
|
| 300 |
+
exc_type: Optional[Type[BaseException]],
|
| 301 |
+
exc_val: Optional[BaseException],
|
| 302 |
+
exc_tb: Optional[TracebackType],
|
| 303 |
+
) -> None:
|
| 304 |
+
self.progress.stop()
|
| 305 |
+
self.reader.__exit__(exc_type, exc_val, exc_tb)
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
def wrap_file(
|
| 309 |
+
file: BinaryIO,
|
| 310 |
+
total: int,
|
| 311 |
+
*,
|
| 312 |
+
description: str = "Reading...",
|
| 313 |
+
auto_refresh: bool = True,
|
| 314 |
+
console: Optional[Console] = None,
|
| 315 |
+
transient: bool = False,
|
| 316 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 317 |
+
refresh_per_second: float = 10,
|
| 318 |
+
style: StyleType = "bar.back",
|
| 319 |
+
complete_style: StyleType = "bar.complete",
|
| 320 |
+
finished_style: StyleType = "bar.finished",
|
| 321 |
+
pulse_style: StyleType = "bar.pulse",
|
| 322 |
+
disable: bool = False,
|
| 323 |
+
) -> ContextManager[BinaryIO]:
|
| 324 |
+
"""Read bytes from a file while tracking progress.
|
| 325 |
+
|
| 326 |
+
Args:
|
| 327 |
+
file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
|
| 328 |
+
total (int): Total number of bytes to read.
|
| 329 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
|
| 330 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 331 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 332 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 333 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 334 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 335 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 336 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 337 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 338 |
+
disable (bool, optional): Disable display of progress.
|
| 339 |
+
Returns:
|
| 340 |
+
ContextManager[BinaryIO]: A context manager yielding a progress reader.
|
| 341 |
+
|
| 342 |
+
"""
|
| 343 |
+
|
| 344 |
+
columns: List["ProgressColumn"] = (
|
| 345 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 346 |
+
)
|
| 347 |
+
columns.extend(
|
| 348 |
+
(
|
| 349 |
+
BarColumn(
|
| 350 |
+
style=style,
|
| 351 |
+
complete_style=complete_style,
|
| 352 |
+
finished_style=finished_style,
|
| 353 |
+
pulse_style=pulse_style,
|
| 354 |
+
),
|
| 355 |
+
DownloadColumn(),
|
| 356 |
+
TimeRemainingColumn(),
|
| 357 |
+
)
|
| 358 |
+
)
|
| 359 |
+
progress = Progress(
|
| 360 |
+
*columns,
|
| 361 |
+
auto_refresh=auto_refresh,
|
| 362 |
+
console=console,
|
| 363 |
+
transient=transient,
|
| 364 |
+
get_time=get_time,
|
| 365 |
+
refresh_per_second=refresh_per_second or 10,
|
| 366 |
+
disable=disable,
|
| 367 |
+
)
|
| 368 |
+
|
| 369 |
+
reader = progress.wrap_file(file, total=total, description=description)
|
| 370 |
+
return _ReadContext(progress, reader)
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
@typing.overload
|
| 374 |
+
def open(
|
| 375 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 376 |
+
mode: Union[Literal["rt"], Literal["r"]],
|
| 377 |
+
buffering: int = -1,
|
| 378 |
+
encoding: Optional[str] = None,
|
| 379 |
+
errors: Optional[str] = None,
|
| 380 |
+
newline: Optional[str] = None,
|
| 381 |
+
*,
|
| 382 |
+
total: Optional[int] = None,
|
| 383 |
+
description: str = "Reading...",
|
| 384 |
+
auto_refresh: bool = True,
|
| 385 |
+
console: Optional[Console] = None,
|
| 386 |
+
transient: bool = False,
|
| 387 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 388 |
+
refresh_per_second: float = 10,
|
| 389 |
+
style: StyleType = "bar.back",
|
| 390 |
+
complete_style: StyleType = "bar.complete",
|
| 391 |
+
finished_style: StyleType = "bar.finished",
|
| 392 |
+
pulse_style: StyleType = "bar.pulse",
|
| 393 |
+
disable: bool = False,
|
| 394 |
+
) -> ContextManager[TextIO]:
|
| 395 |
+
pass
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
@typing.overload
|
| 399 |
+
def open(
|
| 400 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 401 |
+
mode: Literal["rb"],
|
| 402 |
+
buffering: int = -1,
|
| 403 |
+
encoding: Optional[str] = None,
|
| 404 |
+
errors: Optional[str] = None,
|
| 405 |
+
newline: Optional[str] = None,
|
| 406 |
+
*,
|
| 407 |
+
total: Optional[int] = None,
|
| 408 |
+
description: str = "Reading...",
|
| 409 |
+
auto_refresh: bool = True,
|
| 410 |
+
console: Optional[Console] = None,
|
| 411 |
+
transient: bool = False,
|
| 412 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 413 |
+
refresh_per_second: float = 10,
|
| 414 |
+
style: StyleType = "bar.back",
|
| 415 |
+
complete_style: StyleType = "bar.complete",
|
| 416 |
+
finished_style: StyleType = "bar.finished",
|
| 417 |
+
pulse_style: StyleType = "bar.pulse",
|
| 418 |
+
disable: bool = False,
|
| 419 |
+
) -> ContextManager[BinaryIO]:
|
| 420 |
+
pass
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
def open(
|
| 424 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 425 |
+
mode: Union[Literal["rb"], Literal["rt"], Literal["r"]] = "r",
|
| 426 |
+
buffering: int = -1,
|
| 427 |
+
encoding: Optional[str] = None,
|
| 428 |
+
errors: Optional[str] = None,
|
| 429 |
+
newline: Optional[str] = None,
|
| 430 |
+
*,
|
| 431 |
+
total: Optional[int] = None,
|
| 432 |
+
description: str = "Reading...",
|
| 433 |
+
auto_refresh: bool = True,
|
| 434 |
+
console: Optional[Console] = None,
|
| 435 |
+
transient: bool = False,
|
| 436 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 437 |
+
refresh_per_second: float = 10,
|
| 438 |
+
style: StyleType = "bar.back",
|
| 439 |
+
complete_style: StyleType = "bar.complete",
|
| 440 |
+
finished_style: StyleType = "bar.finished",
|
| 441 |
+
pulse_style: StyleType = "bar.pulse",
|
| 442 |
+
disable: bool = False,
|
| 443 |
+
) -> Union[ContextManager[BinaryIO], ContextManager[TextIO]]:
|
| 444 |
+
"""Read bytes from a file while tracking progress.
|
| 445 |
+
|
| 446 |
+
Args:
|
| 447 |
+
path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
|
| 448 |
+
mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
|
| 449 |
+
buffering (int): The buffering strategy to use, see :func:`io.open`.
|
| 450 |
+
encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
|
| 451 |
+
errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
|
| 452 |
+
newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`
|
| 453 |
+
total: (int, optional): Total number of bytes to read. Must be provided if reading from a file handle. Default for a path is os.stat(file).st_size.
|
| 454 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
|
| 455 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 456 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 457 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 458 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 459 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 460 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 461 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 462 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 463 |
+
disable (bool, optional): Disable display of progress.
|
| 464 |
+
encoding (str, optional): The encoding to use when reading in text mode.
|
| 465 |
+
|
| 466 |
+
Returns:
|
| 467 |
+
ContextManager[BinaryIO]: A context manager yielding a progress reader.
|
| 468 |
+
|
| 469 |
+
"""
|
| 470 |
+
|
| 471 |
+
columns: List["ProgressColumn"] = (
|
| 472 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 473 |
+
)
|
| 474 |
+
columns.extend(
|
| 475 |
+
(
|
| 476 |
+
BarColumn(
|
| 477 |
+
style=style,
|
| 478 |
+
complete_style=complete_style,
|
| 479 |
+
finished_style=finished_style,
|
| 480 |
+
pulse_style=pulse_style,
|
| 481 |
+
),
|
| 482 |
+
DownloadColumn(),
|
| 483 |
+
TimeRemainingColumn(),
|
| 484 |
+
)
|
| 485 |
+
)
|
| 486 |
+
progress = Progress(
|
| 487 |
+
*columns,
|
| 488 |
+
auto_refresh=auto_refresh,
|
| 489 |
+
console=console,
|
| 490 |
+
transient=transient,
|
| 491 |
+
get_time=get_time,
|
| 492 |
+
refresh_per_second=refresh_per_second or 10,
|
| 493 |
+
disable=disable,
|
| 494 |
+
)
|
| 495 |
+
|
| 496 |
+
reader = progress.open(
|
| 497 |
+
file,
|
| 498 |
+
mode=mode,
|
| 499 |
+
buffering=buffering,
|
| 500 |
+
encoding=encoding,
|
| 501 |
+
errors=errors,
|
| 502 |
+
newline=newline,
|
| 503 |
+
total=total,
|
| 504 |
+
description=description,
|
| 505 |
+
)
|
| 506 |
+
return _ReadContext(progress, reader) # type: ignore[return-value, type-var]
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
class ProgressColumn(ABC):
|
| 510 |
+
"""Base class for a widget to use in progress display."""
|
| 511 |
+
|
| 512 |
+
max_refresh: Optional[float] = None
|
| 513 |
+
|
| 514 |
+
def __init__(self, table_column: Optional[Column] = None) -> None:
|
| 515 |
+
self._table_column = table_column
|
| 516 |
+
self._renderable_cache: Dict[TaskID, Tuple[float, RenderableType]] = {}
|
| 517 |
+
self._update_time: Optional[float] = None
|
| 518 |
+
|
| 519 |
+
def get_table_column(self) -> Column:
|
| 520 |
+
"""Get a table column, used to build tasks table."""
|
| 521 |
+
return self._table_column or Column()
|
| 522 |
+
|
| 523 |
+
def __call__(self, task: "Task") -> RenderableType:
|
| 524 |
+
"""Called by the Progress object to return a renderable for the given task.
|
| 525 |
+
|
| 526 |
+
Args:
|
| 527 |
+
task (Task): An object containing information regarding the task.
|
| 528 |
+
|
| 529 |
+
Returns:
|
| 530 |
+
RenderableType: Anything renderable (including str).
|
| 531 |
+
"""
|
| 532 |
+
current_time = task.get_time()
|
| 533 |
+
if self.max_refresh is not None and not task.completed:
|
| 534 |
+
try:
|
| 535 |
+
timestamp, renderable = self._renderable_cache[task.id]
|
| 536 |
+
except KeyError:
|
| 537 |
+
pass
|
| 538 |
+
else:
|
| 539 |
+
if timestamp + self.max_refresh > current_time:
|
| 540 |
+
return renderable
|
| 541 |
+
|
| 542 |
+
renderable = self.render(task)
|
| 543 |
+
self._renderable_cache[task.id] = (current_time, renderable)
|
| 544 |
+
return renderable
|
| 545 |
+
|
| 546 |
+
@abstractmethod
|
| 547 |
+
def render(self, task: "Task") -> RenderableType:
|
| 548 |
+
"""Should return a renderable object."""
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
class RenderableColumn(ProgressColumn):
|
| 552 |
+
"""A column to insert an arbitrary column.
|
| 553 |
+
|
| 554 |
+
Args:
|
| 555 |
+
renderable (RenderableType, optional): Any renderable. Defaults to empty string.
|
| 556 |
+
"""
|
| 557 |
+
|
| 558 |
+
def __init__(
|
| 559 |
+
self, renderable: RenderableType = "", *, table_column: Optional[Column] = None
|
| 560 |
+
):
|
| 561 |
+
self.renderable = renderable
|
| 562 |
+
super().__init__(table_column=table_column)
|
| 563 |
+
|
| 564 |
+
def render(self, task: "Task") -> RenderableType:
|
| 565 |
+
return self.renderable
|
| 566 |
+
|
| 567 |
+
|
| 568 |
+
class SpinnerColumn(ProgressColumn):
|
| 569 |
+
"""A column with a 'spinner' animation.
|
| 570 |
+
|
| 571 |
+
Args:
|
| 572 |
+
spinner_name (str, optional): Name of spinner animation. Defaults to "dots".
|
| 573 |
+
style (StyleType, optional): Style of spinner. Defaults to "progress.spinner".
|
| 574 |
+
speed (float, optional): Speed factor of spinner. Defaults to 1.0.
|
| 575 |
+
finished_text (TextType, optional): Text used when task is finished. Defaults to " ".
|
| 576 |
+
"""
|
| 577 |
+
|
| 578 |
+
def __init__(
|
| 579 |
+
self,
|
| 580 |
+
spinner_name: str = "dots",
|
| 581 |
+
style: Optional[StyleType] = "progress.spinner",
|
| 582 |
+
speed: float = 1.0,
|
| 583 |
+
finished_text: TextType = " ",
|
| 584 |
+
table_column: Optional[Column] = None,
|
| 585 |
+
):
|
| 586 |
+
self.spinner = Spinner(spinner_name, style=style, speed=speed)
|
| 587 |
+
self.finished_text = (
|
| 588 |
+
Text.from_markup(finished_text)
|
| 589 |
+
if isinstance(finished_text, str)
|
| 590 |
+
else finished_text
|
| 591 |
+
)
|
| 592 |
+
super().__init__(table_column=table_column)
|
| 593 |
+
|
| 594 |
+
def set_spinner(
|
| 595 |
+
self,
|
| 596 |
+
spinner_name: str,
|
| 597 |
+
spinner_style: Optional[StyleType] = "progress.spinner",
|
| 598 |
+
speed: float = 1.0,
|
| 599 |
+
) -> None:
|
| 600 |
+
"""Set a new spinner.
|
| 601 |
+
|
| 602 |
+
Args:
|
| 603 |
+
spinner_name (str): Spinner name, see python -m rich.spinner.
|
| 604 |
+
spinner_style (Optional[StyleType], optional): Spinner style. Defaults to "progress.spinner".
|
| 605 |
+
speed (float, optional): Speed factor of spinner. Defaults to 1.0.
|
| 606 |
+
"""
|
| 607 |
+
self.spinner = Spinner(spinner_name, style=spinner_style, speed=speed)
|
| 608 |
+
|
| 609 |
+
def render(self, task: "Task") -> RenderableType:
|
| 610 |
+
text = (
|
| 611 |
+
self.finished_text
|
| 612 |
+
if task.finished
|
| 613 |
+
else self.spinner.render(task.get_time())
|
| 614 |
+
)
|
| 615 |
+
return text
|
| 616 |
+
|
| 617 |
+
|
| 618 |
+
class TextColumn(ProgressColumn):
|
| 619 |
+
"""A column containing text."""
|
| 620 |
+
|
| 621 |
+
def __init__(
|
| 622 |
+
self,
|
| 623 |
+
text_format: str,
|
| 624 |
+
style: StyleType = "none",
|
| 625 |
+
justify: JustifyMethod = "left",
|
| 626 |
+
markup: bool = True,
|
| 627 |
+
highlighter: Optional[Highlighter] = None,
|
| 628 |
+
table_column: Optional[Column] = None,
|
| 629 |
+
) -> None:
|
| 630 |
+
self.text_format = text_format
|
| 631 |
+
self.justify: JustifyMethod = justify
|
| 632 |
+
self.style = style
|
| 633 |
+
self.markup = markup
|
| 634 |
+
self.highlighter = highlighter
|
| 635 |
+
super().__init__(table_column=table_column or Column(no_wrap=True))
|
| 636 |
+
|
| 637 |
+
def render(self, task: "Task") -> Text:
|
| 638 |
+
_text = self.text_format.format(task=task)
|
| 639 |
+
if self.markup:
|
| 640 |
+
text = Text.from_markup(_text, style=self.style, justify=self.justify)
|
| 641 |
+
else:
|
| 642 |
+
text = Text(_text, style=self.style, justify=self.justify)
|
| 643 |
+
if self.highlighter:
|
| 644 |
+
self.highlighter.highlight(text)
|
| 645 |
+
return text
|
| 646 |
+
|
| 647 |
+
|
| 648 |
+
class BarColumn(ProgressColumn):
|
| 649 |
+
"""Renders a visual progress bar.
|
| 650 |
+
|
| 651 |
+
Args:
|
| 652 |
+
bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40.
|
| 653 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 654 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 655 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 656 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 657 |
+
"""
|
| 658 |
+
|
| 659 |
+
def __init__(
|
| 660 |
+
self,
|
| 661 |
+
bar_width: Optional[int] = 40,
|
| 662 |
+
style: StyleType = "bar.back",
|
| 663 |
+
complete_style: StyleType = "bar.complete",
|
| 664 |
+
finished_style: StyleType = "bar.finished",
|
| 665 |
+
pulse_style: StyleType = "bar.pulse",
|
| 666 |
+
table_column: Optional[Column] = None,
|
| 667 |
+
) -> None:
|
| 668 |
+
self.bar_width = bar_width
|
| 669 |
+
self.style = style
|
| 670 |
+
self.complete_style = complete_style
|
| 671 |
+
self.finished_style = finished_style
|
| 672 |
+
self.pulse_style = pulse_style
|
| 673 |
+
super().__init__(table_column=table_column)
|
| 674 |
+
|
| 675 |
+
def render(self, task: "Task") -> ProgressBar:
|
| 676 |
+
"""Gets a progress bar widget for a task."""
|
| 677 |
+
return ProgressBar(
|
| 678 |
+
total=max(0, task.total) if task.total is not None else None,
|
| 679 |
+
completed=max(0, task.completed),
|
| 680 |
+
width=None if self.bar_width is None else max(1, self.bar_width),
|
| 681 |
+
pulse=not task.started,
|
| 682 |
+
animation_time=task.get_time(),
|
| 683 |
+
style=self.style,
|
| 684 |
+
complete_style=self.complete_style,
|
| 685 |
+
finished_style=self.finished_style,
|
| 686 |
+
pulse_style=self.pulse_style,
|
| 687 |
+
)
|
| 688 |
+
|
| 689 |
+
|
| 690 |
+
class TimeElapsedColumn(ProgressColumn):
|
| 691 |
+
"""Renders time elapsed."""
|
| 692 |
+
|
| 693 |
+
def render(self, task: "Task") -> Text:
|
| 694 |
+
"""Show time elapsed."""
|
| 695 |
+
elapsed = task.finished_time if task.finished else task.elapsed
|
| 696 |
+
if elapsed is None:
|
| 697 |
+
return Text("-:--:--", style="progress.elapsed")
|
| 698 |
+
delta = timedelta(seconds=max(0, int(elapsed)))
|
| 699 |
+
return Text(str(delta), style="progress.elapsed")
|
| 700 |
+
|
| 701 |
+
|
| 702 |
+
class TaskProgressColumn(TextColumn):
|
| 703 |
+
"""Show task progress as a percentage.
|
| 704 |
+
|
| 705 |
+
Args:
|
| 706 |
+
text_format (str, optional): Format for percentage display. Defaults to "[progress.percentage]{task.percentage:>3.0f}%".
|
| 707 |
+
text_format_no_percentage (str, optional): Format if percentage is unknown. Defaults to "".
|
| 708 |
+
style (StyleType, optional): Style of output. Defaults to "none".
|
| 709 |
+
justify (JustifyMethod, optional): Text justification. Defaults to "left".
|
| 710 |
+
markup (bool, optional): Enable markup. Defaults to True.
|
| 711 |
+
highlighter (Optional[Highlighter], optional): Highlighter to apply to output. Defaults to None.
|
| 712 |
+
table_column (Optional[Column], optional): Table Column to use. Defaults to None.
|
| 713 |
+
show_speed (bool, optional): Show speed if total is unknown. Defaults to False.
|
| 714 |
+
"""
|
| 715 |
+
|
| 716 |
+
def __init__(
|
| 717 |
+
self,
|
| 718 |
+
text_format: str = "[progress.percentage]{task.percentage:>3.0f}%",
|
| 719 |
+
text_format_no_percentage: str = "",
|
| 720 |
+
style: StyleType = "none",
|
| 721 |
+
justify: JustifyMethod = "left",
|
| 722 |
+
markup: bool = True,
|
| 723 |
+
highlighter: Optional[Highlighter] = None,
|
| 724 |
+
table_column: Optional[Column] = None,
|
| 725 |
+
show_speed: bool = False,
|
| 726 |
+
) -> None:
|
| 727 |
+
self.text_format_no_percentage = text_format_no_percentage
|
| 728 |
+
self.show_speed = show_speed
|
| 729 |
+
super().__init__(
|
| 730 |
+
text_format=text_format,
|
| 731 |
+
style=style,
|
| 732 |
+
justify=justify,
|
| 733 |
+
markup=markup,
|
| 734 |
+
highlighter=highlighter,
|
| 735 |
+
table_column=table_column,
|
| 736 |
+
)
|
| 737 |
+
|
| 738 |
+
@classmethod
|
| 739 |
+
def render_speed(cls, speed: Optional[float]) -> Text:
|
| 740 |
+
"""Render the speed in iterations per second.
|
| 741 |
+
|
| 742 |
+
Args:
|
| 743 |
+
task (Task): A Task object.
|
| 744 |
+
|
| 745 |
+
Returns:
|
| 746 |
+
Text: Text object containing the task speed.
|
| 747 |
+
"""
|
| 748 |
+
if speed is None:
|
| 749 |
+
return Text("", style="progress.percentage")
|
| 750 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 751 |
+
int(speed),
|
| 752 |
+
["", "×10³", "×10⁶", "×10⁹", "×10¹²"],
|
| 753 |
+
1000,
|
| 754 |
+
)
|
| 755 |
+
data_speed = speed / unit
|
| 756 |
+
return Text(f"{data_speed:.1f}{suffix} it/s", style="progress.percentage")
|
| 757 |
+
|
| 758 |
+
def render(self, task: "Task") -> Text:
|
| 759 |
+
if task.total is None and self.show_speed:
|
| 760 |
+
return self.render_speed(task.finished_speed or task.speed)
|
| 761 |
+
text_format = (
|
| 762 |
+
self.text_format_no_percentage if task.total is None else self.text_format
|
| 763 |
+
)
|
| 764 |
+
_text = text_format.format(task=task)
|
| 765 |
+
if self.markup:
|
| 766 |
+
text = Text.from_markup(_text, style=self.style, justify=self.justify)
|
| 767 |
+
else:
|
| 768 |
+
text = Text(_text, style=self.style, justify=self.justify)
|
| 769 |
+
if self.highlighter:
|
| 770 |
+
self.highlighter.highlight(text)
|
| 771 |
+
return text
|
| 772 |
+
|
| 773 |
+
|
| 774 |
+
class TimeRemainingColumn(ProgressColumn):
|
| 775 |
+
"""Renders estimated time remaining.
|
| 776 |
+
|
| 777 |
+
Args:
|
| 778 |
+
compact (bool, optional): Render MM:SS when time remaining is less than an hour. Defaults to False.
|
| 779 |
+
elapsed_when_finished (bool, optional): Render time elapsed when the task is finished. Defaults to False.
|
| 780 |
+
"""
|
| 781 |
+
|
| 782 |
+
# Only refresh twice a second to prevent jitter
|
| 783 |
+
max_refresh = 0.5
|
| 784 |
+
|
| 785 |
+
def __init__(
|
| 786 |
+
self,
|
| 787 |
+
compact: bool = False,
|
| 788 |
+
elapsed_when_finished: bool = False,
|
| 789 |
+
table_column: Optional[Column] = None,
|
| 790 |
+
):
|
| 791 |
+
self.compact = compact
|
| 792 |
+
self.elapsed_when_finished = elapsed_when_finished
|
| 793 |
+
super().__init__(table_column=table_column)
|
| 794 |
+
|
| 795 |
+
def render(self, task: "Task") -> Text:
|
| 796 |
+
"""Show time remaining."""
|
| 797 |
+
if self.elapsed_when_finished and task.finished:
|
| 798 |
+
task_time = task.finished_time
|
| 799 |
+
style = "progress.elapsed"
|
| 800 |
+
else:
|
| 801 |
+
task_time = task.time_remaining
|
| 802 |
+
style = "progress.remaining"
|
| 803 |
+
|
| 804 |
+
if task.total is None:
|
| 805 |
+
return Text("", style=style)
|
| 806 |
+
|
| 807 |
+
if task_time is None:
|
| 808 |
+
return Text("--:--" if self.compact else "-:--:--", style=style)
|
| 809 |
+
|
| 810 |
+
# Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
|
| 811 |
+
minutes, seconds = divmod(int(task_time), 60)
|
| 812 |
+
hours, minutes = divmod(minutes, 60)
|
| 813 |
+
|
| 814 |
+
if self.compact and not hours:
|
| 815 |
+
formatted = f"{minutes:02d}:{seconds:02d}"
|
| 816 |
+
else:
|
| 817 |
+
formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
|
| 818 |
+
|
| 819 |
+
return Text(formatted, style=style)
|
| 820 |
+
|
| 821 |
+
|
| 822 |
+
class FileSizeColumn(ProgressColumn):
|
| 823 |
+
"""Renders completed filesize."""
|
| 824 |
+
|
| 825 |
+
def render(self, task: "Task") -> Text:
|
| 826 |
+
"""Show data completed."""
|
| 827 |
+
data_size = filesize.decimal(int(task.completed))
|
| 828 |
+
return Text(data_size, style="progress.filesize")
|
| 829 |
+
|
| 830 |
+
|
| 831 |
+
class TotalFileSizeColumn(ProgressColumn):
|
| 832 |
+
"""Renders total filesize."""
|
| 833 |
+
|
| 834 |
+
def render(self, task: "Task") -> Text:
|
| 835 |
+
"""Show data completed."""
|
| 836 |
+
data_size = filesize.decimal(int(task.total)) if task.total is not None else ""
|
| 837 |
+
return Text(data_size, style="progress.filesize.total")
|
| 838 |
+
|
| 839 |
+
|
| 840 |
+
class MofNCompleteColumn(ProgressColumn):
|
| 841 |
+
"""Renders completed count/total, e.g. ' 10/1000'.
|
| 842 |
+
|
| 843 |
+
Best for bounded tasks with int quantities.
|
| 844 |
+
|
| 845 |
+
Space pads the completed count so that progress length does not change as task progresses
|
| 846 |
+
past powers of 10.
|
| 847 |
+
|
| 848 |
+
Args:
|
| 849 |
+
separator (str, optional): Text to separate completed and total values. Defaults to "/".
|
| 850 |
+
"""
|
| 851 |
+
|
| 852 |
+
def __init__(self, separator: str = "/", table_column: Optional[Column] = None):
|
| 853 |
+
self.separator = separator
|
| 854 |
+
super().__init__(table_column=table_column)
|
| 855 |
+
|
| 856 |
+
def render(self, task: "Task") -> Text:
|
| 857 |
+
"""Show completed/total."""
|
| 858 |
+
completed = int(task.completed)
|
| 859 |
+
total = int(task.total) if task.total is not None else "?"
|
| 860 |
+
total_width = len(str(total))
|
| 861 |
+
return Text(
|
| 862 |
+
f"{completed:{total_width}d}{self.separator}{total}",
|
| 863 |
+
style="progress.download",
|
| 864 |
+
)
|
| 865 |
+
|
| 866 |
+
|
| 867 |
+
class DownloadColumn(ProgressColumn):
|
| 868 |
+
"""Renders file size downloaded and total, e.g. '0.5/2.3 GB'.
|
| 869 |
+
|
| 870 |
+
Args:
|
| 871 |
+
binary_units (bool, optional): Use binary units, KiB, MiB etc. Defaults to False.
|
| 872 |
+
"""
|
| 873 |
+
|
| 874 |
+
def __init__(
|
| 875 |
+
self, binary_units: bool = False, table_column: Optional[Column] = None
|
| 876 |
+
) -> None:
|
| 877 |
+
self.binary_units = binary_units
|
| 878 |
+
super().__init__(table_column=table_column)
|
| 879 |
+
|
| 880 |
+
def render(self, task: "Task") -> Text:
|
| 881 |
+
"""Calculate common unit for completed and total."""
|
| 882 |
+
completed = int(task.completed)
|
| 883 |
+
|
| 884 |
+
unit_and_suffix_calculation_base = (
|
| 885 |
+
int(task.total) if task.total is not None else completed
|
| 886 |
+
)
|
| 887 |
+
if self.binary_units:
|
| 888 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 889 |
+
unit_and_suffix_calculation_base,
|
| 890 |
+
["bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"],
|
| 891 |
+
1024,
|
| 892 |
+
)
|
| 893 |
+
else:
|
| 894 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 895 |
+
unit_and_suffix_calculation_base,
|
| 896 |
+
["bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
| 897 |
+
1000,
|
| 898 |
+
)
|
| 899 |
+
precision = 0 if unit == 1 else 1
|
| 900 |
+
|
| 901 |
+
completed_ratio = completed / unit
|
| 902 |
+
completed_str = f"{completed_ratio:,.{precision}f}"
|
| 903 |
+
|
| 904 |
+
if task.total is not None:
|
| 905 |
+
total = int(task.total)
|
| 906 |
+
total_ratio = total / unit
|
| 907 |
+
total_str = f"{total_ratio:,.{precision}f}"
|
| 908 |
+
else:
|
| 909 |
+
total_str = "?"
|
| 910 |
+
|
| 911 |
+
download_status = f"{completed_str}/{total_str} {suffix}"
|
| 912 |
+
download_text = Text(download_status, style="progress.download")
|
| 913 |
+
return download_text
|
| 914 |
+
|
| 915 |
+
|
| 916 |
+
class TransferSpeedColumn(ProgressColumn):
|
| 917 |
+
"""Renders human readable transfer speed."""
|
| 918 |
+
|
| 919 |
+
def render(self, task: "Task") -> Text:
|
| 920 |
+
"""Show data transfer speed."""
|
| 921 |
+
speed = task.finished_speed or task.speed
|
| 922 |
+
if speed is None:
|
| 923 |
+
return Text("?", style="progress.data.speed")
|
| 924 |
+
data_speed = filesize.decimal(int(speed))
|
| 925 |
+
return Text(f"{data_speed}/s", style="progress.data.speed")
|
| 926 |
+
|
| 927 |
+
|
| 928 |
+
class ProgressSample(NamedTuple):
|
| 929 |
+
"""Sample of progress for a given time."""
|
| 930 |
+
|
| 931 |
+
timestamp: float
|
| 932 |
+
"""Timestamp of sample."""
|
| 933 |
+
completed: float
|
| 934 |
+
"""Number of steps completed."""
|
| 935 |
+
|
| 936 |
+
|
| 937 |
+
@dataclass
|
| 938 |
+
class Task:
|
| 939 |
+
"""Information regarding a progress task.
|
| 940 |
+
|
| 941 |
+
This object should be considered read-only outside of the :class:`~Progress` class.
|
| 942 |
+
|
| 943 |
+
"""
|
| 944 |
+
|
| 945 |
+
id: TaskID
|
| 946 |
+
"""Task ID associated with this task (used in Progress methods)."""
|
| 947 |
+
|
| 948 |
+
description: str
|
| 949 |
+
"""str: Description of the task."""
|
| 950 |
+
|
| 951 |
+
total: Optional[float]
|
| 952 |
+
"""Optional[float]: Total number of steps in this task."""
|
| 953 |
+
|
| 954 |
+
completed: float
|
| 955 |
+
"""float: Number of steps completed"""
|
| 956 |
+
|
| 957 |
+
_get_time: GetTimeCallable
|
| 958 |
+
"""Callable to get the current time."""
|
| 959 |
+
|
| 960 |
+
finished_time: Optional[float] = None
|
| 961 |
+
"""float: Time task was finished."""
|
| 962 |
+
|
| 963 |
+
visible: bool = True
|
| 964 |
+
"""bool: Indicates if this task is visible in the progress display."""
|
| 965 |
+
|
| 966 |
+
fields: Dict[str, Any] = field(default_factory=dict)
|
| 967 |
+
"""dict: Arbitrary fields passed in via Progress.update."""
|
| 968 |
+
|
| 969 |
+
start_time: Optional[float] = field(default=None, init=False, repr=False)
|
| 970 |
+
"""Optional[float]: Time this task was started, or None if not started."""
|
| 971 |
+
|
| 972 |
+
stop_time: Optional[float] = field(default=None, init=False, repr=False)
|
| 973 |
+
"""Optional[float]: Time this task was stopped, or None if not stopped."""
|
| 974 |
+
|
| 975 |
+
finished_speed: Optional[float] = None
|
| 976 |
+
"""Optional[float]: The last speed for a finished task."""
|
| 977 |
+
|
| 978 |
+
_progress: Deque[ProgressSample] = field(
|
| 979 |
+
default_factory=lambda: deque(maxlen=1000), init=False, repr=False
|
| 980 |
+
)
|
| 981 |
+
|
| 982 |
+
_lock: RLock = field(repr=False, default_factory=RLock)
|
| 983 |
+
"""Thread lock."""
|
| 984 |
+
|
| 985 |
+
def get_time(self) -> float:
|
| 986 |
+
"""float: Get the current time, in seconds."""
|
| 987 |
+
return self._get_time()
|
| 988 |
+
|
| 989 |
+
@property
|
| 990 |
+
def started(self) -> bool:
|
| 991 |
+
"""bool: Check if the task as started."""
|
| 992 |
+
return self.start_time is not None
|
| 993 |
+
|
| 994 |
+
@property
|
| 995 |
+
def remaining(self) -> Optional[float]:
|
| 996 |
+
"""Optional[float]: Get the number of steps remaining, if a non-None total was set."""
|
| 997 |
+
if self.total is None:
|
| 998 |
+
return None
|
| 999 |
+
return self.total - self.completed
|
| 1000 |
+
|
| 1001 |
+
@property
|
| 1002 |
+
def elapsed(self) -> Optional[float]:
|
| 1003 |
+
"""Optional[float]: Time elapsed since task was started, or ``None`` if the task hasn't started."""
|
| 1004 |
+
if self.start_time is None:
|
| 1005 |
+
return None
|
| 1006 |
+
if self.stop_time is not None:
|
| 1007 |
+
return self.stop_time - self.start_time
|
| 1008 |
+
return self.get_time() - self.start_time
|
| 1009 |
+
|
| 1010 |
+
@property
|
| 1011 |
+
def finished(self) -> bool:
|
| 1012 |
+
"""Check if the task has finished."""
|
| 1013 |
+
return self.finished_time is not None
|
| 1014 |
+
|
| 1015 |
+
@property
|
| 1016 |
+
def percentage(self) -> float:
|
| 1017 |
+
"""float: Get progress of task as a percentage. If a None total was set, returns 0"""
|
| 1018 |
+
if not self.total:
|
| 1019 |
+
return 0.0
|
| 1020 |
+
completed = (self.completed / self.total) * 100.0
|
| 1021 |
+
completed = min(100.0, max(0.0, completed))
|
| 1022 |
+
return completed
|
| 1023 |
+
|
| 1024 |
+
@property
|
| 1025 |
+
def speed(self) -> Optional[float]:
|
| 1026 |
+
"""Optional[float]: Get the estimated speed in steps per second."""
|
| 1027 |
+
if self.start_time is None:
|
| 1028 |
+
return None
|
| 1029 |
+
with self._lock:
|
| 1030 |
+
progress = self._progress
|
| 1031 |
+
if not progress:
|
| 1032 |
+
return None
|
| 1033 |
+
total_time = progress[-1].timestamp - progress[0].timestamp
|
| 1034 |
+
if total_time == 0:
|
| 1035 |
+
return None
|
| 1036 |
+
iter_progress = iter(progress)
|
| 1037 |
+
next(iter_progress)
|
| 1038 |
+
total_completed = sum(sample.completed for sample in iter_progress)
|
| 1039 |
+
speed = total_completed / total_time
|
| 1040 |
+
return speed
|
| 1041 |
+
|
| 1042 |
+
@property
|
| 1043 |
+
def time_remaining(self) -> Optional[float]:
|
| 1044 |
+
"""Optional[float]: Get estimated time to completion, or ``None`` if no data."""
|
| 1045 |
+
if self.finished:
|
| 1046 |
+
return 0.0
|
| 1047 |
+
speed = self.speed
|
| 1048 |
+
if not speed:
|
| 1049 |
+
return None
|
| 1050 |
+
remaining = self.remaining
|
| 1051 |
+
if remaining is None:
|
| 1052 |
+
return None
|
| 1053 |
+
estimate = ceil(remaining / speed)
|
| 1054 |
+
return estimate
|
| 1055 |
+
|
| 1056 |
+
def _reset(self) -> None:
|
| 1057 |
+
"""Reset progress."""
|
| 1058 |
+
self._progress.clear()
|
| 1059 |
+
self.finished_time = None
|
| 1060 |
+
self.finished_speed = None
|
| 1061 |
+
|
| 1062 |
+
|
| 1063 |
+
class Progress(JupyterMixin):
|
| 1064 |
+
"""Renders an auto-updating progress bar(s).
|
| 1065 |
+
|
| 1066 |
+
Args:
|
| 1067 |
+
console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.
|
| 1068 |
+
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.
|
| 1069 |
+
refresh_per_second (Optional[float], optional): Number of times per second to refresh the progress information or None to use default (10). Defaults to None.
|
| 1070 |
+
speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.
|
| 1071 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 1072 |
+
redirect_stdout: (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
|
| 1073 |
+
redirect_stderr: (bool, optional): Enable redirection of stderr. Defaults to True.
|
| 1074 |
+
get_time: (Callable, optional): A callable that gets the current time, or None to use Console.get_time. Defaults to None.
|
| 1075 |
+
disable (bool, optional): Disable progress display. Defaults to False
|
| 1076 |
+
expand (bool, optional): Expand tasks table to fit width. Defaults to False.
|
| 1077 |
+
"""
|
| 1078 |
+
|
| 1079 |
+
def __init__(
|
| 1080 |
+
self,
|
| 1081 |
+
*columns: Union[str, ProgressColumn],
|
| 1082 |
+
console: Optional[Console] = None,
|
| 1083 |
+
auto_refresh: bool = True,
|
| 1084 |
+
refresh_per_second: float = 10,
|
| 1085 |
+
speed_estimate_period: float = 30.0,
|
| 1086 |
+
transient: bool = False,
|
| 1087 |
+
redirect_stdout: bool = True,
|
| 1088 |
+
redirect_stderr: bool = True,
|
| 1089 |
+
get_time: Optional[GetTimeCallable] = None,
|
| 1090 |
+
disable: bool = False,
|
| 1091 |
+
expand: bool = False,
|
| 1092 |
+
) -> None:
|
| 1093 |
+
assert refresh_per_second > 0, "refresh_per_second must be > 0"
|
| 1094 |
+
self._lock = RLock()
|
| 1095 |
+
self.columns = columns or self.get_default_columns()
|
| 1096 |
+
self.speed_estimate_period = speed_estimate_period
|
| 1097 |
+
|
| 1098 |
+
self.disable = disable
|
| 1099 |
+
self.expand = expand
|
| 1100 |
+
self._tasks: Dict[TaskID, Task] = {}
|
| 1101 |
+
self._task_index: TaskID = TaskID(0)
|
| 1102 |
+
self.live = Live(
|
| 1103 |
+
console=console or get_console(),
|
| 1104 |
+
auto_refresh=auto_refresh,
|
| 1105 |
+
refresh_per_second=refresh_per_second,
|
| 1106 |
+
transient=transient,
|
| 1107 |
+
redirect_stdout=redirect_stdout,
|
| 1108 |
+
redirect_stderr=redirect_stderr,
|
| 1109 |
+
get_renderable=self.get_renderable,
|
| 1110 |
+
)
|
| 1111 |
+
self.get_time = get_time or self.console.get_time
|
| 1112 |
+
self.print = self.console.print
|
| 1113 |
+
self.log = self.console.log
|
| 1114 |
+
|
| 1115 |
+
@classmethod
|
| 1116 |
+
def get_default_columns(cls) -> Tuple[ProgressColumn, ...]:
|
| 1117 |
+
"""Get the default columns used for a new Progress instance:
|
| 1118 |
+
- a text column for the description (TextColumn)
|
| 1119 |
+
- the bar itself (BarColumn)
|
| 1120 |
+
- a text column showing completion percentage (TextColumn)
|
| 1121 |
+
- an estimated-time-remaining column (TimeRemainingColumn)
|
| 1122 |
+
If the Progress instance is created without passing a columns argument,
|
| 1123 |
+
the default columns defined here will be used.
|
| 1124 |
+
|
| 1125 |
+
You can also create a Progress instance using custom columns before
|
| 1126 |
+
and/or after the defaults, as in this example:
|
| 1127 |
+
|
| 1128 |
+
progress = Progress(
|
| 1129 |
+
SpinnerColumn(),
|
| 1130 |
+
*Progress.get_default_columns(),
|
| 1131 |
+
"Elapsed:",
|
| 1132 |
+
TimeElapsedColumn(),
|
| 1133 |
+
)
|
| 1134 |
+
|
| 1135 |
+
This code shows the creation of a Progress display, containing
|
| 1136 |
+
a spinner to the left, the default columns, and a labeled elapsed
|
| 1137 |
+
time column.
|
| 1138 |
+
"""
|
| 1139 |
+
return (
|
| 1140 |
+
TextColumn("[progress.description]{task.description}"),
|
| 1141 |
+
BarColumn(),
|
| 1142 |
+
TaskProgressColumn(),
|
| 1143 |
+
TimeRemainingColumn(),
|
| 1144 |
+
)
|
| 1145 |
+
|
| 1146 |
+
@property
|
| 1147 |
+
def console(self) -> Console:
|
| 1148 |
+
return self.live.console
|
| 1149 |
+
|
| 1150 |
+
@property
|
| 1151 |
+
def tasks(self) -> List[Task]:
|
| 1152 |
+
"""Get a list of Task instances."""
|
| 1153 |
+
with self._lock:
|
| 1154 |
+
return list(self._tasks.values())
|
| 1155 |
+
|
| 1156 |
+
@property
|
| 1157 |
+
def task_ids(self) -> List[TaskID]:
|
| 1158 |
+
"""A list of task IDs."""
|
| 1159 |
+
with self._lock:
|
| 1160 |
+
return list(self._tasks.keys())
|
| 1161 |
+
|
| 1162 |
+
@property
|
| 1163 |
+
def finished(self) -> bool:
|
| 1164 |
+
"""Check if all tasks have been completed."""
|
| 1165 |
+
with self._lock:
|
| 1166 |
+
if not self._tasks:
|
| 1167 |
+
return True
|
| 1168 |
+
return all(task.finished for task in self._tasks.values())
|
| 1169 |
+
|
| 1170 |
+
def start(self) -> None:
|
| 1171 |
+
"""Start the progress display."""
|
| 1172 |
+
if not self.disable:
|
| 1173 |
+
self.live.start(refresh=True)
|
| 1174 |
+
|
| 1175 |
+
def stop(self) -> None:
|
| 1176 |
+
"""Stop the progress display."""
|
| 1177 |
+
self.live.stop()
|
| 1178 |
+
if not self.console.is_interactive and not self.console.is_jupyter:
|
| 1179 |
+
self.console.print()
|
| 1180 |
+
|
| 1181 |
+
def __enter__(self) -> Self:
|
| 1182 |
+
self.start()
|
| 1183 |
+
return self
|
| 1184 |
+
|
| 1185 |
+
def __exit__(
|
| 1186 |
+
self,
|
| 1187 |
+
exc_type: Optional[Type[BaseException]],
|
| 1188 |
+
exc_val: Optional[BaseException],
|
| 1189 |
+
exc_tb: Optional[TracebackType],
|
| 1190 |
+
) -> None:
|
| 1191 |
+
self.stop()
|
| 1192 |
+
|
| 1193 |
+
def track(
|
| 1194 |
+
self,
|
| 1195 |
+
sequence: Union[Iterable[ProgressType], Sequence[ProgressType]],
|
| 1196 |
+
total: Optional[float] = None,
|
| 1197 |
+
completed: int = 0,
|
| 1198 |
+
task_id: Optional[TaskID] = None,
|
| 1199 |
+
description: str = "Working...",
|
| 1200 |
+
update_period: float = 0.1,
|
| 1201 |
+
) -> Iterable[ProgressType]:
|
| 1202 |
+
"""Track progress by iterating over a sequence.
|
| 1203 |
+
|
| 1204 |
+
Args:
|
| 1205 |
+
sequence (Sequence[ProgressType]): A sequence of values you want to iterate over and track progress.
|
| 1206 |
+
total: (float, optional): Total number of steps. Default is len(sequence).
|
| 1207 |
+
completed (int, optional): Number of steps completed so far. Defaults to 0.
|
| 1208 |
+
task_id: (TaskID): Task to track. Default is new task.
|
| 1209 |
+
description: (str, optional): Description of task, if new task is created.
|
| 1210 |
+
update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
|
| 1211 |
+
|
| 1212 |
+
Returns:
|
| 1213 |
+
Iterable[ProgressType]: An iterable of values taken from the provided sequence.
|
| 1214 |
+
"""
|
| 1215 |
+
if total is None:
|
| 1216 |
+
total = float(length_hint(sequence)) or None
|
| 1217 |
+
|
| 1218 |
+
if task_id is None:
|
| 1219 |
+
task_id = self.add_task(description, total=total, completed=completed)
|
| 1220 |
+
else:
|
| 1221 |
+
self.update(task_id, total=total, completed=completed)
|
| 1222 |
+
|
| 1223 |
+
if self.live.auto_refresh:
|
| 1224 |
+
with _TrackThread(self, task_id, update_period) as track_thread:
|
| 1225 |
+
for value in sequence:
|
| 1226 |
+
yield value
|
| 1227 |
+
track_thread.completed += 1
|
| 1228 |
+
else:
|
| 1229 |
+
advance = self.advance
|
| 1230 |
+
refresh = self.refresh
|
| 1231 |
+
for value in sequence:
|
| 1232 |
+
yield value
|
| 1233 |
+
advance(task_id, 1)
|
| 1234 |
+
refresh()
|
| 1235 |
+
|
| 1236 |
+
def wrap_file(
|
| 1237 |
+
self,
|
| 1238 |
+
file: BinaryIO,
|
| 1239 |
+
total: Optional[int] = None,
|
| 1240 |
+
*,
|
| 1241 |
+
task_id: Optional[TaskID] = None,
|
| 1242 |
+
description: str = "Reading...",
|
| 1243 |
+
) -> BinaryIO:
|
| 1244 |
+
"""Track progress file reading from a binary file.
|
| 1245 |
+
|
| 1246 |
+
Args:
|
| 1247 |
+
file (BinaryIO): A file-like object opened in binary mode.
|
| 1248 |
+
total (int, optional): Total number of bytes to read. This must be provided unless a task with a total is also given.
|
| 1249 |
+
task_id (TaskID): Task to track. Default is new task.
|
| 1250 |
+
description (str, optional): Description of task, if new task is created.
|
| 1251 |
+
|
| 1252 |
+
Returns:
|
| 1253 |
+
BinaryIO: A readable file-like object in binary mode.
|
| 1254 |
+
|
| 1255 |
+
Raises:
|
| 1256 |
+
ValueError: When no total value can be extracted from the arguments or the task.
|
| 1257 |
+
"""
|
| 1258 |
+
# attempt to recover the total from the task
|
| 1259 |
+
total_bytes: Optional[float] = None
|
| 1260 |
+
if total is not None:
|
| 1261 |
+
total_bytes = total
|
| 1262 |
+
elif task_id is not None:
|
| 1263 |
+
with self._lock:
|
| 1264 |
+
total_bytes = self._tasks[task_id].total
|
| 1265 |
+
if total_bytes is None:
|
| 1266 |
+
raise ValueError(
|
| 1267 |
+
f"unable to get the total number of bytes, please specify 'total'"
|
| 1268 |
+
)
|
| 1269 |
+
|
| 1270 |
+
# update total of task or create new task
|
| 1271 |
+
if task_id is None:
|
| 1272 |
+
task_id = self.add_task(description, total=total_bytes)
|
| 1273 |
+
else:
|
| 1274 |
+
self.update(task_id, total=total_bytes)
|
| 1275 |
+
|
| 1276 |
+
return _Reader(file, self, task_id, close_handle=False)
|
| 1277 |
+
|
| 1278 |
+
@typing.overload
|
| 1279 |
+
def open(
|
| 1280 |
+
self,
|
| 1281 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1282 |
+
mode: Literal["rb"],
|
| 1283 |
+
buffering: int = -1,
|
| 1284 |
+
encoding: Optional[str] = None,
|
| 1285 |
+
errors: Optional[str] = None,
|
| 1286 |
+
newline: Optional[str] = None,
|
| 1287 |
+
*,
|
| 1288 |
+
total: Optional[int] = None,
|
| 1289 |
+
task_id: Optional[TaskID] = None,
|
| 1290 |
+
description: str = "Reading...",
|
| 1291 |
+
) -> BinaryIO:
|
| 1292 |
+
pass
|
| 1293 |
+
|
| 1294 |
+
@typing.overload
|
| 1295 |
+
def open(
|
| 1296 |
+
self,
|
| 1297 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1298 |
+
mode: Union[Literal["r"], Literal["rt"]],
|
| 1299 |
+
buffering: int = -1,
|
| 1300 |
+
encoding: Optional[str] = None,
|
| 1301 |
+
errors: Optional[str] = None,
|
| 1302 |
+
newline: Optional[str] = None,
|
| 1303 |
+
*,
|
| 1304 |
+
total: Optional[int] = None,
|
| 1305 |
+
task_id: Optional[TaskID] = None,
|
| 1306 |
+
description: str = "Reading...",
|
| 1307 |
+
) -> TextIO:
|
| 1308 |
+
pass
|
| 1309 |
+
|
| 1310 |
+
def open(
|
| 1311 |
+
self,
|
| 1312 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1313 |
+
mode: Union[Literal["rb"], Literal["rt"], Literal["r"]] = "r",
|
| 1314 |
+
buffering: int = -1,
|
| 1315 |
+
encoding: Optional[str] = None,
|
| 1316 |
+
errors: Optional[str] = None,
|
| 1317 |
+
newline: Optional[str] = None,
|
| 1318 |
+
*,
|
| 1319 |
+
total: Optional[int] = None,
|
| 1320 |
+
task_id: Optional[TaskID] = None,
|
| 1321 |
+
description: str = "Reading...",
|
| 1322 |
+
) -> Union[BinaryIO, TextIO]:
|
| 1323 |
+
"""Track progress while reading from a binary file.
|
| 1324 |
+
|
| 1325 |
+
Args:
|
| 1326 |
+
path (Union[str, PathLike[str]]): The path to the file to read.
|
| 1327 |
+
mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
|
| 1328 |
+
buffering (int): The buffering strategy to use, see :func:`io.open`.
|
| 1329 |
+
encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
|
| 1330 |
+
errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
|
| 1331 |
+
newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`.
|
| 1332 |
+
total (int, optional): Total number of bytes to read. If none given, os.stat(path).st_size is used.
|
| 1333 |
+
task_id (TaskID): Task to track. Default is new task.
|
| 1334 |
+
description (str, optional): Description of task, if new task is created.
|
| 1335 |
+
|
| 1336 |
+
Returns:
|
| 1337 |
+
BinaryIO: A readable file-like object in binary mode.
|
| 1338 |
+
|
| 1339 |
+
Raises:
|
| 1340 |
+
ValueError: When an invalid mode is given.
|
| 1341 |
+
"""
|
| 1342 |
+
# normalize the mode (always rb, rt)
|
| 1343 |
+
_mode = "".join(sorted(mode, reverse=False))
|
| 1344 |
+
if _mode not in ("br", "rt", "r"):
|
| 1345 |
+
raise ValueError(f"invalid mode {mode!r}")
|
| 1346 |
+
|
| 1347 |
+
# patch buffering to provide the same behaviour as the builtin `open`
|
| 1348 |
+
line_buffering = buffering == 1
|
| 1349 |
+
if _mode == "br" and buffering == 1:
|
| 1350 |
+
warnings.warn(
|
| 1351 |
+
"line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used",
|
| 1352 |
+
RuntimeWarning,
|
| 1353 |
+
)
|
| 1354 |
+
buffering = -1
|
| 1355 |
+
elif _mode in ("rt", "r"):
|
| 1356 |
+
if buffering == 0:
|
| 1357 |
+
raise ValueError("can't have unbuffered text I/O")
|
| 1358 |
+
elif buffering == 1:
|
| 1359 |
+
buffering = -1
|
| 1360 |
+
|
| 1361 |
+
# attempt to get the total with `os.stat`
|
| 1362 |
+
if total is None:
|
| 1363 |
+
total = stat(file).st_size
|
| 1364 |
+
|
| 1365 |
+
# update total of task or create new task
|
| 1366 |
+
if task_id is None:
|
| 1367 |
+
task_id = self.add_task(description, total=total)
|
| 1368 |
+
else:
|
| 1369 |
+
self.update(task_id, total=total)
|
| 1370 |
+
|
| 1371 |
+
# open the file in binary mode,
|
| 1372 |
+
handle = io.open(file, "rb", buffering=buffering)
|
| 1373 |
+
reader = _Reader(handle, self, task_id, close_handle=True)
|
| 1374 |
+
|
| 1375 |
+
# wrap the reader in a `TextIOWrapper` if text mode
|
| 1376 |
+
if mode in ("r", "rt"):
|
| 1377 |
+
return io.TextIOWrapper(
|
| 1378 |
+
reader,
|
| 1379 |
+
encoding=encoding,
|
| 1380 |
+
errors=errors,
|
| 1381 |
+
newline=newline,
|
| 1382 |
+
line_buffering=line_buffering,
|
| 1383 |
+
)
|
| 1384 |
+
|
| 1385 |
+
return reader
|
| 1386 |
+
|
| 1387 |
+
def start_task(self, task_id: TaskID) -> None:
|
| 1388 |
+
"""Start a task.
|
| 1389 |
+
|
| 1390 |
+
Starts a task (used when calculating elapsed time). You may need to call this manually,
|
| 1391 |
+
if you called ``add_task`` with ``start=False``.
|
| 1392 |
+
|
| 1393 |
+
Args:
|
| 1394 |
+
task_id (TaskID): ID of task.
|
| 1395 |
+
"""
|
| 1396 |
+
with self._lock:
|
| 1397 |
+
task = self._tasks[task_id]
|
| 1398 |
+
if task.start_time is None:
|
| 1399 |
+
task.start_time = self.get_time()
|
| 1400 |
+
|
| 1401 |
+
def stop_task(self, task_id: TaskID) -> None:
|
| 1402 |
+
"""Stop a task.
|
| 1403 |
+
|
| 1404 |
+
This will freeze the elapsed time on the task.
|
| 1405 |
+
|
| 1406 |
+
Args:
|
| 1407 |
+
task_id (TaskID): ID of task.
|
| 1408 |
+
"""
|
| 1409 |
+
with self._lock:
|
| 1410 |
+
task = self._tasks[task_id]
|
| 1411 |
+
current_time = self.get_time()
|
| 1412 |
+
if task.start_time is None:
|
| 1413 |
+
task.start_time = current_time
|
| 1414 |
+
task.stop_time = current_time
|
| 1415 |
+
|
| 1416 |
+
def update(
|
| 1417 |
+
self,
|
| 1418 |
+
task_id: TaskID,
|
| 1419 |
+
*,
|
| 1420 |
+
total: Optional[float] = None,
|
| 1421 |
+
completed: Optional[float] = None,
|
| 1422 |
+
advance: Optional[float] = None,
|
| 1423 |
+
description: Optional[str] = None,
|
| 1424 |
+
visible: Optional[bool] = None,
|
| 1425 |
+
refresh: bool = False,
|
| 1426 |
+
**fields: Any,
|
| 1427 |
+
) -> None:
|
| 1428 |
+
"""Update information associated with a task.
|
| 1429 |
+
|
| 1430 |
+
Args:
|
| 1431 |
+
task_id (TaskID): Task id (returned by add_task).
|
| 1432 |
+
total (float, optional): Updates task.total if not None.
|
| 1433 |
+
completed (float, optional): Updates task.completed if not None.
|
| 1434 |
+
advance (float, optional): Add a value to task.completed if not None.
|
| 1435 |
+
description (str, optional): Change task description if not None.
|
| 1436 |
+
visible (bool, optional): Set visible flag if not None.
|
| 1437 |
+
refresh (bool): Force a refresh of progress information. Default is False.
|
| 1438 |
+
**fields (Any): Additional data fields required for rendering.
|
| 1439 |
+
"""
|
| 1440 |
+
with self._lock:
|
| 1441 |
+
task = self._tasks[task_id]
|
| 1442 |
+
completed_start = task.completed
|
| 1443 |
+
|
| 1444 |
+
if total is not None and total != task.total:
|
| 1445 |
+
task.total = total
|
| 1446 |
+
task._reset()
|
| 1447 |
+
if advance is not None:
|
| 1448 |
+
task.completed += advance
|
| 1449 |
+
if completed is not None:
|
| 1450 |
+
task.completed = completed
|
| 1451 |
+
if description is not None:
|
| 1452 |
+
task.description = description
|
| 1453 |
+
if visible is not None:
|
| 1454 |
+
task.visible = visible
|
| 1455 |
+
task.fields.update(fields)
|
| 1456 |
+
update_completed = task.completed - completed_start
|
| 1457 |
+
|
| 1458 |
+
current_time = self.get_time()
|
| 1459 |
+
old_sample_time = current_time - self.speed_estimate_period
|
| 1460 |
+
_progress = task._progress
|
| 1461 |
+
|
| 1462 |
+
popleft = _progress.popleft
|
| 1463 |
+
while _progress and _progress[0].timestamp < old_sample_time:
|
| 1464 |
+
popleft()
|
| 1465 |
+
if update_completed > 0:
|
| 1466 |
+
_progress.append(ProgressSample(current_time, update_completed))
|
| 1467 |
+
if (
|
| 1468 |
+
task.total is not None
|
| 1469 |
+
and task.completed >= task.total
|
| 1470 |
+
and task.finished_time is None
|
| 1471 |
+
):
|
| 1472 |
+
task.finished_time = task.elapsed
|
| 1473 |
+
|
| 1474 |
+
if refresh:
|
| 1475 |
+
self.refresh()
|
| 1476 |
+
|
| 1477 |
+
def reset(
|
| 1478 |
+
self,
|
| 1479 |
+
task_id: TaskID,
|
| 1480 |
+
*,
|
| 1481 |
+
start: bool = True,
|
| 1482 |
+
total: Optional[float] = None,
|
| 1483 |
+
completed: int = 0,
|
| 1484 |
+
visible: Optional[bool] = None,
|
| 1485 |
+
description: Optional[str] = None,
|
| 1486 |
+
**fields: Any,
|
| 1487 |
+
) -> None:
|
| 1488 |
+
"""Reset a task so completed is 0 and the clock is reset.
|
| 1489 |
+
|
| 1490 |
+
Args:
|
| 1491 |
+
task_id (TaskID): ID of task.
|
| 1492 |
+
start (bool, optional): Start the task after reset. Defaults to True.
|
| 1493 |
+
total (float, optional): New total steps in task, or None to use current total. Defaults to None.
|
| 1494 |
+
completed (int, optional): Number of steps completed. Defaults to 0.
|
| 1495 |
+
visible (bool, optional): Enable display of the task. Defaults to True.
|
| 1496 |
+
description (str, optional): Change task description if not None. Defaults to None.
|
| 1497 |
+
**fields (str): Additional data fields required for rendering.
|
| 1498 |
+
"""
|
| 1499 |
+
current_time = self.get_time()
|
| 1500 |
+
with self._lock:
|
| 1501 |
+
task = self._tasks[task_id]
|
| 1502 |
+
task._reset()
|
| 1503 |
+
task.start_time = current_time if start else None
|
| 1504 |
+
if total is not None:
|
| 1505 |
+
task.total = total
|
| 1506 |
+
task.completed = completed
|
| 1507 |
+
if visible is not None:
|
| 1508 |
+
task.visible = visible
|
| 1509 |
+
if fields:
|
| 1510 |
+
task.fields = fields
|
| 1511 |
+
if description is not None:
|
| 1512 |
+
task.description = description
|
| 1513 |
+
task.finished_time = None
|
| 1514 |
+
self.refresh()
|
| 1515 |
+
|
| 1516 |
+
def advance(self, task_id: TaskID, advance: float = 1) -> None:
|
| 1517 |
+
"""Advance task by a number of steps.
|
| 1518 |
+
|
| 1519 |
+
Args:
|
| 1520 |
+
task_id (TaskID): ID of task.
|
| 1521 |
+
advance (float): Number of steps to advance. Default is 1.
|
| 1522 |
+
"""
|
| 1523 |
+
current_time = self.get_time()
|
| 1524 |
+
with self._lock:
|
| 1525 |
+
task = self._tasks[task_id]
|
| 1526 |
+
completed_start = task.completed
|
| 1527 |
+
task.completed += advance
|
| 1528 |
+
update_completed = task.completed - completed_start
|
| 1529 |
+
old_sample_time = current_time - self.speed_estimate_period
|
| 1530 |
+
_progress = task._progress
|
| 1531 |
+
|
| 1532 |
+
popleft = _progress.popleft
|
| 1533 |
+
while _progress and _progress[0].timestamp < old_sample_time:
|
| 1534 |
+
popleft()
|
| 1535 |
+
while len(_progress) > 1000:
|
| 1536 |
+
popleft()
|
| 1537 |
+
_progress.append(ProgressSample(current_time, update_completed))
|
| 1538 |
+
if (
|
| 1539 |
+
task.total is not None
|
| 1540 |
+
and task.completed >= task.total
|
| 1541 |
+
and task.finished_time is None
|
| 1542 |
+
):
|
| 1543 |
+
task.finished_time = task.elapsed
|
| 1544 |
+
task.finished_speed = task.speed
|
| 1545 |
+
|
| 1546 |
+
def refresh(self) -> None:
|
| 1547 |
+
"""Refresh (render) the progress information."""
|
| 1548 |
+
if not self.disable and self.live.is_started:
|
| 1549 |
+
self.live.refresh()
|
| 1550 |
+
|
| 1551 |
+
def get_renderable(self) -> RenderableType:
|
| 1552 |
+
"""Get a renderable for the progress display."""
|
| 1553 |
+
renderable = Group(*self.get_renderables())
|
| 1554 |
+
return renderable
|
| 1555 |
+
|
| 1556 |
+
def get_renderables(self) -> Iterable[RenderableType]:
|
| 1557 |
+
"""Get a number of renderables for the progress display."""
|
| 1558 |
+
table = self.make_tasks_table(self.tasks)
|
| 1559 |
+
yield table
|
| 1560 |
+
|
| 1561 |
+
def make_tasks_table(self, tasks: Iterable[Task]) -> Table:
|
| 1562 |
+
"""Get a table to render the Progress display.
|
| 1563 |
+
|
| 1564 |
+
Args:
|
| 1565 |
+
tasks (Iterable[Task]): An iterable of Task instances, one per row of the table.
|
| 1566 |
+
|
| 1567 |
+
Returns:
|
| 1568 |
+
Table: A table instance.
|
| 1569 |
+
"""
|
| 1570 |
+
table_columns = (
|
| 1571 |
+
(
|
| 1572 |
+
Column(no_wrap=True)
|
| 1573 |
+
if isinstance(_column, str)
|
| 1574 |
+
else _column.get_table_column().copy()
|
| 1575 |
+
)
|
| 1576 |
+
for _column in self.columns
|
| 1577 |
+
)
|
| 1578 |
+
table = Table.grid(*table_columns, padding=(0, 1), expand=self.expand)
|
| 1579 |
+
|
| 1580 |
+
for task in tasks:
|
| 1581 |
+
if task.visible:
|
| 1582 |
+
table.add_row(
|
| 1583 |
+
*(
|
| 1584 |
+
(
|
| 1585 |
+
column.format(task=task)
|
| 1586 |
+
if isinstance(column, str)
|
| 1587 |
+
else column(task)
|
| 1588 |
+
)
|
| 1589 |
+
for column in self.columns
|
| 1590 |
+
)
|
| 1591 |
+
)
|
| 1592 |
+
return table
|
| 1593 |
+
|
| 1594 |
+
def __rich__(self) -> RenderableType:
|
| 1595 |
+
"""Makes the Progress class itself renderable."""
|
| 1596 |
+
with self._lock:
|
| 1597 |
+
return self.get_renderable()
|
| 1598 |
+
|
| 1599 |
+
def add_task(
|
| 1600 |
+
self,
|
| 1601 |
+
description: str,
|
| 1602 |
+
start: bool = True,
|
| 1603 |
+
total: Optional[float] = 100.0,
|
| 1604 |
+
completed: int = 0,
|
| 1605 |
+
visible: bool = True,
|
| 1606 |
+
**fields: Any,
|
| 1607 |
+
) -> TaskID:
|
| 1608 |
+
"""Add a new 'task' to the Progress display.
|
| 1609 |
+
|
| 1610 |
+
Args:
|
| 1611 |
+
description (str): A description of the task.
|
| 1612 |
+
start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,
|
| 1613 |
+
you will need to call `start` manually. Defaults to True.
|
| 1614 |
+
total (float, optional): Number of total steps in the progress if known.
|
| 1615 |
+
Set to None to render a pulsing animation. Defaults to 100.
|
| 1616 |
+
completed (int, optional): Number of steps completed so far. Defaults to 0.
|
| 1617 |
+
visible (bool, optional): Enable display of the task. Defaults to True.
|
| 1618 |
+
**fields (str): Additional data fields required for rendering.
|
| 1619 |
+
|
| 1620 |
+
Returns:
|
| 1621 |
+
TaskID: An ID you can use when calling `update`.
|
| 1622 |
+
"""
|
| 1623 |
+
with self._lock:
|
| 1624 |
+
task = Task(
|
| 1625 |
+
self._task_index,
|
| 1626 |
+
description,
|
| 1627 |
+
total,
|
| 1628 |
+
completed,
|
| 1629 |
+
visible=visible,
|
| 1630 |
+
fields=fields,
|
| 1631 |
+
_get_time=self.get_time,
|
| 1632 |
+
_lock=self._lock,
|
| 1633 |
+
)
|
| 1634 |
+
self._tasks[self._task_index] = task
|
| 1635 |
+
if start:
|
| 1636 |
+
self.start_task(self._task_index)
|
| 1637 |
+
new_task_index = self._task_index
|
| 1638 |
+
self._task_index = TaskID(int(self._task_index) + 1)
|
| 1639 |
+
self.refresh()
|
| 1640 |
+
return new_task_index
|
| 1641 |
+
|
| 1642 |
+
def remove_task(self, task_id: TaskID) -> None:
|
| 1643 |
+
"""Delete a task if it exists.
|
| 1644 |
+
|
| 1645 |
+
Args:
|
| 1646 |
+
task_id (TaskID): A task ID.
|
| 1647 |
+
|
| 1648 |
+
"""
|
| 1649 |
+
with self._lock:
|
| 1650 |
+
del self._tasks[task_id]
|
| 1651 |
+
|
| 1652 |
+
|
| 1653 |
+
if __name__ == "__main__": # pragma: no coverage
|
| 1654 |
+
import random
|
| 1655 |
+
import time
|
| 1656 |
+
|
| 1657 |
+
from .panel import Panel
|
| 1658 |
+
from .rule import Rule
|
| 1659 |
+
from .syntax import Syntax
|
| 1660 |
+
from .table import Table
|
| 1661 |
+
|
| 1662 |
+
syntax = Syntax(
|
| 1663 |
+
'''def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
|
| 1664 |
+
"""Iterate and generate a tuple with a flag for last value."""
|
| 1665 |
+
iter_values = iter(values)
|
| 1666 |
+
try:
|
| 1667 |
+
previous_value = next(iter_values)
|
| 1668 |
+
except StopIteration:
|
| 1669 |
+
return
|
| 1670 |
+
for value in iter_values:
|
| 1671 |
+
yield False, previous_value
|
| 1672 |
+
previous_value = value
|
| 1673 |
+
yield True, previous_value''',
|
| 1674 |
+
"python",
|
| 1675 |
+
line_numbers=True,
|
| 1676 |
+
)
|
| 1677 |
+
|
| 1678 |
+
table = Table("foo", "bar", "baz")
|
| 1679 |
+
table.add_row("1", "2", "3")
|
| 1680 |
+
|
| 1681 |
+
progress_renderables = [
|
| 1682 |
+
"Text may be printed while the progress bars are rendering.",
|
| 1683 |
+
Panel("In fact, [i]any[/i] renderable will work"),
|
| 1684 |
+
"Such as [magenta]tables[/]...",
|
| 1685 |
+
table,
|
| 1686 |
+
"Pretty printed structures...",
|
| 1687 |
+
{"type": "example", "text": "Pretty printed"},
|
| 1688 |
+
"Syntax...",
|
| 1689 |
+
syntax,
|
| 1690 |
+
Rule("Give it a try!"),
|
| 1691 |
+
]
|
| 1692 |
+
|
| 1693 |
+
from itertools import cycle
|
| 1694 |
+
|
| 1695 |
+
examples = cycle(progress_renderables)
|
| 1696 |
+
|
| 1697 |
+
console = Console(record=True)
|
| 1698 |
+
|
| 1699 |
+
with Progress(
|
| 1700 |
+
SpinnerColumn(),
|
| 1701 |
+
*Progress.get_default_columns(),
|
| 1702 |
+
TimeElapsedColumn(),
|
| 1703 |
+
console=console,
|
| 1704 |
+
transient=False,
|
| 1705 |
+
) as progress:
|
| 1706 |
+
task1 = progress.add_task("[red]Downloading", total=1000)
|
| 1707 |
+
task2 = progress.add_task("[green]Processing", total=1000)
|
| 1708 |
+
task3 = progress.add_task("[yellow]Thinking", total=None)
|
| 1709 |
+
|
| 1710 |
+
while not progress.finished:
|
| 1711 |
+
progress.update(task1, advance=0.5)
|
| 1712 |
+
progress.update(task2, advance=0.3)
|
| 1713 |
+
time.sleep(0.01)
|
| 1714 |
+
if random.randint(0, 100) < 1:
|
| 1715 |
+
progress.log(next(examples))
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/progress_bar.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
from functools import lru_cache
|
| 3 |
+
from time import monotonic
|
| 4 |
+
from typing import Iterable, List, Optional
|
| 5 |
+
|
| 6 |
+
from .color import Color, blend_rgb
|
| 7 |
+
from .color_triplet import ColorTriplet
|
| 8 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 9 |
+
from .jupyter import JupyterMixin
|
| 10 |
+
from .measure import Measurement
|
| 11 |
+
from .segment import Segment
|
| 12 |
+
from .style import Style, StyleType
|
| 13 |
+
|
| 14 |
+
# Number of characters before 'pulse' animation repeats
|
| 15 |
+
PULSE_SIZE = 20
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class ProgressBar(JupyterMixin):
|
| 19 |
+
"""Renders a (progress) bar. Used by rich.progress.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
total (float, optional): Number of steps in the bar. Defaults to 100. Set to None to render a pulsing animation.
|
| 23 |
+
completed (float, optional): Number of steps completed. Defaults to 0.
|
| 24 |
+
width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None.
|
| 25 |
+
pulse (bool, optional): Enable pulse effect. Defaults to False. Will pulse if a None total was passed.
|
| 26 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 27 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 28 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 29 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 30 |
+
animation_time (Optional[float], optional): Time in seconds to use for animation, or None to use system time.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self,
|
| 35 |
+
total: Optional[float] = 100.0,
|
| 36 |
+
completed: float = 0,
|
| 37 |
+
width: Optional[int] = None,
|
| 38 |
+
pulse: bool = False,
|
| 39 |
+
style: StyleType = "bar.back",
|
| 40 |
+
complete_style: StyleType = "bar.complete",
|
| 41 |
+
finished_style: StyleType = "bar.finished",
|
| 42 |
+
pulse_style: StyleType = "bar.pulse",
|
| 43 |
+
animation_time: Optional[float] = None,
|
| 44 |
+
):
|
| 45 |
+
self.total = total
|
| 46 |
+
self.completed = completed
|
| 47 |
+
self.width = width
|
| 48 |
+
self.pulse = pulse
|
| 49 |
+
self.style = style
|
| 50 |
+
self.complete_style = complete_style
|
| 51 |
+
self.finished_style = finished_style
|
| 52 |
+
self.pulse_style = pulse_style
|
| 53 |
+
self.animation_time = animation_time
|
| 54 |
+
|
| 55 |
+
self._pulse_segments: Optional[List[Segment]] = None
|
| 56 |
+
|
| 57 |
+
def __repr__(self) -> str:
|
| 58 |
+
return f"<Bar {self.completed!r} of {self.total!r}>"
|
| 59 |
+
|
| 60 |
+
@property
|
| 61 |
+
def percentage_completed(self) -> Optional[float]:
|
| 62 |
+
"""Calculate percentage complete."""
|
| 63 |
+
if self.total is None:
|
| 64 |
+
return None
|
| 65 |
+
completed = (self.completed / self.total) * 100.0
|
| 66 |
+
completed = min(100, max(0.0, completed))
|
| 67 |
+
return completed
|
| 68 |
+
|
| 69 |
+
@lru_cache(maxsize=16)
|
| 70 |
+
def _get_pulse_segments(
|
| 71 |
+
self,
|
| 72 |
+
fore_style: Style,
|
| 73 |
+
back_style: Style,
|
| 74 |
+
color_system: str,
|
| 75 |
+
no_color: bool,
|
| 76 |
+
ascii: bool = False,
|
| 77 |
+
) -> List[Segment]:
|
| 78 |
+
"""Get a list of segments to render a pulse animation.
|
| 79 |
+
|
| 80 |
+
Returns:
|
| 81 |
+
List[Segment]: A list of segments, one segment per character.
|
| 82 |
+
"""
|
| 83 |
+
bar = "-" if ascii else "━"
|
| 84 |
+
segments: List[Segment] = []
|
| 85 |
+
if color_system not in ("standard", "eight_bit", "truecolor") or no_color:
|
| 86 |
+
segments += [Segment(bar, fore_style)] * (PULSE_SIZE // 2)
|
| 87 |
+
segments += [Segment(" " if no_color else bar, back_style)] * (
|
| 88 |
+
PULSE_SIZE - (PULSE_SIZE // 2)
|
| 89 |
+
)
|
| 90 |
+
return segments
|
| 91 |
+
|
| 92 |
+
append = segments.append
|
| 93 |
+
fore_color = (
|
| 94 |
+
fore_style.color.get_truecolor()
|
| 95 |
+
if fore_style.color
|
| 96 |
+
else ColorTriplet(255, 0, 255)
|
| 97 |
+
)
|
| 98 |
+
back_color = (
|
| 99 |
+
back_style.color.get_truecolor()
|
| 100 |
+
if back_style.color
|
| 101 |
+
else ColorTriplet(0, 0, 0)
|
| 102 |
+
)
|
| 103 |
+
cos = math.cos
|
| 104 |
+
pi = math.pi
|
| 105 |
+
_Segment = Segment
|
| 106 |
+
_Style = Style
|
| 107 |
+
from_triplet = Color.from_triplet
|
| 108 |
+
|
| 109 |
+
for index in range(PULSE_SIZE):
|
| 110 |
+
position = index / PULSE_SIZE
|
| 111 |
+
fade = 0.5 + cos(position * pi * 2) / 2.0
|
| 112 |
+
color = blend_rgb(fore_color, back_color, cross_fade=fade)
|
| 113 |
+
append(_Segment(bar, _Style(color=from_triplet(color))))
|
| 114 |
+
return segments
|
| 115 |
+
|
| 116 |
+
def update(self, completed: float, total: Optional[float] = None) -> None:
|
| 117 |
+
"""Update progress with new values.
|
| 118 |
+
|
| 119 |
+
Args:
|
| 120 |
+
completed (float): Number of steps completed.
|
| 121 |
+
total (float, optional): Total number of steps, or ``None`` to not change. Defaults to None.
|
| 122 |
+
"""
|
| 123 |
+
self.completed = completed
|
| 124 |
+
self.total = total if total is not None else self.total
|
| 125 |
+
|
| 126 |
+
def _render_pulse(
|
| 127 |
+
self, console: Console, width: int, ascii: bool = False
|
| 128 |
+
) -> Iterable[Segment]:
|
| 129 |
+
"""Renders the pulse animation.
|
| 130 |
+
|
| 131 |
+
Args:
|
| 132 |
+
console (Console): Console instance.
|
| 133 |
+
width (int): Width in characters of pulse animation.
|
| 134 |
+
|
| 135 |
+
Returns:
|
| 136 |
+
RenderResult: [description]
|
| 137 |
+
|
| 138 |
+
Yields:
|
| 139 |
+
Iterator[Segment]: Segments to render pulse
|
| 140 |
+
"""
|
| 141 |
+
fore_style = console.get_style(self.pulse_style, default="white")
|
| 142 |
+
back_style = console.get_style(self.style, default="black")
|
| 143 |
+
|
| 144 |
+
pulse_segments = self._get_pulse_segments(
|
| 145 |
+
fore_style, back_style, console.color_system, console.no_color, ascii=ascii
|
| 146 |
+
)
|
| 147 |
+
segment_count = len(pulse_segments)
|
| 148 |
+
current_time = (
|
| 149 |
+
monotonic() if self.animation_time is None else self.animation_time
|
| 150 |
+
)
|
| 151 |
+
segments = pulse_segments * (int(width / segment_count) + 2)
|
| 152 |
+
offset = int(-current_time * 15) % segment_count
|
| 153 |
+
segments = segments[offset : offset + width]
|
| 154 |
+
yield from segments
|
| 155 |
+
|
| 156 |
+
def __rich_console__(
|
| 157 |
+
self, console: Console, options: ConsoleOptions
|
| 158 |
+
) -> RenderResult:
|
| 159 |
+
width = min(self.width or options.max_width, options.max_width)
|
| 160 |
+
ascii = options.legacy_windows or options.ascii_only
|
| 161 |
+
should_pulse = self.pulse or self.total is None
|
| 162 |
+
if should_pulse:
|
| 163 |
+
yield from self._render_pulse(console, width, ascii=ascii)
|
| 164 |
+
return
|
| 165 |
+
|
| 166 |
+
completed: Optional[float] = (
|
| 167 |
+
min(self.total, max(0, self.completed)) if self.total is not None else None
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
bar = "-" if ascii else "━"
|
| 171 |
+
half_bar_right = " " if ascii else "╸"
|
| 172 |
+
half_bar_left = " " if ascii else "╺"
|
| 173 |
+
complete_halves = (
|
| 174 |
+
int(width * 2 * completed / self.total)
|
| 175 |
+
if self.total and completed is not None
|
| 176 |
+
else width * 2
|
| 177 |
+
)
|
| 178 |
+
bar_count = complete_halves // 2
|
| 179 |
+
half_bar_count = complete_halves % 2
|
| 180 |
+
style = console.get_style(self.style)
|
| 181 |
+
is_finished = self.total is None or self.completed >= self.total
|
| 182 |
+
complete_style = console.get_style(
|
| 183 |
+
self.finished_style if is_finished else self.complete_style
|
| 184 |
+
)
|
| 185 |
+
_Segment = Segment
|
| 186 |
+
if bar_count:
|
| 187 |
+
yield _Segment(bar * bar_count, complete_style)
|
| 188 |
+
if half_bar_count:
|
| 189 |
+
yield _Segment(half_bar_right * half_bar_count, complete_style)
|
| 190 |
+
|
| 191 |
+
if not console.no_color:
|
| 192 |
+
remaining_bars = width - bar_count - half_bar_count
|
| 193 |
+
if remaining_bars and console.color_system is not None:
|
| 194 |
+
if not half_bar_count and bar_count:
|
| 195 |
+
yield _Segment(half_bar_left, style)
|
| 196 |
+
remaining_bars -= 1
|
| 197 |
+
if remaining_bars:
|
| 198 |
+
yield _Segment(bar * remaining_bars, style)
|
| 199 |
+
|
| 200 |
+
def __rich_measure__(
|
| 201 |
+
self, console: Console, options: ConsoleOptions
|
| 202 |
+
) -> Measurement:
|
| 203 |
+
return (
|
| 204 |
+
Measurement(self.width, self.width)
|
| 205 |
+
if self.width is not None
|
| 206 |
+
else Measurement(4, options.max_width)
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
if __name__ == "__main__": # pragma: no cover
|
| 211 |
+
console = Console()
|
| 212 |
+
bar = ProgressBar(width=50, total=100)
|
| 213 |
+
|
| 214 |
+
import time
|
| 215 |
+
|
| 216 |
+
console.show_cursor(False)
|
| 217 |
+
for n in range(0, 101, 1):
|
| 218 |
+
bar.update(n)
|
| 219 |
+
console.print(bar)
|
| 220 |
+
console.file.write("\r")
|
| 221 |
+
time.sleep(0.05)
|
| 222 |
+
console.show_cursor(True)
|
| 223 |
+
console.print()
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/prompt.py
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Generic, List, Optional, TextIO, TypeVar, Union, overload
|
| 2 |
+
|
| 3 |
+
from . import get_console
|
| 4 |
+
from .console import Console
|
| 5 |
+
from .text import Text, TextType
|
| 6 |
+
|
| 7 |
+
PromptType = TypeVar("PromptType")
|
| 8 |
+
DefaultType = TypeVar("DefaultType")
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class PromptError(Exception):
|
| 12 |
+
"""Exception base class for prompt related errors."""
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class InvalidResponse(PromptError):
|
| 16 |
+
"""Exception to indicate a response was invalid. Raise this within process_response() to indicate an error
|
| 17 |
+
and provide an error message.
|
| 18 |
+
|
| 19 |
+
Args:
|
| 20 |
+
message (Union[str, Text]): Error message.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(self, message: TextType) -> None:
|
| 24 |
+
self.message = message
|
| 25 |
+
|
| 26 |
+
def __rich__(self) -> TextType:
|
| 27 |
+
return self.message
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class PromptBase(Generic[PromptType]):
|
| 31 |
+
"""Ask the user for input until a valid response is received. This is the base class, see one of
|
| 32 |
+
the concrete classes for examples.
|
| 33 |
+
|
| 34 |
+
Args:
|
| 35 |
+
prompt (TextType, optional): Prompt text. Defaults to "".
|
| 36 |
+
console (Console, optional): A Console instance or None to use global console. Defaults to None.
|
| 37 |
+
password (bool, optional): Enable password input. Defaults to False.
|
| 38 |
+
choices (List[str], optional): A list of valid choices. Defaults to None.
|
| 39 |
+
case_sensitive (bool, optional): Matching of choices should be case-sensitive. Defaults to True.
|
| 40 |
+
show_default (bool, optional): Show default in prompt. Defaults to True.
|
| 41 |
+
show_choices (bool, optional): Show choices in prompt. Defaults to True.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
response_type: type = str
|
| 45 |
+
|
| 46 |
+
validate_error_message = "[prompt.invalid]Please enter a valid value"
|
| 47 |
+
illegal_choice_message = (
|
| 48 |
+
"[prompt.invalid.choice]Please select one of the available options"
|
| 49 |
+
)
|
| 50 |
+
prompt_suffix = ": "
|
| 51 |
+
|
| 52 |
+
choices: Optional[List[str]] = None
|
| 53 |
+
|
| 54 |
+
def __init__(
|
| 55 |
+
self,
|
| 56 |
+
prompt: TextType = "",
|
| 57 |
+
*,
|
| 58 |
+
console: Optional[Console] = None,
|
| 59 |
+
password: bool = False,
|
| 60 |
+
choices: Optional[List[str]] = None,
|
| 61 |
+
case_sensitive: bool = True,
|
| 62 |
+
show_default: bool = True,
|
| 63 |
+
show_choices: bool = True,
|
| 64 |
+
) -> None:
|
| 65 |
+
self.console = console or get_console()
|
| 66 |
+
self.prompt = (
|
| 67 |
+
Text.from_markup(prompt, style="prompt")
|
| 68 |
+
if isinstance(prompt, str)
|
| 69 |
+
else prompt
|
| 70 |
+
)
|
| 71 |
+
self.password = password
|
| 72 |
+
if choices is not None:
|
| 73 |
+
self.choices = choices
|
| 74 |
+
self.case_sensitive = case_sensitive
|
| 75 |
+
self.show_default = show_default
|
| 76 |
+
self.show_choices = show_choices
|
| 77 |
+
|
| 78 |
+
@classmethod
|
| 79 |
+
@overload
|
| 80 |
+
def ask(
|
| 81 |
+
cls,
|
| 82 |
+
prompt: TextType = "",
|
| 83 |
+
*,
|
| 84 |
+
console: Optional[Console] = None,
|
| 85 |
+
password: bool = False,
|
| 86 |
+
choices: Optional[List[str]] = None,
|
| 87 |
+
case_sensitive: bool = True,
|
| 88 |
+
show_default: bool = True,
|
| 89 |
+
show_choices: bool = True,
|
| 90 |
+
default: DefaultType,
|
| 91 |
+
stream: Optional[TextIO] = None,
|
| 92 |
+
) -> Union[DefaultType, PromptType]:
|
| 93 |
+
...
|
| 94 |
+
|
| 95 |
+
@classmethod
|
| 96 |
+
@overload
|
| 97 |
+
def ask(
|
| 98 |
+
cls,
|
| 99 |
+
prompt: TextType = "",
|
| 100 |
+
*,
|
| 101 |
+
console: Optional[Console] = None,
|
| 102 |
+
password: bool = False,
|
| 103 |
+
choices: Optional[List[str]] = None,
|
| 104 |
+
case_sensitive: bool = True,
|
| 105 |
+
show_default: bool = True,
|
| 106 |
+
show_choices: bool = True,
|
| 107 |
+
stream: Optional[TextIO] = None,
|
| 108 |
+
) -> PromptType:
|
| 109 |
+
...
|
| 110 |
+
|
| 111 |
+
@classmethod
|
| 112 |
+
def ask(
|
| 113 |
+
cls,
|
| 114 |
+
prompt: TextType = "",
|
| 115 |
+
*,
|
| 116 |
+
console: Optional[Console] = None,
|
| 117 |
+
password: bool = False,
|
| 118 |
+
choices: Optional[List[str]] = None,
|
| 119 |
+
case_sensitive: bool = True,
|
| 120 |
+
show_default: bool = True,
|
| 121 |
+
show_choices: bool = True,
|
| 122 |
+
default: Any = ...,
|
| 123 |
+
stream: Optional[TextIO] = None,
|
| 124 |
+
) -> Any:
|
| 125 |
+
"""Shortcut to construct and run a prompt loop and return the result.
|
| 126 |
+
|
| 127 |
+
Example:
|
| 128 |
+
>>> filename = Prompt.ask("Enter a filename")
|
| 129 |
+
|
| 130 |
+
Args:
|
| 131 |
+
prompt (TextType, optional): Prompt text. Defaults to "".
|
| 132 |
+
console (Console, optional): A Console instance or None to use global console. Defaults to None.
|
| 133 |
+
password (bool, optional): Enable password input. Defaults to False.
|
| 134 |
+
choices (List[str], optional): A list of valid choices. Defaults to None.
|
| 135 |
+
case_sensitive (bool, optional): Matching of choices should be case-sensitive. Defaults to True.
|
| 136 |
+
show_default (bool, optional): Show default in prompt. Defaults to True.
|
| 137 |
+
show_choices (bool, optional): Show choices in prompt. Defaults to True.
|
| 138 |
+
stream (TextIO, optional): Optional text file open for reading to get input. Defaults to None.
|
| 139 |
+
"""
|
| 140 |
+
_prompt = cls(
|
| 141 |
+
prompt,
|
| 142 |
+
console=console,
|
| 143 |
+
password=password,
|
| 144 |
+
choices=choices,
|
| 145 |
+
case_sensitive=case_sensitive,
|
| 146 |
+
show_default=show_default,
|
| 147 |
+
show_choices=show_choices,
|
| 148 |
+
)
|
| 149 |
+
return _prompt(default=default, stream=stream)
|
| 150 |
+
|
| 151 |
+
def render_default(self, default: DefaultType) -> Text:
|
| 152 |
+
"""Turn the supplied default in to a Text instance.
|
| 153 |
+
|
| 154 |
+
Args:
|
| 155 |
+
default (DefaultType): Default value.
|
| 156 |
+
|
| 157 |
+
Returns:
|
| 158 |
+
Text: Text containing rendering of default value.
|
| 159 |
+
"""
|
| 160 |
+
return Text(f"({default})", "prompt.default")
|
| 161 |
+
|
| 162 |
+
def make_prompt(self, default: DefaultType) -> Text:
|
| 163 |
+
"""Make prompt text.
|
| 164 |
+
|
| 165 |
+
Args:
|
| 166 |
+
default (DefaultType): Default value.
|
| 167 |
+
|
| 168 |
+
Returns:
|
| 169 |
+
Text: Text to display in prompt.
|
| 170 |
+
"""
|
| 171 |
+
prompt = self.prompt.copy()
|
| 172 |
+
prompt.end = ""
|
| 173 |
+
|
| 174 |
+
if self.show_choices and self.choices:
|
| 175 |
+
_choices = "/".join(self.choices)
|
| 176 |
+
choices = f"[{_choices}]"
|
| 177 |
+
prompt.append(" ")
|
| 178 |
+
prompt.append(choices, "prompt.choices")
|
| 179 |
+
|
| 180 |
+
if (
|
| 181 |
+
default != ...
|
| 182 |
+
and self.show_default
|
| 183 |
+
and isinstance(default, (str, self.response_type))
|
| 184 |
+
):
|
| 185 |
+
prompt.append(" ")
|
| 186 |
+
_default = self.render_default(default)
|
| 187 |
+
prompt.append(_default)
|
| 188 |
+
|
| 189 |
+
prompt.append(self.prompt_suffix)
|
| 190 |
+
|
| 191 |
+
return prompt
|
| 192 |
+
|
| 193 |
+
@classmethod
|
| 194 |
+
def get_input(
|
| 195 |
+
cls,
|
| 196 |
+
console: Console,
|
| 197 |
+
prompt: TextType,
|
| 198 |
+
password: bool,
|
| 199 |
+
stream: Optional[TextIO] = None,
|
| 200 |
+
) -> str:
|
| 201 |
+
"""Get input from user.
|
| 202 |
+
|
| 203 |
+
Args:
|
| 204 |
+
console (Console): Console instance.
|
| 205 |
+
prompt (TextType): Prompt text.
|
| 206 |
+
password (bool): Enable password entry.
|
| 207 |
+
|
| 208 |
+
Returns:
|
| 209 |
+
str: String from user.
|
| 210 |
+
"""
|
| 211 |
+
return console.input(prompt, password=password, stream=stream)
|
| 212 |
+
|
| 213 |
+
def check_choice(self, value: str) -> bool:
|
| 214 |
+
"""Check value is in the list of valid choices.
|
| 215 |
+
|
| 216 |
+
Args:
|
| 217 |
+
value (str): Value entered by user.
|
| 218 |
+
|
| 219 |
+
Returns:
|
| 220 |
+
bool: True if choice was valid, otherwise False.
|
| 221 |
+
"""
|
| 222 |
+
assert self.choices is not None
|
| 223 |
+
if self.case_sensitive:
|
| 224 |
+
return value.strip() in self.choices
|
| 225 |
+
return value.strip().lower() in [choice.lower() for choice in self.choices]
|
| 226 |
+
|
| 227 |
+
def process_response(self, value: str) -> PromptType:
|
| 228 |
+
"""Process response from user, convert to prompt type.
|
| 229 |
+
|
| 230 |
+
Args:
|
| 231 |
+
value (str): String typed by user.
|
| 232 |
+
|
| 233 |
+
Raises:
|
| 234 |
+
InvalidResponse: If ``value`` is invalid.
|
| 235 |
+
|
| 236 |
+
Returns:
|
| 237 |
+
PromptType: The value to be returned from ask method.
|
| 238 |
+
"""
|
| 239 |
+
value = value.strip()
|
| 240 |
+
try:
|
| 241 |
+
return_value: PromptType = self.response_type(value)
|
| 242 |
+
except ValueError:
|
| 243 |
+
raise InvalidResponse(self.validate_error_message)
|
| 244 |
+
|
| 245 |
+
if self.choices is not None:
|
| 246 |
+
if not self.check_choice(value):
|
| 247 |
+
raise InvalidResponse(self.illegal_choice_message)
|
| 248 |
+
|
| 249 |
+
if not self.case_sensitive:
|
| 250 |
+
# return the original choice, not the lower case version
|
| 251 |
+
return_value = self.response_type(
|
| 252 |
+
self.choices[
|
| 253 |
+
[choice.lower() for choice in self.choices].index(value.lower())
|
| 254 |
+
]
|
| 255 |
+
)
|
| 256 |
+
return return_value
|
| 257 |
+
|
| 258 |
+
def on_validate_error(self, value: str, error: InvalidResponse) -> None:
|
| 259 |
+
"""Called to handle validation error.
|
| 260 |
+
|
| 261 |
+
Args:
|
| 262 |
+
value (str): String entered by user.
|
| 263 |
+
error (InvalidResponse): Exception instance the initiated the error.
|
| 264 |
+
"""
|
| 265 |
+
self.console.print(error)
|
| 266 |
+
|
| 267 |
+
def pre_prompt(self) -> None:
|
| 268 |
+
"""Hook to display something before the prompt."""
|
| 269 |
+
|
| 270 |
+
@overload
|
| 271 |
+
def __call__(self, *, stream: Optional[TextIO] = None) -> PromptType:
|
| 272 |
+
...
|
| 273 |
+
|
| 274 |
+
@overload
|
| 275 |
+
def __call__(
|
| 276 |
+
self, *, default: DefaultType, stream: Optional[TextIO] = None
|
| 277 |
+
) -> Union[PromptType, DefaultType]:
|
| 278 |
+
...
|
| 279 |
+
|
| 280 |
+
def __call__(self, *, default: Any = ..., stream: Optional[TextIO] = None) -> Any:
|
| 281 |
+
"""Run the prompt loop.
|
| 282 |
+
|
| 283 |
+
Args:
|
| 284 |
+
default (Any, optional): Optional default value.
|
| 285 |
+
|
| 286 |
+
Returns:
|
| 287 |
+
PromptType: Processed value.
|
| 288 |
+
"""
|
| 289 |
+
while True:
|
| 290 |
+
self.pre_prompt()
|
| 291 |
+
prompt = self.make_prompt(default)
|
| 292 |
+
value = self.get_input(self.console, prompt, self.password, stream=stream)
|
| 293 |
+
if value == "" and default != ...:
|
| 294 |
+
return default
|
| 295 |
+
try:
|
| 296 |
+
return_value = self.process_response(value)
|
| 297 |
+
except InvalidResponse as error:
|
| 298 |
+
self.on_validate_error(value, error)
|
| 299 |
+
continue
|
| 300 |
+
else:
|
| 301 |
+
return return_value
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
class Prompt(PromptBase[str]):
|
| 305 |
+
"""A prompt that returns a str.
|
| 306 |
+
|
| 307 |
+
Example:
|
| 308 |
+
>>> name = Prompt.ask("Enter your name")
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
"""
|
| 312 |
+
|
| 313 |
+
response_type = str
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
class IntPrompt(PromptBase[int]):
|
| 317 |
+
"""A prompt that returns an integer.
|
| 318 |
+
|
| 319 |
+
Example:
|
| 320 |
+
>>> burrito_count = IntPrompt.ask("How many burritos do you want to order")
|
| 321 |
+
|
| 322 |
+
"""
|
| 323 |
+
|
| 324 |
+
response_type = int
|
| 325 |
+
validate_error_message = "[prompt.invalid]Please enter a valid integer number"
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
class FloatPrompt(PromptBase[float]):
|
| 329 |
+
"""A prompt that returns a float.
|
| 330 |
+
|
| 331 |
+
Example:
|
| 332 |
+
>>> temperature = FloatPrompt.ask("Enter desired temperature")
|
| 333 |
+
|
| 334 |
+
"""
|
| 335 |
+
|
| 336 |
+
response_type = float
|
| 337 |
+
validate_error_message = "[prompt.invalid]Please enter a number"
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
class Confirm(PromptBase[bool]):
|
| 341 |
+
"""A yes / no confirmation prompt.
|
| 342 |
+
|
| 343 |
+
Example:
|
| 344 |
+
>>> if Confirm.ask("Continue"):
|
| 345 |
+
run_job()
|
| 346 |
+
|
| 347 |
+
"""
|
| 348 |
+
|
| 349 |
+
response_type = bool
|
| 350 |
+
validate_error_message = "[prompt.invalid]Please enter Y or N"
|
| 351 |
+
choices: List[str] = ["y", "n"]
|
| 352 |
+
|
| 353 |
+
def render_default(self, default: DefaultType) -> Text:
|
| 354 |
+
"""Render the default as (y) or (n) rather than True/False."""
|
| 355 |
+
yes, no = self.choices
|
| 356 |
+
return Text(f"({yes})" if default else f"({no})", style="prompt.default")
|
| 357 |
+
|
| 358 |
+
def process_response(self, value: str) -> bool:
|
| 359 |
+
"""Convert choices to a bool."""
|
| 360 |
+
value = value.strip().lower()
|
| 361 |
+
if value not in self.choices:
|
| 362 |
+
raise InvalidResponse(self.validate_error_message)
|
| 363 |
+
return value == self.choices[0]
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
if __name__ == "__main__": # pragma: no cover
|
| 367 |
+
from pip._vendor.rich import print
|
| 368 |
+
|
| 369 |
+
if Confirm.ask("Run [i]prompt[/i] tests?", default=True):
|
| 370 |
+
while True:
|
| 371 |
+
result = IntPrompt.ask(
|
| 372 |
+
":rocket: Enter a number between [b]1[/b] and [b]10[/b]", default=5
|
| 373 |
+
)
|
| 374 |
+
if result >= 1 and result <= 10:
|
| 375 |
+
break
|
| 376 |
+
print(":pile_of_poo: [prompt.invalid]Number must be between 1 and 10")
|
| 377 |
+
print(f"number={result}")
|
| 378 |
+
|
| 379 |
+
while True:
|
| 380 |
+
password = Prompt.ask(
|
| 381 |
+
"Please enter a password [cyan](must be at least 5 characters)",
|
| 382 |
+
password=True,
|
| 383 |
+
)
|
| 384 |
+
if len(password) >= 5:
|
| 385 |
+
break
|
| 386 |
+
print("[prompt.invalid]password too short")
|
| 387 |
+
print(f"password={password!r}")
|
| 388 |
+
|
| 389 |
+
fruit = Prompt.ask("Enter a fruit", choices=["apple", "orange", "pear"])
|
| 390 |
+
print(f"fruit={fruit!r}")
|
| 391 |
+
|
| 392 |
+
doggie = Prompt.ask(
|
| 393 |
+
"What's the best Dog? (Case INSENSITIVE)",
|
| 394 |
+
choices=["Border Terrier", "Collie", "Labradoodle"],
|
| 395 |
+
case_sensitive=False,
|
| 396 |
+
)
|
| 397 |
+
print(f"doggie={doggie!r}")
|
| 398 |
+
|
| 399 |
+
else:
|
| 400 |
+
print("[b]OK :loudly_crying_face:")
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/protocol.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, cast, Set, TYPE_CHECKING
|
| 2 |
+
from inspect import isclass
|
| 3 |
+
|
| 4 |
+
if TYPE_CHECKING:
|
| 5 |
+
from pip._vendor.rich.console import RenderableType
|
| 6 |
+
|
| 7 |
+
_GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def is_renderable(check_object: Any) -> bool:
|
| 11 |
+
"""Check if an object may be rendered by Rich."""
|
| 12 |
+
return (
|
| 13 |
+
isinstance(check_object, str)
|
| 14 |
+
or hasattr(check_object, "__rich__")
|
| 15 |
+
or hasattr(check_object, "__rich_console__")
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def rich_cast(renderable: object) -> "RenderableType":
|
| 20 |
+
"""Cast an object to a renderable by calling __rich__ if present.
|
| 21 |
+
|
| 22 |
+
Args:
|
| 23 |
+
renderable (object): A potentially renderable object
|
| 24 |
+
|
| 25 |
+
Returns:
|
| 26 |
+
object: The result of recursively calling __rich__.
|
| 27 |
+
"""
|
| 28 |
+
from pip._vendor.rich.console import RenderableType
|
| 29 |
+
|
| 30 |
+
rich_visited_set: Set[type] = set() # Prevent potential infinite loop
|
| 31 |
+
while hasattr(renderable, "__rich__") and not isclass(renderable):
|
| 32 |
+
# Detect object which claim to have all the attributes
|
| 33 |
+
if hasattr(renderable, _GIBBERISH):
|
| 34 |
+
return repr(renderable)
|
| 35 |
+
cast_method = getattr(renderable, "__rich__")
|
| 36 |
+
renderable = cast_method()
|
| 37 |
+
renderable_type = type(renderable)
|
| 38 |
+
if renderable_type in rich_visited_set:
|
| 39 |
+
break
|
| 40 |
+
rich_visited_set.add(renderable_type)
|
| 41 |
+
|
| 42 |
+
return cast(RenderableType, renderable)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/py.typed
ADDED
|
File without changes
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/region.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import NamedTuple
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class Region(NamedTuple):
|
| 5 |
+
"""Defines a rectangular region of the screen."""
|
| 6 |
+
|
| 7 |
+
x: int
|
| 8 |
+
y: int
|
| 9 |
+
width: int
|
| 10 |
+
height: int
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/repr.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
from functools import partial
|
| 3 |
+
from typing import (
|
| 4 |
+
Any,
|
| 5 |
+
Callable,
|
| 6 |
+
Iterable,
|
| 7 |
+
List,
|
| 8 |
+
Optional,
|
| 9 |
+
Tuple,
|
| 10 |
+
Type,
|
| 11 |
+
TypeVar,
|
| 12 |
+
Union,
|
| 13 |
+
overload,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
T = TypeVar("T")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
Result = Iterable[Union[Any, Tuple[Any], Tuple[str, Any], Tuple[str, Any, Any]]]
|
| 20 |
+
RichReprResult = Result
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class ReprError(Exception):
|
| 24 |
+
"""An error occurred when attempting to build a repr."""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@overload
|
| 28 |
+
def auto(cls: Optional[Type[T]]) -> Type[T]:
|
| 29 |
+
...
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
@overload
|
| 33 |
+
def auto(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 34 |
+
...
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def auto(
|
| 38 |
+
cls: Optional[Type[T]] = None, *, angular: Optional[bool] = None
|
| 39 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 40 |
+
"""Class decorator to create __repr__ from __rich_repr__"""
|
| 41 |
+
|
| 42 |
+
def do_replace(cls: Type[T], angular: Optional[bool] = None) -> Type[T]:
|
| 43 |
+
def auto_repr(self: T) -> str:
|
| 44 |
+
"""Create repr string from __rich_repr__"""
|
| 45 |
+
repr_str: List[str] = []
|
| 46 |
+
append = repr_str.append
|
| 47 |
+
|
| 48 |
+
angular: bool = getattr(self.__rich_repr__, "angular", False) # type: ignore[attr-defined]
|
| 49 |
+
for arg in self.__rich_repr__(): # type: ignore[attr-defined]
|
| 50 |
+
if isinstance(arg, tuple):
|
| 51 |
+
if len(arg) == 1:
|
| 52 |
+
append(repr(arg[0]))
|
| 53 |
+
else:
|
| 54 |
+
key, value, *default = arg
|
| 55 |
+
if key is None:
|
| 56 |
+
append(repr(value))
|
| 57 |
+
else:
|
| 58 |
+
if default and default[0] == value:
|
| 59 |
+
continue
|
| 60 |
+
append(f"{key}={value!r}")
|
| 61 |
+
else:
|
| 62 |
+
append(repr(arg))
|
| 63 |
+
if angular:
|
| 64 |
+
return f"<{self.__class__.__name__} {' '.join(repr_str)}>"
|
| 65 |
+
else:
|
| 66 |
+
return f"{self.__class__.__name__}({', '.join(repr_str)})"
|
| 67 |
+
|
| 68 |
+
def auto_rich_repr(self: Type[T]) -> Result:
|
| 69 |
+
"""Auto generate __rich_rep__ from signature of __init__"""
|
| 70 |
+
try:
|
| 71 |
+
signature = inspect.signature(self.__init__)
|
| 72 |
+
for name, param in signature.parameters.items():
|
| 73 |
+
if param.kind == param.POSITIONAL_ONLY:
|
| 74 |
+
yield getattr(self, name)
|
| 75 |
+
elif param.kind in (
|
| 76 |
+
param.POSITIONAL_OR_KEYWORD,
|
| 77 |
+
param.KEYWORD_ONLY,
|
| 78 |
+
):
|
| 79 |
+
if param.default is param.empty:
|
| 80 |
+
yield getattr(self, param.name)
|
| 81 |
+
else:
|
| 82 |
+
yield param.name, getattr(self, param.name), param.default
|
| 83 |
+
except Exception as error:
|
| 84 |
+
raise ReprError(
|
| 85 |
+
f"Failed to auto generate __rich_repr__; {error}"
|
| 86 |
+
) from None
|
| 87 |
+
|
| 88 |
+
if not hasattr(cls, "__rich_repr__"):
|
| 89 |
+
auto_rich_repr.__doc__ = "Build a rich repr"
|
| 90 |
+
cls.__rich_repr__ = auto_rich_repr # type: ignore[attr-defined]
|
| 91 |
+
|
| 92 |
+
auto_repr.__doc__ = "Return repr(self)"
|
| 93 |
+
cls.__repr__ = auto_repr # type: ignore[assignment]
|
| 94 |
+
if angular is not None:
|
| 95 |
+
cls.__rich_repr__.angular = angular # type: ignore[attr-defined]
|
| 96 |
+
return cls
|
| 97 |
+
|
| 98 |
+
if cls is None:
|
| 99 |
+
return partial(do_replace, angular=angular)
|
| 100 |
+
else:
|
| 101 |
+
return do_replace(cls, angular=angular)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@overload
|
| 105 |
+
def rich_repr(cls: Optional[Type[T]]) -> Type[T]:
|
| 106 |
+
...
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
@overload
|
| 110 |
+
def rich_repr(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 111 |
+
...
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def rich_repr(
|
| 115 |
+
cls: Optional[Type[T]] = None, *, angular: bool = False
|
| 116 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 117 |
+
if cls is None:
|
| 118 |
+
return auto(angular=angular)
|
| 119 |
+
else:
|
| 120 |
+
return auto(cls)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
if __name__ == "__main__":
|
| 124 |
+
|
| 125 |
+
@auto
|
| 126 |
+
class Foo:
|
| 127 |
+
def __rich_repr__(self) -> Result:
|
| 128 |
+
yield "foo"
|
| 129 |
+
yield "bar", {"shopping": ["eggs", "ham", "pineapple"]}
|
| 130 |
+
yield "buy", "hand sanitizer"
|
| 131 |
+
|
| 132 |
+
foo = Foo()
|
| 133 |
+
from pip._vendor.rich.console import Console
|
| 134 |
+
|
| 135 |
+
console = Console()
|
| 136 |
+
|
| 137 |
+
console.rule("Standard repr")
|
| 138 |
+
console.print(foo)
|
| 139 |
+
|
| 140 |
+
console.print(foo, width=60)
|
| 141 |
+
console.print(foo, width=30)
|
| 142 |
+
|
| 143 |
+
console.rule("Angular repr")
|
| 144 |
+
Foo.__rich_repr__.angular = True # type: ignore[attr-defined]
|
| 145 |
+
|
| 146 |
+
console.print(foo)
|
| 147 |
+
|
| 148 |
+
console.print(foo, width=60)
|
| 149 |
+
console.print(foo, width=30)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/rule.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Union
|
| 2 |
+
|
| 3 |
+
from .align import AlignMethod
|
| 4 |
+
from .cells import cell_len, set_cell_size
|
| 5 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 6 |
+
from .jupyter import JupyterMixin
|
| 7 |
+
from .measure import Measurement
|
| 8 |
+
from .style import Style
|
| 9 |
+
from .text import Text
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Rule(JupyterMixin):
|
| 13 |
+
"""A console renderable to draw a horizontal rule (line).
|
| 14 |
+
|
| 15 |
+
Args:
|
| 16 |
+
title (Union[str, Text], optional): Text to render in the rule. Defaults to "".
|
| 17 |
+
characters (str, optional): Character(s) used to draw the line. Defaults to "─".
|
| 18 |
+
style (StyleType, optional): Style of Rule. Defaults to "rule.line".
|
| 19 |
+
end (str, optional): Character at end of Rule. defaults to "\\\\n"
|
| 20 |
+
align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center".
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
title: Union[str, Text] = "",
|
| 26 |
+
*,
|
| 27 |
+
characters: str = "─",
|
| 28 |
+
style: Union[str, Style] = "rule.line",
|
| 29 |
+
end: str = "\n",
|
| 30 |
+
align: AlignMethod = "center",
|
| 31 |
+
) -> None:
|
| 32 |
+
if cell_len(characters) < 1:
|
| 33 |
+
raise ValueError(
|
| 34 |
+
"'characters' argument must have a cell width of at least 1"
|
| 35 |
+
)
|
| 36 |
+
if align not in ("left", "center", "right"):
|
| 37 |
+
raise ValueError(
|
| 38 |
+
f'invalid value for align, expected "left", "center", "right" (not {align!r})'
|
| 39 |
+
)
|
| 40 |
+
self.title = title
|
| 41 |
+
self.characters = characters
|
| 42 |
+
self.style = style
|
| 43 |
+
self.end = end
|
| 44 |
+
self.align = align
|
| 45 |
+
|
| 46 |
+
def __repr__(self) -> str:
|
| 47 |
+
return f"Rule({self.title!r}, {self.characters!r})"
|
| 48 |
+
|
| 49 |
+
def __rich_console__(
|
| 50 |
+
self, console: Console, options: ConsoleOptions
|
| 51 |
+
) -> RenderResult:
|
| 52 |
+
width = options.max_width
|
| 53 |
+
|
| 54 |
+
characters = (
|
| 55 |
+
"-"
|
| 56 |
+
if (options.ascii_only and not self.characters.isascii())
|
| 57 |
+
else self.characters
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
chars_len = cell_len(characters)
|
| 61 |
+
if not self.title:
|
| 62 |
+
yield self._rule_line(chars_len, width)
|
| 63 |
+
return
|
| 64 |
+
|
| 65 |
+
if isinstance(self.title, Text):
|
| 66 |
+
title_text = self.title
|
| 67 |
+
else:
|
| 68 |
+
title_text = console.render_str(self.title, style="rule.text")
|
| 69 |
+
|
| 70 |
+
title_text.plain = title_text.plain.replace("\n", " ")
|
| 71 |
+
title_text.expand_tabs()
|
| 72 |
+
|
| 73 |
+
required_space = 4 if self.align == "center" else 2
|
| 74 |
+
truncate_width = max(0, width - required_space)
|
| 75 |
+
if not truncate_width:
|
| 76 |
+
yield self._rule_line(chars_len, width)
|
| 77 |
+
return
|
| 78 |
+
|
| 79 |
+
rule_text = Text(end=self.end)
|
| 80 |
+
if self.align == "center":
|
| 81 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 82 |
+
side_width = (width - cell_len(title_text.plain)) // 2
|
| 83 |
+
left = Text(characters * (side_width // chars_len + 1))
|
| 84 |
+
left.truncate(side_width - 1)
|
| 85 |
+
right_length = width - cell_len(left.plain) - cell_len(title_text.plain)
|
| 86 |
+
right = Text(characters * (side_width // chars_len + 1))
|
| 87 |
+
right.truncate(right_length)
|
| 88 |
+
rule_text.append(left.plain + " ", self.style)
|
| 89 |
+
rule_text.append(title_text)
|
| 90 |
+
rule_text.append(" " + right.plain, self.style)
|
| 91 |
+
elif self.align == "left":
|
| 92 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 93 |
+
rule_text.append(title_text)
|
| 94 |
+
rule_text.append(" ")
|
| 95 |
+
rule_text.append(characters * (width - rule_text.cell_len), self.style)
|
| 96 |
+
elif self.align == "right":
|
| 97 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 98 |
+
rule_text.append(characters * (width - title_text.cell_len - 1), self.style)
|
| 99 |
+
rule_text.append(" ")
|
| 100 |
+
rule_text.append(title_text)
|
| 101 |
+
|
| 102 |
+
rule_text.plain = set_cell_size(rule_text.plain, width)
|
| 103 |
+
yield rule_text
|
| 104 |
+
|
| 105 |
+
def _rule_line(self, chars_len: int, width: int) -> Text:
|
| 106 |
+
rule_text = Text(self.characters * ((width // chars_len) + 1), self.style)
|
| 107 |
+
rule_text.truncate(width)
|
| 108 |
+
rule_text.plain = set_cell_size(rule_text.plain, width)
|
| 109 |
+
return rule_text
|
| 110 |
+
|
| 111 |
+
def __rich_measure__(
|
| 112 |
+
self, console: Console, options: ConsoleOptions
|
| 113 |
+
) -> Measurement:
|
| 114 |
+
return Measurement(1, 1)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
if __name__ == "__main__": # pragma: no cover
|
| 118 |
+
import sys
|
| 119 |
+
|
| 120 |
+
from pip._vendor.rich.console import Console
|
| 121 |
+
|
| 122 |
+
try:
|
| 123 |
+
text = sys.argv[1]
|
| 124 |
+
except IndexError:
|
| 125 |
+
text = "Hello, World"
|
| 126 |
+
console = Console()
|
| 127 |
+
console.print(Rule(title=text))
|
| 128 |
+
|
| 129 |
+
console = Console()
|
| 130 |
+
console.print(Rule("foo"), width=4)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/scope.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Mapping
|
| 2 |
+
from typing import TYPE_CHECKING, Any, Optional, Tuple
|
| 3 |
+
|
| 4 |
+
from .highlighter import ReprHighlighter
|
| 5 |
+
from .panel import Panel
|
| 6 |
+
from .pretty import Pretty
|
| 7 |
+
from .table import Table
|
| 8 |
+
from .text import Text, TextType
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from .console import ConsoleRenderable
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def render_scope(
|
| 15 |
+
scope: "Mapping[str, Any]",
|
| 16 |
+
*,
|
| 17 |
+
title: Optional[TextType] = None,
|
| 18 |
+
sort_keys: bool = True,
|
| 19 |
+
indent_guides: bool = False,
|
| 20 |
+
max_length: Optional[int] = None,
|
| 21 |
+
max_string: Optional[int] = None,
|
| 22 |
+
) -> "ConsoleRenderable":
|
| 23 |
+
"""Render python variables in a given scope.
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
scope (Mapping): A mapping containing variable names and values.
|
| 27 |
+
title (str, optional): Optional title. Defaults to None.
|
| 28 |
+
sort_keys (bool, optional): Enable sorting of items. Defaults to True.
|
| 29 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 30 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 31 |
+
Defaults to None.
|
| 32 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 33 |
+
|
| 34 |
+
Returns:
|
| 35 |
+
ConsoleRenderable: A renderable object.
|
| 36 |
+
"""
|
| 37 |
+
highlighter = ReprHighlighter()
|
| 38 |
+
items_table = Table.grid(padding=(0, 1), expand=False)
|
| 39 |
+
items_table.add_column(justify="right")
|
| 40 |
+
|
| 41 |
+
def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]:
|
| 42 |
+
"""Sort special variables first, then alphabetically."""
|
| 43 |
+
key, _ = item
|
| 44 |
+
return (not key.startswith("__"), key.lower())
|
| 45 |
+
|
| 46 |
+
items = sorted(scope.items(), key=sort_items) if sort_keys else scope.items()
|
| 47 |
+
for key, value in items:
|
| 48 |
+
key_text = Text.assemble(
|
| 49 |
+
(key, "scope.key.special" if key.startswith("__") else "scope.key"),
|
| 50 |
+
(" =", "scope.equals"),
|
| 51 |
+
)
|
| 52 |
+
items_table.add_row(
|
| 53 |
+
key_text,
|
| 54 |
+
Pretty(
|
| 55 |
+
value,
|
| 56 |
+
highlighter=highlighter,
|
| 57 |
+
indent_guides=indent_guides,
|
| 58 |
+
max_length=max_length,
|
| 59 |
+
max_string=max_string,
|
| 60 |
+
),
|
| 61 |
+
)
|
| 62 |
+
return Panel.fit(
|
| 63 |
+
items_table,
|
| 64 |
+
title=title,
|
| 65 |
+
border_style="scope.border",
|
| 66 |
+
padding=(0, 1),
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
if __name__ == "__main__": # pragma: no cover
|
| 71 |
+
from pip._vendor.rich import print
|
| 72 |
+
|
| 73 |
+
print()
|
| 74 |
+
|
| 75 |
+
def test(foo: float, bar: float) -> None:
|
| 76 |
+
list_of_things = [1, 2, 3, None, 4, True, False, "Hello World"]
|
| 77 |
+
dict_of_things = {
|
| 78 |
+
"version": "1.1",
|
| 79 |
+
"method": "confirmFruitPurchase",
|
| 80 |
+
"params": [["apple", "orange", "mangoes", "pomelo"], 1.123],
|
| 81 |
+
"id": "194521489",
|
| 82 |
+
}
|
| 83 |
+
print(render_scope(locals(), title="[i]locals", sort_keys=False))
|
| 84 |
+
|
| 85 |
+
test(20.3423, 3.1427)
|
| 86 |
+
print()
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/screen.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, TYPE_CHECKING
|
| 2 |
+
|
| 3 |
+
from .segment import Segment
|
| 4 |
+
from .style import StyleType
|
| 5 |
+
from ._loop import loop_last
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if TYPE_CHECKING:
|
| 9 |
+
from .console import (
|
| 10 |
+
Console,
|
| 11 |
+
ConsoleOptions,
|
| 12 |
+
RenderResult,
|
| 13 |
+
RenderableType,
|
| 14 |
+
Group,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class Screen:
|
| 19 |
+
"""A renderable that fills the terminal screen and crops excess.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
renderable (RenderableType): Child renderable.
|
| 23 |
+
style (StyleType, optional): Optional background style. Defaults to None.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
renderable: "RenderableType"
|
| 27 |
+
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
*renderables: "RenderableType",
|
| 31 |
+
style: Optional[StyleType] = None,
|
| 32 |
+
application_mode: bool = False,
|
| 33 |
+
) -> None:
|
| 34 |
+
from pip._vendor.rich.console import Group
|
| 35 |
+
|
| 36 |
+
self.renderable = Group(*renderables)
|
| 37 |
+
self.style = style
|
| 38 |
+
self.application_mode = application_mode
|
| 39 |
+
|
| 40 |
+
def __rich_console__(
|
| 41 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 42 |
+
) -> "RenderResult":
|
| 43 |
+
width, height = options.size
|
| 44 |
+
style = console.get_style(self.style) if self.style else None
|
| 45 |
+
render_options = options.update(width=width, height=height)
|
| 46 |
+
lines = console.render_lines(
|
| 47 |
+
self.renderable or "", render_options, style=style, pad=True
|
| 48 |
+
)
|
| 49 |
+
lines = Segment.set_shape(lines, width, height, style=style)
|
| 50 |
+
new_line = Segment("\n\r") if self.application_mode else Segment.line()
|
| 51 |
+
for last, line in loop_last(lines):
|
| 52 |
+
yield from line
|
| 53 |
+
if not last:
|
| 54 |
+
yield new_line
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/segment.py
ADDED
|
@@ -0,0 +1,752 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import IntEnum
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from itertools import filterfalse
|
| 4 |
+
from logging import getLogger
|
| 5 |
+
from operator import attrgetter
|
| 6 |
+
from typing import (
|
| 7 |
+
TYPE_CHECKING,
|
| 8 |
+
Dict,
|
| 9 |
+
Iterable,
|
| 10 |
+
List,
|
| 11 |
+
NamedTuple,
|
| 12 |
+
Optional,
|
| 13 |
+
Sequence,
|
| 14 |
+
Tuple,
|
| 15 |
+
Type,
|
| 16 |
+
Union,
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
from .cells import (
|
| 20 |
+
_is_single_cell_widths,
|
| 21 |
+
cached_cell_len,
|
| 22 |
+
cell_len,
|
| 23 |
+
get_character_cell_size,
|
| 24 |
+
set_cell_size,
|
| 25 |
+
)
|
| 26 |
+
from .repr import Result, rich_repr
|
| 27 |
+
from .style import Style
|
| 28 |
+
|
| 29 |
+
if TYPE_CHECKING:
|
| 30 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 31 |
+
|
| 32 |
+
log = getLogger("rich")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class ControlType(IntEnum):
|
| 36 |
+
"""Non-printable control codes which typically translate to ANSI codes."""
|
| 37 |
+
|
| 38 |
+
BELL = 1
|
| 39 |
+
CARRIAGE_RETURN = 2
|
| 40 |
+
HOME = 3
|
| 41 |
+
CLEAR = 4
|
| 42 |
+
SHOW_CURSOR = 5
|
| 43 |
+
HIDE_CURSOR = 6
|
| 44 |
+
ENABLE_ALT_SCREEN = 7
|
| 45 |
+
DISABLE_ALT_SCREEN = 8
|
| 46 |
+
CURSOR_UP = 9
|
| 47 |
+
CURSOR_DOWN = 10
|
| 48 |
+
CURSOR_FORWARD = 11
|
| 49 |
+
CURSOR_BACKWARD = 12
|
| 50 |
+
CURSOR_MOVE_TO_COLUMN = 13
|
| 51 |
+
CURSOR_MOVE_TO = 14
|
| 52 |
+
ERASE_IN_LINE = 15
|
| 53 |
+
SET_WINDOW_TITLE = 16
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
ControlCode = Union[
|
| 57 |
+
Tuple[ControlType],
|
| 58 |
+
Tuple[ControlType, Union[int, str]],
|
| 59 |
+
Tuple[ControlType, int, int],
|
| 60 |
+
]
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
@rich_repr()
|
| 64 |
+
class Segment(NamedTuple):
|
| 65 |
+
"""A piece of text with associated style. Segments are produced by the Console render process and
|
| 66 |
+
are ultimately converted in to strings to be written to the terminal.
|
| 67 |
+
|
| 68 |
+
Args:
|
| 69 |
+
text (str): A piece of text.
|
| 70 |
+
style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.
|
| 71 |
+
control (Tuple[ControlCode], optional): Optional sequence of control codes.
|
| 72 |
+
|
| 73 |
+
Attributes:
|
| 74 |
+
cell_length (int): The cell length of this Segment.
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
text: str
|
| 78 |
+
style: Optional[Style] = None
|
| 79 |
+
control: Optional[Sequence[ControlCode]] = None
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def cell_length(self) -> int:
|
| 83 |
+
"""The number of terminal cells required to display self.text.
|
| 84 |
+
|
| 85 |
+
Returns:
|
| 86 |
+
int: A number of cells.
|
| 87 |
+
"""
|
| 88 |
+
text, _style, control = self
|
| 89 |
+
return 0 if control else cell_len(text)
|
| 90 |
+
|
| 91 |
+
def __rich_repr__(self) -> Result:
|
| 92 |
+
yield self.text
|
| 93 |
+
if self.control is None:
|
| 94 |
+
if self.style is not None:
|
| 95 |
+
yield self.style
|
| 96 |
+
else:
|
| 97 |
+
yield self.style
|
| 98 |
+
yield self.control
|
| 99 |
+
|
| 100 |
+
def __bool__(self) -> bool:
|
| 101 |
+
"""Check if the segment contains text."""
|
| 102 |
+
return bool(self.text)
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def is_control(self) -> bool:
|
| 106 |
+
"""Check if the segment contains control codes."""
|
| 107 |
+
return self.control is not None
|
| 108 |
+
|
| 109 |
+
@classmethod
|
| 110 |
+
@lru_cache(1024 * 16)
|
| 111 |
+
def _split_cells(cls, segment: "Segment", cut: int) -> Tuple["Segment", "Segment"]:
|
| 112 |
+
"""Split a segment in to two at a given cell position.
|
| 113 |
+
|
| 114 |
+
Note that splitting a double-width character, may result in that character turning
|
| 115 |
+
into two spaces.
|
| 116 |
+
|
| 117 |
+
Args:
|
| 118 |
+
segment (Segment): A segment to split.
|
| 119 |
+
cut (int): A cell position to cut on.
|
| 120 |
+
|
| 121 |
+
Returns:
|
| 122 |
+
A tuple of two segments.
|
| 123 |
+
"""
|
| 124 |
+
text, style, control = segment
|
| 125 |
+
_Segment = Segment
|
| 126 |
+
cell_length = segment.cell_length
|
| 127 |
+
if cut >= cell_length:
|
| 128 |
+
return segment, _Segment("", style, control)
|
| 129 |
+
|
| 130 |
+
cell_size = get_character_cell_size
|
| 131 |
+
|
| 132 |
+
pos = int((cut / cell_length) * len(text))
|
| 133 |
+
|
| 134 |
+
while True:
|
| 135 |
+
before = text[:pos]
|
| 136 |
+
cell_pos = cell_len(before)
|
| 137 |
+
out_by = cell_pos - cut
|
| 138 |
+
if not out_by:
|
| 139 |
+
return (
|
| 140 |
+
_Segment(before, style, control),
|
| 141 |
+
_Segment(text[pos:], style, control),
|
| 142 |
+
)
|
| 143 |
+
if out_by == -1 and cell_size(text[pos]) == 2:
|
| 144 |
+
return (
|
| 145 |
+
_Segment(text[:pos] + " ", style, control),
|
| 146 |
+
_Segment(" " + text[pos + 1 :], style, control),
|
| 147 |
+
)
|
| 148 |
+
if out_by == +1 and cell_size(text[pos - 1]) == 2:
|
| 149 |
+
return (
|
| 150 |
+
_Segment(text[: pos - 1] + " ", style, control),
|
| 151 |
+
_Segment(" " + text[pos:], style, control),
|
| 152 |
+
)
|
| 153 |
+
if cell_pos < cut:
|
| 154 |
+
pos += 1
|
| 155 |
+
else:
|
| 156 |
+
pos -= 1
|
| 157 |
+
|
| 158 |
+
def split_cells(self, cut: int) -> Tuple["Segment", "Segment"]:
|
| 159 |
+
"""Split segment in to two segments at the specified column.
|
| 160 |
+
|
| 161 |
+
If the cut point falls in the middle of a 2-cell wide character then it is replaced
|
| 162 |
+
by two spaces, to preserve the display width of the parent segment.
|
| 163 |
+
|
| 164 |
+
Args:
|
| 165 |
+
cut (int): Offset within the segment to cut.
|
| 166 |
+
|
| 167 |
+
Returns:
|
| 168 |
+
Tuple[Segment, Segment]: Two segments.
|
| 169 |
+
"""
|
| 170 |
+
text, style, control = self
|
| 171 |
+
assert cut >= 0
|
| 172 |
+
|
| 173 |
+
if _is_single_cell_widths(text):
|
| 174 |
+
# Fast path with all 1 cell characters
|
| 175 |
+
if cut >= len(text):
|
| 176 |
+
return self, Segment("", style, control)
|
| 177 |
+
return (
|
| 178 |
+
Segment(text[:cut], style, control),
|
| 179 |
+
Segment(text[cut:], style, control),
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
return self._split_cells(self, cut)
|
| 183 |
+
|
| 184 |
+
@classmethod
|
| 185 |
+
def line(cls) -> "Segment":
|
| 186 |
+
"""Make a new line segment."""
|
| 187 |
+
return cls("\n")
|
| 188 |
+
|
| 189 |
+
@classmethod
|
| 190 |
+
def apply_style(
|
| 191 |
+
cls,
|
| 192 |
+
segments: Iterable["Segment"],
|
| 193 |
+
style: Optional[Style] = None,
|
| 194 |
+
post_style: Optional[Style] = None,
|
| 195 |
+
) -> Iterable["Segment"]:
|
| 196 |
+
"""Apply style(s) to an iterable of segments.
|
| 197 |
+
|
| 198 |
+
Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.
|
| 199 |
+
|
| 200 |
+
Args:
|
| 201 |
+
segments (Iterable[Segment]): Segments to process.
|
| 202 |
+
style (Style, optional): Base style. Defaults to None.
|
| 203 |
+
post_style (Style, optional): Style to apply on top of segment style. Defaults to None.
|
| 204 |
+
|
| 205 |
+
Returns:
|
| 206 |
+
Iterable[Segments]: A new iterable of segments (possibly the same iterable).
|
| 207 |
+
"""
|
| 208 |
+
result_segments = segments
|
| 209 |
+
if style:
|
| 210 |
+
apply = style.__add__
|
| 211 |
+
result_segments = (
|
| 212 |
+
cls(text, None if control else apply(_style), control)
|
| 213 |
+
for text, _style, control in result_segments
|
| 214 |
+
)
|
| 215 |
+
if post_style:
|
| 216 |
+
result_segments = (
|
| 217 |
+
cls(
|
| 218 |
+
text,
|
| 219 |
+
(
|
| 220 |
+
None
|
| 221 |
+
if control
|
| 222 |
+
else (_style + post_style if _style else post_style)
|
| 223 |
+
),
|
| 224 |
+
control,
|
| 225 |
+
)
|
| 226 |
+
for text, _style, control in result_segments
|
| 227 |
+
)
|
| 228 |
+
return result_segments
|
| 229 |
+
|
| 230 |
+
@classmethod
|
| 231 |
+
def filter_control(
|
| 232 |
+
cls, segments: Iterable["Segment"], is_control: bool = False
|
| 233 |
+
) -> Iterable["Segment"]:
|
| 234 |
+
"""Filter segments by ``is_control`` attribute.
|
| 235 |
+
|
| 236 |
+
Args:
|
| 237 |
+
segments (Iterable[Segment]): An iterable of Segment instances.
|
| 238 |
+
is_control (bool, optional): is_control flag to match in search.
|
| 239 |
+
|
| 240 |
+
Returns:
|
| 241 |
+
Iterable[Segment]: And iterable of Segment instances.
|
| 242 |
+
|
| 243 |
+
"""
|
| 244 |
+
if is_control:
|
| 245 |
+
return filter(attrgetter("control"), segments)
|
| 246 |
+
else:
|
| 247 |
+
return filterfalse(attrgetter("control"), segments)
|
| 248 |
+
|
| 249 |
+
@classmethod
|
| 250 |
+
def split_lines(cls, segments: Iterable["Segment"]) -> Iterable[List["Segment"]]:
|
| 251 |
+
"""Split a sequence of segments in to a list of lines.
|
| 252 |
+
|
| 253 |
+
Args:
|
| 254 |
+
segments (Iterable[Segment]): Segments potentially containing line feeds.
|
| 255 |
+
|
| 256 |
+
Yields:
|
| 257 |
+
Iterable[List[Segment]]: Iterable of segment lists, one per line.
|
| 258 |
+
"""
|
| 259 |
+
line: List[Segment] = []
|
| 260 |
+
append = line.append
|
| 261 |
+
|
| 262 |
+
for segment in segments:
|
| 263 |
+
if "\n" in segment.text and not segment.control:
|
| 264 |
+
text, style, _ = segment
|
| 265 |
+
while text:
|
| 266 |
+
_text, new_line, text = text.partition("\n")
|
| 267 |
+
if _text:
|
| 268 |
+
append(cls(_text, style))
|
| 269 |
+
if new_line:
|
| 270 |
+
yield line
|
| 271 |
+
line = []
|
| 272 |
+
append = line.append
|
| 273 |
+
else:
|
| 274 |
+
append(segment)
|
| 275 |
+
if line:
|
| 276 |
+
yield line
|
| 277 |
+
|
| 278 |
+
@classmethod
|
| 279 |
+
def split_and_crop_lines(
|
| 280 |
+
cls,
|
| 281 |
+
segments: Iterable["Segment"],
|
| 282 |
+
length: int,
|
| 283 |
+
style: Optional[Style] = None,
|
| 284 |
+
pad: bool = True,
|
| 285 |
+
include_new_lines: bool = True,
|
| 286 |
+
) -> Iterable[List["Segment"]]:
|
| 287 |
+
"""Split segments in to lines, and crop lines greater than a given length.
|
| 288 |
+
|
| 289 |
+
Args:
|
| 290 |
+
segments (Iterable[Segment]): An iterable of segments, probably
|
| 291 |
+
generated from console.render.
|
| 292 |
+
length (int): Desired line length.
|
| 293 |
+
style (Style, optional): Style to use for any padding.
|
| 294 |
+
pad (bool): Enable padding of lines that are less than `length`.
|
| 295 |
+
|
| 296 |
+
Returns:
|
| 297 |
+
Iterable[List[Segment]]: An iterable of lines of segments.
|
| 298 |
+
"""
|
| 299 |
+
line: List[Segment] = []
|
| 300 |
+
append = line.append
|
| 301 |
+
|
| 302 |
+
adjust_line_length = cls.adjust_line_length
|
| 303 |
+
new_line_segment = cls("\n")
|
| 304 |
+
|
| 305 |
+
for segment in segments:
|
| 306 |
+
if "\n" in segment.text and not segment.control:
|
| 307 |
+
text, segment_style, _ = segment
|
| 308 |
+
while text:
|
| 309 |
+
_text, new_line, text = text.partition("\n")
|
| 310 |
+
if _text:
|
| 311 |
+
append(cls(_text, segment_style))
|
| 312 |
+
if new_line:
|
| 313 |
+
cropped_line = adjust_line_length(
|
| 314 |
+
line, length, style=style, pad=pad
|
| 315 |
+
)
|
| 316 |
+
if include_new_lines:
|
| 317 |
+
cropped_line.append(new_line_segment)
|
| 318 |
+
yield cropped_line
|
| 319 |
+
line.clear()
|
| 320 |
+
else:
|
| 321 |
+
append(segment)
|
| 322 |
+
if line:
|
| 323 |
+
yield adjust_line_length(line, length, style=style, pad=pad)
|
| 324 |
+
|
| 325 |
+
@classmethod
|
| 326 |
+
def adjust_line_length(
|
| 327 |
+
cls,
|
| 328 |
+
line: List["Segment"],
|
| 329 |
+
length: int,
|
| 330 |
+
style: Optional[Style] = None,
|
| 331 |
+
pad: bool = True,
|
| 332 |
+
) -> List["Segment"]:
|
| 333 |
+
"""Adjust a line to a given width (cropping or padding as required).
|
| 334 |
+
|
| 335 |
+
Args:
|
| 336 |
+
segments (Iterable[Segment]): A list of segments in a single line.
|
| 337 |
+
length (int): The desired width of the line.
|
| 338 |
+
style (Style, optional): The style of padding if used (space on the end). Defaults to None.
|
| 339 |
+
pad (bool, optional): Pad lines with spaces if they are shorter than `length`. Defaults to True.
|
| 340 |
+
|
| 341 |
+
Returns:
|
| 342 |
+
List[Segment]: A line of segments with the desired length.
|
| 343 |
+
"""
|
| 344 |
+
line_length = sum(segment.cell_length for segment in line)
|
| 345 |
+
new_line: List[Segment]
|
| 346 |
+
|
| 347 |
+
if line_length < length:
|
| 348 |
+
if pad:
|
| 349 |
+
new_line = line + [cls(" " * (length - line_length), style)]
|
| 350 |
+
else:
|
| 351 |
+
new_line = line[:]
|
| 352 |
+
elif line_length > length:
|
| 353 |
+
new_line = []
|
| 354 |
+
append = new_line.append
|
| 355 |
+
line_length = 0
|
| 356 |
+
for segment in line:
|
| 357 |
+
segment_length = segment.cell_length
|
| 358 |
+
if line_length + segment_length < length or segment.control:
|
| 359 |
+
append(segment)
|
| 360 |
+
line_length += segment_length
|
| 361 |
+
else:
|
| 362 |
+
text, segment_style, _ = segment
|
| 363 |
+
text = set_cell_size(text, length - line_length)
|
| 364 |
+
append(cls(text, segment_style))
|
| 365 |
+
break
|
| 366 |
+
else:
|
| 367 |
+
new_line = line[:]
|
| 368 |
+
return new_line
|
| 369 |
+
|
| 370 |
+
@classmethod
|
| 371 |
+
def get_line_length(cls, line: List["Segment"]) -> int:
|
| 372 |
+
"""Get the length of list of segments.
|
| 373 |
+
|
| 374 |
+
Args:
|
| 375 |
+
line (List[Segment]): A line encoded as a list of Segments (assumes no '\\\\n' characters),
|
| 376 |
+
|
| 377 |
+
Returns:
|
| 378 |
+
int: The length of the line.
|
| 379 |
+
"""
|
| 380 |
+
_cell_len = cell_len
|
| 381 |
+
return sum(_cell_len(text) for text, style, control in line if not control)
|
| 382 |
+
|
| 383 |
+
@classmethod
|
| 384 |
+
def get_shape(cls, lines: List[List["Segment"]]) -> Tuple[int, int]:
|
| 385 |
+
"""Get the shape (enclosing rectangle) of a list of lines.
|
| 386 |
+
|
| 387 |
+
Args:
|
| 388 |
+
lines (List[List[Segment]]): A list of lines (no '\\\\n' characters).
|
| 389 |
+
|
| 390 |
+
Returns:
|
| 391 |
+
Tuple[int, int]: Width and height in characters.
|
| 392 |
+
"""
|
| 393 |
+
get_line_length = cls.get_line_length
|
| 394 |
+
max_width = max(get_line_length(line) for line in lines) if lines else 0
|
| 395 |
+
return (max_width, len(lines))
|
| 396 |
+
|
| 397 |
+
@classmethod
|
| 398 |
+
def set_shape(
|
| 399 |
+
cls,
|
| 400 |
+
lines: List[List["Segment"]],
|
| 401 |
+
width: int,
|
| 402 |
+
height: Optional[int] = None,
|
| 403 |
+
style: Optional[Style] = None,
|
| 404 |
+
new_lines: bool = False,
|
| 405 |
+
) -> List[List["Segment"]]:
|
| 406 |
+
"""Set the shape of a list of lines (enclosing rectangle).
|
| 407 |
+
|
| 408 |
+
Args:
|
| 409 |
+
lines (List[List[Segment]]): A list of lines.
|
| 410 |
+
width (int): Desired width.
|
| 411 |
+
height (int, optional): Desired height or None for no change.
|
| 412 |
+
style (Style, optional): Style of any padding added.
|
| 413 |
+
new_lines (bool, optional): Padded lines should include "\n". Defaults to False.
|
| 414 |
+
|
| 415 |
+
Returns:
|
| 416 |
+
List[List[Segment]]: New list of lines.
|
| 417 |
+
"""
|
| 418 |
+
_height = height or len(lines)
|
| 419 |
+
|
| 420 |
+
blank = (
|
| 421 |
+
[cls(" " * width + "\n", style)] if new_lines else [cls(" " * width, style)]
|
| 422 |
+
)
|
| 423 |
+
|
| 424 |
+
adjust_line_length = cls.adjust_line_length
|
| 425 |
+
shaped_lines = lines[:_height]
|
| 426 |
+
shaped_lines[:] = [
|
| 427 |
+
adjust_line_length(line, width, style=style) for line in lines
|
| 428 |
+
]
|
| 429 |
+
if len(shaped_lines) < _height:
|
| 430 |
+
shaped_lines.extend([blank] * (_height - len(shaped_lines)))
|
| 431 |
+
return shaped_lines
|
| 432 |
+
|
| 433 |
+
@classmethod
|
| 434 |
+
def align_top(
|
| 435 |
+
cls: Type["Segment"],
|
| 436 |
+
lines: List[List["Segment"]],
|
| 437 |
+
width: int,
|
| 438 |
+
height: int,
|
| 439 |
+
style: Style,
|
| 440 |
+
new_lines: bool = False,
|
| 441 |
+
) -> List[List["Segment"]]:
|
| 442 |
+
"""Aligns lines to top (adds extra lines to bottom as required).
|
| 443 |
+
|
| 444 |
+
Args:
|
| 445 |
+
lines (List[List[Segment]]): A list of lines.
|
| 446 |
+
width (int): Desired width.
|
| 447 |
+
height (int, optional): Desired height or None for no change.
|
| 448 |
+
style (Style): Style of any padding added.
|
| 449 |
+
new_lines (bool, optional): Padded lines should include "\n". Defaults to False.
|
| 450 |
+
|
| 451 |
+
Returns:
|
| 452 |
+
List[List[Segment]]: New list of lines.
|
| 453 |
+
"""
|
| 454 |
+
extra_lines = height - len(lines)
|
| 455 |
+
if not extra_lines:
|
| 456 |
+
return lines[:]
|
| 457 |
+
lines = lines[:height]
|
| 458 |
+
blank = cls(" " * width + "\n", style) if new_lines else cls(" " * width, style)
|
| 459 |
+
lines = lines + [[blank]] * extra_lines
|
| 460 |
+
return lines
|
| 461 |
+
|
| 462 |
+
@classmethod
|
| 463 |
+
def align_bottom(
|
| 464 |
+
cls: Type["Segment"],
|
| 465 |
+
lines: List[List["Segment"]],
|
| 466 |
+
width: int,
|
| 467 |
+
height: int,
|
| 468 |
+
style: Style,
|
| 469 |
+
new_lines: bool = False,
|
| 470 |
+
) -> List[List["Segment"]]:
|
| 471 |
+
"""Aligns render to bottom (adds extra lines above as required).
|
| 472 |
+
|
| 473 |
+
Args:
|
| 474 |
+
lines (List[List[Segment]]): A list of lines.
|
| 475 |
+
width (int): Desired width.
|
| 476 |
+
height (int, optional): Desired height or None for no change.
|
| 477 |
+
style (Style): Style of any padding added. Defaults to None.
|
| 478 |
+
new_lines (bool, optional): Padded lines should include "\n". Defaults to False.
|
| 479 |
+
|
| 480 |
+
Returns:
|
| 481 |
+
List[List[Segment]]: New list of lines.
|
| 482 |
+
"""
|
| 483 |
+
extra_lines = height - len(lines)
|
| 484 |
+
if not extra_lines:
|
| 485 |
+
return lines[:]
|
| 486 |
+
lines = lines[:height]
|
| 487 |
+
blank = cls(" " * width + "\n", style) if new_lines else cls(" " * width, style)
|
| 488 |
+
lines = [[blank]] * extra_lines + lines
|
| 489 |
+
return lines
|
| 490 |
+
|
| 491 |
+
@classmethod
|
| 492 |
+
def align_middle(
|
| 493 |
+
cls: Type["Segment"],
|
| 494 |
+
lines: List[List["Segment"]],
|
| 495 |
+
width: int,
|
| 496 |
+
height: int,
|
| 497 |
+
style: Style,
|
| 498 |
+
new_lines: bool = False,
|
| 499 |
+
) -> List[List["Segment"]]:
|
| 500 |
+
"""Aligns lines to middle (adds extra lines to above and below as required).
|
| 501 |
+
|
| 502 |
+
Args:
|
| 503 |
+
lines (List[List[Segment]]): A list of lines.
|
| 504 |
+
width (int): Desired width.
|
| 505 |
+
height (int, optional): Desired height or None for no change.
|
| 506 |
+
style (Style): Style of any padding added.
|
| 507 |
+
new_lines (bool, optional): Padded lines should include "\n". Defaults to False.
|
| 508 |
+
|
| 509 |
+
Returns:
|
| 510 |
+
List[List[Segment]]: New list of lines.
|
| 511 |
+
"""
|
| 512 |
+
extra_lines = height - len(lines)
|
| 513 |
+
if not extra_lines:
|
| 514 |
+
return lines[:]
|
| 515 |
+
lines = lines[:height]
|
| 516 |
+
blank = cls(" " * width + "\n", style) if new_lines else cls(" " * width, style)
|
| 517 |
+
top_lines = extra_lines // 2
|
| 518 |
+
bottom_lines = extra_lines - top_lines
|
| 519 |
+
lines = [[blank]] * top_lines + lines + [[blank]] * bottom_lines
|
| 520 |
+
return lines
|
| 521 |
+
|
| 522 |
+
@classmethod
|
| 523 |
+
def simplify(cls, segments: Iterable["Segment"]) -> Iterable["Segment"]:
|
| 524 |
+
"""Simplify an iterable of segments by combining contiguous segments with the same style.
|
| 525 |
+
|
| 526 |
+
Args:
|
| 527 |
+
segments (Iterable[Segment]): An iterable of segments.
|
| 528 |
+
|
| 529 |
+
Returns:
|
| 530 |
+
Iterable[Segment]: A possibly smaller iterable of segments that will render the same way.
|
| 531 |
+
"""
|
| 532 |
+
iter_segments = iter(segments)
|
| 533 |
+
try:
|
| 534 |
+
last_segment = next(iter_segments)
|
| 535 |
+
except StopIteration:
|
| 536 |
+
return
|
| 537 |
+
|
| 538 |
+
_Segment = Segment
|
| 539 |
+
for segment in iter_segments:
|
| 540 |
+
if last_segment.style == segment.style and not segment.control:
|
| 541 |
+
last_segment = _Segment(
|
| 542 |
+
last_segment.text + segment.text, last_segment.style
|
| 543 |
+
)
|
| 544 |
+
else:
|
| 545 |
+
yield last_segment
|
| 546 |
+
last_segment = segment
|
| 547 |
+
yield last_segment
|
| 548 |
+
|
| 549 |
+
@classmethod
|
| 550 |
+
def strip_links(cls, segments: Iterable["Segment"]) -> Iterable["Segment"]:
|
| 551 |
+
"""Remove all links from an iterable of styles.
|
| 552 |
+
|
| 553 |
+
Args:
|
| 554 |
+
segments (Iterable[Segment]): An iterable segments.
|
| 555 |
+
|
| 556 |
+
Yields:
|
| 557 |
+
Segment: Segments with link removed.
|
| 558 |
+
"""
|
| 559 |
+
for segment in segments:
|
| 560 |
+
if segment.control or segment.style is None:
|
| 561 |
+
yield segment
|
| 562 |
+
else:
|
| 563 |
+
text, style, _control = segment
|
| 564 |
+
yield cls(text, style.update_link(None) if style else None)
|
| 565 |
+
|
| 566 |
+
@classmethod
|
| 567 |
+
def strip_styles(cls, segments: Iterable["Segment"]) -> Iterable["Segment"]:
|
| 568 |
+
"""Remove all styles from an iterable of segments.
|
| 569 |
+
|
| 570 |
+
Args:
|
| 571 |
+
segments (Iterable[Segment]): An iterable segments.
|
| 572 |
+
|
| 573 |
+
Yields:
|
| 574 |
+
Segment: Segments with styles replace with None
|
| 575 |
+
"""
|
| 576 |
+
for text, _style, control in segments:
|
| 577 |
+
yield cls(text, None, control)
|
| 578 |
+
|
| 579 |
+
@classmethod
|
| 580 |
+
def remove_color(cls, segments: Iterable["Segment"]) -> Iterable["Segment"]:
|
| 581 |
+
"""Remove all color from an iterable of segments.
|
| 582 |
+
|
| 583 |
+
Args:
|
| 584 |
+
segments (Iterable[Segment]): An iterable segments.
|
| 585 |
+
|
| 586 |
+
Yields:
|
| 587 |
+
Segment: Segments with colorless style.
|
| 588 |
+
"""
|
| 589 |
+
|
| 590 |
+
cache: Dict[Style, Style] = {}
|
| 591 |
+
for text, style, control in segments:
|
| 592 |
+
if style:
|
| 593 |
+
colorless_style = cache.get(style)
|
| 594 |
+
if colorless_style is None:
|
| 595 |
+
colorless_style = style.without_color
|
| 596 |
+
cache[style] = colorless_style
|
| 597 |
+
yield cls(text, colorless_style, control)
|
| 598 |
+
else:
|
| 599 |
+
yield cls(text, None, control)
|
| 600 |
+
|
| 601 |
+
@classmethod
|
| 602 |
+
def divide(
|
| 603 |
+
cls, segments: Iterable["Segment"], cuts: Iterable[int]
|
| 604 |
+
) -> Iterable[List["Segment"]]:
|
| 605 |
+
"""Divides an iterable of segments in to portions.
|
| 606 |
+
|
| 607 |
+
Args:
|
| 608 |
+
cuts (Iterable[int]): Cell positions where to divide.
|
| 609 |
+
|
| 610 |
+
Yields:
|
| 611 |
+
[Iterable[List[Segment]]]: An iterable of Segments in List.
|
| 612 |
+
"""
|
| 613 |
+
split_segments: List["Segment"] = []
|
| 614 |
+
add_segment = split_segments.append
|
| 615 |
+
|
| 616 |
+
iter_cuts = iter(cuts)
|
| 617 |
+
|
| 618 |
+
while True:
|
| 619 |
+
cut = next(iter_cuts, -1)
|
| 620 |
+
if cut == -1:
|
| 621 |
+
return
|
| 622 |
+
if cut != 0:
|
| 623 |
+
break
|
| 624 |
+
yield []
|
| 625 |
+
pos = 0
|
| 626 |
+
|
| 627 |
+
segments_clear = split_segments.clear
|
| 628 |
+
segments_copy = split_segments.copy
|
| 629 |
+
|
| 630 |
+
_cell_len = cached_cell_len
|
| 631 |
+
for segment in segments:
|
| 632 |
+
text, _style, control = segment
|
| 633 |
+
while text:
|
| 634 |
+
end_pos = pos if control else pos + _cell_len(text)
|
| 635 |
+
if end_pos < cut:
|
| 636 |
+
add_segment(segment)
|
| 637 |
+
pos = end_pos
|
| 638 |
+
break
|
| 639 |
+
|
| 640 |
+
if end_pos == cut:
|
| 641 |
+
add_segment(segment)
|
| 642 |
+
yield segments_copy()
|
| 643 |
+
segments_clear()
|
| 644 |
+
pos = end_pos
|
| 645 |
+
|
| 646 |
+
cut = next(iter_cuts, -1)
|
| 647 |
+
if cut == -1:
|
| 648 |
+
if split_segments:
|
| 649 |
+
yield segments_copy()
|
| 650 |
+
return
|
| 651 |
+
|
| 652 |
+
break
|
| 653 |
+
|
| 654 |
+
else:
|
| 655 |
+
before, segment = segment.split_cells(cut - pos)
|
| 656 |
+
text, _style, control = segment
|
| 657 |
+
add_segment(before)
|
| 658 |
+
yield segments_copy()
|
| 659 |
+
segments_clear()
|
| 660 |
+
pos = cut
|
| 661 |
+
|
| 662 |
+
cut = next(iter_cuts, -1)
|
| 663 |
+
if cut == -1:
|
| 664 |
+
if split_segments:
|
| 665 |
+
yield segments_copy()
|
| 666 |
+
return
|
| 667 |
+
|
| 668 |
+
yield segments_copy()
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
class Segments:
|
| 672 |
+
"""A simple renderable to render an iterable of segments. This class may be useful if
|
| 673 |
+
you want to print segments outside of a __rich_console__ method.
|
| 674 |
+
|
| 675 |
+
Args:
|
| 676 |
+
segments (Iterable[Segment]): An iterable of segments.
|
| 677 |
+
new_lines (bool, optional): Add new lines between segments. Defaults to False.
|
| 678 |
+
"""
|
| 679 |
+
|
| 680 |
+
def __init__(self, segments: Iterable[Segment], new_lines: bool = False) -> None:
|
| 681 |
+
self.segments = list(segments)
|
| 682 |
+
self.new_lines = new_lines
|
| 683 |
+
|
| 684 |
+
def __rich_console__(
|
| 685 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 686 |
+
) -> "RenderResult":
|
| 687 |
+
if self.new_lines:
|
| 688 |
+
line = Segment.line()
|
| 689 |
+
for segment in self.segments:
|
| 690 |
+
yield segment
|
| 691 |
+
yield line
|
| 692 |
+
else:
|
| 693 |
+
yield from self.segments
|
| 694 |
+
|
| 695 |
+
|
| 696 |
+
class SegmentLines:
|
| 697 |
+
def __init__(self, lines: Iterable[List[Segment]], new_lines: bool = False) -> None:
|
| 698 |
+
"""A simple renderable containing a number of lines of segments. May be used as an intermediate
|
| 699 |
+
in rendering process.
|
| 700 |
+
|
| 701 |
+
Args:
|
| 702 |
+
lines (Iterable[List[Segment]]): Lists of segments forming lines.
|
| 703 |
+
new_lines (bool, optional): Insert new lines after each line. Defaults to False.
|
| 704 |
+
"""
|
| 705 |
+
self.lines = list(lines)
|
| 706 |
+
self.new_lines = new_lines
|
| 707 |
+
|
| 708 |
+
def __rich_console__(
|
| 709 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 710 |
+
) -> "RenderResult":
|
| 711 |
+
if self.new_lines:
|
| 712 |
+
new_line = Segment.line()
|
| 713 |
+
for line in self.lines:
|
| 714 |
+
yield from line
|
| 715 |
+
yield new_line
|
| 716 |
+
else:
|
| 717 |
+
for line in self.lines:
|
| 718 |
+
yield from line
|
| 719 |
+
|
| 720 |
+
|
| 721 |
+
if __name__ == "__main__": # pragma: no cover
|
| 722 |
+
from pip._vendor.rich.console import Console
|
| 723 |
+
from pip._vendor.rich.syntax import Syntax
|
| 724 |
+
from pip._vendor.rich.text import Text
|
| 725 |
+
|
| 726 |
+
code = """from rich.console import Console
|
| 727 |
+
console = Console()
|
| 728 |
+
text = Text.from_markup("Hello, [bold magenta]World[/]!")
|
| 729 |
+
console.print(text)"""
|
| 730 |
+
|
| 731 |
+
text = Text.from_markup("Hello, [bold magenta]World[/]!")
|
| 732 |
+
|
| 733 |
+
console = Console()
|
| 734 |
+
|
| 735 |
+
console.rule("rich.Segment")
|
| 736 |
+
console.print(
|
| 737 |
+
"A Segment is the last step in the Rich render process before generating text with ANSI codes."
|
| 738 |
+
)
|
| 739 |
+
console.print("\nConsider the following code:\n")
|
| 740 |
+
console.print(Syntax(code, "python", line_numbers=True))
|
| 741 |
+
console.print()
|
| 742 |
+
console.print(
|
| 743 |
+
"When you call [b]print()[/b], Rich [i]renders[/i] the object in to the following:\n"
|
| 744 |
+
)
|
| 745 |
+
fragments = list(console.render(text))
|
| 746 |
+
console.print(fragments)
|
| 747 |
+
console.print()
|
| 748 |
+
console.print("The Segments are then processed to produce the following output:\n")
|
| 749 |
+
console.print(text)
|
| 750 |
+
console.print(
|
| 751 |
+
"\nYou will only need to know this if you are implementing your own Rich renderables."
|
| 752 |
+
)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/spinner.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import cast, List, Optional, TYPE_CHECKING, Union
|
| 2 |
+
|
| 3 |
+
from ._spinners import SPINNERS
|
| 4 |
+
from .measure import Measurement
|
| 5 |
+
from .table import Table
|
| 6 |
+
from .text import Text
|
| 7 |
+
|
| 8 |
+
if TYPE_CHECKING:
|
| 9 |
+
from .console import Console, ConsoleOptions, RenderResult, RenderableType
|
| 10 |
+
from .style import StyleType
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class Spinner:
|
| 14 |
+
"""A spinner animation.
|
| 15 |
+
|
| 16 |
+
Args:
|
| 17 |
+
name (str): Name of spinner (run python -m rich.spinner).
|
| 18 |
+
text (RenderableType, optional): A renderable to display at the right of the spinner (str or Text typically). Defaults to "".
|
| 19 |
+
style (StyleType, optional): Style for spinner animation. Defaults to None.
|
| 20 |
+
speed (float, optional): Speed factor for animation. Defaults to 1.0.
|
| 21 |
+
|
| 22 |
+
Raises:
|
| 23 |
+
KeyError: If name isn't one of the supported spinner animations.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
def __init__(
|
| 27 |
+
self,
|
| 28 |
+
name: str,
|
| 29 |
+
text: "RenderableType" = "",
|
| 30 |
+
*,
|
| 31 |
+
style: Optional["StyleType"] = None,
|
| 32 |
+
speed: float = 1.0,
|
| 33 |
+
) -> None:
|
| 34 |
+
try:
|
| 35 |
+
spinner = SPINNERS[name]
|
| 36 |
+
except KeyError:
|
| 37 |
+
raise KeyError(f"no spinner called {name!r}")
|
| 38 |
+
self.text: "Union[RenderableType, Text]" = (
|
| 39 |
+
Text.from_markup(text) if isinstance(text, str) else text
|
| 40 |
+
)
|
| 41 |
+
self.name = name
|
| 42 |
+
self.frames = cast(List[str], spinner["frames"])[:]
|
| 43 |
+
self.interval = cast(float, spinner["interval"])
|
| 44 |
+
self.start_time: Optional[float] = None
|
| 45 |
+
self.style = style
|
| 46 |
+
self.speed = speed
|
| 47 |
+
self.frame_no_offset: float = 0.0
|
| 48 |
+
self._update_speed = 0.0
|
| 49 |
+
|
| 50 |
+
def __rich_console__(
|
| 51 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 52 |
+
) -> "RenderResult":
|
| 53 |
+
yield self.render(console.get_time())
|
| 54 |
+
|
| 55 |
+
def __rich_measure__(
|
| 56 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 57 |
+
) -> Measurement:
|
| 58 |
+
text = self.render(0)
|
| 59 |
+
return Measurement.get(console, options, text)
|
| 60 |
+
|
| 61 |
+
def render(self, time: float) -> "RenderableType":
|
| 62 |
+
"""Render the spinner for a given time.
|
| 63 |
+
|
| 64 |
+
Args:
|
| 65 |
+
time (float): Time in seconds.
|
| 66 |
+
|
| 67 |
+
Returns:
|
| 68 |
+
RenderableType: A renderable containing animation frame.
|
| 69 |
+
"""
|
| 70 |
+
if self.start_time is None:
|
| 71 |
+
self.start_time = time
|
| 72 |
+
|
| 73 |
+
frame_no = ((time - self.start_time) * self.speed) / (
|
| 74 |
+
self.interval / 1000.0
|
| 75 |
+
) + self.frame_no_offset
|
| 76 |
+
frame = Text(
|
| 77 |
+
self.frames[int(frame_no) % len(self.frames)], style=self.style or ""
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
if self._update_speed:
|
| 81 |
+
self.frame_no_offset = frame_no
|
| 82 |
+
self.start_time = time
|
| 83 |
+
self.speed = self._update_speed
|
| 84 |
+
self._update_speed = 0.0
|
| 85 |
+
|
| 86 |
+
if not self.text:
|
| 87 |
+
return frame
|
| 88 |
+
elif isinstance(self.text, (str, Text)):
|
| 89 |
+
return Text.assemble(frame, " ", self.text)
|
| 90 |
+
else:
|
| 91 |
+
table = Table.grid(padding=1)
|
| 92 |
+
table.add_row(frame, self.text)
|
| 93 |
+
return table
|
| 94 |
+
|
| 95 |
+
def update(
|
| 96 |
+
self,
|
| 97 |
+
*,
|
| 98 |
+
text: "RenderableType" = "",
|
| 99 |
+
style: Optional["StyleType"] = None,
|
| 100 |
+
speed: Optional[float] = None,
|
| 101 |
+
) -> None:
|
| 102 |
+
"""Updates attributes of a spinner after it has been started.
|
| 103 |
+
|
| 104 |
+
Args:
|
| 105 |
+
text (RenderableType, optional): A renderable to display at the right of the spinner (str or Text typically). Defaults to "".
|
| 106 |
+
style (StyleType, optional): Style for spinner animation. Defaults to None.
|
| 107 |
+
speed (float, optional): Speed factor for animation. Defaults to None.
|
| 108 |
+
"""
|
| 109 |
+
if text:
|
| 110 |
+
self.text = Text.from_markup(text) if isinstance(text, str) else text
|
| 111 |
+
if style:
|
| 112 |
+
self.style = style
|
| 113 |
+
if speed:
|
| 114 |
+
self._update_speed = speed
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
if __name__ == "__main__": # pragma: no cover
|
| 118 |
+
from time import sleep
|
| 119 |
+
|
| 120 |
+
from .columns import Columns
|
| 121 |
+
from .panel import Panel
|
| 122 |
+
from .live import Live
|
| 123 |
+
|
| 124 |
+
all_spinners = Columns(
|
| 125 |
+
[
|
| 126 |
+
Spinner(spinner_name, text=Text(repr(spinner_name), style="green"))
|
| 127 |
+
for spinner_name in sorted(SPINNERS.keys())
|
| 128 |
+
],
|
| 129 |
+
column_first=True,
|
| 130 |
+
expand=True,
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
with Live(
|
| 134 |
+
Panel(all_spinners, title="Spinners", border_style="blue"),
|
| 135 |
+
refresh_per_second=20,
|
| 136 |
+
) as live:
|
| 137 |
+
while True:
|
| 138 |
+
sleep(0.1)
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/status.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from types import TracebackType
|
| 2 |
+
from typing import Optional, Type
|
| 3 |
+
|
| 4 |
+
from .console import Console, RenderableType
|
| 5 |
+
from .jupyter import JupyterMixin
|
| 6 |
+
from .live import Live
|
| 7 |
+
from .spinner import Spinner
|
| 8 |
+
from .style import StyleType
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Status(JupyterMixin):
|
| 12 |
+
"""Displays a status indicator with a 'spinner' animation.
|
| 13 |
+
|
| 14 |
+
Args:
|
| 15 |
+
status (RenderableType): A status renderable (str or Text typically).
|
| 16 |
+
console (Console, optional): Console instance to use, or None for global console. Defaults to None.
|
| 17 |
+
spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots".
|
| 18 |
+
spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner".
|
| 19 |
+
speed (float, optional): Speed factor for spinner animation. Defaults to 1.0.
|
| 20 |
+
refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
status: RenderableType,
|
| 26 |
+
*,
|
| 27 |
+
console: Optional[Console] = None,
|
| 28 |
+
spinner: str = "dots",
|
| 29 |
+
spinner_style: StyleType = "status.spinner",
|
| 30 |
+
speed: float = 1.0,
|
| 31 |
+
refresh_per_second: float = 12.5,
|
| 32 |
+
):
|
| 33 |
+
self.status = status
|
| 34 |
+
self.spinner_style = spinner_style
|
| 35 |
+
self.speed = speed
|
| 36 |
+
self._spinner = Spinner(spinner, text=status, style=spinner_style, speed=speed)
|
| 37 |
+
self._live = Live(
|
| 38 |
+
self.renderable,
|
| 39 |
+
console=console,
|
| 40 |
+
refresh_per_second=refresh_per_second,
|
| 41 |
+
transient=True,
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
@property
|
| 45 |
+
def renderable(self) -> Spinner:
|
| 46 |
+
return self._spinner
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def console(self) -> "Console":
|
| 50 |
+
"""Get the Console used by the Status objects."""
|
| 51 |
+
return self._live.console
|
| 52 |
+
|
| 53 |
+
def update(
|
| 54 |
+
self,
|
| 55 |
+
status: Optional[RenderableType] = None,
|
| 56 |
+
*,
|
| 57 |
+
spinner: Optional[str] = None,
|
| 58 |
+
spinner_style: Optional[StyleType] = None,
|
| 59 |
+
speed: Optional[float] = None,
|
| 60 |
+
) -> None:
|
| 61 |
+
"""Update status.
|
| 62 |
+
|
| 63 |
+
Args:
|
| 64 |
+
status (Optional[RenderableType], optional): New status renderable or None for no change. Defaults to None.
|
| 65 |
+
spinner (Optional[str], optional): New spinner or None for no change. Defaults to None.
|
| 66 |
+
spinner_style (Optional[StyleType], optional): New spinner style or None for no change. Defaults to None.
|
| 67 |
+
speed (Optional[float], optional): Speed factor for spinner animation or None for no change. Defaults to None.
|
| 68 |
+
"""
|
| 69 |
+
if status is not None:
|
| 70 |
+
self.status = status
|
| 71 |
+
if spinner_style is not None:
|
| 72 |
+
self.spinner_style = spinner_style
|
| 73 |
+
if speed is not None:
|
| 74 |
+
self.speed = speed
|
| 75 |
+
if spinner is not None:
|
| 76 |
+
self._spinner = Spinner(
|
| 77 |
+
spinner, text=self.status, style=self.spinner_style, speed=self.speed
|
| 78 |
+
)
|
| 79 |
+
self._live.update(self.renderable, refresh=True)
|
| 80 |
+
else:
|
| 81 |
+
self._spinner.update(
|
| 82 |
+
text=self.status, style=self.spinner_style, speed=self.speed
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
def start(self) -> None:
|
| 86 |
+
"""Start the status animation."""
|
| 87 |
+
self._live.start()
|
| 88 |
+
|
| 89 |
+
def stop(self) -> None:
|
| 90 |
+
"""Stop the spinner animation."""
|
| 91 |
+
self._live.stop()
|
| 92 |
+
|
| 93 |
+
def __rich__(self) -> RenderableType:
|
| 94 |
+
return self.renderable
|
| 95 |
+
|
| 96 |
+
def __enter__(self) -> "Status":
|
| 97 |
+
self.start()
|
| 98 |
+
return self
|
| 99 |
+
|
| 100 |
+
def __exit__(
|
| 101 |
+
self,
|
| 102 |
+
exc_type: Optional[Type[BaseException]],
|
| 103 |
+
exc_val: Optional[BaseException],
|
| 104 |
+
exc_tb: Optional[TracebackType],
|
| 105 |
+
) -> None:
|
| 106 |
+
self.stop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
if __name__ == "__main__": # pragma: no cover
|
| 110 |
+
from time import sleep
|
| 111 |
+
|
| 112 |
+
from .console import Console
|
| 113 |
+
|
| 114 |
+
console = Console()
|
| 115 |
+
with console.status("[magenta]Covid detector booting up") as status:
|
| 116 |
+
sleep(3)
|
| 117 |
+
console.log("Importing advanced AI")
|
| 118 |
+
sleep(3)
|
| 119 |
+
console.log("Advanced Covid AI Ready")
|
| 120 |
+
sleep(3)
|
| 121 |
+
status.update(status="[bold blue] Scanning for Covid", spinner="earth")
|
| 122 |
+
sleep(3)
|
| 123 |
+
console.log("Found 10,000,000,000 copies of Covid32.exe")
|
| 124 |
+
sleep(3)
|
| 125 |
+
status.update(
|
| 126 |
+
status="[bold red]Moving Covid32.exe to Trash",
|
| 127 |
+
spinner="bouncingBall",
|
| 128 |
+
spinner_style="yellow",
|
| 129 |
+
)
|
| 130 |
+
sleep(5)
|
| 131 |
+
console.print("[bold green]Covid deleted successfully")
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/style.py
ADDED
|
@@ -0,0 +1,796 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from marshal import dumps, loads
|
| 4 |
+
from random import randint
|
| 5 |
+
from typing import Any, Dict, Iterable, List, Optional, Type, Union, cast
|
| 6 |
+
|
| 7 |
+
from . import errors
|
| 8 |
+
from .color import Color, ColorParseError, ColorSystem, blend_rgb
|
| 9 |
+
from .repr import Result, rich_repr
|
| 10 |
+
from .terminal_theme import DEFAULT_TERMINAL_THEME, TerminalTheme
|
| 11 |
+
|
| 12 |
+
# Style instances and style definitions are often interchangeable
|
| 13 |
+
StyleType = Union[str, "Style"]
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class _Bit:
|
| 17 |
+
"""A descriptor to get/set a style attribute bit."""
|
| 18 |
+
|
| 19 |
+
__slots__ = ["bit"]
|
| 20 |
+
|
| 21 |
+
def __init__(self, bit_no: int) -> None:
|
| 22 |
+
self.bit = 1 << bit_no
|
| 23 |
+
|
| 24 |
+
def __get__(self, obj: "Style", objtype: Type["Style"]) -> Optional[bool]:
|
| 25 |
+
if obj._set_attributes & self.bit:
|
| 26 |
+
return obj._attributes & self.bit != 0
|
| 27 |
+
return None
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
@rich_repr
|
| 31 |
+
class Style:
|
| 32 |
+
"""A terminal style.
|
| 33 |
+
|
| 34 |
+
A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such
|
| 35 |
+
as bold, italic etc. The attributes have 3 states: they can either be on
|
| 36 |
+
(``True``), off (``False``), or not set (``None``).
|
| 37 |
+
|
| 38 |
+
Args:
|
| 39 |
+
color (Union[Color, str], optional): Color of terminal text. Defaults to None.
|
| 40 |
+
bgcolor (Union[Color, str], optional): Color of terminal background. Defaults to None.
|
| 41 |
+
bold (bool, optional): Enable bold text. Defaults to None.
|
| 42 |
+
dim (bool, optional): Enable dim text. Defaults to None.
|
| 43 |
+
italic (bool, optional): Enable italic text. Defaults to None.
|
| 44 |
+
underline (bool, optional): Enable underlined text. Defaults to None.
|
| 45 |
+
blink (bool, optional): Enabled blinking text. Defaults to None.
|
| 46 |
+
blink2 (bool, optional): Enable fast blinking text. Defaults to None.
|
| 47 |
+
reverse (bool, optional): Enabled reverse text. Defaults to None.
|
| 48 |
+
conceal (bool, optional): Enable concealed text. Defaults to None.
|
| 49 |
+
strike (bool, optional): Enable strikethrough text. Defaults to None.
|
| 50 |
+
underline2 (bool, optional): Enable doubly underlined text. Defaults to None.
|
| 51 |
+
frame (bool, optional): Enable framed text. Defaults to None.
|
| 52 |
+
encircle (bool, optional): Enable encircled text. Defaults to None.
|
| 53 |
+
overline (bool, optional): Enable overlined text. Defaults to None.
|
| 54 |
+
link (str, link): Link URL. Defaults to None.
|
| 55 |
+
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
_color: Optional[Color]
|
| 59 |
+
_bgcolor: Optional[Color]
|
| 60 |
+
_attributes: int
|
| 61 |
+
_set_attributes: int
|
| 62 |
+
_hash: Optional[int]
|
| 63 |
+
_null: bool
|
| 64 |
+
_meta: Optional[bytes]
|
| 65 |
+
|
| 66 |
+
__slots__ = [
|
| 67 |
+
"_color",
|
| 68 |
+
"_bgcolor",
|
| 69 |
+
"_attributes",
|
| 70 |
+
"_set_attributes",
|
| 71 |
+
"_link",
|
| 72 |
+
"_link_id",
|
| 73 |
+
"_ansi",
|
| 74 |
+
"_style_definition",
|
| 75 |
+
"_hash",
|
| 76 |
+
"_null",
|
| 77 |
+
"_meta",
|
| 78 |
+
]
|
| 79 |
+
|
| 80 |
+
# maps bits on to SGR parameter
|
| 81 |
+
_style_map = {
|
| 82 |
+
0: "1",
|
| 83 |
+
1: "2",
|
| 84 |
+
2: "3",
|
| 85 |
+
3: "4",
|
| 86 |
+
4: "5",
|
| 87 |
+
5: "6",
|
| 88 |
+
6: "7",
|
| 89 |
+
7: "8",
|
| 90 |
+
8: "9",
|
| 91 |
+
9: "21",
|
| 92 |
+
10: "51",
|
| 93 |
+
11: "52",
|
| 94 |
+
12: "53",
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
STYLE_ATTRIBUTES = {
|
| 98 |
+
"dim": "dim",
|
| 99 |
+
"d": "dim",
|
| 100 |
+
"bold": "bold",
|
| 101 |
+
"b": "bold",
|
| 102 |
+
"italic": "italic",
|
| 103 |
+
"i": "italic",
|
| 104 |
+
"underline": "underline",
|
| 105 |
+
"u": "underline",
|
| 106 |
+
"blink": "blink",
|
| 107 |
+
"blink2": "blink2",
|
| 108 |
+
"reverse": "reverse",
|
| 109 |
+
"r": "reverse",
|
| 110 |
+
"conceal": "conceal",
|
| 111 |
+
"c": "conceal",
|
| 112 |
+
"strike": "strike",
|
| 113 |
+
"s": "strike",
|
| 114 |
+
"underline2": "underline2",
|
| 115 |
+
"uu": "underline2",
|
| 116 |
+
"frame": "frame",
|
| 117 |
+
"encircle": "encircle",
|
| 118 |
+
"overline": "overline",
|
| 119 |
+
"o": "overline",
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
def __init__(
|
| 123 |
+
self,
|
| 124 |
+
*,
|
| 125 |
+
color: Optional[Union[Color, str]] = None,
|
| 126 |
+
bgcolor: Optional[Union[Color, str]] = None,
|
| 127 |
+
bold: Optional[bool] = None,
|
| 128 |
+
dim: Optional[bool] = None,
|
| 129 |
+
italic: Optional[bool] = None,
|
| 130 |
+
underline: Optional[bool] = None,
|
| 131 |
+
blink: Optional[bool] = None,
|
| 132 |
+
blink2: Optional[bool] = None,
|
| 133 |
+
reverse: Optional[bool] = None,
|
| 134 |
+
conceal: Optional[bool] = None,
|
| 135 |
+
strike: Optional[bool] = None,
|
| 136 |
+
underline2: Optional[bool] = None,
|
| 137 |
+
frame: Optional[bool] = None,
|
| 138 |
+
encircle: Optional[bool] = None,
|
| 139 |
+
overline: Optional[bool] = None,
|
| 140 |
+
link: Optional[str] = None,
|
| 141 |
+
meta: Optional[Dict[str, Any]] = None,
|
| 142 |
+
):
|
| 143 |
+
self._ansi: Optional[str] = None
|
| 144 |
+
self._style_definition: Optional[str] = None
|
| 145 |
+
|
| 146 |
+
def _make_color(color: Union[Color, str]) -> Color:
|
| 147 |
+
return color if isinstance(color, Color) else Color.parse(color)
|
| 148 |
+
|
| 149 |
+
self._color = None if color is None else _make_color(color)
|
| 150 |
+
self._bgcolor = None if bgcolor is None else _make_color(bgcolor)
|
| 151 |
+
self._set_attributes = sum(
|
| 152 |
+
(
|
| 153 |
+
bold is not None,
|
| 154 |
+
dim is not None and 2,
|
| 155 |
+
italic is not None and 4,
|
| 156 |
+
underline is not None and 8,
|
| 157 |
+
blink is not None and 16,
|
| 158 |
+
blink2 is not None and 32,
|
| 159 |
+
reverse is not None and 64,
|
| 160 |
+
conceal is not None and 128,
|
| 161 |
+
strike is not None and 256,
|
| 162 |
+
underline2 is not None and 512,
|
| 163 |
+
frame is not None and 1024,
|
| 164 |
+
encircle is not None and 2048,
|
| 165 |
+
overline is not None and 4096,
|
| 166 |
+
)
|
| 167 |
+
)
|
| 168 |
+
self._attributes = (
|
| 169 |
+
sum(
|
| 170 |
+
(
|
| 171 |
+
bold and 1 or 0,
|
| 172 |
+
dim and 2 or 0,
|
| 173 |
+
italic and 4 or 0,
|
| 174 |
+
underline and 8 or 0,
|
| 175 |
+
blink and 16 or 0,
|
| 176 |
+
blink2 and 32 or 0,
|
| 177 |
+
reverse and 64 or 0,
|
| 178 |
+
conceal and 128 or 0,
|
| 179 |
+
strike and 256 or 0,
|
| 180 |
+
underline2 and 512 or 0,
|
| 181 |
+
frame and 1024 or 0,
|
| 182 |
+
encircle and 2048 or 0,
|
| 183 |
+
overline and 4096 or 0,
|
| 184 |
+
)
|
| 185 |
+
)
|
| 186 |
+
if self._set_attributes
|
| 187 |
+
else 0
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
self._link = link
|
| 191 |
+
self._meta = None if meta is None else dumps(meta)
|
| 192 |
+
self._link_id = (
|
| 193 |
+
f"{randint(0, 999999)}{hash(self._meta)}" if (link or meta) else ""
|
| 194 |
+
)
|
| 195 |
+
self._hash: Optional[int] = None
|
| 196 |
+
self._null = not (self._set_attributes or color or bgcolor or link or meta)
|
| 197 |
+
|
| 198 |
+
@classmethod
|
| 199 |
+
def null(cls) -> "Style":
|
| 200 |
+
"""Create an 'null' style, equivalent to Style(), but more performant."""
|
| 201 |
+
return NULL_STYLE
|
| 202 |
+
|
| 203 |
+
@classmethod
|
| 204 |
+
def from_color(
|
| 205 |
+
cls, color: Optional[Color] = None, bgcolor: Optional[Color] = None
|
| 206 |
+
) -> "Style":
|
| 207 |
+
"""Create a new style with colors and no attributes.
|
| 208 |
+
|
| 209 |
+
Returns:
|
| 210 |
+
color (Optional[Color]): A (foreground) color, or None for no color. Defaults to None.
|
| 211 |
+
bgcolor (Optional[Color]): A (background) color, or None for no color. Defaults to None.
|
| 212 |
+
"""
|
| 213 |
+
style: Style = cls.__new__(Style)
|
| 214 |
+
style._ansi = None
|
| 215 |
+
style._style_definition = None
|
| 216 |
+
style._color = color
|
| 217 |
+
style._bgcolor = bgcolor
|
| 218 |
+
style._set_attributes = 0
|
| 219 |
+
style._attributes = 0
|
| 220 |
+
style._link = None
|
| 221 |
+
style._link_id = ""
|
| 222 |
+
style._meta = None
|
| 223 |
+
style._null = not (color or bgcolor)
|
| 224 |
+
style._hash = None
|
| 225 |
+
return style
|
| 226 |
+
|
| 227 |
+
@classmethod
|
| 228 |
+
def from_meta(cls, meta: Optional[Dict[str, Any]]) -> "Style":
|
| 229 |
+
"""Create a new style with meta data.
|
| 230 |
+
|
| 231 |
+
Returns:
|
| 232 |
+
meta (Optional[Dict[str, Any]]): A dictionary of meta data. Defaults to None.
|
| 233 |
+
"""
|
| 234 |
+
style: Style = cls.__new__(Style)
|
| 235 |
+
style._ansi = None
|
| 236 |
+
style._style_definition = None
|
| 237 |
+
style._color = None
|
| 238 |
+
style._bgcolor = None
|
| 239 |
+
style._set_attributes = 0
|
| 240 |
+
style._attributes = 0
|
| 241 |
+
style._link = None
|
| 242 |
+
style._meta = dumps(meta)
|
| 243 |
+
style._link_id = f"{randint(0, 999999)}{hash(style._meta)}"
|
| 244 |
+
style._hash = None
|
| 245 |
+
style._null = not (meta)
|
| 246 |
+
return style
|
| 247 |
+
|
| 248 |
+
@classmethod
|
| 249 |
+
def on(cls, meta: Optional[Dict[str, Any]] = None, **handlers: Any) -> "Style":
|
| 250 |
+
"""Create a blank style with meta information.
|
| 251 |
+
|
| 252 |
+
Example:
|
| 253 |
+
style = Style.on(click=self.on_click)
|
| 254 |
+
|
| 255 |
+
Args:
|
| 256 |
+
meta (Optional[Dict[str, Any]], optional): An optional dict of meta information.
|
| 257 |
+
**handlers (Any): Keyword arguments are translated in to handlers.
|
| 258 |
+
|
| 259 |
+
Returns:
|
| 260 |
+
Style: A Style with meta information attached.
|
| 261 |
+
"""
|
| 262 |
+
meta = {} if meta is None else meta
|
| 263 |
+
meta.update({f"@{key}": value for key, value in handlers.items()})
|
| 264 |
+
return cls.from_meta(meta)
|
| 265 |
+
|
| 266 |
+
bold = _Bit(0)
|
| 267 |
+
dim = _Bit(1)
|
| 268 |
+
italic = _Bit(2)
|
| 269 |
+
underline = _Bit(3)
|
| 270 |
+
blink = _Bit(4)
|
| 271 |
+
blink2 = _Bit(5)
|
| 272 |
+
reverse = _Bit(6)
|
| 273 |
+
conceal = _Bit(7)
|
| 274 |
+
strike = _Bit(8)
|
| 275 |
+
underline2 = _Bit(9)
|
| 276 |
+
frame = _Bit(10)
|
| 277 |
+
encircle = _Bit(11)
|
| 278 |
+
overline = _Bit(12)
|
| 279 |
+
|
| 280 |
+
@property
|
| 281 |
+
def link_id(self) -> str:
|
| 282 |
+
"""Get a link id, used in ansi code for links."""
|
| 283 |
+
return self._link_id
|
| 284 |
+
|
| 285 |
+
def __str__(self) -> str:
|
| 286 |
+
"""Re-generate style definition from attributes."""
|
| 287 |
+
if self._style_definition is None:
|
| 288 |
+
attributes: List[str] = []
|
| 289 |
+
append = attributes.append
|
| 290 |
+
bits = self._set_attributes
|
| 291 |
+
if bits & 0b0000000001111:
|
| 292 |
+
if bits & 1:
|
| 293 |
+
append("bold" if self.bold else "not bold")
|
| 294 |
+
if bits & (1 << 1):
|
| 295 |
+
append("dim" if self.dim else "not dim")
|
| 296 |
+
if bits & (1 << 2):
|
| 297 |
+
append("italic" if self.italic else "not italic")
|
| 298 |
+
if bits & (1 << 3):
|
| 299 |
+
append("underline" if self.underline else "not underline")
|
| 300 |
+
if bits & 0b0000111110000:
|
| 301 |
+
if bits & (1 << 4):
|
| 302 |
+
append("blink" if self.blink else "not blink")
|
| 303 |
+
if bits & (1 << 5):
|
| 304 |
+
append("blink2" if self.blink2 else "not blink2")
|
| 305 |
+
if bits & (1 << 6):
|
| 306 |
+
append("reverse" if self.reverse else "not reverse")
|
| 307 |
+
if bits & (1 << 7):
|
| 308 |
+
append("conceal" if self.conceal else "not conceal")
|
| 309 |
+
if bits & (1 << 8):
|
| 310 |
+
append("strike" if self.strike else "not strike")
|
| 311 |
+
if bits & 0b1111000000000:
|
| 312 |
+
if bits & (1 << 9):
|
| 313 |
+
append("underline2" if self.underline2 else "not underline2")
|
| 314 |
+
if bits & (1 << 10):
|
| 315 |
+
append("frame" if self.frame else "not frame")
|
| 316 |
+
if bits & (1 << 11):
|
| 317 |
+
append("encircle" if self.encircle else "not encircle")
|
| 318 |
+
if bits & (1 << 12):
|
| 319 |
+
append("overline" if self.overline else "not overline")
|
| 320 |
+
if self._color is not None:
|
| 321 |
+
append(self._color.name)
|
| 322 |
+
if self._bgcolor is not None:
|
| 323 |
+
append("on")
|
| 324 |
+
append(self._bgcolor.name)
|
| 325 |
+
if self._link:
|
| 326 |
+
append("link")
|
| 327 |
+
append(self._link)
|
| 328 |
+
self._style_definition = " ".join(attributes) or "none"
|
| 329 |
+
return self._style_definition
|
| 330 |
+
|
| 331 |
+
def __bool__(self) -> bool:
|
| 332 |
+
"""A Style is false if it has no attributes, colors, or links."""
|
| 333 |
+
return not self._null
|
| 334 |
+
|
| 335 |
+
def _make_ansi_codes(self, color_system: ColorSystem) -> str:
|
| 336 |
+
"""Generate ANSI codes for this style.
|
| 337 |
+
|
| 338 |
+
Args:
|
| 339 |
+
color_system (ColorSystem): Color system.
|
| 340 |
+
|
| 341 |
+
Returns:
|
| 342 |
+
str: String containing codes.
|
| 343 |
+
"""
|
| 344 |
+
|
| 345 |
+
if self._ansi is None:
|
| 346 |
+
sgr: List[str] = []
|
| 347 |
+
append = sgr.append
|
| 348 |
+
_style_map = self._style_map
|
| 349 |
+
attributes = self._attributes & self._set_attributes
|
| 350 |
+
if attributes:
|
| 351 |
+
if attributes & 1:
|
| 352 |
+
append(_style_map[0])
|
| 353 |
+
if attributes & 2:
|
| 354 |
+
append(_style_map[1])
|
| 355 |
+
if attributes & 4:
|
| 356 |
+
append(_style_map[2])
|
| 357 |
+
if attributes & 8:
|
| 358 |
+
append(_style_map[3])
|
| 359 |
+
if attributes & 0b0000111110000:
|
| 360 |
+
for bit in range(4, 9):
|
| 361 |
+
if attributes & (1 << bit):
|
| 362 |
+
append(_style_map[bit])
|
| 363 |
+
if attributes & 0b1111000000000:
|
| 364 |
+
for bit in range(9, 13):
|
| 365 |
+
if attributes & (1 << bit):
|
| 366 |
+
append(_style_map[bit])
|
| 367 |
+
if self._color is not None:
|
| 368 |
+
sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
|
| 369 |
+
if self._bgcolor is not None:
|
| 370 |
+
sgr.extend(
|
| 371 |
+
self._bgcolor.downgrade(color_system).get_ansi_codes(
|
| 372 |
+
foreground=False
|
| 373 |
+
)
|
| 374 |
+
)
|
| 375 |
+
self._ansi = ";".join(sgr)
|
| 376 |
+
return self._ansi
|
| 377 |
+
|
| 378 |
+
@classmethod
|
| 379 |
+
@lru_cache(maxsize=1024)
|
| 380 |
+
def normalize(cls, style: str) -> str:
|
| 381 |
+
"""Normalize a style definition so that styles with the same effect have the same string
|
| 382 |
+
representation.
|
| 383 |
+
|
| 384 |
+
Args:
|
| 385 |
+
style (str): A style definition.
|
| 386 |
+
|
| 387 |
+
Returns:
|
| 388 |
+
str: Normal form of style definition.
|
| 389 |
+
"""
|
| 390 |
+
try:
|
| 391 |
+
return str(cls.parse(style))
|
| 392 |
+
except errors.StyleSyntaxError:
|
| 393 |
+
return style.strip().lower()
|
| 394 |
+
|
| 395 |
+
@classmethod
|
| 396 |
+
def pick_first(cls, *values: Optional[StyleType]) -> StyleType:
|
| 397 |
+
"""Pick first non-None style."""
|
| 398 |
+
for value in values:
|
| 399 |
+
if value is not None:
|
| 400 |
+
return value
|
| 401 |
+
raise ValueError("expected at least one non-None style")
|
| 402 |
+
|
| 403 |
+
def __rich_repr__(self) -> Result:
|
| 404 |
+
yield "color", self.color, None
|
| 405 |
+
yield "bgcolor", self.bgcolor, None
|
| 406 |
+
yield "bold", self.bold, None,
|
| 407 |
+
yield "dim", self.dim, None,
|
| 408 |
+
yield "italic", self.italic, None
|
| 409 |
+
yield "underline", self.underline, None,
|
| 410 |
+
yield "blink", self.blink, None
|
| 411 |
+
yield "blink2", self.blink2, None
|
| 412 |
+
yield "reverse", self.reverse, None
|
| 413 |
+
yield "conceal", self.conceal, None
|
| 414 |
+
yield "strike", self.strike, None
|
| 415 |
+
yield "underline2", self.underline2, None
|
| 416 |
+
yield "frame", self.frame, None
|
| 417 |
+
yield "encircle", self.encircle, None
|
| 418 |
+
yield "link", self.link, None
|
| 419 |
+
if self._meta:
|
| 420 |
+
yield "meta", self.meta
|
| 421 |
+
|
| 422 |
+
def __eq__(self, other: Any) -> bool:
|
| 423 |
+
if not isinstance(other, Style):
|
| 424 |
+
return NotImplemented
|
| 425 |
+
return self.__hash__() == other.__hash__()
|
| 426 |
+
|
| 427 |
+
def __ne__(self, other: Any) -> bool:
|
| 428 |
+
if not isinstance(other, Style):
|
| 429 |
+
return NotImplemented
|
| 430 |
+
return self.__hash__() != other.__hash__()
|
| 431 |
+
|
| 432 |
+
def __hash__(self) -> int:
|
| 433 |
+
if self._hash is not None:
|
| 434 |
+
return self._hash
|
| 435 |
+
self._hash = hash(
|
| 436 |
+
(
|
| 437 |
+
self._color,
|
| 438 |
+
self._bgcolor,
|
| 439 |
+
self._attributes,
|
| 440 |
+
self._set_attributes,
|
| 441 |
+
self._link,
|
| 442 |
+
self._meta,
|
| 443 |
+
)
|
| 444 |
+
)
|
| 445 |
+
return self._hash
|
| 446 |
+
|
| 447 |
+
@property
|
| 448 |
+
def color(self) -> Optional[Color]:
|
| 449 |
+
"""The foreground color or None if it is not set."""
|
| 450 |
+
return self._color
|
| 451 |
+
|
| 452 |
+
@property
|
| 453 |
+
def bgcolor(self) -> Optional[Color]:
|
| 454 |
+
"""The background color or None if it is not set."""
|
| 455 |
+
return self._bgcolor
|
| 456 |
+
|
| 457 |
+
@property
|
| 458 |
+
def link(self) -> Optional[str]:
|
| 459 |
+
"""Link text, if set."""
|
| 460 |
+
return self._link
|
| 461 |
+
|
| 462 |
+
@property
|
| 463 |
+
def transparent_background(self) -> bool:
|
| 464 |
+
"""Check if the style specified a transparent background."""
|
| 465 |
+
return self.bgcolor is None or self.bgcolor.is_default
|
| 466 |
+
|
| 467 |
+
@property
|
| 468 |
+
def background_style(self) -> "Style":
|
| 469 |
+
"""A Style with background only."""
|
| 470 |
+
return Style(bgcolor=self.bgcolor)
|
| 471 |
+
|
| 472 |
+
@property
|
| 473 |
+
def meta(self) -> Dict[str, Any]:
|
| 474 |
+
"""Get meta information (can not be changed after construction)."""
|
| 475 |
+
return {} if self._meta is None else cast(Dict[str, Any], loads(self._meta))
|
| 476 |
+
|
| 477 |
+
@property
|
| 478 |
+
def without_color(self) -> "Style":
|
| 479 |
+
"""Get a copy of the style with color removed."""
|
| 480 |
+
if self._null:
|
| 481 |
+
return NULL_STYLE
|
| 482 |
+
style: Style = self.__new__(Style)
|
| 483 |
+
style._ansi = None
|
| 484 |
+
style._style_definition = None
|
| 485 |
+
style._color = None
|
| 486 |
+
style._bgcolor = None
|
| 487 |
+
style._attributes = self._attributes
|
| 488 |
+
style._set_attributes = self._set_attributes
|
| 489 |
+
style._link = self._link
|
| 490 |
+
style._link_id = f"{randint(0, 999999)}" if self._link else ""
|
| 491 |
+
style._null = False
|
| 492 |
+
style._meta = None
|
| 493 |
+
style._hash = None
|
| 494 |
+
return style
|
| 495 |
+
|
| 496 |
+
@classmethod
|
| 497 |
+
@lru_cache(maxsize=4096)
|
| 498 |
+
def parse(cls, style_definition: str) -> "Style":
|
| 499 |
+
"""Parse a style definition.
|
| 500 |
+
|
| 501 |
+
Args:
|
| 502 |
+
style_definition (str): A string containing a style.
|
| 503 |
+
|
| 504 |
+
Raises:
|
| 505 |
+
errors.StyleSyntaxError: If the style definition syntax is invalid.
|
| 506 |
+
|
| 507 |
+
Returns:
|
| 508 |
+
`Style`: A Style instance.
|
| 509 |
+
"""
|
| 510 |
+
if style_definition.strip() == "none" or not style_definition:
|
| 511 |
+
return cls.null()
|
| 512 |
+
|
| 513 |
+
STYLE_ATTRIBUTES = cls.STYLE_ATTRIBUTES
|
| 514 |
+
color: Optional[str] = None
|
| 515 |
+
bgcolor: Optional[str] = None
|
| 516 |
+
attributes: Dict[str, Optional[Any]] = {}
|
| 517 |
+
link: Optional[str] = None
|
| 518 |
+
|
| 519 |
+
words = iter(style_definition.split())
|
| 520 |
+
for original_word in words:
|
| 521 |
+
word = original_word.lower()
|
| 522 |
+
if word == "on":
|
| 523 |
+
word = next(words, "")
|
| 524 |
+
if not word:
|
| 525 |
+
raise errors.StyleSyntaxError("color expected after 'on'")
|
| 526 |
+
try:
|
| 527 |
+
Color.parse(word)
|
| 528 |
+
except ColorParseError as error:
|
| 529 |
+
raise errors.StyleSyntaxError(
|
| 530 |
+
f"unable to parse {word!r} as background color; {error}"
|
| 531 |
+
) from None
|
| 532 |
+
bgcolor = word
|
| 533 |
+
|
| 534 |
+
elif word == "not":
|
| 535 |
+
word = next(words, "")
|
| 536 |
+
attribute = STYLE_ATTRIBUTES.get(word)
|
| 537 |
+
if attribute is None:
|
| 538 |
+
raise errors.StyleSyntaxError(
|
| 539 |
+
f"expected style attribute after 'not', found {word!r}"
|
| 540 |
+
)
|
| 541 |
+
attributes[attribute] = False
|
| 542 |
+
|
| 543 |
+
elif word == "link":
|
| 544 |
+
word = next(words, "")
|
| 545 |
+
if not word:
|
| 546 |
+
raise errors.StyleSyntaxError("URL expected after 'link'")
|
| 547 |
+
link = word
|
| 548 |
+
|
| 549 |
+
elif word in STYLE_ATTRIBUTES:
|
| 550 |
+
attributes[STYLE_ATTRIBUTES[word]] = True
|
| 551 |
+
|
| 552 |
+
else:
|
| 553 |
+
try:
|
| 554 |
+
Color.parse(word)
|
| 555 |
+
except ColorParseError as error:
|
| 556 |
+
raise errors.StyleSyntaxError(
|
| 557 |
+
f"unable to parse {word!r} as color; {error}"
|
| 558 |
+
) from None
|
| 559 |
+
color = word
|
| 560 |
+
style = Style(color=color, bgcolor=bgcolor, link=link, **attributes)
|
| 561 |
+
return style
|
| 562 |
+
|
| 563 |
+
@lru_cache(maxsize=1024)
|
| 564 |
+
def get_html_style(self, theme: Optional[TerminalTheme] = None) -> str:
|
| 565 |
+
"""Get a CSS style rule."""
|
| 566 |
+
theme = theme or DEFAULT_TERMINAL_THEME
|
| 567 |
+
css: List[str] = []
|
| 568 |
+
append = css.append
|
| 569 |
+
|
| 570 |
+
color = self.color
|
| 571 |
+
bgcolor = self.bgcolor
|
| 572 |
+
if self.reverse:
|
| 573 |
+
color, bgcolor = bgcolor, color
|
| 574 |
+
if self.dim:
|
| 575 |
+
foreground_color = (
|
| 576 |
+
theme.foreground_color if color is None else color.get_truecolor(theme)
|
| 577 |
+
)
|
| 578 |
+
color = Color.from_triplet(
|
| 579 |
+
blend_rgb(foreground_color, theme.background_color, 0.5)
|
| 580 |
+
)
|
| 581 |
+
if color is not None:
|
| 582 |
+
theme_color = color.get_truecolor(theme)
|
| 583 |
+
append(f"color: {theme_color.hex}")
|
| 584 |
+
append(f"text-decoration-color: {theme_color.hex}")
|
| 585 |
+
if bgcolor is not None:
|
| 586 |
+
theme_color = bgcolor.get_truecolor(theme, foreground=False)
|
| 587 |
+
append(f"background-color: {theme_color.hex}")
|
| 588 |
+
if self.bold:
|
| 589 |
+
append("font-weight: bold")
|
| 590 |
+
if self.italic:
|
| 591 |
+
append("font-style: italic")
|
| 592 |
+
if self.underline:
|
| 593 |
+
append("text-decoration: underline")
|
| 594 |
+
if self.strike:
|
| 595 |
+
append("text-decoration: line-through")
|
| 596 |
+
if self.overline:
|
| 597 |
+
append("text-decoration: overline")
|
| 598 |
+
return "; ".join(css)
|
| 599 |
+
|
| 600 |
+
@classmethod
|
| 601 |
+
def combine(cls, styles: Iterable["Style"]) -> "Style":
|
| 602 |
+
"""Combine styles and get result.
|
| 603 |
+
|
| 604 |
+
Args:
|
| 605 |
+
styles (Iterable[Style]): Styles to combine.
|
| 606 |
+
|
| 607 |
+
Returns:
|
| 608 |
+
Style: A new style instance.
|
| 609 |
+
"""
|
| 610 |
+
iter_styles = iter(styles)
|
| 611 |
+
return sum(iter_styles, next(iter_styles))
|
| 612 |
+
|
| 613 |
+
@classmethod
|
| 614 |
+
def chain(cls, *styles: "Style") -> "Style":
|
| 615 |
+
"""Combine styles from positional argument in to a single style.
|
| 616 |
+
|
| 617 |
+
Args:
|
| 618 |
+
*styles (Iterable[Style]): Styles to combine.
|
| 619 |
+
|
| 620 |
+
Returns:
|
| 621 |
+
Style: A new style instance.
|
| 622 |
+
"""
|
| 623 |
+
iter_styles = iter(styles)
|
| 624 |
+
return sum(iter_styles, next(iter_styles))
|
| 625 |
+
|
| 626 |
+
def copy(self) -> "Style":
|
| 627 |
+
"""Get a copy of this style.
|
| 628 |
+
|
| 629 |
+
Returns:
|
| 630 |
+
Style: A new Style instance with identical attributes.
|
| 631 |
+
"""
|
| 632 |
+
if self._null:
|
| 633 |
+
return NULL_STYLE
|
| 634 |
+
style: Style = self.__new__(Style)
|
| 635 |
+
style._ansi = self._ansi
|
| 636 |
+
style._style_definition = self._style_definition
|
| 637 |
+
style._color = self._color
|
| 638 |
+
style._bgcolor = self._bgcolor
|
| 639 |
+
style._attributes = self._attributes
|
| 640 |
+
style._set_attributes = self._set_attributes
|
| 641 |
+
style._link = self._link
|
| 642 |
+
style._link_id = f"{randint(0, 999999)}" if self._link else ""
|
| 643 |
+
style._hash = self._hash
|
| 644 |
+
style._null = False
|
| 645 |
+
style._meta = self._meta
|
| 646 |
+
return style
|
| 647 |
+
|
| 648 |
+
@lru_cache(maxsize=128)
|
| 649 |
+
def clear_meta_and_links(self) -> "Style":
|
| 650 |
+
"""Get a copy of this style with link and meta information removed.
|
| 651 |
+
|
| 652 |
+
Returns:
|
| 653 |
+
Style: New style object.
|
| 654 |
+
"""
|
| 655 |
+
if self._null:
|
| 656 |
+
return NULL_STYLE
|
| 657 |
+
style: Style = self.__new__(Style)
|
| 658 |
+
style._ansi = self._ansi
|
| 659 |
+
style._style_definition = self._style_definition
|
| 660 |
+
style._color = self._color
|
| 661 |
+
style._bgcolor = self._bgcolor
|
| 662 |
+
style._attributes = self._attributes
|
| 663 |
+
style._set_attributes = self._set_attributes
|
| 664 |
+
style._link = None
|
| 665 |
+
style._link_id = ""
|
| 666 |
+
style._hash = None
|
| 667 |
+
style._null = False
|
| 668 |
+
style._meta = None
|
| 669 |
+
return style
|
| 670 |
+
|
| 671 |
+
def update_link(self, link: Optional[str] = None) -> "Style":
|
| 672 |
+
"""Get a copy with a different value for link.
|
| 673 |
+
|
| 674 |
+
Args:
|
| 675 |
+
link (str, optional): New value for link. Defaults to None.
|
| 676 |
+
|
| 677 |
+
Returns:
|
| 678 |
+
Style: A new Style instance.
|
| 679 |
+
"""
|
| 680 |
+
style: Style = self.__new__(Style)
|
| 681 |
+
style._ansi = self._ansi
|
| 682 |
+
style._style_definition = self._style_definition
|
| 683 |
+
style._color = self._color
|
| 684 |
+
style._bgcolor = self._bgcolor
|
| 685 |
+
style._attributes = self._attributes
|
| 686 |
+
style._set_attributes = self._set_attributes
|
| 687 |
+
style._link = link
|
| 688 |
+
style._link_id = f"{randint(0, 999999)}" if link else ""
|
| 689 |
+
style._hash = None
|
| 690 |
+
style._null = False
|
| 691 |
+
style._meta = self._meta
|
| 692 |
+
return style
|
| 693 |
+
|
| 694 |
+
def render(
|
| 695 |
+
self,
|
| 696 |
+
text: str = "",
|
| 697 |
+
*,
|
| 698 |
+
color_system: Optional[ColorSystem] = ColorSystem.TRUECOLOR,
|
| 699 |
+
legacy_windows: bool = False,
|
| 700 |
+
) -> str:
|
| 701 |
+
"""Render the ANSI codes for the style.
|
| 702 |
+
|
| 703 |
+
Args:
|
| 704 |
+
text (str, optional): A string to style. Defaults to "".
|
| 705 |
+
color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.
|
| 706 |
+
|
| 707 |
+
Returns:
|
| 708 |
+
str: A string containing ANSI style codes.
|
| 709 |
+
"""
|
| 710 |
+
if not text or color_system is None:
|
| 711 |
+
return text
|
| 712 |
+
attrs = self._ansi or self._make_ansi_codes(color_system)
|
| 713 |
+
rendered = f"\x1b[{attrs}m{text}\x1b[0m" if attrs else text
|
| 714 |
+
if self._link and not legacy_windows:
|
| 715 |
+
rendered = (
|
| 716 |
+
f"\x1b]8;id={self._link_id};{self._link}\x1b\\{rendered}\x1b]8;;\x1b\\"
|
| 717 |
+
)
|
| 718 |
+
return rendered
|
| 719 |
+
|
| 720 |
+
def test(self, text: Optional[str] = None) -> None:
|
| 721 |
+
"""Write text with style directly to terminal.
|
| 722 |
+
|
| 723 |
+
This method is for testing purposes only.
|
| 724 |
+
|
| 725 |
+
Args:
|
| 726 |
+
text (Optional[str], optional): Text to style or None for style name.
|
| 727 |
+
|
| 728 |
+
"""
|
| 729 |
+
text = text or str(self)
|
| 730 |
+
sys.stdout.write(f"{self.render(text)}\n")
|
| 731 |
+
|
| 732 |
+
@lru_cache(maxsize=1024)
|
| 733 |
+
def _add(self, style: Optional["Style"]) -> "Style":
|
| 734 |
+
if style is None or style._null:
|
| 735 |
+
return self
|
| 736 |
+
if self._null:
|
| 737 |
+
return style
|
| 738 |
+
new_style: Style = self.__new__(Style)
|
| 739 |
+
new_style._ansi = None
|
| 740 |
+
new_style._style_definition = None
|
| 741 |
+
new_style._color = style._color or self._color
|
| 742 |
+
new_style._bgcolor = style._bgcolor or self._bgcolor
|
| 743 |
+
new_style._attributes = (self._attributes & ~style._set_attributes) | (
|
| 744 |
+
style._attributes & style._set_attributes
|
| 745 |
+
)
|
| 746 |
+
new_style._set_attributes = self._set_attributes | style._set_attributes
|
| 747 |
+
new_style._link = style._link or self._link
|
| 748 |
+
new_style._link_id = style._link_id or self._link_id
|
| 749 |
+
new_style._null = style._null
|
| 750 |
+
if self._meta and style._meta:
|
| 751 |
+
new_style._meta = dumps({**self.meta, **style.meta})
|
| 752 |
+
else:
|
| 753 |
+
new_style._meta = self._meta or style._meta
|
| 754 |
+
new_style._hash = None
|
| 755 |
+
return new_style
|
| 756 |
+
|
| 757 |
+
def __add__(self, style: Optional["Style"]) -> "Style":
|
| 758 |
+
combined_style = self._add(style)
|
| 759 |
+
return combined_style.copy() if combined_style.link else combined_style
|
| 760 |
+
|
| 761 |
+
|
| 762 |
+
NULL_STYLE = Style()
|
| 763 |
+
|
| 764 |
+
|
| 765 |
+
class StyleStack:
|
| 766 |
+
"""A stack of styles."""
|
| 767 |
+
|
| 768 |
+
__slots__ = ["_stack"]
|
| 769 |
+
|
| 770 |
+
def __init__(self, default_style: "Style") -> None:
|
| 771 |
+
self._stack: List[Style] = [default_style]
|
| 772 |
+
|
| 773 |
+
def __repr__(self) -> str:
|
| 774 |
+
return f"<stylestack {self._stack!r}>"
|
| 775 |
+
|
| 776 |
+
@property
|
| 777 |
+
def current(self) -> Style:
|
| 778 |
+
"""Get the Style at the top of the stack."""
|
| 779 |
+
return self._stack[-1]
|
| 780 |
+
|
| 781 |
+
def push(self, style: Style) -> None:
|
| 782 |
+
"""Push a new style on to the stack.
|
| 783 |
+
|
| 784 |
+
Args:
|
| 785 |
+
style (Style): New style to combine with current style.
|
| 786 |
+
"""
|
| 787 |
+
self._stack.append(self._stack[-1] + style)
|
| 788 |
+
|
| 789 |
+
def pop(self) -> Style:
|
| 790 |
+
"""Pop last style and discard.
|
| 791 |
+
|
| 792 |
+
Returns:
|
| 793 |
+
Style: New current style (also available as stack.current)
|
| 794 |
+
"""
|
| 795 |
+
self._stack.pop()
|
| 796 |
+
return self._stack[-1]
|
.venv/lib/python3.13/site-packages/pip/_vendor/rich/styled.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING
|
| 2 |
+
|
| 3 |
+
from .measure import Measurement
|
| 4 |
+
from .segment import Segment
|
| 5 |
+
from .style import StyleType
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from .console import Console, ConsoleOptions, RenderResult, RenderableType
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Styled:
|
| 12 |
+
"""Apply a style to a renderable.
|
| 13 |
+
|
| 14 |
+
Args:
|
| 15 |
+
renderable (RenderableType): Any renderable.
|
| 16 |
+
style (StyleType): A style to apply across the entire renderable.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
def __init__(self, renderable: "RenderableType", style: "StyleType") -> None:
|
| 20 |
+
self.renderable = renderable
|
| 21 |
+
self.style = style
|
| 22 |
+
|
| 23 |
+
def __rich_console__(
|
| 24 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 25 |
+
) -> "RenderResult":
|
| 26 |
+
style = console.get_style(self.style)
|
| 27 |
+
rendered_segments = console.render(self.renderable, options)
|
| 28 |
+
segments = Segment.apply_style(rendered_segments, style)
|
| 29 |
+
return segments
|
| 30 |
+
|
| 31 |
+
def __rich_measure__(
|
| 32 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 33 |
+
) -> Measurement:
|
| 34 |
+
return Measurement.get(console, options, self.renderable)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
if __name__ == "__main__": # pragma: no cover
|
| 38 |
+
from pip._vendor.rich import print
|
| 39 |
+
from pip._vendor.rich.panel import Panel
|
| 40 |
+
|
| 41 |
+
panel = Styled(Panel("hello"), "on blue")
|
| 42 |
+
print(panel)
|