├── tests ├── __init__.py ├── samples │ ├── requirements-invalid.txt │ ├── requirements-version-in-name.txt │ ├── requirements-nested.txt │ ├── results │ │ ├── test_updates_package_with_version_in_name │ │ ├── test_dry_run_changed │ │ ├── test_does_not_update_package_with_wildcard_spec │ │ ├── test_skip_package_in_nested_requirements_nested │ │ ├── test_updates_package_in_nested_requirements_nested │ │ ├── test_updates_package_with_extras │ │ ├── test_updates_package_with_max_version_spec │ │ ├── test_updates_package_with_min_version_spec │ │ ├── test_minor │ │ ├── test_patch │ │ ├── test_updates_package_with_multiline_spec │ │ ├── test_only │ │ ├── test_updates_package │ │ ├── test_dry_run_invalid_package │ │ ├── test_pre_release │ │ ├── test_skip_package │ │ ├── test_interactive_choice_quit │ │ ├── test_interactive_choice_invalid │ │ ├── test_only_multiple_packages │ │ ├── test_updates_package_with_no_version_specified │ │ ├── test_updates_package_in_nested_requirements │ │ └── test_updates_nested_requirements_to_output_file_with_no_recursive │ ├── requirements-with-wildcard-spec.txt │ ├── requirements-with-extras.txt │ ├── requirements-with-max-version-spec.txt │ ├── requirements-with-min-version-spec.txt │ ├── requirements-multiline.txt │ ├── requirements-with-alt-index-url.txt │ ├── requirements.txt │ ├── requirements-up-to-date.txt │ ├── requirements-multiple.txt │ └── requirements-with-nested-reqfile.txt └── utils.py ├── pur ├── packages │ ├── __init__.py │ └── pip │ │ ├── _vendor │ │ ├── idna │ │ │ ├── py.typed │ │ │ ├── package_data.py │ │ │ ├── compat.py │ │ │ ├── __init__.py │ │ │ ├── LICENSE.md │ │ │ └── intranges.py │ │ ├── rich │ │ │ ├── py.typed │ │ │ ├── themes.py │ │ │ ├── region.py │ │ │ ├── _extension.py │ │ │ ├── _stack.py │ │ │ ├── _pick.py │ │ │ ├── _timer.py │ │ │ ├── errors.py │ │ │ ├── _fileno.py │ │ │ ├── pager.py │ │ │ ├── abc.py │ │ │ ├── LICENSE │ │ │ ├── diagnose.py │ │ │ ├── _emoji_replace.py │ │ │ ├── color_triplet.py │ │ │ ├── _loop.py │ │ │ ├── styled.py │ │ │ ├── constrain.py │ │ │ ├── protocol.py │ │ │ ├── _null_file.py │ │ │ ├── screen.py │ │ │ ├── file_proxy.py │ │ │ ├── _wrap.py │ │ │ └── _windows.py │ │ ├── certifi │ │ │ ├── py.typed │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ └── LICENSE │ │ ├── chardet │ │ │ ├── py.typed │ │ │ ├── cli │ │ │ │ └── __init__.py │ │ │ ├── metadata │ │ │ │ └── __init__.py │ │ │ ├── version.py │ │ │ ├── resultdict.py │ │ │ ├── codingstatemachinedict.py │ │ │ ├── euckrprober.py │ │ │ ├── euctwprober.py │ │ │ ├── johabprober.py │ │ │ ├── gb2312prober.py │ │ │ ├── big5prober.py │ │ │ ├── cp949prober.py │ │ │ ├── enums.py │ │ │ └── mbcsgroupprober.py │ │ ├── distro │ │ │ ├── py.typed │ │ │ ├── __main__.py │ │ │ └── __init__.py │ │ ├── packaging │ │ │ ├── py.typed │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __about__.py │ │ │ ├── LICENSE.BSD │ │ │ └── _structures.py │ │ ├── pyparsing │ │ │ ├── py.typed │ │ │ └── LICENSE │ │ ├── tenacity │ │ │ ├── py.typed │ │ │ ├── nap.py │ │ │ ├── before.py │ │ │ ├── after.py │ │ │ └── tornadoweb.py │ │ ├── platformdirs │ │ │ ├── py.typed │ │ │ ├── version.py │ │ │ ├── LICENSE │ │ │ └── __main__.py │ │ ├── resolvelib │ │ │ ├── py.typed │ │ │ ├── compat │ │ │ │ ├── __init__.py │ │ │ │ ├── collections_abc.pyi │ │ │ │ └── collections_abc.py │ │ │ ├── reporters.pyi │ │ │ ├── __init__.pyi │ │ │ ├── __init__.py │ │ │ ├── LICENSE │ │ │ ├── structs.pyi │ │ │ ├── providers.pyi │ │ │ └── reporters.py │ │ ├── urllib3 │ │ │ ├── contrib │ │ │ │ ├── __init__.py │ │ │ │ ├── _securetransport │ │ │ │ │ └── __init__.py │ │ │ │ └── _appengine_environ.py │ │ │ ├── packages │ │ │ │ ├── __init__.py │ │ │ │ └── backports │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── makefile.py │ │ │ ├── _version.py │ │ │ ├── util │ │ │ │ ├── queue.py │ │ │ │ ├── __init__.py │ │ │ │ └── proxy.py │ │ │ └── LICENSE.txt │ │ ├── distlib.pyi │ │ ├── msgpack.pyi │ │ ├── six │ │ │ ├── __init__.pyi │ │ │ └── moves │ │ │ │ ├── __init__.pyi │ │ │ │ └── configparser.pyi │ │ ├── urllib3.pyi │ │ ├── colorama.pyi │ │ ├── pygments.pyi │ │ ├── requests.pyi │ │ ├── cachecontrol.pyi │ │ ├── webencodings.pyi │ │ ├── pkg_resources.pyi │ │ ├── pyproject_hooks.pyi │ │ ├── tomli │ │ │ ├── py.typed │ │ │ ├── _types.py │ │ │ ├── __init__.py │ │ │ └── LICENSE │ │ ├── typing_extensions.pyi │ │ ├── distlib │ │ │ ├── t32.exe │ │ │ ├── t64.exe │ │ │ ├── w32.exe │ │ │ ├── w64.exe │ │ │ ├── t64-arm.exe │ │ │ ├── w64-arm.exe │ │ │ └── __init__.py │ │ ├── pyproject_hooks │ │ │ ├── _compat.py │ │ │ ├── __init__.py │ │ │ ├── _in_process │ │ │ │ └── __init__.py │ │ │ └── LICENSE │ │ ├── colorama │ │ │ ├── __init__.py │ │ │ └── LICENSE.txt │ │ ├── cachecontrol │ │ │ ├── caches │ │ │ │ ├── __init__.py │ │ │ │ └── redis_cache.py │ │ │ ├── __init__.py │ │ │ ├── LICENSE.txt │ │ │ ├── compat.py │ │ │ ├── wrapper.py │ │ │ ├── _cmd.py │ │ │ └── cache.py │ │ ├── pygments │ │ │ ├── __main__.py │ │ │ ├── modeline.py │ │ │ ├── LICENSE │ │ │ ├── console.py │ │ │ └── filter.py │ │ ├── requests │ │ │ ├── __version__.py │ │ │ ├── certs.py │ │ │ ├── packages.py │ │ │ ├── hooks.py │ │ │ ├── compat.py │ │ │ └── _internal_utils.py │ │ ├── vendor.txt │ │ ├── msgpack │ │ │ ├── COPYING │ │ │ ├── exceptions.py │ │ │ └── __init__.py │ │ ├── pkg_resources │ │ │ └── LICENSE │ │ ├── six.LICENSE │ │ └── webencodings │ │ │ ├── mklabels.py │ │ │ └── LICENSE │ │ ├── _internal │ │ ├── utils │ │ │ ├── __init__.py │ │ │ ├── datetime.py │ │ │ ├── filetypes.py │ │ │ ├── inject_securetransport.py │ │ │ ├── _log.py │ │ │ ├── encoding.py │ │ │ ├── models.py │ │ │ ├── appdirs.py │ │ │ ├── urls.py │ │ │ ├── compat.py │ │ │ ├── packaging.py │ │ │ └── egg_link.py │ │ ├── operations │ │ │ ├── __init__.py │ │ │ ├── build │ │ │ │ ├── __init__.py │ │ │ │ ├── wheel.py │ │ │ │ ├── metadata.py │ │ │ │ ├── wheel_editable.py │ │ │ │ └── metadata_editable.py │ │ │ └── install │ │ │ │ ├── __init__.py │ │ │ │ └── editable_legacy.py │ │ ├── resolution │ │ │ ├── __init__.py │ │ │ ├── legacy │ │ │ │ └── __init__.py │ │ │ ├── resolvelib │ │ │ │ └── __init__.py │ │ │ └── base.py │ │ ├── index │ │ │ └── __init__.py │ │ ├── network │ │ │ ├── __init__.py │ │ │ └── xmlrpc.py │ │ ├── models │ │ │ ├── __init__.py │ │ │ ├── scheme.py │ │ │ ├── candidate.py │ │ │ ├── index.py │ │ │ └── selection_prefs.py │ │ ├── metadata │ │ │ └── importlib │ │ │ │ ├── __init__.py │ │ │ │ └── _compat.py │ │ ├── cli │ │ │ ├── status_codes.py │ │ │ ├── __init__.py │ │ │ ├── command_context.py │ │ │ └── progress_bars.py │ │ ├── main.py │ │ ├── __init__.py │ │ ├── vcs │ │ │ └── __init__.py │ │ ├── distributions │ │ │ ├── installed.py │ │ │ ├── __init__.py │ │ │ ├── wheel.py │ │ │ └── base.py │ │ └── commands │ │ │ ├── help.py │ │ │ ├── hash.py │ │ │ └── check.py │ │ ├── py.typed │ │ ├── __init__.py │ │ ├── __main__.py │ │ └── __pip-runner__.py ├── __main__.py ├── exceptions.py └── __about__.py ├── requirements.txt ├── dev-requirements.txt ├── pur.gif ├── MANIFEST.in ├── codecov.yml ├── tox.ini ├── .coveragerc ├── AUTHORS ├── .gitignore ├── Makefile ├── .github └── workflows │ └── tests.yml ├── NOTICE ├── LICENSE └── setup.py /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | click>=8.0.0 2 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/certifi/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distro/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyparsing/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tenacity/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/cli/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/platformdirs/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/resolution/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/packages/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/build/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/resolution/legacy/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib.pyi: -------------------------------------------------------------------------------- 1 | from distlib import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/msgpack.pyi: -------------------------------------------------------------------------------- 1 | from msgpack import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/compat/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/six/__init__.pyi: -------------------------------------------------------------------------------- 1 | from six import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3.pyi: -------------------------------------------------------------------------------- 1 | from urllib3 import * -------------------------------------------------------------------------------- /pur/packages/pip/_internal/resolution/resolvelib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/colorama.pyi: -------------------------------------------------------------------------------- 1 | from colorama import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments.pyi: -------------------------------------------------------------------------------- 1 | from pygments import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests.pyi: -------------------------------------------------------------------------------- 1 | from requests import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/packages/backports/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/samples/requirements-invalid.txt: -------------------------------------------------------------------------------- 1 | invalidpackage==0.9 2 | -------------------------------------------------------------------------------- /tests/samples/requirements-version-in-name.txt: -------------------------------------------------------------------------------- 1 | package1==1 2 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol.pyi: -------------------------------------------------------------------------------- 1 | from cachecontrol import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/webencodings.pyi: -------------------------------------------------------------------------------- 1 | from webencodings import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pkg_resources.pyi: -------------------------------------------------------------------------------- 1 | from pkg_resources import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyproject_hooks.pyi: -------------------------------------------------------------------------------- 1 | from pyproject_hooks import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/six/moves/__init__.pyi: -------------------------------------------------------------------------------- 1 | from six.moves import * -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tomli/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561 2 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/package_data.py: -------------------------------------------------------------------------------- 1 | __version__ = '3.4' 2 | 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/typing_extensions.pyi: -------------------------------------------------------------------------------- 1 | from typing_extensions import * -------------------------------------------------------------------------------- /tests/samples/requirements-nested.txt: -------------------------------------------------------------------------------- 1 | readtime==0.9 2 | virtualenv==0.10.1 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/index/__init__.py: -------------------------------------------------------------------------------- 1 | """Index interaction code 2 | """ 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_version_in_name: -------------------------------------------------------------------------------- 1 | package1==2.0 2 | -------------------------------------------------------------------------------- /dev-requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | 3 | coverage 4 | pytest 5 | pytest-cov 6 | -------------------------------------------------------------------------------- /pur.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur.gif -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/six/moves/configparser.pyi: -------------------------------------------------------------------------------- 1 | from six.moves.configparser import * -------------------------------------------------------------------------------- /tests/samples/requirements-with-wildcard-spec.txt: -------------------------------------------------------------------------------- 1 | fakewebserver==0.9.* 2 | flask==0.9 3 | -------------------------------------------------------------------------------- /tests/samples/requirements-with-extras.txt: -------------------------------------------------------------------------------- 1 | firstpackage1[secondpackage1] == 1 # this is a comment 2 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/network/__init__.py: -------------------------------------------------------------------------------- 1 | """Contains purely network-related utilities. 2 | """ 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_dry_run_changed: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | Alembic==0.10.1 3 | sqlalchemy==0.10.1 4 | 5 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/compat/collections_abc.pyi: -------------------------------------------------------------------------------- 1 | from collections.abc import Mapping, Sequence 2 | -------------------------------------------------------------------------------- /tests/samples/results/test_does_not_update_package_with_wildcard_spec: -------------------------------------------------------------------------------- 1 | fakewebserver==0.9.* 2 | flask==0.9.1 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_skip_package_in_nested_requirements_nested: -------------------------------------------------------------------------------- 1 | readtime==0.9 2 | virtualenv==0.10.1 3 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst LICENSE NOTICE HISTORY.rst requirements.txt 2 | recursive-include pur *.py *.pem 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/models/__init__.py: -------------------------------------------------------------------------------- 1 | """A package that contains models that represent entities. 2 | """ 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/install/__init__.py: -------------------------------------------------------------------------------- 1 | """For modules related to installing packages. 2 | """ 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/_version.py: -------------------------------------------------------------------------------- 1 | # This file is protected via CODEOWNERS 2 | __version__ = "1.26.16" 3 | -------------------------------------------------------------------------------- /tests/samples/requirements-with-max-version-spec.txt: -------------------------------------------------------------------------------- 1 | afakepackage == 0.9, < 1.0 2 | afakepackage == 0.9, <= 1.0 3 | -------------------------------------------------------------------------------- /tests/samples/requirements-with-min-version-spec.txt: -------------------------------------------------------------------------------- 1 | fakewebserver>=1.8.6,<=1.9 2 | fakewebserver > 1.8.6, < 1.9 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_in_nested_requirements_nested: -------------------------------------------------------------------------------- 1 | readtime==0.10.1 2 | virtualenv==0.10.1 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_extras: -------------------------------------------------------------------------------- 1 | firstpackage1[secondpackage1] == 2.0 # this is a comment 2 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "pur/packages" 3 | - "*/python?.?/*" 4 | - "*/site-packages/nose/*" 5 | comment: false 6 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distro/__main__.py: -------------------------------------------------------------------------------- 1 | from .distro import main 2 | 3 | if __name__ == "__main__": 4 | main() 5 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_max_version_spec: -------------------------------------------------------------------------------- 1 | afakepackage == 0.10.1, < 1.0 2 | afakepackage == 0.10.1, <= 1.0 3 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_min_version_spec: -------------------------------------------------------------------------------- 1 | fakewebserver>=1.8.13,<=1.9 2 | fakewebserver > 1.8.6, < 1.9 3 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/t32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/t32.exe -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/t64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/t64.exe -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/w32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/w32.exe -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/w64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/w64.exe -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py37, py38, py39, py310, py311, py312 3 | [testenv] 4 | deps = -rdev-requirements.txt 5 | commands = pytest --cov=./pur 6 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/certifi/__init__.py: -------------------------------------------------------------------------------- 1 | from .core import contents, where 2 | 3 | __all__ = ["contents", "where"] 4 | __version__ = "2023.07.22" 5 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/t64-arm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/t64-arm.exe -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/w64-arm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanhamlett/pip-update-requirements/HEAD/pur/packages/pip/_vendor/distlib/w64-arm.exe -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/themes.py: -------------------------------------------------------------------------------- 1 | from .default_styles import DEFAULT_STYLES 2 | from .theme import Theme 3 | 4 | 5 | DEFAULT = Theme(DEFAULT_STYLES) 6 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/metadata/importlib/__init__.py: -------------------------------------------------------------------------------- 1 | from ._dists import Distribution 2 | from ._envs import Environment 3 | 4 | __all__ = ["Distribution", "Environment"] 5 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = false 3 | omit = 4 | pur/packages/* 5 | [report] 6 | omit = 7 | pur/packages/* 8 | */python?.?/* 9 | */site-packages/nose/* 10 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/cli/status_codes.py: -------------------------------------------------------------------------------- 1 | SUCCESS = 0 2 | ERROR = 1 3 | UNKNOWN_ERROR = 2 4 | VIRTUALENV_NOT_FOUND = 3 5 | PREVIOUS_BUILD_DIR_ERROR = 4 6 | NO_MATCHES_FOUND = 23 7 | -------------------------------------------------------------------------------- /tests/samples/requirements-multiline.txt: -------------------------------------------------------------------------------- 1 | afakepackage == 0.9, < 3.0, \ 2 | > 0.1, >= 0.2, < 2.0, <= 1.0, != 0.9.1 3 | afakepackage == 0.9, < 3.0, \ 4 | < 2.0, <= 1.0, != 0.9.1\ 5 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/cli/__init__.py: -------------------------------------------------------------------------------- 1 | """Subpackage containing all of pip's command line interface related code 2 | """ 3 | 4 | # This file intentionally does not import submodules 5 | -------------------------------------------------------------------------------- /tests/samples/requirements-with-alt-index-url.txt: -------------------------------------------------------------------------------- 1 | --index-url=http://pypi.example.com 2 | --trusted-host=pypi.example.com 3 | 4 | --extra-index-url=https://pypi2.example.com 5 | 6 | . 7 | flask 8 | -------------------------------------------------------------------------------- /tests/samples/requirements.txt: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | flask==12.0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_minor: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | flask==12.1.3 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_patch: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | flask==12.0.3 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_multiline_spec: -------------------------------------------------------------------------------- 1 | afakepackage == 1.0, < 3.0, \ 2 | > 0.1, >= 0.2, < 2.0, <= 1.0, != 0.9.1 3 | afakepackage == 1.0, < 3.0, \ 4 | < 2.0, <= 1.0, != 0.9.1\ 5 | -------------------------------------------------------------------------------- /tests/samples/requirements-up-to-date.txt: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | flask==12.0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_only: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | Alembic==0.9 3 | sqlalchemy==0.9 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | flask==12.0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyproject_hooks/_compat.py: -------------------------------------------------------------------------------- 1 | __all__ = ("tomllib",) 2 | 3 | import sys 4 | 5 | if sys.version_info >= (3, 11): 6 | import tomllib 7 | else: 8 | from pip._vendor import tomli as tomllib 9 | -------------------------------------------------------------------------------- /tests/samples/requirements-multiple.txt: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | Alembic==0.9 3 | sqlalchemy==0.9 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_dry_run_invalid_package: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | flask==12.0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/platformdirs/version.py: -------------------------------------------------------------------------------- 1 | # file generated by setuptools_scm 2 | # don't change, don't track in version control 3 | __version__ = version = '3.8.1' 4 | __version_tuple__ = version_tuple = (3, 8, 1) 5 | -------------------------------------------------------------------------------- /tests/samples/results/test_pre_release: -------------------------------------------------------------------------------- 1 | flask==13.0.0.dev0 2 | flask==13.0.0.dev0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_skip_package: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | Alembic==0.10.1 3 | sqlalchemy==0.10.1 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_interactive_choice_quit: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | Alembic==0.9 3 | sqlalchemy==0.9 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/compat/collections_abc.py: -------------------------------------------------------------------------------- 1 | __all__ = ["Mapping", "Sequence"] 2 | 3 | try: 4 | from collections.abc import Mapping, Sequence 5 | except ImportError: 6 | from collections import Mapping, Sequence 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_interactive_choice_invalid: -------------------------------------------------------------------------------- 1 | flask==0.9 2 | Alembic==0.10.1 3 | sqlalchemy==0.9 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /tests/samples/results/test_only_multiple_packages: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | Alembic==0.9 3 | sqlalchemy==0.10.1 4 | # an empty line below 5 | 6 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 7 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/LICENSE: -------------------------------------------------------------------------------- 1 | This software is made available under the terms of *either* of the licenses 2 | found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made 3 | under the terms of *both* these licenses. 4 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_with_no_version_specified: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | flask==12.0 3 | # an empty line below 4 | 5 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 6 | flask==0.10.1 7 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/region.py: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /tests/samples/requirements-with-nested-reqfile.txt: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | flask==12.0 3 | # a comment 4 | -r requirements-nested.txt 5 | # an empty line below 6 | 7 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 8 | flask 9 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_package_in_nested_requirements: -------------------------------------------------------------------------------- 1 | flask==0.10.1 2 | flask==12.0 3 | # a comment 4 | -r requirements-nested.txt 5 | # an empty line below 6 | 7 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 8 | flask 9 | -------------------------------------------------------------------------------- /tests/samples/results/test_updates_nested_requirements_to_output_file_with_no_recursive: -------------------------------------------------------------------------------- 1 | flask==0.11 2 | flask==12.0 3 | # a comment 4 | -r requirements-nested.txt 5 | # an empty line below 6 | 7 | -e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox 8 | flask 9 | -------------------------------------------------------------------------------- /pur/packages/pip/py.typed: -------------------------------------------------------------------------------- 1 | pip is a command line program. While it is implemented in Python, and so is 2 | available for import, you must not use pip's internal APIs in this way. Typing 3 | information is provided as a convenience only and is not a guarantee. Expect 4 | unannounced changes to the API and types in releases. 5 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module exists only to simplify retrieving the version number of chardet 3 | from within setuptools and from chardet subpackages. 4 | 5 | :author: Dan Blanchard (dan.blanchard@gmail.com) 6 | """ 7 | 8 | __version__ = "5.1.0" 9 | VERSION = __version__.split(".") 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | pip-update-requirements is written and maintained by Alan Hamlett and 2 | various contributors: 3 | 4 | 5 | Development Lead 6 | ---------------- 7 | 8 | - Alan Hamlett 9 | 10 | 11 | Patches and Suggestions 12 | ----------------------- 13 | 14 | - Tom Marks 15 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/datetime.py: -------------------------------------------------------------------------------- 1 | """For when pip wants to check the date or time. 2 | """ 3 | 4 | import datetime 5 | 6 | 7 | def today_is_later_than(year: int, month: int, day: int) -> bool: 8 | today = datetime.date.today() 9 | given = datetime.date(year, month, day) 10 | 11 | return today > given 12 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/colorama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from .initialise import init, deinit, reinit, colorama_text, just_fix_windows_console 3 | from .ansi import Fore, Back, Style, Cursor 4 | from .ansitowin32 import AnsiToWin32 5 | 6 | __version__ = '0.4.6' 7 | 8 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/caches/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .file_cache import FileCache, SeparateBodyFileCache 6 | from .redis_cache import RedisCache 7 | 8 | 9 | __all__ = ["FileCache", "SeparateBodyFileCache", "RedisCache"] 10 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tomli/_types.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # SPDX-FileCopyrightText: 2021 Taneli Hukkinen 3 | # Licensed to PSF under a Contributor Agreement. 4 | 5 | from typing import Any, Callable, Tuple 6 | 7 | # Type annotations 8 | ParseFloat = Callable[[str], Any] 9 | Key = Tuple[str, ...] 10 | Pos = int 11 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/certifi/__main__.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from pip._vendor.certifi import contents, where 4 | 5 | parser = argparse.ArgumentParser() 6 | parser.add_argument("-c", "--contents", action="store_true") 7 | args = parser.parse_args() 8 | 9 | if args.contents: 10 | print(contents()) 11 | else: 12 | print(where()) 13 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_extension.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | 4 | def load_ipython_extension(ip: Any) -> None: # pragma: no cover 5 | # prevent circular import 6 | from pip._vendor.rich.pretty import install 7 | from pip._vendor.rich.traceback import install as tr_install 8 | 9 | install() 10 | tr_install() 11 | -------------------------------------------------------------------------------- /pur/__main__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | pur.__main__ 4 | ~~~~~~~~~~~~ 5 | Update packages in a requirements.txt file to latest versions. 6 | :copyright: (c) 2016 Alan Hamlett. 7 | :license: BSD, see LICENSE for more details. 8 | """ 9 | 10 | 11 | from .__init__ import pur 12 | 13 | 14 | if __name__ == '__main__': 15 | pur() 16 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/compat.py: -------------------------------------------------------------------------------- 1 | from .core import * 2 | from .codec import * 3 | from typing import Any, Union 4 | 5 | def ToASCII(label: str) -> bytes: 6 | return encode(label) 7 | 8 | def ToUnicode(label: Union[bytes, bytearray]) -> str: 9 | return decode(label) 10 | 11 | def nameprep(s: Any) -> None: 12 | raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') 13 | 14 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/main.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | 4 | def main(args: Optional[List[str]] = None) -> int: 5 | """This is preserved for old console scripts that may still be referencing 6 | it. 7 | 8 | For additional details, see https://github.com/pypa/pip/issues/7498. 9 | """ 10 | from pip._internal.utils.entrypoints import _wrapper 11 | 12 | return _wrapper(args) 13 | -------------------------------------------------------------------------------- /pur/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | pur.exceptions 4 | ~~~~~~~~~~~~~~ 5 | :copyright: (c) 2016 Alan Hamlett. 6 | :license: BSD, see LICENSE for more details. 7 | """ 8 | 9 | 10 | class InvalidPackage(Exception): 11 | """The package has no releases.""" 12 | pass 13 | 14 | 15 | class StopUpdating(Exception): 16 | """Stop updating a requirements file and exit.""" 17 | pass 18 | -------------------------------------------------------------------------------- /pur/__about__.py: -------------------------------------------------------------------------------- 1 | __title__ = 'pur' 2 | __description__ = 'Update packages in a requirements.txt file to latest versions.' 3 | __url__ = 'https://github.com/alanhamlett/pip-update-requirements' 4 | __version_info__ = ('7', '3', '3') 5 | __version__ = '.'.join(__version_info__) 6 | __author__ = 'Alan Hamlett' 7 | __author_email__ = 'alan.hamlett@gmail.com' 8 | __license__ = 'BSD' 9 | __copyright__ = 'Copyright 2016 Alan Hamlett' 10 | -------------------------------------------------------------------------------- /pur/packages/pip/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | __version__ = "23.2.1" 4 | 5 | 6 | def main(args: Optional[List[str]] = None) -> int: 7 | """This is an internal API only meant for use by pip's own console scripts. 8 | 9 | For additional details, see https://github.com/pypa/pip/issues/7498. 10 | """ 11 | from pip._internal.utils.entrypoints import _wrapper 12 | 13 | return _wrapper(args) 14 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_stack.py: -------------------------------------------------------------------------------- 1 | from typing import List, TypeVar 2 | 3 | T = TypeVar("T") 4 | 5 | 6 | class Stack(List[T]): 7 | """A small shim over builtin list.""" 8 | 9 | @property 10 | def top(self) -> T: 11 | """Get top of stack.""" 12 | return self[-1] 13 | 14 | def push(self, item: T) -> None: 15 | """Push an item on to the stack (append in stack nomenclature).""" 16 | self.append(item) 17 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments/__main__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pygments.__main__ 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Main entry point for ``python -m pygments``. 6 | 7 | :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | """ 10 | 11 | import sys 12 | from pip._vendor.pygments.cmdline import main 13 | 14 | try: 15 | sys.exit(main(sys.argv)) 16 | except KeyboardInterrupt: 17 | sys.exit(1) 18 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tomli/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # SPDX-FileCopyrightText: 2021 Taneli Hukkinen 3 | # Licensed to PSF under a Contributor Agreement. 4 | 5 | __all__ = ("loads", "load", "TOMLDecodeError") 6 | __version__ = "2.0.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT 7 | 8 | from ._parser import TOMLDecodeError, load, loads 9 | 10 | # Pretend this exception was created here. 11 | TOMLDecodeError.__module__ = __name__ 12 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/resultdict.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING, Optional 2 | 3 | if TYPE_CHECKING: 4 | # TypedDict was introduced in Python 3.8. 5 | # 6 | # TODO: Remove the else block and TYPE_CHECKING check when dropping support 7 | # for Python 3.7. 8 | from typing import TypedDict 9 | 10 | class ResultDict(TypedDict): 11 | encoding: Optional[str] 12 | confidence: float 13 | language: Optional[str] 14 | 15 | else: 16 | ResultDict = dict 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | pur/build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | 21 | # Installer logs 22 | pip-log.txt 23 | 24 | # Unit test / coverage reports 25 | .coverage 26 | .tox 27 | nosetests.xml 28 | 29 | # Translations 30 | *.mo 31 | 32 | # Mr Developer 33 | .mr.developer.cfg 34 | .project 35 | .pydevproject 36 | 37 | virtualenv 38 | venv 39 | .DS_Store 40 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_pick.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | 4 | def pick_bool(*values: Optional[bool]) -> bool: 5 | """Pick the first non-none bool or return the last value. 6 | 7 | Args: 8 | *values (bool): Any number of boolean or None values. 9 | 10 | Returns: 11 | bool: First non-none boolean. 12 | """ 13 | assert values, "1 or more values required" 14 | for value in values: 15 | if value is not None: 16 | return value 17 | return bool(value) 18 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_timer.py: -------------------------------------------------------------------------------- 1 | """ 2 | Timer context manager, only used in debug. 3 | 4 | """ 5 | 6 | from time import time 7 | 8 | import contextlib 9 | from typing import Generator 10 | 11 | 12 | @contextlib.contextmanager 13 | def timer(subject: str = "time") -> Generator[None, None, None]: 14 | """print the elapsed time. (only used in debugging)""" 15 | start = time() 16 | yield 17 | elapsed = time() - start 18 | elapsed_ms = elapsed * 1000 19 | print(f"{subject} elapsed {elapsed_ms:.1f}ms") 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test upgrade clean build upload 2 | 3 | all: 4 | @echo 'test run the unit tests with the current default python' 5 | @echo 'upgrade run pip to check for dependency updates' 6 | @echo 'release publish the current version to pypi' 7 | 8 | test: 9 | @pytest --cov=./pur 10 | 11 | upgrade: 12 | @pur --skip click -r dev-requirements.txt 13 | 14 | release: clean build upload 15 | 16 | clean: 17 | @rm -f dist/* 18 | 19 | build: 20 | @python ./setup.py sdist 21 | 22 | upload: 23 | @twine upload ./dist/* 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/__version__.py: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. . . .-. .-. .-. .-. 2 | # |( |- |.| | | |- `-. | `-. 3 | # ' ' `-' `-`.`-' `-' `-' ' `-' 4 | 5 | __title__ = "requests" 6 | __description__ = "Python HTTP for Humans." 7 | __url__ = "https://requests.readthedocs.io" 8 | __version__ = "2.31.0" 9 | __build__ = 0x023100 10 | __author__ = "Kenneth Reitz" 11 | __author_email__ = "me@kennethreitz.org" 12 | __license__ = "Apache 2.0" 13 | __copyright__ = "Copyright Kenneth Reitz" 14 | __cake__ = "\u2728 \U0001f370 \u2728" 15 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | """CacheControl import Interface. 6 | 7 | Make it easy to import from cachecontrol without long namespaces. 8 | """ 9 | __author__ = "Eric Larson" 10 | __email__ = "eric@ionrock.org" 11 | __version__ = "0.12.11" 12 | 13 | from .wrapper import CacheControl 14 | from .adapter import CacheControlAdapter 15 | from .controller import CacheController 16 | 17 | import logging 18 | logging.getLogger(__name__).addHandler(logging.NullHandler()) 19 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/reporters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | class BaseReporter: 4 | def starting(self) -> Any: ... 5 | def starting_round(self, index: int) -> Any: ... 6 | def ending_round(self, index: int, state: Any) -> Any: ... 7 | def ending(self, state: Any) -> Any: ... 8 | def adding_requirement(self, requirement: Any, parent: Any) -> Any: ... 9 | def rejecting_candidate(self, criterion: Any, candidate: Any) -> Any: ... 10 | def resolving_conflicts(self, causes: Any) -> Any: ... 11 | def pinning(self, candidate: Any) -> Any: ... 12 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/vendor.txt: -------------------------------------------------------------------------------- 1 | CacheControl==0.12.11 # Make sure to update the license in pyproject.toml for this. 2 | colorama==0.4.6 3 | distlib==0.3.6 4 | distro==1.8.0 5 | msgpack==1.0.5 6 | packaging==21.3 7 | platformdirs==3.8.1 8 | pyparsing==3.1.0 9 | pyproject-hooks==1.0.0 10 | requests==2.31.0 11 | certifi==2023.5.7 12 | chardet==5.1.0 13 | idna==3.4 14 | urllib3==1.26.16 15 | rich==13.4.2 16 | pygments==2.15.1 17 | typing_extensions==4.7.1 18 | resolvelib==1.0.1 19 | setuptools==68.0.0 20 | six==1.16.0 21 | tenacity==8.2.2 22 | tomli==2.0.1 23 | webencodings==0.5.1 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/util/queue.py: -------------------------------------------------------------------------------- 1 | import collections 2 | 3 | from ..packages import six 4 | from ..packages.six.moves import queue 5 | 6 | if six.PY2: 7 | # Queue is imported for side effects on MS Windows. See issue #229. 8 | import Queue as _unused_module_Queue # noqa: F401 9 | 10 | 11 | class LifoQueue(queue.Queue): 12 | def _init(self, _): 13 | self.queue = collections.deque() 14 | 15 | def _qsize(self, len=len): 16 | return len(self.queue) 17 | 18 | def _put(self, item): 19 | self.queue.append(item) 20 | 21 | def _get(self): 22 | return self.queue.pop() 23 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyproject_hooks/__init__.py: -------------------------------------------------------------------------------- 1 | """Wrappers to call pyproject.toml-based build backend hooks. 2 | """ 3 | 4 | from ._impl import ( 5 | BackendInvalid, 6 | BackendUnavailable, 7 | BuildBackendHookCaller, 8 | HookMissing, 9 | UnsupportedOperation, 10 | default_subprocess_runner, 11 | quiet_subprocess_runner, 12 | ) 13 | 14 | __version__ = '1.0.0' 15 | __all__ = [ 16 | 'BackendUnavailable', 17 | 'BackendInvalid', 18 | 'HookMissing', 19 | 'UnsupportedOperation', 20 | 'default_subprocess_runner', 21 | 'quiet_subprocess_runner', 22 | 'BuildBackendHookCaller', 23 | ] 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/__init__.pyi: -------------------------------------------------------------------------------- 1 | __version__: str 2 | 3 | from .providers import AbstractProvider as AbstractProvider 4 | from .providers import AbstractResolver as AbstractResolver 5 | from .reporters import BaseReporter as BaseReporter 6 | from .resolvers import InconsistentCandidate as InconsistentCandidate 7 | from .resolvers import RequirementsConflicted as RequirementsConflicted 8 | from .resolvers import ResolutionError as ResolutionError 9 | from .resolvers import ResolutionImpossible as ResolutionImpossible 10 | from .resolvers import ResolutionTooDeep as ResolutionTooDeep 11 | from .resolvers import Resolver as Resolver 12 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012-2021 Eric Larson 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | 5 | from .__about__ import ( 6 | __author__, 7 | __copyright__, 8 | __email__, 9 | __license__, 10 | __summary__, 11 | __title__, 12 | __uri__, 13 | __version__, 14 | ) 15 | 16 | __all__ = [ 17 | "__title__", 18 | "__summary__", 19 | "__uri__", 20 | "__version__", 21 | "__author__", 22 | "__email__", 23 | "__license__", 24 | "__copyright__", 25 | ] 26 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/codingstatemachinedict.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING, Tuple 2 | 3 | if TYPE_CHECKING: 4 | # TypedDict was introduced in Python 3.8. 5 | # 6 | # TODO: Remove the else block and TYPE_CHECKING check when dropping support 7 | # for Python 3.7. 8 | from typing import TypedDict 9 | 10 | class CodingStateMachineDict(TypedDict, total=False): 11 | class_table: Tuple[int, ...] 12 | class_factor: int 13 | state_table: Tuple[int, ...] 14 | char_len_table: Tuple[int, ...] 15 | name: str 16 | language: str # Optional key 17 | 18 | else: 19 | CodingStateMachineDict = dict 20 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py: -------------------------------------------------------------------------------- 1 | """This is a subpackage because the directory is on sys.path for _in_process.py 2 | 3 | The subpackage should stay as empty as possible to avoid shadowing modules that 4 | the backend might import. 5 | """ 6 | 7 | import importlib.resources as resources 8 | 9 | try: 10 | resources.files 11 | except AttributeError: 12 | # Python 3.8 compatibility 13 | def _in_proc_script_path(): 14 | return resources.path(__package__, '_in_process.py') 15 | else: 16 | def _in_proc_script_path(): 17 | return resources.as_file( 18 | resources.files(__package__).joinpath('_in_process.py')) 19 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | import pip._internal.utils.inject_securetransport # noqa 4 | from pip._internal.utils import _log 5 | 6 | # init_logging() must be called before any call to logging.getLogger() 7 | # which happens at import of most modules. 8 | _log.init_logging() 9 | 10 | 11 | def main(args: (Optional[List[str]]) = None) -> int: 12 | """This is preserved for old console scripts that may still be referencing 13 | it. 14 | 15 | For additional details, see https://github.com/pypa/pip/issues/7498. 16 | """ 17 | from pip._internal.utils.entrypoints import _wrapper 18 | 19 | return _wrapper(args) 20 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/vcs/__init__.py: -------------------------------------------------------------------------------- 1 | # Expose a limited set of classes and functions so callers outside of 2 | # the vcs package don't need to import deeper than `pip._internal.vcs`. 3 | # (The test directory may still need to import from a vcs sub-package.) 4 | # Import all vcs modules to register each VCS in the VcsSupport object. 5 | import pip._internal.vcs.bazaar 6 | import pip._internal.vcs.git 7 | import pip._internal.vcs.mercurial 8 | import pip._internal.vcs.subversion # noqa: F401 9 | from pip._internal.vcs.versioncontrol import ( # noqa: F401 10 | RemoteNotFoundError, 11 | RemoteNotValidError, 12 | is_url, 13 | make_vcs_requirement_url, 14 | vcs, 15 | ) 16 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = [ 2 | "__version__", 3 | "AbstractProvider", 4 | "AbstractResolver", 5 | "BaseReporter", 6 | "InconsistentCandidate", 7 | "Resolver", 8 | "RequirementsConflicted", 9 | "ResolutionError", 10 | "ResolutionImpossible", 11 | "ResolutionTooDeep", 12 | ] 13 | 14 | __version__ = "1.0.1" 15 | 16 | 17 | from .providers import AbstractProvider, AbstractResolver 18 | from .reporters import BaseReporter 19 | from .resolvers import ( 20 | InconsistentCandidate, 21 | RequirementsConflicted, 22 | ResolutionError, 23 | ResolutionImpossible, 24 | ResolutionTooDeep, 25 | Resolver, 26 | ) 27 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/msgpack/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2008-2011 INADA Naoki 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/resolution/base.py: -------------------------------------------------------------------------------- 1 | from typing import Callable, List, Optional 2 | 3 | from pip._internal.req.req_install import InstallRequirement 4 | from pip._internal.req.req_set import RequirementSet 5 | 6 | InstallRequirementProvider = Callable[ 7 | [str, Optional[InstallRequirement]], InstallRequirement 8 | ] 9 | 10 | 11 | class BaseResolver: 12 | def resolve( 13 | self, root_reqs: List[InstallRequirement], check_supported_wheels: bool 14 | ) -> RequirementSet: 15 | raise NotImplementedError() 16 | 17 | def get_installation_order( 18 | self, req_set: RequirementSet 19 | ) -> List[InstallRequirement]: 20 | raise NotImplementedError() 21 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/certs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | requests.certs 5 | ~~~~~~~~~~~~~~ 6 | 7 | This module returns the preferred default CA certificate bundle. There is 8 | only one — the one from the certifi package. 9 | 10 | If you are packaging Requests, e.g., for a Linux distribution or a managed 11 | environment, you can change the definition of where() to return a separately 12 | packaged CA bundle. 13 | """ 14 | 15 | import os 16 | 17 | if "_PIP_STANDALONE_CERT" not in os.environ: 18 | from pip._vendor.certifi import where 19 | else: 20 | def where(): 21 | return os.environ["_PIP_STANDALONE_CERT"] 22 | 23 | if __name__ == "__main__": 24 | print(where()) 25 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distlib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012-2022 Vinay Sajip. 4 | # Licensed to the Python Software Foundation under a contributor agreement. 5 | # See LICENSE.txt and CONTRIBUTORS.txt. 6 | # 7 | import logging 8 | 9 | __version__ = '0.3.6' 10 | 11 | class DistlibException(Exception): 12 | pass 13 | 14 | try: 15 | from logging import NullHandler 16 | except ImportError: # pragma: no cover 17 | class NullHandler(logging.Handler): 18 | def handle(self, record): pass 19 | def emit(self, record): pass 20 | def createLock(self): self.lock = None 21 | 22 | logger = logging.getLogger(__name__) 23 | logger.addHandler(NullHandler()) 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/packages.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | # This code exists for backwards compatibility reasons. 4 | # I don't like it either. Just look the other way. :) 5 | 6 | for package in ('urllib3', 'idna', 'chardet'): 7 | vendored_package = "pip._vendor." + package 8 | locals()[package] = __import__(vendored_package) 9 | # This traversal is apparently necessary such that the identities are 10 | # preserved (requests.packages.urllib3.* is urllib3.*) 11 | for mod in list(sys.modules): 12 | if mod == vendored_package or mod.startswith(vendored_package + '.'): 13 | unprefixed_mod = mod[len("pip._vendor."):] 14 | sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod] 15 | 16 | # Kinda cool, though, right? 17 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/__about__.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | 5 | __all__ = [ 6 | "__title__", 7 | "__summary__", 8 | "__uri__", 9 | "__version__", 10 | "__author__", 11 | "__email__", 12 | "__license__", 13 | "__copyright__", 14 | ] 15 | 16 | __title__ = "packaging" 17 | __summary__ = "Core utilities for Python packages" 18 | __uri__ = "https://github.com/pypa/packaging" 19 | 20 | __version__ = "21.3" 21 | 22 | __author__ = "Donald Stufft and individual contributors" 23 | __email__ = "donald@stufft.io" 24 | 25 | __license__ = "BSD-2-Clause or Apache-2.0" 26 | __copyright__ = "2014-2019 %s" % __author__ 27 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/errors.py: -------------------------------------------------------------------------------- 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.""" 35 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Tzu-ping Chung 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/distributions/installed.py: -------------------------------------------------------------------------------- 1 | from pip._internal.distributions.base import AbstractDistribution 2 | from pip._internal.index.package_finder import PackageFinder 3 | from pip._internal.metadata import BaseDistribution 4 | 5 | 6 | class InstalledDistribution(AbstractDistribution): 7 | """Represents an installed package. 8 | 9 | This does not need any preparation as the required information has already 10 | been computed. 11 | """ 12 | 13 | def get_metadata_distribution(self) -> BaseDistribution: 14 | assert self.req.satisfied_by is not None, "not actually installed" 15 | return self.req.satisfied_by 16 | 17 | def prepare_distribution_metadata( 18 | self, 19 | finder: PackageFinder, 20 | build_isolation: bool, 21 | check_build_deps: bool, 22 | ) -> None: 23 | pass 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/filetypes.py: -------------------------------------------------------------------------------- 1 | """Filetype information. 2 | """ 3 | 4 | from typing import Tuple 5 | 6 | from pip._internal.utils.misc import splitext 7 | 8 | WHEEL_EXTENSION = ".whl" 9 | BZ2_EXTENSIONS: Tuple[str, ...] = (".tar.bz2", ".tbz") 10 | XZ_EXTENSIONS: Tuple[str, ...] = ( 11 | ".tar.xz", 12 | ".txz", 13 | ".tlz", 14 | ".tar.lz", 15 | ".tar.lzma", 16 | ) 17 | ZIP_EXTENSIONS: Tuple[str, ...] = (".zip", WHEEL_EXTENSION) 18 | TAR_EXTENSIONS: Tuple[str, ...] = (".tar.gz", ".tgz", ".tar") 19 | ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS 20 | 21 | 22 | def is_archive_file(name: str) -> bool: 23 | """Return True if `name` is a considered as an archive file.""" 24 | ext = splitext(name)[1].lower() 25 | if ext in ARCHIVE_EXTENSIONS: 26 | return True 27 | return False 28 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/models/scheme.py: -------------------------------------------------------------------------------- 1 | """ 2 | For types associated with installation schemes. 3 | 4 | For a general overview of available schemes and their context, see 5 | https://docs.python.org/3/install/index.html#alternate-installation. 6 | """ 7 | 8 | 9 | SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"] 10 | 11 | 12 | class Scheme: 13 | """A Scheme holds paths which are used as the base directories for 14 | artifacts associated with a Python package. 15 | """ 16 | 17 | __slots__ = SCHEME_KEYS 18 | 19 | def __init__( 20 | self, 21 | platlib: str, 22 | purelib: str, 23 | headers: str, 24 | scripts: str, 25 | data: str, 26 | ) -> None: 27 | self.platlib = platlib 28 | self.purelib = purelib 29 | self.headers = headers 30 | self.scripts = scripts 31 | self.data = data 32 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/hooks.py: -------------------------------------------------------------------------------- 1 | """ 2 | requests.hooks 3 | ~~~~~~~~~~~~~~ 4 | 5 | This module provides the capabilities for the Requests hooks system. 6 | 7 | Available hooks: 8 | 9 | ``response``: 10 | The response generated from a Request. 11 | """ 12 | HOOKS = ["response"] 13 | 14 | 15 | def default_hooks(): 16 | return {event: [] for event in HOOKS} 17 | 18 | 19 | # TODO: response is the only one 20 | 21 | 22 | def dispatch_hook(key, hooks, hook_data, **kwargs): 23 | """Dispatches a hook dictionary on a given piece of data.""" 24 | hooks = hooks or {} 25 | hooks = hooks.get(key) 26 | if hooks: 27 | if hasattr(hooks, "__call__"): 28 | hooks = [hooks] 29 | for hook in hooks: 30 | _hook_data = hook(hook_data, **kwargs) 31 | if _hook_data is not None: 32 | hook_data = _hook_data 33 | return hook_data 34 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/cli/command_context.py: -------------------------------------------------------------------------------- 1 | from contextlib import ExitStack, contextmanager 2 | from typing import ContextManager, Generator, TypeVar 3 | 4 | _T = TypeVar("_T", covariant=True) 5 | 6 | 7 | class CommandContextMixIn: 8 | def __init__(self) -> None: 9 | super().__init__() 10 | self._in_main_context = False 11 | self._main_context = ExitStack() 12 | 13 | @contextmanager 14 | def main_context(self) -> Generator[None, None, None]: 15 | assert not self._in_main_context 16 | 17 | self._in_main_context = True 18 | try: 19 | with self._main_context: 20 | yield 21 | finally: 22 | self._in_main_context = False 23 | 24 | def enter_context(self, context_provider: ContextManager[_T]) -> _T: 25 | assert self._in_main_context 26 | 27 | return self._main_context.enter_context(context_provider) 28 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_fileno.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import IO, Callable 4 | 5 | 6 | def get_fileno(file_like: IO[str]) -> int | None: 7 | """Get fileno() from a file, accounting for poorly implemented file-like objects. 8 | 9 | Args: 10 | file_like (IO): A file-like object. 11 | 12 | Returns: 13 | int | None: The result of fileno if available, or None if operation failed. 14 | """ 15 | fileno: Callable[[], int] | None = getattr(file_like, "fileno", None) 16 | if fileno is not None: 17 | try: 18 | return fileno() 19 | except Exception: 20 | # `fileno` is documented as potentially raising a OSError 21 | # Alas, from the issues, there are so many poorly implemented file-like objects, 22 | # that `fileno()` can raise just about anything. 23 | return None 24 | return None 25 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/compat.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | try: 6 | from urllib.parse import urljoin 7 | except ImportError: 8 | from urlparse import urljoin 9 | 10 | 11 | try: 12 | import cPickle as pickle 13 | except ImportError: 14 | import pickle 15 | 16 | # Handle the case where the requests module has been patched to not have 17 | # urllib3 bundled as part of its source. 18 | try: 19 | from pip._vendor.requests.packages.urllib3.response import HTTPResponse 20 | except ImportError: 21 | from pip._vendor.urllib3.response import HTTPResponse 22 | 23 | try: 24 | from pip._vendor.requests.packages.urllib3.util import is_fp_closed 25 | except ImportError: 26 | from pip._vendor.urllib3.util import is_fp_closed 27 | 28 | # Replicate some six behaviour 29 | try: 30 | text_type = unicode 31 | except NameError: 32 | text_type = str 33 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/wrapper.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .adapter import CacheControlAdapter 6 | from .cache import DictCache 7 | 8 | 9 | def CacheControl( 10 | sess, 11 | cache=None, 12 | cache_etags=True, 13 | serializer=None, 14 | heuristic=None, 15 | controller_class=None, 16 | adapter_class=None, 17 | cacheable_methods=None, 18 | ): 19 | 20 | cache = DictCache() if cache is None else cache 21 | adapter_class = adapter_class or CacheControlAdapter 22 | adapter = adapter_class( 23 | cache, 24 | cache_etags=cache_etags, 25 | serializer=serializer, 26 | heuristic=heuristic, 27 | controller_class=controller_class, 28 | cacheable_methods=cacheable_methods, 29 | ) 30 | sess.mount("http://", adapter) 31 | sess.mount("https://", adapter) 32 | 33 | return sess 34 | -------------------------------------------------------------------------------- /pur/packages/pip/__main__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | # Remove '' and current working directory from the first entry 5 | # of sys.path, if present to avoid using current directory 6 | # in pip commands check, freeze, install, list and show, 7 | # when invoked as python -m pip 8 | if sys.path[0] in ("", os.getcwd()): 9 | sys.path.pop(0) 10 | 11 | # If we are running from a wheel, add the wheel to sys.path 12 | # This allows the usage python pip-*.whl/pip install pip-*.whl 13 | if __package__ == "": 14 | # __file__ is pip-*.whl/pip/__main__.py 15 | # first dirname call strips of '/__main__.py', second strips off '/pip' 16 | # Resulting path is the name of the wheel itself 17 | # Add that to sys.path so we can import pip 18 | path = os.path.dirname(os.path.dirname(__file__)) 19 | sys.path.insert(0, path) 20 | 21 | if __name__ == "__main__": 22 | from pip._internal.cli.main import main as _main 23 | 24 | sys.exit(_main()) 25 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/distributions/__init__.py: -------------------------------------------------------------------------------- 1 | from pip._internal.distributions.base import AbstractDistribution 2 | from pip._internal.distributions.sdist import SourceDistribution 3 | from pip._internal.distributions.wheel import WheelDistribution 4 | from pip._internal.req.req_install import InstallRequirement 5 | 6 | 7 | def make_distribution_for_install_requirement( 8 | install_req: InstallRequirement, 9 | ) -> AbstractDistribution: 10 | """Returns a Distribution for the given InstallRequirement""" 11 | # Editable requirements will always be source distributions. They use the 12 | # legacy logic until we create a modern standard for them. 13 | if install_req.editable: 14 | return SourceDistribution(install_req) 15 | 16 | # If it's a wheel, it's a WheelDistribution 17 | if install_req.is_wheel: 18 | return WheelDistribution(install_req) 19 | 20 | # Otherwise, a SourceDistribution 21 | return SourceDistribution(install_req) 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/inject_securetransport.py: -------------------------------------------------------------------------------- 1 | """A helper module that injects SecureTransport, on import. 2 | 3 | The import should be done as early as possible, to ensure all requests and 4 | sessions (or whatever) are created after injecting SecureTransport. 5 | 6 | Note that we only do the injection on macOS, when the linked OpenSSL is too 7 | old to handle TLSv1.2. 8 | """ 9 | 10 | import sys 11 | 12 | 13 | def inject_securetransport() -> None: 14 | # Only relevant on macOS 15 | if sys.platform != "darwin": 16 | return 17 | 18 | try: 19 | import ssl 20 | except ImportError: 21 | return 22 | 23 | # Checks for OpenSSL 1.0.1 24 | if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F: 25 | return 26 | 27 | try: 28 | from pip._vendor.urllib3.contrib import securetransport 29 | except (ImportError, OSError): 30 | return 31 | 32 | securetransport.inject_into_urllib3() 33 | 34 | 35 | inject_securetransport() 36 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/pager.py: -------------------------------------------------------------------------------- 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()) 35 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - master 7 | jobs: 8 | tests: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] 13 | name: Run Tests with Python ${{ matrix.python-version }} 14 | steps: 15 | - 16 | name: Checkout 17 | uses: actions/checkout@v4 18 | - name: Set up Python 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: ${{ matrix.python-version }} 22 | architecture: x64 23 | - 24 | name: Install Dependencies 25 | run: pip install -r dev-requirements.txt 26 | - 27 | name: Unit tests 28 | run: pytest --cov=./pur --cov-report=xml 29 | - 30 | name: Upload Coverage 31 | uses: codecov/codecov-action@v5 32 | with: 33 | token: ${{ secrets.CODECOV_TOKEN }} 34 | flags: unittests 35 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/abc.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | 4 | class RichRenderable(ABC): 5 | """An abstract base class for Rich renderables. 6 | 7 | Note that there is no need to extend this class, the intended use is to check if an 8 | object supports the Rich renderable protocol. For example:: 9 | 10 | if isinstance(my_object, RichRenderable): 11 | console.print(my_object) 12 | 13 | """ 14 | 15 | @classmethod 16 | def __subclasshook__(cls, other: type) -> bool: 17 | """Check if this class supports the rich render protocol.""" 18 | return hasattr(other, "__rich_console__") or hasattr(other, "__rich__") 19 | 20 | 21 | if __name__ == "__main__": # pragma: no cover 22 | from pip._vendor.rich.text import Text 23 | 24 | t = Text() 25 | print(isinstance(Text, RichRenderable)) 26 | print(isinstance(t, RichRenderable)) 27 | 28 | class Foo: 29 | pass 30 | 31 | f = Foo() 32 | print(isinstance(f, RichRenderable)) 33 | print(isinstance("", RichRenderable)) 34 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/__init__.py: -------------------------------------------------------------------------------- 1 | from .package_data import __version__ 2 | from .core import ( 3 | IDNABidiError, 4 | IDNAError, 5 | InvalidCodepoint, 6 | InvalidCodepointContext, 7 | alabel, 8 | check_bidi, 9 | check_hyphen_ok, 10 | check_initial_combiner, 11 | check_label, 12 | check_nfc, 13 | decode, 14 | encode, 15 | ulabel, 16 | uts46_remap, 17 | valid_contextj, 18 | valid_contexto, 19 | valid_label_length, 20 | valid_string_length, 21 | ) 22 | from .intranges import intranges_contain 23 | 24 | __all__ = [ 25 | "IDNABidiError", 26 | "IDNAError", 27 | "InvalidCodepoint", 28 | "InvalidCodepointContext", 29 | "alabel", 30 | "check_bidi", 31 | "check_hyphen_ok", 32 | "check_initial_combiner", 33 | "check_label", 34 | "check_nfc", 35 | "decode", 36 | "encode", 37 | "intranges_contain", 38 | "ulabel", 39 | "uts46_remap", 40 | "valid_contextj", 41 | "valid_contexto", 42 | "valid_label_length", 43 | "valid_string_length", 44 | ] 45 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pkg_resources/LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to 3 | deal in the Software without restriction, including without limitation the 4 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 5 | sell copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 16 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 17 | IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyparsing/LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining 2 | a copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to 7 | the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be 10 | included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 16 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 17 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Will McGugan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/six.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 Benjamin Peterson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/certifi/LICENSE: -------------------------------------------------------------------------------- 1 | This package contains a modified version of ca-bundle.crt: 2 | 3 | ca-bundle.crt -- Bundle of CA Root Certificates 4 | 5 | Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# 6 | This is a bundle of X.509 certificates of public Certificate Authorities 7 | (CA). These were automatically extracted from Mozilla's root certificates 8 | file (certdata.txt). This file can be found in the mozilla source tree: 9 | https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt 10 | It contains the certificates in PEM format and therefore 11 | can be directly used with curl / libcurl / php_curl, or with 12 | an Apache+mod_ssl webserver for SSL client authentication. 13 | Just configure this file as the SSLCACertificateFile.# 14 | 15 | ***** BEGIN LICENSE BLOCK ***** 16 | This Source Code Form is subject to the terms of the Mozilla Public License, 17 | v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain 18 | one at http://mozilla.org/MPL/2.0/. 19 | 20 | ***** END LICENSE BLOCK ***** 21 | @(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/diagnose.py: -------------------------------------------------------------------------------- 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 | "TERM", 19 | "COLORTERM", 20 | "CLICOLOR", 21 | "NO_COLOR", 22 | "TERM_PROGRAM", 23 | "COLUMNS", 24 | "LINES", 25 | "JUPYTER_COLUMNS", 26 | "JUPYTER_LINES", 27 | "JPY_PARENT_PID", 28 | "VSCODE_VERBOSE_LOGGING", 29 | ) 30 | env = {name: os.getenv(name) for name in env_names} 31 | console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables")) 32 | 33 | console.print(f'platform="{platform.system()}"') 34 | 35 | 36 | if __name__ == "__main__": # pragma: no cover 37 | report() 38 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/contrib/_appengine_environ.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module provides means to detect the App Engine environment. 3 | """ 4 | 5 | import os 6 | 7 | 8 | def is_appengine(): 9 | return is_local_appengine() or is_prod_appengine() 10 | 11 | 12 | def is_appengine_sandbox(): 13 | """Reports if the app is running in the first generation sandbox. 14 | 15 | The second generation runtimes are technically still in a sandbox, but it 16 | is much less restrictive, so generally you shouldn't need to check for it. 17 | see https://cloud.google.com/appengine/docs/standard/runtimes 18 | """ 19 | return is_appengine() and os.environ["APPENGINE_RUNTIME"] == "python27" 20 | 21 | 22 | def is_local_appengine(): 23 | return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 24 | "SERVER_SOFTWARE", "" 25 | ).startswith("Development/") 26 | 27 | 28 | def is_prod_appengine(): 29 | return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 30 | "SERVER_SOFTWARE", "" 31 | ).startswith("Google App Engine/") 32 | 33 | 34 | def is_prod_appengine_mvms(): 35 | """Deprecated.""" 36 | return False 37 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/models/candidate.py: -------------------------------------------------------------------------------- 1 | from pip._vendor.packaging.version import parse as parse_version 2 | 3 | from pip._internal.models.link import Link 4 | from pip._internal.utils.models import KeyBasedCompareMixin 5 | 6 | 7 | class InstallationCandidate(KeyBasedCompareMixin): 8 | """Represents a potential "candidate" for installation.""" 9 | 10 | __slots__ = ["name", "version", "link"] 11 | 12 | def __init__(self, name: str, version: str, link: Link) -> None: 13 | self.name = name 14 | self.version = parse_version(version) 15 | self.link = link 16 | 17 | super().__init__( 18 | key=(self.name, self.version, self.link), 19 | defining_class=InstallationCandidate, 20 | ) 21 | 22 | def __repr__(self) -> str: 23 | return "".format( 24 | self.name, 25 | self.version, 26 | self.link, 27 | ) 28 | 29 | def __str__(self) -> str: 30 | return "{!r} candidate (version {} at {})".format( 31 | self.name, 32 | self.version, 33 | self.link, 34 | ) 35 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/models/index.py: -------------------------------------------------------------------------------- 1 | import urllib.parse 2 | 3 | 4 | class PackageIndex: 5 | """Represents a Package Index and provides easier access to endpoints""" 6 | 7 | __slots__ = ["url", "netloc", "simple_url", "pypi_url", "file_storage_domain"] 8 | 9 | def __init__(self, url: str, file_storage_domain: str) -> None: 10 | super().__init__() 11 | self.url = url 12 | self.netloc = urllib.parse.urlsplit(url).netloc 13 | self.simple_url = self._url_for_path("simple") 14 | self.pypi_url = self._url_for_path("pypi") 15 | 16 | # This is part of a temporary hack used to block installs of PyPI 17 | # packages which depend on external urls only necessary until PyPI can 18 | # block such packages themselves 19 | self.file_storage_domain = file_storage_domain 20 | 21 | def _url_for_path(self, path: str) -> str: 22 | return urllib.parse.urljoin(self.url, path) 23 | 24 | 25 | PyPI = PackageIndex("https://pypi.org/", file_storage_domain="files.pythonhosted.org") 26 | TestPyPI = PackageIndex( 27 | "https://test.pypi.org/", file_storage_domain="test-files.pythonhosted.org" 28 | ) 29 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tomli/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Taneli Hukkinen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pyproject_hooks/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Thomas Kluyver 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/platformdirs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2010-202x The platformdirs developers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/_log.py: -------------------------------------------------------------------------------- 1 | """Customize logging 2 | 3 | Defines custom logger class for the `logger.verbose(...)` method. 4 | 5 | init_logging() must be called before any other modules that call logging.getLogger. 6 | """ 7 | 8 | import logging 9 | from typing import Any, cast 10 | 11 | # custom log level for `--verbose` output 12 | # between DEBUG and INFO 13 | VERBOSE = 15 14 | 15 | 16 | class VerboseLogger(logging.Logger): 17 | """Custom Logger, defining a verbose log-level 18 | 19 | VERBOSE is between INFO and DEBUG. 20 | """ 21 | 22 | def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None: 23 | return self.log(VERBOSE, msg, *args, **kwargs) 24 | 25 | 26 | def getLogger(name: str) -> VerboseLogger: 27 | """logging.getLogger, but ensures our VerboseLogger class is returned""" 28 | return cast(VerboseLogger, logging.getLogger(name)) 29 | 30 | 31 | def init_logging() -> None: 32 | """Register our VerboseLogger and VERBOSE log level. 33 | 34 | Should be called before any calls to getLogger(), 35 | i.e. in pip._internal.__init__ 36 | """ 37 | logging.setLoggerClass(VerboseLogger) 38 | logging.addLevelName(VERBOSE, "VERBOSE") 39 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments/modeline.py: -------------------------------------------------------------------------------- 1 | """ 2 | pygments.modeline 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | A simple modeline parser (based on pymodeline). 6 | 7 | :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | """ 10 | 11 | import re 12 | 13 | __all__ = ['get_filetype_from_buffer'] 14 | 15 | 16 | modeline_re = re.compile(r''' 17 | (?: vi | vim | ex ) (?: [<=>]? \d* )? : 18 | .* (?: ft | filetype | syn | syntax ) = ( [^:\s]+ ) 19 | ''', re.VERBOSE) 20 | 21 | 22 | def get_filetype_from_line(l): 23 | m = modeline_re.search(l) 24 | if m: 25 | return m.group(1) 26 | 27 | 28 | def get_filetype_from_buffer(buf, max_lines=5): 29 | """ 30 | Scan the buffer for modelines and return filetype if one is found. 31 | """ 32 | lines = buf.splitlines() 33 | for l in lines[-1:-max_lines-1:-1]: 34 | ret = get_filetype_from_line(l) 35 | if ret: 36 | return ret 37 | for i in range(max_lines, -1, -1): 38 | if i < len(lines): 39 | ret = get_filetype_from_line(lines[i]) 40 | if ret: 41 | return ret 42 | 43 | return None 44 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2008-2020 Andrey Petrov and contributors (see CONTRIBUTORS.txt) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_emoji_replace.py: -------------------------------------------------------------------------------- 1 | from typing import Callable, Match, Optional 2 | import re 3 | 4 | from ._emoji_codes import EMOJI 5 | 6 | 7 | _ReStringMatch = Match[str] # regex match object 8 | _ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub 9 | _EmojiSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re 10 | 11 | 12 | def _emoji_replace( 13 | text: str, 14 | default_variant: Optional[str] = None, 15 | _emoji_sub: _EmojiSubMethod = re.compile(r"(:(\S*?)(?:(?:\-)(emoji|text))?:)").sub, 16 | ) -> str: 17 | """Replace emoji code in text.""" 18 | get_emoji = EMOJI.__getitem__ 19 | variants = {"text": "\uFE0E", "emoji": "\uFE0F"} 20 | get_variant = variants.get 21 | default_variant_code = variants.get(default_variant, "") if default_variant else "" 22 | 23 | def do_replace(match: Match[str]) -> str: 24 | emoji_code, emoji_name, variant = match.groups() 25 | try: 26 | return get_emoji(emoji_name.lower()) + get_variant( 27 | variant, default_variant_code 28 | ) 29 | except KeyError: 30 | return emoji_code 31 | 32 | return _emoji_sub(do_replace, text) 33 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/caches/redis_cache.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from __future__ import division 6 | 7 | from datetime import datetime 8 | from pip._vendor.cachecontrol.cache import BaseCache 9 | 10 | 11 | class RedisCache(BaseCache): 12 | 13 | def __init__(self, conn): 14 | self.conn = conn 15 | 16 | def get(self, key): 17 | return self.conn.get(key) 18 | 19 | def set(self, key, value, expires=None): 20 | if not expires: 21 | self.conn.set(key, value) 22 | elif isinstance(expires, datetime): 23 | expires = expires - datetime.utcnow() 24 | self.conn.setex(key, int(expires.total_seconds()), value) 25 | else: 26 | self.conn.setex(key, expires, value) 27 | 28 | def delete(self, key): 29 | self.conn.delete(key) 30 | 31 | def clear(self): 32 | """Helper for clearing all the keys in a database. Use with 33 | caution!""" 34 | for key in self.conn.keys(): 35 | self.conn.delete(key) 36 | 37 | def close(self): 38 | """Redis uses connection pooling, no need to close the connection.""" 39 | pass 40 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/color_triplet.py: -------------------------------------------------------------------------------- 1 | from typing import NamedTuple, Tuple 2 | 3 | 4 | class ColorTriplet(NamedTuple): 5 | """The red, green, and blue components of a color.""" 6 | 7 | red: int 8 | """Red component in 0 to 255 range.""" 9 | green: int 10 | """Green component in 0 to 255 range.""" 11 | blue: int 12 | """Blue component in 0 to 255 range.""" 13 | 14 | @property 15 | def hex(self) -> str: 16 | """get the color triplet in CSS style.""" 17 | red, green, blue = self 18 | return f"#{red:02x}{green:02x}{blue:02x}" 19 | 20 | @property 21 | def rgb(self) -> str: 22 | """The color in RGB format. 23 | 24 | Returns: 25 | str: An rgb color, e.g. ``"rgb(100,23,255)"``. 26 | """ 27 | red, green, blue = self 28 | return f"rgb({red},{green},{blue})" 29 | 30 | @property 31 | def normalized(self) -> Tuple[float, float, float]: 32 | """Convert components into floats between 0 and 1. 33 | 34 | Returns: 35 | Tuple[float, float, float]: A tuple of three normalized colour components. 36 | """ 37 | red, green, blue = self 38 | return red / 255.0, green / 255.0, blue / 255.0 39 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/distro/__init__.py: -------------------------------------------------------------------------------- 1 | from .distro import ( 2 | NORMALIZED_DISTRO_ID, 3 | NORMALIZED_LSB_ID, 4 | NORMALIZED_OS_ID, 5 | LinuxDistribution, 6 | __version__, 7 | build_number, 8 | codename, 9 | distro_release_attr, 10 | distro_release_info, 11 | id, 12 | info, 13 | like, 14 | linux_distribution, 15 | lsb_release_attr, 16 | lsb_release_info, 17 | major_version, 18 | minor_version, 19 | name, 20 | os_release_attr, 21 | os_release_info, 22 | uname_attr, 23 | uname_info, 24 | version, 25 | version_parts, 26 | ) 27 | 28 | __all__ = [ 29 | "NORMALIZED_DISTRO_ID", 30 | "NORMALIZED_LSB_ID", 31 | "NORMALIZED_OS_ID", 32 | "LinuxDistribution", 33 | "build_number", 34 | "codename", 35 | "distro_release_attr", 36 | "distro_release_info", 37 | "id", 38 | "info", 39 | "like", 40 | "linux_distribution", 41 | "lsb_release_attr", 42 | "lsb_release_info", 43 | "major_version", 44 | "minor_version", 45 | "name", 46 | "os_release_attr", 47 | "os_release_info", 48 | "uname_attr", 49 | "uname_info", 50 | "version", 51 | "version_parts", 52 | ] 53 | 54 | __version__ = __version__ 55 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/build/wheel.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from typing import Optional 4 | 5 | from pip._vendor.pyproject_hooks import BuildBackendHookCaller 6 | 7 | from pip._internal.utils.subprocess import runner_with_spinner_message 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | def build_wheel_pep517( 13 | name: str, 14 | backend: BuildBackendHookCaller, 15 | metadata_directory: str, 16 | tempd: str, 17 | ) -> Optional[str]: 18 | """Build one InstallRequirement using the PEP 517 build process. 19 | 20 | Returns path to wheel if successfully built. Otherwise, returns None. 21 | """ 22 | assert metadata_directory is not None 23 | try: 24 | logger.debug("Destination directory: %s", tempd) 25 | 26 | runner = runner_with_spinner_message( 27 | f"Building wheel for {name} (pyproject.toml)" 28 | ) 29 | with backend.subprocess_runner(runner): 30 | wheel_name = backend.build_wheel( 31 | tempd, 32 | metadata_directory=metadata_directory, 33 | ) 34 | except Exception: 35 | logger.error("Failed building wheel for %s", name) 36 | return None 37 | return os.path.join(tempd, wheel_name) 38 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Pur includes some vendorized python libraries to ease installation. 2 | 3 | 4 | Pip License 5 | =========== 6 | 7 | Copyright (c) 2008-2016 The pip developers (see AUTHORS.txt file) 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | "Software"), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/msgpack/exceptions.py: -------------------------------------------------------------------------------- 1 | class UnpackException(Exception): 2 | """Base class for some exceptions raised while unpacking. 3 | 4 | NOTE: unpack may raise exception other than subclass of 5 | UnpackException. If you want to catch all error, catch 6 | Exception instead. 7 | """ 8 | 9 | 10 | class BufferFull(UnpackException): 11 | pass 12 | 13 | 14 | class OutOfData(UnpackException): 15 | pass 16 | 17 | 18 | class FormatError(ValueError, UnpackException): 19 | """Invalid msgpack format""" 20 | 21 | 22 | class StackError(ValueError, UnpackException): 23 | """Too nested""" 24 | 25 | 26 | # Deprecated. Use ValueError instead 27 | UnpackValueError = ValueError 28 | 29 | 30 | class ExtraData(UnpackValueError): 31 | """ExtraData is raised when there is trailing data. 32 | 33 | This exception is raised while only one-shot (not streaming) 34 | unpack. 35 | """ 36 | 37 | def __init__(self, unpacked, extra): 38 | self.unpacked = unpacked 39 | self.extra = extra 40 | 41 | def __str__(self): 42 | return "unpack(b) received extra data." 43 | 44 | 45 | # Deprecated. Use Exception instead to catch all exception during packing. 46 | PackException = Exception 47 | PackValueError = ValueError 48 | PackOverflowError = OverflowError 49 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/structs.pyi: -------------------------------------------------------------------------------- 1 | from abc import ABCMeta 2 | from typing import ( 3 | Callable, 4 | Container, 5 | Generic, 6 | Iterable, 7 | Iterator, 8 | Mapping, 9 | Tuple, 10 | TypeVar, 11 | Union, 12 | ) 13 | 14 | KT = TypeVar("KT") # Identifier. 15 | RT = TypeVar("RT") # Requirement. 16 | CT = TypeVar("CT") # Candidate. 17 | _T = TypeVar("_T") 18 | 19 | Matches = Union[Iterable[CT], Callable[[], Iterable[CT]]] 20 | 21 | class IteratorMapping(Mapping[KT, _T], metaclass=ABCMeta): 22 | pass 23 | 24 | class IterableView(Container[CT], Iterable[CT], metaclass=ABCMeta): 25 | pass 26 | 27 | class DirectedGraph(Generic[KT]): 28 | def __iter__(self) -> Iterator[KT]: ... 29 | def __len__(self) -> int: ... 30 | def __contains__(self, key: KT) -> bool: ... 31 | def copy(self) -> "DirectedGraph[KT]": ... 32 | def add(self, key: KT) -> None: ... 33 | def remove(self, key: KT) -> None: ... 34 | def connected(self, f: KT, t: KT) -> bool: ... 35 | def connect(self, f: KT, t: KT) -> None: ... 36 | def iter_edges(self) -> Iterable[Tuple[KT, KT]]: ... 37 | def iter_children(self, key: KT) -> Iterable[KT]: ... 38 | def iter_parents(self, key: KT) -> Iterable[KT]: ... 39 | 40 | def build_iter_view(matches: Matches) -> IterableView[CT]: ... 41 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/commands/help.py: -------------------------------------------------------------------------------- 1 | from optparse import Values 2 | from typing import List 3 | 4 | from pip._internal.cli.base_command import Command 5 | from pip._internal.cli.status_codes import SUCCESS 6 | from pip._internal.exceptions import CommandError 7 | 8 | 9 | class HelpCommand(Command): 10 | """Show help for commands""" 11 | 12 | usage = """ 13 | %prog """ 14 | ignore_require_venv = True 15 | 16 | def run(self, options: Values, args: List[str]) -> int: 17 | from pip._internal.commands import ( 18 | commands_dict, 19 | create_command, 20 | get_similar_commands, 21 | ) 22 | 23 | try: 24 | # 'pip help' with no args is handled by pip.__init__.parseopt() 25 | cmd_name = args[0] # the command we need help for 26 | except IndexError: 27 | return SUCCESS 28 | 29 | if cmd_name not in commands_dict: 30 | guess = get_similar_commands(cmd_name) 31 | 32 | msg = [f'unknown command "{cmd_name}"'] 33 | if guess: 34 | msg.append(f'maybe you meant "{guess}"') 35 | 36 | raise CommandError(" - ".join(msg)) 37 | 38 | command = create_command(cmd_name) 39 | command.parser.print_help() 40 | 41 | return SUCCESS 42 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/distributions/wheel.py: -------------------------------------------------------------------------------- 1 | from pip._vendor.packaging.utils import canonicalize_name 2 | 3 | from pip._internal.distributions.base import AbstractDistribution 4 | from pip._internal.index.package_finder import PackageFinder 5 | from pip._internal.metadata import ( 6 | BaseDistribution, 7 | FilesystemWheel, 8 | get_wheel_distribution, 9 | ) 10 | 11 | 12 | class WheelDistribution(AbstractDistribution): 13 | """Represents a wheel distribution. 14 | 15 | This does not need any preparation as wheels can be directly unpacked. 16 | """ 17 | 18 | def get_metadata_distribution(self) -> BaseDistribution: 19 | """Loads the metadata from the wheel file into memory and returns a 20 | Distribution that uses it, not relying on the wheel file or 21 | requirement. 22 | """ 23 | assert self.req.local_file_path, "Set as part of preparation during download" 24 | assert self.req.name, "Wheels are never unnamed" 25 | wheel = FilesystemWheel(self.req.local_file_path) 26 | return get_wheel_distribution(wheel, canonicalize_name(self.req.name)) 27 | 28 | def prepare_distribution_metadata( 29 | self, 30 | finder: PackageFinder, 31 | build_isolation: bool, 32 | check_build_deps: bool, 33 | ) -> None: 34 | pass 35 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/encoding.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | import locale 3 | import re 4 | import sys 5 | from typing import List, Tuple 6 | 7 | BOMS: List[Tuple[bytes, str]] = [ 8 | (codecs.BOM_UTF8, "utf-8"), 9 | (codecs.BOM_UTF16, "utf-16"), 10 | (codecs.BOM_UTF16_BE, "utf-16-be"), 11 | (codecs.BOM_UTF16_LE, "utf-16-le"), 12 | (codecs.BOM_UTF32, "utf-32"), 13 | (codecs.BOM_UTF32_BE, "utf-32-be"), 14 | (codecs.BOM_UTF32_LE, "utf-32-le"), 15 | ] 16 | 17 | ENCODING_RE = re.compile(rb"coding[:=]\s*([-\w.]+)") 18 | 19 | 20 | def auto_decode(data: bytes) -> str: 21 | """Check a bytes string for a BOM to correctly detect the encoding 22 | 23 | Fallback to locale.getpreferredencoding(False) like open() on Python3""" 24 | for bom, encoding in BOMS: 25 | if data.startswith(bom): 26 | return data[len(bom) :].decode(encoding) 27 | # Lets check the first two lines as in PEP263 28 | for line in data.split(b"\n")[:2]: 29 | if line[0:1] == b"#" and ENCODING_RE.search(line): 30 | result = ENCODING_RE.search(line) 31 | assert result is not None 32 | encoding = result.groups()[0].decode("ascii") 33 | return data.decode(encoding) 34 | return data.decode( 35 | locale.getpreferredencoding(False) or sys.getdefaultencoding(), 36 | ) 37 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/models.py: -------------------------------------------------------------------------------- 1 | """Utilities for defining models 2 | """ 3 | 4 | import operator 5 | from typing import Any, Callable, Type 6 | 7 | 8 | class KeyBasedCompareMixin: 9 | """Provides comparison capabilities that is based on a key""" 10 | 11 | __slots__ = ["_compare_key", "_defining_class"] 12 | 13 | def __init__(self, key: Any, defining_class: Type["KeyBasedCompareMixin"]) -> None: 14 | self._compare_key = key 15 | self._defining_class = defining_class 16 | 17 | def __hash__(self) -> int: 18 | return hash(self._compare_key) 19 | 20 | def __lt__(self, other: Any) -> bool: 21 | return self._compare(other, operator.__lt__) 22 | 23 | def __le__(self, other: Any) -> bool: 24 | return self._compare(other, operator.__le__) 25 | 26 | def __gt__(self, other: Any) -> bool: 27 | return self._compare(other, operator.__gt__) 28 | 29 | def __ge__(self, other: Any) -> bool: 30 | return self._compare(other, operator.__ge__) 31 | 32 | def __eq__(self, other: Any) -> bool: 33 | return self._compare(other, operator.__eq__) 34 | 35 | def _compare(self, other: Any, method: Callable[[Any, Any], bool]) -> bool: 36 | if not isinstance(other, self._defining_class): 37 | return NotImplemented 38 | 39 | return method(self._compare_key, other._compare_key) 40 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/util/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # For backwards compatibility, provide imports that used to be here. 4 | from .connection import is_connection_dropped 5 | from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers 6 | from .response import is_fp_closed 7 | from .retry import Retry 8 | from .ssl_ import ( 9 | ALPN_PROTOCOLS, 10 | HAS_SNI, 11 | IS_PYOPENSSL, 12 | IS_SECURETRANSPORT, 13 | PROTOCOL_TLS, 14 | SSLContext, 15 | assert_fingerprint, 16 | resolve_cert_reqs, 17 | resolve_ssl_version, 18 | ssl_wrap_socket, 19 | ) 20 | from .timeout import Timeout, current_time 21 | from .url import Url, get_host, parse_url, split_first 22 | from .wait import wait_for_read, wait_for_write 23 | 24 | __all__ = ( 25 | "HAS_SNI", 26 | "IS_PYOPENSSL", 27 | "IS_SECURETRANSPORT", 28 | "SSLContext", 29 | "PROTOCOL_TLS", 30 | "ALPN_PROTOCOLS", 31 | "Retry", 32 | "Timeout", 33 | "Url", 34 | "assert_fingerprint", 35 | "current_time", 36 | "is_connection_dropped", 37 | "is_fp_closed", 38 | "get_host", 39 | "parse_url", 40 | "make_headers", 41 | "resolve_cert_reqs", 42 | "resolve_ssl_version", 43 | "split_first", 44 | "ssl_wrap_socket", 45 | "wait_for_read", 46 | "wait_for_write", 47 | "SKIP_HEADER", 48 | "SKIPPABLE_HEADERS", 49 | ) 50 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/msgpack/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from .exceptions import * 3 | from .ext import ExtType, Timestamp 4 | 5 | import os 6 | import sys 7 | 8 | 9 | version = (1, 0, 5) 10 | __version__ = "1.0.5" 11 | 12 | 13 | if os.environ.get("MSGPACK_PUREPYTHON") or sys.version_info[0] == 2: 14 | from .fallback import Packer, unpackb, Unpacker 15 | else: 16 | try: 17 | from ._cmsgpack import Packer, unpackb, Unpacker 18 | except ImportError: 19 | from .fallback import Packer, unpackb, Unpacker 20 | 21 | 22 | def pack(o, stream, **kwargs): 23 | """ 24 | Pack object `o` and write it to `stream` 25 | 26 | See :class:`Packer` for options. 27 | """ 28 | packer = Packer(**kwargs) 29 | stream.write(packer.pack(o)) 30 | 31 | 32 | def packb(o, **kwargs): 33 | """ 34 | Pack object `o` and return packed bytes 35 | 36 | See :class:`Packer` for options. 37 | """ 38 | return Packer(**kwargs).pack(o) 39 | 40 | 41 | def unpack(stream, **kwargs): 42 | """ 43 | Unpack an object from `stream`. 44 | 45 | Raises `ExtraData` when `stream` contains extra bytes. 46 | See :class:`Unpacker` for options. 47 | """ 48 | data = stream.read() 49 | return unpackb(data, **kwargs) 50 | 51 | 52 | # alias for compatibility to simplejson/marshal/pickle. 53 | load = unpack 54 | loads = unpackb 55 | 56 | dump = pack 57 | dumps = packb 58 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/distributions/base.py: -------------------------------------------------------------------------------- 1 | import abc 2 | 3 | from pip._internal.index.package_finder import PackageFinder 4 | from pip._internal.metadata.base import BaseDistribution 5 | from pip._internal.req import InstallRequirement 6 | 7 | 8 | class AbstractDistribution(metaclass=abc.ABCMeta): 9 | """A base class for handling installable artifacts. 10 | 11 | The requirements for anything installable are as follows: 12 | 13 | - we must be able to determine the requirement name 14 | (or we can't correctly handle the non-upgrade case). 15 | 16 | - for packages with setup requirements, we must also be able 17 | to determine their requirements without installing additional 18 | packages (for the same reason as run-time dependencies) 19 | 20 | - we must be able to create a Distribution object exposing the 21 | above metadata. 22 | """ 23 | 24 | def __init__(self, req: InstallRequirement) -> None: 25 | super().__init__() 26 | self.req = req 27 | 28 | @abc.abstractmethod 29 | def get_metadata_distribution(self) -> BaseDistribution: 30 | raise NotImplementedError() 31 | 32 | @abc.abstractmethod 33 | def prepare_distribution_metadata( 34 | self, 35 | finder: PackageFinder, 36 | build_isolation: bool, 37 | check_build_deps: bool, 38 | ) -> None: 39 | raise NotImplementedError() 40 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_loop.py: -------------------------------------------------------------------------------- 1 | from typing import Iterable, Tuple, TypeVar 2 | 3 | T = TypeVar("T") 4 | 5 | 6 | def loop_first(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: 7 | """Iterate and generate a tuple with a flag for first value.""" 8 | iter_values = iter(values) 9 | try: 10 | value = next(iter_values) 11 | except StopIteration: 12 | return 13 | yield True, value 14 | for value in iter_values: 15 | yield False, value 16 | 17 | 18 | def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: 19 | """Iterate and generate a tuple with a flag for last value.""" 20 | iter_values = iter(values) 21 | try: 22 | previous_value = next(iter_values) 23 | except StopIteration: 24 | return 25 | for value in iter_values: 26 | yield False, previous_value 27 | previous_value = value 28 | yield True, previous_value 29 | 30 | 31 | def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]: 32 | """Iterate and generate a tuple with a flag for first and last value.""" 33 | iter_values = iter(values) 34 | try: 35 | previous_value = next(iter_values) 36 | except StopIteration: 37 | return 38 | first = True 39 | for value in iter_values: 40 | yield first, False, previous_value 41 | first = False 42 | previous_value = value 43 | yield first, True, previous_value 44 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2022 by the respective authors (see AUTHORS file). 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/LICENSE.BSD: -------------------------------------------------------------------------------- 1 | Copyright (c) Donald Stufft and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/styled.py: -------------------------------------------------------------------------------- 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) 43 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/constrain.py: -------------------------------------------------------------------------------- 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 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | =========== 3 | 4 | Copyright (c) 2016 by the respective authors (see AUTHORS file). 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided 16 | with the distribution. 17 | 18 | THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND 19 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 20 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/install/editable_legacy.py: -------------------------------------------------------------------------------- 1 | """Legacy editable installation process, i.e. `setup.py develop`. 2 | """ 3 | import logging 4 | from typing import Optional, Sequence 5 | 6 | from pip._internal.build_env import BuildEnvironment 7 | from pip._internal.utils.logging import indent_log 8 | from pip._internal.utils.setuptools_build import make_setuptools_develop_args 9 | from pip._internal.utils.subprocess import call_subprocess 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | 14 | def install_editable( 15 | *, 16 | global_options: Sequence[str], 17 | prefix: Optional[str], 18 | home: Optional[str], 19 | use_user_site: bool, 20 | name: str, 21 | setup_py_path: str, 22 | isolated: bool, 23 | build_env: BuildEnvironment, 24 | unpacked_source_directory: str, 25 | ) -> None: 26 | """Install a package in editable mode. Most arguments are pass-through 27 | to setuptools. 28 | """ 29 | logger.info("Running setup.py develop for %s", name) 30 | 31 | args = make_setuptools_develop_args( 32 | setup_py_path, 33 | global_options=global_options, 34 | no_user_config=isolated, 35 | prefix=prefix, 36 | home=home, 37 | use_user_site=use_user_site, 38 | ) 39 | 40 | with indent_log(): 41 | with build_env: 42 | call_subprocess( 43 | args, 44 | command_desc="python setup.py develop", 45 | cwd=unpacked_source_directory, 46 | ) 47 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/providers.pyi: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | Any, 3 | Generic, 4 | Iterable, 5 | Iterator, 6 | Mapping, 7 | Protocol, 8 | Sequence, 9 | Union, 10 | ) 11 | 12 | from .reporters import BaseReporter 13 | from .resolvers import RequirementInformation 14 | from .structs import CT, KT, RT, Matches 15 | 16 | class Preference(Protocol): 17 | def __lt__(self, __other: Any) -> bool: ... 18 | 19 | class AbstractProvider(Generic[RT, CT, KT]): 20 | def identify(self, requirement_or_candidate: Union[RT, CT]) -> KT: ... 21 | def get_preference( 22 | self, 23 | identifier: KT, 24 | resolutions: Mapping[KT, CT], 25 | candidates: Mapping[KT, Iterator[CT]], 26 | information: Mapping[KT, Iterator[RequirementInformation[RT, CT]]], 27 | backtrack_causes: Sequence[RequirementInformation[RT, CT]], 28 | ) -> Preference: ... 29 | def find_matches( 30 | self, 31 | identifier: KT, 32 | requirements: Mapping[KT, Iterator[RT]], 33 | incompatibilities: Mapping[KT, Iterator[CT]], 34 | ) -> Matches: ... 35 | def is_satisfied_by(self, requirement: RT, candidate: CT) -> bool: ... 36 | def get_dependencies(self, candidate: CT) -> Iterable[RT]: ... 37 | 38 | class AbstractResolver(Generic[RT, CT, KT]): 39 | base_exception = Exception 40 | provider: AbstractProvider[RT, CT, KT] 41 | reporter: BaseReporter 42 | def __init__( 43 | self, provider: AbstractProvider[RT, CT, KT], reporter: BaseReporter 44 | ): ... 45 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tenacity/nap.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Étienne Bersac 2 | # Copyright 2016 Julien Danjou 3 | # Copyright 2016 Joshua Harlow 4 | # Copyright 2013-2014 Ray Holder 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | import time 19 | import typing 20 | 21 | if typing.TYPE_CHECKING: 22 | import threading 23 | 24 | 25 | def sleep(seconds: float) -> None: 26 | """ 27 | Sleep strategy that delays execution for a given number of seconds. 28 | 29 | This is the default strategy, and may be mocked out for unit testing. 30 | """ 31 | time.sleep(seconds) 32 | 33 | 34 | class sleep_using_event: 35 | """Sleep strategy that waits on an event to be set.""" 36 | 37 | def __init__(self, event: "threading.Event") -> None: 38 | self.event = event 39 | 40 | def __call__(self, timeout: typing.Optional[float]) -> None: 41 | # NOTE(harlowja): this may *not* actually wait for timeout 42 | # seconds if the event is set (ie this may eject out early). 43 | self.event.wait(timeout=timeout) 44 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/protocol.py: -------------------------------------------------------------------------------- 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) 43 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/webencodings/mklabels.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | webencodings.mklabels 4 | ~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | Regenarate the webencodings.labels module. 7 | 8 | :copyright: Copyright 2012 by Simon Sapin 9 | :license: BSD, see LICENSE for details. 10 | 11 | """ 12 | 13 | import json 14 | try: 15 | from urllib import urlopen 16 | except ImportError: 17 | from urllib.request import urlopen 18 | 19 | 20 | def assert_lower(string): 21 | assert string == string.lower() 22 | return string 23 | 24 | 25 | def generate(url): 26 | parts = ['''\ 27 | """ 28 | 29 | webencodings.labels 30 | ~~~~~~~~~~~~~~~~~~~ 31 | 32 | Map encoding labels to their name. 33 | 34 | :copyright: Copyright 2012 by Simon Sapin 35 | :license: BSD, see LICENSE for details. 36 | 37 | """ 38 | 39 | # XXX Do not edit! 40 | # This file is automatically generated by mklabels.py 41 | 42 | LABELS = { 43 | '''] 44 | labels = [ 45 | (repr(assert_lower(label)).lstrip('u'), 46 | repr(encoding['name']).lstrip('u')) 47 | for category in json.loads(urlopen(url).read().decode('ascii')) 48 | for encoding in category['encodings'] 49 | for label in encoding['labels']] 50 | max_len = max(len(label) for label, name in labels) 51 | parts.extend( 52 | ' %s:%s %s,\n' % (label, ' ' * (max_len - len(label)), name) 53 | for label, name in labels) 54 | parts.append('}') 55 | return ''.join(parts) 56 | 57 | 58 | if __name__ == '__main__': 59 | print(generate('http://encoding.spec.whatwg.org/encodings.json')) 60 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | requests.compat 3 | ~~~~~~~~~~~~~~~ 4 | 5 | This module previously handled import compatibility issues 6 | between Python 2 and Python 3. It remains for backwards 7 | compatibility until the next major version. 8 | """ 9 | 10 | from pip._vendor import chardet 11 | 12 | import sys 13 | 14 | # ------- 15 | # Pythons 16 | # ------- 17 | 18 | # Syntax sugar. 19 | _ver = sys.version_info 20 | 21 | #: Python 2.x? 22 | is_py2 = _ver[0] == 2 23 | 24 | #: Python 3.x? 25 | is_py3 = _ver[0] == 3 26 | 27 | # Note: We've patched out simplejson support in pip because it prevents 28 | # upgrading simplejson on Windows. 29 | import json 30 | from json import JSONDecodeError 31 | 32 | # Keep OrderedDict for backwards compatibility. 33 | from collections import OrderedDict 34 | from collections.abc import Callable, Mapping, MutableMapping 35 | from http import cookiejar as cookielib 36 | from http.cookies import Morsel 37 | from io import StringIO 38 | 39 | # -------------- 40 | # Legacy Imports 41 | # -------------- 42 | from urllib.parse import ( 43 | quote, 44 | quote_plus, 45 | unquote, 46 | unquote_plus, 47 | urldefrag, 48 | urlencode, 49 | urljoin, 50 | urlparse, 51 | urlsplit, 52 | urlunparse, 53 | ) 54 | from urllib.request import ( 55 | getproxies, 56 | getproxies_environment, 57 | parse_http_list, 58 | proxy_bypass, 59 | proxy_bypass_environment, 60 | ) 61 | 62 | builtin_str = str 63 | str = str 64 | bytes = bytes 65 | basestring = (str, bytes) 66 | numeric_types = (int, float) 67 | integer_types = (int,) 68 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/build/metadata.py: -------------------------------------------------------------------------------- 1 | """Metadata generation logic for source distributions. 2 | """ 3 | 4 | import os 5 | 6 | from pip._vendor.pyproject_hooks import BuildBackendHookCaller 7 | 8 | from pip._internal.build_env import BuildEnvironment 9 | from pip._internal.exceptions import ( 10 | InstallationSubprocessError, 11 | MetadataGenerationFailed, 12 | ) 13 | from pip._internal.utils.subprocess import runner_with_spinner_message 14 | from pip._internal.utils.temp_dir import TempDirectory 15 | 16 | 17 | def generate_metadata( 18 | build_env: BuildEnvironment, backend: BuildBackendHookCaller, details: str 19 | ) -> str: 20 | """Generate metadata using mechanisms described in PEP 517. 21 | 22 | Returns the generated metadata directory. 23 | """ 24 | metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) 25 | 26 | metadata_dir = metadata_tmpdir.path 27 | 28 | with build_env: 29 | # Note that BuildBackendHookCaller implements a fallback for 30 | # prepare_metadata_for_build_wheel, so we don't have to 31 | # consider the possibility that this hook doesn't exist. 32 | runner = runner_with_spinner_message("Preparing metadata (pyproject.toml)") 33 | with backend.subprocess_runner(runner): 34 | try: 35 | distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir) 36 | except InstallationSubprocessError as error: 37 | raise MetadataGenerationFailed(package_details=details) from error 38 | 39 | return os.path.join(metadata_dir, distinfo_dir) 40 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/colorama/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Jonathan Hartley 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the copyright holders, nor those of its contributors 15 | may be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/webencodings/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 by Simon Sapin. 2 | 3 | Some rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * The names of the contributors may not be used to endorse or 18 | promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/build/wheel_editable.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from typing import Optional 4 | 5 | from pip._vendor.pyproject_hooks import BuildBackendHookCaller, HookMissing 6 | 7 | from pip._internal.utils.subprocess import runner_with_spinner_message 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | def build_wheel_editable( 13 | name: str, 14 | backend: BuildBackendHookCaller, 15 | metadata_directory: str, 16 | tempd: str, 17 | ) -> Optional[str]: 18 | """Build one InstallRequirement using the PEP 660 build process. 19 | 20 | Returns path to wheel if successfully built. Otherwise, returns None. 21 | """ 22 | assert metadata_directory is not None 23 | try: 24 | logger.debug("Destination directory: %s", tempd) 25 | 26 | runner = runner_with_spinner_message( 27 | f"Building editable for {name} (pyproject.toml)" 28 | ) 29 | with backend.subprocess_runner(runner): 30 | try: 31 | wheel_name = backend.build_editable( 32 | tempd, 33 | metadata_directory=metadata_directory, 34 | ) 35 | except HookMissing as e: 36 | logger.error( 37 | "Cannot build editable %s because the build " 38 | "backend does not have the %s hook", 39 | name, 40 | e, 41 | ) 42 | return None 43 | except Exception: 44 | logger.error("Failed building editable for %s", name) 45 | return None 46 | return os.path.join(tempd, wheel_name) 47 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2013-2021, Kim Davies 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /pur/packages/pip/__pip-runner__.py: -------------------------------------------------------------------------------- 1 | """Execute exactly this copy of pip, within a different environment. 2 | 3 | This file is named as it is, to ensure that this module can't be imported via 4 | an import statement. 5 | """ 6 | 7 | # /!\ This version compatibility check section must be Python 2 compatible. /!\ 8 | 9 | import sys 10 | 11 | # Copied from setup.py 12 | PYTHON_REQUIRES = (3, 7) 13 | 14 | 15 | def version_str(version): # type: ignore 16 | return ".".join(str(v) for v in version) 17 | 18 | 19 | if sys.version_info[:2] < PYTHON_REQUIRES: 20 | raise SystemExit( 21 | "This version of pip does not support python {} (requires >={}).".format( 22 | version_str(sys.version_info[:2]), version_str(PYTHON_REQUIRES) 23 | ) 24 | ) 25 | 26 | # From here on, we can use Python 3 features, but the syntax must remain 27 | # Python 2 compatible. 28 | 29 | import runpy # noqa: E402 30 | from importlib.machinery import PathFinder # noqa: E402 31 | from os.path import dirname # noqa: E402 32 | 33 | PIP_SOURCES_ROOT = dirname(dirname(__file__)) 34 | 35 | 36 | class PipImportRedirectingFinder: 37 | @classmethod 38 | def find_spec(self, fullname, path=None, target=None): # type: ignore 39 | if fullname != "pip": 40 | return None 41 | 42 | spec = PathFinder.find_spec(fullname, [PIP_SOURCES_ROOT], target) 43 | assert spec, (PIP_SOURCES_ROOT, fullname) 44 | return spec 45 | 46 | 47 | sys.meta_path.insert(0, PipImportRedirectingFinder()) 48 | 49 | assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module" 50 | runpy.run_module("pip", run_name="__main__", alter_sys=True) 51 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/_cmd.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import logging 6 | 7 | from pip._vendor import requests 8 | 9 | from pip._vendor.cachecontrol.adapter import CacheControlAdapter 10 | from pip._vendor.cachecontrol.cache import DictCache 11 | from pip._vendor.cachecontrol.controller import logger 12 | 13 | from argparse import ArgumentParser 14 | 15 | 16 | def setup_logging(): 17 | logger.setLevel(logging.DEBUG) 18 | handler = logging.StreamHandler() 19 | logger.addHandler(handler) 20 | 21 | 22 | def get_session(): 23 | adapter = CacheControlAdapter( 24 | DictCache(), cache_etags=True, serializer=None, heuristic=None 25 | ) 26 | sess = requests.Session() 27 | sess.mount("http://", adapter) 28 | sess.mount("https://", adapter) 29 | 30 | sess.cache_controller = adapter.controller 31 | return sess 32 | 33 | 34 | def get_args(): 35 | parser = ArgumentParser() 36 | parser.add_argument("url", help="The URL to try and cache") 37 | return parser.parse_args() 38 | 39 | 40 | def main(args=None): 41 | args = get_args() 42 | sess = get_session() 43 | 44 | # Make a request to get a response 45 | resp = sess.get(args.url) 46 | 47 | # Turn on logging 48 | setup_logging() 49 | 50 | # try setting the cache 51 | sess.cache_controller.cache_response(resp.request, resp.raw) 52 | 53 | # Now try to get it 54 | if sess.cache_controller.cached_request(resp.request): 55 | print("Cached!") 56 | else: 57 | print("Not cached :(") 58 | 59 | 60 | if __name__ == "__main__": 61 | main() 62 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/packages/backports/makefile.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | backports.makefile 4 | ~~~~~~~~~~~~~~~~~~ 5 | 6 | Backports the Python 3 ``socket.makefile`` method for use with anything that 7 | wants to create a "fake" socket object. 8 | """ 9 | import io 10 | from socket import SocketIO 11 | 12 | 13 | def backport_makefile( 14 | self, mode="r", buffering=None, encoding=None, errors=None, newline=None 15 | ): 16 | """ 17 | Backport of ``socket.makefile`` from Python 3.5. 18 | """ 19 | if not set(mode) <= {"r", "w", "b"}: 20 | raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,)) 21 | writing = "w" in mode 22 | reading = "r" in mode or not writing 23 | assert reading or writing 24 | binary = "b" in mode 25 | rawmode = "" 26 | if reading: 27 | rawmode += "r" 28 | if writing: 29 | rawmode += "w" 30 | raw = SocketIO(self, rawmode) 31 | self._makefile_refs += 1 32 | if buffering is None: 33 | buffering = -1 34 | if buffering < 0: 35 | buffering = io.DEFAULT_BUFFER_SIZE 36 | if buffering == 0: 37 | if not binary: 38 | raise ValueError("unbuffered streams must be binary") 39 | return raw 40 | if reading and writing: 41 | buffer = io.BufferedRWPair(raw, raw, buffering) 42 | elif reading: 43 | buffer = io.BufferedReader(raw, buffering) 44 | else: 45 | assert writing 46 | buffer = io.BufferedWriter(raw, buffering) 47 | if binary: 48 | return buffer 49 | text = io.TextIOWrapper(buffer, encoding, errors, newline) 50 | text.mode = mode 51 | return text 52 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/operations/build/metadata_editable.py: -------------------------------------------------------------------------------- 1 | """Metadata generation logic for source distributions. 2 | """ 3 | 4 | import os 5 | 6 | from pip._vendor.pyproject_hooks import BuildBackendHookCaller 7 | 8 | from pip._internal.build_env import BuildEnvironment 9 | from pip._internal.exceptions import ( 10 | InstallationSubprocessError, 11 | MetadataGenerationFailed, 12 | ) 13 | from pip._internal.utils.subprocess import runner_with_spinner_message 14 | from pip._internal.utils.temp_dir import TempDirectory 15 | 16 | 17 | def generate_editable_metadata( 18 | build_env: BuildEnvironment, backend: BuildBackendHookCaller, details: str 19 | ) -> str: 20 | """Generate metadata using mechanisms described in PEP 660. 21 | 22 | Returns the generated metadata directory. 23 | """ 24 | metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) 25 | 26 | metadata_dir = metadata_tmpdir.path 27 | 28 | with build_env: 29 | # Note that BuildBackendHookCaller implements a fallback for 30 | # prepare_metadata_for_build_wheel/editable, so we don't have to 31 | # consider the possibility that this hook doesn't exist. 32 | runner = runner_with_spinner_message( 33 | "Preparing editable metadata (pyproject.toml)" 34 | ) 35 | with backend.subprocess_runner(runner): 36 | try: 37 | distinfo_dir = backend.prepare_metadata_for_build_editable(metadata_dir) 38 | except InstallationSubprocessError as error: 39 | raise MetadataGenerationFailed(package_details=details) from error 40 | 41 | return os.path.join(metadata_dir, distinfo_dir) 42 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_null_file.py: -------------------------------------------------------------------------------- 1 | from types import TracebackType 2 | from typing import IO, Iterable, Iterator, List, Optional, Type 3 | 4 | 5 | class NullFile(IO[str]): 6 | def close(self) -> None: 7 | pass 8 | 9 | def isatty(self) -> bool: 10 | return False 11 | 12 | def read(self, __n: int = 1) -> str: 13 | return "" 14 | 15 | def readable(self) -> bool: 16 | return False 17 | 18 | def readline(self, __limit: int = 1) -> str: 19 | return "" 20 | 21 | def readlines(self, __hint: int = 1) -> List[str]: 22 | return [] 23 | 24 | def seek(self, __offset: int, __whence: int = 1) -> int: 25 | return 0 26 | 27 | def seekable(self) -> bool: 28 | return False 29 | 30 | def tell(self) -> int: 31 | return 0 32 | 33 | def truncate(self, __size: Optional[int] = 1) -> int: 34 | return 0 35 | 36 | def writable(self) -> bool: 37 | return False 38 | 39 | def writelines(self, __lines: Iterable[str]) -> None: 40 | pass 41 | 42 | def __next__(self) -> str: 43 | return "" 44 | 45 | def __iter__(self) -> Iterator[str]: 46 | return iter([""]) 47 | 48 | def __enter__(self) -> IO[str]: 49 | pass 50 | 51 | def __exit__( 52 | self, 53 | __t: Optional[Type[BaseException]], 54 | __value: Optional[BaseException], 55 | __traceback: Optional[TracebackType], 56 | ) -> None: 57 | pass 58 | 59 | def write(self, text: str) -> int: 60 | return 0 61 | 62 | def flush(self) -> None: 63 | pass 64 | 65 | def fileno(self) -> int: 66 | return -1 67 | 68 | 69 | NULL_FILE = NullFile() 70 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | about = {} 4 | with open('pur/__about__.py') as f: 5 | exec(f.read(), about) 6 | 7 | packages = [ 8 | about['__title__'], 9 | ] 10 | 11 | install_requires = [x.strip() for x in open('requirements.txt').readlines()] 12 | 13 | setup( 14 | name=about['__title__'], 15 | version=about['__version__'], 16 | license=about['__license__'], 17 | description=about['__description__'], 18 | long_description=open('README.md').read(), 19 | long_description_content_type="text/markdown", 20 | author=about['__author__'], 21 | author_email=about['__author_email__'], 22 | url=about['__url__'], 23 | packages=packages, 24 | package_dir={about['__title__']: about['__title__']}, 25 | include_package_data=True, 26 | zip_safe=False, 27 | platforms='any', 28 | install_requires=install_requires, 29 | entry_points={ 30 | 'console_scripts': ['pur = pur.__init__:pur'], 31 | }, 32 | classifiers=[ 33 | 'Development Status :: 5 - Production/Stable', 34 | 'Environment :: Console', 35 | 'Intended Audience :: Developers', 36 | 'License :: OSI Approved :: BSD License', 37 | 'Natural Language :: English', 38 | 'Programming Language :: Python', 39 | 'Programming Language :: Python :: 3', 40 | 'Programming Language :: Python :: 3.7', 41 | 'Programming Language :: Python :: 3.8', 42 | 'Programming Language :: Python :: 3.9', 43 | 'Programming Language :: Python :: 3.10', 44 | 'Programming Language :: Python :: 3.11', 45 | 'Programming Language :: Python :: 3.12', 46 | 'Topic :: Software Development :: Build Tools', 47 | ], 48 | ) 49 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/packaging/_structures.py: -------------------------------------------------------------------------------- 1 | # This file is dual licensed under the terms of the Apache License, Version 2 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository 3 | # for complete details. 4 | 5 | 6 | class InfinityType: 7 | def __repr__(self) -> str: 8 | return "Infinity" 9 | 10 | def __hash__(self) -> int: 11 | return hash(repr(self)) 12 | 13 | def __lt__(self, other: object) -> bool: 14 | return False 15 | 16 | def __le__(self, other: object) -> bool: 17 | return False 18 | 19 | def __eq__(self, other: object) -> bool: 20 | return isinstance(other, self.__class__) 21 | 22 | def __gt__(self, other: object) -> bool: 23 | return True 24 | 25 | def __ge__(self, other: object) -> bool: 26 | return True 27 | 28 | def __neg__(self: object) -> "NegativeInfinityType": 29 | return NegativeInfinity 30 | 31 | 32 | Infinity = InfinityType() 33 | 34 | 35 | class NegativeInfinityType: 36 | def __repr__(self) -> str: 37 | return "-Infinity" 38 | 39 | def __hash__(self) -> int: 40 | return hash(repr(self)) 41 | 42 | def __lt__(self, other: object) -> bool: 43 | return True 44 | 45 | def __le__(self, other: object) -> bool: 46 | return True 47 | 48 | def __eq__(self, other: object) -> bool: 49 | return isinstance(other, self.__class__) 50 | 51 | def __gt__(self, other: object) -> bool: 52 | return False 53 | 54 | def __ge__(self, other: object) -> bool: 55 | return False 56 | 57 | def __neg__(self: object) -> InfinityType: 58 | return Infinity 59 | 60 | 61 | NegativeInfinity = NegativeInfinityType() 62 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/platformdirs/__main__.py: -------------------------------------------------------------------------------- 1 | """Main entry point.""" 2 | from __future__ import annotations 3 | 4 | from pip._vendor.platformdirs import PlatformDirs, __version__ 5 | 6 | PROPS = ( 7 | "user_data_dir", 8 | "user_config_dir", 9 | "user_cache_dir", 10 | "user_state_dir", 11 | "user_log_dir", 12 | "user_documents_dir", 13 | "user_downloads_dir", 14 | "user_pictures_dir", 15 | "user_videos_dir", 16 | "user_music_dir", 17 | "user_runtime_dir", 18 | "site_data_dir", 19 | "site_config_dir", 20 | "site_cache_dir", 21 | ) 22 | 23 | 24 | def main() -> None: 25 | """Run main entry point.""" 26 | app_name = "MyApp" 27 | app_author = "MyCompany" 28 | 29 | print(f"-- platformdirs {__version__} --") # noqa: T201 30 | 31 | print("-- app dirs (with optional 'version')") # noqa: T201 32 | dirs = PlatformDirs(app_name, app_author, version="1.0") 33 | for prop in PROPS: 34 | print(f"{prop}: {getattr(dirs, prop)}") # noqa: T201 35 | 36 | print("\n-- app dirs (without optional 'version')") # noqa: T201 37 | dirs = PlatformDirs(app_name, app_author) 38 | for prop in PROPS: 39 | print(f"{prop}: {getattr(dirs, prop)}") # noqa: T201 40 | 41 | print("\n-- app dirs (without optional 'appauthor')") # noqa: T201 42 | dirs = PlatformDirs(app_name) 43 | for prop in PROPS: 44 | print(f"{prop}: {getattr(dirs, prop)}") # noqa: T201 45 | 46 | print("\n-- app dirs (with disabled 'appauthor')") # noqa: T201 47 | dirs = PlatformDirs(app_name, appauthor=False) 48 | for prop in PROPS: 49 | print(f"{prop}: {getattr(dirs, prop)}") # noqa: T201 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/requests/_internal_utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | requests._internal_utils 3 | ~~~~~~~~~~~~~~ 4 | 5 | Provides utility functions that are consumed internally by Requests 6 | which depend on extremely few external helpers (such as compat) 7 | """ 8 | import re 9 | 10 | from .compat import builtin_str 11 | 12 | _VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$") 13 | _VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*$") 14 | _VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") 15 | _VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") 16 | 17 | _HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) 18 | _HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) 19 | HEADER_VALIDATORS = { 20 | bytes: _HEADER_VALIDATORS_BYTE, 21 | str: _HEADER_VALIDATORS_STR, 22 | } 23 | 24 | 25 | def to_native_string(string, encoding="ascii"): 26 | """Given a string object, regardless of type, returns a representation of 27 | that string in the native string type, encoding and decoding where 28 | necessary. This assumes ASCII unless told otherwise. 29 | """ 30 | if isinstance(string, builtin_str): 31 | out = string 32 | else: 33 | out = string.decode(encoding) 34 | 35 | return out 36 | 37 | 38 | def unicode_is_ascii(u_string): 39 | """Determine if unicode string only contains ASCII characters. 40 | 41 | :param str u_string: unicode string to check. Must be unicode 42 | and not Python 2 `str`. 43 | :rtype: bool 44 | """ 45 | assert isinstance(u_string, str) 46 | try: 47 | u_string.encode("ascii") 48 | return True 49 | except UnicodeEncodeError: 50 | return False 51 | -------------------------------------------------------------------------------- /tests/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import logging 5 | import unittest 6 | from contextlib import contextmanager 7 | from unittest.mock import patch 8 | 9 | 10 | def u(text): 11 | if isinstance(text, bytes): 12 | return text.decode('utf-8') 13 | return str(text) 14 | 15 | 16 | class TestCase(unittest.TestCase): 17 | patch_these = [] 18 | 19 | def setUp(self): 20 | # disable logging while testing 21 | logging.disable(logging.CRITICAL) 22 | 23 | self.patched = {} 24 | if hasattr(self, 'patch_these'): 25 | for patch_this in self.patch_these: 26 | namespace = patch_this[0] if isinstance(patch_this, (list, set)) else patch_this 27 | 28 | patcher = patch(namespace) 29 | mocked = patcher.start() 30 | mocked.reset_mock() 31 | self.patched[namespace] = mocked 32 | 33 | if isinstance(patch_this, (list, set)) and len(patch_this) > 0: 34 | retval = patch_this[1] 35 | if callable(retval): 36 | retval = retval() 37 | mocked.return_value = retval 38 | 39 | def tearDown(self): 40 | patch.stopall() 41 | 42 | def normalize_list(self, items): 43 | return sorted([u(x) for x in items]) 44 | 45 | def assertListsEqual(self, first_list, second_list): 46 | self.assertEqual(self.normalize_list(first_list), self.normalize_list(second_list)) 47 | 48 | @contextmanager 49 | def cd(self, newdir): 50 | prevdir = os.getcwd() 51 | os.chdir(os.path.expanduser(newdir)) 52 | try: 53 | yield 54 | finally: 55 | os.chdir(prevdir) 56 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tenacity/before.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Julien Danjou 2 | # Copyright 2016 Joshua Harlow 3 | # Copyright 2013-2014 Ray Holder 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import typing 18 | 19 | from pip._vendor.tenacity import _utils 20 | 21 | if typing.TYPE_CHECKING: 22 | import logging 23 | 24 | from pip._vendor.tenacity import RetryCallState 25 | 26 | 27 | def before_nothing(retry_state: "RetryCallState") -> None: 28 | """Before call strategy that does nothing.""" 29 | 30 | 31 | def before_log(logger: "logging.Logger", log_level: int) -> typing.Callable[["RetryCallState"], None]: 32 | """Before call strategy that logs to some logger the attempt.""" 33 | 34 | def log_it(retry_state: "RetryCallState") -> None: 35 | if retry_state.fn is None: 36 | # NOTE(sileht): can't really happen, but we must please mypy 37 | fn_name = "" 38 | else: 39 | fn_name = _utils.get_callback_name(retry_state.fn) 40 | logger.log( 41 | log_level, 42 | f"Starting call to '{fn_name}', " 43 | f"this is the {_utils.to_ordinal(retry_state.attempt_number)} time calling it.", 44 | ) 45 | 46 | return log_it 47 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/resolvelib/reporters.py: -------------------------------------------------------------------------------- 1 | class BaseReporter(object): 2 | """Delegate class to provider progress reporting for the resolver.""" 3 | 4 | def starting(self): 5 | """Called before the resolution actually starts.""" 6 | 7 | def starting_round(self, index): 8 | """Called before each round of resolution starts. 9 | 10 | The index is zero-based. 11 | """ 12 | 13 | def ending_round(self, index, state): 14 | """Called before each round of resolution ends. 15 | 16 | This is NOT called if the resolution ends at this round. Use `ending` 17 | if you want to report finalization. The index is zero-based. 18 | """ 19 | 20 | def ending(self, state): 21 | """Called before the resolution ends successfully.""" 22 | 23 | def adding_requirement(self, requirement, parent): 24 | """Called when adding a new requirement into the resolve criteria. 25 | 26 | :param requirement: The additional requirement to be applied to filter 27 | the available candidaites. 28 | :param parent: The candidate that requires ``requirement`` as a 29 | dependency, or None if ``requirement`` is one of the root 30 | requirements passed in from ``Resolver.resolve()``. 31 | """ 32 | 33 | def resolving_conflicts(self, causes): 34 | """Called when starting to attempt requirement conflict resolution. 35 | 36 | :param causes: The information on the collision that caused the backtracking. 37 | """ 38 | 39 | def rejecting_candidate(self, criterion, candidate): 40 | """Called when rejecting a candidate during backtracking.""" 41 | 42 | def pinning(self, candidate): 43 | """Called when adding a candidate to the potential solution.""" 44 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/screen.py: -------------------------------------------------------------------------------- 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 55 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/cachecontrol/cache.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2015 Eric Larson 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | """ 6 | The cache object API for implementing caches. The default is a thread 7 | safe in-memory dictionary. 8 | """ 9 | from threading import Lock 10 | 11 | 12 | class BaseCache(object): 13 | 14 | def get(self, key): 15 | raise NotImplementedError() 16 | 17 | def set(self, key, value, expires=None): 18 | raise NotImplementedError() 19 | 20 | def delete(self, key): 21 | raise NotImplementedError() 22 | 23 | def close(self): 24 | pass 25 | 26 | 27 | class DictCache(BaseCache): 28 | 29 | def __init__(self, init_dict=None): 30 | self.lock = Lock() 31 | self.data = init_dict or {} 32 | 33 | def get(self, key): 34 | return self.data.get(key, None) 35 | 36 | def set(self, key, value, expires=None): 37 | with self.lock: 38 | self.data.update({key: value}) 39 | 40 | def delete(self, key): 41 | with self.lock: 42 | if key in self.data: 43 | self.data.pop(key) 44 | 45 | 46 | class SeparateBodyBaseCache(BaseCache): 47 | """ 48 | In this variant, the body is not stored mixed in with the metadata, but is 49 | passed in (as a bytes-like object) in a separate call to ``set_body()``. 50 | 51 | That is, the expected interaction pattern is:: 52 | 53 | cache.set(key, serialized_metadata) 54 | cache.set_body(key) 55 | 56 | Similarly, the body should be loaded separately via ``get_body()``. 57 | """ 58 | def set_body(self, key, body): 59 | raise NotImplementedError() 60 | 61 | def get_body(self, key): 62 | """ 63 | Return the body as file-like object. 64 | """ 65 | raise NotImplementedError() 66 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/urllib3/util/proxy.py: -------------------------------------------------------------------------------- 1 | from .ssl_ import create_urllib3_context, resolve_cert_reqs, resolve_ssl_version 2 | 3 | 4 | def connection_requires_http_tunnel( 5 | proxy_url=None, proxy_config=None, destination_scheme=None 6 | ): 7 | """ 8 | Returns True if the connection requires an HTTP CONNECT through the proxy. 9 | 10 | :param URL proxy_url: 11 | URL of the proxy. 12 | :param ProxyConfig proxy_config: 13 | Proxy configuration from poolmanager.py 14 | :param str destination_scheme: 15 | The scheme of the destination. (i.e https, http, etc) 16 | """ 17 | # If we're not using a proxy, no way to use a tunnel. 18 | if proxy_url is None: 19 | return False 20 | 21 | # HTTP destinations never require tunneling, we always forward. 22 | if destination_scheme == "http": 23 | return False 24 | 25 | # Support for forwarding with HTTPS proxies and HTTPS destinations. 26 | if ( 27 | proxy_url.scheme == "https" 28 | and proxy_config 29 | and proxy_config.use_forwarding_for_https 30 | ): 31 | return False 32 | 33 | # Otherwise always use a tunnel. 34 | return True 35 | 36 | 37 | def create_proxy_ssl_context( 38 | ssl_version, cert_reqs, ca_certs=None, ca_cert_dir=None, ca_cert_data=None 39 | ): 40 | """ 41 | Generates a default proxy ssl context if one hasn't been provided by the 42 | user. 43 | """ 44 | ssl_context = create_urllib3_context( 45 | ssl_version=resolve_ssl_version(ssl_version), 46 | cert_reqs=resolve_cert_reqs(cert_reqs), 47 | ) 48 | 49 | if ( 50 | not ca_certs 51 | and not ca_cert_dir 52 | and not ca_cert_data 53 | and hasattr(ssl_context, "load_default_certs") 54 | ): 55 | ssl_context.load_default_certs() 56 | 57 | return ssl_context 58 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/appdirs.py: -------------------------------------------------------------------------------- 1 | """ 2 | This code wraps the vendored appdirs module to so the return values are 3 | compatible for the current pip code base. 4 | 5 | The intention is to rewrite current usages gradually, keeping the tests pass, 6 | and eventually drop this after all usages are changed. 7 | """ 8 | 9 | import os 10 | import sys 11 | from typing import List 12 | 13 | from pip._vendor import platformdirs as _appdirs 14 | 15 | 16 | def user_cache_dir(appname: str) -> str: 17 | return _appdirs.user_cache_dir(appname, appauthor=False) 18 | 19 | 20 | def _macos_user_config_dir(appname: str, roaming: bool = True) -> str: 21 | # Use ~/Application Support/pip, if the directory exists. 22 | path = _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming) 23 | if os.path.isdir(path): 24 | return path 25 | 26 | # Use a Linux-like ~/.config/pip, by default. 27 | linux_like_path = "~/.config/" 28 | if appname: 29 | linux_like_path = os.path.join(linux_like_path, appname) 30 | 31 | return os.path.expanduser(linux_like_path) 32 | 33 | 34 | def user_config_dir(appname: str, roaming: bool = True) -> str: 35 | if sys.platform == "darwin": 36 | return _macos_user_config_dir(appname, roaming) 37 | 38 | return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) 39 | 40 | 41 | # for the discussion regarding site_config_dir locations 42 | # see 43 | def site_config_dirs(appname: str) -> List[str]: 44 | if sys.platform == "darwin": 45 | return [_appdirs.site_data_dir(appname, appauthor=False, multipath=True)] 46 | 47 | dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True) 48 | if sys.platform == "win32": 49 | return [dirval] 50 | 51 | # Unix-y system. Look in /etc as well. 52 | return dirval.split(os.pathsep) + ["/etc"] 53 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tenacity/after.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Julien Danjou 2 | # Copyright 2016 Joshua Harlow 3 | # Copyright 2013-2014 Ray Holder 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import typing 18 | 19 | from pip._vendor.tenacity import _utils 20 | 21 | if typing.TYPE_CHECKING: 22 | import logging 23 | 24 | from pip._vendor.tenacity import RetryCallState 25 | 26 | 27 | def after_nothing(retry_state: "RetryCallState") -> None: 28 | """After call strategy that does nothing.""" 29 | 30 | 31 | def after_log( 32 | logger: "logging.Logger", 33 | log_level: int, 34 | sec_format: str = "%0.3f", 35 | ) -> typing.Callable[["RetryCallState"], None]: 36 | """After call strategy that logs to some logger the finished attempt.""" 37 | 38 | def log_it(retry_state: "RetryCallState") -> None: 39 | if retry_state.fn is None: 40 | # NOTE(sileht): can't really happen, but we must please mypy 41 | fn_name = "" 42 | else: 43 | fn_name = _utils.get_callback_name(retry_state.fn) 44 | logger.log( 45 | log_level, 46 | f"Finished call to '{fn_name}' " 47 | f"after {sec_format % retry_state.seconds_since_start}(s), " 48 | f"this was the {_utils.to_ordinal(retry_state.attempt_number)} time calling it.", 49 | ) 50 | 51 | return log_it 52 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/file_proxy.py: -------------------------------------------------------------------------------- 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() 58 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/euckrprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import EUCKRDistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import EUCKR_SM_MODEL 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL) 38 | self.distribution_analyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self) -> str: 43 | return "EUC-KR" 44 | 45 | @property 46 | def language(self) -> str: 47 | return "Korean" 48 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/euctwprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import EUCTWDistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import EUCTW_SM_MODEL 32 | 33 | 34 | class EUCTWProber(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL) 38 | self.distribution_analyzer = EUCTWDistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self) -> str: 43 | return "EUC-TW" 44 | 45 | @property 46 | def language(self) -> str: 47 | return "Taiwan" 48 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/johabprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import JOHABDistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import JOHAB_SM_MODEL 32 | 33 | 34 | class JOHABProber(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(JOHAB_SM_MODEL) 38 | self.distribution_analyzer = JOHABDistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self) -> str: 43 | return "Johab" 44 | 45 | @property 46 | def language(self) -> str: 47 | return "Korean" 48 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/commands/hash.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import logging 3 | import sys 4 | from optparse import Values 5 | from typing import List 6 | 7 | from pip._internal.cli.base_command import Command 8 | from pip._internal.cli.status_codes import ERROR, SUCCESS 9 | from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES 10 | from pip._internal.utils.misc import read_chunks, write_output 11 | 12 | logger = logging.getLogger(__name__) 13 | 14 | 15 | class HashCommand(Command): 16 | """ 17 | Compute a hash of a local package archive. 18 | 19 | These can be used with --hash in a requirements file to do repeatable 20 | installs. 21 | """ 22 | 23 | usage = "%prog [options] ..." 24 | ignore_require_venv = True 25 | 26 | def add_options(self) -> None: 27 | self.cmd_opts.add_option( 28 | "-a", 29 | "--algorithm", 30 | dest="algorithm", 31 | choices=STRONG_HASHES, 32 | action="store", 33 | default=FAVORITE_HASH, 34 | help="The hash algorithm to use: one of {}".format( 35 | ", ".join(STRONG_HASHES) 36 | ), 37 | ) 38 | self.parser.insert_option_group(0, self.cmd_opts) 39 | 40 | def run(self, options: Values, args: List[str]) -> int: 41 | if not args: 42 | self.parser.print_usage(sys.stderr) 43 | return ERROR 44 | 45 | algorithm = options.algorithm 46 | for path in args: 47 | write_output( 48 | "%s:\n--hash=%s:%s", path, algorithm, _hash_of_file(path, algorithm) 49 | ) 50 | return SUCCESS 51 | 52 | 53 | def _hash_of_file(path: str, algorithm: str) -> str: 54 | """Return the hash digest of a file.""" 55 | with open(path, "rb") as archive: 56 | hash = hashlib.new(algorithm) 57 | for chunk in read_chunks(archive): 58 | hash.update(chunk) 59 | return hash.hexdigest() 60 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/gb2312prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import GB2312DistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import GB2312_SM_MODEL 32 | 33 | 34 | class GB2312Prober(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(GB2312_SM_MODEL) 38 | self.distribution_analyzer = GB2312DistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self) -> str: 43 | return "GB2312" 44 | 45 | @property 46 | def language(self) -> str: 47 | return "Chinese" 48 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import Big5DistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import BIG5_SM_MODEL 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(BIG5_SM_MODEL) 38 | self.distribution_analyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self) -> str: 43 | return "Big5" 44 | 45 | @property 46 | def language(self) -> str: 47 | return "Chinese" 48 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments/console.py: -------------------------------------------------------------------------------- 1 | """ 2 | pygments.console 3 | ~~~~~~~~~~~~~~~~ 4 | 5 | Format colored console output. 6 | 7 | :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | """ 10 | 11 | esc = "\x1b[" 12 | 13 | codes = {} 14 | codes[""] = "" 15 | codes["reset"] = esc + "39;49;00m" 16 | 17 | codes["bold"] = esc + "01m" 18 | codes["faint"] = esc + "02m" 19 | codes["standout"] = esc + "03m" 20 | codes["underline"] = esc + "04m" 21 | codes["blink"] = esc + "05m" 22 | codes["overline"] = esc + "06m" 23 | 24 | dark_colors = ["black", "red", "green", "yellow", "blue", 25 | "magenta", "cyan", "gray"] 26 | light_colors = ["brightblack", "brightred", "brightgreen", "brightyellow", "brightblue", 27 | "brightmagenta", "brightcyan", "white"] 28 | 29 | x = 30 30 | for d, l in zip(dark_colors, light_colors): 31 | codes[d] = esc + "%im" % x 32 | codes[l] = esc + "%im" % (60 + x) 33 | x += 1 34 | 35 | del d, l, x 36 | 37 | codes["white"] = codes["bold"] 38 | 39 | 40 | def reset_color(): 41 | return codes["reset"] 42 | 43 | 44 | def colorize(color_key, text): 45 | return codes[color_key] + text + codes["reset"] 46 | 47 | 48 | def ansiformat(attr, text): 49 | """ 50 | Format ``text`` with a color and/or some attributes:: 51 | 52 | color normal color 53 | *color* bold color 54 | _color_ underlined color 55 | +color+ blinking color 56 | """ 57 | result = [] 58 | if attr[:1] == attr[-1:] == '+': 59 | result.append(codes['blink']) 60 | attr = attr[1:-1] 61 | if attr[:1] == attr[-1:] == '*': 62 | result.append(codes['bold']) 63 | attr = attr[1:-1] 64 | if attr[:1] == attr[-1:] == '_': 65 | result.append(codes['underline']) 66 | attr = attr[1:-1] 67 | result.append(codes[attr]) 68 | result.append(text) 69 | result.append(codes['reset']) 70 | return ''.join(result) 71 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/commands/check.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from optparse import Values 3 | from typing import List 4 | 5 | from pip._internal.cli.base_command import Command 6 | from pip._internal.cli.status_codes import ERROR, SUCCESS 7 | from pip._internal.operations.check import ( 8 | check_package_set, 9 | create_package_set_from_installed, 10 | warn_legacy_versions_and_specifiers, 11 | ) 12 | from pip._internal.utils.misc import write_output 13 | 14 | logger = logging.getLogger(__name__) 15 | 16 | 17 | class CheckCommand(Command): 18 | """Verify installed packages have compatible dependencies.""" 19 | 20 | usage = """ 21 | %prog [options]""" 22 | 23 | def run(self, options: Values, args: List[str]) -> int: 24 | package_set, parsing_probs = create_package_set_from_installed() 25 | warn_legacy_versions_and_specifiers(package_set) 26 | missing, conflicting = check_package_set(package_set) 27 | 28 | for project_name in missing: 29 | version = package_set[project_name].version 30 | for dependency in missing[project_name]: 31 | write_output( 32 | "%s %s requires %s, which is not installed.", 33 | project_name, 34 | version, 35 | dependency[0], 36 | ) 37 | 38 | for project_name in conflicting: 39 | version = package_set[project_name].version 40 | for dep_name, dep_version, req in conflicting[project_name]: 41 | write_output( 42 | "%s %s has requirement %s, but you have %s %s.", 43 | project_name, 44 | version, 45 | req, 46 | dep_name, 47 | dep_version, 48 | ) 49 | 50 | if missing or conflicting or parsing_probs: 51 | return ERROR 52 | else: 53 | write_output("No broken requirements found.") 54 | return SUCCESS 55 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/urls.py: -------------------------------------------------------------------------------- 1 | import os 2 | import string 3 | import urllib.parse 4 | import urllib.request 5 | from typing import Optional 6 | 7 | from .compat import WINDOWS 8 | 9 | 10 | def get_url_scheme(url: str) -> Optional[str]: 11 | if ":" not in url: 12 | return None 13 | return url.split(":", 1)[0].lower() 14 | 15 | 16 | def path_to_url(path: str) -> str: 17 | """ 18 | Convert a path to a file: URL. The path will be made absolute and have 19 | quoted path parts. 20 | """ 21 | path = os.path.normpath(os.path.abspath(path)) 22 | url = urllib.parse.urljoin("file:", urllib.request.pathname2url(path)) 23 | return url 24 | 25 | 26 | def url_to_path(url: str) -> str: 27 | """ 28 | Convert a file: URL to a path. 29 | """ 30 | assert url.startswith( 31 | "file:" 32 | ), f"You can only turn file: urls into filenames (not {url!r})" 33 | 34 | _, netloc, path, _, _ = urllib.parse.urlsplit(url) 35 | 36 | if not netloc or netloc == "localhost": 37 | # According to RFC 8089, same as empty authority. 38 | netloc = "" 39 | elif WINDOWS: 40 | # If we have a UNC path, prepend UNC share notation. 41 | netloc = "\\\\" + netloc 42 | else: 43 | raise ValueError( 44 | f"non-local file URIs are not supported on this platform: {url!r}" 45 | ) 46 | 47 | path = urllib.request.url2pathname(netloc + path) 48 | 49 | # On Windows, urlsplit parses the path as something like "/C:/Users/foo". 50 | # This creates issues for path-related functions like io.open(), so we try 51 | # to detect and strip the leading slash. 52 | if ( 53 | WINDOWS 54 | and not netloc # Not UNC. 55 | and len(path) >= 3 56 | and path[0] == "/" # Leading slash to strip. 57 | and path[1] in string.ascii_letters # Drive letter. 58 | and path[2:4] in (":", ":/") # Colon + end of string, or colon + absolute path. 59 | ): 60 | path = path[1:] 61 | 62 | return path 63 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/network/xmlrpc.py: -------------------------------------------------------------------------------- 1 | """xmlrpclib.Transport implementation 2 | """ 3 | 4 | import logging 5 | import urllib.parse 6 | import xmlrpc.client 7 | from typing import TYPE_CHECKING, Tuple 8 | 9 | from pip._internal.exceptions import NetworkConnectionError 10 | from pip._internal.network.session import PipSession 11 | from pip._internal.network.utils import raise_for_status 12 | 13 | if TYPE_CHECKING: 14 | from xmlrpc.client import _HostType, _Marshallable 15 | 16 | logger = logging.getLogger(__name__) 17 | 18 | 19 | class PipXmlrpcTransport(xmlrpc.client.Transport): 20 | """Provide a `xmlrpclib.Transport` implementation via a `PipSession` 21 | object. 22 | """ 23 | 24 | def __init__( 25 | self, index_url: str, session: PipSession, use_datetime: bool = False 26 | ) -> None: 27 | super().__init__(use_datetime) 28 | index_parts = urllib.parse.urlparse(index_url) 29 | self._scheme = index_parts.scheme 30 | self._session = session 31 | 32 | def request( 33 | self, 34 | host: "_HostType", 35 | handler: str, 36 | request_body: bytes, 37 | verbose: bool = False, 38 | ) -> Tuple["_Marshallable", ...]: 39 | assert isinstance(host, str) 40 | parts = (self._scheme, host, handler, None, None, None) 41 | url = urllib.parse.urlunparse(parts) 42 | try: 43 | headers = {"Content-Type": "text/xml"} 44 | response = self._session.post( 45 | url, 46 | data=request_body, 47 | headers=headers, 48 | stream=True, 49 | ) 50 | raise_for_status(response) 51 | self.verbose = verbose 52 | return self.parse_response(response.raw) 53 | except NetworkConnectionError as exc: 54 | assert exc.response 55 | logger.critical( 56 | "HTTP error %s while getting %s", 57 | exc.response.status_code, 58 | url, 59 | ) 60 | raise 61 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/cp949prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import EUCKRDistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import CP949_SM_MODEL 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self) -> None: 36 | super().__init__() 37 | self.coding_sm = CodingStateMachine(CP949_SM_MODEL) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self.distribution_analyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | @property 44 | def charset_name(self) -> str: 45 | return "CP949" 46 | 47 | @property 48 | def language(self) -> str: 49 | return "Korean" 50 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/enums.py: -------------------------------------------------------------------------------- 1 | """ 2 | All of the Enums that are used throughout the chardet package. 3 | 4 | :author: Dan Blanchard (dan.blanchard@gmail.com) 5 | """ 6 | 7 | from enum import Enum, Flag 8 | 9 | 10 | class InputState: 11 | """ 12 | This enum represents the different states a universal detector can be in. 13 | """ 14 | 15 | PURE_ASCII = 0 16 | ESC_ASCII = 1 17 | HIGH_BYTE = 2 18 | 19 | 20 | class LanguageFilter(Flag): 21 | """ 22 | This enum represents the different language filters we can apply to a 23 | ``UniversalDetector``. 24 | """ 25 | 26 | NONE = 0x00 27 | CHINESE_SIMPLIFIED = 0x01 28 | CHINESE_TRADITIONAL = 0x02 29 | JAPANESE = 0x04 30 | KOREAN = 0x08 31 | NON_CJK = 0x10 32 | ALL = 0x1F 33 | CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL 34 | CJK = CHINESE | JAPANESE | KOREAN 35 | 36 | 37 | class ProbingState(Enum): 38 | """ 39 | This enum represents the different states a prober can be in. 40 | """ 41 | 42 | DETECTING = 0 43 | FOUND_IT = 1 44 | NOT_ME = 2 45 | 46 | 47 | class MachineState: 48 | """ 49 | This enum represents the different states a state machine can be in. 50 | """ 51 | 52 | START = 0 53 | ERROR = 1 54 | ITS_ME = 2 55 | 56 | 57 | class SequenceLikelihood: 58 | """ 59 | This enum represents the likelihood of a character following the previous one. 60 | """ 61 | 62 | NEGATIVE = 0 63 | UNLIKELY = 1 64 | LIKELY = 2 65 | POSITIVE = 3 66 | 67 | @classmethod 68 | def get_num_categories(cls) -> int: 69 | """:returns: The number of likelihood categories in the enum.""" 70 | return 4 71 | 72 | 73 | class CharacterCategory: 74 | """ 75 | This enum represents the different categories language models for 76 | ``SingleByteCharsetProber`` put characters into. 77 | 78 | Anything less than CONTROL is considered a letter. 79 | """ 80 | 81 | UNDEFINED = 255 82 | LINE_BREAK = 254 83 | SYMBOL = 253 84 | DIGIT = 252 85 | CONTROL = 251 86 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_wrap.py: -------------------------------------------------------------------------------- 1 | import re 2 | from typing import Iterable, List, Tuple 3 | 4 | from ._loop import loop_last 5 | from .cells import cell_len, chop_cells 6 | 7 | re_word = re.compile(r"\s*\S+\s*") 8 | 9 | 10 | def words(text: str) -> Iterable[Tuple[int, int, str]]: 11 | position = 0 12 | word_match = re_word.match(text, position) 13 | while word_match is not None: 14 | start, end = word_match.span() 15 | word = word_match.group(0) 16 | yield start, end, word 17 | word_match = re_word.match(text, end) 18 | 19 | 20 | def divide_line(text: str, width: int, fold: bool = True) -> List[int]: 21 | divides: List[int] = [] 22 | append = divides.append 23 | line_position = 0 24 | _cell_len = cell_len 25 | for start, _end, word in words(text): 26 | word_length = _cell_len(word.rstrip()) 27 | if line_position + word_length > width: 28 | if word_length > width: 29 | if fold: 30 | chopped_words = chop_cells(word, max_size=width, position=0) 31 | for last, line in loop_last(chopped_words): 32 | if start: 33 | append(start) 34 | 35 | if last: 36 | line_position = _cell_len(line) 37 | else: 38 | start += len(line) 39 | else: 40 | if start: 41 | append(start) 42 | line_position = _cell_len(word) 43 | elif line_position and start: 44 | append(start) 45 | line_position = _cell_len(word) 46 | else: 47 | line_position += _cell_len(word) 48 | return divides 49 | 50 | 51 | if __name__ == "__main__": # pragma: no cover 52 | from .console import Console 53 | 54 | console = Console(width=10) 55 | console.print("12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345") 56 | print(chop_cells("abcdefghijklmnopqrstuvwxyz", 10, position=2)) 57 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/idna/intranges.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a list of integers, made up of (hopefully) a small number of long runs 3 | of consecutive integers, compute a representation of the form 4 | ((start1, end1), (start2, end2) ...). Then answer the question "was x present 5 | in the original list?" in time O(log(# runs)). 6 | """ 7 | 8 | import bisect 9 | from typing import List, Tuple 10 | 11 | def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: 12 | """Represent a list of integers as a sequence of ranges: 13 | ((start_0, end_0), (start_1, end_1), ...), such that the original 14 | integers are exactly those x such that start_i <= x < end_i for some i. 15 | 16 | Ranges are encoded as single integers (start << 32 | end), not as tuples. 17 | """ 18 | 19 | sorted_list = sorted(list_) 20 | ranges = [] 21 | last_write = -1 22 | for i in range(len(sorted_list)): 23 | if i+1 < len(sorted_list): 24 | if sorted_list[i] == sorted_list[i+1]-1: 25 | continue 26 | current_range = sorted_list[last_write+1:i+1] 27 | ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) 28 | last_write = i 29 | 30 | return tuple(ranges) 31 | 32 | def _encode_range(start: int, end: int) -> int: 33 | return (start << 32) | end 34 | 35 | def _decode_range(r: int) -> Tuple[int, int]: 36 | return (r >> 32), (r & ((1 << 32) - 1)) 37 | 38 | 39 | def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: 40 | """Determine if `int_` falls into one of the ranges in `ranges`.""" 41 | tuple_ = _encode_range(int_, 0) 42 | pos = bisect.bisect_left(ranges, tuple_) 43 | # we could be immediately ahead of a tuple (start, end) 44 | # with start < int_ <= end 45 | if pos > 0: 46 | left, right = _decode_range(ranges[pos-1]) 47 | if left <= int_ < right: 48 | return True 49 | # or we could be immediately behind a tuple (int_, end) 50 | if pos < len(ranges): 51 | left, _ = _decode_range(ranges[pos]) 52 | if left == int_: 53 | return True 54 | return False 55 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/metadata/importlib/_compat.py: -------------------------------------------------------------------------------- 1 | import importlib.metadata 2 | from typing import Any, Optional, Protocol, cast 3 | 4 | 5 | class BadMetadata(ValueError): 6 | def __init__(self, dist: importlib.metadata.Distribution, *, reason: str) -> None: 7 | self.dist = dist 8 | self.reason = reason 9 | 10 | def __str__(self) -> str: 11 | return f"Bad metadata in {self.dist} ({self.reason})" 12 | 13 | 14 | class BasePath(Protocol): 15 | """A protocol that various path objects conform. 16 | 17 | This exists because importlib.metadata uses both ``pathlib.Path`` and 18 | ``zipfile.Path``, and we need a common base for type hints (Union does not 19 | work well since ``zipfile.Path`` is too new for our linter setup). 20 | 21 | This does not mean to be exhaustive, but only contains things that present 22 | in both classes *that we need*. 23 | """ 24 | 25 | @property 26 | def name(self) -> str: 27 | raise NotImplementedError() 28 | 29 | @property 30 | def parent(self) -> "BasePath": 31 | raise NotImplementedError() 32 | 33 | 34 | def get_info_location(d: importlib.metadata.Distribution) -> Optional[BasePath]: 35 | """Find the path to the distribution's metadata directory. 36 | 37 | HACK: This relies on importlib.metadata's private ``_path`` attribute. Not 38 | all distributions exist on disk, so importlib.metadata is correct to not 39 | expose the attribute as public. But pip's code base is old and not as clean, 40 | so we do this to avoid having to rewrite too many things. Hopefully we can 41 | eliminate this some day. 42 | """ 43 | return getattr(d, "_path", None) 44 | 45 | 46 | def get_dist_name(dist: importlib.metadata.Distribution) -> str: 47 | """Get the distribution's project name. 48 | 49 | The ``name`` attribute is only available in Python 3.10 or later. We are 50 | targeting exactly that, but Mypy does not know this. 51 | """ 52 | name = cast(Any, dist).name 53 | if not isinstance(name, str): 54 | raise BadMetadata(dist, reason="invalid metadata entry 'name'") 55 | return name 56 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/models/selection_prefs.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from pip._internal.models.format_control import FormatControl 4 | 5 | 6 | class SelectionPreferences: 7 | """ 8 | Encapsulates the candidate selection preferences for downloading 9 | and installing files. 10 | """ 11 | 12 | __slots__ = [ 13 | "allow_yanked", 14 | "allow_all_prereleases", 15 | "format_control", 16 | "prefer_binary", 17 | "ignore_requires_python", 18 | ] 19 | 20 | # Don't include an allow_yanked default value to make sure each call 21 | # site considers whether yanked releases are allowed. This also causes 22 | # that decision to be made explicit in the calling code, which helps 23 | # people when reading the code. 24 | def __init__( 25 | self, 26 | allow_yanked: bool, 27 | allow_all_prereleases: bool = False, 28 | format_control: Optional[FormatControl] = None, 29 | prefer_binary: bool = False, 30 | ignore_requires_python: Optional[bool] = None, 31 | ) -> None: 32 | """Create a SelectionPreferences object. 33 | 34 | :param allow_yanked: Whether files marked as yanked (in the sense 35 | of PEP 592) are permitted to be candidates for install. 36 | :param format_control: A FormatControl object or None. Used to control 37 | the selection of source packages / binary packages when consulting 38 | the index and links. 39 | :param prefer_binary: Whether to prefer an old, but valid, binary 40 | dist over a new source dist. 41 | :param ignore_requires_python: Whether to ignore incompatible 42 | "Requires-Python" values in links. Defaults to False. 43 | """ 44 | if ignore_requires_python is None: 45 | ignore_requires_python = False 46 | 47 | self.allow_yanked = allow_yanked 48 | self.allow_all_prereleases = allow_all_prereleases 49 | self.format_control = format_control 50 | self.prefer_binary = prefer_binary 51 | self.ignore_requires_python = ignore_requires_python 52 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/compat.py: -------------------------------------------------------------------------------- 1 | """Stuff that differs in different Python versions and platform 2 | distributions.""" 3 | 4 | import logging 5 | import os 6 | import sys 7 | 8 | __all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"] 9 | 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | 14 | def has_tls() -> bool: 15 | try: 16 | import _ssl # noqa: F401 # ignore unused 17 | 18 | return True 19 | except ImportError: 20 | pass 21 | 22 | from pip._vendor.urllib3.util import IS_PYOPENSSL 23 | 24 | return IS_PYOPENSSL 25 | 26 | 27 | def get_path_uid(path: str) -> int: 28 | """ 29 | Return path's uid. 30 | 31 | Does not follow symlinks: 32 | https://github.com/pypa/pip/pull/935#discussion_r5307003 33 | 34 | Placed this function in compat due to differences on AIX and 35 | Jython, that should eventually go away. 36 | 37 | :raises OSError: When path is a symlink or can't be read. 38 | """ 39 | if hasattr(os, "O_NOFOLLOW"): 40 | fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) 41 | file_uid = os.fstat(fd).st_uid 42 | os.close(fd) 43 | else: # AIX and Jython 44 | # WARNING: time of check vulnerability, but best we can do w/o NOFOLLOW 45 | if not os.path.islink(path): 46 | # older versions of Jython don't have `os.fstat` 47 | file_uid = os.stat(path).st_uid 48 | else: 49 | # raise OSError for parity with os.O_NOFOLLOW above 50 | raise OSError(f"{path} is a symlink; Will not return uid for symlinks") 51 | return file_uid 52 | 53 | 54 | # packages in the stdlib that may have installation metadata, but should not be 55 | # considered 'installed'. this theoretically could be determined based on 56 | # dist.location (py27:`sysconfig.get_paths()['stdlib']`, 57 | # py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may 58 | # make this ineffective, so hard-coding 59 | stdlib_pkgs = {"python", "wsgiref", "argparse"} 60 | 61 | 62 | # windows detection, covers cpython and ironpython 63 | WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt") 64 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/rich/_windows.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from dataclasses import dataclass 3 | 4 | 5 | @dataclass 6 | class WindowsConsoleFeatures: 7 | """Windows features available.""" 8 | 9 | vt: bool = False 10 | """The console supports VT codes.""" 11 | truecolor: bool = False 12 | """The console supports truecolor.""" 13 | 14 | 15 | try: 16 | import ctypes 17 | from ctypes import LibraryLoader 18 | 19 | if sys.platform == "win32": 20 | windll = LibraryLoader(ctypes.WinDLL) 21 | else: 22 | windll = None 23 | raise ImportError("Not windows") 24 | 25 | from pip._vendor.rich._win32_console import ( 26 | ENABLE_VIRTUAL_TERMINAL_PROCESSING, 27 | GetConsoleMode, 28 | GetStdHandle, 29 | LegacyWindowsError, 30 | ) 31 | 32 | except (AttributeError, ImportError, ValueError): 33 | 34 | # Fallback if we can't load the Windows DLL 35 | def get_windows_console_features() -> WindowsConsoleFeatures: 36 | features = WindowsConsoleFeatures() 37 | return features 38 | 39 | else: 40 | 41 | def get_windows_console_features() -> WindowsConsoleFeatures: 42 | """Get windows console features. 43 | 44 | Returns: 45 | WindowsConsoleFeatures: An instance of WindowsConsoleFeatures. 46 | """ 47 | handle = GetStdHandle() 48 | try: 49 | console_mode = GetConsoleMode(handle) 50 | success = True 51 | except LegacyWindowsError: 52 | console_mode = 0 53 | success = False 54 | vt = bool(success and console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) 55 | truecolor = False 56 | if vt: 57 | win_version = sys.getwindowsversion() 58 | truecolor = win_version.major > 10 or ( 59 | win_version.major == 10 and win_version.build >= 15063 60 | ) 61 | features = WindowsConsoleFeatures(vt=vt, truecolor=truecolor) 62 | return features 63 | 64 | 65 | if __name__ == "__main__": 66 | import platform 67 | 68 | features = get_windows_console_features() 69 | from pip._vendor.rich import print 70 | 71 | print(f'platform="{platform.system()}"') 72 | print(repr(features)) 73 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/pygments/filter.py: -------------------------------------------------------------------------------- 1 | """ 2 | pygments.filter 3 | ~~~~~~~~~~~~~~~ 4 | 5 | Module that implements the default filter. 6 | 7 | :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | """ 10 | 11 | 12 | def apply_filters(stream, filters, lexer=None): 13 | """ 14 | Use this method to apply an iterable of filters to 15 | a stream. If lexer is given it's forwarded to the 16 | filter, otherwise the filter receives `None`. 17 | """ 18 | def _apply(filter_, stream): 19 | yield from filter_.filter(lexer, stream) 20 | for filter_ in filters: 21 | stream = _apply(filter_, stream) 22 | return stream 23 | 24 | 25 | def simplefilter(f): 26 | """ 27 | Decorator that converts a function into a filter:: 28 | 29 | @simplefilter 30 | def lowercase(self, lexer, stream, options): 31 | for ttype, value in stream: 32 | yield ttype, value.lower() 33 | """ 34 | return type(f.__name__, (FunctionFilter,), { 35 | '__module__': getattr(f, '__module__'), 36 | '__doc__': f.__doc__, 37 | 'function': f, 38 | }) 39 | 40 | 41 | class Filter: 42 | """ 43 | Default filter. Subclass this class or use the `simplefilter` 44 | decorator to create own filters. 45 | """ 46 | 47 | def __init__(self, **options): 48 | self.options = options 49 | 50 | def filter(self, lexer, stream): 51 | raise NotImplementedError() 52 | 53 | 54 | class FunctionFilter(Filter): 55 | """ 56 | Abstract class used by `simplefilter` to create simple 57 | function filters on the fly. The `simplefilter` decorator 58 | automatically creates subclasses of this class for 59 | functions passed to it. 60 | """ 61 | function = None 62 | 63 | def __init__(self, **options): 64 | if not hasattr(self, 'function'): 65 | raise TypeError('%r used without bound function' % 66 | self.__class__.__name__) 67 | Filter.__init__(self, **options) 68 | 69 | def filter(self, lexer, stream): 70 | # pylint: disable=not-callable 71 | yield from self.function(lexer, stream, self.options) 72 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/cli/progress_bars.py: -------------------------------------------------------------------------------- 1 | import functools 2 | from typing import Callable, Generator, Iterable, Iterator, Optional, Tuple 3 | 4 | from pip._vendor.rich.progress import ( 5 | BarColumn, 6 | DownloadColumn, 7 | FileSizeColumn, 8 | Progress, 9 | ProgressColumn, 10 | SpinnerColumn, 11 | TextColumn, 12 | TimeElapsedColumn, 13 | TimeRemainingColumn, 14 | TransferSpeedColumn, 15 | ) 16 | 17 | from pip._internal.utils.logging import get_indentation 18 | 19 | DownloadProgressRenderer = Callable[[Iterable[bytes]], Iterator[bytes]] 20 | 21 | 22 | def _rich_progress_bar( 23 | iterable: Iterable[bytes], 24 | *, 25 | bar_type: str, 26 | size: int, 27 | ) -> Generator[bytes, None, None]: 28 | assert bar_type == "on", "This should only be used in the default mode." 29 | 30 | if not size: 31 | total = float("inf") 32 | columns: Tuple[ProgressColumn, ...] = ( 33 | TextColumn("[progress.description]{task.description}"), 34 | SpinnerColumn("line", speed=1.5), 35 | FileSizeColumn(), 36 | TransferSpeedColumn(), 37 | TimeElapsedColumn(), 38 | ) 39 | else: 40 | total = size 41 | columns = ( 42 | TextColumn("[progress.description]{task.description}"), 43 | BarColumn(), 44 | DownloadColumn(), 45 | TransferSpeedColumn(), 46 | TextColumn("eta"), 47 | TimeRemainingColumn(), 48 | ) 49 | 50 | progress = Progress(*columns, refresh_per_second=30) 51 | task_id = progress.add_task(" " * (get_indentation() + 2), total=total) 52 | with progress: 53 | for chunk in iterable: 54 | yield chunk 55 | progress.update(task_id, advance=len(chunk)) 56 | 57 | 58 | def get_download_progress_renderer( 59 | *, bar_type: str, size: Optional[int] = None 60 | ) -> DownloadProgressRenderer: 61 | """Get an object that can be used to render the download progress. 62 | 63 | Returns a callable, that takes an iterable to "wrap". 64 | """ 65 | if bar_type == "on": 66 | return functools.partial(_rich_progress_bar, bar_type=bar_type, size=size) 67 | else: 68 | return iter # no-op, when passed an iterator 69 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/packaging.py: -------------------------------------------------------------------------------- 1 | import functools 2 | import logging 3 | import re 4 | from typing import NewType, Optional, Tuple, cast 5 | 6 | from pip._vendor.packaging import specifiers, version 7 | from pip._vendor.packaging.requirements import Requirement 8 | 9 | NormalizedExtra = NewType("NormalizedExtra", str) 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | 14 | def check_requires_python( 15 | requires_python: Optional[str], version_info: Tuple[int, ...] 16 | ) -> bool: 17 | """ 18 | Check if the given Python version matches a "Requires-Python" specifier. 19 | 20 | :param version_info: A 3-tuple of ints representing a Python 21 | major-minor-micro version to check (e.g. `sys.version_info[:3]`). 22 | 23 | :return: `True` if the given Python version satisfies the requirement. 24 | Otherwise, return `False`. 25 | 26 | :raises InvalidSpecifier: If `requires_python` has an invalid format. 27 | """ 28 | if requires_python is None: 29 | # The package provides no information 30 | return True 31 | requires_python_specifier = specifiers.SpecifierSet(requires_python) 32 | 33 | python_version = version.parse(".".join(map(str, version_info))) 34 | return python_version in requires_python_specifier 35 | 36 | 37 | @functools.lru_cache(maxsize=512) 38 | def get_requirement(req_string: str) -> Requirement: 39 | """Construct a packaging.Requirement object with caching""" 40 | # Parsing requirement strings is expensive, and is also expected to happen 41 | # with a low diversity of different arguments (at least relative the number 42 | # constructed). This method adds a cache to requirement object creation to 43 | # minimize repeated parsing of the same string to construct equivalent 44 | # Requirement objects. 45 | return Requirement(req_string) 46 | 47 | 48 | def safe_extra(extra: str) -> NormalizedExtra: 49 | """Convert an arbitrary string to a standard 'extra' name 50 | 51 | Any runs of non-alphanumeric characters are replaced with a single '_', 52 | and the result is always lowercased. 53 | 54 | This function is duplicated from ``pkg_resources``. Note that this is not 55 | the same to either ``canonicalize_name`` or ``_egg_link_name``. 56 | """ 57 | return cast(NormalizedExtra, re.sub("[^A-Za-z0-9.-]+", "_", extra).lower()) 58 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/chardet/mbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .big5prober import Big5Prober 31 | from .charsetgroupprober import CharSetGroupProber 32 | from .cp949prober import CP949Prober 33 | from .enums import LanguageFilter 34 | from .eucjpprober import EUCJPProber 35 | from .euckrprober import EUCKRProber 36 | from .euctwprober import EUCTWProber 37 | from .gb2312prober import GB2312Prober 38 | from .johabprober import JOHABProber 39 | from .sjisprober import SJISProber 40 | from .utf8prober import UTF8Prober 41 | 42 | 43 | class MBCSGroupProber(CharSetGroupProber): 44 | def __init__(self, lang_filter: LanguageFilter = LanguageFilter.NONE) -> None: 45 | super().__init__(lang_filter=lang_filter) 46 | self.probers = [ 47 | UTF8Prober(), 48 | SJISProber(), 49 | EUCJPProber(), 50 | GB2312Prober(), 51 | EUCKRProber(), 52 | CP949Prober(), 53 | Big5Prober(), 54 | EUCTWProber(), 55 | JOHABProber(), 56 | ] 57 | self.reset() 58 | -------------------------------------------------------------------------------- /pur/packages/pip/_vendor/tenacity/tornadoweb.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Elisey Zanko 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import sys 16 | import typing 17 | 18 | from pip._vendor.tenacity import BaseRetrying 19 | from pip._vendor.tenacity import DoAttempt 20 | from pip._vendor.tenacity import DoSleep 21 | from pip._vendor.tenacity import RetryCallState 22 | 23 | from tornado import gen 24 | 25 | if typing.TYPE_CHECKING: 26 | from tornado.concurrent import Future 27 | 28 | _RetValT = typing.TypeVar("_RetValT") 29 | 30 | 31 | class TornadoRetrying(BaseRetrying): 32 | def __init__(self, sleep: "typing.Callable[[float], Future[None]]" = gen.sleep, **kwargs: typing.Any) -> None: 33 | super().__init__(**kwargs) 34 | self.sleep = sleep 35 | 36 | @gen.coroutine # type: ignore[misc] 37 | def __call__( 38 | self, 39 | fn: "typing.Callable[..., typing.Union[typing.Generator[typing.Any, typing.Any, _RetValT], Future[_RetValT]]]", 40 | *args: typing.Any, 41 | **kwargs: typing.Any, 42 | ) -> "typing.Generator[typing.Any, typing.Any, _RetValT]": 43 | self.begin() 44 | 45 | retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs) 46 | while True: 47 | do = self.iter(retry_state=retry_state) 48 | if isinstance(do, DoAttempt): 49 | try: 50 | result = yield fn(*args, **kwargs) 51 | except BaseException: # noqa: B902 52 | retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type] 53 | else: 54 | retry_state.set_result(result) 55 | elif isinstance(do, DoSleep): 56 | retry_state.prepare_for_next_attempt() 57 | yield self.sleep(do) 58 | else: 59 | raise gen.Return(do) 60 | -------------------------------------------------------------------------------- /pur/packages/pip/_internal/utils/egg_link.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import sys 4 | from typing import List, Optional 5 | 6 | from pip._internal.locations import site_packages, user_site 7 | from pip._internal.utils.virtualenv import ( 8 | running_under_virtualenv, 9 | virtualenv_no_global, 10 | ) 11 | 12 | __all__ = [ 13 | "egg_link_path_from_sys_path", 14 | "egg_link_path_from_location", 15 | ] 16 | 17 | 18 | def _egg_link_name(raw_name: str) -> str: 19 | """ 20 | Convert a Name metadata value to a .egg-link name, by applying 21 | the same substitution as pkg_resources's safe_name function. 22 | Note: we cannot use canonicalize_name because it has a different logic. 23 | """ 24 | return re.sub("[^A-Za-z0-9.]+", "-", raw_name) + ".egg-link" 25 | 26 | 27 | def egg_link_path_from_sys_path(raw_name: str) -> Optional[str]: 28 | """ 29 | Look for a .egg-link file for project name, by walking sys.path. 30 | """ 31 | egg_link_name = _egg_link_name(raw_name) 32 | for path_item in sys.path: 33 | egg_link = os.path.join(path_item, egg_link_name) 34 | if os.path.isfile(egg_link): 35 | return egg_link 36 | return None 37 | 38 | 39 | def egg_link_path_from_location(raw_name: str) -> Optional[str]: 40 | """ 41 | Return the path for the .egg-link file if it exists, otherwise, None. 42 | 43 | There's 3 scenarios: 44 | 1) not in a virtualenv 45 | try to find in site.USER_SITE, then site_packages 46 | 2) in a no-global virtualenv 47 | try to find in site_packages 48 | 3) in a yes-global virtualenv 49 | try to find in site_packages, then site.USER_SITE 50 | (don't look in global location) 51 | 52 | For #1 and #3, there could be odd cases, where there's an egg-link in 2 53 | locations. 54 | 55 | This method will just return the first one found. 56 | """ 57 | sites: List[str] = [] 58 | if running_under_virtualenv(): 59 | sites.append(site_packages) 60 | if not virtualenv_no_global() and user_site: 61 | sites.append(user_site) 62 | else: 63 | if user_site: 64 | sites.append(user_site) 65 | sites.append(site_packages) 66 | 67 | egg_link_name = _egg_link_name(raw_name) 68 | for site in sites: 69 | egglink = os.path.join(site, egg_link_name) 70 | if os.path.isfile(egglink): 71 | return egglink 72 | return None 73 | --------------------------------------------------------------------------------